@agent-inspect/viewer 6.12.0 → 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.cjs CHANGED
@@ -500,12 +500,12 @@ function persistedInspectEventToTraceEvents(event) {
500
500
  if (!isPersistedInspectEvent(event)) {
501
501
  throw new Error("Invalid PersistedInspectEvent: failed isPersistedInspectEvent");
502
502
  }
503
- const legacyEvent = event.attributes?.legacyEvent;
504
- if (legacyEvent === "run_started") return [fromLegacyRunStarted(event)];
505
- if (legacyEvent === "run_completed") return [fromLegacyRunCompleted(event)];
506
- if (legacyEvent === "step_started") return [fromLegacyStepStarted(event)];
507
- if (legacyEvent === "step_completed") return [fromLegacyStepCompleted(event)];
508
- if (legacyEvent === "outcome_observed") return [fromLegacyOutcomeObserved(event)];
503
+ const legacyEvent2 = event.attributes?.legacyEvent;
504
+ if (legacyEvent2 === "run_started") return [fromLegacyRunStarted(event)];
505
+ if (legacyEvent2 === "run_completed") return [fromLegacyRunCompleted(event)];
506
+ if (legacyEvent2 === "step_started") return [fromLegacyStepStarted(event)];
507
+ if (legacyEvent2 === "step_completed") return [fromLegacyStepCompleted(event)];
508
+ if (legacyEvent2 === "outcome_observed") return [fromLegacyOutcomeObserved(event)];
509
509
  if (event.kind === "RUN") {
510
510
  return fromNativeRun(event);
511
511
  }
@@ -2223,6 +2223,260 @@ async function resolveSuiteCaseTrace(suiteCase, options) {
2223
2223
  };
2224
2224
  }
2225
2225
 
