agent-inspect 6.14.0 → 6.14.2

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +22 -6
  2. package/README.md +47 -45
  3. package/docs/DEMO-SCRIPT.md +2 -2
  4. package/docs/GOLDEN-PATH.md +18 -18
  5. package/docs/KNOWN-ISSUES.md +2 -1
  6. package/docs/SUPPORT-LEVELS.md +2 -2
  7. package/docs/TRACE-CONTRACTS.md +13 -3
  8. package/package.json +15 -6
  9. package/packages/cli/dist/{chunk-MEO2Z3KE.mjs → chunk-AACUXCHT.mjs} +205 -35
  10. package/packages/cli/dist/chunk-AACUXCHT.mjs.map +1 -0
  11. package/packages/cli/dist/index.cjs +265 -35
  12. package/packages/cli/dist/index.cjs.map +1 -1
  13. package/packages/cli/dist/index.mjs +59 -6
  14. package/packages/cli/dist/index.mjs.map +1 -1
  15. package/packages/cli/dist/{src-6VZNGIF6.mjs → src-ABTS4GO4.mjs} +3 -3
  16. package/packages/cli/dist/{src-6VZNGIF6.mjs.map → src-ABTS4GO4.mjs.map} +1 -1
  17. package/packages/core/dist/advanced.cjs +156 -19
  18. package/packages/core/dist/advanced.cjs.map +1 -1
  19. package/packages/core/dist/advanced.d.cts +17 -9
  20. package/packages/core/dist/advanced.d.ts +17 -9
  21. package/packages/core/dist/advanced.mjs +6 -6
  22. package/packages/core/dist/checks.cjs +108 -18
  23. package/packages/core/dist/checks.cjs.map +1 -1
  24. package/packages/core/dist/checks.d.cts +4 -4
  25. package/packages/core/dist/checks.d.ts +4 -4
  26. package/packages/core/dist/checks.mjs +1 -1
  27. package/packages/core/dist/{chunk-CTA6XNDP.mjs → chunk-5N2OBM7S.mjs} +3 -3
  28. package/packages/core/dist/{chunk-CTA6XNDP.mjs.map → chunk-5N2OBM7S.mjs.map} +1 -1
  29. package/packages/core/dist/chunk-AK5EN4U2.mjs +174 -0
  30. package/packages/core/dist/chunk-AK5EN4U2.mjs.map +1 -0
  31. package/packages/core/dist/{chunk-BS2QCAJX.mjs → chunk-BHMXLDLK.mjs} +110 -20
  32. package/packages/core/dist/chunk-BHMXLDLK.mjs.map +1 -0
  33. package/packages/core/dist/{chunk-UOPVGCOB.mjs → chunk-NXQF73EC.mjs} +3 -3
  34. package/packages/core/dist/{chunk-UOPVGCOB.mjs.map → chunk-NXQF73EC.mjs.map} +1 -1
  35. package/packages/core/dist/{chunk-LFWZEO2L.mjs → chunk-SGL4JGCD.mjs} +3 -3
  36. package/packages/core/dist/{chunk-LFWZEO2L.mjs.map → chunk-SGL4JGCD.mjs.map} +1 -1
  37. package/packages/core/dist/{context-BHAgRjOe.d.cts → context-Ca5yK8Cs.d.cts} +3 -3
  38. package/packages/core/dist/{context-Blyjb5my.d.ts → context-D6cS4XIL.d.ts} +3 -3
  39. package/packages/core/dist/diff.d.cts +3 -3
  40. package/packages/core/dist/diff.d.ts +3 -3
  41. package/packages/core/dist/exporters.d.cts +3 -3
  42. package/packages/core/dist/exporters.d.ts +3 -3
  43. package/packages/core/dist/exporters.mjs +1 -1
  44. package/packages/core/dist/{index-CmXMS-MF.d.cts → index-BY6XZ5aG.d.cts} +3 -3
  45. package/packages/core/dist/{index-Bu_vOjql.d.ts → index-D9HBequ_.d.ts} +3 -3
  46. package/packages/core/dist/index.d.cts +6 -6
  47. package/packages/core/dist/index.d.ts +6 -6
  48. package/packages/core/dist/{inspect-event-DVg84S4v.d.cts → inspect-event-DRthdZlf.d.cts} +9 -0
  49. package/packages/core/dist/{inspect-event-DVg84S4v.d.ts → inspect-event-DRthdZlf.d.ts} +9 -0
  50. package/packages/core/dist/{log-config-BG1WmWf2.d.cts → log-config-CFlIJHTf.d.cts} +1 -1
  51. package/packages/core/dist/{log-config-Ck0aT_Ou.d.ts → log-config-OZRfpHED.d.ts} +1 -1
  52. package/packages/core/dist/logs.cjs +95 -15
  53. package/packages/core/dist/logs.cjs.map +1 -1
  54. package/packages/core/dist/logs.d.cts +3 -3
  55. package/packages/core/dist/logs.d.ts +3 -3
  56. package/packages/core/dist/logs.mjs +2 -2
  57. package/packages/core/dist/{persisted-inspect-event-ChE7pGb7.d.ts → persisted-inspect-event-BVucFVrP.d.ts} +1 -1
  58. package/packages/core/dist/{persisted-inspect-event-d-mSP8kd.d.cts → persisted-inspect-event-CVZWZldL.d.cts} +1 -1
  59. package/packages/core/dist/persisted.cjs +95 -15
  60. package/packages/core/dist/persisted.cjs.map +1 -1
  61. package/packages/core/dist/persisted.d.cts +5 -5
  62. package/packages/core/dist/persisted.d.ts +5 -5
  63. package/packages/core/dist/persisted.mjs +3 -3
  64. package/packages/core/dist/readers.cjs +95 -15
  65. package/packages/core/dist/readers.cjs.map +1 -1
  66. package/packages/core/dist/readers.d.cts +2 -2
  67. package/packages/core/dist/readers.d.ts +2 -2
  68. package/packages/core/dist/readers.mjs +3 -3
  69. package/packages/core/dist/{types-MuwXSJ4b.d.ts → types--ainI31J.d.ts} +1 -1
  70. package/packages/core/dist/{types-BLX3tiOW.d.cts → types-UnrNaTo2.d.cts} +1 -1
  71. package/packages/core/dist/writers.d.cts +2 -2
  72. package/packages/core/dist/writers.d.ts +2 -2
  73. package/packages/cli/dist/chunk-MEO2Z3KE.mjs.map +0 -1
  74. package/packages/core/dist/chunk-BS2QCAJX.mjs.map +0 -1
  75. package/packages/core/dist/chunk-T5MASTIW.mjs +0 -94
  76. package/packages/core/dist/chunk-T5MASTIW.mjs.map +0 -1
