agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
23 lines • 1.04 kB
JavaScript
/**
* The adapter owns the evidence; core only carries it alongside the text it
* actually delivered. Presence is checked without a tracked read, so a run on
* a provider with no replay evidence gains no phantom context source. Thinking
* joins this carrier only when the provider supplied replay evidence; legacy
* message writers retain their existing thinking behaviour otherwise.
*/
export function assistantReplayFields(state) {
if (!('llmLatestReplay' in state))
return {};
// Footprint's grouped mapper replaces top-level arrays, but deep-merges
// object members. The tuple carries one indivisible provider proof, so an
// earlier layout or binding can never be merged into the next response.
const replay = state.llmLatestReplay?.[0];
if (replay === undefined)
return {};
const blocks = state.thinkingBlocks;
return {
replay,
...(blocks !== undefined && blocks.length > 0 && { thinkingBlocks: [...blocks] }),
};
}
//# sourceMappingURL=assistantReplay.js.map