| 283 | } |
| 284 | |
| 285 | private handlePendingFunctionCall( |
| 286 | fnCall: FunctionCall, |
| 287 | ): ServerAnusStreamEvent | null { |
| 288 | const callId = |
| 289 | fnCall.id ?? |
| 290 | `${fnCall.name}-${Date.now()}-${Math.random().toString(16).slice(2)}`; |
| 291 | const name = fnCall.name || 'undefined_tool_name'; |
| 292 | const args = (fnCall.args || {}) as Record<string, unknown>; |
| 293 | |
| 294 | const toolCallRequest: ToolCallRequestInfo = { |
| 295 | callId, |
| 296 | name, |
| 297 | args, |
| 298 | isClientInitiated: false, |
| 299 | prompt_id: this.prompt_id, |
| 300 | }; |
| 301 | |
| 302 | this.pendingToolCalls.push(toolCallRequest); |
| 303 | |
| 304 | // Yield a request for the tool call, not the pending/confirming status |
| 305 | return { type: AnusEventType.ToolCallRequest, value: toolCallRequest }; |
| 306 | } |
| 307 | |
| 308 | getDebugResponses(): GenerateContentResponse[] { |
| 309 | return this.debugResponses; |