* 添加工具调用记录
(toolCall: ToolCall)
| 65 | * 添加工具调用记录 |
| 66 | */ |
| 67 | addToolCall(toolCall: ToolCall): void { |
| 68 | if (!this.contextData) { |
| 69 | throw new Error('上下文数据未初始化'); |
| 70 | } |
| 71 | |
| 72 | this.contextData.layers.tool.recentCalls.push(toolCall); |
| 73 | this.contextData.metadata.lastUpdated = Date.now(); |
| 74 | |
| 75 | // 保持工具调用历史在合理范围内 |
| 76 | if (this.contextData.layers.tool.recentCalls.length > 50) { |
| 77 | this.contextData.layers.tool.recentCalls = |
| 78 | this.contextData.layers.tool.recentCalls.slice(-25); |
| 79 | } |
| 80 | |
| 81 | this.recordAccess('tools'); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * 更新工具状态 |
nothing calls this directly
no test coverage detected