@osfactory/otel-hook 0.13.0 → 0.13.1

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/testing.js CHANGED
@@ -2232,7 +2232,10 @@ var postToolUseFailurePayloadSchema = z16.object({
2232
2232
  hook_event_name: z16.literal("PostToolUseFailure"),
2233
2233
  tool_name: z16.string().min(1),
2234
2234
  tool_input: z16.unknown().optional(),
2235
- tool_error: z16.unknown(),
2235
+ // Optional: a failure that names no message still ends its tool call. The
2236
+ // `error` spelling Claude Code 2.1.x sends is folded onto it by
2237
+ // `normalizeClaudeHookPayload`.
2238
+ tool_error: z16.unknown().optional(),
2236
2239
  tool_use_id: z16.string().min(1)
2237
2240
  });
2238
2241
  var permissionRequestPayloadSchema = z16.object({
@@ -2601,7 +2604,13 @@ var normalizeClaudeHookPayload = (payload) => {
2601
2604
  if (record === void 0) {
2602
2605
  return payload;
2603
2606
  }
2604
- return applyUsageShape(applyPrintResultShape(applyFieldAliases(record)));
2607
+ return applyUsageShape(applyToolFailureShape(applyPrintResultShape(applyFieldAliases(record))));
2608
+ };
2609
+ var applyToolFailureShape = (record) => {
2610
+ if (record.hook_event_name !== "PostToolUseFailure" || record.tool_error !== void 0 || record.error === void 0) {
2611
+ return record;
2612
+ }
2613
+ return { ...record, tool_error: record.error };
2605
2614
  };
2606
2615
  var applyUsageShape = (record) => {
2607
2616
  const usage = coerceClaudeUsage(record.usage) ?? coerceClaudeUsage(record.token_usage) ?? coerceClaudeUsage(record.tokenUsage);