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
@@ -1,6 +1,6 @@
1
1
  import { TraceReadResult, TraceReadWarning } from './readers.js';
2
- import { a as InspectRunTree, b as InspectNode, A as AttributionConfidence } from './inspect-event-DVg84S4v.js';
3
- import { P as PersistedInspectEvent } from './persisted-inspect-event-ChE7pGb7.js';
2
+ import { a as InspectRunTree, b as InspectNode, A as AttributionConfidence } from './inspect-event-DRthdZlf.js';
3
+ import { P as PersistedInspectEvent } from './persisted-inspect-event-BVucFVrP.js';
4
4
  import { O as ObservedOutcomeStatus } from './types-B562HgN_.js';
5
5
 
6
6
  /**
@@ -19,7 +19,7 @@ import { O as ObservedOutcomeStatus } from './types-B562HgN_.js';
19
19
  * @experimental
20
20
  */
21
21
  interface LogicalProjectionDiagnostic {
22
- code: "AI_LOGICAL_PAIR_AMBIGUOUS" | "AI_LOGICAL_PAIR_UNMATCHED_START" | "AI_LOGICAL_PAIR_UNMATCHED_COMPLETE" | "AI_LOGICAL_PARENT_REMAPPED" | "AI_LOGICAL_PARENT_UNRESOLVED";
22
+ code: "AI_LOGICAL_PAIR_AMBIGUOUS" | "AI_LOGICAL_PAIR_UNMATCHED_START" | "AI_LOGICAL_PAIR_UNMATCHED_COMPLETE" | "AI_LOGICAL_PARENT_REMAPPED" | "AI_LOGICAL_PARENT_UNRESOLVED" | "AI_LOGICAL_SELF_PARENT_REMOVED";
23
23
  message: string;
24
24
  eventIds?: readonly string[];
25
25
  }
@@ -1,10 +1,10 @@
1
- import { I as InspectRunOptions, S as StepOptions, O as ObserveOptions } from './types-BLX3tiOW.cjs';
2
- export { E as ErrorInfo, R as RedactionProfile, a as Run, b as RunStatus, c as Step, d as StepMetadata, e as StepStatus, f as StepType, T as TokenMetadata, g as TraceCorrelationMetadata } from './types-BLX3tiOW.cjs';
3
- export { C as CreateInspectorOptions, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, d as InspectorStepOptions, e as createInspector, g as getCurrentCorrelationMetadata, m as maybeInspectRun } from './context-BHAgRjOe.cjs';
1
+ import { I as InspectRunOptions, S as StepOptions, O as ObserveOptions } from './types-UnrNaTo2.cjs';
2
+ export { E as ErrorInfo, R as RedactionProfile, a as Run, b as RunStatus, c as Step, d as StepMetadata, e as StepStatus, f as StepType, T as TokenMetadata, g as TraceCorrelationMetadata } from './types-UnrNaTo2.cjs';
3
+ export { C as CreateInspectorOptions, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, d as InspectorStepOptions, e as createInspector, g as getCurrentCorrelationMetadata, m as maybeInspectRun } from './context-Ca5yK8Cs.cjs';
4
4
  import { a as ObserveOutcomeOptions } from './types-B562HgN_.cjs';
5
- import './log-config-BG1WmWf2.cjs';
6
- import './inspect-event-DVg84S4v.cjs';
7
- import './persisted-inspect-event-d-mSP8kd.cjs';
5
+ import './log-config-CFlIJHTf.cjs';
6
+ import './inspect-event-DRthdZlf.cjs';
7
+ import './persisted-inspect-event-CVZWZldL.cjs';
8
8
  import './writers.cjs';
9
9
 
