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

@@ -111,6 +111,44 @@ describe('useAutoOpenWalkthrough', () => {
expect(onOpen).toHaveBeenCalledTimes(1)
})
it('opens once when a call completes in the last message across streaming updates', () => {
const onOpen = vi.fn()
const { rerender } = renderAutoOpen({
sessionId: 's1',
messages: [assistantMessage('m1', otherToolPart('t1'))],
enabled: true,
loading: false,
onOpen,
})
rerender({
sessionId: 's1',
messages: [
assistantMessage('m1', otherToolPart('t1')),
assistantMessage('m2', openWalkthroughPart('t2', 'running')),
],
enabled: true,
loading: false,
onOpen,
})
expect(onOpen).not.toHaveBeenCalled()
rerender({
sessionId: 's1',
messages: [
assistantMessage('m1', otherToolPart('t1')),
assistantMessage('m2', openWalkthroughPart('t2', 'completed')),
],
enabled: true,
loading: false,
onOpen,
})
expect(onOpen).toHaveBeenCalledTimes(1)
expect(onOpen).toHaveBeenCalledWith(undefined)
})
it('passes the requested source to the opener', () => {
const onOpen = vi.fn()
const part: SessionMessageAssistantTool = {