agent-inspect 6.21.0 → 6.22.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.
Files changed (40) 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-CRUHIL5J.mjs → chunk-CHBYF4LE.mjs} +11 -2
  5. package/packages/cli/dist/chunk-CHBYF4LE.mjs.map +1 -0
  6. package/packages/cli/dist/index.cjs +29 -1
  7. package/packages/cli/dist/index.cjs.map +1 -1
  8. package/packages/cli/dist/index.mjs +4 -4
  9. package/packages/cli/dist/index.mjs.map +1 -1
  10. package/packages/cli/dist/{src-MNJFYW3W.mjs → src-MY5WIBPF.mjs} +3 -3
  11. package/packages/cli/dist/{src-MNJFYW3W.mjs.map → src-MY5WIBPF.mjs.map} +1 -1
  12. package/packages/core/dist/advanced.cjs +38 -0
  13. package/packages/core/dist/advanced.cjs.map +1 -1
  14. package/packages/core/dist/advanced.d.cts +36 -4
  15. package/packages/core/dist/advanced.d.ts +36 -4
  16. package/packages/core/dist/advanced.mjs +32 -4
  17. package/packages/core/dist/advanced.mjs.map +1 -1
  18. package/packages/core/dist/checks.cjs +230 -72
  19. package/packages/core/dist/checks.cjs.map +1 -1
  20. package/packages/core/dist/checks.d.cts +54 -5
  21. package/packages/core/dist/checks.d.ts +54 -5
  22. package/packages/core/dist/checks.mjs +1 -1
  23. package/packages/core/dist/{chunk-HT54OLPE.mjs → chunk-NDRMIL7Z.mjs} +103 -3
  24. package/packages/core/dist/chunk-NDRMIL7Z.mjs.map +1 -0
  25. package/packages/core/dist/{chunk-43SHIPZM.mjs → chunk-OG3GAWCX.mjs} +178 -21
  26. package/packages/core/dist/chunk-OG3GAWCX.mjs.map +1 -0
  27. package/packages/core/dist/{index-BG-ZBESI.d.cts → index-CR4CCRqP.d.cts} +7 -2
  28. package/packages/core/dist/{index-xevIlqdd.d.ts → index-CtK_p-ps.d.ts} +7 -2
  29. package/packages/core/dist/{index-AMAGuO_i.d.ts → index-D72DPqAF.d.ts} +2 -1
  30. package/packages/core/dist/{index-vqr-g6ev.d.cts → index-DLLz9sce.d.cts} +2 -1
  31. package/packages/core/dist/programmatic-gZTWLObB.d.cts +25 -0
  32. package/packages/core/dist/programmatic-gZTWLObB.d.ts +25 -0
  33. package/packages/core/dist/readers.cjs +105 -0
  34. package/packages/core/dist/readers.cjs.map +1 -1
  35. package/packages/core/dist/readers.d.cts +43 -18
  36. package/packages/core/dist/readers.d.ts +43 -18
  37. package/packages/core/dist/readers.mjs +1 -1
  38. package/packages/cli/dist/chunk-CRUHIL5J.mjs.map +0 -1
  39. package/packages/core/dist/chunk-43SHIPZM.mjs.map +0 -1
  40. package/packages/core/dist/chunk-HT54OLPE.mjs.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { T as TraceMetadataStatus } from './types-VzKihKQo.cjs';
2
- import { T as TraceReadWarning, a as TraceReadResult } from './index-vqr-g6ev.cjs';
2
+ import { h as TraceReadWarning, g as TraceReadResult } from './index-DLLz9sce.cjs';
3
3
  import { a as InspectRunTree, b as InspectNode, A as AttributionConfidence } from './inspect-event-DRthdZlf.cjs';
4
4
  import { P as PersistedInspectEvent } from './persisted-inspect-event-CVZWZldL.cjs';
5
5
  import { O as ObservedOutcomeStatus } from './types-B562HgN_.cjs';
6
6
 
