@agent-inspect/viewer 6.12.1 → 6.12.2

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/dist/index.mjs CHANGED
@@ -493,12 +493,12 @@ function persistedInspectEventToTraceEvents(event) {
493
493
  if (!isPersistedInspectEvent(event)) {
494
494
  throw new Error("Invalid PersistedInspectEvent: failed isPersistedInspectEvent");
495
495
  }
496
- const legacyEvent = event.attributes?.legacyEvent;
497
- if (legacyEvent === "run_started") return [fromLegacyRunStarted(event)];
498
- if (legacyEvent === "run_completed") return [fromLegacyRunCompleted(event)];
499
- if (legacyEvent === "step_started") return [fromLegacyStepStarted(event)];
500
- if (legacyEvent === "step_completed") return [fromLegacyStepCompleted(event)];
501
- if (legacyEvent === "outcome_observed") return [fromLegacyOutcomeObserved(event)];
496
+ const legacyEvent2 = event.attributes?.legacyEvent;
497
+ if (legacyEvent2 === "run_started") return [fromLegacyRunStarted(event)];
498
+ if (legacyEvent2 === "run_completed") return [fromLegacyRunCompleted(event)];
499
+ if (legacyEvent2 === "step_started") return [fromLegacyStepStarted(event)];
500
+ if (legacyEvent2 === "step_completed") return [fromLegacyStepCompleted(event)];
501
+ if (legacyEvent2 === "outcome_observed") return [fromLegacyOutcomeObserved(event)];
502
502
  if (event.kind === "RUN") {
503
503
  return fromNativeRun(event);
504
504
  }
@@ -2216,6 +2216,260 @@ async function resolveSuiteCaseTrace(suiteCase, options) {
2216
2216
  };
2217
2217
  }
2218
2218
 