2226
+ // packages/core/src/checks/logical-events.ts
2227
+ function isRecord5(value) {
2228
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2229
+ }
2230
+ function legacyEvent(event) {
2231
+ const value = event.attributes?.legacyEvent;
2232
+ return typeof value === "string" ? value : void 0;
2233
+ }
2234
+ function stepIdOf(event) {
2235
+ const value = event.attributes?.stepId;
2236
+ if (typeof value === "string" && value.trim() !== "") return value;
2237
+ return void 0;
2238
+ }
2239
+ function cloneEvent(event) {
2240
+ return {
2241
+ ...event,
2242
+ ...event.attributes !== void 0 ? { attributes: { ...event.attributes } } : {},
2243
+ ...event.error !== void 0 ? { error: { ...event.error } } : {},
2244
+ ...event.tokenUsage !== void 0 ? { tokenUsage: { ...event.tokenUsage } } : {},
2245
+ ...event.source !== void 0 ? { source: { ...event.source } } : {}
2246
+ };
2247
+ }
2248
+ function mergeAttributes(start, complete) {
2249
+ const merged = {
2250
+ ...isRecord5(complete.attributes) ? complete.attributes : {},
2251
+ ...isRecord5(start.attributes) ? start.attributes : {}
2252
+ };
2253
+ merged.legacyEvent = start.attributes?.legacyEvent ?? complete.attributes?.legacyEvent;
2254
+ merged.legacyCompleteEvent = complete.attributes?.legacyEvent;
2255
+ if (complete.attributes?.errorStack !== void 0) {
2256
+ merged.errorStack = complete.attributes.errorStack;
2257
+ }
2258
+ return Object.keys(merged).length > 0 ? merged : void 0;
2259
+ }
2260
+ function pairStartComplete(start, complete) {
2261
+ const attributes = mergeAttributes(start, complete);
2262
+ const paired = {
2263
+ ...cloneEvent(start),
2264
+ status: complete.status,
2265
+ timestamp: complete.timestamp ?? start.timestamp,
2266
+ ...complete.endedAt !== void 0 ? { endedAt: complete.endedAt } : {},
2267
+ ...complete.durationMs !== void 0 ? { durationMs: complete.durationMs } : {},
2268
+ ...complete.error !== void 0 ? { error: { ...complete.error } } : {},
2269
+ ...complete.tokenUsage !== void 0 && start.tokenUsage === void 0 ? { tokenUsage: { ...complete.tokenUsage } } : {},
2270
+ ...attributes !== void 0 ? { attributes } : {}
2271
+ };
2272
+ return {
2273
+ ...paired,
2274
+ sourceEventIds: Object.freeze([start.eventId, complete.eventId]),
2275
+ projection: {
2276
+ paired: true,
2277
+ absorbedEventIds: Object.freeze([complete.eventId]),
2278
+ parentNormalized: false,
2279
+ ...start.parentId !== void 0 ? { originalParentId: start.parentId } : {}
2280
+ }
2281
+ };
2282
+ }
2283
+ function asLogical(event, extras) {
2284
+ return {
2285
+ ...cloneEvent(event),
2286
+ sourceEventIds: Object.freeze([event.eventId]),
2287
+ projection: {
2288
+ paired: false,
2289
+ absorbedEventIds: Object.freeze([]),
2290
+ parentNormalized: extras?.parentNormalized === true,
2291
+ ...{}
2292
+ }
2293
+ };
2294
+ }
2295
+ function projectLogicalEvents(events) {
2296
+ const diagnostics = [];
2297
+ const byRun = /* @__PURE__ */ new Map();
2298
+ for (const event of events) {
2299
+ const list = byRun.get(event.runId) ?? [];
2300
+ list.push(event);
2301
+ byRun.set(event.runId, list);
2302
+ }
2303
+ const absorbedIds = /* @__PURE__ */ new Set();
2304
+ const logicalByRawId = /* @__PURE__ */ new Map();
2305
+ const stepIdToLogicalId = /* @__PURE__ */ new Map();
2306
+ const logical = [];
2307
+ const orderedRuns = [...byRun.keys()].sort((a, b) => a.localeCompare(b));
2308
+ for (const runId of orderedRuns) {
2309
+ const runEvents = byRun.get(runId) ?? [];
2310
+ const starts = [];
2311
+ const completes = [];
2312
+ const others = [];
2313
+ for (const event of runEvents) {
2314
+ const legacy = legacyEvent(event);
2315
+ if (legacy === "step_started" || legacy === "run_started" && event.status === "running") {
2316
+ starts.push(event);
2317
+ } else if (legacy === "step_completed" || legacy === "run_completed") {
2318
+ completes.push(event);
2319
+ } else {
2320
+ others.push(event);
2321
+ }
2322
+ }
2323
+ const usedCompletes = /* @__PURE__ */ new Set();
2324
+ for (const start of starts) {
2325
+ const stepId = stepIdOf(start);
2326
+ let match;
2327
+ if (legacyEvent(start) === "run_started") {
2328
+ const candidates = completes.filter(
2329
+ (c) => !usedCompletes.has(c.eventId) && legacyEvent(c) === "run_completed"
2330
+ );
2331
+ if (candidates.length > 1) {
2332
+ diagnostics.push({
2333
+ code: "AI_LOGICAL_PAIR_AMBIGUOUS",
2334
+ message: `Multiple run_completed rows for run ${runId}; using first by eventId.`,
2335
+ eventIds: candidates.map((c) => c.eventId)
2336
+ });
2337
+ candidates.sort((a, b) => a.eventId.localeCompare(b.eventId));
2338
+ }
2339
+ match = candidates[0];
2340
+ } else if (stepId) {
2341
+ const candidates = completes.filter(
2342
+ (c) => !usedCompletes.has(c.eventId) && legacyEvent(c) === "step_completed" && stepIdOf(c) === stepId
2343
+ );
2344
+ if (candidates.length > 1) {
2345
+ diagnostics.push({
2346
+ code: "AI_LOGICAL_PAIR_AMBIGUOUS",
2347
+ message: `Multiple step_completed rows for stepId ${stepId}; using first by eventId.`,
2348
+ eventIds: candidates.map((c) => c.eventId)
2349
+ });
2350
+ candidates.sort((a, b) => a.eventId.localeCompare(b.eventId));
2351
+ }
2352
+ match = candidates[0];
2353
+ }
2354
+ if (match) {
2355
+ usedCompletes.add(match.eventId);
2356
+ absorbedIds.add(match.eventId);
2357
+ const paired = pairStartComplete(start, match);
2358
+ logical.push(paired);
2359
+ logicalByRawId.set(start.eventId, paired);
2360
+ logicalByRawId.set(match.eventId, paired);
2361
+ if (stepId) stepIdToLogicalId.set(`${runId}:${stepId}`, paired.eventId);
2362
+ } else {
2363
+ diagnostics.push({
2364
+ code: "AI_LOGICAL_PAIR_UNMATCHED_START",
2365
+ message: `No matching complete for start ${start.eventId}.`,
2366
+ eventIds: [start.eventId]
2367
+ });
2368
+ const alone = asLogical(start);
2369
+ logical.push(alone);
2370
+ logicalByRawId.set(start.eventId, alone);
2371
+ if (stepId) stepIdToLogicalId.set(`${runId}:${stepId}`, alone.eventId);
2372
+ }
2373
+ }
2374
+ for (const complete of completes) {
2375
+ if (usedCompletes.has(complete.eventId)) continue;
2376
+ diagnostics.push({
2377
+ code: "AI_LOGICAL_PAIR_UNMATCHED_COMPLETE",
2378
+ message: `No matching start for complete ${complete.eventId}.`,
2379
+ eventIds: [complete.eventId]
2380
+ });
2381
+ const alone = asLogical(complete);
2382
+ logical.push(alone);
2383
+ logicalByRawId.set(complete.eventId, alone);
2384
+ const stepId = stepIdOf(complete);
2385
+ if (stepId && !stepIdToLogicalId.has(`${runId}:${stepId}`)) {
2386
+ stepIdToLogicalId.set(`${runId}:${stepId}`, alone.eventId);
2387
+ }
2388
+ }
2389
+ for (const event of others) {
2390
+ const alone = asLogical(event);
2391
+ logical.push(alone);
2392
+ logicalByRawId.set(event.eventId, alone);
2393
+ const stepId = stepIdOf(event);
2394
+ if (stepId && !stepIdToLogicalId.has(`${runId}:${stepId}`)) {
2395
+ stepIdToLogicalId.set(`${runId}:${stepId}`, alone.eventId);
2396
+ }
2397
+ }
2398
+ }
2399
+ const logicalById = new Map(logical.map((e) => [e.eventId, e]));
2400
+ const normalized = [];
2401
+ for (const event of logical) {
2402
+ const originalParentId = event.parentId;
2403
+ if (!originalParentId) {
2404
+ normalized.push(event);
2405
+ continue;
2406
+ }
2407
+ let nextParent = originalParentId;
2408
+ let remapped = false;
2409
+ const viaAbsorbed = logicalByRawId.get(originalParentId);
2410
+ if (viaAbsorbed && viaAbsorbed.eventId !== originalParentId) {
2411
+ nextParent = viaAbsorbed.eventId;
2412
+ remapped = true;
2413
+ } else if (!logicalById.has(originalParentId)) {
2414
+ const viaStep = stepIdToLogicalId.get(`${event.runId}:${originalParentId}`);
2415
+ if (viaStep) {
2416
+ nextParent = viaStep;
2417
+ remapped = true;
2418
+ }
2419
+ }
2420
+ if (!remapped) {
2421
+ if (!logicalById.has(originalParentId) && !logicalByRawId.has(originalParentId)) {
2422
+ diagnostics.push({
2423
+ code: "AI_LOGICAL_PARENT_UNRESOLVED",
2424
+ message: `Parent ${originalParentId} unresolved for ${event.eventId}.`,
2425
+ eventIds: [event.eventId]
2426
+ });
2427
+ }
2428
+ normalized.push(event);
2429
+ continue;
2430
+ }
2431
+ diagnostics.push({
2432
+ code: "AI_LOGICAL_PARENT_REMAPPED",
2433
+ message: `Remapped parent ${originalParentId} \u2192 ${nextParent} for ${event.eventId}.`,
2434
+ eventIds: [event.eventId]
2435
+ });
2436
+ normalized.push({
2437
+ ...event,
2438
+ parentId: nextParent,
2439
+ projection: {
2440
+ ...event.projection,
2441
+ parentNormalized: true,
2442
+ originalParentId
2443
+ }
2444
+ });
2445
+ }
2446
+ const rawIndex = new Map(events.map((e, i) => [e.eventId, i]));
2447
+ normalized.sort((a, b) => {
2448
+ const ai = rawIndex.get(a.sourceEventIds[0]) ?? 0;
2449
+ const bi = rawIndex.get(b.sourceEventIds[0]) ?? 0;
2450
+ return ai - bi || a.eventId.localeCompare(b.eventId);
2451
+ });
2452
+ return {
2453
+ logicalEvents: Object.freeze(normalized),
2454
+ diagnostics: Object.freeze(diagnostics)
2455
+ };
2456
+ }
2457
+ function resolveCanonicalToolName(event) {
2458
+ const attrs = event.attributes;
2459
+ const direct = pickString(attrs, ["toolName", "tool"]);
2460
+ if (direct) return direct;
2461
+ const metadata = attrs?.metadata;
2462
+ if (isRecord5(metadata)) {
2463
+ const nested = pickString(metadata, ["toolName", "tool"]);
2464
+ if (nested) return nested;
2465
+ }
2466
+ for (const prefix of ["tool:", "function:", "mcp-tools:"]) {
2467
+ if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
2468
+ }
2469
+ return event.name;
2470
+ }
2471
+ function pickString(record, keys) {
2472
+ if (!record) return void 0;
2473
+ for (const key of keys) {
2474
+ const value = record[key];
2475
+ if (typeof value === "string" && value.trim() !== "") return value.trim();
2476
+ }
2477
+ return void 0;
2478
+ }
2479
+
2226
2480
  // packages/core/src/checks/index.ts
