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

Function processResponse

src/hooks/useSwarmPermissionPoller.ts:231–257  ·  view source on GitHub ↗

* Process a permission response by invoking the registered callback

(response: PermissionResponse)

Source from the content-addressed store, hash-verified

229 * Process a permission response by invoking the registered callback
230 */
231function processResponse(response: PermissionResponse): boolean {
232 const callback = pendingCallbacks.get(response.requestId)
233
234 if (!callback) {
235 logForDebugging(
236 `[SwarmPermissionPoller] No callback registered for request ${response.requestId}`,
237 )
238 return false
239 }
240
241 logForDebugging(
242 `[SwarmPermissionPoller] Processing response for request ${response.requestId}: ${response.decision}`,
243 )
244
245 // Remove from registry before invoking callback
246 pendingCallbacks.delete(response.requestId)
247
248 if (response.decision === 'approved') {
249 const permissionUpdates = parsePermissionUpdates(response.permissionUpdates)
250 const updatedInput = response.updatedInput
251 callback.onAllow(updatedInput, permissionUpdates)
252 } else {
253 callback.onReject(response.feedback)
254 }
255
256 return true
257}
258
259/**
260 * Hook that polls for permission responses when running as a swarm worker.

Callers 1

useSwarmPermissionPollerFunction · 0.85

Calls 4

logForDebuggingFunction · 0.85
parsePermissionUpdatesFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected