fix: send sync message with workstation name after hello
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -145,9 +145,14 @@ export const setupAgentWsRoute: FastifyPluginAsync = async (fastify) => {
|
||||
if (msg.type === 'hello') {
|
||||
console.log(`[agent-ws] Hello from ${msg.agent_id} (${wsId})`)
|
||||
db.query(
|
||||
'UPDATE workstations SET agent_version = $1, hostname = COALESCE($2, hostname) WHERE id = $3',
|
||||
'UPDATE workstations SET agent_version = $1, hostname = COALESCE($2, hostname) WHERE id = $3 RETURNING name',
|
||||
[msg.version ?? null, msg.hostname ?? null, wsId],
|
||||
).catch(() => {})
|
||||
).then(({ rows }) => {
|
||||
// Отправляем агенту актуальное имя рабочего места
|
||||
if (rows[0]?.name) {
|
||||
socket.send(JSON.stringify({ type: 'sync', workstation_name: rows[0].name }))
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
} catch {}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user