UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

33 lines • 1.8 kB
/** * clientPort — what the MCP client pool asks of a client it opens, and what the * client hands back beside the ordinary `McpClient`. * * Pattern: an internal seam, never on a door. * Role: The pool's clients are ordinary `mcpClient`s (`mcpClient.ts`): their * discovery, their per-tool checks (`callChecks.ts`, counted per * client object by `listingGenerations.ts`), their retry series and * their request ledger are the library's, unchanged. A pool needs * four things more, and only a pool does, so they cross here: * * - a CONNECT signal apart from the client's lifetime signal: one open runs * under the pool's own signal and open deadline, never a caller's; * - the request guard of whatever the pool is doing on the client * (`requestGuard.ts`), so every request is checked and counted; * - the server's tools-changed notice, heard through the SDK's * `listChanged.tools` with its automatic refresh OFF — a notice can only * make the pool list again, through `listing`, which `mcpClient` counts; * - a port back: a listing under the pool's own signal, a callable tool for a * definition this client did not list (a shared one), and an ending whose * settlement is reported apart from its answer. */ const HALF_OPENS = new WeakMap(); /** @internal Remember what `error` (a failed pooled open's) left behind. */ export function rememberHalfOpen(error, halfOpen) { if (error !== null && typeof error === 'object') HALF_OPENS.set(error, halfOpen); } /** @internal What a failed pooled open left behind, if anything. */ export function halfOpenOf(error) { return error !== null && typeof error === 'object' ? HALF_OPENS.get(error) : undefined; } //# sourceMappingURL=clientPort.js.map