@@ -868,6 +868,20 @@ function traceEventsToPersistedInspectEvents(events, options) {
868
868
  function inc(map, key) {
869
869
  map[key] = (map[key] ?? 0) + 1;
870
870
  }
871
+ function confidenceRank(confidence) {
872
+ switch (confidence) {
873
+ case "unknown":
874
+ return 0;
875
+ case "heuristic":
876
+ return 1;
877
+ case "correlated":
878
+ return 2;
879
+ case "explicit":
880
+ return 3;
881
+ default:
882
+ return 0;
883
+ }
884
+ }
871
885
  function computeRunStatus(events) {
872
886
  let runTerminal;
873
887
  let sawRunEvent = false;
@@ -888,6 +902,84 @@ function computeRunStatus(events) {
888
902
  }
889
903
  return hasRunning ? "running" : "ok";
890
904
  }
905
+ function linkNodesVisibilityFirst(nodes) {
906
+ let selfParentCount = 0;
907
+ let unresolvedParentCount = 0;
908
+ let normalizedEdgeCount = 0;
909
+ let cycleCount = 0;
910
+ const pending = [];
911
+ for (const node of nodes.values()) {
912
+ const parentId = node.event.parentId;
913
+ if (!parentId) continue;
914
+ if (parentId === node.event.eventId) {
915
+ selfParentCount += 1;
916
+ normalizedEdgeCount += 1;
917
+ continue;
918
+ }
919
+ if (!nodes.has(parentId)) {
920
+ unresolvedParentCount += 1;
921
+ continue;
922
+ }
923
+ pending.push({
924
+ childId: node.event.eventId,
925
+ parentId,
926
+ childTimestamp: node.event.timestamp,
927
+ childConfidence: node.event.confidence
928
+ });
929
+ }
930
+ pending.sort((a, b) => {
931
+ const conf = confidenceRank(b.childConfidence) - confidenceRank(a.childConfidence);
932
+ if (conf !== 0) return conf;
933
+ return a.childTimestamp - b.childTimestamp;
934
+ });
935
+ const parentOf = /* @__PURE__ */ new Map();
936
+ for (const edge of pending) {
937
+ parentOf.set(edge.childId, edge.parentId);
938
+ let cursor = edge.parentId;
939
+ const seen = /* @__PURE__ */ new Set([edge.childId]);
940
+ let cyclic = false;
941
+ while (cursor) {
942
+ if (seen.has(cursor)) {
943
+ cyclic = true;
944
+ break;
945
+ }
946
+ seen.add(cursor);
947
+ cursor = parentOf.get(cursor);
948
+ }
949
+ if (cyclic) {
950
+ parentOf.delete(edge.childId);
951
+ cycleCount += 1;
952
+ normalizedEdgeCount += 1;
953
+ }
954
+ }
955
+ for (const [childId, parentId] of parentOf) {
956
+ nodes.get(parentId).children.push(nodes.get(childId));
957
+ }
958
+ const roots = [];
959
+ for (const node of nodes.values()) {
960
+ if (!parentOf.has(node.event.eventId)) {
961
+ roots.push(node);
962
+ }
963
+ }
964
+ const assignDepth = (n, depth, stack) => {
965
+ if (stack.has(n.event.eventId)) return;
966
+ n.depth = depth;
967
+ stack.add(n.event.eventId);
968
+ for (const c of n.children) assignDepth(c, depth + 1, stack);
969
+ stack.delete(n.event.eventId);
970
+ };
971
+ for (const r of roots) assignDepth(r, 0, /* @__PURE__ */ new Set());
972
+ return {
973
+ roots,
974
+ summary: {
975
+ rootCount: roots.length,
976
+ selfParentCount,
977
+ cycleCount,
978
+ unresolvedParentCount,
979
+ normalizedEdgeCount
980
+ }
981
+ };
982
+ }
891
983
  var TreeBuilder = class {
892
984
  constructor(options) {
893
985
  void options?.config;
@@ -905,20 +997,7 @@ var TreeBuilder = class {
905
997
  for (const e of sorted) {
906
998
  nodes.set(e.eventId, { event: e, children: [], depth: 0 });
907
999
  }
908
- const roots = [];
909
- for (const node of nodes.values()) {
910
- const parentId = node.event.parentId;
911
- if (parentId && nodes.has(parentId)) {
912
- nodes.get(parentId).children.push(node);
913
- } else {
914
- roots.push(node);
915
- }
916
- }
917
- const assignDepth = (n, depth) => {
918
- n.depth = depth;
919
- for (const c of n.children) assignDepth(c, depth + 1);
920
- };
921
- for (const r of roots) assignDepth(r, 0);
1000
+ const { roots, summary } = linkNodesVisibilityFirst(nodes);
922
1001
  const confidenceBreakdown = {
923
1002
  explicit: 0,
924
1003
  correlated: 0,
@@ -946,7 +1025,8 @@ var TreeBuilder = class {
946
1025
  metadata: {
947
1026
  totalEvents: sorted.length,
948
1027
  confidenceBreakdown,
949
- kinds
1028
+ kinds,
1029
+ relationshipSummary: summary
950
1030
  }
951
1031
  });
952
1032
  }