@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.
@@ -92,6 +92,14 @@ type SpanCorrelation = {
92
92
  * discriminator keeps them from claiming the same span id.
93
93
  */
94
94
  readonly spanIdDiscriminator?: string;
95
+ /**
96
+ * Set for a later *run* of a scope whose first run was already exported (a
97
+ * resumed session): mixed into the span id of this run's record, on the
98
+ * deferred start as well as on the end, so both edges agree and the id differs
99
+ * from the first run's. A resumed session span hangs under the first run's
100
+ * session span, so the trace stays one tree.
101
+ */
102
+ readonly runSpanIdDiscriminator?: string;
95
103
  /** Start recovered from state; authoritative over the batch's own start edge. */
96
104
  readonly startMillis?: number;
97
105
  /** End recovered from state; authoritative so a redelivered end re-exports an identical span. */
package/dist/providers.js CHANGED
@@ -1299,7 +1299,10 @@ var postToolUseFailurePayloadSchema = z12.object({
1299
1299
  hook_event_name: z12.literal("PostToolUseFailure"),
1300
1300
  tool_name: z12.string().min(1),
1301
1301
  tool_input: z12.unknown().optional(),
1302
- tool_error: z12.unknown(),
1302
+ // Optional: a failure that names no message still ends its tool call. The
1303
+ // `error` spelling Claude Code 2.1.x sends is folded onto it by
1304
+ // `normalizeClaudeHookPayload`.
1305
+ tool_error: z12.unknown().optional(),
1303
1306
  tool_use_id: z12.string().min(1)
1304
1307
  });
1305
1308
  var permissionRequestPayloadSchema = z12.object({
@@ -1668,7 +1671,13 @@ var normalizeClaudeHookPayload = (payload) => {
1668
1671
  if (record === void 0) {
1669
1672
  return payload;
1670
1673
  }
1671
- return applyUsageShape(applyPrintResultShape(applyFieldAliases(record)));
1674
+ return applyUsageShape(applyToolFailureShape(applyPrintResultShape(applyFieldAliases(record))));
1675
+ };
1676
+ var applyToolFailureShape = (record) => {
1677
+ if (record.hook_event_name !== "PostToolUseFailure" || record.tool_error !== void 0 || record.error === void 0) {
1678
+ return record;
1679
+ }
1680
+ return { ...record, tool_error: record.error };
1672
1681
  };
1673
1682
  var applyUsageShape = (record) => {
1674
1683
  const usage = coerceClaudeUsage(record.usage) ?? coerceClaudeUsage(record.token_usage) ?? coerceClaudeUsage(record.tokenUsage);