(
part: Extract<OpencodePart, { type: 'tool' }>,
)
| 270 | } |
| 271 | |
| 272 | function* openToolCall( |
| 273 | part: Extract<OpencodePart, { type: 'tool' }>, |
| 274 | ): Generator<StreamChunk> { |
| 275 | if (openedToolCalls.has(part.callID)) return |
| 276 | openedToolCalls.add(part.callID) |
| 277 | const toolCallName = resolveToolName(part.tool, ctx.bridgedToolNames) |
| 278 | const input = part.state.input ?? {} |
| 279 | const args = JSON.stringify(input) |
| 280 | yield { |
| 281 | type: EventType.TOOL_CALL_START, |
| 282 | toolCallId: part.callID, |
| 283 | toolCallName, |
| 284 | toolName: toolCallName, |
| 285 | model, |
| 286 | timestamp: now(), |
| 287 | } |
| 288 | yield { |
| 289 | type: EventType.TOOL_CALL_ARGS, |
| 290 | toolCallId: part.callID, |
| 291 | model, |
| 292 | timestamp: now(), |
| 293 | delta: args, |
| 294 | args, |
| 295 | } |
| 296 | yield { |
| 297 | type: EventType.TOOL_CALL_END, |
| 298 | toolCallId: part.callID, |
| 299 | toolCallName, |
| 300 | toolName: toolCallName, |
| 301 | model, |
| 302 | timestamp: now(), |
| 303 | input, |
| 304 | } |
| 305 | unresolvedToolCalls.add(part.callID) |
| 306 | } |
| 307 | |
| 308 | function* handleToolPart( |
| 309 | part: Extract<OpencodePart, { type: 'tool' }>, |
no test coverage detected