MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / ctx

Function ctx

src/workflow/__tests__/claudeCodeBackend.test.ts:100–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98import { makeHostHandle } from '../hostHandle.js'
99
100function 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
127test('text agent → ok + token/tool/model accounting', async () => {
128 const res = await claudeCodeBackend.run({ prompt: 'do it' }, ctx())

Callers 1

Calls 2

makeHostHandleFunction · 0.85
resolveMethod · 0.45

Tested by

no test coverage detected