* Run a single read tool to completion and return its raw ToolResult, * classifying expected failures the same way execute's catch does so * the SHAPE is identical whether dispatch runs in-process or on a worker: * NotIndexed → success-shaped guidance, PathRefusal → clean er
(toolName: string, args: Record<string, unknown>)
| 2117 | * path validation already ran in {@link execute} before routing here. |
| 2118 | */ |
| 2119 | async executeReadTool(toolName: string, args: Record<string, unknown>): Promise<ToolResult> { |
| 2120 | try { |
| 2121 | return await this.dispatchTool(toolName, args); |
| 2122 | } catch (err) { |
| 2123 | if (err instanceof NotIndexedError) { |
| 2124 | return this.textResult(err.message); |
| 2125 | } |
| 2126 | if (err instanceof PathRefusalError) { |
| 2127 | return this.errorResult(err.message); |
| 2128 | } |
| 2129 | return this.errorResult( |
| 2130 | `Tool execution failed: ${err instanceof Error ? err.message : String(err)}. ` + |
| 2131 | 'This is an internal codegraph error — retry the call once; if it persists, ' + |
| 2132 | 'continue without codegraph for this task.' |
| 2133 | ); |
| 2134 | } |
| 2135 | } |
| 2136 | |
| 2137 | /** |
| 2138 | * Pure dispatch over the read tools — the switch, with no gate, no notices, no |
no test coverage detected