@agent-inspect/langchain 6.14.2 → 6.16.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/dist/index.d.cts CHANGED
@@ -99,6 +99,7 @@ declare class AgentInspectCallback extends BaseCallbackHandler {
99
99
  knownRelationshipCount: number;
100
100
  syntheticGroupCount: number;
101
101
  selfParentRejectedCount: number;
102
+ ambiguousRelationshipCount: number;
102
103
  envelopeStarted: boolean;
103
104
  finalized: boolean;
104
105
  completionGeneration: number;
@@ -172,6 +173,7 @@ interface AdapterPersistenceDiagnostics {
172
173
  readonly knownRelationshipCount: number;
173
174
  readonly syntheticGroupCount: number;
174
175
  readonly selfParentRejectedCount: number;
176
+ readonly ambiguousRelationshipCount: number;
175
177
  readonly envelopeStarted: boolean;
176
178
  readonly finalized: boolean;
177
179
  readonly completionGeneration: number;
package/dist/index.d.ts CHANGED
@@ -99,6 +99,7 @@ declare class AgentInspectCallback extends BaseCallbackHandler {
99
99
  knownRelationshipCount: number;
100
100
  syntheticGroupCount: number;
101
101
  selfParentRejectedCount: number;
102
+ ambiguousRelationshipCount: number;
102
103
  envelopeStarted: boolean;
103
104
  finalized: boolean;
104
105
  completionGeneration: number;
@@ -172,6 +173,7 @@ interface AdapterPersistenceDiagnostics {
172
173
  readonly knownRelationshipCount: number;
173
174
  readonly syntheticGroupCount: number;
174
175
  readonly selfParentRejectedCount: number;
176
+ readonly ambiguousRelationshipCount: number;
175
177
  readonly envelopeStarted: boolean;
176
178
  readonly finalized: boolean;
177
179
  readonly completionGeneration: number;
package/dist/index.mjs CHANGED
@@ -563,6 +563,7 @@ function rejectSelfParentResolution(resolution, stepId, parentLcRunId) {
563
563
  };
564
564
  }
565
565
  var AI_LANGGRAPH_SELF_PARENT_REJECTED = "AI_LANGGRAPH_SELF_PARENT_REJECTED";
566
+ var AI_LANGGRAPH_RELATIONSHIP_AMBIGUOUS = "AI_LANGGRAPH_RELATIONSHIP_AMBIGUOUS";
566
567
  function applySelfParentCaptureInvariant(stepId, parentStepId, metadata, originalParentRunId) {
567
568
  if (!parentStepId || parentStepId !== stepId) {
568
569
  return { parentStepId, rejected: false };
@@ -577,6 +578,16 @@ function applySelfParentCaptureInvariant(stepId, parentStepId, metadata, origina
577
578
  delete metadata.parentCorrelatedVia;
578
579
  return { parentStepId: void 0, rejected: true };
579
580
  }
581
+ function applyAmbiguousScaffoldingDiagnostic(resolution, metadata) {
582
+ if (resolution.parentStepId) return false;
583
+ if (resolution.parentMapping !== "unresolved") return false;
584
+ if (metadata.diagnosticCode === AI_LANGGRAPH_SELF_PARENT_REJECTED) return false;
585
+ metadata.diagnosticCode = AI_LANGGRAPH_RELATIONSHIP_AMBIGUOUS;
586
+ if (typeof metadata.relationshipWarning !== "string") {
587
+ metadata.relationshipWarning = "ambiguous-root";
588
+ }
589
+ return true;
590
+ }
580
591
  function applyParentResolutionMetadata(metadata, resolution) {
581
592
  const hasParentSignal = Boolean(resolution.parentStepId) || Boolean(resolution.unresolvedParentRunId) || Boolean(resolution.semanticParentLabel) || Boolean(resolution.correlatedVia);
582
593
  if (!hasParentSignal) return;
@@ -638,6 +649,7 @@ var LangChainTracePersistence = class {
638
649
  #semanticParentCounts = /* @__PURE__ */ new Map();
639
650
  #lateEventCount = 0;
640
651
  #selfParentRejectedCount = 0;
652
+ #ambiguousRelationshipCount = 0;
641
653
  constructor(options = {}) {
642
654
  const inContext = hasActiveContext();
643
655
  this.#standalone = !inContext;
@@ -676,6 +688,7 @@ var LangChainTracePersistence = class {
676
688
  knownRelationshipCount: this.#lifecycle.knownRelationships.size,
677
689
  syntheticGroupCount: this.#syntheticByLabel.size,
678
690
  selfParentRejectedCount: this.#selfParentRejectedCount,
691
+ ambiguousRelationshipCount: this.#ambiguousRelationshipCount,
679
692
  envelopeStarted: this.#lifecycle.envelopeStarted,
680
693
  finalized: this.#lifecycle.finalized,
681
694
  completionGeneration: this.#lifecycle.completionGeneration,
@@ -691,6 +704,8 @@ var LangChainTracePersistence = class {
691
704
  );
692
705
  if (guarded.rejected) {
693
706
  this.#selfParentRejectedCount += 1;
707
+ } else if (applyAmbiguousScaffoldingDiagnostic(resolution, metadata)) {
708
+ this.#ambiguousRelationshipCount += 1;
694
709
  }
695
710
  return guarded.parentStepId;
696
711
  }
@@ -707,6 +722,7 @@ var LangChainTracePersistence = class {
707
722
  this.#clearStepIndexes();
708
723
  this.#lateEventCount = 0;
709
724
  this.#selfParentRejectedCount = 0;
725
+ this.#ambiguousRelationshipCount = 0;
710
726
  return;
711
727
  }
712
728
  }
@@ -715,12 +731,14 @@ var LangChainTracePersistence = class {
715
731
  this.#clearStepIndexes();
716
732
  this.#lateEventCount = 0;
717
733
  this.#selfParentRejectedCount = 0;
734
+ this.#ambiguousRelationshipCount = 0;
718
735
  }
719
736
  reset() {
720
737
  resetInvocationState(this.#lifecycle);
721
738
  this.#clearStepIndexes();
722
739
  this.#lateEventCount = 0;
723
740
  this.#selfParentRejectedCount = 0;
741
+ this.#ambiguousRelationshipCount = 0;
724
742
  }
725
743
  #clearStepIndexes() {
726
744
  this.#lcToStepId.clear();
@@ -1279,6 +1297,7 @@ var AgentInspectCallback = class extends BaseCallbackHandler {
1279
1297
  knownRelationshipCount: 0,
1280
1298
  syntheticGroupCount: 0,
1281
1299
  selfParentRejectedCount: 0,
1300
+ ambiguousRelationshipCount: 0,
1282
1301
  envelopeStarted: false,
1283
1302
  finalized: false,
1284
1303
  completionGeneration: 0,