agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
55 lines • 2.93 kB
TypeScript
/**
* artifacts/inMemoryArtifacts — the claim-check store in a Map.
*
* For tests, local development, and single-process agents whose artifacts may
* die with the process. Exactly as durable as the process — which is the
* point of the port: swap the one argument for `fileArtifacts` or
* `sqliteArtifacts` and nothing else changes.
*
* ── Bounded, and counting its drops (the innerRunRecords laws) ─────────────
* A retained payload is retained memory, and an agent minting a dataset per
* turn for a week would otherwise pin every one of them — the failure would
* look like a leak rather than like a feature. So this adapter is ALWAYS
* bounded: it has a default byte budget and row budget per scope, an explicit
* retention only replaces those dials, and there is deliberately no spelling
* for "unbounded" here — a memory store without a ceiling is a leak wearing
* configuration. When the budget forces an eviction the least-recently-USED
* artifact leaves first (reading refreshes recency, so the dataset a chart is
* actively rendered from is not the next casualty), every eviction is
* reported by the `put` that caused it, and `dropped` COUNTS them — "we kept
* the last 200 of 340" is an answer a debugging session can act on; a
* silently missing ref is not.
*/
import { type ArtifactRetention } from './retention.js';
import { type ArtifactStore } from './types.js';
/** The always-on bounds. Override dials via `retention`; there is no "off". */
export declare const DEFAULT_IN_MEMORY_ARTIFACT_RETENTION: Required<Pick<ArtifactRetention, 'maxBytesPerScope' | 'maxCountPerScope'>>;
/** Options for {@link inMemoryArtifacts}. */
export interface InMemoryArtifactsOptions {
/**
* Retention dials. Merged OVER the defaults — name a dial to change it;
* the byte and row budgets always exist (see the header for why).
*/
readonly retention?: ArtifactRetention;
/** @internal Test seam — the clock. Defaults to `Date.now`. */
readonly _now?: () => number;
}
/** The in-memory store, plus the accounting a bounded store owes its owner. */
export interface InMemoryArtifacts extends ArtifactStore {
/** Artifacts evicted by the byte/row budgets since construction (TTL expiry
* is the calendar doing its job and is not counted here). Non-zero means
* "resolve sooner, or raise the budget". */
readonly dropped: number;
/** The dials in force, defaults included. */
readonly retention: ArtifactRetention;
}
/**
* A bounded, drop-counting, per-scope-isolated artifact store in process
* memory.
*
* @example
* const store = inMemoryArtifacts({ retention: { ttlMs: 15 * 60_000 } });
* const agent = Agent.create({ provider, artifacts: store });
*/
export declare function inMemoryArtifacts(options?: InMemoryArtifactsOptions): InMemoryArtifacts;
//# sourceMappingURL=inMemoryArtifacts.d.ts.map