10
10
  /**
@@ -1,10 +1,10 @@
1
- import { I as InspectRunOptions, S as StepOptions, O as ObserveOptions } from './types-MuwXSJ4b.js';
2
- export { E as ErrorInfo, R as RedactionProfile, a as Run, b as RunStatus, c as Step, d as StepMetadata, e as StepStatus, f as StepType, T as TokenMetadata, g as TraceCorrelationMetadata } from './types-MuwXSJ4b.js';
3
- export { C as CreateInspectorOptions, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, d as InspectorStepOptions, e as createInspector, g as getCurrentCorrelationMetadata, m as maybeInspectRun } from './context-Blyjb5my.js';
1
+ import { I as InspectRunOptions, S as StepOptions, O as ObserveOptions } from './types--ainI31J.js';
2
+ export { E as ErrorInfo, R as RedactionProfile, a as Run, b as RunStatus, c as Step, d as StepMetadata, e as StepStatus, f as StepType, T as TokenMetadata, g as TraceCorrelationMetadata } from './types--ainI31J.js';
3
+ export { C as CreateInspectorOptions, I as Inspector, a as InspectorCaptureOptions, b as InspectorObserveOptions, c as InspectorRunOptions, d as InspectorStepOptions, e as createInspector, g as getCurrentCorrelationMetadata, m as maybeInspectRun } from './context-D6cS4XIL.js';
4
4
  import { a as ObserveOutcomeOptions } from './types-B562HgN_.js';
5
- import './log-config-Ck0aT_Ou.js';
6
- import './inspect-event-DVg84S4v.js';
7
- import './persisted-inspect-event-ChE7pGb7.js';
5
+ import './log-config-OZRfpHED.js';
6
+ import './inspect-event-DRthdZlf.js';
7
+ import './persisted-inspect-event-BVucFVrP.js';
8
8
  import './writers.js';
9
9
 
10
10
  /**
@@ -23,6 +23,14 @@ interface InspectNode {
23
23
  children: InspectNode[];
24
24
  depth: number;
25
25
  }
26
+ /** Bounded parent/cycle summary for visibility-first tree building (6.14.2+). */
27
+ interface RelationshipSummary {
28
+ rootCount: number;
29
+ selfParentCount: number;
30
+ cycleCount: number;
31
+ unresolvedParentCount: number;
32
+ normalizedEdgeCount: number;
33
+ }
26
34
  interface InspectRunTree {
27
35
  runId: string;
28
36
  name?: string;
@@ -35,6 +43,7 @@ interface InspectRunTree {
35
43
  totalEvents: number;
36
44
  confidenceBreakdown: Record<AttributionConfidence, number>;
37
45
  kinds: Record<InspectKind, number>;
46
+ relationshipSummary?: RelationshipSummary;
38
47
  };
39
48
  }
40
49
 
@@ -23,6 +23,14 @@ interface InspectNode {
23
23
  children: InspectNode[];
24
24
  depth: number;
25
25
  }
26
+ /** Bounded parent/cycle summary for visibility-first tree building (6.14.2+). */
27
+ interface RelationshipSummary {
28
+ rootCount: number;
29
+ selfParentCount: number;
30
+ cycleCount: number;
31
+ unresolvedParentCount: number;
32
+ normalizedEdgeCount: number;
33
+ }
26
34
  interface InspectRunTree {
27
35
  runId: string;
28
36
  name?: string;
@@ -35,6 +43,7 @@ interface InspectRunTree {
35
43
  totalEvents: number;
36
44
  confidenceBreakdown: Record<AttributionConfidence, number>;
37
45
  kinds: Record<InspectKind, number>;
46
+ relationshipSummary?: RelationshipSummary;
38
47
  };
39
48
  }
40
49
 
@@ -1,4 +1,4 @@
1
- import { I as InspectKind } from './inspect-event-DVg84S4v.cjs';
1
+ import { I as InspectKind } from './inspect-event-DRthdZlf.cjs';
2
2
 