2219
+ // packages/core/src/checks/logical-events.ts
2220
+ function isRecord5(value) {
2221
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2222
+ }
2223
+ function legacyEvent(event) {
2224
+ const value = event.attributes?.legacyEvent;
2225
+ return typeof value === "string" ? value : void 0;
2226
+ }
2227
+ function stepIdOf(event) {
2228
+ const value = event.attributes?.stepId;
2229
+ if (typeof value === "string" && value.trim() !== "") return value;
2230
+ return void 0;
2231
+ }
2232
+ function cloneEvent(event) {
2233
+ return {
2234
+ ...event,
2235
+ ...event.attributes !== void 0 ? { attributes: { ...event.attributes } } : {},
2236
+ ...event.error !== void 0 ? { error: { ...event.error } } : {},
2237
+ ...event.tokenUsage !== void 0 ? { tokenUsage: { ...event.tokenUsage } } : {},
2238
+ ...event.source !== void 0 ? { source: { ...event.source } } : {}
2239
+ };
2240
+ }
2241
+ function mergeAttributes(start, complete) {
2242
+ const merged = {
2243
+ ...isRecord5(complete.attributes) ? complete.attributes : {},
2244
+ ...isRecord5(start.attributes) ? start.attributes : {}
2245
+ };
2246
+ merged.legacyEvent = start.attributes?.legacyEvent ?? complete.attributes?.legacyEvent;
2247
+ merged.legacyCompleteEvent = complete.attributes?.legacyEvent;
2248
+ if (complete.attributes?.errorStack !== void 0) {
2249
+ merged.errorStack = complete.attributes.errorStack;
2250
+ }
2251
+ return Object.keys(merged).length > 0 ? merged : void 0;
2252
+ }
2253
+ function pairStartComplete(start, complete) {
2254
+ const attributes = mergeAttributes(start, complete);
2255
+ const paired = {
2256
+ ...cloneEvent(start),
2257
+ status: complete.status,
2258
+ timestamp: complete.timestamp ?? start.timestamp,
2259
+ ...complete.endedAt !== void 0 ? { endedAt: complete.endedAt } : {},
2260
+ ...complete.durationMs !== void 0 ? { durationMs: complete.durationMs } : {},
2261
+ ...complete.error !== void 0 ? { error: { ...complete.error } } : {},
2262
+ ...complete.tokenUsage !== void 0 && start.tokenUsage === void 0 ? { tokenUsage: { ...complete.tokenUsage } } : {},
2263
+ ...attributes !== void 0 ? { attributes } : {}
2264
+ };
2265
+ return {
2266
+ ...paired,
2267
+ sourceEventIds: Object.freeze([start.eventId, complete.eventId]),
2268
+ projection: {
2269
+ paired: true,
2270
+ absorbedEventIds: Object.freeze([complete.eventId]),
2271
+ parentNormalized: false,
2272
+ ...start.parentId !== void 0 ? { originalParentId: start.parentId } : {}
2273
+ }
2274
+ };
2275
+ }
2276
+ function asLogical(event, extras) {
2277
+ return {
2278
+ ...cloneEvent(event),
2279
+ sourceEventIds: Object.freeze([event.eventId]),
2280
+ projection: {
2281
+ paired: false,
2282
+ absorbedEventIds: Object.freeze([]),
2283
+ parentNormalized: extras?.parentNormalized === true,
2284
+ ...{}
2285
+ }
2286
+ };
2287
+ }
2288
+ function projectLogicalEvents(events) {
2289
+ const diagnostics = [];
2290
+ const byRun = /* @__PURE__ */ new Map();
2291
+ for (const event of events) {
2292
+ const list = byRun.get(event.runId) ?? [];
2293
+ list.push(event);
2294
+ byRun.set(event.runId, list);
2295
+ }
2296
+ const absorbedIds = /* @__PURE__ */ new Set();
2297
+ const logicalByRawId = /* @__PURE__ */ new Map();
2298
+ const stepIdToLogicalId = /* @__PURE__ */ new Map();
2299
+ const logical = [];
2300
+ const orderedRuns = [...byRun.keys()].sort((a, b) => a.localeCompare(b));
2301
+ for (const runId of orderedRuns) {
2302
+ const runEvents = byRun.get(runId) ?? [];
2303
+ const starts = [];
2304
+ const completes = [];
2305
+ const others = [];
2306
+ for (const event of runEvents) {
2307
+ const legacy = legacyEvent(event);
2308
+ if (legacy === "step_started" || legacy === "run_started" && event.status === "running") {
2309
+ starts.push(event);
2310
+ } else if (legacy === "step_completed" || legacy === "run_completed") {
2311
+ completes.push(event);
2312
+ } else {
2313
+ others.push(event);
2314
+ }
2315
+ }
2316
+ const usedCompletes = /* @__PURE__ */ new Set();
2317
+ for (const start of starts) {
2318
+ const stepId = stepIdOf(start);
2319
+ let match;
2320
+ if (legacyEvent(start) === "run_started") {
2321
+ const candidates = completes.filter(
2322
+ (c) => !usedCompletes.has(c.eventId) && legacyEvent(c) === "run_completed"
2323
+ );
2324
+ if (candidates.length > 1) {
2325
+ diagnostics.push({
2326
+ code: "AI_LOGICAL_PAIR_AMBIGUOUS",
2327
+ message: `Multiple run_completed rows for run ${runId}; using first by eventId.`,
2328
+ eventIds: candidates.map((c) => c.eventId)
2329
+ });
2330
+ candidates.sort((a, b) => a.eventId.localeCompare(b.eventId));
2331
+ }
2332
+ match = candidates[0];
2333
+ } else if (stepId) {
2334
+ const candidates = completes.filter(
2335
+ (c) => !usedCompletes.has(c.eventId) && legacyEvent(c) === "step_completed" && stepIdOf(c) === stepId
2336
+ );
2337
+ if (candidates.length > 1) {
2338
+ diagnostics.push({
2339
+ code: "AI_LOGICAL_PAIR_AMBIGUOUS",
2340
+ message: `Multiple step_completed rows for stepId ${stepId}; using first by eventId.`,
2341
+ eventIds: candidates.map((c) => c.eventId)
2342
+ });
2343
+ candidates.sort((a, b) => a.eventId.localeCompare(b.eventId));
2344
+ }
2345
+ match = candidates[0];
2346
+ }
2347
+ if (match) {
2348
+ usedCompletes.add(match.eventId);
2349
+ absorbedIds.add(match.eventId);
2350
+ const paired = pairStartComplete(start, match);
2351
+ logical.push(paired);
2352
+ logicalByRawId.set(start.eventId, paired);
2353
+ logicalByRawId.set(match.eventId, paired);
2354
+ if (stepId) stepIdToLogicalId.set(`${runId}:${stepId}`, paired.eventId);
2355
+ } else {
2356
+ diagnostics.push({
2357
+ code: "AI_LOGICAL_PAIR_UNMATCHED_START",
2358
+ message: `No matching complete for start ${start.eventId}.`,
2359
+ eventIds: [start.eventId]
2360
+ });
2361
+ const alone = asLogical(start);
2362
+ logical.push(alone);
2363
+ logicalByRawId.set(start.eventId, alone);
2364
+ if (stepId) stepIdToLogicalId.set(`${runId}:${stepId}`, alone.eventId);
2365
+ }
2366
+ }
2367
+ for (const complete of completes) {
2368
+ if (usedCompletes.has(complete.eventId)) continue;
2369
+ diagnostics.push({
2370
+ code: "AI_LOGICAL_PAIR_UNMATCHED_COMPLETE",
2371
+ message: `No matching start for complete ${complete.eventId}.`,
2372
+ eventIds: [complete.eventId]
2373
+ });
2374
+ const alone = asLogical(complete);
2375
+ logical.push(alone);
2376
+ logicalByRawId.set(complete.eventId, alone);
2377
+ const stepId = stepIdOf(complete);
2378
+ if (stepId && !stepIdToLogicalId.has(`${runId}:${stepId}`)) {
2379
+ stepIdToLogicalId.set(`${runId}:${stepId}`, alone.eventId);
2380
+ }
2381
+ }
2382
+ for (const event of others) {
2383
+ const alone = asLogical(event);
2384
+ logical.push(alone);
2385
+ logicalByRawId.set(event.eventId, alone);
2386
+ const stepId = stepIdOf(event);
2387
+ if (stepId && !stepIdToLogicalId.has(`${runId}:${stepId}`)) {
2388
+ stepIdToLogicalId.set(`${runId}:${stepId}`, alone.eventId);
2389
+ }
2390
+ }
2391
+ }
2392
+ const logicalById = new Map(logical.map((e) => [e.eventId, e]));
2393
+ const normalized = [];
2394
+ for (const event of logical) {
2395
+ const originalParentId = event.parentId;
2396
+ if (!originalParentId) {
2397
+ normalized.push(event);
2398
+ continue;
2399
+ }
2400
+ let nextParent = originalParentId;
2401
+ let remapped = false;
2402
+ const viaAbsorbed = logicalByRawId.get(originalParentId);
2403
+ if (viaAbsorbed && viaAbsorbed.eventId !== originalParentId) {
2404
+ nextParent = viaAbsorbed.eventId;
2405
+ remapped = true;
2406
+ } else if (!logicalById.has(originalParentId)) {
2407
+ const viaStep = stepIdToLogicalId.get(`${event.runId}:${originalParentId}`);
2408
+ if (viaStep) {
2409
+ nextParent = viaStep;
2410
+ remapped = true;
2411
+ }
2412
+ }
2413
+ if (!remapped) {
2414
+ if (!logicalById.has(originalParentId) && !logicalByRawId.has(originalParentId)) {
2415
+ diagnostics.push({
2416
+ code: "AI_LOGICAL_PARENT_UNRESOLVED",
2417
+ message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
2418
+ eventIds: [event.eventId]
2419
+ });
2420
+ }
2421
+ normalized.push(event);
2422
+ continue;
2423
+ }
2424
+ diagnostics.push({
2425
+ code: "AI_LOGICAL_PARENT_REMAPPED",
2426
+ message: `Remapped parent ${originalParentId} \u2192 ${nextParent} for ${event.eventId}.`,
2427
+ eventIds: [event.eventId]
2428
+ });
2429
+ normalized.push({
2430
+ ...event,
2431
+ parentId: nextParent,
2432
+ projection: {
2433
+ ...event.projection,
2434
+ parentNormalized: true,
2435
+ originalParentId
2436
+ }
2437
+ });
2438
+ }
2439
+ const rawIndex = new Map(events.map((e, i) => [e.eventId, i]));
2440
+ normalized.sort((a, b) => {
2441
+ const ai = rawIndex.get(a.sourceEventIds[0]) ?? 0;
2442
+ const bi = rawIndex.get(b.sourceEventIds[0]) ?? 0;
2443
+ return ai - bi || a.eventId.localeCompare(b.eventId);
2444
+ });
2445
+ return {
2446
+ logicalEvents: Object.freeze(normalized),
2447
+ diagnostics: Object.freeze(diagnostics)
2448
+ };
2449
+ }
2450
+ function resolveCanonicalToolName(event) {
2451
+ const attrs = event.attributes;
2452
+ const direct = pickString(attrs, ["toolName", "tool"]);
2453
+ if (direct) return direct;
2454
+ const metadata = attrs?.metadata;
2455
+ if (isRecord5(metadata)) {
2456
+ const nested = pickString(metadata, ["toolName", "tool"]);
2457
+ if (nested) return nested;
2458
+ }
2459
+ for (const prefix of ["tool:", "function:", "mcp-tools:"]) {
2460
+ if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
2461
+ }
2462
+ return event.name;
2463
+ }
2464
+ function pickString(record, keys) {
2465
+ if (!record) return void 0;
2466
+ for (const key of keys) {
2467
+ const value = record[key];
2468
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
2469
+ }
2470
+ return void 0;
2471
+ }
2472
+
2219
2473
  // packages/core/src/checks/index.ts
