agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
67 lines (66 loc) • 3.99 kB
TypeScript
import type { Tool } from '../../../tools/tools.js';
import { type NegativeClaimPhraseExtensions, type ResolvedNegativeClaimPhrases } from '../../../integrity/negative-claim/phrases.js';
/** Configure typed library-written statements or observe ordinary answer prose.
* `{ prose: true }` needs no schema or tool list and never rewrites or blocks an answer.
* Both modes can add bounded literal phrase data; prose findings remain unverified.
*
* In the typed arm, the named field must be a required, top-level array in the output JSON Schema.
* Every cited tool must be registered locally. A search declaration or an admitted
* `absent({ among })` result supplies its coverage at runtime.
*
* Typed enforcement is available, but not recommended until its benchmark gates pass.
* Model prose is observed with a bounded grammar; it remains unchecked.
* Prose enforcement is unavailable.
*/
export type NegativeClaimsOptions = ({
readonly field: string;
readonly tools: readonly string[];
/** Default `withhold`. `state-searched` reports what was read without upgrading its verdict. */
readonly unestablished?: 'withhold' | 'state-searched';
readonly prose?: never;
} | {
/** Observe ordinary answers without a schema, citations, correction or withholding. */
readonly prose: true;
readonly field?: never;
readonly tools?: never;
readonly unestablished?: never;
}) & {
/** Optional bounded literal phrases. They only add observations, never verification or enforcement. */
readonly phrases?: NegativeClaimPhraseExtensions;
};
/** A model-selected claim checked against recorded evidence. Only the absence
* family may be normalized from the read; a negative never becomes completeness.
* The delivered subject and statement come from the admitted search. */
export interface NegativeClaimCitation {
/** Selects the proposition to check; complete must be requested explicitly. */
readonly kind: 'none' | 'not-found' | 'complete';
/** Optional subject phrase. It must include the recorded subject; never delivered as a label. */
readonly about?: string | number;
readonly restsOn: readonly string[];
}
/** @internal Detached configuration carried by the chart, never by the model. */
export interface ResolvedTypedNegativeClaims {
readonly mode: 'typed';
readonly field: string;
readonly tools: readonly string[];
readonly unestablished: 'withhold' | 'state-searched';
readonly phrases?: ResolvedNegativeClaimPhrases;
}
/** @internal Observation has no citation contract or delivery authority. */
export interface ResolvedProseNegativeClaims {
readonly mode: 'prose';
readonly phrases?: ResolvedNegativeClaimPhrases;
}
/** @internal The two arms share native capture, not enforcement. */
export type ResolvedNegativeClaims = ResolvedTypedNegativeClaims | ResolvedProseNegativeClaims;
export declare const NEGATIVE_HANDLE_PATTERN = "^r[1-9][0-9]{0,3}$";
/** Validate once, without keeping any mutable caller-owned arrays. */
export declare function resolveNegativeClaims(options: NegativeClaimsOptions): ResolvedNegativeClaims;
/** Provider-only and MCP tools cannot become trusted by being named in this list. */
export declare function assertNegativeClaimsTools(config: ResolvedTypedNegativeClaims, tools: readonly Tool[]): void;
/** Build the model-facing copy. A parse function is never executed to infer a schema.
* Root/field/item references and unions are deliberately not guessed: expose this
* one citation field directly while the rest of the app's schema is preserved. */
export declare function negativeClaimsSchema(config: ResolvedTypedNegativeClaims, schema: Readonly<Record<string, unknown>> | undefined): Readonly<Record<string, unknown>>;
/** One always-on instruction; handles themselves are served beside admitted results. */
export declare function negativeClaimsInstruction(config: ResolvedTypedNegativeClaims, schema: Readonly<Record<string, unknown>>): string;