* Records a tool_use ID as resolved so that late/duplicate control_response * messages for the same tool are ignored by the orphan handler.
(request: SDKControlRequest)
| 174 | * messages for the same tool are ignored by the orphan handler. |
| 175 | */ |
| 176 | private trackResolvedToolUseId(request: SDKControlRequest): void { |
| 177 | if (request.request.subtype === 'can_use_tool') { |
| 178 | this.resolvedToolUseIds.add(request.request.tool_use_id) |
| 179 | if (this.resolvedToolUseIds.size > MAX_RESOLVED_TOOL_USE_IDS) { |
| 180 | // Evict the oldest entry (Sets iterate in insertion order) |
| 181 | const first = this.resolvedToolUseIds.values().next().value |
| 182 | if (first !== undefined) { |
| 183 | this.resolvedToolUseIds.delete(first) |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | /** Flush pending internal events. No-op for non-remote IO. Overridden by RemoteIO. */ |
| 190 | flushInternalEvents(): Promise<void> { |
no test coverage detected