2220
2474
  var SEVERITY_RANK = {
2221
2475
  error: 0,
@@ -2279,10 +2533,13 @@ function buildFacts(input, selectedRun) {
2279
2533
  childrenByParentId.set(parentId, children);
2280
2534
  }
2281
2535
  }
2536
+ const projection = projectLogicalEvents(scopedEvents);
2282
2537
  return {
2283
2538
  format: input.read.format,
2284
2539
  runs: Object.freeze([...input.read.runs]),
2285
2540
  events: Object.freeze([...scopedEvents]),
2541
+ logicalEvents: projection.logicalEvents,
2542
+ logicalProjectionDiagnostics: projection.diagnostics,
2286
2543
  readerWarnings: Object.freeze([...input.read.warnings]),
2287
2544
  unsupportedFields: Object.freeze([...input.read.unsupportedFields]),
2288
2545
  sourceFiles: Object.freeze([...input.read.sourceFiles]),
@@ -2461,7 +2718,10 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
2461
2718
  };
2462
2719
  }
2463
2720
  function toolName(event) {
2464
- return stringAttr(event, ["toolName", "tool"]) ?? stripPrefix(event.name, ["tool:", "function:", "mcp-tools:"]);
2721
+ return resolveCanonicalToolName(event);
2722
+ }
2723
+ function semanticEvents(context) {
2724
+ return context.logicalEvents ?? context.events;
2465
2725
  }
