Skip to content

The agent that grows with you

fix(desktop): /undo /retry /steer /queue run on a canonical session, as in the TUI

Teknium894c437b7a50
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-session-commands.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-session-commands.test.tsx
new file mode 100644
index 00000000000..5753d5ad3b1
--- /dev/null
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-session-commands.test.tsx
@@ -0,0 +1,272 @@
+import { cleanup } from '@testing-library/react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+import { en } from '@/i18n/en'
+import { createClientSessionState } from '@/lib/chat-runtime'
+import { resolveDesktopCommand } from '@/lib/desktop-slash-commands'
+import { $composerDraft, setComposerDraft } from '@/store/composer'
+import { $queuedPromptsBySession } from '@/store/composer-queue'
+import { $connection } from '@/store/session'
+import { dropSessionState, publishSessionState } from '@/store/session-states'
+
+import { actRender, Harness, type HarnessHandle, RUNTIME_SESSION_ID } from './index-test-utils'
+import { clearSingleFlightSessionResumeState } from './single-flight-resume'
+
+// /undo, /retry, /steer and /queue run against the session owner's canonical verbs (the Ink TUI's
+// behaviour on the same gateway), never as `slash.exec`, which the shared gateway refuses.
+
+vi.mock('@/hermes', () => ({
+ getLatestSessionMessages: vi.fn(async () => ({ messages: [], session_id: 'session' })),
+ getProfiles: vi.fn(async () => ({ profiles: [] })),
+ getSession: vi.fn(),
+ PROMPT_SUBMIT_REQUEST_TIMEOUT_MS: 1_800_000,
+ setApiRequestProfile: vi.fn(),
+ transcribeAudio: vi.fn()
+}))
+
+vi.mock('@/store/gateway', async importOriginal => ({
+ ...(await importOriginal<Record<string, unknown>>()),
+ requestGatewayForAgent: vi.fn()
+}))
+
+const copy = en.promptNotices.sessionCommands
+
+const SNAPSHOT = {
+ revision: 4,
+ execution_generation: 2,
+ messages: [
+ { role: 'user', content: 'first question', row_id: 11 },
+ { role: 'assistant', content: 'first answer', row_id: 12 },
+ { role: 'user', content: '[CONTEXT COMPACTION] summary', row_id: 13 },
+ { role: 'user', content: 'second question', row_id: 14 },
+ { role: 'assistant', content: 'second answer', row_id: 15 }
+ ]
+}
+
+type Responder = (method: string, params?: Record<string, unknown>) => unknown
+
+function gateway(respond: Responder) {
+ return vi.fn(async (method: string, params?: Record<string, unknown>) => (respond(method, params) ?? {}) as never)
+}
+
+async function mount(requestGateway: ReturnType<typeof gateway>) {
+ let handle: HarnessHandle | null = null
+ await actRender(
+ <Harness onReady={h => (handle = h)} refreshSessions={async () => undefined} requestGateway={requestGateway} />
+ )
+
+ return handle!
+}
+
+const callsOf = (requestGateway: ReturnType<typeof gateway>, method: string) =>
+ requestGateway.mock.calls.filter(([name]) => name === method).map(([, params]) => params)
+
+const renderedText = (handle: HarnessHandle) =>
+ handle
+ .state()
+ .messages.flatMap(message => message.parts.map(part => ('text' in part ? String(part.text) : '')))
+ .join('\n')
+
+const queuedTexts = () =>
+ Object.values($queuedPromptsBySession.get())
+ .flat()
+ .map(entry => entry.text)
+
+const canonical = () => $connection.set({ mode: 'local', wsUrl: 'ws://localhost/api/ws?native_dial=unminted' } as never)
+
+beforeEach(() => {
+ clearSingleFlightSessionResumeState()
+ window.localStorage.removeItem('hermes.desktop.composerQueue.v1')
+ $queuedPromptsBySession.set({})
+ setComposerDraft('')
+})
+
+afterEach(() => {
+ cleanup()
+ $connection.set(null)
+ dropSessionState(RUNTIME_SESSION_ID)
+ vi.restoreAllMocks()
+})
+
+describe('desktop surfaces for the canonical session commands', () => {
+ it('routes /undo, /retry, /steer (/s) and /queue (/q) to local actions, not slash.exec', () => {
+ const expected = {
+ '/undo': 'undo',
+ '/retry': 'retry',
+ '/steer': 'steer',
+ '/s': 'steer',
+ '/queue': 'queue',
+ '/q': 'queue'
+ }
+
+ for (const [name, action] of Object.entries(expected)) {
+ expect(resolveDesktopCommand(name)?.surface).toEqual({ kind: 'action', action })
+ }
+ })
+})
+
+describe('/undo on a canonical session', () => {
+ beforeEach(canonical)
+
+ it('rewinds the newest user turn by its durable row id and puts its text in the composer', async () => {
+ const requestGateway = gateway(method => {
+ if (method === 'session.resume') {
+ return SNAPSHOT
+ }
+
+ if (method === 'session.rewind') {
+ return { rewound_count: 2, target_message: { content: 'second question' } }
+ }
+ })
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/undo')
+
+ expect(callsOf(requestGateway, 'session.rewind')).toEqual([
+ { session_id: RUNTIME_SESSION_ID, target_message_id: 14 }
+ ])
+ expect(callsOf(requestGateway, 'slash.exec')).toEqual([])
+ expect($composerDraft.get()).toBe('second question')
+ expect(renderedText(handle)).toContain(copy.undidOther('2'))
+ })
+
+ it('/undo N targets the Nth newest user turn, skipping compaction carriers', async () => {
+ const requestGateway = gateway(method => {
+ if (method === 'session.resume') {
+ return SNAPSHOT
+ }
+
+ if (method === 'session.rewind') {
+ return { rewound_count: 5, target_message: { content: 'first question' } }
+ }
+ })
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/undo 2')
+
+ expect(callsOf(requestGateway, 'session.rewind')).toEqual([
+ { session_id: RUNTIME_SESSION_ID, target_message_id: 11 }
+ ])
+ })
+
+ it('says nothing to undo when there are fewer user turns, without a rewind', async () => {
+ const requestGateway = gateway(method => (method === 'session.resume' ? SNAPSHOT : undefined))
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/undo 3')
+
+ expect(callsOf(requestGateway, 'session.rewind')).toEqual([])
+ expect(renderedText(handle)).toContain(copy.undoNothing)
+ })
+})
+
+describe('/retry on a canonical session', () => {
+ beforeEach(canonical)
+
+ it('rewinds the newest user turn, then resubmits its text as a new prompt', async () => {
+ const requestGateway = gateway(method => {
+ if (method === 'session.resume') {
+ return SNAPSHOT
+ }
+
+ if (method === 'session.rewind') {
+ return { rewound_count: 2, target_message: { content: [{ type: 'text', text: 'second question' }] } }
+ }
+ })
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/retry')
+
+ expect(callsOf(requestGateway, 'session.rewind')).toEqual([
+ { session_id: RUNTIME_SESSION_ID, target_message_id: 14 }
+ ])
+ expect(callsOf(requestGateway, 'prompt.submit')).toEqual([
+ expect.objectContaining({ session_id: RUNTIME_SESSION_ID, text: 'second question' })
+ ])
+ expect(callsOf(requestGateway, 'slash.exec')).toEqual([])
+ })
+
+ it('refuses a media turn before archiving anything', async () => {
+ const requestGateway = gateway(method =>
+ method === 'session.resume'
+ ? { ...SNAPSHOT, messages: [{ role: 'user', content: [{ type: 'image_url', image_url: 'x' }], row_id: 3 }] }
+ : undefined
+ )
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/retry')
+
+ expect(callsOf(requestGateway, 'session.rewind')).toEqual([])
+ expect(callsOf(requestGateway, 'prompt.submit')).toEqual([])
+ expect(renderedText(handle)).toContain(copy.retryUnsupported)
+ })
+})
+
+describe('/steer', () => {
+ it('steers the running turn through session.steer', async () => {
+ publishSessionState(RUNTIME_SESSION_ID, { ...createClientSessionState(RUNTIME_SESSION_ID), busy: true })
+ const requestGateway = gateway(method => (method === 'session.steer' ? { status: 'queued' } : undefined))
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/s check the tests too')
+
+ expect(callsOf(requestGateway, 'session.steer')).toEqual([
+ { session_id: RUNTIME_SESSION_ID, text: 'check the tests too' }
+ ])
+ expect(callsOf(requestGateway, 'slash.exec')).toEqual([])
+ expect(queuedTexts()).toEqual([])
+ expect(renderedText(handle)).toContain(copy.steerQueued('check the tests too'))
+ })
+
+ it('queues the text as the next turn when the steer is not accepted', async () => {
+ publishSessionState(RUNTIME_SESSION_ID, { ...createClientSessionState(RUNTIME_SESSION_ID), busy: true })
+ const requestGateway = gateway(method => (method === 'session.steer' ? { status: 'rejected' } : undefined))
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/steer late words')
+
+ expect(queuedTexts()).toEqual(['late words'])
+ expect(renderedText(handle)).toContain(copy.steerRejected)
+ })
+
+ it('queues the text without a steer when no turn is running', async () => {
+ const requestGateway = gateway(() => undefined)
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/steer next thing')
+
+ expect(callsOf(requestGateway, 'session.steer')).toEqual([])
+ expect(queuedTexts()).toEqual(['next thing'])
+ expect(renderedText(handle)).toContain(copy.steerNoActiveTurn('next thing'))
+ })
+})
+
+describe('/queue', () => {
+ it('enqueues the text on the composer queue and counts it with a bare /queue', async () => {
+ const requestGateway = gateway(() => undefined)
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/q do this after')
+
+ expect(queuedTexts()).toEqual(['do this after'])
+ expect(callsOf(requestGateway, 'slash.exec')).toEqual([])
+
+ await handle.submitText('/queue')
+
+ expect(renderedText(handle)).toContain(copy.queued('do this after'))
+ expect(renderedText(handle)).toContain(copy.countOne('1'))
+ })
+
+ it('admits the text into the owner FIFO on a canonical session', async () => {
+ canonical()
+ const requestGateway = gateway(() => undefined)
+
+ const handle = await mount(requestGateway)
+ await handle.submitText('/queue owner fifo')
+
+ expect(callsOf(requestGateway, 'prompt.submit')).toEqual([
+ expect.objectContaining({ queued: true, session_id: RUNTIME_SESSION_ID, text: 'owner fifo' })
+ ])
+ expect(callsOf(requestGateway, 'slash.exec')).toEqual([])
+ })
+})
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-session-commands.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-session-commands.ts
new file mode 100644
index 00000000000..bb3702993a4
--- /dev/null
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-session-commands.ts
@@ -0,0 +1,323 @@
+import type { MutableRefObject } from 'react'
+
+import type { ClientSessionState, SessionRedirectResponse } from '@/app/types'
+import { runtimeTranslations } from '@/i18n/runtime'
+import type { ChatMessage } from '@/lib/chat-messages'
+import { setComposerDraft } from '@/store/composer'
+import { enqueueQueuedPrompt, getQueuedPrompts, serverOwnsComposerQueue } from '@/store/composer-queue'
+import { $sessions, resolveComposerSessionKey } from '@/store/session'
+import { $sessionStates } from '@/store/session-states'
+
+import type { SubmissionDestination } from './submission-destination'
+import { type GatewayRequest, isTargetSessionBusy, type SubmitTextOptions } from './utils'
+
+// Typed /undo, /retry, /steer and /queue: one behaviour per command on every surface, mirroring the
+// Ink TUI on the same shared gateway (ui-tui/src/app/slash/commands/core.ts +
+// canonicalSessionCommands.ts). The owner refuses them as `slash.exec`, so a canonical session runs
+// /undo and /retry as the revision-fenced `session.mutate rewind` (Desktop's `session.rewind`),
+// /steer as `session.steer`, and /queue on the composer queue the busy composer already uses.
+
+const COMPACTION_MARKERS = ['[CONTEXT COMPACTION', '[CONTEXT SUMMARY]:', '[END OF PRIOR CONTEXT']
+const TEXT_PARTS = new Set(['input_text', 'output_text', 'text'])
+const PREVIEW_CHARS = 50
+
+interface SnapshotRow {
+ content?: unknown
+ display_kind?: unknown
+ role?: unknown
+ row_id?: unknown
+}
+
+interface RewindReceipt {
+ rewound_count?: number
+ status?: string
+ target_message?: { content?: unknown } | null
+}
+
+interface SlashOutput {
+ render: (text: string) => void
+ sessionId: string
+ storedSessionId: null | string
+}
+
+export interface SessionCommandEnv<C extends { arg: string }> {
+ activeSessionIdRef: MutableRefObject<null | string>
+ busyRef: MutableRefObject<boolean>
+ destination: SubmissionDestination
+ requestGateway: GatewayRequest
+ /** Legacy (non-owner) gateways still serve these through the slash worker. */
+ runExec: (ctx: C) => Promise<void>
+ submitPromptText: (rawText: string, options?: SubmitTextOptions) => Promise<boolean>
+ updateSessionState: (
+ sessionId: string,
+ updater: (state: ClientSessionState) => ClientSessionState,
+ storedSessionId?: null | string
+ ) => ClientSessionState
+ withSlashOutput: (ctx: C) => Promise<null | SlashOutput>
+}
+
+const copy = () => runtimeTranslations().promptNotices.sessionCommands
+
+/** Clip a queued/steered prompt for the confirmation line (Ink's previewOf). */
+const previewOf = (text: string) => `${text.slice(0, PREVIEW_CHARS)}${text.length > PREVIEW_CHARS ? '…' : ''}`
+
+const errorText = (err: unknown) => `error: ${err instanceof Error ? err.message : String(err)}`
+
+/** A human-authored user turn (`split_user_originated_turn`): no display-only kind other than a
+ * typed /steer, a durable row id, and not a compaction handoff carrier. */
+function isUserTurn(row: SnapshotRow): boolean {
+ return (
+ row.role === 'user' &&
+ (!row.display_kind || row.display_kind === 'steer') &&
+ Number.isSafeInteger(row.row_id) &&
+ !(typeof row.content === 'string' && COMPACTION_MARKERS.some(marker => String(row.content).includes(marker)))
+ )
+}
+
+/** Lossless /retry text (`retryable_user_text`): '' when the turn has no text, null when it carries
+ * media, unknown or annotated parts (no replay protocol: fail closed). */
+export function retryText(content: unknown): null | string {
+ const parts = typeof content === 'string' ? [content] : Array.isArray(content) ? content : [null]
+ let text = ''
+
+ for (const part of parts) {
+ if (typeof part === 'string') {
+ text += part
+ } else if (
+ part &&
+ typeof part === 'object' &&
+ TEXT_PARTS.has(part.type) &&
+ typeof part.text === 'string' &&
+ Object.keys(part).length === 2
+ ) {
+ text += part.text
+ } else {
+ return null
+ }
+ }
+
+ return text.trim() ? text : ''
+}
+
+/** The Nth newest user turn of the owner's snapshot, or null when there are fewer. */
+export function userTurnFromEnd(rows: readonly SnapshotRow[], turnsBack: number): null | SnapshotRow {
+ const turns = rows.filter(isUserTurn)
+
+ return turns.length >= turnsBack ? turns[turns.length - turnsBack] : null
+}
+
+/** Drop the rewound rows from the rendered transcript: everything from the first message bound to a
+ * durable row at or after the target. Unbound bubbles fall back to the Nth newest user bubble. */
+export function truncateRewoundMessages(messages: ChatMessage[], rowId: number, turnsBack: number): ChatMessage[] {
+ let cut = messages.findIndex(
+ message => (message.rowId ?? -1) >= rowId || message.parts.some(part => (part.sourceRowId ?? -1) >= rowId)
+ )
+
+ if (cut < 0) {
+ const users = messages.flatMap((message, index) => (message.role === 'user' && !message.hidden ? [index] : []))
+ cut = users[users.length - turnsBack] ?? -1
+ }
+
+ return cut < 0 ? messages : messages.slice(0, cut)
+}
+
+export function sessionCommandHandlers<C extends { arg: string }>(env: SessionCommandEnv<C>) {
+ const { activeSessionIdRef, busyRef, destination, requestGateway, submitPromptText, updateSessionState } = env
+
+ // Rewind the Nth newest user turn on the owner. Resolves to the receipt's rewound text, or
+ // undefined after it already rendered why nothing was rewound.
+ async function rewind(
+ out: SlashOutput,
+ turnsBack: number,
+ intent: 'retry' | 'undo'
+ ): Promise<undefined | { count: number; content: unknown }> {
+ const { render, sessionId, storedSessionId } = out
+ const nothing = intent === 'retry' ? copy().retryNothing : copy().undoNothing
+ // The resume snapshot carries every row's durable id and primes the CAS revision/generation the
+ // rewind mutation presents, as Ink's mutateCanonical does.
+ const snapshot = await requestGateway<{ messages?: SnapshotRow[] }>('session.resume', { session_id: sessionId })
+ const target = userTurnFromEnd(Array.isArray(snapshot?.messages) ? snapshot.messages : [], turnsBack)
+
+ if (!target) {
+ return void render(nothing)
+ }
+
+ if (intent === 'retry') {
+ const text = retryText(target.content)
+
+ if (text === null) {
+ return void render(copy().retryUnsupported)
+ }
+
+ if (!text) {
+ return void render(nothing)
+ }
+ }
+
+ const rowId = target.row_id as number
+
+ const receipt = await requestGateway<RewindReceipt>('session.rewind', {
+ session_id: sessionId,
+ target_message_id: rowId
+ })
+
+ const count = Number(receipt?.rewound_count ?? 0)
+
+ if (receipt?.status === 'nothing' || count <= 0) {
+ return void render(nothing)
+ }
+
+ updateSessionState(
+ sessionId,
+ state => ({ ...state, messages: truncateRewoundMessages(state.messages, rowId, turnsBack) }),
+ storedSessionId
+ )
+
+ return { count, content: receipt?.target_message?.content }
+ }
+
+ // The next-turn queue the composer uses while busy: the owner's durable FIFO for a canonical
+ // session (a `queued` admission), the local composer queue otherwise.
+ async function enqueue(out: SlashOutput, text: string): Promise<boolean> {
+ const { sessionId, storedSessionId } = out
+
+ if (serverOwnsComposerQueue(storedSessionId ?? sessionId)) {
+ return submitPromptText(text, { destination, fromQueue: true, sessionId, storedSessionId })
+ }
+
+ return Boolean(enqueueQueuedPrompt(queueKeyFor(out), { attachments: [], text }))
+ }
+
+ const canonical = (out: SlashOutput) => serverOwnsComposerQueue(out.storedSessionId ?? out.sessionId)
+
+ return {
+ undo: async (ctx: C) => {
+ const out = await env.withSlashOutput(ctx)
+
+ if (!out) {
+ return
+ }
+
+ if (!canonical(out)) {
+ return env.runExec(ctx)
+ }
+
+ const arg = ctx.arg.trim()
+
+ if (arg && !/^[1-9]\d*$/.test(arg)) {
+ return out.render(copy().undoUsage)
+ }
+
+ try {
+ const rewound = await rewind(out, Number(arg || 1), 'undo')
+
+ if (!rewound) {
+ return
+ }
+
+ // Main's /undo: the removed message goes back into the composer it was typed in.
+ const text = typeof rewound.content === 'string' ? rewound.content : (retryText(rewound.content) ?? '')
+
+ if (text.trim() && activeSessionIdRef.current === out.sessionId) {
+ setComposerDraft(text)
+ }
+
+ out.render(rewound.count === 1 ? copy().undidOne('1') : copy().undidOther(String(rewound.count)))
+ } catch (err) {
+ out.render(errorText(err))
+ }
+ },
+ retry: async (ctx: C) => {
+ const out = await env.withSlashOutput(ctx)
+
+ if (!out) {
+ return
+ }
+
+ if (!canonical(out)) {
+ return env.runExec(ctx)
+ }
+
+ try {
+ const rewound = await rewind(out, 1, 'retry')
+
+ if (!rewound) {
+ return
+ }
+
+ // Main's /retry: the rewound turn's own text, not whatever this view typed last.
+ const text = retryText(rewound.content)
+
+ if (!text) {
+ return out.render(copy().retryNothing)
+ }
+
+ await submitPromptText(text, { destination, sessionId: out.sessionId, storedSessionId: out.storedSessionId })
+ } catch (err) {
+ out.render(errorText(err))
+ }
+ },
+ steer: async (ctx: C) => {
+ const out = await env.withSlashOutput(ctx)
+
+ if (!out) {
+ return
+ }
+
+ const text = ctx.arg.trim()
+
+ if (!text) {
+ return out.render(copy().steerUsage)
+ }
+
+ // No running turn: queue the words as the next turn so they are not lost (Ink, gateway).
+ if (!isTargetSessionBusy($sessionStates.get(), out.sessionId, busyRef.current)) {
+ return out.render((await enqueue(out, text)) ? copy().steerNoActiveTurn(previewOf(text)) : copy().queueFailed)
+ }
+
+ let accepted = false
+
+ try {
+ const result = await requestGateway<SessionRedirectResponse>('session.steer', {
+ session_id: out.sessionId,
+ text
+ })
+
+ accepted = result?.status === 'queued'
+ } catch {
+ accepted = false
+ }
+
+ if (accepted) {
+ return out.render(copy().steerQueued(previewOf(text)))
+ }
+
+ // The turn ended before the steer landed (#64578): keep the words as the next turn.
+ out.render((await enqueue(out, text)) ? copy().steerRejected : copy().queueFailed)
+ },
+ queue: async (ctx: C) => {
+ const out = await env.withSlashOutput(ctx)
+
+ if (!out) {
+ return
+ }
+
+ const text = ctx.arg.trim()
+
+ if (!text) {
+ const count = getQueuedPrompts(queueKeyFor(out)).length
+
+ return out.render(count === 1 ? copy().countOne('1') : copy().countOther(String(count)))
+ }
+
+ out.render((await enqueue(out, text)) ? copy().queued(previewOf(text)) : copy().queueFailed)
+ }
+ }
+}
+
+/** The composer queue key for the target session (queue-if-busy.ts's resolution). */
+function queueKeyFor({ sessionId, storedSessionId }: SlashOutput): string {
+ const stored = storedSessionId ?? $sessionStates.get()[sessionId]?.storedSessionId ?? null
+
+ return resolveComposerSessionKey(stored, $sessions.get()) || stored || sessionId
+}
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts
index ddee05ef745..cc73e017635 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash.ts
@@ -72,6 +72,7 @@ import type {
import { adoptPreparedSubmission, preparedSubmissionKey } from './prepared-submissions'
import { queueKickoffIfSessionBusy } from './queue-if-busy'
import { resolveTargetSessionId } from './resolve-target-session'
+import { sessionCommandHandlers } from './slash-session-commands'
import { captureSubmissionDestination } from './submission-destination'
import {
type GatewayRequest,
@@ -639,6 +640,16 @@ export function useSlashCommand(deps: SlashCommandDeps) {
// registry row in desktop-slash-commands.ts plus an entry here — never a
// new branch in a dispatch ladder.
const actionHandlers: Record<DesktopActionId, (ctx: SlashActionCtx) => Promise<void>> = {
+ ...sessionCommandHandlers<SlashActionCtx>({
+ activeSessionIdRef,
+ busyRef,
+ destination,
+ requestGateway,
+ runExec,
+ submitPromptText,
+ updateSessionState,
+ withSlashOutput
+ }),
new: async () => {
prepareDefaultNewSession()
startFreshSessionDraft()
diff --git a/apps/desktop/src/i18n/ar_boot.ts b/apps/desktop/src/i18n/ar_boot.ts
index 0477244b7de..7cf0b4e9f43 100644
--- a/apps/desktop/src/i18n/ar_boot.ts
+++ b/apps/desktop/src/i18n/ar_boot.ts
@@ -1,3 +1,4 @@
+import { arSessionCommands } from './ar_session_commands'
import type { TranslationOverrides } from './define-locale'
export const arBoot = {
@@ -69,7 +70,8 @@ export const arBoot = {
},
promptNotices: {
legacySendUnconfirmed:
- 'تعذّر على هذا الخادم تأكيد الإرسال السابق لهذه الرسالة، لذا ربما تم تنفيذها بالفعل. راجع المحادثة قبل إرسالها مرة أخرى.'
+ 'تعذّر على هذا الخادم تأكيد الإرسال السابق لهذه الرسالة، لذا ربما تم تنفيذها بالفعل. راجع المحادثة قبل إرسالها مرة أخرى.',
+ sessionCommands: arSessionCommands
},
updates: {
discontinuedTitle: 'لم يعد إصدار Hermes هذا مدعومًا',
diff --git a/apps/desktop/src/i18n/ar_session_commands.ts b/apps/desktop/src/i18n/ar_session_commands.ts
new file mode 100644
index 00000000000..5f1a0c63904
--- /dev/null
+++ b/apps/desktop/src/i18n/ar_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const arSessionCommands = {
+ undoUsage: 'الاستخدام: /undo [N]',
+ undoNothing: 'لا يوجد ما يمكن التراجع عنه',
+ undidOne: (count: string) => `تم التراجع عن ${count} رسالة — الرسالة المحذوفة موجودة في مربع الكتابة`,
+ undidOther: (count: string) => `تم التراجع عن ${count} رسائل — الرسالة المحذوفة موجودة في مربع الكتابة`,
+ retryNothing: 'لا يوجد ما يمكن إعادة محاولته',
+ retryUnsupported: '/retry: لا يمكن إعادة محاولة الوسائط أو أجزاء المحتوى غير المعروفة',
+ steerUsage: 'الاستخدام: /steer <الطلب>',
+ steerQueued: (preview: string) => `أُضيف التوجيه إلى قائمة الانتظار — يصل بعد استدعاء الأداة التالي: "${preview}"`,
+ steerNoActiveTurn: (preview: string) => `لا يوجد دور نشط — أُضيف إلى قائمة الانتظار للدور التالي: "${preview}"`,
+ steerRejected: 'رُفض التوجيه — لا يوجد دور نشط، أُضيف إلى قائمة الانتظار للدور التالي',
+ queued: (preview: string) => `في قائمة الانتظار: "${preview}"`,
+ queueFailed: 'تعذّرت إضافة الرسالة إلى قائمة الانتظار',
+ countOne: (count: string) => `${count} رسالة في قائمة الانتظار`,
+ countOther: (count: string) => `${count} رسائل في قائمة الانتظار`
+}
diff --git a/apps/desktop/src/i18n/de_notices.ts b/apps/desktop/src/i18n/de_notices.ts
index c4b8c971e08..237d56a2c65 100644
--- a/apps/desktop/src/i18n/de_notices.ts
+++ b/apps/desktop/src/i18n/de_notices.ts
@@ -1,3 +1,4 @@
+import { deSessionCommands } from './de_session_commands'
import type { TranslationOverrides } from './define-locale'
// Shell notices (remote-display toast, butterbar), spread into de.ts.
@@ -18,6 +19,7 @@ export const deNotices = {
},
promptNotices: {
legacySendUnconfirmed:
- 'Dieser Server konnte das frühere Senden dieser Nachricht nicht bestätigen; sie wurde möglicherweise bereits ausgeführt. Prüfe die Unterhaltung, bevor du sie erneut sendest.'
+ 'Dieser Server konnte das frühere Senden dieser Nachricht nicht bestätigen; sie wurde möglicherweise bereits ausgeführt. Prüfe die Unterhaltung, bevor du sie erneut sendest.',
+ sessionCommands: deSessionCommands
}
} satisfies Pick<TranslationOverrides, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/de_session_commands.ts b/apps/desktop/src/i18n/de_session_commands.ts
new file mode 100644
index 00000000000..414ee66eb4d
--- /dev/null
+++ b/apps/desktop/src/i18n/de_session_commands.ts
@@ -0,0 +1,18 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const deSessionCommands = {
+ undoUsage: 'Verwendung: /undo [N]',
+ undoNothing: 'nichts zum Rückgängigmachen',
+ undidOne: (count: string) => `${count} Nachricht rückgängig gemacht — die entfernte Nachricht steht im Eingabefeld`,
+ undidOther: (count: string) =>
+ `${count} Nachrichten rückgängig gemacht — die entfernte Nachricht steht im Eingabefeld`,
+ retryNothing: 'nichts zum Wiederholen',
+ retryUnsupported: '/retry: Medien oder unbekannte Inhaltsteile können nicht wiederholt werden',
+ steerUsage: 'Verwendung: /steer <Prompt>',
+ steerQueued: (preview: string) => `Steuerung eingereiht — kommt nach dem nächsten Tool-Aufruf an: „${preview}“`,
+ steerNoActiveTurn: (preview: string) => `kein aktiver Turn — für den nächsten eingereiht: „${preview}“`,
+ steerRejected: 'Steuerung abgelehnt — kein aktiver Turn, für den nächsten Turn eingereiht',
+ queued: (preview: string) => `eingereiht: „${preview}“`,
+ queueFailed: 'Die Nachricht konnte nicht eingereiht werden',
+ countOne: (count: string) => `${count} eingereihte Nachricht`,
+ countOther: (count: string) => `${count} eingereihte Nachrichten`
+}
diff --git a/apps/desktop/src/i18n/en_notices.ts b/apps/desktop/src/i18n/en_notices.ts
index cb09ce6a2f8..efb02c0de80 100644
--- a/apps/desktop/src/i18n/en_notices.ts
+++ b/apps/desktop/src/i18n/en_notices.ts
@@ -1,3 +1,4 @@
+import { enSessionCommands } from './en_session_commands'
import type { Translations } from './types'
// Shell notices (remote-display toast, butterbar), spread into en.ts.
@@ -18,6 +19,7 @@ export const enNotices = {
},
promptNotices: {
legacySendUnconfirmed:
- 'This server could not confirm the earlier send of this message, so it may already have run. Check the conversation before sending it again.'
+ 'This server could not confirm the earlier send of this message, so it may already have run. Check the conversation before sending it again.',
+ sessionCommands: enSessionCommands
}
} satisfies Pick<Translations, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/en_session_commands.ts b/apps/desktop/src/i18n/en_session_commands.ts
new file mode 100644
index 00000000000..345289b1dd9
--- /dev/null
+++ b/apps/desktop/src/i18n/en_session_commands.ts
@@ -0,0 +1,19 @@
+import type { SessionCommandNotices } from './types_notices'
+
+// Typed /undo /retry /steer /queue lines: the Ink TUI's wording on the same gateway.
+export const enSessionCommands: SessionCommandNotices = {
+ undoUsage: 'usage: /undo [N]',
+ undoNothing: 'nothing to undo',
+ undidOne: (count: string) => `undid ${count} message — the removed message is in the composer`,
+ undidOther: (count: string) => `undid ${count} messages — the removed message is in the composer`,
+ retryNothing: 'nothing to retry',
+ retryUnsupported: '/retry: retry does not support media or unknown content parts',
+ steerUsage: 'usage: /steer <prompt>',
+ steerQueued: (preview: string) => `steer queued — arrives after next tool call: "${preview}"`,
+ steerNoActiveTurn: (preview: string) => `no active turn — queued for next: "${preview}"`,
+ steerRejected: 'steer rejected — no active turn, queued for next turn',
+ queued: (preview: string) => `queued: "${preview}"`,
+ queueFailed: 'could not queue the message',
+ countOne: (count: string) => `${count} queued message`,
+ countOther: (count: string) => `${count} queued messages`
+}
diff --git a/apps/desktop/src/i18n/es_notices.ts b/apps/desktop/src/i18n/es_notices.ts
index bdfa10c5eb6..bd6a1610e80 100644
--- a/apps/desktop/src/i18n/es_notices.ts
+++ b/apps/desktop/src/i18n/es_notices.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { esSessionCommands } from './es_session_commands'
// Shell notices (remote-display toast, butterbar), spread into es.ts.
export const esNotices = {
@@ -18,6 +19,7 @@ export const esNotices = {
},
promptNotices: {
legacySendUnconfirmed:
- 'Este servidor no pudo confirmar el envío anterior de este mensaje, así que es posible que ya se haya ejecutado. Revisa la conversación antes de volver a enviarlo.'
+ 'Este servidor no pudo confirmar el envío anterior de este mensaje, así que es posible que ya se haya ejecutado. Revisa la conversación antes de volver a enviarlo.',
+ sessionCommands: esSessionCommands
}
} satisfies Pick<TranslationOverrides, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/es_session_commands.ts b/apps/desktop/src/i18n/es_session_commands.ts
new file mode 100644
index 00000000000..7b3ce1c5bef
--- /dev/null
+++ b/apps/desktop/src/i18n/es_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const esSessionCommands = {
+ undoUsage: 'uso: /undo [N]',
+ undoNothing: 'nada que deshacer',
+ undidOne: (count: string) => `se deshizo ${count} mensaje — el mensaje eliminado está en el compositor`,
+ undidOther: (count: string) => `se deshicieron ${count} mensajes — el mensaje eliminado está en el compositor`,
+ retryNothing: 'nada que reintentar',
+ retryUnsupported: '/retry: no se pueden reintentar contenidos multimedia o partes desconocidas',
+ steerUsage: 'uso: /steer <prompt>',
+ steerQueued: (preview: string) => `indicación en cola — llega tras la próxima llamada a herramienta: "${preview}"`,
+ steerNoActiveTurn: (preview: string) => `no hay turno activo — en cola para el siguiente: "${preview}"`,
+ steerRejected: 'indicación rechazada — no hay turno activo, en cola para el siguiente turno',
+ queued: (preview: string) => `en cola: "${preview}"`,
+ queueFailed: 'No se pudo poner el mensaje en cola',
+ countOne: (count: string) => `${count} mensaje en cola`,
+ countOther: (count: string) => `${count} mensajes en cola`
+}
diff --git a/apps/desktop/src/i18n/fr_notices.ts b/apps/desktop/src/i18n/fr_notices.ts
index b31a7186117..17069ca5bd7 100644
--- a/apps/desktop/src/i18n/fr_notices.ts
+++ b/apps/desktop/src/i18n/fr_notices.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { frSessionCommands } from './fr_session_commands'
// Shell notices (remote-display toast, butterbar), spread into fr.ts.
export const frNotices = {
@@ -18,6 +19,7 @@ export const frNotices = {
},
promptNotices: {
legacySendUnconfirmed:
- "Ce serveur n'a pas pu confirmer l'envoi précédent de ce message ; il a peut-être déjà été exécuté. Vérifiez la conversation avant de le renvoyer."
+ "Ce serveur n'a pas pu confirmer l'envoi précédent de ce message ; il a peut-être déjà été exécuté. Vérifiez la conversation avant de le renvoyer.",
+ sessionCommands: frSessionCommands
}
} satisfies Pick<TranslationOverrides, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/fr_session_commands.ts b/apps/desktop/src/i18n/fr_session_commands.ts
new file mode 100644
index 00000000000..72bbbbcc8e5
--- /dev/null
+++ b/apps/desktop/src/i18n/fr_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const frSessionCommands = {
+ undoUsage: 'utilisation : /undo [N]',
+ undoNothing: 'rien à annuler',
+ undidOne: (count: string) => `${count} message annulé — le message retiré est dans la zone de saisie`,
+ undidOther: (count: string) => `${count} messages annulés — le message retiré est dans la zone de saisie`,
+ retryNothing: 'rien à réessayer',
+ retryUnsupported: '/retry : impossible de réessayer un contenu multimédia ou des parties inconnues',
+ steerUsage: 'utilisation : /steer <prompt>',
+ steerQueued: (preview: string) => `orientation en file — arrive après le prochain appel d’outil : « ${preview} »`,
+ steerNoActiveTurn: (preview: string) => `aucun tour actif — mis en file pour le suivant : « ${preview} »`,
+ steerRejected: 'orientation refusée — aucun tour actif, mise en file pour le tour suivant',
+ queued: (preview: string) => `en file : « ${preview} »`,
+ queueFailed: 'Impossible de mettre le message en file',
+ countOne: (count: string) => `${count} message en file`,
+ countOther: (count: string) => `${count} messages en file`
+}
diff --git a/apps/desktop/src/i18n/ja_notices.ts b/apps/desktop/src/i18n/ja_notices.ts
index 15b7df888b1..cad027ccfac 100644
--- a/apps/desktop/src/i18n/ja_notices.ts
+++ b/apps/desktop/src/i18n/ja_notices.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { jaSessionCommands } from './ja_session_commands'
// Shell notices (remote-display toast, butterbar), spread into ja.ts.
export const jaNotices = {
@@ -18,6 +19,7 @@ export const jaNotices = {
},
promptNotices: {
legacySendUnconfirmed:
- 'このサーバーはこのメッセージの前回の送信を確認できなかったため、すでに実行された可能性があります。再送信する前に会話を確認してください。'
+ 'このサーバーはこのメッセージの前回の送信を確認できなかったため、すでに実行された可能性があります。再送信する前に会話を確認してください。',
+ sessionCommands: jaSessionCommands
}
} satisfies Pick<TranslationOverrides, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/ja_session_commands.ts b/apps/desktop/src/i18n/ja_session_commands.ts
new file mode 100644
index 00000000000..e83275310ca
--- /dev/null
+++ b/apps/desktop/src/i18n/ja_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const jaSessionCommands = {
+ undoUsage: '使い方: /undo [N]',
+ undoNothing: '元に戻すものはありません',
+ undidOne: (count: string) => `${count} 件のメッセージを元に戻しました — 削除したメッセージは入力欄にあります`,
+ undidOther: (count: string) => `${count} 件のメッセージを元に戻しました — 削除したメッセージは入力欄にあります`,
+ retryNothing: '再試行するものはありません',
+ retryUnsupported: '/retry: メディアや不明なコンテンツを含むターンは再試行できません',
+ steerUsage: '使い方: /steer <プロンプト>',
+ steerQueued: (preview: string) => `誘導を予約しました — 次のツール呼び出しの後に届きます: 「${preview}」`,
+ steerNoActiveTurn: (preview: string) => `実行中のターンがありません — 次のターンに追加しました: 「${preview}」`,
+ steerRejected: '誘導は拒否されました — 実行中のターンがないため、次のターンに追加しました',
+ queued: (preview: string) => `キューに追加: 「${preview}」`,
+ queueFailed: 'メッセージをキューに追加できませんでした',
+ countOne: (count: string) => `キュー内のメッセージ ${count} 件`,
+ countOther: (count: string) => `キュー内のメッセージ ${count} 件`
+}
diff --git a/apps/desktop/src/i18n/ru_notices.ts b/apps/desktop/src/i18n/ru_notices.ts
index 1fe0dd721d1..deb1b0df6c5 100644
--- a/apps/desktop/src/i18n/ru_notices.ts
+++ b/apps/desktop/src/i18n/ru_notices.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { ruSessionCommands } from './ru_session_commands'
// Shell notices (remote-display toast, butterbar), spread into ru.ts.
export const ruNotices = {
@@ -18,6 +19,7 @@ export const ruNotices = {
},
promptNotices: {
legacySendUnconfirmed:
- 'Этот сервер не смог подтвердить предыдущую отправку этого сообщения, поэтому оно, возможно, уже выполнено. Проверьте беседу, прежде чем отправлять его снова.'
+ 'Этот сервер не смог подтвердить предыдущую отправку этого сообщения, поэтому оно, возможно, уже выполнено. Проверьте беседу, прежде чем отправлять его снова.',
+ sessionCommands: ruSessionCommands
}
} satisfies Pick<TranslationOverrides, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/ru_session_commands.ts b/apps/desktop/src/i18n/ru_session_commands.ts
new file mode 100644
index 00000000000..843cc3048d7
--- /dev/null
+++ b/apps/desktop/src/i18n/ru_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const ruSessionCommands = {
+ undoUsage: 'использование: /undo [N]',
+ undoNothing: 'нечего отменять',
+ undidOne: (count: string) => `отменено сообщений: ${count} — удалённое сообщение в поле ввода`,
+ undidOther: (count: string) => `отменено сообщений: ${count} — удалённое сообщение в поле ввода`,
+ retryNothing: 'нечего повторять',
+ retryUnsupported: '/retry: нельзя повторить медиа или неизвестные части содержимого',
+ steerUsage: 'использование: /steer <запрос>',
+ steerQueued: (preview: string) => `уточнение в очереди — придёт после следующего вызова инструмента: «${preview}»`,
+ steerNoActiveTurn: (preview: string) => `нет активного хода — поставлено в очередь на следующий: «${preview}»`,
+ steerRejected: 'уточнение отклонено — нет активного хода, поставлено в очередь на следующий ход',
+ queued: (preview: string) => `в очереди: «${preview}»`,
+ queueFailed: 'Не удалось поставить сообщение в очередь',
+ countOne: (count: string) => `сообщений в очереди: ${count}`,
+ countOther: (count: string) => `сообщений в очереди: ${count}`
+}
diff --git a/apps/desktop/src/i18n/types_notices.ts b/apps/desktop/src/i18n/types_notices.ts
index 107a055af86..d0c078c6c64 100644
--- a/apps/desktop/src/i18n/types_notices.ts
+++ b/apps/desktop/src/i18n/types_notices.ts
@@ -13,5 +13,24 @@ export interface NoticeTranslations {
promptNotices: {
/** An explicit retry of a send whose identityless (legacy) acknowledgement was lost. */
legacySendUnconfirmed: string
+ /** Typed /undo /retry /steer /queue lines (the Ink TUI's wording on the same gateway). */
+ sessionCommands: SessionCommandNotices
}
}
+
+export interface SessionCommandNotices {
+ undoUsage: string
+ undoNothing: string
+ undidOne: (count: string) => string
+ undidOther: (count: string) => string
+ retryNothing: string
+ retryUnsupported: string
+ steerUsage: string
+ steerQueued: (preview: string) => string
+ steerNoActiveTurn: (preview: string) => string
+ steerRejected: string
+ queued: (preview: string) => string
+ queueFailed: string
+ countOne: (count: string) => string
+ countOther: (count: string) => string
+}
diff --git a/apps/desktop/src/i18n/zh-hant_boot.ts b/apps/desktop/src/i18n/zh-hant_boot.ts
index 15445b5a4ff..3eaf5ebf916 100644
--- a/apps/desktop/src/i18n/zh-hant_boot.ts
+++ b/apps/desktop/src/i18n/zh-hant_boot.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { zhHantSessionCommands } from './zh-hant_session_commands'
export const zhHantBoot = {
boot: {
@@ -72,8 +73,8 @@ export const zhHantBoot = {
}
},
promptNotices: {
- legacySendUnconfirmed:
- '此伺服器無法確認這則訊息先前的傳送,它可能已經執行過。再次傳送前請先查看對話。'
+ legacySendUnconfirmed: '此伺服器無法確認這則訊息先前的傳送,它可能已經執行過。再次傳送前請先查看對話。',
+ sessionCommands: zhHantSessionCommands
},
updates: {
diff --git a/apps/desktop/src/i18n/zh-hant_session_commands.ts b/apps/desktop/src/i18n/zh-hant_session_commands.ts
new file mode 100644
index 00000000000..17867792154
--- /dev/null
+++ b/apps/desktop/src/i18n/zh-hant_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const zhHantSessionCommands = {
+ undoUsage: '用法:/undo [N]',
+ undoNothing: '沒有可復原的內容',
+ undidOne: (count: string) => `已復原 ${count} 則訊息 — 被移除的訊息已放回輸入框`,
+ undidOther: (count: string) => `已復原 ${count} 則訊息 — 被移除的訊息已放回輸入框`,
+ retryNothing: '沒有可重試的內容',
+ retryUnsupported: '/retry:無法重試包含媒體或未知內容的訊息',
+ steerUsage: '用法:/steer <提示>',
+ steerQueued: (preview: string) => `引導已排入佇列 — 將在下一次工具呼叫後送達:「${preview}」`,
+ steerNoActiveTurn: (preview: string) => `目前沒有進行中的回合 — 已排入下一回合:「${preview}」`,
+ steerRejected: '引導遭拒 — 沒有進行中的回合,已排入下一回合',
+ queued: (preview: string) => `已排入佇列:「${preview}」`,
+ queueFailed: '無法將訊息排入佇列',
+ countOne: (count: string) => `${count} 則排隊訊息`,
+ countOther: (count: string) => `${count} 則排隊訊息`
+}
diff --git a/apps/desktop/src/i18n/zh_notices.ts b/apps/desktop/src/i18n/zh_notices.ts
index c2455f6146f..828dcc4a4b1 100644
--- a/apps/desktop/src/i18n/zh_notices.ts
+++ b/apps/desktop/src/i18n/zh_notices.ts
@@ -1,4 +1,5 @@
import type { TranslationOverrides } from './define-locale'
+import { zhSessionCommands } from './zh_session_commands'
// Shell notices (remote-display toast, butterbar), spread into zh.ts.
export const zhNotices = {
@@ -16,7 +17,7 @@ export const zhNotices = {
}
},
promptNotices: {
- legacySendUnconfirmed:
- '此服务器无法确认这条消息之前的发送,它可能已经运行过。再次发送前请先查看对话。'
+ legacySendUnconfirmed: '此服务器无法确认这条消息之前的发送,它可能已经运行过。再次发送前请先查看对话。',
+ sessionCommands: zhSessionCommands
}
} satisfies Pick<TranslationOverrides, 'remoteDisplayBanner' | 'butterbar' | 'promptNotices'>
diff --git a/apps/desktop/src/i18n/zh_session_commands.ts b/apps/desktop/src/i18n/zh_session_commands.ts
new file mode 100644
index 00000000000..114fd2d5c64
--- /dev/null
+++ b/apps/desktop/src/i18n/zh_session_commands.ts
@@ -0,0 +1,17 @@
+// Typed /undo /retry /steer /queue lines (en_session_commands.ts is the source).
+export const zhSessionCommands = {
+ undoUsage: '用法:/undo [N]',
+ undoNothing: '没有可撤销的内容',
+ undidOne: (count: string) => `已撤销 ${count} 条消息 — 被移除的消息已放回输入框`,
+ undidOther: (count: string) => `已撤销 ${count} 条消息 — 被移除的消息已放回输入框`,
+ retryNothing: '没有可重试的内容',
+ retryUnsupported: '/retry:无法重试包含媒体或未知内容的消息',
+ steerUsage: '用法:/steer <提示>',
+ steerQueued: (preview: string) => `引导已排队 — 将在下一次工具调用后送达:“${preview}”`,
+ steerNoActiveTurn: (preview: string) => `当前没有进行中的回合 — 已排队到下一回合:“${preview}”`,
+ steerRejected: '引导被拒绝 — 没有进行中的回合,已排队到下一回合',
+ queued: (preview: string) => `已排队:“${preview}”`,
+ queueFailed: '无法将消息加入队列',
+ countOne: (count: string) => `${count} 条排队消息`,
+ countOther: (count: string) => `${count} 条排队消息`
+}
diff --git a/apps/desktop/src/lib/desktop-slash-commands.test.ts b/apps/desktop/src/lib/desktop-slash-commands.test.ts
index c1d8ba76b0a..834e4e72c1f 100644
--- a/apps/desktop/src/lib/desktop-slash-commands.test.ts
+++ b/apps/desktop/src/lib/desktop-slash-commands.test.ts
@@ -198,17 +198,8 @@ describe('desktop slash command curation', () => {
// prompt.background RPC since #97635 (the slash worker's completion
// print lands after the capture window closes, so the result never
// reached the originating conversation).
- const execNames = [
- '/debug',
- '/goal',
- '/personality',
- '/queue',
- '/retry',
- '/rollback',
- '/tools',
- '/undo',
- '/version'
- ]
+ // /undo /retry /steer /queue are local actions now: the shared gateway refuses them as exec.
+ const execNames = ['/debug', '/goal', '/personality', '/rollback', '/tools', '/version']
for (const name of execNames) {
expect(resolveDesktopCommand(name)?.surface).toEqual({ kind: 'exec' })
diff --git a/apps/desktop/src/lib/desktop-slash-commands.ts b/apps/desktop/src/lib/desktop-slash-commands.ts
index ab626ba26c5..6466cdbed03 100644
--- a/apps/desktop/src/lib/desktop-slash-commands.ts
+++ b/apps/desktop/src/lib/desktop-slash-commands.ts
@@ -70,10 +70,14 @@ export type DesktopActionId =
| 'new'
| 'pet'
| 'profile'
+ | 'queue'
| 'reasoning'
+ | 'retry'
| 'skin'
+ | 'steer'
| 'stop'
| 'title'
+ | 'undo'
| 'wake'
| 'yolo'
@@ -289,6 +293,25 @@ const DESKTOP_COMMAND_SPECS: readonly DesktopCommandSpec[] = [
surface: action('background'),
argumentMode: 'text'
},
+ // /undo /retry /steer /queue must be actions, not exec: the shared gateway refuses them as
+ // slash.exec. They run on the owner's canonical verbs like the Ink TUI (session.mutate rewind,
+ // session.steer) and on the composer's next-turn queue (slash-session-commands.ts).
+ { name: '/undo', description: 'Back up N user turns and re-prompt (default 1)', surface: action('undo') },
+ { name: '/retry', description: 'Retry the last message (resend to agent)', surface: action('retry') },
+ {
+ name: '/steer',
+ description: 'Inject a message after the next tool call without interrupting',
+ aliases: ['/s'],
+ surface: action('steer'),
+ argumentMode: 'text'
+ },
+ {
+ name: '/queue',
+ description: 'Queue a prompt for the next turn',
+ aliases: ['/q'],
+ surface: action('queue'),
+ argumentMode: 'text'
+ },
{
name: '/pet',
description: 'Toggle or adopt a petdex mascot (/pet, /pet list, /pet boba)',
diff --git a/locales/_keys.desktop.json b/locales/_keys.desktop.json
index 33cfcfd029d..c2fdf0b7db1 100644
--- a/locales/_keys.desktop.json
+++ b/locales/_keys.desktop.json
@@ -2418,6 +2418,20 @@
"profiles.title",
"profiles.unsavedChanges",
"promptNotices.legacySendUnconfirmed",
+ "promptNotices.sessionCommands.countOne",
+ "promptNotices.sessionCommands.countOther",
+ "promptNotices.sessionCommands.queueFailed",
+ "promptNotices.sessionCommands.queued",
+ "promptNotices.sessionCommands.retryNothing",
+ "promptNotices.sessionCommands.retryUnsupported",
+ "promptNotices.sessionCommands.steerNoActiveTurn",
+ "promptNotices.sessionCommands.steerQueued",
+ "promptNotices.sessionCommands.steerRejected",
+ "promptNotices.sessionCommands.steerUsage",
+ "promptNotices.sessionCommands.undidOne",
+ "promptNotices.sessionCommands.undidOther",
+ "promptNotices.sessionCommands.undoNothing",
+ "promptNotices.sessionCommands.undoUsage",
"prompts.gatewayDisconnected",
"prompts.reconnect",
"prompts.secretDesc",
diff --git a/website/docs/developer-guide/gateway-command-parity.md b/website/docs/developer-guide/gateway-command-parity.md
index 36f31306a30..1eda58ad24e 100644
--- a/website/docs/developer-guide/gateway-command-parity.md
+++ b/website/docs/developer-guide/gateway-command-parity.md
@@ -90,7 +90,7 @@ handler does; `client-local (cli_only)` commands are terminal/UI features of a c
| `/plugins` | refused | HermesCLI._cmd_plugins | slash.exec | unavailable: terminal | refused | client-local (cli_only) |
| `/profile` | read | HermesCLI._handle_profile_command | slash.exec | action: profile | refused | |
| `/prompt` (/compose) | refused | HermesCLI._handle_prompt_compose_command | local | slash.exec: refused | refused | client-local (cli_only) |
-| `/queue` (/q) | refused | HermesCLI._cmd_queue | local | slash.exec: refused | refused | |
+| `/queue` (/q) | refused | HermesCLI._cmd_queue | local | action: queue | refused | |
| `/quit` (/exit) | refused | HermesCLI._cmd_exit | local | unavailable: terminal | refused | client-local (cli_only) |
| `/reasoning` | control | HermesCLI._handle_reasoning_command | canonical route | action: reasoning | refused | per-session setting (gateway handler) |
| `/redraw` | refused | HermesCLI._cmd_redraw | local | unavailable: terminal | refused | client-local (cli_only) |
@@ -100,7 +100,7 @@ handler does; `client-local (cli_only)` commands are terminal/UI features of a c
| `/reload-skills` (/reload_skills) | refused | HermesCLI._cmd_reload_skills | commands.catalog, skills.reload | unavailable: advanced | refused | |
| `/restart` | refused | messaging-only: unknown command | slash.exec: refused | unavailable: terminal | refused | messaging-only |
| `/resume` | refused | HermesCLI._handle_resume_command | local | picker: session | refused | switches the messaging chat's session; local clients resume by id |
-| `/retry` | refused | HermesCLI._cmd_retry | canonical route | slash.exec: refused | refused | |
+| `/retry` | refused | HermesCLI._cmd_retry | canonical route | action: retry | refused | |
| `/review` | control | HermesCLI._handle_review_command | slash.exec | slash.exec | refused | |
| `/rollback` | refused | HermesCLI._handle_rollback_command | rollback.diff, rollback.list, rollback.restore | slash.exec: refused | refused | restores filesystem checkpoints |
| `/save` | refused | HermesCLI.save_conversation | session.save | rpc session.save | refused | writes an export file on the gateway host |
@@ -112,7 +112,7 @@ handler does; `client-local (cli_only)` commands are terminal/UI features of a c
| `/start` | refused | messaging-only: unknown command | slash.exec: refused | slash.exec: refused | refused | messaging-only |
| `/status` | read | HermesCLI._show_session_status | canonical route | slash.exec (rpc fallback) | refused | TUI session: main's `Hermes TUI Status` |
| `/statusbar` (/sb) | refused | HermesCLI._cmd_statusbar | local (preference not saved) | unavailable: terminal | refused | client-local (cli_only) |
-| `/steer` (/s) | refused | HermesCLI._cmd_steer | canonical route | slash.exec: refused | refused | |
+| `/steer` (/s) | refused | HermesCLI._cmd_steer | canonical route | action: steer | refused | |
| `/stop` | refused | HermesCLI._handle_stop_command | canonical route | action: stop | refused | |
| `/subgoal` | control | HermesCLI._handle_subgoal_command | slash.exec | slash.exec | refused | |
| `/subscription` (/upgrade) | refused | HermesCLI._show_subscription | sidecar: subscription.state | slash.exec: refused | refused | client-local (cli_only) |
@@ -123,7 +123,7 @@ handler does; `client-local (cli_only)` commands are terminal/UI features of a c
| `/toolsets` | read | HermesCLI.show_toolsets | slash.exec | unavailable: terminal | refused | client-local (cli_only) |
| `/topic` | refused | messaging-only: unknown command | slash.exec: refused | slash.exec: refused | refused | messaging-only |
| `/topup` | read | HermesCLI._show_billing | sidecar: billing.state | slash.exec | refused | |
-| `/undo` | refused | HermesCLI._cmd_undo | canonical route | slash.exec: refused | refused | |
+| `/undo` | refused | HermesCLI._cmd_undo | canonical route | action: undo | refused | |
| `/update` | refused | HermesCLI._cmd_update | local | unavailable: terminal | refused | |
| `/usage` | read (bare only (`reset` refused)) | HermesCLI._handle_usage_command | canonical route | slash.exec | refused | |
| `/verbose` | control | HermesCLI._toggle_verbose | config.set | unavailable: terminal | refused | per-session setting (gateway handler) |