@agimon-ai/po-log 0.0.0-alpha.103 → 0.0.0-alpha.104
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.
|
@@ -332,6 +332,26 @@ function isEnabled(value) {
|
|
|
332
332
|
}
|
|
333
333
|
//#endregion
|
|
334
334
|
//#region src/services/serverTelemetry/index.ts
|
|
335
|
+
/** Export only fixed categories from structured tool details, never displayed output. */
|
|
336
|
+
function failureAttributes(result) {
|
|
337
|
+
if (!result || typeof result !== "object" || !("details" in result)) return {};
|
|
338
|
+
const details = result.details;
|
|
339
|
+
if (!details || typeof details !== "object") return {};
|
|
340
|
+
const failure = "failure" in details ? details.failure : void 0;
|
|
341
|
+
const kind = failure && typeof failure === "object" && "kind" in failure ? failure.kind : void 0;
|
|
342
|
+
return {
|
|
343
|
+
...typeof kind === "string" && [
|
|
344
|
+
"timeout",
|
|
345
|
+
"exit_code",
|
|
346
|
+
"not_found",
|
|
347
|
+
"permission",
|
|
348
|
+
"validation",
|
|
349
|
+
"aborted",
|
|
350
|
+
"unknown"
|
|
351
|
+
].includes(kind) ? { "failure.kind": kind } : {},
|
|
352
|
+
..."exit_code" in details && typeof details.exit_code === "number" && Number.isFinite(details.exit_code) ? { exit_code: details.exit_code } : {}
|
|
353
|
+
};
|
|
354
|
+
}
|
|
335
355
|
function contextAttributes(execution) {
|
|
336
356
|
return {
|
|
337
357
|
"pi.mode": "json",
|
|
@@ -473,7 +493,8 @@ function createServerTelemetry(options = {}) {
|
|
|
473
493
|
"tool.name": event.toolName,
|
|
474
494
|
"tool.call.id": event.toolCallId,
|
|
475
495
|
success: !event.isError,
|
|
476
|
-
"tool.result.error": event.isError === true
|
|
496
|
+
"tool.result.error": event.isError === true,
|
|
497
|
+
...failureAttributes(event)
|
|
477
498
|
});
|
|
478
499
|
},
|
|
479
500
|
dispose
|
|
@@ -655,6 +676,7 @@ function createServerTelemetry(options = {}) {
|
|
|
655
676
|
"tool.call.id": event.toolCallId,
|
|
656
677
|
success: event.isError !== true,
|
|
657
678
|
"tool.result.error": event.isError === true,
|
|
679
|
+
...failureAttributes(event.result),
|
|
658
680
|
...typeof duration === "number" ? { "tool.duration_ms": duration } : {}
|
|
659
681
|
});
|
|
660
682
|
if (typeof event.toolCallId === "string" && event.toolCallId.startsWith("external-")) await current.flush();
|