agentfootprint-lens 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -279,6 +279,18 @@ stop();
279
279
 
280
280
  The standard agentfootprint introspection methods. `<Lens for={...}>` reads these automatically. You only call them yourself if you're building a custom UI.
281
281
 
282
+ ### `<WhereFrom>` — walk any value's causes on the one cursor
283
+
284
+ In the engineer view's detail panel, the cursor stage's written keys render
285
+ as chips; picking one shows the backward slice that produced its value
286
+ (footprintjs `sliceForKey` — the same query the `backtrack` LLM tool runs).
287
+ **◀ Walk the causes** freezes that slice as reverse-time stops and steps the
288
+ ONE cursor through them ("◀ earlier cause / toward result ▶") — both parents
289
+ of a fork are always visited, the chart cone follows the walk, and
290
+ **[Copy story]** emits the exact `formatSlice` text the LLM tool returns.
291
+ Honest absence stays honest: "never written — initial state / args / a
292
+ closure", and reads-off runs say "unknowable, not absent".
293
+
282
294
  ### `useLiveTimeline()` (escape hatch)
283
295
 
284
296
  Returns `{ timeline, ingest, startTurn, reset, builder }`. Use when you want to feed Lens from a non-runner source (replayed logs, server-sent events, etc.).
@@ -2283,7 +2283,7 @@ function expandSubflowInternals(subflows) {
2283
2283
  }
2284
2284
 
2285
2285
  // src/core/cursorProvenance.ts
2286
- import { flattenCausalDAG, keysReadFromExecutionTree, sliceForKey } from "footprintjs/trace";
2286
+ import { flattenCausalDAG, formatSlice, keysReadFromExecutionTree, sliceForKey } from "footprintjs/trace";
2287
2287
  function getSnapshotOf(runner) {
2288
2288
  const fn = runner?.getLastSnapshot;
2289
2289
  if (typeof fn !== "function") return void 0;
@@ -2304,13 +2304,16 @@ function cursorProvenance(runner, cursorRuntimeStageId) {
2304
2304
  const reads = keysReadFromExecutionTree(
2305
2305
  snapshot?.executionTree ?? { id: "__none__", logs: {}, errors: {}, metrics: {}, evals: {} }
2306
2306
  );
2307
+ const lastCommitIdxOf = /* @__PURE__ */ new Map();
2308
+ for (let i = 0; i <= lastIdx; i++) lastCommitIdxOf.set(log[i].runtimeStageId, i);
2307
2309
  const sliceFor = (key) => {
2308
2310
  const slice = sliceForKey(log, key, reads, {
2309
2311
  before: lastIdx + 1
2310
2312
  });
2311
2313
  const readsWarning = slice.readsCoverage !== void 0 && slice.readsCoverage.steps > 1 && slice.readsCoverage.stepsWithReads === 0;
2314
+ const story = formatSlice(slice);
2312
2315
  if (!slice.root) {
2313
- return { key, frames: [], readsWarning, ...slice.missing !== void 0 && { missing: slice.missing } };
2316
+ return { key, frames: [], readsWarning, story, ...slice.missing !== void 0 && { missing: slice.missing } };
2314
2317
  }
2315
2318
  const frames = flattenCausalDAG(slice.root).map((n) => ({
2316
2319
  runtimeStageId: n.runtimeStageId,
@@ -2318,9 +2321,10 @@ function cursorProvenance(runner, cursorRuntimeStageId) {
2318
2321
  stageId: n.stageId,
2319
2322
  keysWritten: n.keysWritten,
2320
2323
  linkedBy: n.linkedBy,
2321
- depth: n.depth
2324
+ depth: n.depth,
2325
+ commitIdx: lastCommitIdxOf.get(n.runtimeStageId) ?? -1
2322
2326
  }));
2323
- return { key, frames, readsWarning };
2327
+ return { key, frames, readsWarning, story };
2324
2328
  };
2325
2329
  return { writtenKeys: [...written], sliceFor };
2326
2330
  }
@@ -2573,4 +2577,4 @@ export {
2573
2577
  defaultSize,
2574
2578
  layoutLensGraph
2575
2579
  };
2576
- //# sourceMappingURL=chunk-UBBSNJXC.js.map
2580
+ //# sourceMappingURL=chunk-2XM65URD.js.map