(
tools: Array<{ name: string; userFacingName: () => string }>,
)
| 39 | } |
| 40 | |
| 41 | function createToolUseContext( |
| 42 | tools: Array<{ name: string; userFacingName: () => string }>, |
| 43 | ) { |
| 44 | let appState = getDefaultAppState() |
| 45 | |
| 46 | const setAppState = (updater: (prev: typeof appState) => typeof appState) => { |
| 47 | appState = updater(appState) |
| 48 | } |
| 49 | |
| 50 | return { |
| 51 | options: { |
| 52 | commands: [], |
| 53 | debug: false, |
| 54 | mainLoopModel: '/data/models/hf/moonshotai__Kimi-K2.7-Code', |
| 55 | tools: tools as never, |
| 56 | verbose: false, |
| 57 | thinkingConfig: {} as never, |
| 58 | mcpClients: [], |
| 59 | mcpResources: {}, |
| 60 | isNonInteractiveSession: true, |
| 61 | agentDefinitions: { |
| 62 | activeAgents: [], |
| 63 | allAgents: [], |
| 64 | }, |
| 65 | }, |
| 66 | abortController: new AbortController(), |
| 67 | readFileState: {} as never, |
| 68 | getAppState: () => appState, |
| 69 | setAppState, |
| 70 | setAppStateForTasks: setAppState, |
| 71 | setInProgressToolUseIDs: () => {}, |
| 72 | setResponseLength: () => {}, |
| 73 | updateFileHistoryState: () => {}, |
| 74 | updateAttributionState: () => {}, |
| 75 | messages: [], |
| 76 | } as never |
| 77 | } |
| 78 | |
| 79 | async function allowWithOriginalInput<T>(_tool: unknown, input: T) { |
| 80 | return { |
no test coverage detected