mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
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:
1 parent
aa1da8d608
commit
c497df5161
14 files changed
+146
-122
No files matched your search
@@ -5,8 +5,8 @@ import http from 'http'
|
||||
import type { AddressInfo } from 'net'
|
||||
import path from 'path'
|
||||
import os from 'os'
|
||||
import { ASSISTANT_NOTIFICATION_LIMITS, AssistantNotificationRequestSchema } from '@opencode-manager/shared/schemas'
|
||||
import { MANAGER_TOOL_NAME, MANAGER_TOOL_ALLOWED_ROUTES, parseAllowedRoute } from '../../src/services/opencode-manager-tool-plugin'
|
||||
import { ASSISTANT_NOTIFICATION_LIMITS, AssistantNotificationRequestSchema, MANAGER_TOOL_NAME } from '@opencode-manager/shared/schemas'
|
||||
import { MANAGER_TOOL_ALLOWED_ROUTES, parseAllowedRoute } from '../../src/services/opencode-manager-tool-plugin'
|
||||
import { installManagedPlugins, getOpenCodePluginDir } from '../../src/services/opencode/plugin-registry'
|
||||
import { loadGeneratedPlugin, type GeneratedTool } from '../helpers/opencode-plugin-context'
|
||||
import { resolveOpenCode2Binary, runOpenCodeStandalone } from '../helpers/opencode-binary'
|
||||
@@ -132,7 +132,8 @@ describe('ocm-manager plugin', () => {
|
||||
const tool = await loadTool(configHome)
|
||||
|
||||
expect(tool.description).toContain('open_walkthrough')
|
||||
expect(tool.description).toContain("open the change Walkthrough panel for the current session in the user's Manager window")
|
||||
expect(tool.description).toContain('request the change Walkthrough for the current session')
|
||||
expect(tool.description).toContain('when this session is open on desktop')
|
||||
})
|
||||
|
||||
it('enforces the notification limits the internal API enforces', async () => {
|
||||
@@ -242,8 +243,10 @@ describe('ocm-manager plugin', () => {
|
||||
expect(init.headers.Authorization).toBe('Bearer secret-token')
|
||||
expect(init.headers['content-type']).toBe('application/json')
|
||||
expect(JSON.parse(init.body)).toEqual({ source: { kind: 'staged' } })
|
||||
expect(result.content).toBe('Opened the walkthrough (2 stops).')
|
||||
expect(result.metadata).toEqual({ openPanel: 'walkthrough', source: { kind: 'staged' } })
|
||||
expect(result.content).toBe(
|
||||
'Requested the walkthrough (2 stops). It opens in the Manager window when this session is open on desktop; otherwise the user can open it from this tool call.',
|
||||
)
|
||||
expect(result.metadata).toBeUndefined()
|
||||
})
|
||||
|
||||
it('reports that the walkthrough is generating', async () => {
|
||||
@@ -252,8 +255,10 @@ describe('ocm-manager plugin', () => {
|
||||
|
||||
const result = await runToolResult(tool, { action: 'open_walkthrough', params: {} }, { sessionID: 'ses_abc' })
|
||||
|
||||
expect(result.content).toBe('Opened the walkthrough. It is generating; the user can page through it as stops are explained.')
|
||||
expect(result.metadata).toEqual({ openPanel: 'walkthrough' })
|
||||
expect(result.content).toBe(
|
||||
'Requested the walkthrough; it is generating. It opens in the Manager window when this session is open on desktop; otherwise the user can open it from this tool call.',
|
||||
)
|
||||
expect(result.metadata).toBeUndefined()
|
||||
})
|
||||
|
||||
it('opens the walkthrough without a body when no source is given', async () => {
|
||||
@@ -376,6 +381,8 @@ describe('ocm-manager plugin', () => {
|
||||
['POST', '/multi-runs'],
|
||||
['POST', '/multi-runs/1/fusions'],
|
||||
['POST', '/multi-runs/1/entries/2/discard'],
|
||||
['GET', '/change-walkthroughs/x'],
|
||||
['POST', '/change-walkthroughs/x'],
|
||||
] as const
|
||||
|
||||
for (const [method, path] of deniedRoutes) {
|
||||
|
||||
Reference in new issue
Block a user