MCPcopy
hub / github.com/garrytan/gstack / handleCommandInternal

Function handleCommandInternal

browse/src/server.ts:1309–1316  ·  view source on GitHub ↗

* Sanitizing wrapper around handleCommandInternalImpl. ALL callers (single-command * HTTP, batch loop, scoped-token dispatch) go through this so the lone-surrogate * sanitization happens once at the architectural choke point, not per-leaf. * Do not bypass this by calling handleCommandInternalImpl

(
  body: { command: string; args?: string[]; tabId?: number },
  tokenInfo?: TokenInfo | null,
  opts?: { skipRateCheck?: boolean; skipActivity?: boolean; chainDepth?: number },
)

Source from the content-addressed store, hash-verified

1307 * Do not bypass this by calling handleCommandInternalImpl directly.
1308 */
1309async function handleCommandInternal(
1310 body: { command: string; args?: string[]; tabId?: number },
1311 tokenInfo?: TokenInfo | null,
1312 opts?: { skipRateCheck?: boolean; skipActivity?: boolean; chainDepth?: number },
1313): Promise<CommandResult> {
1314 const cr = await handleCommandInternalImpl(body, tokenInfo, opts);
1315 return { ...cr, result: sanitizeLoneSurrogates(cr.result) };
1316}
1317
1318/**
1319 * Build the HTTP response from a CommandResult. Pure function so it can be

Callers 3

handleCommandFunction · 0.85
makeFetchHandlerFunction · 0.85

Calls 2

sanitizeLoneSurrogatesFunction · 0.85

Tested by

no test coverage detected