agent-inspect 6.31.18 → 6.31.19
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-AHARYDFO.mjs → chunk-NALE36AJ.mjs} +104 -15
- package/packages/cli/dist/chunk-NALE36AJ.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +103 -14
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +4 -4
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-YNZZ2KYR.mjs → src-IZIVBMCO.mjs} +3 -3
- package/packages/cli/dist/{src-YNZZ2KYR.mjs.map → src-IZIVBMCO.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +72 -4
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +3 -3
- package/packages/core/dist/checks.cjs +36 -13
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-FRBBZUEP.mjs → chunk-2RSTU3OZ.mjs} +38 -15
- package/packages/core/dist/chunk-2RSTU3OZ.mjs.map +1 -0
- package/packages/core/dist/{chunk-NJUSSJX3.mjs → chunk-EIP5CNEL.mjs} +68 -2
- package/packages/core/dist/chunk-EIP5CNEL.mjs.map +1 -0
- package/packages/core/dist/readers.cjs +66 -0
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.mjs +1 -1
- package/packages/cli/dist/chunk-AHARYDFO.mjs.map +0 -1
- package/packages/core/dist/chunk-FRBBZUEP.mjs.map +0 -1
- package/packages/core/dist/chunk-NJUSSJX3.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.31.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8df3096: Fix residual recovery attemptNumber undercount and invalid result-availability times; promote OTLP agent_inspect.\* identity into workflow metadata on read; harden packed MCP SDK e2e (429/cancel/overlap/readiness); complete keyless Fix-Owes fixture corpus (Om through Thorin, Bezalel invariants).
|
|
8
|
+
|
|
3
9
|
## 6.31.18
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ The root package is enough for custom capture, the CLI, checks, and Evidence wor
|
|
|
213
213
|
|
|
214
214
|
## Status and documentation
|
|
215
215
|
|
|
216
|
-
**Current published baseline:** **6.31.
|
|
216
|
+
**Current published baseline:** **6.31.19** · persisted schema `1.0` · Node.js `>=20` · MIT.
|
|
217
217
|
|
|
218
218
|
Legacy v0.1 and v0.2 traces remain readable. Check the npm badge and [changelog](CHANGELOG.md) for the current published version.
|
|
219
219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-inspect",
|
|
3
|
-
"version": "6.31.
|
|
3
|
+
"version": "6.31.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local evidence debugger and trajectory-test toolkit for TypeScript AI agents — execution trees, TraceContract checks, Evidence v2, and read-only MCP",
|
|
@@ -3696,7 +3696,7 @@ function extractSessionWorkflowMetadata(record) {
|
|
|
3696
3696
|
assignString("conversationId", record.conversationId);
|
|
3697
3697
|
assignString("groupId", record.groupId);
|
|
3698
3698
|
assignString("parentGroupId", record.parentGroupId);
|
|
3699
|
-
assignString("retryOf", record.retryOf);
|
|
3699
|
+
assignString("retryOf", record.retryOf ?? record["agent_inspect.retry_of"]);
|
|
3700
3700
|
assignString("retryReason", record.retryReason);
|
|
3701
3701
|
assignString("handoffFrom", record.handoffFrom);
|
|
3702
3702
|
assignString("handoffTo", record.handoffTo);
|
|
@@ -3709,8 +3709,8 @@ function extractSessionWorkflowMetadata(record) {
|
|
|
3709
3709
|
assignString("toolCallId", record.toolCallId);
|
|
3710
3710
|
assignString("mcpToolCallId", record.mcpToolCallId);
|
|
3711
3711
|
assignString("linkedStepId", record.linkedStepId);
|
|
3712
|
-
assignString("operationId", record.operationId);
|
|
3713
|
-
assignString("attemptId", record.attemptId);
|
|
3712
|
+
assignString("operationId", record.operationId ?? record["agent_inspect.operation_id"]);
|
|
3713
|
+
assignString("attemptId", record.attemptId ?? record["agent_inspect.attempt_id"]);
|
|
3714
3714
|
assignString("fallbackOf", record.fallbackOf);
|
|
3715
3715
|
assignString("idempotencyKey", record.idempotencyKey);
|
|
3716
3716
|
assignString("correlationId", record.correlationId);
|
|
@@ -3721,7 +3721,9 @@ function extractSessionWorkflowMetadata(record) {
|
|
|
3721
3721
|
out.attempt = attempt;
|
|
3722
3722
|
found = true;
|
|
3723
3723
|
}
|
|
3724
|
-
const attemptNumber = finitePositiveInt(
|
|
3724
|
+
const attemptNumber = finitePositiveInt(
|
|
3725
|
+
record.attemptNumber ?? record["agent_inspect.attempt_number"]
|
|
3726
|
+
);
|
|
3725
3727
|
if (attemptNumber !== void 0) {
|
|
3726
3728
|
out.attemptNumber = attemptNumber;
|
|
3727
3729
|
found = true;
|
|
@@ -5751,12 +5753,21 @@ function countOperationAttempts(members) {
|
|
|
5751
5753
|
if (identified.size > 0) {
|
|
5752
5754
|
return identified.size + unidentified;
|
|
5753
5755
|
}
|
|
5754
|
-
const
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5756
|
+
const numbered = /* @__PURE__ */ new Set();
|
|
5757
|
+
let unnumbered = 0;
|
|
5758
|
+
for (const event of members) {
|
|
5759
|
+
if (event.kind !== "TOOL" && event.kind !== "LLM") continue;
|
|
5760
|
+
const num = attemptNumberOf(event);
|
|
5761
|
+
if (num !== void 0) {
|
|
5762
|
+
numbered.add(num);
|
|
5763
|
+
continue;
|
|
5764
|
+
}
|
|
5765
|
+
unnumbered += 1;
|
|
5758
5766
|
}
|
|
5759
|
-
|
|
5767
|
+
if (numbered.size > 0) {
|
|
5768
|
+
return numbered.size + unnumbered;
|
|
5769
|
+
}
|
|
5770
|
+
return unnumbered;
|
|
5760
5771
|
}
|
|
5761
5772
|
function classifyRetryAttempt(event, priorOrdered, allMembers) {
|
|
5762
5773
|
const workflow = workflowFor(event);
|
|
@@ -6040,11 +6051,23 @@ function consumerStartMs(event) {
|
|
|
6040
6051
|
return parseComparableMs(event.startedAt) ?? parseComparableMs(event.timestamp);
|
|
6041
6052
|
}
|
|
6042
6053
|
function resultAvailableMs(event) {
|
|
6043
|
-
const ended = parseComparableMs(event.endedAt);
|
|
6044
|
-
if (ended !== void 0) return ended;
|
|
6045
6054
|
const started = parseComparableMs(event.startedAt) ?? parseComparableMs(event.timestamp);
|
|
6046
|
-
|
|
6047
|
-
|
|
6055
|
+
const endedRaw = event.endedAt;
|
|
6056
|
+
const endedPresent = endedRaw !== void 0 && endedRaw !== null && String(endedRaw).trim() !== "";
|
|
6057
|
+
if (endedPresent) {
|
|
6058
|
+
const ended = parseComparableMs(typeof endedRaw === "string" ? endedRaw : String(endedRaw));
|
|
6059
|
+
if (ended === void 0) return void 0;
|
|
6060
|
+
if (started !== void 0 && ended < started) return void 0;
|
|
6061
|
+
return ended;
|
|
6062
|
+
}
|
|
6063
|
+
if (event.durationMs !== void 0) {
|
|
6064
|
+
if (!Number.isFinite(event.durationMs) || event.durationMs < 0) {
|
|
6065
|
+
return void 0;
|
|
6066
|
+
}
|
|
6067
|
+
if (started !== void 0) {
|
|
6068
|
+
return started + event.durationMs;
|
|
6069
|
+
}
|
|
6070
|
+
return void 0;
|
|
6048
6071
|
}
|
|
6049
6072
|
return parseComparableMs(event.timestamp);
|
|
6050
6073
|
}
|
|
@@ -13607,6 +13630,70 @@ function mapOtlpEvents(value, pathPrefix) {
|
|
|
13607
13630
|
unsupportedFields
|
|
13608
13631
|
};
|
|
13609
13632
|
}
|
|
13633
|
+
function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
|
|
13634
|
+
const warnings = [];
|
|
13635
|
+
const mapping = [
|
|
13636
|
+
["agent_inspect.operation_id", "operationId", "string"],
|
|
13637
|
+
["agent_inspect.attempt_id", "attemptId", "string"],
|
|
13638
|
+
["agent_inspect.retry_of", "retryOf", "string"],
|
|
13639
|
+
["agent_inspect.attempt_number", "attemptNumber", "int"]
|
|
13640
|
+
];
|
|
13641
|
+
const metadata = attributes.metadata && typeof attributes.metadata === "object" && !Array.isArray(attributes.metadata) ? { ...attributes.metadata } : {};
|
|
13642
|
+
for (const [dotted, camel, kind] of mapping) {
|
|
13643
|
+
const raw = attributes[dotted];
|
|
13644
|
+
if (raw === void 0 || raw === null) continue;
|
|
13645
|
+
let promoted;
|
|
13646
|
+
if (kind === "int") {
|
|
13647
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" ? Number(raw) : NaN;
|
|
13648
|
+
if (!Number.isFinite(n) || n < 1) {
|
|
13649
|
+
warnings.push({
|
|
13650
|
+
code: "otlp_identity_invalid",
|
|
13651
|
+
message: `Ignoring invalid ${dotted} identity value.`,
|
|
13652
|
+
severity: "warning",
|
|
13653
|
+
field: `${pathPrefix}.${dotted}`
|
|
13654
|
+
});
|
|
13655
|
+
continue;
|
|
13656
|
+
}
|
|
13657
|
+
promoted = Math.trunc(n);
|
|
13658
|
+
} else if (typeof raw === "string" && raw.trim() !== "") {
|
|
13659
|
+
promoted = raw.trim();
|
|
13660
|
+
} else {
|
|
13661
|
+
warnings.push({
|
|
13662
|
+
code: "otlp_identity_invalid",
|
|
13663
|
+
message: `Ignoring non-string ${dotted} identity value.`,
|
|
13664
|
+
severity: "warning",
|
|
13665
|
+
field: `${pathPrefix}.${dotted}`
|
|
13666
|
+
});
|
|
13667
|
+
continue;
|
|
13668
|
+
}
|
|
13669
|
+
const direct = attributes[camel];
|
|
13670
|
+
const nested = metadata[camel];
|
|
13671
|
+
if (direct !== void 0 && direct !== promoted) {
|
|
13672
|
+
warnings.push({
|
|
13673
|
+
code: "otlp_identity_conflict",
|
|
13674
|
+
message: `Conflicting ${camel}: attributes.${camel} vs ${dotted}; keeping camelCase.`,
|
|
13675
|
+
severity: "warning",
|
|
13676
|
+
field: `${pathPrefix}.${dotted}`
|
|
13677
|
+
});
|
|
13678
|
+
continue;
|
|
13679
|
+
}
|
|
13680
|
+
if (nested !== void 0 && nested !== promoted && direct === void 0) {
|
|
13681
|
+
warnings.push({
|
|
13682
|
+
code: "otlp_identity_conflict",
|
|
13683
|
+
message: `Conflicting ${camel}: attributes.metadata.${camel} vs ${dotted}; keeping nested.`,
|
|
13684
|
+
severity: "warning",
|
|
13685
|
+
field: `${pathPrefix}.${dotted}`
|
|
13686
|
+
});
|
|
13687
|
+
continue;
|
|
13688
|
+
}
|
|
13689
|
+
if (direct === void 0) attributes[camel] = promoted;
|
|
13690
|
+
if (nested === void 0) metadata[camel] = promoted;
|
|
13691
|
+
}
|
|
13692
|
+
if (Object.keys(metadata).length > 0) {
|
|
13693
|
+
attributes.metadata = metadata;
|
|
13694
|
+
}
|
|
13695
|
+
return warnings;
|
|
13696
|
+
}
|
|
13610
13697
|
function mapOtlpSpan(context) {
|
|
13611
13698
|
const { span, pathPrefix } = context;
|
|
13612
13699
|
const warnings = [];
|
|
@@ -13638,6 +13725,7 @@ function mapOtlpSpan(context) {
|
|
|
13638
13725
|
if (context.scopeVersion !== void 0) {
|
|
13639
13726
|
attributes["scope.version"] = context.scopeVersion;
|
|
13640
13727
|
}
|
|
13728
|
+
warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
|
|
13641
13729
|
for (const [key, value] of Object.entries(span)) {
|
|
13642
13730
|
if (OTLP_SPAN_KEYS.has(key)) continue;
|
|
13643
13731
|
unsupportedFields.push(`${pathPrefix}.${key}`);
|
|
@@ -13675,6 +13763,7 @@ function mapOtlpSpan(context) {
|
|
|
13675
13763
|
if (events.events !== void 0) {
|
|
13676
13764
|
attributes["otlp.events"] = events.events;
|
|
13677
13765
|
}
|
|
13766
|
+
warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
|
|
13678
13767
|
const traceId = readStringField(span, ["traceId"]) ?? "trace-unknown";
|
|
13679
13768
|
const spanId = readStringField(span, ["spanId"]) ?? "span-unknown";
|
|
13680
13769
|
const parentSpanId = readStringField(span, ["parentSpanId"]);
|
|
@@ -15581,5 +15670,5 @@ function renderGateReport(result, options = {}) {
|
|
|
15581
15670
|
}
|
|
15582
15671
|
|
|
15583
15672
|
export { ATTRIBUTION_CONFIDENCES, COHORT_METRIC_IDS, DEFAULT_REDACT_KEYS, DEFAULT_SUITE_ARTIFACTS_DIR, EVIDENCE_FORMAT_VERSION, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, Redactor, TraceDirectory, TraceReadError, TreeBuilder, aggregateBundleSafeStatus, aggregateSessionCheckResults, analyzeCohort, applyProfileMetadataCaps, assertBundlePathContained, assertEvidenceRelativePath, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceCausalFailureViewHtml, buildEvidenceCiPackage, buildEvidenceCircuitViewHtml, buildEvidenceContractsViewHtml, buildEvidenceDiffViewHtml, buildEvidenceHtmlShell, buildEvidenceManifest, buildEvidenceOutcomesViewHtml, buildEvidenceProvenanceViewHtml, buildEvidenceSafetyViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceTreeViewHtml, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, buildZipArchive, bundleFailsOnSafety, bundleRunAssetRelativePath, collectTraceSchemaVersions, compactAttributes, createBaselineRegressionRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRunDepthRule, createRunDurationRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolUsageRule, defaultBundleOutputPath, defaultSuiteConfigTemplate, defineTraceContract, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, evaluateTraceContract, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isAttributionConfidence, isCredentialSensitiveKey, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToRunTrees, persistedInspectEventsToTraceEvents, projectLogicalEvents, renderActivitySummaryHuman, renderCohortReport, renderErrorLine, renderGateReport, renderObservedOutcomesHtml, renderObservedOutcomesMarkdown, renderRunDiff, renderRunWhat, renderStepLine, renderSuiteReport, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveSuiteTemplate, resolveTraceDir, runGate, runSuite, runTraceChecks, safeString, sanitizeBundleRunId, searchTraces, serializeEvidenceManifest, sha256Hex, stableJson, stringContainsHighConfidenceCredential, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
|
|
15584
|
-
//# sourceMappingURL=chunk-
|
|
15585
|
-
//# sourceMappingURL=chunk-
|
|
15673
|
+
//# sourceMappingURL=chunk-NALE36AJ.mjs.map
|
|
15674
|
+
//# sourceMappingURL=chunk-NALE36AJ.mjs.map
|