2466
2726
  function llmModel(event) {
2467
2727
  return stringAttr(event, ["model", "modelId", "responseModelId", "modelName", "model_name"]) ?? stripPrefix(event.name, ["llm:", "generation:", "transcription:", "speech:"]);
@@ -2473,7 +2733,7 @@ function llmFinishReason(event) {
2473
2733
  return stringAttr(event, ["finishReason", "rawFinishReason", "finish_reason"]);
2474
2734
  }
2475
2735
  function finishedEvents(context, kind) {
2476
- return context.events.filter(
2736
+ return semanticEvents(context).filter(
2477
2737
  (event) => (kind === void 0 || event.kind === kind) && event.status !== "running"
2478
2738
  );
2479
2739
  }
@@ -2499,7 +2759,7 @@ function createRunStatusRule(options = {}) {
2499
2759
  );
2500
2760
  }
2501
2761
  if (!allowIncomplete) {
2502
- const running = context.events.filter((event) => event.status === "running");
2762
+ const running = semanticEvents(context).filter((event) => event.status === "running");
2503
2763
  if (running.length > 0) {
2504
2764
  findings.push(
2505
2765
  failFinding(
@@ -2736,14 +2996,14 @@ function runTraceChecks(input, options = {}) {
2736
2996
  }
2737
2997
 
2738
2998
  // packages/core/src/persisted/token-usage.ts
2739
- function isRecord5(value) {
2999
+ function isRecord6(value) {
2740
3000
  return typeof value === "object" && value !== null && !Array.isArray(value);
2741
3001
  }
2742
3002
  function nonNegativeFinite(value) {
2743
3003
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
2744
3004
  }
2745
3005
  function normalizeTokenUsage(value) {
2746
- if (!isRecord5(value)) return void 0;
3006
+ if (!isRecord6(value)) return void 0;
2747
3007
  const input = nonNegativeFinite(value.input);
2748
3008
  const output = nonNegativeFinite(value.output);
2749
3009
  const suppliedTotal = nonNegativeFinite(value.total);
@@ -3512,7 +3772,7 @@ function persistedEventsForParsedTrace(parsed) {
3512
3772
  sourceName: "agent-inspect-jsonl-reader"
3513
3773
  });
3514
3774
  }
3515
- function isRecord6(value) {
3775
+ function isRecord7(value) {
3516
3776
  return typeof value === "object" && value !== null && !Array.isArray(value);
3517
3777
  }
3518
3778
  function isNonEmptyString4(value) {
@@ -3527,13 +3787,13 @@ function readStringField(record, keys) {
3527
3787
  }
3528
3788
  function readRecordField(record, key) {
3529
3789
  const value = record[key];
3530
- return isRecord6(value) ? value : void 0;
3790
+ return isRecord7(value) ? value : void 0;
3531
3791
  }
3532
3792
  function parseJsonDocument(content) {
3533
3793
  return JSON.parse(content);
3534
3794
  }
3535
3795
  function looksLikeOpenInferenceSpan(value) {
3536
- if (!isRecord6(value)) return false;
3796
+ if (!isRecord7(value)) return false;
3537
3797
  const attributes = readRecordField(value, "attributes");
3538
3798
  return readStringField(value, ["trace_id", "traceId"]) !== void 0 && readStringField(value, ["span_id", "spanId"]) !== void 0 && (readStringField(value, ["name"]) !== void 0 || attributes?.["openinference.span.kind"] !== void 0);
3539
3799
  }
@@ -3558,7 +3818,7 @@ function extractOpenInferenceDocument(root) {
3558
3818
  unsupportedFields
3559
3819
  };
3560
3820
  }
3561
- if (!isRecord6(root)) return void 0;
3821
+ if (!isRecord7(root)) return void 0;
3562
3822
  const rootFormat = root.format;
3563
3823
  const rootCompatibility = root.compatibility;
3564
3824
  const version = typeof root.version === "string" && root.version.trim() !== "" ? root.version : void 0;
@@ -3698,7 +3958,7 @@ function summarizeAttributeValue(value) {
3698
3958
  if (Array.isArray(value)) {
3699
3959
  return { type: "array", length: value.length };
3700
3960
  }
3701
- if (isRecord6(value)) {
3961
+ if (isRecord7(value)) {
3702
3962
  return { type: "object", keyCount: Object.keys(value).length };
3703
3963
  }
3704
3964
  if (value === null) {
@@ -3785,7 +4045,7 @@ function mapOpenInferenceKind(span, attributes, pathPrefix) {
3785
4045
  }
3786
4046
  }
3787
4047
  function mapOpenInferenceStatus(status) {
3788
- if (!isRecord6(status)) return void 0;
4048
+ if (!isRecord7(status)) return void 0;
3789
4049
  const rawCode = status.code;
3790
4050
  if (typeof rawCode !== "string") return void 0;
3791
4051
  switch (rawCode.toUpperCase()) {
@@ -3885,7 +4145,7 @@ function mapOpenInferenceSpan(span, index, version) {
3885
4145
  warnings.push(...kindWarnings);
3886
4146
  const status = mapOpenInferenceStatus(span.status);
3887
4147
  const tokenUsage = readOpenInferenceTokenUsage(rawAttributes);
3888
- const errorMessage = isRecord6(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
4148
+ const errorMessage = isRecord7(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
3889
4149
  const event = {
3890
4150
  schemaVersion: "0.2",
3891
4151
  eventId: typeof rawAttributes["agent_inspect.event_id"] === "string" ? rawAttributes["agent_inspect.event_id"] : spanId,
@@ -4031,7 +4291,7 @@ var openInferenceJsonReader = {
4031
4291
  }
4032
4292
  };
4033
4293
  function parseOtlpAnyValue(value, field, warnings, unsupportedFields) {
4034
- if (!isRecord6(value)) {
4294
+ if (!isRecord7(value)) {
4035
4295
  unsupportedFields.push(field);
4036
4296
  warnings.push({
4037
4297
  code: "otlp_attribute_value_invalid",
@@ -4053,15 +4313,15 @@ function parseOtlpAnyValue(value, field, warnings, unsupportedFields) {
4053
4313
  if (typeof value.doubleValue === "number" && Number.isFinite(value.doubleValue)) {
4054
4314
  return value.doubleValue;
4055
4315
  }
4056
- if (isRecord6(value.arrayValue) && Array.isArray(value.arrayValue.values)) {
4316
+ if (isRecord7(value.arrayValue) && Array.isArray(value.arrayValue.values)) {
4057
4317
  return value.arrayValue.values.map(
4058
4318
  (item, index) => parseOtlpAnyValue(item, `${field}.arrayValue.values[${index}]`, warnings, unsupportedFields)
4059
4319
  );
4060
4320
  }
4061
- if (isRecord6(value.kvlistValue) && Array.isArray(value.kvlistValue.values)) {
4321
+ if (isRecord7(value.kvlistValue) && Array.isArray(value.kvlistValue.values)) {
4062
4322
  const out = {};
4063
4323
  for (const [index, item] of value.kvlistValue.values.entries()) {
4064
- if (!isRecord6(item) || typeof item.key !== "string") {
4324
+ if (!isRecord7(item) || typeof item.key !== "string") {
4065
4325
  unsupportedFields.push(`${field}.kvlistValue.values[${index}]`);
4066
4326
  continue;
4067
4327
  }
@@ -4112,7 +4372,7 @@ function parseOtlpAttributes(value, pathPrefix) {
4112
4372
  }
4113
4373
  for (const [index, item] of value.entries()) {
4114
4374
  const field = `${pathPrefix}[${index}]`;
4115
- if (!isRecord6(item) || typeof item.key !== "string") {
4375
+ if (!isRecord7(item) || typeof item.key !== "string") {
4116
4376
  unsupportedFields.push(field);
4117
4377
  warnings.push({
4118
4378
  code: "otlp_attribute_invalid",
@@ -4135,16 +4395,16 @@ function parseOtlpAttributes(value, pathPrefix) {
4135
4395
  return { attributes, warnings, unsupportedFields };
4136
4396
  }
4137
4397
  function looksLikeOtlpSpan(value) {
4138
- return isRecord6(value) && readStringField(value, ["traceId"]) !== void 0 && readStringField(value, ["spanId"]) !== void 0 && readStringField(value, ["name"]) !== void 0;
4398
+ return isRecord7(value) && readStringField(value, ["traceId"]) !== void 0 && readStringField(value, ["spanId"]) !== void 0 && readStringField(value, ["name"]) !== void 0;
4139
4399
  }
4140
4400
  function extractOtlpDocument(root) {
4141
- if (!isRecord6(root) || !Array.isArray(root.resourceSpans)) return void 0;
4401
+ if (!isRecord7(root) || !Array.isArray(root.resourceSpans)) return void 0;
4142
4402
  const spans = [];
4143
4403
  const warnings = [];
4144
4404
  const unsupportedFields = [];
4145
4405
  for (const [resourceIndex, resourceSpan] of root.resourceSpans.entries()) {
4146
4406
  const resourcePath = `resourceSpans[${resourceIndex}]`;
4147
- if (!isRecord6(resourceSpan)) {
4407
+ if (!isRecord7(resourceSpan)) {
4148
4408
  unsupportedFields.push(resourcePath);
4149
4409
  continue;
4150
4410
  }
@@ -4167,7 +4427,7 @@ function extractOtlpDocument(root) {
4167
4427
  }
4168
4428
  for (const [scopeIndex, scopeSpan] of resourceSpan.scopeSpans.entries()) {
4169
4429
  const scopePath = `${resourcePath}.scopeSpans[${scopeIndex}]`;
4170
- if (!isRecord6(scopeSpan)) {
4430
+ if (!isRecord7(scopeSpan)) {
4171
4431
  unsupportedFields.push(scopePath);
4172
4432
  continue;
4173
4433
  }
@@ -4234,7 +4494,7 @@ function extractOtlpDocument(root) {
4234
4494
  };
4235
4495
  }
4236
4496
  function mapOtlpStatus(status) {
4237
- if (!isRecord6(status)) return void 0;
4497
+ if (!isRecord7(status)) return void 0;
4238
4498
  const rawCode = status.code;
4239
4499
  if (typeof rawCode !== "string") return void 0;
4240
4500
  switch (rawCode.toUpperCase()) {
@@ -4334,7 +4594,7 @@ function mapOtlpEvents(value, pathPrefix) {
4334
4594
  const events = [];
4335
4595
  for (const [index, event] of value.entries()) {
4336
4596
  const eventPath = `${pathPrefix}[${index}]`;
4337
- if (!isRecord6(event)) {
4597
+ if (!isRecord7(event)) {
4338
4598
  unsupportedFields.push(eventPath);
4339
4599
  continue;
4340
4600
  }
@@ -4472,7 +4732,7 @@ function mapOtlpSpan(context) {
4472
4732
  warnings.push(...kindWarnings);
4473
4733
  const status = mapOtlpStatus(span.status);
4474
4734
  const tokenUsage = readOtlpTokenUsage(parsedSpanAttributes.attributes);
4475
- const errorMessage = isRecord6(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
4735
+ const errorMessage = isRecord7(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
4476
4736
  const event = {
4477
4737
  schemaVersion: "0.2",
4478
4738
  eventId: typeof parsedSpanAttributes.attributes["agent_inspect.event_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.event_id"] : spanId,