fix(walkthrough): address review of agent-opened walkthrough

- Wait for the model catalog once per walkthrough generation instead of before every model call
- Report open_walkthrough as requested, not opened, and drop its unused metadata
- Share the ocm tool and action names through @opencode-manager/shared
- Remove the unused source-request nonce and duplicate session check
- Scan only new messages when auto-opening the walkthrough
- Assert the request action cannot reach the internal change-walkthroughs route
This commit is contained in:
Chris Scott committed 2026-10-09 11:25:26 -04:00
1 parent aa1da8d608
commit c497df5161
14 files changed
+146 -122

No files matched your search

+4 -7
View File
@@ -1,11 +1,8 @@
import type { SessionMessageAssistantTool, SessionMessageInfo } from '@opencode-manager/shared/opencode'
import { WalkthroughSourceSchema } from '@opencode-manager/shared/schemas'
import { MANAGER_TOOL_NAME, MANAGER_TOOL_OPEN_WALKTHROUGH_ACTION, WalkthroughSourceSchema } from '@opencode-manager/shared/schemas'
import type { WalkthroughSource } from '@opencode-manager/shared/schemas'
export const OCM_TOOL_NAME = 'ocm'
export const OPEN_WALKTHROUGH_ACTION = 'open_walkthrough'
export interface OpenWalkthroughCall {
interface OpenWalkthroughCall {
id: string
source?: WalkthroughSource
}
@@ -28,8 +25,8 @@ function readOpenWalkthroughSource(params: unknown): WalkthroughSource | undefin
export function readOpenWalkthroughCall(
part: SessionMessageAssistantTool,
): OpenWalkthroughCall | undefined {
if (part.name !== OCM_TOOL_NAME || part.state.status !== 'completed') return undefined
if (part.state.input.action !== OPEN_WALKTHROUGH_ACTION) return undefined
if (part.name !== MANAGER_TOOL_NAME || part.state.status !== 'completed') return undefined
if (part.state.input.action !== MANAGER_TOOL_OPEN_WALKTHROUGH_ACTION) return undefined
return { id: part.id, source: readOpenWalkthroughSource(part.state.input.params) }
}