agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
25 lines (24 loc) • 1.23 kB
TypeScript
/**
* sha256Hex — FIPS 180-4 SHA-256 over a JS string, with no platform edge.
*
* Role: Fold. A leaf function. It reads nothing, writes nothing and emits
* nothing; the receipt calls it to fingerprint content it must not
* keep.
* Reads: its argument.
* Emits: N/A.
*
* WHY NOT `rag/hash.ts` · `sha256`. That one reaches `node:crypto` through
* `lazyRequire`, which is right where it lives: indexing a corpus is a Node
* job that runs once, off any hot path. This one is called on EVERY LLM call,
* including from an agent running in a browser through the `browser*`
* providers — a `node:crypto` edge there would throw at request assembly and
* take the run with it. `crypto.subtle.digest` is the browser answer and it is
* asynchronous, which request assembly is not.
*
* So the algorithm is here, in about seventy lines, and
* `test/time-travel/receipt-conformance.test.ts` checks it against
* `node:crypto` on every input the suite hashes. A vendored primitive that is
* never compared against the reference is a second truth waiting to happen.
*/
/** Hex SHA-256 of a string's UTF-8 bytes. 64 lowercase hex characters. */
export declare function sha256Hex(input: string): string;