@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.cjs +19 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -569,6 +569,7 @@ function rejectSelfParentResolution(resolution, stepId, parentLcRunId) {
|
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
571
|
var AI_LANGGRAPH_SELF_PARENT_REJECTED = "AI_LANGGRAPH_SELF_PARENT_REJECTED";
|
|
572
|
+
var AI_LANGGRAPH_RELATIONSHIP_AMBIGUOUS = "AI_LANGGRAPH_RELATIONSHIP_AMBIGUOUS";
|
|
572
573
|
function applySelfParentCaptureInvariant(stepId, parentStepId, metadata, originalParentRunId) {
|
|
573
574
|
if (!parentStepId || parentStepId !== stepId) {
|
|
574
575
|
return { parentStepId, rejected: false };
|
|
@@ -583,6 +584,16 @@ function applySelfParentCaptureInvariant(stepId, parentStepId, metadata, origina
|
|
|
583
584
|
delete metadata.parentCorrelatedVia;
|
|
584
585
|
return { parentStepId: void 0, rejected: true };
|
|
585
586
|
}
|
|
587
|
+
function applyAmbiguousScaffoldingDiagnostic(resolution, metadata) {
|
|
588
|
+
if (resolution.parentStepId) return false;
|
|
589
|
+
if (resolution.parentMapping !== "unresolved") return false;
|
|
590
|
+
if (metadata.diagnosticCode === AI_LANGGRAPH_SELF_PARENT_REJECTED) return false;
|
|
591
|
+
metadata.diagnosticCode = AI_LANGGRAPH_RELATIONSHIP_AMBIGUOUS;
|
|
592
|
+
if (typeof metadata.relationshipWarning !== "string") {
|
|
593
|
+
metadata.relationshipWarning = "ambiguous-root";
|
|
594
|
+
}
|
|
595
|
+
return true;
|
|
596
|
+
}
|
|
586
597
|
function applyParentResolutionMetadata(metadata, resolution) {
|
|
587
598
|
const hasParentSignal = Boolean(resolution.parentStepId) || Boolean(resolution.unresolvedParentRunId) || Boolean(resolution.semanticParentLabel) || Boolean(resolution.correlatedVia);
|
|
588
599
|
if (!hasParentSignal) return;
|
|
@@ -644,6 +655,7 @@ var LangChainTracePersistence = class {
|
|
|
644
655
|
#semanticParentCounts = /* @__PURE__ */ new Map();
|
|
645
656
|
#lateEventCount = 0;
|
|
646
657
|
#selfParentRejectedCount = 0;
|
|
658
|
+
#ambiguousRelationshipCount = 0;
|
|
647
659
|
constructor(options = {}) {
|
|
648
660
|
const inContext = advanced.hasActiveContext();
|
|
649
661
|
this.#standalone = !inContext;
|
|
@@ -682,6 +694,7 @@ var LangChainTracePersistence = class {
|
|
|
682
694
|
knownRelationshipCount: this.#lifecycle.knownRelationships.size,
|
|
683
695
|
syntheticGroupCount: this.#syntheticByLabel.size,
|
|
684
696
|
selfParentRejectedCount: this.#selfParentRejectedCount,
|
|
697
|
+
ambiguousRelationshipCount: this.#ambiguousRelationshipCount,
|
|
685
698
|
envelopeStarted: this.#lifecycle.envelopeStarted,
|
|
686
699
|
finalized: this.#lifecycle.finalized,
|
|
687
700
|
completionGeneration: this.#lifecycle.completionGeneration,
|
|
@@ -697,6 +710,8 @@ var LangChainTracePersistence = class {
|
|
|
697
710
|
);
|
|
698
711
|
if (guarded.rejected) {
|
|
699
712
|
this.#selfParentRejectedCount += 1;
|
|
713
|
+
} else if (applyAmbiguousScaffoldingDiagnostic(resolution, metadata)) {
|
|
714
|
+
this.#ambiguousRelationshipCount += 1;
|
|
700
715
|
}
|
|
701
716
|
return guarded.parentStepId;
|
|
702
717
|
}
|
|
@@ -713,6 +728,7 @@ var LangChainTracePersistence = class {
|
|
|
713
728
|
this.#clearStepIndexes();
|
|
714
729
|
this.#lateEventCount = 0;
|
|
715
730
|
this.#selfParentRejectedCount = 0;
|
|
731
|
+
this.#ambiguousRelationshipCount = 0;
|
|
716
732
|
return;
|
|
717
733
|
}
|
|
718
734
|
}
|
|
@@ -721,12 +737,14 @@ var LangChainTracePersistence = class {
|
|
|
721
737
|
this.#clearStepIndexes();
|
|
722
738
|
this.#lateEventCount = 0;
|
|
723
739
|
this.#selfParentRejectedCount = 0;
|
|
740
|
+
this.#ambiguousRelationshipCount = 0;
|
|
724
741
|
}
|
|
725
742
|
reset() {
|
|
726
743
|
resetInvocationState(this.#lifecycle);
|
|
727
744
|
this.#clearStepIndexes();
|
|
728
745
|
this.#lateEventCount = 0;
|
|
729
746
|
this.#selfParentRejectedCount = 0;
|
|
747
|
+
this.#ambiguousRelationshipCount = 0;
|
|
730
748
|
}
|
|
731
749
|
#clearStepIndexes() {
|
|
732
750
|
this.#lcToStepId.clear();
|
|
@@ -1285,6 +1303,7 @@ var AgentInspectCallback = class extends base.BaseCallbackHandler {
|
|
|
1285
1303
|
knownRelationshipCount: 0,
|
|
1286
1304
|
syntheticGroupCount: 0,
|
|
1287
1305
|
selfParentRejectedCount: 0,
|
|
1306
|
+
ambiguousRelationshipCount: 0,
|
|
1288
1307
|
envelopeStarted: false,
|
|
1289
1308
|
finalized: false,
|
|
1290
1309
|
completionGeneration: 0,
|