fix: show agent messages before workspace lookup and bump to 1.2.24
This commit is contained in:
@@ -15,6 +15,8 @@ const plain = value => JSON.parse(JSON.stringify(value))
|
||||
function harness(remoteWorkspace) {
|
||||
const executions = []
|
||||
const calls = []
|
||||
const contexts = []
|
||||
const events = []
|
||||
const errors = []
|
||||
const target = { host: '100.64.0.10', user: 'fixture', workspaceRoot: '/fixture/workspace' }
|
||||
const live = [{ name: 'NAV2-MKMini', folderName: 'vehicle', state: 'running', parameters: ['sim_mode:=false', 'robot:=mkmini'] }]
|
||||
@@ -26,10 +28,14 @@ function harness(remoteWorkspace) {
|
||||
getRemoteWorkspaceTarget: () => target, applyModuleParameterOverrides: modules => modules,
|
||||
validateAgentTool: request => request, AGENT_PRACTICE_PROFILES: [],
|
||||
window: {
|
||||
remoteWorkspace: { modules: { list: async () => ({ modules: live }) }, agent: { readTool: readTool('remote') } },
|
||||
localWorkspace: { modules: { list: async () => ({ modules: live }) }, agent: { readTool: readTool('local') } }
|
||||
remoteWorkspace: { modules: { list: async () => { events.push('snapshot-read'); return { modules: live } } }, agent: { readTool: readTool('remote') } },
|
||||
localWorkspace: { modules: { list: async () => { events.push('snapshot-read'); return { modules: live } } }, agent: { readTool: readTool('local') } }
|
||||
},
|
||||
requestAgentPlan: async (...args) => {
|
||||
calls.push(args)
|
||||
events.push('plan-start')
|
||||
contexts.push(await args[3].loadInitialContext(new AbortController().signal))
|
||||
},
|
||||
requestAgentPlan: async (...args) => { calls.push(args) },
|
||||
onTitlebarNotice: (...args) => { errors.push(args) }, console: { error: () => {} },
|
||||
loadAgentRequestedContext: async () => ({ modules: [], runtimeLogs: [] })
|
||||
}
|
||||
@@ -37,16 +43,19 @@ function harness(remoteWorkspace) {
|
||||
vm.runInNewContext(ts.transpileModule(names.map(name => `const ${name} = ${declarations.get(name)}; exports.${name} = ${name}`).join('\n'), {
|
||||
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 }
|
||||
}).outputText, globals)
|
||||
return { ...exports, executions, calls, errors }
|
||||
return { ...exports, executions, calls, contexts, events, errors }
|
||||
}
|
||||
|
||||
for (const remote of [false, true]) {
|
||||
test(`${remote ? 'remote' : 'local'}: a new question refreshes state and start settings before sending context`, async () => {
|
||||
test(`${remote ? 'remote' : 'local'}: enters the chat lifecycle immediately and refreshes state before the provider request`, async () => {
|
||||
const h = harness(remote)
|
||||
await h.submitAgentRequest('최대 속도 제한 코드 위치')
|
||||
assert.deepEqual(h.errors, [])
|
||||
assert.equal(h.calls.length, 1)
|
||||
const [, modules, , options] = h.calls[0]
|
||||
const [, initialModules, , options] = h.calls[0]
|
||||
assert.deepEqual(plain(initialModules), [])
|
||||
assert.deepEqual(h.events, ['plan-start', 'snapshot-read'])
|
||||
const { modules } = h.contexts[0]
|
||||
assert.equal(modules[0].state, 'running')
|
||||
assert.deepEqual(plain(modules[0].parameters), ['sim_mode:=false', 'robot:=mkmini'])
|
||||
assert.deepEqual(plain(modules[0].files), [])
|
||||
|
||||
Reference in New Issue
Block a user