The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tui): Ink /status reads through the shared gateway; /save, /bg, /btw refuse in words
Teknium93017ec678e7
diff --git a/ui-tui/src/__tests__/canonicalSlashCommands.test.ts b/ui-tui/src/__tests__/canonicalSlashCommands.test.tsindex 0d0084d8ef3..56b098c4ca4 100644--- a/ui-tui/src/__tests__/canonicalSlashCommands.test.ts+++ b/ui-tui/src/__tests__/canonicalSlashCommands.test.ts@@ -47,23 +47,28 @@ function harness() {return { launch_request: { toolsets: ['terminal', 'web'] } }}+ if (method === 'slash.exec' && params.command === 'status') {+ return { output: 'Session: owner' }+ }+throw new Error(`unknown_method: ${method}`)})const sys = vi.fn()const send = vi.fn()const panel = vi.fn()+ const page = vi.fn()const ctx = {slashFlightRef: { current: 0 },gateway: { gw: { isCanonical: true, request }, rpc: request },- transcript: { panel, send, sys, setHistoryItems: vi.fn(), trimLastExchange: (items: unknown[]) => items },- local: { getLastUserMsg: () => 'typed elsewhere', maybeWarn: vi.fn() },+ transcript: { page, panel, send, sys, setHistoryItems: vi.fn(), trimLastExchange: (items: unknown[]) => items },+ local: { getHistoryItems: () => messages, getLastUserMsg: () => 'typed elsewhere', maybeWarn: vi.fn() },session: { resumeById: vi.fn() },composer: { enqueue: vi.fn() }}- return { panel, request, send, slash: createSlashHandler(ctx as any), sys }+ return { page, panel, request, send, slash: createSlashHandler(ctx as any), sys }}beforeEach(() => {@@ -131,3 +136,30 @@ it('/usage renders the committed turn result and /tools says what the shared gatexpect(sys.mock.calls.some(([line]) => /request_failed|unsupported_command|unknown_method/.test(line))).toBe(false)expect(request.mock.calls.some(([method]) => LEGACY.includes(method))).toBe(false)})++it('/status reads through the gateway; /save, /bg and /btw refuse instead of calling sidecar-only RPCs', async () => {+ const { page, request, slash, sys } = harness()++ slash('/status')+ await flush()+ expect(request).toHaveBeenCalledWith('slash.exec', { command: 'status', session_id: 'owner' })+ expect(page).toHaveBeenCalledWith('Session: owner', expect.any(String))++ for (const cmd of ['/save', '/bg check the logs', '/btw what was that']) {+ slash(cmd)+ }++ await flush()++ const methods = request.mock.calls.map(([method]) => method)++ for (const method of ['session.status', 'session.save', 'prompt.background', 'prompt.btw']) {+ expect(methods).not.toContain(method)+ }++ const notices = sys.mock.calls.map(([text]) => String(text))++ for (const name of ['save', 'bg', 'btw']) {+ expect(notices).toContain(`/${name} is not available on the shared gateway yet`)+ }+})diff --git a/ui-tui/src/app/slash/commands/core.ts b/ui-tui/src/app/slash/commands/core.tsindex 567bccbade3..0700b238e9e 100644--- a/ui-tui/src/app/slash/commands/core.ts+++ b/ui-tui/src/app/slash/commands/core.ts@@ -12,6 +12,7 @@ import type {SessionSteerResponse,SessionTitleResponse,SessionUndoResponse,+ SlashExecResponse,SystemBatteryResponse} from '../../../gatewayTypes.js'import { t } from '../../../i18n/runtime.js'@@ -227,6 +228,20 @@ export const coreCommands: SlashCommand[] = [return ctx.transcript.sys(t('slashCmd.core.status.noActiveSession'))}+ if (ctx.gateway.gw?.isCanonical) {+ // The shared gateway serves /status as a session read; session.status is a legacy sidecar RPC.+ ctx.gateway.gw+ .request<SlashExecResponse>('slash.exec', { command: 'status', session_id: ctx.sid })+ .then(r => {+ if (!ctx.stale()) {+ ctx.transcript.page(r?.output || t('slashCmd.core.status.empty'), t('slashCmd.core.status.pageTitle'))+ }+ })+ .catch(ctx.guardedErr)++ return+ }+ctx.gateway.rpc<SessionStatusResponse>('session.status', { session_id: ctx.sid }).then(@@ -573,6 +588,10 @@ export const coreCommands: SlashCommand[] = [return ctx.transcript.sys(t('slashCmd.core.save.noActiveSession'))}+ if (ctx.gateway.gw?.isCanonical) {+ return ctx.transcript.sys(t('canonical.controls.notAvailable', 'save'))+ }+ctx.gateway.rpc<SessionSaveResponse>('session.save', { session_id: ctx.sid }).then(diff --git a/ui-tui/src/app/slash/commands/session.ts b/ui-tui/src/app/slash/commands/session.tsindex 8cd8a328dda..a978b3d559f 100644--- a/ui-tui/src/app/slash/commands/session.ts+++ b/ui-tui/src/app/slash/commands/session.ts@@ -116,6 +116,10 @@ export const sessionCommands: SlashCommand[] = [return ctx.transcript.sys(t('slashCmd.session.bg.usage'))}+ if (ctx.gateway.gw?.isCanonical) {+ return ctx.transcript.sys(t('canonical.controls.notAvailable', 'bg'))+ }+ctx.gateway.rpc<BackgroundStartResponse>('prompt.background', { session_id: ctx.sid, text: arg }).then(ctx.guarded<BackgroundStartResponse>(r => {if (!r.task_id) {@@ -137,6 +141,10 @@ export const sessionCommands: SlashCommand[] = [return ctx.transcript.sys(t('slashCmd.session.btw.usage'))}+ if (ctx.gateway.gw?.isCanonical) {+ return ctx.transcript.sys(t('canonical.controls.notAvailable', 'btw'))+ }+ctx.gateway.rpc<BackgroundStartResponse>('prompt.btw', { session_id: ctx.sid, text: arg }).then(ctx.guarded<BackgroundStartResponse>(r => {if (!r.task_id) {