agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
37 lines (36 loc) • 1.74 kB
TypeScript
/**
* artifacts/naming — the ONE owner of the ref grammar.
*
* `art_` + 22 crypto-random base62 chars = 26 chars the model can speak
* cheaply and copy reliably. The grammar lives in exactly one module (the
* `branchSegment.ts` precedent upstream): mint here, recognize here, and
* nowhere else — an adapter that parses refs with its own regex is a design
* smell this header exists to refuse.
*
* NEVER content-addressed. The digest is metadata on {@link ArtifactMeta};
* making content the key would collide two tenants' identical bytes into one
* object (an isolation bug wearing a dedup win) and could never name two
* generations of "the current dataset". Randomness comes from
* `globalThis.crypto` — present in every supported Node and every browser —
* so minting works wherever the in-memory adapter does.
*/
import type { ArtifactRef } from './types.js';
/** The prefix every minted ref carries. */
export declare const ARTIFACT_REF_PREFIX = "art_";
/**
* Mint a fresh, opaque, never-content-derived ref.
*
* Rejection sampling keeps the distribution uniform (256 % 62 ≠ 0, so a bare
* modulo would bias the low end of the alphabet — cosmetically fine,
* cryptographically sloppy, and cheap to do right).
*/
export declare function mintArtifactRef(): ArtifactRef;
/**
* Is this string a well-formed artifact ref?
*
* Structural, total, and the ONLY recognizer. Adapters call it before any
* ref touches a filesystem path or a SQL parameter: refs are minted so a
* traversal payload cannot arrive by construction — and this asserts it
* anyway, because "cannot happen" is a claim, not a defence.
*/
export declare function isArtifactRef(candidate: unknown): candidate is ArtifactRef;