agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
26 lines • 976 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadFacts = void 0;
const types_js_1 = require("./types.js");
const DEFAULT_LIMIT = 100;
function loadFacts(config) {
const limit = config.limit ?? DEFAULT_LIMIT;
return async (scope) => {
const { entries } = await config.store.list(scope.identity, {
limit,
...(config.tiers && { tiers: config.tiers }),
});
// Filter by fact-id prefix. `list` may return mixed payloads
// (messages + beats + facts) if the store is shared. Prefix filter
// keeps only the fact-shaped entries.
const facts = [];
for (const entry of entries) {
if ((0, types_js_1.isFactId)(entry.id))
facts.push(entry);
}
const existing = scope.loadedFacts ?? [];
scope.loadedFacts = [...existing, ...facts];
};
}
exports.loadFacts = loadFacts;
//# sourceMappingURL=loadFacts.js.map