UNPKG

agentfootprint

Version:

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

60 lines • 3.49 kB
/** * The account's size — README law 8 in its OWN unit, and its one authority. * * The contract is in serialized bytes: the account at most `ACCOUNT_BYTES`, * the op's body (`{ account, shown }`) at most `BODY_BYTES` — the UTF-8 bytes * of the JSON a reader is sent, escaping included (`lib/boundedJson.ts` · * `jsonBytes`). A cut in characters per field cannot add up to that: JSON * writes a control character or a lone surrogate as six bytes, UTF-8 a BMP * character as up to three, a sentence carries each value three times * (`text`, `parts`, `vars`), and a pointer repeats its identity on every line * that names its event. So the bound is not composed from the fields — it is * MEASURED, here, on what the account serializes to. * * {@link fitAccount} is the last step of every account the reader tells: * * - within the bound (every ordinary record) — the same object, unchanged; * - over it — the LISTINGS are fitted, never the judgements: the seven * rows' lines and the three fact lists (`calls`, `beforePause`, `inView`) * share what the rest of the account leaves, each up to an equal share * of what is left (max-min fair, so one long row cannot crowd out the * others), in their own order. What a row cannot list is ONE line that * counts it (`row.sizeBound`); what a fact list cannot is added to its * omitted count (`callsOmitted`, …). Every count, check, chip and status * was taken over everything before this step and is kept as it is; * - when even the rest is over the bound (only a record built to be: every * text at its cut in characters that JSON writes six bytes wide) — the * account says this record is too large to explain within the limit, * and counts it unread. Never a truncated account that looks whole. * * The per-field cuts (`FACT_TEXT_CHARS`, `MAX_VAR_CHARS`, the item and * long-text budgets) keep an ordinary account readable; this keeps every * account within its bound. */ import type { AnswerAccount } from './types.js'; /** The account, serialized: at most this many UTF-8 bytes (README law 8). */ export declare const ACCOUNT_BYTES: number; /** The op's body, `{ account, shown }` (`hosting/artifactWire.ts` · `AnswerAccountWireBody`), serialized. */ export declare const BODY_BYTES: number; /** The show-me map's share of the body: what the account and the frame leave (`shown.ts`). */ export declare const SHOWN_BYTES: number; /** * An identity a pointer copies from the record — an event's `runtimeStageId`, * a history message's `toolCallId` — at most this many serialized bytes * (`facts/common.ts` · `boundedPointer`). It rides every pointer into its * event, so it is bounded in the contract's unit where it is copied. */ export declare const POINTER_ID_BYTES = 200; /** * Max-min fair shares of `available` among `needs`: in order of need, each * gets all it needs up to an equal share of what is left; what one does not * need is shared by the rest. Deterministic. */ export declare function fairShares(needs: readonly number[], available: number): number[]; /** * `account` within {@link ACCOUNT_BYTES} — itself when it is (every ordinary * record), else its listings fitted as the module doc says; `tooLarge()` when * the part that is not a listing is over the bound on its own. */ export declare function fitAccount(account: AnswerAccount, tooLarge: () => AnswerAccount): AnswerAccount; //# sourceMappingURL=size.d.ts.map