UNPKG

agentfootprint

Version:

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

44 lines • 2.22 kB
"use strict"; /** * snapshotPipeline — composes `loadSnapshot` + `writeSnapshot` into a * `MemoryPipeline` ready to be mounted by `defineMemory({ type: CAUSAL })`. * * READ : LoadSnapshot — embed query → search → project → format * WRITE : WriteSnapshot — embed query → store as MemoryEntry<SnapshotEntry> * * The pipeline emits the same `agentfootprint.context.injected` event * (with `source: 'memory'`) as every other memory flavor, so Lens * shows Causal injections as memory chips alongside Episodic / * Semantic / Narrative without special UI. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.snapshotPipeline = void 0; const footprintjs_1 = require("footprintjs"); const loadSnapshot_js_1 = require("./loadSnapshot.js"); const writeSnapshot_js_1 = require("./writeSnapshot.js"); function snapshotPipeline(config) { const loadConfig = { store: config.store, embedder: config.embedder, ...(config.embedderId !== undefined && { embedderId: config.embedderId }), ...(config.topK !== undefined && { topK: config.topK }), ...(config.minScore !== undefined && { minScore: config.minScore }), ...(config.projection !== undefined && { projection: config.projection }), }; const writeConfig = { store: config.store, embedder: config.embedder, ...(config.embedderId !== undefined && { embedderId: config.embedderId }), ...(config.ttlMs !== undefined && { ttlMs: config.ttlMs }), ...(config.tier && { tier: config.tier }), }; const read = (0, footprintjs_1.flowChart)('LoadSnapshot', (0, loadSnapshot_js_1.loadSnapshot)(loadConfig), 'load-snapshot', { description: 'Embed query, retrieve top-K past snapshots, project + format as system messages', }).build(); const write = (0, footprintjs_1.flowChart)('WriteSnapshot', (0, writeSnapshot_js_1.writeSnapshot)(writeConfig), 'write-snapshot', { description: 'Capture (query, finalContent) from the run, embed query, persist as MemoryEntry<SnapshotEntry>', }).build(); return { read, write }; } exports.snapshotPipeline = snapshotPipeline; //# sourceMappingURL=snapshotPipeline.js.map