MCPcopy Index your code
hub / github.com/codeaashu/claude-code / trackResolvedToolUseId

Method trackResolvedToolUseId

src/cli/structuredIO.ts:176–187  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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> {

Callers 3

injectControlResponseMethod · 0.95
processLineMethod · 0.95
abortedMethod · 0.95

Calls 4

nextMethod · 0.80
valuesMethod · 0.80
deleteMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected