agent-inspect 6.31.7 → 6.31.8

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 (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/package.json +1 -1
  4. package/packages/cli/dist/{chunk-QV73NM25.mjs → chunk-6FE47XSF.mjs} +24 -11
  5. package/packages/cli/dist/chunk-6FE47XSF.mjs.map +1 -0
  6. package/packages/cli/dist/index.cjs +176 -42
  7. package/packages/cli/dist/index.cjs.map +1 -1
  8. package/packages/cli/dist/index.mjs +156 -36
  9. package/packages/cli/dist/index.mjs.map +1 -1
  10. package/packages/cli/dist/{src-KFOBXFPN.mjs → src-NXAYHG34.mjs} +3 -3
  11. package/packages/cli/dist/{src-KFOBXFPN.mjs.map → src-NXAYHG34.mjs.map} +1 -1
  12. package/packages/core/dist/advanced.cjs +22 -9
  13. package/packages/core/dist/advanced.cjs.map +1 -1
  14. package/packages/core/dist/advanced.mjs +5 -5
  15. package/packages/core/dist/checks.mjs +2 -2
  16. package/packages/core/dist/{chunk-LXYPM2ZO.mjs → chunk-2CCRUI42.mjs} +19 -318
  17. package/packages/core/dist/chunk-2CCRUI42.mjs.map +1 -0
  18. package/packages/core/dist/{chunk-QLYUWKK7.mjs → chunk-2IRRUNIN.mjs} +11 -5
  19. package/packages/core/dist/chunk-2IRRUNIN.mjs.map +1 -0
  20. package/packages/core/dist/{chunk-3RV3JILQ.mjs → chunk-IJJSPJXV.mjs} +20 -12
  21. package/packages/core/dist/chunk-IJJSPJXV.mjs.map +1 -0
  22. package/packages/core/dist/chunk-L5WLVBW4.mjs +355 -0
  23. package/packages/core/dist/chunk-L5WLVBW4.mjs.map +1 -0
  24. package/packages/core/dist/exporters.cjs +110 -18
  25. package/packages/core/dist/exporters.cjs.map +1 -1
  26. package/packages/core/dist/exporters.mjs +110 -18
  27. package/packages/core/dist/exporters.mjs.map +1 -1
  28. package/packages/core/dist/persisted.cjs +344 -9
  29. package/packages/core/dist/persisted.cjs.map +1 -1
  30. package/packages/core/dist/persisted.d.cts +8 -1
  31. package/packages/core/dist/persisted.d.ts +8 -1
  32. package/packages/core/dist/persisted.mjs +3 -2
  33. package/packages/core/dist/persisted.mjs.map +1 -1
  34. package/packages/core/dist/readers.cjs +377 -87
  35. package/packages/core/dist/readers.cjs.map +1 -1
  36. package/packages/core/dist/readers.mjs +3 -3
  37. package/packages/cli/dist/chunk-QV73NM25.mjs.map +0 -1
  38. package/packages/core/dist/chunk-3RV3JILQ.mjs.map +0 -1
  39. package/packages/core/dist/chunk-FWK3Q3OJ.mjs +0 -56
  40. package/packages/core/dist/chunk-FWK3Q3OJ.mjs.map +0 -1
  41. package/packages/core/dist/chunk-LXYPM2ZO.mjs.map +0 -1
  42. package/packages/core/dist/chunk-QLYUWKK7.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.31.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 5bbe8c0: Restore CLI export lifecycle coalescing for schema 0.1 nested tools, map adapter modelId/source/fractional duration on OTLP export, keep OTLP parent lookup trace-scoped, strengthen producer validation, and make Promptfoo/Collector/Elastic recipe verifiers honest.
8
+
3
9
  ## 6.31.7
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.7** · persisted schema `1.0` · Node.js `>=20` · MIT.
216
+ **Current published baseline:** **6.31.8** · 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.7",
3
+ "version": "6.31.8",
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",
@@ -11954,8 +11954,13 @@ function persistedInspectEventsToInspectEvents(events, options) {
11954
11954
  }
11955
11955
 
11956
11956
  // packages/core/src/persisted/tree-bridge.ts
11957
+ function logicalToPersisted(event) {
11958
+ const { sourceEventIds: _sourceEventIds, projection: _projection, ...rest } = event;
11959
+ return rest;
11960
+ }
11957
11961
  function persistedInspectEventsToRunTrees(events, options) {
11958
- const inspectEvents = persistedInspectEventsToInspectEvents(events, {
11962
+ const sourceEvents = options?.coalesceLifecycle === true ? projectLogicalEvents(events).logicalEvents.map(logicalToPersisted) : events;
11963
+ const inspectEvents = persistedInspectEventsToInspectEvents(sourceEvents, {
11959
11964
  skipInvalid: options?.skipInvalid
11960
11965
  });
11961
11966
  return new TreeBuilder().build(inspectEvents);
@@ -12649,7 +12654,7 @@ function mapOpenInferenceSpan(span, index, version) {
12649
12654
  const errorMessage = isRecord11(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
12650
12655
  const event = {
12651
12656
  schemaVersion: "0.2",
12652
- eventId: typeof rawAttributes["agent_inspect.event_id"] === "string" ? rawAttributes["agent_inspect.event_id"] : spanId,
12657
+ eventId: typeof rawAttributes["agent_inspect.event_id"] === "string" ? rawAttributes["agent_inspect.event_id"] : `${traceId}:${spanId}`,
12653
12658
  runId: typeof rawAttributes["agent_inspect.run_id"] === "string" ? rawAttributes["agent_inspect.run_id"] : traceId,
12654
12659
  kind,
12655
12660
  name,
@@ -12700,12 +12705,16 @@ function mapOpenInferenceEvents(document) {
12700
12705
  const mapped = document.spans.map(
12701
12706
  (span, index) => mapOpenInferenceSpan(span, index, document.version)
12702
12707
  );
12703
- const spanIdToEventId = new Map(
12704
- mapped.map((span) => [span.spanId, span.event.eventId])
12708
+ const spanKeyToEventId = new Map(
12709
+ mapped.map((span) => {
12710
+ const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
12711
+ return [`${traceId}:${span.spanId}`, span.event.eventId];
12712
+ })
12705
12713
  );
12706
12714
  for (const span of mapped) {
12707
12715
  if (span.parentSpanId === void 0) continue;
12708
- span.event.parentId = spanIdToEventId.get(span.parentSpanId) ?? span.parentSpanId;
12716
+ const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
12717
+ span.event.parentId = spanKeyToEventId.get(`${traceId}:${span.parentSpanId}`) ?? span.parentSpanId;
12709
12718
  }
12710
12719
  return {
12711
12720
  events: mapped.map((span) => span.event),
@@ -13254,7 +13263,7 @@ function mapOtlpSpan(context) {
13254
13263
  const errorMessage = isRecord11(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
13255
13264
  const event = {
13256
13265
  schemaVersion: "0.2",
13257
- eventId: typeof parsedSpanAttributes.attributes["agent_inspect.event_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.event_id"] : spanId,
13266
+ eventId: typeof parsedSpanAttributes.attributes["agent_inspect.event_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.event_id"] : `${traceId}:${spanId}`,
13258
13267
  runId: typeof parsedSpanAttributes.attributes["agent_inspect.run_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.run_id"] : traceId,
13259
13268
  kind,
13260
13269
  name: readStringField(span, ["name"]) ?? spanId,
@@ -13303,12 +13312,16 @@ function mapOtlpSpan(context) {
13303
13312
  }
13304
13313
  function mapOtlpEventsToPersisted(document) {
13305
13314
  const mapped = document.spans.map((span) => mapOtlpSpan(span));
13306
- const spanIdToEventId = new Map(
13307
- mapped.map((span) => [span.spanId, span.event.eventId])
13315
+ const spanKeyToEventId = new Map(
13316
+ mapped.map((span) => {
13317
+ const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
13318
+ return [`${traceId}:${span.spanId}`, span.event.eventId];
13319
+ })
13308
13320
  );
13309
13321
  for (const span of mapped) {
13310
13322
  if (span.parentSpanId === void 0) continue;
13311
- span.event.parentId = spanIdToEventId.get(span.parentSpanId) ?? span.parentSpanId;
13323
+ const traceId = typeof span.event.trace?.traceId === "string" ? span.event.trace.traceId : "";
13324
+ span.event.parentId = spanKeyToEventId.get(`${traceId}:${span.parentSpanId}`) ?? span.parentSpanId;
13312
13325
  }
13313
13326
  return {
13314
13327
  events: mapped.map((span) => span.event),
@@ -14960,5 +14973,5 @@ function renderGateReport(result, options = {}) {
14960
14973
  }
14961
14974
 
14962
14975
  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 };
14963
- //# sourceMappingURL=chunk-QV73NM25.mjs.map
14964
- //# sourceMappingURL=chunk-QV73NM25.mjs.map
14976
+ //# sourceMappingURL=chunk-6FE47XSF.mjs.map
14977
+ //# sourceMappingURL=chunk-6FE47XSF.mjs.map