MCPcopy
hub / github.com/claude-code-best/claude-code / handler

Function handler

src/hooks/useMasterMonitor.ts:184–220  ·  view source on GitHub ↗
(msg: PipeMessage)

Source from the content-addressed store, hash-verified

182 detachPipeEntryEmitter(name, _slaveClients.get(name))
183 if (typeof client.on !== 'function') return
184 const handler = (msg: PipeMessage) => {
185 if (!isMonitoredPipeEntryType(msg.type)) return
186
187 // Mute gate: drop business messages from muted slaves
188 if (shouldDropMutedMessage(name, msg.type)) {
189 // Auto-deny permission_request to prevent slave deadlock
190 if (msg.type === 'permission_request') {
191 try {
192 const payload = JSON.parse(msg.data ?? '{}')
193 if (payload.requestId) {
194 client.send({
195 type: 'permission_response',
196 data: JSON.stringify({
197 requestId: payload.requestId,
198 behavior: 'deny',
199 feedback:
200 'Permission auto-denied: pipe is logically disconnected.',
201 }),
202 })
203 }
204 } catch {
205 // Malformed payload — safe to ignore
206 }
207 }
208 return
209 }
210
211 // Clear /send override when slave turn completes
212 if (
213 (msg.type === 'done' || msg.type === 'error') &&
214 hasSendOverride(name)
215 ) {
216 removeSendOverride(name)
217 }
218
219 emitPipeEntry(name, pipeMessageToSessionEntry(name, msg))
220 }
221 _pipeEntryHandlers.set(name, handler)
222 client.on('message', handler)
223}

Callers 7

handlePermissionResponseFunction · 0.70
useFilePermissionDialogFunction · 0.50
setupSocketMethod · 0.50
setupSocketListenersMethod · 0.50
registerHookEventHandlerFunction · 0.50
handleResponseFunction · 0.50

Calls 11

isMonitoredPipeEntryTypeFunction · 0.85
shouldDropMutedMessageFunction · 0.85
hasSendOverrideFunction · 0.85
removeSendOverrideFunction · 0.85
emitPipeEntryFunction · 0.85
getPipeIpcFunction · 0.85
sendMethod · 0.65
setAppStateFunction · 0.50
logForDebuggingFunction · 0.50

Tested by 1

handleResponseFunction · 0.40