@agent-inspect/viewer 6.31.17 → 6.31.19
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 +72 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +72 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1564,7 +1564,7 @@ function extractSessionWorkflowMetadata(record) {
|
|
|
1564
1564
|
assignString("conversationId", record.conversationId);
|
|
1565
1565
|
assignString("groupId", record.groupId);
|
|
1566
1566
|
assignString("parentGroupId", record.parentGroupId);
|
|
1567
|
-
assignString("retryOf", record.retryOf);
|
|
1567
|
+
assignString("retryOf", record.retryOf ?? record["agent_inspect.retry_of"]);
|
|
1568
1568
|
assignString("retryReason", record.retryReason);
|
|
1569
1569
|
assignString("handoffFrom", record.handoffFrom);
|
|
1570
1570
|
assignString("handoffTo", record.handoffTo);
|
|
@@ -1577,8 +1577,8 @@ function extractSessionWorkflowMetadata(record) {
|
|
|
1577
1577
|
assignString("toolCallId", record.toolCallId);
|
|
1578
1578
|
assignString("mcpToolCallId", record.mcpToolCallId);
|
|
1579
1579
|
assignString("linkedStepId", record.linkedStepId);
|
|
1580
|
-
assignString("operationId", record.operationId);
|
|
1581
|
-
assignString("attemptId", record.attemptId);
|
|
1580
|
+
assignString("operationId", record.operationId ?? record["agent_inspect.operation_id"]);
|
|
1581
|
+
assignString("attemptId", record.attemptId ?? record["agent_inspect.attempt_id"]);
|
|
1582
1582
|
assignString("fallbackOf", record.fallbackOf);
|
|
1583
1583
|
assignString("idempotencyKey", record.idempotencyKey);
|
|
1584
1584
|
assignString("correlationId", record.correlationId);
|
|
@@ -1589,7 +1589,9 @@ function extractSessionWorkflowMetadata(record) {
|
|
|
1589
1589
|
out.attempt = attempt;
|
|
1590
1590
|
found = true;
|
|
1591
1591
|
}
|
|
1592
|
-
const attemptNumber = finitePositiveInt(
|
|
1592
|
+
const attemptNumber = finitePositiveInt(
|
|
1593
|
+
record.attemptNumber ?? record["agent_inspect.attempt_number"]
|
|
1594
|
+
);
|
|
1593
1595
|
if (attemptNumber !== void 0) {
|
|
1594
1596
|
out.attemptNumber = attemptNumber;
|
|
1595
1597
|
found = true;
|
|
@@ -5384,6 +5386,70 @@ function mapOtlpEvents(value, pathPrefix) {
|
|
|
5384
5386
|
unsupportedFields
|
|
5385
5387
|
};
|
|
5386
5388
|
}
|
|
5389
|
+
function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
|
|
5390
|
+
const warnings = [];
|
|
5391
|
+
const mapping = [
|
|
5392
|
+
["agent_inspect.operation_id", "operationId", "string"],
|
|
5393
|
+
["agent_inspect.attempt_id", "attemptId", "string"],
|
|
5394
|
+
["agent_inspect.retry_of", "retryOf", "string"],
|
|
5395
|
+
["agent_inspect.attempt_number", "attemptNumber", "int"]
|
|
5396
|
+
];
|
|
5397
|
+
const metadata = attributes.metadata && typeof attributes.metadata === "object" && !Array.isArray(attributes.metadata) ? { ...attributes.metadata } : {};
|
|
5398
|
+
for (const [dotted, camel, kind] of mapping) {
|
|
5399
|
+
const raw = attributes[dotted];
|
|
5400
|
+
if (raw === void 0 || raw === null) continue;
|
|
5401
|
+
let promoted;
|
|
5402
|
+
if (kind === "int") {
|
|
5403
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" ? Number(raw) : NaN;
|
|
5404
|
+
if (!Number.isFinite(n) || n < 1) {
|
|
5405
|
+
warnings.push({
|
|
5406
|
+
code: "otlp_identity_invalid",
|
|
5407
|
+
message: `Ignoring invalid ${dotted} identity value.`,
|
|
5408
|
+
severity: "warning",
|
|
5409
|
+
field: `${pathPrefix}.${dotted}`
|
|
5410
|
+
});
|
|
5411
|
+
continue;
|
|
5412
|
+
}
|
|
5413
|
+
promoted = Math.trunc(n);
|
|
5414
|
+
} else if (typeof raw === "string" && raw.trim() !== "") {
|
|
5415
|
+
promoted = raw.trim();
|
|
5416
|
+
} else {
|
|
5417
|
+
warnings.push({
|
|
5418
|
+
code: "otlp_identity_invalid",
|
|
5419
|
+
message: `Ignoring non-string ${dotted} identity value.`,
|
|
5420
|
+
severity: "warning",
|
|
5421
|
+
field: `${pathPrefix}.${dotted}`
|
|
5422
|
+
});
|
|
5423
|
+
continue;
|
|
5424
|
+
}
|
|
5425
|
+
const direct = attributes[camel];
|
|
5426
|
+
const nested = metadata[camel];
|
|
5427
|
+
if (direct !== void 0 && direct !== promoted) {
|
|
5428
|
+
warnings.push({
|
|
5429
|
+
code: "otlp_identity_conflict",
|
|
5430
|
+
message: `Conflicting ${camel}: attributes.${camel} vs ${dotted}; keeping camelCase.`,
|
|
5431
|
+
severity: "warning",
|
|
5432
|
+
field: `${pathPrefix}.${dotted}`
|
|
5433
|
+
});
|
|
5434
|
+
continue;
|
|
5435
|
+
}
|
|
5436
|
+
if (nested !== void 0 && nested !== promoted && direct === void 0) {
|
|
5437
|
+
warnings.push({
|
|
5438
|
+
code: "otlp_identity_conflict",
|
|
5439
|
+
message: `Conflicting ${camel}: attributes.metadata.${camel} vs ${dotted}; keeping nested.`,
|
|
5440
|
+
severity: "warning",
|
|
5441
|
+
field: `${pathPrefix}.${dotted}`
|
|
5442
|
+
});
|
|
5443
|
+
continue;
|
|
5444
|
+
}
|
|
5445
|
+
if (direct === void 0) attributes[camel] = promoted;
|
|
5446
|
+
if (nested === void 0) metadata[camel] = promoted;
|
|
5447
|
+
}
|
|
5448
|
+
if (Object.keys(metadata).length > 0) {
|
|
5449
|
+
attributes.metadata = metadata;
|
|
5450
|
+
}
|
|
5451
|
+
return warnings;
|
|
5452
|
+
}
|
|
5387
5453
|
function mapOtlpSpan(context) {
|
|
5388
5454
|
const { span, pathPrefix } = context;
|
|
5389
5455
|
const warnings = [];
|
|
@@ -5415,6 +5481,7 @@ function mapOtlpSpan(context) {
|
|
|
5415
5481
|
if (context.scopeVersion !== void 0) {
|
|
5416
5482
|
attributes["scope.version"] = context.scopeVersion;
|
|
5417
5483
|
}
|
|
5484
|
+
warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
|
|
5418
5485
|
for (const [key, value] of Object.entries(span)) {
|
|
5419
5486
|
if (OTLP_SPAN_KEYS.has(key)) continue;
|
|
5420
5487
|
unsupportedFields.push(`${pathPrefix}.${key}`);
|
|
@@ -5452,6 +5519,7 @@ function mapOtlpSpan(context) {
|
|
|
5452
5519
|
if (events.events !== void 0) {
|
|
5453
5520
|
attributes["otlp.events"] = events.events;
|
|
5454
5521
|
}
|
|
5522
|
+
warnings.push(...promoteAgentInspectWorkflowIdentity(attributes, pathPrefix));
|
|
5455
5523
|
const traceId = readStringField(span, ["traceId"]) ?? "trace-unknown";
|
|
5456
5524
|
const spanId = readStringField(span, ["spanId"]) ?? "span-unknown";
|
|
5457
5525
|
const parentSpanId = readStringField(span, ["parentSpanId"]);
|