agentfootprint-lens 0.26.2 → 0.27.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.
@@ -2282,6 +2282,49 @@ function expandSubflowInternals(subflows) {
2282
2282
  return { nodes, edges };
2283
2283
  }
2284
2284
 
2285
+ // src/core/cursorProvenance.ts
2286
+ import { flattenCausalDAG, keysReadFromExecutionTree, sliceForKey } from "footprintjs/trace";
2287
+ function getSnapshotOf(runner) {
2288
+ const fn = runner?.getLastSnapshot;
2289
+ if (typeof fn !== "function") return void 0;
2290
+ return fn.call(runner);
2291
+ }
2292
+ function cursorProvenance(runner, cursorRuntimeStageId) {
2293
+ const snapshot = getSnapshotOf(runner);
2294
+ const log = snapshot?.commitLog;
2295
+ if (!log?.length || !cursorRuntimeStageId) return void 0;
2296
+ let lastIdx = -1;
2297
+ const written = /* @__PURE__ */ new Set();
2298
+ for (let i = 0; i < log.length; i++) {
2299
+ if (log[i].runtimeStageId !== cursorRuntimeStageId) continue;
2300
+ lastIdx = i;
2301
+ for (const t of log[i].trace) written.add(t.path);
2302
+ }
2303
+ if (lastIdx < 0 || written.size === 0) return void 0;
2304
+ const reads = keysReadFromExecutionTree(
2305
+ snapshot?.executionTree ?? { id: "__none__", logs: {}, errors: {}, metrics: {}, evals: {} }
2306
+ );
2307
+ const sliceFor = (key) => {
2308
+ const slice = sliceForKey(log, key, reads, {
2309
+ before: lastIdx + 1
2310
+ });
2311
+ const readsWarning = slice.readsCoverage !== void 0 && slice.readsCoverage.steps > 1 && slice.readsCoverage.stepsWithReads === 0;
2312
+ if (!slice.root) {
2313
+ return { key, frames: [], readsWarning, ...slice.missing !== void 0 && { missing: slice.missing } };
2314
+ }
2315
+ const frames = flattenCausalDAG(slice.root).map((n) => ({
2316
+ runtimeStageId: n.runtimeStageId,
2317
+ stageName: n.stageName,
2318
+ stageId: n.stageId,
2319
+ keysWritten: n.keysWritten,
2320
+ linkedBy: n.linkedBy,
2321
+ depth: n.depth
2322
+ }));
2323
+ return { key, frames, readsWarning };
2324
+ };
2325
+ return { writtenKeys: [...written], sliceFor };
2326
+ }
2327
+
2285
2328
  // src/core/explainableShellProps.ts
2286
2329
  function explainableShellPropsFromRunner(agent, recorder) {
2287
2330
  return {
@@ -2524,9 +2567,10 @@ export {
2524
2567
  lensGroupTranslator,
2525
2568
  structureGraphFromRunner,
2526
2569
  structureGraphFromSpec,
2570
+ cursorProvenance,
2527
2571
  explainableShellPropsFromRunner,
2528
2572
  toReactFlow,
2529
2573
  defaultSize,
2530
2574
  layoutLensGraph
2531
2575
  };
2532
- //# sourceMappingURL=chunk-JGB5GEQK.js.map
2576
+ //# sourceMappingURL=chunk-UBBSNJXC.js.map