The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: TypeScript casts + backend-ready test updates for { port, token } return
kshitijk4poor71e2924c5f45
diff --git a/apps/desktop/electron/backend-ready.test.ts b/apps/desktop/electron/backend-ready.test.tsindex b51987a773b..63d02bf16cf 100644--- a/apps/desktop/electron/backend-ready.test.ts+++ b/apps/desktop/electron/backend-ready.test.ts@@ -89,14 +89,14 @@ test('resolves with the announced port', async () => {const child = makeFakeChild()const p = waitForDashboardPort(child, 1000)child.stdout.emit('data', 'noise before\nHERMES_DASHBOARD_READY port=54321\n')- assert.equal(await p, 54321)+ assert.deepEqual(await p, { port: 54321, token: undefined })})test('resolves with a HERMES_BACKEND_READY port (headless `serve`)', async () => {const child = makeFakeChild()const p = waitForDashboardPort(child, 1000)child.stdout.emit('data', 'HERMES_BACKEND_READY port=43210\n')- assert.equal(await p, 43210)+ assert.deepEqual(await p, { port: 43210, token: undefined })})test('parses the port even when the line arrives split across chunks', async () => {@@ -104,7 +104,7 @@ test('parses the port even when the line arrives split across chunks', async ()const p = waitForDashboardPort(child, 1000)child.stdout.emit('data', 'HERMES_DASHBOARD_READY po')child.stdout.emit('data', 'rt=8080\n')- assert.equal(await p, 8080)+ assert.deepEqual(await p, { port: 8080, token: undefined })})test('rejects when the child exits before announcing', async () => {@@ -185,7 +185,7 @@ test('waitForDashboardReadyFile resolves when the ready file appears', async ()try {const p = waitForDashboardReadyFile(tmp.file, child, 1000)setTimeout(() => fs.writeFileSync(tmp.file, JSON.stringify({ port: 8765 })), 20)- assert.equal(await p, 8765)+ assert.deepEqual(await p, { port: 8765 })} finally {tmp.cleanup()}@@ -198,7 +198,7 @@ test('waitForDashboardPortAnnouncement uses ready file when provided', async ()try {const p = waitForDashboardPortAnnouncement(child, { readyFile: tmp.file, timeoutMs: 1000 })setTimeout(() => fs.writeFileSync(tmp.file, JSON.stringify({ port: 9876 })), 20)- assert.equal(await p, 9876)+ assert.deepEqual(await p, { port: 9876 })} finally {tmp.cleanup()}@@ -260,3 +260,17 @@ test('exit-before-announcement error stays clean when no output was buffered', areturn true})})++test('resolves with the token when the ready line includes one (--ws-only)', async () => {+ const child = makeFakeChild()+ const p = waitForDashboardPort(child, 1000)+ child.stdout.emit('data', 'HERMES_BACKEND_READY port=9999 token=abc123-def456\n')+ assert.deepEqual(await p, { port: 9999, token: 'abc123-def456' })+})++test('token is undefined when the ready line omits it (dashboard path)', async () => {+ const child = makeFakeChild()+ const p = waitForDashboardPort(child, 1000)+ child.stdout.emit('data', 'HERMES_DASHBOARD_READY port=7777\n')+ assert.deepEqual(await p, { port: 7777, token: undefined })+})diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.tsindex 2bfa9d3e6f3..fdb6cd2244a 100644--- a/apps/desktop/electron/main.ts+++ b/apps/desktop/electron/main.ts@@ -10638,7 +10638,7 @@ async function spawnPoolBackend(profile, entry, opts: { forceLocal?: boolean; poconst announced = await Promise.race([waitForDashboardPortAnnouncement(child, { describeOutputTail: () => outputTail.describe(), readyFile }),startFailed- ])+ ]) as { port: number; token?: string }const port = announced.port// The slim --ws-only server emits its token on the ready line; the@@ -11102,7 +11102,7 @@ async function startHermes() {readyFile}),backendStartFailed- ])+ ]) as { port: number; token?: string }const port = announced.portconst announcedToken = announced.token