agent-inspect 1.9.0 → 2.0.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 (98) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +13 -9
  3. package/docs/ADAPTER-CONFORMANCE.md +1 -1
  4. package/docs/API.md +30 -29
  5. package/docs/CLI.md +41 -11
  6. package/docs/EXPORTS.md +1 -1
  7. package/docs/GETTING-STARTED.md +2 -1
  8. package/docs/KNOWN-ISSUES.md +8 -3
  9. package/docs/LIMITATIONS.md +6 -6
  10. package/docs/MIGRATION.md +8 -8
  11. package/docs/SCHEMA.md +29 -12
  12. package/package.json +1 -1
  13. package/packages/cli/dist/index.cjs +7135 -7481
  14. package/packages/cli/dist/index.cjs.map +1 -1
  15. package/packages/cli/dist/index.mjs +7135 -7481
  16. package/packages/cli/dist/index.mjs.map +1 -1
  17. package/packages/core/dist/advanced.cjs +2047 -26
  18. package/packages/core/dist/advanced.cjs.map +1 -1
  19. package/packages/core/dist/advanced.d.cts +346 -196
  20. package/packages/core/dist/advanced.d.ts +346 -196
  21. package/packages/core/dist/advanced.mjs +628 -5
  22. package/packages/core/dist/advanced.mjs.map +1 -1
  23. package/packages/core/dist/checks.d.cts +1 -1
  24. package/packages/core/dist/checks.d.ts +1 -1
  25. package/packages/core/dist/chunk-2ZXEMWGK.mjs +549 -0
  26. package/packages/core/dist/chunk-2ZXEMWGK.mjs.map +1 -0
  27. package/packages/core/dist/{chunk-57S5D6HR.mjs → chunk-4JVGFNQH.mjs} +50 -6
  28. package/packages/core/dist/chunk-4JVGFNQH.mjs.map +1 -0
  29. package/packages/core/dist/{chunk-6QSLZCBJ.mjs → chunk-A4V2H3YU.mjs} +329 -163
  30. package/packages/core/dist/chunk-A4V2H3YU.mjs.map +1 -0
  31. package/packages/core/dist/{chunk-74XZ6N7Q.mjs → chunk-IZBJAZGF.mjs} +12 -4
  32. package/packages/core/dist/chunk-IZBJAZGF.mjs.map +1 -0
  33. package/packages/core/dist/{chunk-VTIB5MDK.mjs → chunk-NQZPZ2FN.mjs} +15 -10
  34. package/packages/core/dist/chunk-NQZPZ2FN.mjs.map +1 -0
  35. package/packages/core/dist/{chunk-TZISEVLQ.mjs → chunk-XUNJMAPD.mjs} +3 -3
  36. package/packages/core/dist/{chunk-TZISEVLQ.mjs.map → chunk-XUNJMAPD.mjs.map} +1 -1
  37. package/packages/core/dist/context-CSKnzpXR.d.cts +177 -0
  38. package/packages/core/dist/context-yv2VSDQF.d.ts +177 -0
  39. package/packages/core/dist/diff.d.cts +2 -2
  40. package/packages/core/dist/diff.d.ts +2 -2
  41. package/packages/core/dist/diff.mjs +473 -3
  42. package/packages/core/dist/diff.mjs.map +1 -1
  43. package/packages/core/dist/exporters.cjs +691 -0
  44. package/packages/core/dist/exporters.cjs.map +1 -1
  45. package/packages/core/dist/exporters.d.cts +24 -3
  46. package/packages/core/dist/exporters.d.ts +24 -3
  47. package/packages/core/dist/exporters.mjs +1113 -3
  48. package/packages/core/dist/exporters.mjs.map +1 -1
  49. package/packages/core/dist/index.cjs +1385 -8168
  50. package/packages/core/dist/index.cjs.map +1 -1
  51. package/packages/core/dist/index.d.cts +8 -350
  52. package/packages/core/dist/index.d.ts +8 -350
  53. package/packages/core/dist/index.mjs +18 -1478
  54. package/packages/core/dist/index.mjs.map +1 -1
  55. package/packages/core/dist/{log-config-DanPV3P9.d.cts → log-config-8aE5Kxtr.d.cts} +1 -1
  56. package/packages/core/dist/{log-config-BPHS4Sds.d.ts → log-config-DVimQJho.d.ts} +1 -1
  57. package/packages/core/dist/logs.d.cts +2 -2
  58. package/packages/core/dist/logs.d.ts +2 -2
  59. package/packages/core/dist/logs.mjs +785 -2
  60. package/packages/core/dist/logs.mjs.map +1 -1
  61. package/packages/core/dist/{persisted-inspect-event-Cw7TeYGr.d.ts → persisted-inspect-event-D-WpXeZX.d.ts} +14 -5
  62. package/packages/core/dist/{persisted-inspect-event-DHPfzUd8.d.cts → persisted-inspect-event-DHcHPUKv.d.cts} +14 -5
  63. package/packages/core/dist/persisted.cjs +11 -1
  64. package/packages/core/dist/persisted.cjs.map +1 -1
  65. package/packages/core/dist/persisted.d.cts +4 -4
  66. package/packages/core/dist/persisted.d.ts +4 -4
  67. package/packages/core/dist/persisted.mjs +150 -3
  68. package/packages/core/dist/persisted.mjs.map +1 -1
  69. package/packages/core/dist/readers.cjs +27 -10
  70. package/packages/core/dist/readers.cjs.map +1 -1
  71. package/packages/core/dist/readers.d.cts +1 -1
  72. package/packages/core/dist/readers.d.ts +1 -1
  73. package/packages/core/dist/readers.mjs +1580 -4
  74. package/packages/core/dist/readers.mjs.map +1 -1
  75. package/packages/core/dist/{types-Ap9uMdx_.d.ts → types-D-Y1kOU-.d.ts} +2 -2
  76. package/packages/core/dist/{types-B2-BU5CS.d.cts → types-DgMN3qow.d.cts} +2 -2
  77. package/packages/core/dist/writers.cjs +49 -3
  78. package/packages/core/dist/writers.cjs.map +1 -1
  79. package/packages/core/dist/writers.d.cts +1 -1
  80. package/packages/core/dist/writers.d.ts +1 -1
  81. package/packages/core/dist/writers.mjs +341 -4
  82. package/packages/core/dist/writers.mjs.map +1 -1
  83. package/packages/core/dist/chunk-57S5D6HR.mjs.map +0 -1
  84. package/packages/core/dist/chunk-6QSLZCBJ.mjs.map +0 -1
  85. package/packages/core/dist/chunk-6SZPTECC.mjs +0 -342
  86. package/packages/core/dist/chunk-6SZPTECC.mjs.map +0 -1
  87. package/packages/core/dist/chunk-74XZ6N7Q.mjs.map +0 -1
  88. package/packages/core/dist/chunk-HR7G62IE.mjs +0 -785
  89. package/packages/core/dist/chunk-HR7G62IE.mjs.map +0 -1
  90. package/packages/core/dist/chunk-TFLPUZ56.mjs +0 -1571
  91. package/packages/core/dist/chunk-TFLPUZ56.mjs.map +0 -1
  92. package/packages/core/dist/chunk-U2BGPESY.mjs +0 -150
  93. package/packages/core/dist/chunk-U2BGPESY.mjs.map +0 -1
  94. package/packages/core/dist/chunk-VTIB5MDK.mjs.map +0 -1
  95. package/packages/core/dist/chunk-Y56BPA3B.mjs +0 -990
  96. package/packages/core/dist/chunk-Y56BPA3B.mjs.map +0 -1
  97. package/packages/core/dist/chunk-YWAOOXLR.mjs +0 -475
  98. package/packages/core/dist/chunk-YWAOOXLR.mjs.map +0 -1
