agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
34 lines (33 loc) • 2.01 kB
TypeScript
/**
* listTools — one conversation's tools, bound to it: one listing operation.
*
* Pattern: one admitted operation per call, the provider's and the lease's alike.
* Role: § 3.2 and § 6 of the design. A listing is one `list(ctx)` for one
* conversation, admitted against `maxOperations`. Its setup — the open
* of the key's client, the `tools/list` — runs inside its slot.
*
* - PER CLIENT: the conversation's own client is opened (or reused) and its own
* list served, listed again when it cannot be served as it stands.
* - SHARED, under the app's contract: the plan is resolved and the context
* computed WITHOUT opening anything; a current entry is served touching no
* client (`client: 'not-needed'`); a listing already under way for it is
* joined; otherwise the listing runs on THIS conversation's own client —
* never in another conversation's session.
* - THE CALLER'S CONTEXT AFTER EVERY WAIT: the app's names are asked again
* after a joined listing and after this one's own (`Pool.ensureListed`); a
* list is served only under the context the caller has at that moment, and
* a moved context is resolved again — at most three rounds, then refused
* (`binding-changed`).
*
* A refused listing never reaches the model as a tool result: it fails that
* iteration's tool discovery (`agentfootprint.tools.discovery_failed`), as any
* failing `ToolProvider` does. A list that cannot be read to its end
* (`McpToolListIncompleteError`, from the client's own discovery) is never
* served cut short.
*/
import type { Tool } from '../../tools/tools.js';
import type { PoolKey } from './identityKey.js';
import type { Pool } from './pool.js';
import type { UseFacts } from './record.js';
/** List `key`'s conversation's tools, bound to it, under one admitted operation. */
export declare function listTools(pool: Pool, key: PoolKey, signal: AbortSignal | undefined, facts: UseFacts): Promise<readonly Tool[]>;