MCPcopy Index your code
hub / github.com/Noumena-Network/code / trackResolvedToolUseId

Method trackResolvedToolUseId

src/cli/structuredIO.ts:177–188  ·  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

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

Callers 3

injectControlResponseMethod · 0.95
processLineMethod · 0.95
abortedMethod · 0.95

Calls 3

deleteMethod · 0.80
addMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected