Skip to content

The agent that grows with you

fix(tui): /logs shows the shared-gateway attach line where main showed its spawn line

Teknium1c23079f9484
diff --git a/ui-tui/src/__tests__/gatewayClient.test.ts b/ui-tui/src/__tests__/gatewayClient.test.ts
index 97848f4c1c4..7c4e2ac9682 100644
--- a/ui-tui/src/__tests__/gatewayClient.test.ts
+++ b/ui-tui/src/__tests__/gatewayClient.test.ts
@@ -178,6 +178,28 @@ describe('GatewayClient websocket attach mode', () => {
}
})
+ it('/logs carries the attach lifecycle like main\'s sidecar spawn line (row 24)', async () => {
+ vi.useFakeTimers()
+ delete process.env.HERMES_TUI_GATEWAY_URL
+ delete process.env.HERMES_TUI_SIDECAR_URL
+ const gw = new GatewayClient(async () => ({
+ url: 'ws://127.0.0.1:9/api/ws?token=secret', protocols: [], instance_id: 'owner-1', profile_id: '/home/u/.hermes/profiles/work'
+ }))
+
+ try {
+ gw.start()
+ await vi.advanceTimersByTimeAsync(0)
+ const tail = gw.getLogTail(20)
+ expect(tail).toMatch(/^\[lifecycle\] attached shared gateway /m)
+ expect(tail).toContain('profile=/home/u/.hermes/profiles/work')
+ expect(tail).toContain('instance=owner-1')
+ expect(tail).not.toContain('secret')
+ } finally {
+ gw.kill()
+ vi.useRealTimers()
+ }
+ })
+
it("boots the owner's profile skin: runtime.describe.skin rides the client-local ready (row 3)", async () => {
vi.useFakeTimers()
delete process.env.HERMES_TUI_GATEWAY_URL
diff --git a/ui-tui/src/gatewayClient.ts b/ui-tui/src/gatewayClient.ts
index 30859ef4167..ddcc8c38f5f 100644
--- a/ui-tui/src/gatewayClient.ts
+++ b/ui-tui/src/gatewayClient.ts
@@ -593,6 +593,9 @@ export class GatewayClient extends EventEmitter {
if (this.disposed || generation !== this.localGeneration) { return }
this.attachUrl = grant.url
this.isCanonical = true
+ // Main's /logs opened with the sidecar's spawn line; the shared owner's equivalent is the attach.
+ this.lifecycle(`[lifecycle] attached shared gateway ${start ? 'start' : recover ? 'recover' : 'discover'} ` +
+ `url=${redactUrl(grant.url)} profile=${grant.profile_id} instance=${grant.instance_id}`)
this.startAttachedGateway(grant.url, grant.protocols)
}).catch(error => {
if (this.disposed || generation !== this.localGeneration) { return }