@@ -106,7 +106,9 @@ function isPersistedTraceContext(value) {
106
106
  }
107
107
  function isPersistedInspectEvent(value) {
108
108
  if (!isRecord(value)) return false;
109
- if (value.schemaVersion !== "0.2") return false;
109
+ if (value.schemaVersion !== "0.2" && value.schemaVersion !== "1.0") {
110
+ return false;
111
+ }
110
112
  if (!isNonEmptyString(value.eventId)) return false;
111
113
  if (!isNonEmptyString(value.runId)) return false;
112
114
  if (!isInspectKind(value.kind)) return false;
@@ -466,6 +468,7 @@ function detectLineFormat(parsed) {
466
468
  if (!isRecord3(parsed)) return "unknown";
467
469
  if (parsed.schemaVersion === "0.1") return "0.1";
468
470
  if (parsed.schemaVersion === "0.2") return "0.2";
471
+ if (parsed.schemaVersion === "1.0") return "1.0";
469
472
  return "unknown";
470
473
  }
471
474
  function parseTraceJsonl(raw, options = {}) {
@@ -479,6 +482,7 @@ function parseTraceJsonl(raw, options = {}) {
479
482
  let sourceEventCount = 0;
480
483
  let saw01 = false;
481
484
  let saw02 = false;
485
+ let saw10 = false;
482
486
  let lineNumber = 0;
483
487
  for (const line of raw.split(/\r?\n/)) {
484
488
  lineNumber += 1;
@@ -503,12 +507,13 @@ function parseTraceJsonl(raw, options = {}) {
503
507
  }
504
508
  continue;
505
509
  }
506
- if (format2 === "0.2") {
507
- saw02 = true;
510
+ if (format2 === "0.2" || format2 === "1.0") {
511
+ if (format2 === "0.2") saw02 = true;
512
+ else saw10 = true;
508
513
  if (isPersistedInspectEvent(parsed)) {
509
514
  sourceEventCount += 1;
510
515
  persisted.push(parsed);
511
- rows.push({ format: "0.2", event: parsed, sourceLine: lineNumber });
516
+ rows.push({ format: format2, event: parsed, sourceLine: lineNumber });
512
517
  traceEvents.push(...persistedInspectEventToTraceEvents(parsed));
513
518
  } else {
514
519
  emitWarning("Skipped invalid persisted inspect event line in trace file");
@@ -517,15 +522,17 @@ function parseTraceJsonl(raw, options = {}) {
517
522
  }
518
523
  emitWarning("Skipped trace line with unknown schemaVersion");
519
524
  }
520
- if (saw01 && saw02) {
525
+ const seenFormats = [saw01, saw02, saw10].filter(Boolean).length;
526
+ if (seenFormats > 1) {
521
527
  emitWarning(
522
- "Trace file mixes schemaVersion 0.1 and 0.2 lines; normalizing all rows"
528
+ "Trace file mixes AgentInspect schemaVersion rows; normalizing all rows"
523
529
  );
524
530
  }
525
531
  let format = "empty";
526
- if (saw01 && saw02) format = "mixed";
532
+ if (seenFormats > 1) format = "mixed";
527
533
  else if (saw01) format = "0.1";
528
534
  else if (saw02) format = "0.2";
535
+ else if (saw10) format = "1.0";
529
536
  return { format, sourceEventCount, events: traceEvents, persisted, rows };
530
537
  }
531
538
 
@@ -1190,6 +1197,7 @@ async function resolveInputUncached(input) {
1190
1197
  function detectJsonlFormat(content) {
1191
1198
  let saw01 = false;
1192
1199
  let saw02 = false;
1200
+ let saw10 = false;
1193
1201
  let validRows = 0;
1194
1202
  let invalidJsonRows = 0;
1195
1203
  let unknownSchemaRows = 0;
@@ -1220,6 +1228,11 @@ function detectJsonlFormat(content) {
1220
1228
  validRows += 1;
1221
1229
  continue;
1222
1230
  }
1231
+ if (version === "1.0") {
1232
+ saw10 = true;
1233
+ validRows += 1;
1234
+ continue;
1235
+ }
1223
1236
  }
1224
1237
  unknownSchemaRows += 1;
1225
1238
  firstUnknownSchemaLine ??= lineNumber;
@@ -1242,9 +1255,11 @@ function detectJsonlFormat(content) {
1242
1255
  });
1243
1256
  }
1244
1257
  let format = "empty";
1245
- if (saw01 && saw02) format = "mixed";
1258
+ const seenFormats = [saw01, saw02, saw10].filter(Boolean).length;
1259
+ if (seenFormats > 1) format = "mixed";
1246
1260
  else if (saw01) format = "0.1";
1247
1261
  else if (saw02) format = "0.2";
1262
+ else if (saw10) format = "1.0";
1248
1263
  return { format, validRows, warnings };
1249
1264
  }
1250
1265
  function agentInspectFormatLabel(format) {
@@ -1253,6 +1268,8 @@ function agentInspectFormatLabel(format) {
1253
1268
  return "agent-inspect-v0.1-jsonl";
1254
1269
  case "0.2":
1255
1270
  return "agent-inspect-v0.2-jsonl";
1271
+ case "1.0":
1272
+ return "agent-inspect-v1.0-jsonl";
1256
1273
  case "mixed":
1257
1274
  return "agent-inspect-mixed-jsonl";
1258
1275
  default:
@@ -1260,12 +1277,12 @@ function agentInspectFormatLabel(format) {
1260
1277
  }
1261
1278
  }
1262
1279
  function persistedEventsForParsedTrace(parsed) {
1263
- if (parsed.format === "0.2" && parsed.persisted.length > 0) {
1280
+ if ((parsed.format === "0.2" || parsed.format === "1.0") && parsed.persisted.length > 0) {
1264
1281
  return [...parsed.persisted];
1265
1282
  }
1266
1283
  if (parsed.format === "mixed" && parsed.rows.length > 0) {
1267
1284
  return parsed.rows.map((row, index) => {
1268
- if (row.format === "0.2") return row.event;
1285
+ if (row.format === "0.2" || row.format === "1.0") return row.event;
1269
1286
  return traceEventToPersistedInspectEvent(row.event, {
1270
1287
  eventIndex: index,
1271
1288
  sourceName: "agent-inspect-jsonl-reader"