7
7
  /** Known session/workflow metadata keys (v2.4 RFC). */
8
- declare const SESSION_WORKFLOW_KEYS: readonly ["sessionId", "conversationId", "groupId", "parentGroupId", "attempt", "retryOf", "retryReason", "handoffFrom", "handoffTo", "subAgentId", "subAgentName", "jobId", "queueName", "workflowName", "workflowStep", "toolCallId", "mcpToolCallId", "linkedStepId", "correlationId", "requestId", "decisionId"];
8
+ declare const SESSION_WORKFLOW_KEYS: readonly ["sessionId", "conversationId", "groupId", "parentGroupId", "attempt", "retryOf", "retryReason", "handoffFrom", "handoffTo", "subAgentId", "subAgentName", "jobId", "queueName", "workflowName", "workflowStep", "toolCallId", "mcpToolCallId", "linkedStepId", "operationId", "attemptId", "attemptNumber", "fallbackOf", "idempotencyKey", "correlationId", "requestId", "decisionId"];
9
9
  type SessionWorkflowKey = (typeof SESSION_WORKFLOW_KEYS)[number];
10
10
  type SessionConfidence = "explicit" | "correlated" | "heuristic" | "unknown";
11
11
  type SessionEdgeSource = "manual" | "adapter" | "json-log" | "log4js" | "mcp-client" | "inferred";