2227
2481
  var SEVERITY_RANK = {
2228
2482
  error: 0,
@@ -2286,10 +2540,13 @@ function buildFacts(input, selectedRun) {
2286
2540
  childrenByParentId.set(parentId, children);
2287
2541
  }
2288
2542
  }
2543
+ const projection = projectLogicalEvents(scopedEvents);
2289
2544
  return {
2290
2545
  format: input.read.format,
2291
2546
  runs: Object.freeze([...input.read.runs]),
2292
2547
  events: Object.freeze([...scopedEvents]),
2548
+ logicalEvents: projection.logicalEvents,
2549
+ logicalProjectionDiagnostics: projection.diagnostics,
2293
2550
  readerWarnings: Object.freeze([...input.read.warnings]),
2294
2551
  unsupportedFields: Object.freeze([...input.read.unsupportedFields]),
2295
2552
  sourceFiles: Object.freeze([...input.read.sourceFiles]),
@@ -2468,7 +2725,10 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
2468
2725
  };
2469
2726
  }
2470
2727
  function toolName(event) {
2471
- return stringAttr(event, ["toolName", "tool"]) ?? stripPrefix(event.name, ["tool:", "function:", "mcp-tools:"]);
2728
+ return resolveCanonicalToolName(event);
2729
+ }
2730
+ function semanticEvents(context) {
2731
+ return context.logicalEvents ?? context.events;
2472
2732
  }
