()
| 98 | import { makeHostHandle } from '../hostHandle.js' |
| 99 | |
| 100 | function ctx() { |
| 101 | return { |
| 102 | host: makeHostHandle({ |
| 103 | toolUseContext: { |
| 104 | options: { |
| 105 | agentDefinitions: { activeAgents: [] }, |
| 106 | querySource: 'workflow', |
| 107 | mainLoopModel: 'm', |
| 108 | }, |
| 109 | getAppState: () => ({ |
| 110 | toolPermissionContext: { |
| 111 | mode: 'acceptEdits', |
| 112 | alwaysAllowRules: {}, |
| 113 | }, |
| 114 | mcp: { tools: [] }, |
| 115 | }), |
| 116 | } as never, |
| 117 | canUseTool: (() => Promise.resolve({ behavior: 'allow' })) as never, |
| 118 | // run() does not read parentMessage; use an empty object placeholder to satisfy the WorkflowHostBundle type. |
| 119 | parentMessage: {} as never, |
| 120 | }), |
| 121 | signal: new AbortController().signal, |
| 122 | runId: 'r1', |
| 123 | agentId: 1, |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | test('text agent → ok + token/tool/model accounting', async () => { |
| 128 | const res = await claudeCodeBackend.run({ prompt: 'do it' }, ctx()) |
no test coverage detected