agent-inspect 6.31.18 → 6.31.20

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.31.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 714475a: Forward MCP SDK RequestOptions (signal/timeout/progress) through wrapMcpClient; distinguish Headsign ADVANCE from COMPLETE; join Keniel receipts to comment+article; harden Roy/Gary/Shola/Navya evidence packets and retryable-error metadata lookup.
8
+
9
+ ## 6.31.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 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).
14
+
3
15
  ## 6.31.18
4
16
 
5
17
  ### 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.18** · persisted schema `1.0` · Node.js `>=20` · MIT.
216
+ **Current published baseline:** **6.31.20** · 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.18",
3
+ "version": "6.31.20",
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(record.attemptNumber);
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 numbers = members.map((event) => attemptNumberOf(event)).filter((value) => value !== void 0).sort((a, b) => a - b);
5755
- if (numbers.length > 0) {
5756
- const unique = [...new Set(numbers)];
5757
- return unique.length;
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;
5766
+ }
5767
+ if (numbered.size > 0) {
5768
+ return numbered.size + unnumbered;
5758
5769
  }
5759
- return unidentified;
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
- if (started !== void 0 && event.durationMs !== void 0 && Number.isFinite(event.durationMs)) {
6047
- return started + event.durationMs;
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
  }
@@ -6070,6 +6093,13 @@ function errorCodeOf(event) {
6070
6093
  const code = nested.code;
6071
6094
  if (typeof code === "string" && code.trim() !== "") return code.trim();
6072
6095
  }
6096
+ const meta = attrs.metadata;
6097
+ if (meta && typeof meta === "object") {
6098
+ for (const key of ["errorCode", "code"]) {
6099
+ const value = meta[key];
6100
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
6101
+ }
6102
+ }
6073
6103
  return void 0;
6074
6104
  }
6075
6105
  function argumentDigestOf(event) {
@@ -13607,6 +13637,70 @@ function mapOtlpEvents(value, pathPrefix) {
13607
13637
  unsupportedFields
13608
13638
  };
13609
13639
  }
13640
+ function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
13641
+ const warnings = [];
13642
+ const mapping = [
13643
+ ["agent_inspect.operation_id", "operationId", "string"],
13644
+ ["agent_inspect.attempt_id", "attemptId", "string"],
13645
+ ["agent_inspect.retry_of", "retryOf", "string"],
13646
+ ["agent_inspect.attempt_number", "attemptNumber", "int"]
13647
+ ];
13648
+ const metadata = attributes.metadata && typeof attributes.metadata === "object" && !Array.isArray(attributes.metadata) ? { ...attributes.metadata } : {};
13649
+ for (const [dotted, camel, kind] of mapping) {
13650
+ const raw = attributes[dotted];
13651
+ if (raw === void 0 || raw === null) continue;
13652
+ let promoted;
13653
+ if (kind === "int") {
13654
+ const n = typeof raw === "number" ? raw : typeof raw === "string" ? Number(raw) : NaN;
13655
+ if (!Number.isFinite(n) || n < 1) {
13656
+ warnings.push({
13657
+ code: "otlp_identity_invalid",
13658
+ message: `Ignoring invalid ${dotted} identity value.`,
13659
+ severity: "warning",
13660
+ field: `${pathPrefix}.${dotted}`
13661
+ });
13662
+ continue;
13663
+ }
13664
+ promoted = Math.trunc(n);
13665
+ } else if (typeof raw === "string" && raw.trim() !== "") {
13666
+ promoted = raw.trim();
13667
+ } else {
13668
+ warnings.push({
13669
+ code: "otlp_identity_invalid",
13670
+ message: `Ignoring non-string ${dotted} identity value.`,
13671
+ severity: "warning",
13672
+ field: `${pathPrefix}.${dotted}`
13673
+ });
13674
+ continue;
13675
+ }
13676
+ const direct = attributes[camel];
13677
+ const nested = metadata[camel];
13678
+ if (direct !== void 0 && direct !== promoted) {
13679
+ warnings.push({
13680
+ code: "otlp_identity_conflict",
13681
+ message: `Conflicting ${camel}: attributes.${camel} vs ${dotted}; keeping camelCase.`,
13682
+ severity: "warning",
13683
+ field: `${pathPrefix}.${dotted}`
13684
+ });
13685
+ continue;
13686
+ }
13687
+ if (nested !== void 0 && nested !== promoted && direct === void 0) {
13688
+ warnings.push({
13689
+ code: "otlp_identity_conflict",
13690
+ message: `Conflicting ${camel}: attributes.metadata.${camel} vs ${dotted}; keeping nested.`,
13691
+ severity: "warning",
13692
+ field: `${pathPrefix}.${dotted}`
13693
+ });
13694
+ continue;
13695
+ }
13696
+ if (direct === void 0) attributes[camel] = promoted;
13697
+ if (nested === void 0) metadata[camel] = promoted;
13698
+ }
13699
+ if (Object.keys(metadata).length > 0) {
13700
+ attributes.metadata = metadata;
13701
+ }
13702
+ return warnings;
13703
+ }
13610
13704
  function mapOtlpSpan(context) {
13611
13705
  const { span, pathPrefix } = context;
13612
13706
  const warnings = [];
@@ -13638,6 +13732,7 @@ function mapOtlpSpan(context) {
13638
13732
  if (context.scopeVersion !== void 0) {
13639
13733
  attributes["scope.version"] = context.scopeVersion;
13640
13734
  }
13735
+ warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
13641
13736
  for (const [key, value] of Object.entries(span)) {
13642
13737
  if (OTLP_SPAN_KEYS.has(key)) continue;
13643
13738
  unsupportedFields.push(`${pathPrefix}.${key}`);
@@ -13675,6 +13770,7 @@ function mapOtlpSpan(context) {
13675
13770
  if (events.events !== void 0) {
13676
13771
  attributes["otlp.events"] = events.events;
13677
13772
  }
13773
+ warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
13678
13774
  const traceId = readStringField(span, ["traceId"]) ?? "trace-unknown";
13679
13775
  const spanId = readStringField(span, ["spanId"]) ?? "span-unknown";
13680
13776
  const parentSpanId = readStringField(span, ["parentSpanId"]);
@@ -15581,5 +15677,5 @@ function renderGateReport(result, options = {}) {
15581
15677
  }
15582
15678
 
15583
15679
  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-AHARYDFO.mjs.map
15585
- //# sourceMappingURL=chunk-AHARYDFO.mjs.map
15680
+ //# sourceMappingURL=chunk-EVSIYDB2.mjs.map
15681
+ //# sourceMappingURL=chunk-EVSIYDB2.mjs.map