@@ -28,6 +28,11 @@ interface SessionWorkflowMetadata {
28
28
  toolCallId?: string;
29
29
  mcpToolCallId?: string;
30
30
  linkedStepId?: string;
31
+ operationId?: string;
32
+ attemptId?: string;
33
+ attemptNumber?: number;
34
+ fallbackOf?: string;
35
+ idempotencyKey?: string;
31
36
  correlationId?: string;
32
37
  requestId?: string;
33
38
  decisionId?: string;
@@ -1,11 +1,11 @@
1
1
  import { T as TraceMetadataStatus } from './types-Bx3mEZ04.js';
2
- import { T as TraceReadWarning, a as TraceReadResult } from './index-AMAGuO_i.js';
2
+ import { h as TraceReadWarning, g as TraceReadResult } from './index-D72DPqAF.js';
3
3
  import { a as InspectRunTree, b as InspectNode, A as AttributionConfidence } from './inspect-event-DRthdZlf.js';
4
4
  import { P as PersistedInspectEvent } from './persisted-inspect-event-BVucFVrP.js';
5
5
  import { O as ObservedOutcomeStatus } from './types-B562HgN_.js';
6
6
 
7
7
  /** Known session/workflow metadata keys (v2.4 RFC). */
8
- declare const SESSION_WORKFLOW_KEYS: readonly ["sessionId", "conversationId", "groupId", "parentGroupId", "attempt", "retryOf", "retryReason", "handoffFrom", "handoffTo", "subAgentId", "subAgentName", "jobId", "queueName", "workflowName", "workflowStep", "toolCallId", "mcpToolCallId", "linkedStepId", "correlationId", "requestId", "decisionId"];
8
+ declare const SESSION_WORKFLOW_KEYS: readonly ["sessionId", "conversationId", "groupId", "parentGroupId", "attempt", "retryOf", "retryReason", "handoffFrom", "handoffTo", "subAgentId", "subAgentName", "jobId", "queueName", "workflowName", "workflowStep", "toolCallId", "mcpToolCallId", "linkedStepId", "operationId", "attemptId", "attemptNumber", "fallbackOf", "idempotencyKey", "correlationId", "requestId", "decisionId"];
9
9
  type SessionWorkflowKey = (typeof SESSION_WORKFLOW_KEYS)[number];
10
10
  type SessionConfidence = "explicit" | "correlated" | "heuristic" | "unknown";
11
11
  type SessionEdgeSource = "manual" | "adapter" | "json-log" | "log4js" | "mcp-client" | "inferred";
@@ -28,6 +28,11 @@ interface SessionWorkflowMetadata {
28
28
  toolCallId?: string;
29
29
  mcpToolCallId?: string;
30
30
  linkedStepId?: string;
31
+ operationId?: string;
32
+ attemptId?: string;
33
+ attemptNumber?: number;
34
+ fallbackOf?: string;
35
+ idempotencyKey?: string;
31
36
  correlationId?: string;
32
37
  requestId?: string;
33
38
  decisionId?: string;
@@ -77,6 +77,7 @@ declare const openInferenceJsonReader: TraceReader;
77
77
  declare const otlpJsonReader: TraceReader;
78
78
  declare const agentInspectJsonlReader: TraceReader;
79
79
  declare const DEFAULT_TRACE_READERS: readonly TraceReader[];
80
+
80
81
  declare function detectTraceFormat(input: TraceInput, options?: TraceReadOptions): Promise<TraceFormatDetectionResult>;
81
82
  declare function readTrace(input: TraceInput, options?: TraceReadOptions): Promise<TraceReadResult>;
82
83
  declare function openTrace(input: TraceInput, options?: TraceReadOptions): Promise<TraceReadResult>;
@@ -99,4 +100,4 @@ declare function openTraceDirectory(dirPath: string, options?: TraceReadOptions)
99
100
  */
100
101
  declare function openTraceText(content: string, options?: TraceReadOptions): Promise<TraceReadResult>;
101
102
 
102
- export { DEFAULT_TRACE_READERS as D, type TraceReadWarning as T, type TraceReadResult as a, type TraceFormatCandidate as b, type TraceFormatDetectionResult as c, type TraceFormatDetectionStatus as d, type TraceInput as e, TraceReadError as f, type TraceReadErrorCode as g, type TraceReadOptions as h, type TraceReadWarningSeverity as i, type TraceReader as j, type TraceReaderDetectOptions as k, type TraceReaderReadOptions as l, agentInspectJsonlReader as m, assertTraceInput as n, detectTraceFormat as o, openInferenceJsonReader as p, openTrace as q, openTraceDirectory as r, openTraceFile as s, openTraceText as t, otlpJsonReader as u, readTrace as v };
103
+ export { DEFAULT_TRACE_READERS as D, type TraceFormatCandidate as T, type TraceFormatDetectionResult as a, type TraceFormatDetectionStatus as b, type TraceInput as c, TraceReadError as d, type TraceReadErrorCode as e, type TraceReadOptions as f, type TraceReadResult as g, type TraceReadWarning as h, type TraceReadWarningSeverity as i, type TraceReader as j, type TraceReaderDetectOptions as k, type TraceReaderReadOptions as l, agentInspectJsonlReader as m, assertTraceInput as n, detectTraceFormat as o, openInferenceJsonReader as p, openTrace as q, openTraceDirectory as r, openTraceFile as s, openTraceText as t, otlpJsonReader as u, readTrace as v };
@@ -77,6 +77,7 @@ declare const openInferenceJsonReader: TraceReader;
77
77
  declare const otlpJsonReader: TraceReader;
78
78
  declare const agentInspectJsonlReader: TraceReader;
79
79
  declare const DEFAULT_TRACE_READERS: readonly TraceReader[];
80
+
80
81
  declare function detectTraceFormat(input: TraceInput, options?: TraceReadOptions): Promise<TraceFormatDetectionResult>;
81
82
  declare function readTrace(input: TraceInput, options?: TraceReadOptions): Promise<TraceReadResult>;
82
83
  declare function openTrace(input: TraceInput, options?: TraceReadOptions): Promise<TraceReadResult>;
@@ -99,4 +100,4 @@ declare function openTraceDirectory(dirPath: string, options?: TraceReadOptions)
99
100
  */
100
101
  declare function openTraceText(content: string, options?: TraceReadOptions): Promise<TraceReadResult>;
101
102
 
102
- export { DEFAULT_TRACE_READERS as D, type TraceReadWarning as T, type TraceReadResult as a, type TraceFormatCandidate as b, type TraceFormatDetectionResult as c, type TraceFormatDetectionStatus as d, type TraceInput as e, TraceReadError as f, type TraceReadErrorCode as g, type TraceReadOptions as h, type TraceReadWarningSeverity as i, type TraceReader as j, type TraceReaderDetectOptions as k, type TraceReaderReadOptions as l, agentInspectJsonlReader as m, assertTraceInput as n, detectTraceFormat as o, openInferenceJsonReader as p, openTrace as q, openTraceDirectory as r, openTraceFile as s, openTraceText as t, otlpJsonReader as u, readTrace as v };
103
+ export { DEFAULT_TRACE_READERS as D, type TraceFormatCandidate as T, type TraceFormatDetectionResult as a, type TraceFormatDetectionStatus as b, type TraceInput as c, TraceReadError as d, type TraceReadErrorCode as e, type TraceReadOptions as f, type TraceReadResult as g, type TraceReadWarning as h, type TraceReadWarningSeverity as i, type TraceReader as j, type TraceReaderDetectOptions as k, type TraceReaderReadOptions as l, agentInspectJsonlReader as m, assertTraceInput as n, detectTraceFormat as o, openInferenceJsonReader as p, openTrace as q, openTraceDirectory as r, openTraceFile as s, openTraceText as t, otlpJsonReader as u, readTrace as v };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Stable programmatic diagnostic codes for readers / TraceFacts / TraceContract.
3
+ *
4
+ * Lowercase `TraceReadError.code` values remain the published reader error codes.
5
+ * These `AI_*` identifiers appear in messages and catalogs for actionable remediation.
6
+ *
7
+ * @experimental Additive in 6.15.0; do not replace published lowercase reader codes.
8
+ */
9
+ type ProgrammaticDiagnosticCode = "AI_TRACE_INPUT_INVALID" | "AI_TRACE_FORMAT_UNSUPPORTED" | "AI_TRACE_FORMAT_AMBIGUOUS" | "AI_TRACE_FACTS_INPUT_NOT_NORMALIZED" | "AI_TRACE_CONTRACT_RUN_SELECTION_REQUIRED" | "AI_TRACE_RELATIONSHIP_SELF_PARENT" | "AI_TRACE_RELATIONSHIP_CYCLE";
10
+ interface ProgrammaticDiagnosticSpec {
11
+ readonly code: ProgrammaticDiagnosticCode;
12
+ /** Short problem statement (without the code prefix). */
13
+ readonly summary: string;
14
+ /** Actionable remediation hint (always included in formatted messages). */
15
+ readonly remediation: string;
16
+ /** Related published / capture codes that must remain valid. */
17
+ readonly relatedCodes?: readonly string[];
18
+ }
19
+ declare const PROGRAMMATIC_DIAGNOSTIC_SPECS: Readonly<Record<ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec>>;
20
+ /**
21
+ * Format `CODE: summary Remediation: …` for thrown errors and diagnostics.
22
+ */
23
+ declare function formatProgrammaticDiagnostic(code: ProgrammaticDiagnosticCode, detail?: string): string;
24
+
25
+ export { PROGRAMMATIC_DIAGNOSTIC_SPECS as P, type ProgrammaticDiagnosticCode as a, type ProgrammaticDiagnosticSpec as b, formatProgrammaticDiagnostic as f };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Stable programmatic diagnostic codes for readers / TraceFacts / TraceContract.
3
+ *
4
+ * Lowercase `TraceReadError.code` values remain the published reader error codes.
5
+ * These `AI_*` identifiers appear in messages and catalogs for actionable remediation.
6
+ *
7
+ * @experimental Additive in 6.15.0; do not replace published lowercase reader codes.
8
+ */
9
+ type ProgrammaticDiagnosticCode = "AI_TRACE_INPUT_INVALID" | "AI_TRACE_FORMAT_UNSUPPORTED" | "AI_TRACE_FORMAT_AMBIGUOUS" | "AI_TRACE_FACTS_INPUT_NOT_NORMALIZED" | "AI_TRACE_CONTRACT_RUN_SELECTION_REQUIRED" | "AI_TRACE_RELATIONSHIP_SELF_PARENT" | "AI_TRACE_RELATIONSHIP_CYCLE";
10
+ interface ProgrammaticDiagnosticSpec {
11
+ readonly code: ProgrammaticDiagnosticCode;
12
+ /** Short problem statement (without the code prefix). */
13
+ readonly summary: string;
14
+ /** Actionable remediation hint (always included in formatted messages). */
15
+ readonly remediation: string;
16
+ /** Related published / capture codes that must remain valid. */
17
+ readonly relatedCodes?: readonly string[];
18
+ }
19
+ declare const PROGRAMMATIC_DIAGNOSTIC_SPECS: Readonly<Record<ProgrammaticDiagnosticCode, ProgrammaticDiagnosticSpec>>;
20
+ /**
21
+ * Format `CODE: summary Remediation: …` for thrown errors and diagnostics.
22
+ */
23
+ declare function formatProgrammaticDiagnostic(code: ProgrammaticDiagnosticCode, detail?: string): string;
24
+
25
+ export { PROGRAMMATIC_DIAGNOSTIC_SPECS as P, type ProgrammaticDiagnosticCode as a, type ProgrammaticDiagnosticSpec as b, formatProgrammaticDiagnostic as f };
@@ -1234,6 +1234,107 @@ function formatProgrammaticDiagnostic(code, detail) {
1234
1234
  return `${code}: ${summary} Remediation: ${spec.remediation}`;
1235
1235
  }
1236
1236
 
1237
+ // packages/core/src/readers/mapping-ledger.ts
1238
+ var OPENINFERENCE_MAPPING_LEDGER = {
1239
+ id: "openinference-to-agent-inspect",
1240
+ sourceFormat: "openinference-json",
1241
+ targetFormat: "agent-inspect-persisted-1.0",
1242
+ convention: {
1243
+ name: "OpenInference",
1244
+ version: "0.2.x",
1245
+ specUrl: "https://github.com/Arize-ai/openinference"
1246
+ },
1247
+ entries: [
1248
+ {
1249
+ source: "span.context.span_id",
1250
+ target: "eventId / trace.spanId",
1251
+ transformation: "hex identity when present",
1252
+ confidence: "explicit",
1253
+ loss: "none"
1254
+ },
1255
+ {
1256
+ source: "span.context.trace_id",
1257
+ target: "trace.traceId",
1258
+ transformation: "hex identity when present",
1259
+ confidence: "explicit",
1260
+ loss: "none"
1261
+ },
1262
+ {
1263
+ source: "span.parent_id",
1264
+ target: "parentId",
1265
+ transformation: "direct when resolvable in batch",
1266
+ confidence: "explicit",
1267
+ loss: "none"
1268
+ },
1269
+ {
1270
+ source: "attributes.openinference.span.kind",
1271
+ target: "kind",
1272
+ transformation: "enumerated kind map with degrade-to-LOGIC",
1273
+ confidence: "correlated",
1274
+ loss: "kind-degraded",
1275
+ privacyDecision: "unknown kinds preserved under bounds as attributes"
1276
+ },
1277
+ {
1278
+ source: "attributes.llm.input_messages / output_messages",
1279
+ target: "inputSummary / outputSummary",
1280
+ transformation: "bounded summaries only",
1281
+ confidence: "heuristic",
1282
+ loss: "privacy-redacted",
1283
+ privacyDecision: "raw message bodies are not required and may be omitted"
1284
+ }
1285
+ ],
1286
+ knownLosses: [
1287
+ "Chain-of-thought / private reasoning fields are never imported as raw content.",
1288
+ "Oversized attributes are bounded or marked unsupported.",
1289
+ "Unknown OpenInference kinds degrade to LOGIC with a warning."
1290
+ ]
1291
+ };
1292
+ var OTLP_JSON_MAPPING_LEDGER = {
1293
+ id: "otlp-json-to-agent-inspect",
1294
+ sourceFormat: "otlp-json",
1295
+ targetFormat: "agent-inspect-persisted-1.0",
1296
+ convention: {
1297
+ name: "OpenTelemetry GenAI semantic conventions",
1298
+ version: "1.36.0",
1299
+ specUrl: "https://opentelemetry.io/docs/specs/semconv/gen-ai/"
1300
+ },
1301
+ entries: [
1302
+ {
1303
+ source: "resourceSpans[].scopeSpans[].spans[]",
1304
+ target: "PersistedInspectEvent[]",
1305
+ transformation: "one span \u2192 one event when mappable",
1306
+ confidence: "explicit",
1307
+ loss: "none"
1308
+ },
1309
+ {
1310
+ source: "span.attributes[gen_ai.*]",
1311
+ target: "attributes / tokenUsage / kind",
1312
+ transformation: "pinned GenAI attribute family",
1313
+ confidence: "correlated",
1314
+ loss: "bounded"
1315
+ },
1316
+ {
1317
+ source: "span.attributes (unknown keys)",
1318
+ target: "attributes.* / unsupportedFields",
1319
+ transformation: "preserve under bounds or list as unsupported",
1320
+ confidence: "unknown",
1321
+ loss: "unsupported"
1322
+ }
1323
+ ],
1324
+ knownLosses: [
1325
+ "Schema 1.0 is not bound to Development-status OTel GenAI revisions.",
1326
+ "Status rewrite to fit a local narrative is forbidden.",
1327
+ "Payload bodies may be omitted; digests are optional application metadata."
1328
+ ]
1329
+ };
1330
+ var BUILTIN_MAPPING_LEDGERS = Object.freeze([
1331
+ OPENINFERENCE_MAPPING_LEDGER,
1332
+ OTLP_JSON_MAPPING_LEDGER
1333
+ ]);
1334
+ function getMappingLedger(id) {
1335
+ return BUILTIN_MAPPING_LEDGERS.find((ledger) => ledger.id === id);
1336
+ }
1337
+
1237
1338
  // packages/core/src/readers/index.ts
1238
1339
  var DEFAULT_MAX_TRACE_INPUT_BYTES = 10 * 1024 * 1024;
1239
1340
  var MIN_DETECTION_CONFIDENCE = 0.5;
@@ -2854,13 +2955,17 @@ function openTraceText(content, options = {}) {
2854
2955
  return openTrace({ type: "string", content }, options);
2855
2956
  }
2856
2957
 
2958
+ exports.BUILTIN_MAPPING_LEDGERS = BUILTIN_MAPPING_LEDGERS;
2857
2959
  exports.DEFAULT_TRACE_READERS = DEFAULT_TRACE_READERS;
2960
+ exports.OPENINFERENCE_MAPPING_LEDGER = OPENINFERENCE_MAPPING_LEDGER;
2961
+ exports.OTLP_JSON_MAPPING_LEDGER = OTLP_JSON_MAPPING_LEDGER;
2858
2962
  exports.PROGRAMMATIC_DIAGNOSTIC_SPECS = PROGRAMMATIC_DIAGNOSTIC_SPECS;
2859
2963
  exports.TraceReadError = TraceReadError;
2860
2964
  exports.agentInspectJsonlReader = agentInspectJsonlReader;
2861
2965
  exports.assertTraceInput = assertTraceInput;
2862
2966
  exports.detectTraceFormat = detectTraceFormat;
2863
2967
  exports.formatProgrammaticDiagnostic = formatProgrammaticDiagnostic;
2968
+ exports.getMappingLedger = getMappingLedger;
2864
2969
  exports.openInferenceJsonReader = openInferenceJsonReader;
2865
2970
  exports.openTrace = openTrace;
2866
2971
  exports.openTraceDirectory = openTraceDirectory;