UNPKG

agentfootprint

Version:

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

69 lines • 3 kB
"use strict"; /** * provider-contract/types — the Ports of the hexagonal architecture. * * Pattern: Adapter (GoF, Design Patterns ch. 4) + Ports-and-Adapters * (Cockburn, 2005). * Role: Contracts for every external dependency the library reaches for: * LLM providers, memory stores, permission checkers, pricing tables. * Emits: N/A (interfaces only). * * Concrete adapters (AnthropicProvider, PineconeStore, PermissionPolicy, * ...) implement these contracts. `core/` and `core-flow/` depend only on * these interfaces — never on concrete adapters. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.canRunCodeCommands = exports.canReadCodeFiles = exports.canStageCodeInputs = exports.STAGED_INPUTS_ENV = exports.checkerGoverns = exports.DEFAULT_CARRIES_IN_MESSAGES = void 0; /** * The floor every known wire supports. Used for any provider that does not * declare `carriesInMessages` — a third-party adapter is assumed to carry * only what all of them do, never more. */ exports.DEFAULT_CARRIES_IN_MESSAGES = Object.freeze([ 'user', 'assistant', ]); /** * Does this checker ask to be consulted about `capability`? (9.11.0) * * `'tool_call'` is always true — it has been enforced since v2.4 and needs no * declaration. Everything else is true only when the checker named it. * Absence is NO. */ function checkerGoverns(checker, capability) { if (!checker) return false; if (capability === 'tool_call') return true; return checker.governs?.includes(capability) === true; } exports.checkerGoverns = checkerGoverns; /** * The environment variable an executing snippet reads its staged inputs from — * a JSON object mapping each input's NAME to the path it landed at. * * Part of {@link CodeSession.stageInputs}'s contract rather than one adapter's * convention, and named here so an adapter uses the constant instead of * retyping the string. It is what makes model-written code portable across * backends: the code reads one variable, and every adapter that stages inputs * fills it the same way. */ exports.STAGED_INPUTS_ENV = 'AF_STAGED_INPUTS'; /** Can this session accept staged inputs? The feature-detection law: read the * member, never assume it from the adapter's name. */ function canStageCodeInputs(session) { return typeof session.stageInputs === 'function'; } exports.canStageCodeInputs = canStageCodeInputs; /** Can this session read files back out? Read the member, never the adapter's name. */ function canReadCodeFiles(session) { return typeof session.readFile === 'function'; } exports.canReadCodeFiles = canReadCodeFiles; /** Can this session run shell commands? Absent unless the runner was built * with `commands: true`. Read the member, never the adapter's name. */ function canRunCodeCommands(session) { return typeof session.runCommand === 'function'; } exports.canRunCodeCommands = canRunCodeCommands; //# sourceMappingURL=types.js.map