agent-inspect 6.31.17 → 6.31.18
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/COMPARE.md +1 -1
- package/package.json +2 -2
- package/packages/cli/dist/{chunk-USZJEEME.mjs → chunk-AHARYDFO.mjs} +58 -24
- package/packages/cli/dist/chunk-AHARYDFO.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +112 -25
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +58 -6
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-EY4EY456.mjs → src-YNZZ2KYR.mjs} +3 -3
- package/packages/cli/dist/{src-EY4EY456.mjs.map → src-YNZZ2KYR.mjs.map} +1 -1
- package/packages/core/dist/advanced.mjs +2 -2
- package/packages/core/dist/checks.cjs +56 -22
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-GTA6SNDK.mjs → chunk-FRBBZUEP.mjs} +58 -24
- package/packages/core/dist/chunk-FRBBZUEP.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +54 -2
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +54 -2
- package/packages/core/dist/exporters.mjs.map +1 -1
- package/packages/cli/dist/chunk-USZJEEME.mjs.map +0 -1
- package/packages/core/dist/chunk-GTA6SNDK.mjs.map +0 -1
|
@@ -1259,6 +1259,51 @@ function genAiOperationName(kind) {
|
|
|
1259
1259
|
return void 0;
|
|
1260
1260
|
}
|
|
1261
1261
|
}
|
|
1262
|
+
var STRUCTURAL_IDENTITY_KEYS = [
|
|
1263
|
+
"operationId",
|
|
1264
|
+
"attemptId",
|
|
1265
|
+
"retryOf",
|
|
1266
|
+
"attemptNumber",
|
|
1267
|
+
"attempt"
|
|
1268
|
+
];
|
|
1269
|
+
function pickBoundedIdentityString(bag, key, maxLen) {
|
|
1270
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
1271
|
+
const direct = bag[key];
|
|
1272
|
+
if (typeof direct === "string" && direct.trim() !== "") {
|
|
1273
|
+
return direct.trim().slice(0, maxLen);
|
|
1274
|
+
}
|
|
1275
|
+
const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
|
|
1276
|
+
if (typeof nested === "string" && nested.trim() !== "") {
|
|
1277
|
+
return nested.trim().slice(0, maxLen);
|
|
1278
|
+
}
|
|
1279
|
+
return void 0;
|
|
1280
|
+
}
|
|
1281
|
+
function pickBoundedIdentityNumber(bag, key) {
|
|
1282
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
1283
|
+
const direct = bag[key];
|
|
1284
|
+
if (typeof direct === "number" && Number.isFinite(direct)) return direct;
|
|
1285
|
+
const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
|
|
1286
|
+
if (typeof nested === "number" && Number.isFinite(nested)) return nested;
|
|
1287
|
+
return void 0;
|
|
1288
|
+
}
|
|
1289
|
+
function appendStructuralIdentityAttrs(attrs, meta, maxLen) {
|
|
1290
|
+
const operationId = pickBoundedIdentityString(meta, "operationId", maxLen);
|
|
1291
|
+
if (operationId !== void 0) {
|
|
1292
|
+
attrs.push(stringAttr("agent_inspect.operation_id", operationId));
|
|
1293
|
+
}
|
|
1294
|
+
const attemptId = pickBoundedIdentityString(meta, "attemptId", maxLen);
|
|
1295
|
+
if (attemptId !== void 0) {
|
|
1296
|
+
attrs.push(stringAttr("agent_inspect.attempt_id", attemptId));
|
|
1297
|
+
}
|
|
1298
|
+
const retryOf = pickBoundedIdentityString(meta, "retryOf", maxLen);
|
|
1299
|
+
if (retryOf !== void 0) {
|
|
1300
|
+
attrs.push(stringAttr("agent_inspect.retry_of", retryOf));
|
|
1301
|
+
}
|
|
1302
|
+
const attemptNumber = pickBoundedIdentityNumber(meta, "attemptNumber") ?? pickBoundedIdentityNumber(meta, "attempt");
|
|
1303
|
+
if (attemptNumber !== void 0) {
|
|
1304
|
+
attrs.push(intAttr("agent_inspect.attempt_number", attemptNumber));
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1262
1307
|
function resolveSpanTimes(ev) {
|
|
1263
1308
|
const startedAtMs = typeof ev.attributes?.startedAtMs === "number" && Number.isFinite(ev.attributes.startedAtMs) ? ev.attributes.startedAtMs : void 0;
|
|
1264
1309
|
const endedAtMs = typeof ev.attributes?.endedAtMs === "number" && Number.isFinite(ev.attributes.endedAtMs) ? ev.attributes.endedAtMs : void 0;
|
|
@@ -1279,7 +1324,8 @@ function exportOtlpJson(tree, options) {
|
|
|
1279
1324
|
const warnings = [
|
|
1280
1325
|
"OTLP JSON export uses OTel GenAI-aligned attributes where applicable; experimental until verified against specific collectors.",
|
|
1281
1326
|
"Not OTLP gRPC/protobuf \u2014 JSON mapping only. Generated locally; no network upload.",
|
|
1282
|
-
"Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1)."
|
|
1327
|
+
"Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1).",
|
|
1328
|
+
"When present on source events, operationId/attemptId/retryOf/attemptNumber are emitted as bounded agent_inspect.* identity attributes (not a broad attribute dump)."
|
|
1283
1329
|
];
|
|
1284
1330
|
const traceId = hexFrom2(`trace:${tree.runId}`, 16);
|
|
1285
1331
|
const includeAttributes = options?.includeAttributes ?? false;
|
|
@@ -1327,6 +1373,11 @@ function exportOtlpJson(tree, options) {
|
|
|
1327
1373
|
if (typeof inp === "number") attrs.push(intAttr("gen_ai.usage.input_tokens", inp));
|
|
1328
1374
|
if (typeof outp === "number") attrs.push(intAttr("gen_ai.usage.output_tokens", outp));
|
|
1329
1375
|
}
|
|
1376
|
+
appendStructuralIdentityAttrs(
|
|
1377
|
+
attrs,
|
|
1378
|
+
meta && typeof meta === "object" ? meta : void 0,
|
|
1379
|
+
maxLen
|
|
1380
|
+
);
|
|
1330
1381
|
if (includeAttributes && meta && typeof meta === "object") {
|
|
1331
1382
|
const skipKeys = /* @__PURE__ */ new Set([
|
|
1332
1383
|
"tokens",
|
|
@@ -1335,7 +1386,8 @@ function exportOtlpJson(tree, options) {
|
|
|
1335
1386
|
"responseModel",
|
|
1336
1387
|
"responseModelId",
|
|
1337
1388
|
"provider",
|
|
1338
|
-
"originalSourceType"
|
|
1389
|
+
"originalSourceType",
|
|
1390
|
+
...STRUCTURAL_IDENTITY_KEYS
|
|
1339
1391
|
]);
|
|
1340
1392
|
for (const [k, v] of Object.entries(meta)) {
|
|
1341
1393
|
if (skipKeys.has(k)) continue;
|