diff --git a/cli/src/opencode/loop.ts b/cli/src/opencode/loop.ts index 0946f23b..de6a0ef1 100644 --- a/cli/src/opencode/loop.ts +++ b/cli/src/opencode/loop.ts @@ -8,6 +8,7 @@ import { opencodeRemoteLauncher } from './opencodeRemoteLauncher'; import { ApiClient, ApiSessionClient } from '@/lib'; import type { OpencodeMode, PermissionMode } from './types'; import type { OpencodeHookServer } from './utils/startOpencodeHookServer'; +import type { OpencodeGoalState } from './utils/opencodeGoal'; interface OpencodeLoopOptions { path: string; @@ -28,6 +29,8 @@ interface OpencodeLoopOptions { onReasoningEffortRollback?: (effort: string | null) => void; onSteerCancelHandlerChange?: (handler: OpencodeSteerCancelHandler | null) => void; onCompactAvailabilityChange?: (available: boolean) => void; + /** Latest OpenCode goal state, used by the goal RPC handler. */ + onOpencodeGoalStateChange?: (goal: OpencodeGoalState | null) => void; onClearRequested?: () => Promise; onClearCleanupComplete?: () => Promise; onClearCleanupFailed?: () => Promise; @@ -87,6 +90,7 @@ export async function opencodeLoop(opts: OpencodeLoopOptions): Promise { onModelRollback: opts.onModelRollback, onReasoningEffortRollback: opts.onReasoningEffortRollback, onCompactAvailabilityChange: opts.onCompactAvailabilityChange, + onOpencodeGoalStateChange: opts.onOpencodeGoalStateChange, onSteerCancelHandlerChange: opts.onSteerCancelHandlerChange, isLocalIdCancelled: opts.isLocalIdCancelled, onClearRequested: opts.onClearRequested, diff --git a/cli/src/opencode/opencodeRemoteLauncher.ts b/cli/src/opencode/opencodeRemoteLauncher.ts index 56f7312e..2638f906 100644 --- a/cli/src/opencode/opencodeRemoteLauncher.ts +++ b/cli/src/opencode/opencodeRemoteLauncher.ts @@ -40,7 +40,7 @@ import { } from './utils/opencodeCompactBridge'; import { OpencodeNativeTranscript } from './utils/opencodeNativeTranscript'; import { opencodeCompactionEventId } from './utils/opencodeCompactionProjector'; -import { asOpencodeGoalState, fetchOpencodeGoal, type OpencodeGoalState } from './utils/opencodeGoal'; +import { asOpencodeGoalState, fetchOpencodeGoal, toThreadGoal, type OpencodeGoalState } from './utils/opencodeGoal'; import { formatOpencodePromptError } from './utils/opencodeErrorText'; import { formatOpencodeRetryStatus, @@ -65,6 +65,7 @@ type OpencodeRemoteLauncherOptions = { // a `/compact` message should be queued or immediately answered with a // "not yet supported" reply — see its `slash.kind === 'compact'` branch. onCompactAvailabilityChange?: (available: boolean) => void; + onOpencodeGoalStateChange?: (goal: OpencodeGoalState | null) => void; // Consumes (delete-and-return) whether the queued item with this localId // was cancelled via runOpencode.ts's `onCancelQueuedMessage` fallback // branch (see the comment on `cancelledDequeuedLocalIds` there for what @@ -1345,6 +1346,7 @@ class OpencodeRemoteLauncher extends RemoteLauncherBase { if (key === this.goalProjectionKey) return; this.goalProjectionKey = key; this.goalState = goal; + this.options.onOpencodeGoalStateChange?.(goal); // A goal loop runs outside ACP turns, so nothing else marks the // session as working. Without this the session list shows it idle // while the agent is actively working through rounds. @@ -1353,20 +1355,11 @@ class OpencodeRemoteLauncher extends RemoteLauncherBase { session.client.sendAgentMessage({ type: 'thread_goal_cleared', thread_id: acpSessionId }); return; } - const webGoal = { - source: 'opencode' as const, - threadId: acpSessionId, - objective: goal.objective, - status: goal.status, - // OpenCode counts continuation rounds, not tokens. Keep them in - // their own fields so the UI never labels them as tokens. - rounds: goal.rounds, - maxRounds: goal.maxRounds, - createdAt: goal.updatedAt, - updatedAt: goal.updatedAt, - timeUsedSeconds: 0 - }; - session.client.sendAgentMessage({ type: 'thread_goal_updated', thread_id: acpSessionId, goal: webGoal }); + session.client.sendAgentMessage({ + type: 'thread_goal_updated', + thread_id: acpSessionId, + goal: toThreadGoal(goal, acpSessionId) + }); } private handleV2SteerEvent(type: string, properties: Record): void { diff --git a/cli/src/opencode/runOpencode.test.ts b/cli/src/opencode/runOpencode.test.ts index 164473f9..7166a619 100644 --- a/cli/src/opencode/runOpencode.test.ts +++ b/cli/src/opencode/runOpencode.test.ts @@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; import { buildCliArgs } from '@/runner/run'; import { parseRemoteAgentCommandOptions } from '@/commands/agentCommandOptions'; import { OPENCODE_PERMISSION_MODES } from '@hapi/protocol/modes'; +import { RPC_METHODS } from '@hapi/protocol/rpcMethods'; import type { MessageQueue2 } from '@/utils/MessageQueue2'; import type { OpencodeMode } from './types'; @@ -47,6 +48,7 @@ const harness = vi.hoisted(() => ({ // run without throwing when a test invokes the real onModeChange // wrapper passed to opencodeLoop. updateAgentState: vi.fn(), + updateMetadata: vi.fn(), rpcHandlerManager: { registerHandler: vi.fn() } @@ -165,6 +167,7 @@ describe('runOpencode set-session-config handler', () => { harness.session.sendSessionEvent.mockReset(); harness.session.emitMessagesConsumed.mockReset(); harness.session.updateAgentState.mockReset(); + harness.session.updateMetadata.mockReset(); harness.session.rpcHandlerManager.registerHandler.mockReset(); harness.listSlashCommands.mockReset(); harness.listSlashCommands.mockResolvedValue([]); @@ -415,6 +418,35 @@ describe('runOpencode set-session-config handler', () => { expect(harness.session.sendAgentMessage).not.toHaveBeenCalled(); }); + it('serves the OpenCode goal over RPC and queues controls as native commands', async () => { + await runOpencode({}); + + const handler = harness.session.rpcHandlerManager.registerHandler.mock.calls + .find(call => call[0] === RPC_METHODS.OpencodeGoal)?.[1] as + | ((request: Record) => Promise<{ goal: Record | null }>) + | undefined; + expect(handler).toBeDefined(); + + await expect(handler!({ action: 'get' })).resolves.toEqual({ goal: null }); + + const loopArgs = harness.opencodeLoopArgs[0]; + const onGoalStateChange = loopArgs.onOpencodeGoalStateChange as + | ((goal: Record | null) => void) | undefined; + onGoalStateChange!({ id: 'g', objective: 'x', status: 'active', rounds: 2, maxRounds: 50, updatedAt: 1 }); + + await expect(handler!({ action: 'get' })).resolves.toMatchObject({ + goal: { status: 'active', rounds: 2, source: 'opencode' } + }); + + await handler!({ action: 'pause' }); + const messageQueue = loopArgs.messageQueue as + { queue: Array<{ message: string; mode: { operation?: string } }> }; + expect(messageQueue.queue[0]).toMatchObject({ + message: '/goal pause', + mode: { operation: 'goal' } + }); + }); + it('queues /goal verbatim as its own isolated operation', async () => { await runOpencode({}); diff --git a/cli/src/opencode/runOpencode.ts b/cli/src/opencode/runOpencode.ts index bbefef46..ed2f4a23 100644 --- a/cli/src/opencode/runOpencode.ts +++ b/cli/src/opencode/runOpencode.ts @@ -19,6 +19,9 @@ import { listSlashCommands } from '@/modules/common/slashCommands'; import { resolveOpencodeSlashCommand } from './utils/slashCommands'; import { isRetryableConnectionError } from '@/utils/errorUtils'; import { withRetry } from '@/utils/time'; +import { RPC_METHODS } from '@hapi/protocol/rpcMethods'; +import { OpencodeGoalRequestSchema } from '@hapi/protocol/apiTypes'; +import { toThreadGoal, type OpencodeGoalState } from './utils/opencodeGoal'; export async function runOpencode(opts: { startedBy?: 'runner' | 'terminal'; @@ -133,6 +136,31 @@ export async function runOpencode(opts: { let currentPermissionMode: PermissionMode = opts.permissionMode ?? 'default'; let sessionModel: string | null = initialModel; let sessionModelReasoningEffort: string | null = initialModelReasoningEffort; + let opencodeGoalState: OpencodeGoalState | null = null; + + // Same control surface Codex exposes over `codex-goal`: the web queries + // the live goal instead of inferring it from chat messages, and controls + // are queued as the native `/goal` commands OpenCode owns. + session.rpcHandlerManager.registerHandler(RPC_METHODS.OpencodeGoal, async raw => { + const request = OpencodeGoalRequestSchema.parse(raw); + if (request.action !== 'get') { + const text = request.action === 'update' ? `/goal ${request.objective}` : `/goal ${request.action}`; + messageQueue.pushIsolated(text, { + permissionMode: currentPermissionMode, + model: sessionModel, + modelReasoningEffort: sessionModelReasoningEffort, + operation: 'goal' + }); + } + return { + goal: opencodeGoalState ? toThreadGoal(opencodeGoalState, session.sessionId) : null + }; + }); + session.updateMetadata(metadata => ({ + ...metadata, + capabilities: { ...metadata.capabilities, opencodeGoal: true } + })); + const hookServer = await startOpencodeHookServer({ onEvent: (event) => { const currentSession = sessionWrapperRef.current; @@ -537,6 +565,7 @@ export async function runOpencode(opts: { resumeSessionId: opts.resumeSessionId, hookServer, hookUrl, + onOpencodeGoalStateChange: (goal) => { opencodeGoalState = goal; }, onModeChange: (mode) => { if (mode === 'remote') { // A fresh remote entry is beginning (first-ever, or a diff --git a/cli/src/opencode/utils/opencodeGoal.ts b/cli/src/opencode/utils/opencodeGoal.ts index bdcb067a..db08591b 100644 --- a/cli/src/opencode/utils/opencodeGoal.ts +++ b/cli/src/opencode/utils/opencodeGoal.ts @@ -49,6 +49,21 @@ export async function fetchOpencodeGoal(opts: { return asOpencodeGoalState(output ?? null); } +/** Project OpenCode's goal state into the shared ThreadGoal shape. */ +export function toThreadGoal(goal: OpencodeGoalState, threadId: string) { + return { + source: 'opencode' as const, + threadId, + objective: goal.objective, + status: goal.status, + rounds: goal.rounds, + maxRounds: goal.maxRounds, + createdAt: goal.updatedAt, + updatedAt: goal.updatedAt, + timeUsedSeconds: 0 + } +} + /** * Pull `{ sessionID, goal }` out of an `rpc.opencode.goal.changed` event. * v2 event frames wrap the body twice (`{ type, data: { type, data, location } }` diff --git a/hub/src/sync/rpcGateway.ts b/hub/src/sync/rpcGateway.ts index 81870fb5..1ee56281 100644 --- a/hub/src/sync/rpcGateway.ts +++ b/hub/src/sync/rpcGateway.ts @@ -3,6 +3,7 @@ import { PERMISSION_REQUEST_NOT_FOUND_MESSAGE, RPC_METHODS } from '@hapi/protoco import { sessionStartupTimeoutMs } from '@hapi/protocol' import { CodexGoalResponseSchema, + OpencodeGoalResponseSchema, ArchiveCodexSessionRpcResponseSchema, AgentAvailabilityResponseSchema, CursorChatStoreStatusSchema, @@ -15,6 +16,8 @@ import { import type { CodexGoalRequest, CodexGoalResponse, + OpencodeGoalRequest, + OpencodeGoalResponse, AgyModelsResponse, ClaudeModelsResponse, AgentAvailabilityResponse, @@ -732,6 +735,10 @@ export class RpcGateway { return CodexGoalResponseSchema.parse(await this.sessionRpc(sessionId, RPC_METHODS.CodexGoal, request)) } + async opencodeGoal(sessionId: string, request: OpencodeGoalRequest): Promise { + return OpencodeGoalResponseSchema.parse(await this.sessionRpc(sessionId, RPC_METHODS.OpencodeGoal, request)) + } + async rewindConversation( sessionId: string, params: { messageLocalId: string } diff --git a/hub/src/sync/syncEngine.ts b/hub/src/sync/syncEngine.ts index 7d831900..4eb10533 100644 --- a/hub/src/sync/syncEngine.ts +++ b/hub/src/sync/syncEngine.ts @@ -13,7 +13,7 @@ import { isMachineCapabilitySkewed, runnerSupportsAgentTeam, } from '@hapi/protocol/runnerCapabilities' -import type { CodexGoalRequest, CodexGoalResponse, CursorChatStoreStatus, CursorMigrateOutcome, CursorMigrateToAcpRequest, ImplementCodexPlanResult, MessageContextResponse, MessageDeliveryMode, MessagesResponse, QueuedStateResponse, RewindConversationErrorCode, SlashCommandsResponse } from '@hapi/protocol/apiTypes' +import type { CodexGoalRequest, CodexGoalResponse, OpencodeGoalRequest, OpencodeGoalResponse, CursorChatStoreStatus, CursorMigrateOutcome, CursorMigrateToAcpRequest, ImplementCodexPlanResult, MessageContextResponse, MessageDeliveryMode, MessagesResponse, QueuedStateResponse, RewindConversationErrorCode, SlashCommandsResponse } from '@hapi/protocol/apiTypes' import type { SteerQueuedMessageResponse } from '@hapi/protocol/schemas' import type { AgentFlavor, BackgroundTask, CodexCollaborationMode, CopilotAgentMode, DecryptedMessage, PermissionMode, Session, SyncEvent } from '@hapi/protocol/types' import { hasConversationMessageContent, unwrapRoleWrappedRecordEnvelope } from '@hapi/protocol/messages' @@ -2606,6 +2606,15 @@ export class SyncEngine { return await this.rpcGateway.codexGoal(access.sessionId, request) } + async opencodeGoal(sessionId: string, namespace: string, request: OpencodeGoalRequest): Promise { + const access = this.sessionCache.resolveSessionAccess(sessionId, namespace) + if (!access.ok || !access.session.active || access.session.metadata?.flavor !== 'opencode' + || !access.session.metadata.capabilities?.opencodeGoal) { + throw new Error('Goal controls require an active, updated OpenCode session') + } + return await this.rpcGateway.opencodeGoal(access.sessionId, request) + } + async switchSession(sessionId: string, to: 'remote' | 'local'): Promise { if (this.getSession(sessionId)?.metadata?.capabilities?.concurrentClients) throw new Error('control_mode_not_applicable') if (this.historyActionsInFlight.has(sessionId)) { diff --git a/hub/src/web/routes/sessions.ts b/hub/src/web/routes/sessions.ts index bfcd1849..75d881f2 100644 --- a/hub/src/web/routes/sessions.ts +++ b/hub/src/web/routes/sessions.ts @@ -1,6 +1,7 @@ import { compareSessionSummaries } from '@hapi/protocol' import { CodexGoalRequestSchema, + OpencodeGoalRequestSchema, SessionReadStateRequestSchema, CursorMigrateToAcpRequestSchema, DeleteUploadRequestSchema, @@ -819,6 +820,25 @@ export function createSessionsRoutes( } }) + app.on(['GET', 'POST'], '/sessions/:id/opencode/goal', async (c) => { + const engine = requireSyncEngine(c, getSyncEngine) + if (engine instanceof Response) return engine + const access = requireSessionFromParam(c, engine, { requireActive: true }) + if (access instanceof Response) return access + if (c.get('role') === 'session-guest') return c.json({ error: 'Goal controls require session owner access' }, 403) + if (access.session.metadata?.flavor !== 'opencode' || !access.session.metadata.capabilities?.opencodeGoal) { + return c.json({ error: 'Goal controls require an updated OpenCode session', code: 'goal_unavailable' }, 409) + } + const parsed = OpencodeGoalRequestSchema.safeParse(c.req.method === 'GET' + ? { action: 'get' } : await c.req.json().catch(() => null)) + if (!parsed.success) return c.json({ error: 'Invalid Goal action' }, 400) + try { + return c.json(await engine.opencodeGoal(access.sessionId, c.get('namespace'), parsed.data)) + } catch (error) { + return c.json({ error: error instanceof Error ? error.message : 'Goal action failed' }, 502) + } + }) + app.post('/sessions/:id/codex/plan/implement', async (c) => { const engine = requireSyncEngine(c, getSyncEngine) if (engine instanceof Response) return engine diff --git a/shared/src/apiTypes.ts b/shared/src/apiTypes.ts index 42d200c9..b96689ad 100644 --- a/shared/src/apiTypes.ts +++ b/shared/src/apiTypes.ts @@ -974,6 +974,23 @@ export type CodexGoalRequest = z.infer export const CodexGoalResponseSchema = z.object({ goal: ThreadGoalSchema.nullable() }) export type CodexGoalResponse = z.infer +// OpenCode goals are driven by its core plugin through `/goal` commands. The +// same control surface as Codex, routed to the OpenCode CLI instead. +export const OpencodeGoalRequestSchema = z.discriminatedUnion('action', [ + z.object({ action: z.literal('get') }).strict(), + z.object({ + action: z.literal('update'), + objective: z.string().trim().min(1).refine(value => Array.from(value).length <= 4000, 'Goal must be at most 4000 characters') + }).strict(), + z.object({ action: z.literal('pause') }).strict(), + z.object({ action: z.literal('resume') }).strict(), + z.object({ action: z.literal('clear') }).strict() +]) + +export type OpencodeGoalRequest = z.infer +export const OpencodeGoalResponseSchema = z.object({ goal: ThreadGoalSchema.nullable() }) +export type OpencodeGoalResponse = z.infer + export type ImplementCodexPlanResult = { ok: true } | { ok: false code: 'stale_plan' | 'unavailable' | 'indeterminate' | 'failed' diff --git a/shared/src/rpcMethods.ts b/shared/src/rpcMethods.ts index f618bd27..c08f44b9 100644 --- a/shared/src/rpcMethods.ts +++ b/shared/src/rpcMethods.ts @@ -69,6 +69,7 @@ export const RPC_METHODS = { ClearConversation: 'clear-conversation', ImplementCodexPlan: 'implement-codex-plan', CodexGoal: 'codex-goal', + OpencodeGoal: 'opencode-goal', } as const export const RPC_TARGET_MISSING_ERROR_CODE = 'rpc_target_missing' as const diff --git a/shared/src/schemas.ts b/shared/src/schemas.ts index d434c381..811fceab 100644 --- a/shared/src/schemas.ts +++ b/shared/src/schemas.ts @@ -38,6 +38,7 @@ export type OpencodeClearOperation = z.infer { + return await this.request(`/api/sessions/${encodeURIComponent(sessionId)}/opencode/goal`) + } + + async manageOpencodeGoal(sessionId: string, action: OpencodeGoalRequest): Promise { + return await this.request(`/api/sessions/${encodeURIComponent(sessionId)}/opencode/goal`, { + method: 'POST', body: JSON.stringify(action) + }) + } + async retryCodexTurn(sessionId: string): Promise<{ retried: boolean; error?: string; sessionId?: string }> { return await this.request<{ retried: boolean; error?: string; sessionId?: string }>( `/api/sessions/${encodeURIComponent(sessionId)}/retry-codex-turn`, diff --git a/web/src/components/SessionChat.tsx b/web/src/components/SessionChat.tsx index 4f3da505..9948a184 100644 --- a/web/src/components/SessionChat.tsx +++ b/web/src/components/SessionChat.tsx @@ -98,6 +98,7 @@ import { TeamPanel } from '@/components/TeamPanel' import { SessionStatusPanel } from '@/components/SessionStatusPanel' import { buildSessionStatusData } from '@/chat/sessionStatus' import { useCodexGoal } from '@/hooks/useCodexGoal' +import { useOpencodeGoal } from '@/hooks/useOpencodeGoal' import { usePlatform } from '@/hooks/usePlatform' import { getToolCardDisplayPresentation, useToolCardDisplayMode } from '@/hooks/useToolCardDisplayMode' import { useSessionActions } from '@/hooks/mutations/useSessionActions' @@ -1539,10 +1540,8 @@ function SessionChatInner(props: SessionChatProps) { // OpenCode's goal lives in a core plugin; its controls are the same `/goal` // slash commands the user can type. Drive them through the composer so the // H5 status panel gets Codex-style pause/resume/clear buttons too. - // Tie the controls directly to the card the user can see. Requiring the - // session's active/guest/controlled flags here previously hid the buttons - // even when the goal card was right in front of the user. - const canManageOpencodeGoal = reduced.latestGoal?.source === 'opencode' + const canManageOpencodeGoal = !isSessionGuest && agentFlavor === 'opencode' && props.session.active + && Boolean(props.session.metadata?.capabilities?.opencodeGoal) && !controlledByUser const goalEventId = useMemo(() => { for (let i = normalizedGoalStateMessages.length - 1; i >= 0; i--) { const message = normalizedGoalStateMessages[i] @@ -1553,9 +1552,12 @@ function SessionChatInner(props: SessionChatProps) { return null }, [normalizedGoalStateMessages]) const codexGoal = useCodexGoal(props.api, props.session.id, canManageGoal, goalEventId) + const opencodeGoal = useOpencodeGoal(props.api, props.session.id, canManageOpencodeGoal, goalEventId) const sessionStatus = useMemo( () => buildSessionStatusData({ - goal: codexGoal.goal === undefined ? reduced.latestGoal : codexGoal.goal, + goal: opencodeGoal.goal !== undefined + ? opencodeGoal.goal + : codexGoal.goal === undefined ? reduced.latestGoal : codexGoal.goal, tasks: props.session.todos, blocks: reconciled.blocks, backgroundTasks: props.session.backgroundTasks @@ -1563,6 +1565,7 @@ function SessionChatInner(props: SessionChatProps) { [ reduced.latestGoal, codexGoal.goal, + opencodeGoal.goal, props.session.todos, props.session.backgroundTasks, reconciled.blocks @@ -2058,14 +2061,7 @@ function SessionChatInner(props: SessionChatProps) { {sessionStatus ? ( { - const text = action.action === 'update' - ? `/goal ${action.objective}` - : `/goal ${action.action}`; - await props.onSend(text); - } - : canManageGoal ? codexGoal.act : undefined} + onGoalAction={canManageOpencodeGoal ? opencodeGoal.act : canManageGoal ? codexGoal.act : undefined} /> ) : null} diff --git a/web/src/hooks/useOpencodeGoal.ts b/web/src/hooks/useOpencodeGoal.ts new file mode 100644 index 00000000..08a898bf --- /dev/null +++ b/web/src/hooks/useOpencodeGoal.ts @@ -0,0 +1,35 @@ +import { useEffect } from 'react' +import { useQuery, useQueryClient } from '@tanstack/react-query' +import type { OpencodeGoalRequest, OpencodeGoalResponse } from '@hapi/protocol/apiTypes' +import type { ApiClient } from '@/api/client' +import { queryKeys } from '@/lib/query-keys' + +/** Codex parity: the goal comes from a live RPC query, never from chat text. */ +export function useOpencodeGoal(api: ApiClient, sessionId: string, enabled: boolean, goalEventId: string | null) { + const queryClient = useQueryClient() + const queryKey = queryKeys.opencodeGoal(sessionId) + const query = useQuery({ + queryKey, + queryFn: () => api.getOpencodeGoal(sessionId), + enabled, + retry: false, + refetchOnWindowFocus: true + }) + + useEffect(() => { + if (enabled) void queryClient.invalidateQueries({ queryKey }) + }, [queryClient, sessionId, enabled, goalEventId]) + + const act = async (action: OpencodeGoalRequest) => { + await queryClient.cancelQueries({ queryKey }) + try { + const result = await api.manageOpencodeGoal(sessionId, action) + queryClient.setQueryData(queryKey, result) + void queryClient.invalidateQueries({ queryKey }) + } catch (error) { + void queryClient.invalidateQueries({ queryKey }) + throw error + } + } + return { goal: enabled ? query.data?.goal : undefined, act } +} diff --git a/web/src/lib/query-keys.ts b/web/src/lib/query-keys.ts index 400dca20..b3fa9852 100644 --- a/web/src/lib/query-keys.ts +++ b/web/src/lib/query-keys.ts @@ -13,6 +13,7 @@ export const queryKeys = { machineAgentAvailability: (machineId: string) => ['machine-agent-availability', machineId] as const, sessionCodexModels: (sessionId: string) => ['session-codex-models', sessionId] as const, codexGoal: (sessionId: string) => ['codex-goal', sessionId] as const, + opencodeGoal: (sessionId: string) => ['opencode-goal', sessionId] as const, machineDshModels: (machineId: string) => ['machine-dsh-models', machineId] as const, sessionDshModels: (sessionId: string) => ['session-dsh-models', sessionId] as const, gitStatus: (sessionId: string) => ['git-status', sessionId] as const,