@agimon-ai/po-log 0.0.0-alpha.131 → 0.0.0-alpha.133

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.
@@ -387,6 +387,8 @@ function isEnabled(value) {
387
387
  }
388
388
  //#endregion
389
389
  //#region src/services/serverTelemetry/index.ts
390
+ /** A reason is a fixed token such as an error class or code, never free text that could carry output. */
391
+ const FAILURE_REASON_PATTERN = /^[A-Za-z][A-Za-z0-9_]{0,63}$/u;
390
392
  /** Export only fixed categories from structured tool details, never displayed output. */
391
393
  function failureAttributes(result) {
392
394
  if (!result || typeof result !== "object" || !("details" in result)) return {};
@@ -394,6 +396,7 @@ function failureAttributes(result) {
394
396
  if (!details || typeof details !== "object") return {};
395
397
  const failure = "failure" in details ? details.failure : void 0;
396
398
  const kind = failure && typeof failure === "object" && "kind" in failure ? failure.kind : void 0;
399
+ const reason = failure && typeof failure === "object" && "reason" in failure ? failure.reason : void 0;
397
400
  return {
398
401
  ...typeof kind === "string" && [
399
402
  "timeout",
@@ -404,6 +407,7 @@ function failureAttributes(result) {
404
407
  "aborted",
405
408
  "unknown"
406
409
  ].includes(kind) ? { "failure.kind": kind } : {},
410
+ ...typeof reason === "string" && FAILURE_REASON_PATTERN.test(reason) ? { "failure.reason": reason } : {},
407
411
  ..."exit_code" in details && typeof details.exit_code === "number" && Number.isFinite(details.exit_code) ? { exit_code: details.exit_code } : {}
408
412
  };
409
413
  }