3
3
  interface LogEventMapping {
4
4
  kind?: InspectKind;
@@ -1,4 +1,4 @@
1
- import { I as InspectKind } from './inspect-event-DVg84S4v.js';
1
+ import { I as InspectKind } from './inspect-event-DRthdZlf.js';
2
2
 
3
3
  interface LogEventMapping {
4
4
  kind?: InspectKind;
@@ -634,6 +634,20 @@ var EventNormalizer = class {
634
634
  function inc(map, key) {
635
635
  map[key] = (map[key] ?? 0) + 1;
636
636
  }
637
+ function confidenceRank(confidence) {
638
+ switch (confidence) {
639
+ case "unknown":
640
+ return 0;
641
+ case "heuristic":
642
+ return 1;
643
+ case "correlated":
644
+ return 2;
645
+ case "explicit":
646
+ return 3;
647
+ default:
648
+ return 0;
649
+ }
650
+ }
637
651
  function computeRunStatus(events) {
638
652
  let runTerminal;
639
653
  let sawRunEvent = false;
@@ -654,6 +668,84 @@ function computeRunStatus(events) {
654
668
  }
655
669
  return hasRunning ? "running" : "ok";
656
670
  }
671
+ function linkNodesVisibilityFirst(nodes) {
672
+ let selfParentCount = 0;
673
+ let unresolvedParentCount = 0;
674
+ let normalizedEdgeCount = 0;
675
+ let cycleCount = 0;
676
+ const pending = [];
677
+ for (const node of nodes.values()) {
678
+ const parentId = node.event.parentId;
679
+ if (!parentId) continue;
680
+ if (parentId === node.event.eventId) {
681
+ selfParentCount += 1;
682
+ normalizedEdgeCount += 1;
683
+ continue;
684
+ }
685
+ if (!nodes.has(parentId)) {
686
+ unresolvedParentCount += 1;
687
+ continue;
688
+ }
689
+ pending.push({
690
+ childId: node.event.eventId,
691
+ parentId,
692
+ childTimestamp: node.event.timestamp,
693
+ childConfidence: node.event.confidence
694
+ });
695
+ }
696
+ pending.sort((a, b) => {
697
+ const conf = confidenceRank(b.childConfidence) - confidenceRank(a.childConfidence);
698
+ if (conf !== 0) return conf;
699
+ return a.childTimestamp - b.childTimestamp;
700
+ });
701
+ const parentOf = /* @__PURE__ */ new Map();
702
+ for (const edge of pending) {
703
+ parentOf.set(edge.childId, edge.parentId);
704
+ let cursor = edge.parentId;
705
+ const seen = /* @__PURE__ */ new Set([edge.childId]);
706
+ let cyclic = false;
707
+ while (cursor) {
708
+ if (seen.has(cursor)) {
709
+ cyclic = true;
710
+ break;
711
+ }
712
+ seen.add(cursor);
713
+ cursor = parentOf.get(cursor);
714
+ }
715
+ if (cyclic) {
716
+ parentOf.delete(edge.childId);
717
+ cycleCount += 1;
718
+ normalizedEdgeCount += 1;
719
+ }
720
+ }
721
+ for (const [childId, parentId] of parentOf) {
722
+ nodes.get(parentId).children.push(nodes.get(childId));
723
+ }
724
+ const roots = [];
725
+ for (const node of nodes.values()) {
726
+ if (!parentOf.has(node.event.eventId)) {
727
+ roots.push(node);
728
+ }
729
+ }
730
+ const assignDepth = (n, depth, stack) => {
731
+ if (stack.has(n.event.eventId)) return;
732
+ n.depth = depth;
733
+ stack.add(n.event.eventId);
734
+ for (const c of n.children) assignDepth(c, depth + 1, stack);
735
+ stack.delete(n.event.eventId);
736
+ };
737
+ for (const r of roots) assignDepth(r, 0, /* @__PURE__ */ new Set());
738
+ return {
739
+ roots,
740
+ summary: {
741
+ rootCount: roots.length,
742
+ selfParentCount,
743
+ cycleCount,
744
+ unresolvedParentCount,
745
+ normalizedEdgeCount
746
+ }
747
+ };
748
+ }
657
749
  var TreeBuilder = class {
658
750
  constructor(options) {
659
751
  void options?.config;
@@ -671,20 +763,7 @@ var TreeBuilder = class {
671
763
  for (const e of sorted) {
672
764
  nodes.set(e.eventId, { event: e, children: [], depth: 0 });
673
765
  }
674
- const roots = [];
675
- for (const node of nodes.values()) {
676
- const parentId = node.event.parentId;
677
- if (parentId && nodes.has(parentId)) {
678
- nodes.get(parentId).children.push(node);
679
- } else {
680
- roots.push(node);
681
- }
682
- }
683
- const assignDepth = (n, depth) => {
684
- n.depth = depth;
685
- for (const c of n.children) assignDepth(c, depth + 1);
686
- };
687
- for (const r of roots) assignDepth(r, 0);
766
+ const { roots, summary } = linkNodesVisibilityFirst(nodes);
688
767
  const confidenceBreakdown = {
689
768
  explicit: 0,
690
769
  correlated: 0,
@@ -712,7 +791,8 @@ var TreeBuilder = class {
712
791
  metadata: {
713
792
  totalEvents: sorted.length,
714
793
  confidenceBreakdown,
715
- kinds
794
+ kinds,
795
+ relationshipSummary: summary
716
796
  }
717
797
  });
718
798
  }