2473
2733
  function llmModel(event) {
2474
2734
  return stringAttr(event, ["model", "modelId", "responseModelId", "modelName", "model_name"]) ?? stripPrefix(event.name, ["llm:", "generation:", "transcription:", "speech:"]);
@@ -2480,7 +2740,7 @@ function llmFinishReason(event) {
2480
2740
  return stringAttr(event, ["finishReason", "rawFinishReason", "finish_reason"]);
2481
2741
  }
2482
2742
  function finishedEvents(context, kind) {
2483
- return context.events.filter(
2743
+ return semanticEvents(context).filter(
2484
2744
  (event) => (kind === void 0 || event.kind === kind) && event.status !== "running"
2485
2745
  );
2486
2746
  }
@@ -2506,7 +2766,7 @@ function createRunStatusRule(options = {}) {
2506
2766
  );
2507
2767
  }
2508
2768
  if (!allowIncomplete) {
2509
- const running = context.events.filter((event) => event.status === "running");
2769
+ const running = semanticEvents(context).filter((event) => event.status === "running");
2510
2770
  if (running.length > 0) {
2511
2771
  findings.push(
2512
2772
  failFinding(
@@ -2743,14 +3003,14 @@ function runTraceChecks(input, options = {}) {
2743
3003
  }
2744
3004
 
2745
3005
  // packages/core/src/persisted/token-usage.ts
2746
- function isRecord5(value) {
3006
+ function isRecord6(value) {
2747
3007
  return typeof value === "object" && value !== null && !Array.isArray(value);
2748
3008
  }
2749
3009
  function nonNegativeFinite(value) {
2750
3010
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
2751
3011
  }
2752
3012
  function normalizeTokenUsage(value) {
2753
- if (!isRecord5(value)) return void 0;
3013
+ if (!isRecord6(value)) return void 0;
2754
3014
  const input = nonNegativeFinite(value.input);
2755
3015
  const output = nonNegativeFinite(value.output);
2756
3016
  const suppliedTotal = nonNegativeFinite(value.total);
@@ -3519,7 +3779,7 @@ function persistedEventsForParsedTrace(parsed) {
3519
3779
  sourceName: "agent-inspect-jsonl-reader"
3520
3780
  });
3521
3781
  }
3522
- function isRecord6(value) {
3782
+ function isRecord7(value) {
3523
3783
  return typeof value === "object" && value !== null && !Array.isArray(value);
3524
3784
  }
3525
3785
  function isNonEmptyString4(value) {
@@ -3534,13 +3794,13 @@ function readStringField(record, keys) {
3534
3794
  }
3535
3795
  function readRecordField(record, key) {
3536
3796
  const value = record[key];
3537
- return isRecord6(value) ? value : void 0;
3797
+ return isRecord7(value) ? value : void 0;
3538
3798
  }
3539
3799
  function parseJsonDocument(content) {
3540
3800
  return JSON.parse(content);
3541
3801
  }
3542
3802
  function looksLikeOpenInferenceSpan(value) {
3543
- if (!isRecord6(value)) return false;
3803
+ if (!isRecord7(value)) return false;
3544
3804
  const attributes = readRecordField(value, "attributes");
3545
3805
  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);
3546
3806
  }
@@ -3565,7 +3825,7 @@ function extractOpenInferenceDocument(root) {
3565
3825
  unsupportedFields
3566
3826
  };
3567
3827
  }
3568
- if (!isRecord6(root)) return void 0;
3828
+ if (!isRecord7(root)) return void 0;
3569
3829
  const rootFormat = root.format;
3570
3830
  const rootCompatibility = root.compatibility;
3571
3831
  const version = typeof root.version === "string" && root.version.trim() !== "" ? root.version : void 0;
@@ -3705,7 +3965,7 @@ function summarizeAttributeValue(value) {
3705
3965
  if (Array.isArray(value)) {
3706
3966
  return { type: "array", length: value.length };
3707
3967
  }
3708
- if (isRecord6(value)) {
3968
+ if (isRecord7(value)) {
3709
3969
  return { type: "object", keyCount: Object.keys(value).length };
3710
3970
  }
3711
3971
  if (value === null) {
@@ -3792,7 +4052,7 @@ function mapOpenInferenceKind(span, attributes, pathPrefix) {
3792
4052
  }
3793
4053
  }
3794
4054
  function mapOpenInferenceStatus(status) {
3795
- if (!isRecord6(status)) return void 0;
4055
+ if (!isRecord7(status)) return void 0;
3796
4056
  const rawCode = status.code;
3797
4057
  if (typeof rawCode !== "string") return void 0;
3798
4058
  switch (rawCode.toUpperCase()) {
@@ -3892,7 +4152,7 @@ function mapOpenInferenceSpan(span, index, version) {
3892
4152
  warnings.push(...kindWarnings);
3893
4153
  const status = mapOpenInferenceStatus(span.status);
3894
4154
  const tokenUsage = readOpenInferenceTokenUsage(rawAttributes);
3895
- const errorMessage = isRecord6(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
4155
+ const errorMessage = isRecord7(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
3896
4156
  const event = {
3897
4157
  schemaVersion: "0.2",
3898
4158
  eventId: typeof rawAttributes["agent_inspect.event_id"] === "string" ? rawAttributes["agent_inspect.event_id"] : spanId,
@@ -4038,7 +4298,7 @@ var openInferenceJsonReader = {
4038
4298
  }
4039
4299
  };
4040
4300
  function parseOtlpAnyValue(value, field, warnings, unsupportedFields) {
4041
- if (!isRecord6(value)) {
4301
+ if (!isRecord7(value)) {
4042
4302
  unsupportedFields.push(field);
4043
4303
  warnings.push({
4044
4304
  code: "otlp_attribute_value_invalid",
@@ -4060,15 +4320,15 @@ function parseOtlpAnyValue(value, field, warnings, unsupportedFields) {
4060
4320
  if (typeof value.doubleValue === "number" && Number.isFinite(value.doubleValue)) {
4061
4321
  return value.doubleValue;
4062
4322
  }
4063
- if (isRecord6(value.arrayValue) && Array.isArray(value.arrayValue.values)) {
4323
+ if (isRecord7(value.arrayValue) && Array.isArray(value.arrayValue.values)) {
4064
4324
  return value.arrayValue.values.map(
4065
4325
  (item, index) => parseOtlpAnyValue(item, `${field}.arrayValue.values[${index}]`, warnings, unsupportedFields)
4066
4326
  );
4067
4327
  }
4068
- if (isRecord6(value.kvlistValue) && Array.isArray(value.kvlistValue.values)) {
4328
+ if (isRecord7(value.kvlistValue) && Array.isArray(value.kvlistValue.values)) {
4069
4329
  const out = {};
4070
4330
  for (const [index, item] of value.kvlistValue.values.entries()) {
4071
- if (!isRecord6(item) || typeof item.key !== "string") {
4331
+ if (!isRecord7(item) || typeof item.key !== "string") {
4072
4332
  unsupportedFields.push(`${field}.kvlistValue.values[${index}]`);
4073
4333
  continue;
4074
4334
  }
@@ -4119,7 +4379,7 @@ function parseOtlpAttributes(value, pathPrefix) {
4119
4379
  }
4120
4380
  for (const [index, item] of value.entries()) {
4121
4381
  const field = `${pathPrefix}[${index}]`;
4122
- if (!isRecord6(item) || typeof item.key !== "string") {
4382
+ if (!isRecord7(item) || typeof item.key !== "string") {
4123
4383
  unsupportedFields.push(field);
4124
4384
  warnings.push({
4125
4385
  code: "otlp_attribute_invalid",
@@ -4142,16 +4402,16 @@ function parseOtlpAttributes(value, pathPrefix) {
4142
4402
  return { attributes, warnings, unsupportedFields };
4143
4403
  }
4144
4404
  function looksLikeOtlpSpan(value) {
4145
- return isRecord6(value) && readStringField(value, ["traceId"]) !== void 0 && readStringField(value, ["spanId"]) !== void 0 && readStringField(value, ["name"]) !== void 0;
4405
+ return isRecord7(value) && readStringField(value, ["traceId"]) !== void 0 && readStringField(value, ["spanId"]) !== void 0 && readStringField(value, ["name"]) !== void 0;
4146
4406
  }
4147
4407
  function extractOtlpDocument(root) {
4148
- if (!isRecord6(root) || !Array.isArray(root.resourceSpans)) return void 0;
4408
+ if (!isRecord7(root) || !Array.isArray(root.resourceSpans)) return void 0;
4149
4409
  const spans = [];
4150
4410
  const warnings = [];
4151
4411
  const unsupportedFields = [];
4152
4412
  for (const [resourceIndex, resourceSpan] of root.resourceSpans.entries()) {
4153
4413
  const resourcePath = `resourceSpans[${resourceIndex}]`;
4154
- if (!isRecord6(resourceSpan)) {
4414
+ if (!isRecord7(resourceSpan)) {
4155
4415
  unsupportedFields.push(resourcePath);
4156
4416
  continue;
4157
4417
  }
@@ -4174,7 +4434,7 @@ function extractOtlpDocument(root) {
4174
4434
  }
4175
4435
  for (const [scopeIndex, scopeSpan] of resourceSpan.scopeSpans.entries()) {
4176
4436
  const scopePath = `${resourcePath}.scopeSpans[${scopeIndex}]`;
4177
- if (!isRecord6(scopeSpan)) {
4437
+ if (!isRecord7(scopeSpan)) {
4178
4438
  unsupportedFields.push(scopePath);
4179
4439
  continue;
4180
4440
  }
@@ -4241,7 +4501,7 @@ function extractOtlpDocument(root) {
4241
4501
  };
4242
4502
  }
4243
4503
  function mapOtlpStatus(status) {
4244
- if (!isRecord6(status)) return void 0;
4504
+ if (!isRecord7(status)) return void 0;
4245
4505
  const rawCode = status.code;
4246
4506
  if (typeof rawCode !== "string") return void 0;
4247
4507
  switch (rawCode.toUpperCase()) {
@@ -4341,7 +4601,7 @@ function mapOtlpEvents(value, pathPrefix) {
4341
4601
  const events = [];
4342
4602
  for (const [index, event] of value.entries()) {
4343
4603
  const eventPath = `${pathPrefix}[${index}]`;
4344
- if (!isRecord6(event)) {
4604
+ if (!isRecord7(event)) {
4345
4605
  unsupportedFields.push(eventPath);
4346
4606
  continue;
4347
4607
  }
@@ -4479,7 +4739,7 @@ function mapOtlpSpan(context) {
4479
4739
  warnings.push(...kindWarnings);
4480
4740
  const status = mapOtlpStatus(span.status);
4481
4741
  const tokenUsage = readOtlpTokenUsage(parsedSpanAttributes.attributes);
4482
- const errorMessage = isRecord6(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
4742
+ const errorMessage = isRecord7(span.status) && typeof span.status.message === "string" ? span.status.message : void 0;
4483
4743
  const event = {
4484
4744
  schemaVersion: "0.2",
4485
4745
  eventId: typeof parsedSpanAttributes.attributes["agent_inspect.event_id"] === "string" ? parsedSpanAttributes.attributes["agent_inspect.event_id"] : spanId,