Skip to content

The agent that grows with you

fix(tui): the banner shows main's 8-character session label for a canonical id

Teknium2c97990051a6
diff --git a/ui-tui/src/components/appLayout.tsx b/ui-tui/src/components/appLayout.tsx
index 2808ae5ccd0..cc92dc9f28c 100644
--- a/ui-tui/src/components/appLayout.tsx
+++ b/ui-tui/src/components/appLayout.tsx
@@ -24,6 +24,7 @@ import {
} from '../lib/inputMetrics.js'
import { PerfPane } from '../lib/perfPane.js'
import { composerPromptText } from '../lib/prompt.js'
+import { sessionLabel } from '../lib/sessionLabel.js'
import { ActiveWidgetSlot, AmbientDock, AmbientRail, useAmbientRailWidth } from '../sdk/host.js'
import { AgentsOverlay } from './agentsOverlay.js'
@@ -216,7 +217,7 @@ const TranscriptPane = memo(function TranscriptPane({
<SessionPanel
info={row.msg.info}
maxWidth={Math.max(1, composer.cols - 2)}
- sid={ui.sid}
+ sid={sessionLabel(ui.sid)}
t={ui.theme}
/>
)}
diff --git a/ui-tui/src/lib/sessionLabel.test.ts b/ui-tui/src/lib/sessionLabel.test.ts
new file mode 100644
index 00000000000..256bc435b21
--- /dev/null
+++ b/ui-tui/src/lib/sessionLabel.test.ts
@@ -0,0 +1,15 @@
+import { describe, expect, it } from 'vitest'
+
+import { sessionLabel } from './sessionLabel.js'
+
+describe('sessionLabel', () => {
+ it("shows a canonical durable id as main's 8-character label", () => {
+ expect(sessionLabel(`local-${'ab12cd34'}${'0'.repeat(56)}`)).toBe('ab12cd34')
+ })
+
+ it('leaves every other id as it is', () => {
+ expect(sessionLabel('a707d4c3')).toBe('a707d4c3')
+ expect(sessionLabel('20261012_134501_abcdef')).toBe('20261012_134501_abcdef')
+ expect(sessionLabel(null)).toBeNull()
+ })
+})
diff --git a/ui-tui/src/lib/sessionLabel.ts b/ui-tui/src/lib/sessionLabel.ts
new file mode 100644
index 00000000000..6865d43dfc1
--- /dev/null
+++ b/ui-tui/src/lib/sessionLabel.ts
@@ -0,0 +1,6 @@
+// The canonical owner names a session by its durable id (`local-` + 64 hex). The banner shows
+// main's short 8-character label; the full id stays in state for every RPC.
+const CANONICAL_LOCAL_ID = /^local-([0-9a-f]{8})[0-9a-f]{56}$/
+
+export const sessionLabel = (sid: null | string | undefined): null | string | undefined =>
+ sid ? (CANONICAL_LOCAL_ID.exec(sid)?.[1] ?? sid) : sid