* Record a tool call step.
(name, args, result, durationMs)
| 38 | * Record a tool call step. |
| 39 | */ |
| 40 | recordToolCall(name, args, result, durationMs) { |
| 41 | if (!this.recording || !this.current) return; |
| 42 | // Redact args + result before persisting. Tool args from the model can |
| 43 | // include literal API keys (e.g. when user pastes an env var into the |
| 44 | // prompt) and tool results often contain file content with secrets. |
| 45 | const safeArgs = redactValue(args); |
| 46 | const safeResult = typeof result === 'string' |
| 47 | ? redactString(result).slice(0, 2000) |
| 48 | : JSON.stringify(redactValue(result)).slice(0, 2000); |
| 49 | this.current.steps.push({ |
| 50 | type: 'tool_call', |
| 51 | name, |
| 52 | args: safeArgs, |
| 53 | result: safeResult, |
| 54 | durationMs, |
| 55 | timestamp: Date.now(), |
| 56 | }); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Record a model response (text or tool decision). |
no test coverage detected