autotel 2.26.3 → 3.0.3

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.
Files changed (191) hide show
  1. package/README.md +50 -23
  2. package/dist/attribute-redacting-processor.cjs +8 -8
  3. package/dist/attribute-redacting-processor.d.cts +10 -1
  4. package/dist/attribute-redacting-processor.d.ts +10 -1
  5. package/dist/attribute-redacting-processor.js +1 -1
  6. package/dist/attributes.cjs +21 -21
  7. package/dist/attributes.d.cts +3 -3
  8. package/dist/attributes.d.ts +3 -3
  9. package/dist/attributes.js +2 -2
  10. package/dist/auto.cjs +3 -3
  11. package/dist/auto.js +2 -2
  12. package/dist/business-baggage.d.cts +1 -1
  13. package/dist/business-baggage.d.ts +1 -1
  14. package/dist/chunk-4P6ZOARG.cjs +33 -0
  15. package/dist/chunk-4P6ZOARG.cjs.map +1 -0
  16. package/dist/{chunk-U54FTVFH.js → chunk-52PUSFC2.js} +3 -3
  17. package/dist/{chunk-U54FTVFH.js.map → chunk-52PUSFC2.js.map} +1 -1
  18. package/dist/{chunk-YEVCD6DR.cjs → chunk-7SMNC4LS.cjs} +7 -7
  19. package/dist/{chunk-YEVCD6DR.cjs.map → chunk-7SMNC4LS.cjs.map} +1 -1
  20. package/dist/{chunk-563EL6O6.cjs → chunk-BPO2PQ3T.cjs} +12 -8
  21. package/dist/chunk-BPO2PQ3T.cjs.map +1 -0
  22. package/dist/{chunk-WZOKY3PW.cjs → chunk-DAZ7EGR4.cjs} +19 -19
  23. package/dist/{chunk-WZOKY3PW.cjs.map → chunk-DAZ7EGR4.cjs.map} +1 -1
  24. package/dist/{chunk-ER43K7ES.js → chunk-DDXIUZEG.js} +3 -3
  25. package/dist/{chunk-ER43K7ES.js.map → chunk-DDXIUZEG.js.map} +1 -1
  26. package/dist/{chunk-JKIMEPI2.cjs → chunk-DQ2SUROF.cjs} +4 -4
  27. package/dist/{chunk-JKIMEPI2.cjs.map → chunk-DQ2SUROF.cjs.map} +1 -1
  28. package/dist/{chunk-B3ZHLLMP.js → chunk-DSMSIVTG.js} +2 -2
  29. package/dist/chunk-DSMSIVTG.js.map +1 -0
  30. package/dist/{chunk-OBWXM4NN.cjs → chunk-HKZHUGGN.cjs} +15 -14
  31. package/dist/chunk-HKZHUGGN.cjs.map +1 -0
  32. package/dist/{chunk-TDNKIHKT.js → chunk-JVWJDHDB.js} +13 -4
  33. package/dist/chunk-JVWJDHDB.js.map +1 -0
  34. package/dist/{chunk-YN7USLHW.js → chunk-K7HSRLP5.js} +11 -10
  35. package/dist/chunk-K7HSRLP5.js.map +1 -0
  36. package/dist/chunk-KIL5CUN6.js +31 -0
  37. package/dist/chunk-KIL5CUN6.js.map +1 -0
  38. package/dist/chunk-KKGM42RQ.cjs +1207 -0
  39. package/dist/chunk-KKGM42RQ.cjs.map +1 -0
  40. package/dist/{chunk-6YGUN7IY.cjs → chunk-MOO75VE4.cjs} +18 -17
  41. package/dist/chunk-MOO75VE4.cjs.map +1 -0
  42. package/dist/{chunk-GML3FBOT.cjs → chunk-NCSMD3TK.cjs} +2 -2
  43. package/dist/chunk-NCSMD3TK.cjs.map +1 -0
  44. package/dist/{chunk-CMNGGTQL.cjs → chunk-NXLRY2CE.cjs} +13 -4
  45. package/dist/chunk-NXLRY2CE.cjs.map +1 -0
  46. package/dist/{chunk-BJ2XPN77.js → chunk-OM4OSBOP.js} +5 -5
  47. package/dist/{chunk-BJ2XPN77.js.map → chunk-OM4OSBOP.js.map} +1 -1
  48. package/dist/{chunk-HPUGKUMZ.js → chunk-PMRWMRXY.js} +13 -640
  49. package/dist/chunk-PMRWMRXY.js.map +1 -0
  50. package/dist/{chunk-UTZR7P7E.cjs → chunk-QPH5ZKP5.cjs} +43 -673
  51. package/dist/chunk-QPH5ZKP5.cjs.map +1 -0
  52. package/dist/chunk-SEO6NAQT.js +14 -0
  53. package/dist/chunk-SEO6NAQT.js.map +1 -0
  54. package/dist/{chunk-QC5MNKVF.js → chunk-TFRZOUTV.js} +13 -12
  55. package/dist/chunk-TFRZOUTV.js.map +1 -0
  56. package/dist/chunk-VQTCQKHQ.cjs +17 -0
  57. package/dist/chunk-VQTCQKHQ.cjs.map +1 -0
  58. package/dist/chunk-Z7VAOK5X.js +1183 -0
  59. package/dist/chunk-Z7VAOK5X.js.map +1 -0
  60. package/dist/{chunk-W35FVJBC.js → chunk-ZDPIWKWD.js} +9 -5
  61. package/dist/chunk-ZDPIWKWD.js.map +1 -0
  62. package/dist/correlation-id.cjs +22 -10
  63. package/dist/correlation-id.js +14 -2
  64. package/dist/decorators.cjs +7 -8
  65. package/dist/decorators.cjs.map +1 -1
  66. package/dist/decorators.d.cts +1 -1
  67. package/dist/decorators.d.ts +1 -1
  68. package/dist/decorators.js +6 -7
  69. package/dist/decorators.js.map +1 -1
  70. package/dist/event.cjs +8 -9
  71. package/dist/event.js +5 -6
  72. package/dist/functional.cjs +13 -14
  73. package/dist/functional.d.cts +1 -1
  74. package/dist/functional.d.ts +1 -1
  75. package/dist/functional.js +6 -7
  76. package/dist/http.cjs +13 -2
  77. package/dist/http.cjs.map +1 -1
  78. package/dist/http.js +12 -1
  79. package/dist/http.js.map +1 -1
  80. package/dist/index.cjs +305 -280
  81. package/dist/index.cjs.map +1 -1
  82. package/dist/index.d.cts +89 -10
  83. package/dist/index.d.ts +89 -10
  84. package/dist/index.js +180 -181
  85. package/dist/index.js.map +1 -1
  86. package/dist/instrumentation.cjs +9 -9
  87. package/dist/instrumentation.js +2 -2
  88. package/dist/messaging-adapters.d.cts +1 -1
  89. package/dist/messaging-adapters.d.ts +1 -1
  90. package/dist/messaging-testing.d.cts +1 -1
  91. package/dist/messaging-testing.d.ts +1 -1
  92. package/dist/messaging.cjs +11 -11
  93. package/dist/messaging.d.cts +1 -1
  94. package/dist/messaging.d.ts +1 -1
  95. package/dist/messaging.js +8 -8
  96. package/dist/semantic-helpers.cjs +11 -12
  97. package/dist/semantic-helpers.d.cts +1 -1
  98. package/dist/semantic-helpers.d.ts +1 -1
  99. package/dist/semantic-helpers.js +7 -8
  100. package/dist/{trace-context-t5X1AP-e.d.cts → trace-context-DbGKd1Rn.d.cts} +18 -5
  101. package/dist/{trace-context-t5X1AP-e.d.ts → trace-context-DbGKd1Rn.d.ts} +18 -5
  102. package/dist/trace-helpers.cjs +13 -13
  103. package/dist/trace-helpers.d.cts +2 -2
  104. package/dist/trace-helpers.d.ts +2 -2
  105. package/dist/trace-helpers.js +1 -1
  106. package/dist/{utils-CbUkl8r1.d.cts → utils-BahBCFtJ.d.cts} +1 -1
  107. package/dist/{utils-Buel3cj0.d.ts → utils-CLKwaUlG.d.ts} +1 -1
  108. package/dist/webhook.cjs +21 -12
  109. package/dist/webhook.cjs.map +1 -1
  110. package/dist/webhook.d.cts +1 -1
  111. package/dist/webhook.d.ts +1 -1
  112. package/dist/webhook.js +20 -11
  113. package/dist/webhook.js.map +1 -1
  114. package/dist/workflow-distributed.cjs +25 -21
  115. package/dist/workflow-distributed.cjs.map +1 -1
  116. package/dist/workflow-distributed.d.cts +1 -1
  117. package/dist/workflow-distributed.d.ts +1 -1
  118. package/dist/workflow-distributed.js +23 -19
  119. package/dist/workflow-distributed.js.map +1 -1
  120. package/dist/workflow.cjs +12 -12
  121. package/dist/workflow.d.cts +1 -1
  122. package/dist/workflow.d.ts +1 -1
  123. package/dist/workflow.js +8 -8
  124. package/package.json +43 -45
  125. package/skills/analyze-traces/SKILL.md +178 -0
  126. package/skills/autotel-core/SKILL.md +2 -7
  127. package/skills/autotel-events/SKILL.md +2 -6
  128. package/skills/autotel-frameworks/SKILL.md +2 -9
  129. package/skills/autotel-instrumentation/SKILL.md +2 -7
  130. package/skills/autotel-request-logging/SKILL.md +2 -8
  131. package/skills/autotel-structured-errors/SKILL.md +2 -7
  132. package/skills/build-audit-trails/SKILL.md +302 -0
  133. package/skills/debug-missing-spans/SKILL.md +248 -0
  134. package/skills/migrate-to-autotel/SKILL.md +268 -0
  135. package/skills/review-otel-patterns/SKILL.md +488 -0
  136. package/skills/review-otel-patterns/references/code-review.md +75 -0
  137. package/skills/review-otel-patterns/references/processor-pipeline.md +205 -0
  138. package/skills/review-otel-patterns/references/structured-errors.md +102 -0
  139. package/skills/review-otel-patterns/references/wide-spans.md +85 -0
  140. package/skills/tune-sampling/SKILL.md +210 -0
  141. package/src/attribute-redacting-processor.test.ts +6 -4
  142. package/src/attribute-redacting-processor.ts +11 -2
  143. package/src/correlated-events.test.ts +151 -0
  144. package/src/correlated-events.ts +47 -0
  145. package/src/drain-toolkit.test.ts +113 -0
  146. package/src/drain-toolkit.ts +129 -0
  147. package/src/enricher-toolkit.test.ts +67 -0
  148. package/src/enricher-toolkit.ts +79 -0
  149. package/src/functional.ts +2 -0
  150. package/src/gen-ai-events.ts +14 -5
  151. package/src/index.ts +39 -4
  152. package/src/messaging.ts +10 -9
  153. package/src/redact-values.test.ts +24 -10
  154. package/src/redact-values.ts +9 -2
  155. package/src/request-logger.test.ts +91 -0
  156. package/src/request-logger.ts +40 -5
  157. package/src/structured-error.test.ts +86 -1
  158. package/src/structured-error.ts +9 -2
  159. package/src/trace-context.ts +39 -11
  160. package/src/trace-helpers.ts +2 -2
  161. package/src/trace-hybrid.test.ts +42 -0
  162. package/src/trace-hybrid.ts +37 -0
  163. package/src/webhook.ts +16 -7
  164. package/src/workflow-distributed.ts +18 -13
  165. package/src/workflow.ts +7 -6
  166. package/bin/intent.js +0 -6
  167. package/dist/chunk-563EL6O6.cjs.map +0 -1
  168. package/dist/chunk-6YGUN7IY.cjs.map +0 -1
  169. package/dist/chunk-B3ZHLLMP.js.map +0 -1
  170. package/dist/chunk-BBBWDIYQ.js +0 -211
  171. package/dist/chunk-BBBWDIYQ.js.map +0 -1
  172. package/dist/chunk-CMNGGTQL.cjs.map +0 -1
  173. package/dist/chunk-D5LMF53P.cjs +0 -150
  174. package/dist/chunk-D5LMF53P.cjs.map +0 -1
  175. package/dist/chunk-GML3FBOT.cjs.map +0 -1
  176. package/dist/chunk-HPUGKUMZ.js.map +0 -1
  177. package/dist/chunk-HZ3FYBJG.cjs +0 -217
  178. package/dist/chunk-HZ3FYBJG.cjs.map +0 -1
  179. package/dist/chunk-JSNUWSBH.cjs +0 -62
  180. package/dist/chunk-JSNUWSBH.cjs.map +0 -1
  181. package/dist/chunk-OBWXM4NN.cjs.map +0 -1
  182. package/dist/chunk-QC5MNKVF.js.map +0 -1
  183. package/dist/chunk-S4OFEXLA.js +0 -53
  184. package/dist/chunk-S4OFEXLA.js.map +0 -1
  185. package/dist/chunk-TDNKIHKT.js.map +0 -1
  186. package/dist/chunk-UTZR7P7E.cjs.map +0 -1
  187. package/dist/chunk-W35FVJBC.js.map +0 -1
  188. package/dist/chunk-WD4RP6IV.js +0 -146
  189. package/dist/chunk-WD4RP6IV.js.map +0 -1
  190. package/dist/chunk-YN7USLHW.js.map +0 -1
  191. package/src/package-manifest.test.ts +0 -24
package/dist/index.cjs CHANGED
@@ -1,31 +1,31 @@
1
1
  'use strict';
2
2
 
3
3
  var chunk7EQ4G4SI_cjs = require('./chunk-7EQ4G4SI.cjs');
4
- var chunk6YGUN7IY_cjs = require('./chunk-6YGUN7IY.cjs');
5
- var chunkJKIMEPI2_cjs = require('./chunk-JKIMEPI2.cjs');
4
+ var chunkMOO75VE4_cjs = require('./chunk-MOO75VE4.cjs');
5
+ var chunkDQ2SUROF_cjs = require('./chunk-DQ2SUROF.cjs');
6
6
  var chunk2ZKEORFN_cjs = require('./chunk-2ZKEORFN.cjs');
7
7
  var chunkESMHTKLJ_cjs = require('./chunk-ESMHTKLJ.cjs');
8
8
  var chunkT4B5LB6E_cjs = require('./chunk-T4B5LB6E.cjs');
9
- var chunkOBWXM4NN_cjs = require('./chunk-OBWXM4NN.cjs');
9
+ var chunkHKZHUGGN_cjs = require('./chunk-HKZHUGGN.cjs');
10
+ var chunk4P6ZOARG_cjs = require('./chunk-4P6ZOARG.cjs');
10
11
  var chunkINJD3G4K_cjs = require('./chunk-INJD3G4K.cjs');
11
12
  var chunkTC5ZPWM4_cjs = require('./chunk-TC5ZPWM4.cjs');
12
13
  require('./chunk-YTXEZ4SD.cjs');
13
14
  var chunkWJH6IYU2_cjs = require('./chunk-WJH6IYU2.cjs');
14
- var chunkYEVCD6DR_cjs = require('./chunk-YEVCD6DR.cjs');
15
- var chunkUTZR7P7E_cjs = require('./chunk-UTZR7P7E.cjs');
16
- var chunkGML3FBOT_cjs = require('./chunk-GML3FBOT.cjs');
17
- var chunkWZOKY3PW_cjs = require('./chunk-WZOKY3PW.cjs');
15
+ var chunk7SMNC4LS_cjs = require('./chunk-7SMNC4LS.cjs');
16
+ var chunkQPH5ZKP5_cjs = require('./chunk-QPH5ZKP5.cjs');
17
+ var chunkNCSMD3TK_cjs = require('./chunk-NCSMD3TK.cjs');
18
+ var chunkDAZ7EGR4_cjs = require('./chunk-DAZ7EGR4.cjs');
18
19
  require('./chunk-NZ72VDNY.cjs');
19
20
  require('./chunk-UY3UYPBZ.cjs');
20
- var chunkD5LMF53P_cjs = require('./chunk-D5LMF53P.cjs');
21
- var chunkJSNUWSBH_cjs = require('./chunk-JSNUWSBH.cjs');
22
- var chunkHZ3FYBJG_cjs = require('./chunk-HZ3FYBJG.cjs');
23
- var chunk563EL6O6_cjs = require('./chunk-563EL6O6.cjs');
21
+ var chunkVQTCQKHQ_cjs = require('./chunk-VQTCQKHQ.cjs');
22
+ var chunkKKGM42RQ_cjs = require('./chunk-KKGM42RQ.cjs');
23
+ var chunkBPO2PQ3T_cjs = require('./chunk-BPO2PQ3T.cjs');
24
24
  require('./chunk-OC6X2VIN.cjs');
25
25
  require('./chunk-CEAQK2QY.cjs');
26
26
  var chunkZNMBW67B_cjs = require('./chunk-ZNMBW67B.cjs');
27
27
  var chunkIOYFAFHJ_cjs = require('./chunk-IOYFAFHJ.cjs');
28
- var chunkCMNGGTQL_cjs = require('./chunk-CMNGGTQL.cjs');
28
+ var chunkNXLRY2CE_cjs = require('./chunk-NXLRY2CE.cjs');
29
29
  require('./chunk-CU6IDACR.cjs');
30
30
  var chunk6S5RUKU3_cjs = require('./chunk-6S5RUKU3.cjs');
31
31
  require('./chunk-YS6C2YJE.cjs');
@@ -34,16 +34,37 @@ require('./chunk-FU6R566Y.cjs');
34
34
  require('./chunk-ESLWRGAG.cjs');
35
35
  var chunkYREV3LGG_cjs = require('./chunk-YREV3LGG.cjs');
36
36
  require('./chunk-JEQ2X3Z6.cjs');
37
- var async_hooks = require('async_hooks');
38
37
  var api = require('@opentelemetry/api');
38
+ var async_hooks = require('async_hooks');
39
39
  var sdkMetrics = require('@opentelemetry/sdk-metrics');
40
40
 
41
+ var otelMethods = {
42
+ // Class methods on TraceAPI — bind to the singleton.
43
+ setGlobalTracerProvider: api.trace.setGlobalTracerProvider.bind(api.trace),
44
+ getTracerProvider: api.trace.getTracerProvider.bind(api.trace),
45
+ getTracer: api.trace.getTracer.bind(api.trace),
46
+ disable: api.trace.disable.bind(api.trace),
47
+ // Instance fields on TraceAPI — already standalone, copy by reference.
48
+ wrapSpanContext: api.trace.wrapSpanContext,
49
+ isSpanContextValid: api.trace.isSpanContextValid,
50
+ deleteSpan: api.trace.deleteSpan,
51
+ getSpan: api.trace.getSpan,
52
+ getActiveSpan: api.trace.getActiveSpan,
53
+ getSpanContext: api.trace.getSpanContext,
54
+ setSpan: api.trace.setSpan,
55
+ setSpanContext: api.trace.setSpanContext
56
+ };
57
+ var trace2 = Object.assign(
58
+ chunkQPH5ZKP5_cjs.trace,
59
+ otelMethods
60
+ );
61
+
41
62
  // src/shutdown.ts
42
63
  async function flush(options) {
43
64
  const timeout = options?.timeout ?? 2e3;
44
65
  const forShutdown = options?.forShutdown ?? false;
45
66
  const doFlush = async () => {
46
- const eventsQueue = chunkUTZR7P7E_cjs.getEventQueue();
67
+ const eventsQueue = chunkKKGM42RQ_cjs.getEventQueue();
47
68
  if (eventsQueue) {
48
69
  if (forShutdown) {
49
70
  await eventsQueue.shutdown();
@@ -51,7 +72,7 @@ async function flush(options) {
51
72
  await eventsQueue.flush();
52
73
  }
53
74
  }
54
- const sdk = chunk563EL6O6_cjs.getSdk();
75
+ const sdk = chunkBPO2PQ3T_cjs.getSdk();
55
76
  if (sdk) {
56
77
  try {
57
78
  const sdkAny = sdk;
@@ -85,7 +106,7 @@ async function flush(options) {
85
106
  if (timeoutHandle) {
86
107
  clearTimeout(timeoutHandle);
87
108
  }
88
- const logger = chunk563EL6O6_cjs.getLogger();
109
+ const logger = chunkBPO2PQ3T_cjs.getLogger();
89
110
  logger.error(
90
111
  {
91
112
  err: error instanceof Error ? error : new Error(String(error))
@@ -96,7 +117,7 @@ async function flush(options) {
96
117
  }
97
118
  }
98
119
  async function shutdown() {
99
- const logger = chunk563EL6O6_cjs.getLogger();
120
+ const logger = chunkBPO2PQ3T_cjs.getLogger();
100
121
  let shutdownError = null;
101
122
  try {
102
123
  await flush({ forShutdown: true });
@@ -111,7 +132,7 @@ async function shutdown() {
111
132
  );
112
133
  }
113
134
  try {
114
- const sdk = chunk563EL6O6_cjs.getSdk();
135
+ const sdk = chunkBPO2PQ3T_cjs.getSdk();
115
136
  if (sdk) {
116
137
  await sdk.shutdown();
117
138
  }
@@ -125,14 +146,14 @@ async function shutdown() {
125
146
  logger.error({ err }, "[autotel] SDK shutdown failed");
126
147
  }
127
148
  } finally {
128
- await chunk563EL6O6_cjs._closeEmbeddedDevtools();
129
- const eventsQueue = chunkUTZR7P7E_cjs.getEventQueue();
149
+ await chunkBPO2PQ3T_cjs._closeEmbeddedDevtools();
150
+ const eventsQueue = chunkKKGM42RQ_cjs.getEventQueue();
130
151
  if (eventsQueue && typeof eventsQueue.cleanup === "function") {
131
152
  eventsQueue.cleanup();
132
153
  }
133
- chunkWZOKY3PW_cjs.resetEvents();
154
+ chunkDAZ7EGR4_cjs.resetEvents();
134
155
  chunkTC5ZPWM4_cjs.resetMetrics();
135
- chunkUTZR7P7E_cjs.resetEventQueue();
156
+ chunkKKGM42RQ_cjs.resetEventQueue();
136
157
  }
137
158
  if (shutdownError) {
138
159
  throw shutdownError;
@@ -147,7 +168,7 @@ function registerShutdownHooks() {
147
168
  if (shuttingDown) return;
148
169
  shuttingDown = true;
149
170
  if (process.env.NODE_ENV !== "test") {
150
- chunk563EL6O6_cjs.getLogger().info(
171
+ chunkBPO2PQ3T_cjs.getLogger().info(
151
172
  {},
152
173
  `[autotel] Received ${signal}, flushing telemetry...`
153
174
  );
@@ -155,7 +176,7 @@ function registerShutdownHooks() {
155
176
  try {
156
177
  await shutdown();
157
178
  } catch (error) {
158
- chunk563EL6O6_cjs.getLogger().error(
179
+ chunkBPO2PQ3T_cjs.getLogger().error(
159
180
  {
160
181
  err: error instanceof Error ? error : void 0
161
182
  },
@@ -168,159 +189,6 @@ function registerShutdownHooks() {
168
189
  }
169
190
  }
170
191
  registerShutdownHooks();
171
-
172
- // src/flatten-attributes.ts
173
- function toAttributeValue(value) {
174
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
175
- return value;
176
- }
177
- if (Array.isArray(value)) {
178
- if (value.every((v) => typeof v === "string") || value.every((v) => typeof v === "number") || value.every((v) => typeof v === "boolean")) {
179
- return value;
180
- }
181
- try {
182
- return JSON.stringify(value);
183
- } catch {
184
- return "<serialization-failed>";
185
- }
186
- }
187
- if (value instanceof Date) {
188
- return value.toISOString();
189
- }
190
- if (value instanceof Error) {
191
- return value.message;
192
- }
193
- return void 0;
194
- }
195
- function flattenToAttributes(fields, prefix = "") {
196
- const out = {};
197
- const seen = /* @__PURE__ */ new WeakSet();
198
- function flatten(obj, currentPrefix) {
199
- for (const [key, value] of Object.entries(obj)) {
200
- if (value == null) continue;
201
- const nextKey = currentPrefix ? `${currentPrefix}.${key}` : key;
202
- const attr = toAttributeValue(value);
203
- if (attr !== void 0) {
204
- out[nextKey] = attr;
205
- continue;
206
- }
207
- if (typeof value === "object" && value.constructor === Object) {
208
- if (seen.has(value)) {
209
- out[nextKey] = "<circular-reference>";
210
- continue;
211
- }
212
- seen.add(value);
213
- flatten(value, nextKey);
214
- continue;
215
- }
216
- try {
217
- out[nextKey] = JSON.stringify(value);
218
- } catch {
219
- out[nextKey] = "<serialization-failed>";
220
- }
221
- }
222
- }
223
- flatten(fields, prefix);
224
- return out;
225
- }
226
-
227
- // src/structured-error.ts
228
- var internalKey = /* @__PURE__ */ Symbol.for("autotel.error.internal");
229
- function createStructuredError(input) {
230
- const error = new Error(input.message, {
231
- cause: input.cause
232
- });
233
- error.name = input.name ?? "StructuredError";
234
- if (input.why !== void 0) error.why = input.why;
235
- if (input.fix !== void 0) error.fix = input.fix;
236
- if (input.link !== void 0) error.link = input.link;
237
- if (input.code !== void 0) error.code = input.code;
238
- if (input.status !== void 0) error.status = input.status;
239
- if (input.details !== void 0) error.details = input.details;
240
- if (input.internal !== void 0) {
241
- Object.defineProperty(error, internalKey, {
242
- value: input.internal,
243
- enumerable: false,
244
- writable: false,
245
- configurable: true
246
- });
247
- }
248
- Object.defineProperty(error, "internal", {
249
- get() {
250
- return this[internalKey];
251
- },
252
- enumerable: false,
253
- configurable: true
254
- });
255
- error.toString = () => {
256
- const lines = [`${error.name}: ${error.message}`];
257
- if (error.why) lines.push(` Why: ${error.why}`);
258
- if (error.fix) lines.push(` Fix: ${error.fix}`);
259
- if (error.link) lines.push(` Link: ${error.link}`);
260
- if (error.code !== void 0) lines.push(` Code: ${error.code}`);
261
- if (error.status !== void 0) lines.push(` Status: ${error.status}`);
262
- if (error.cause) {
263
- const cause = error.cause;
264
- lines.push(` Caused by: ${cause.name}: ${cause.message}`);
265
- }
266
- return lines.join("\n");
267
- };
268
- return error;
269
- }
270
- function structuredErrorToJSON(error) {
271
- const result = {
272
- name: error.name,
273
- message: error.message
274
- };
275
- if (error.status !== void 0) result.status = error.status;
276
- if (error.why || error.fix || error.link) {
277
- result.data = {
278
- ...error.why && { why: error.why },
279
- ...error.fix && { fix: error.fix },
280
- ...error.link && { link: error.link }
281
- };
282
- }
283
- if (error.code !== void 0) result.code = error.code;
284
- if (error.details) result.details = error.details;
285
- if (error.cause instanceof Error) {
286
- result.cause = { name: error.cause.name, message: error.cause.message };
287
- }
288
- return result;
289
- }
290
- function getStructuredErrorAttributes(error) {
291
- const structured = error;
292
- const attributes = {
293
- "error.type": error.name || "Error",
294
- "error.message": error.message
295
- };
296
- if (error.stack) attributes["error.stack"] = error.stack;
297
- if (structured.why) attributes["error.why"] = structured.why;
298
- if (structured.fix) attributes["error.fix"] = structured.fix;
299
- if (structured.link) attributes["error.link"] = structured.link;
300
- if (structured.code !== void 0) {
301
- attributes["error.code"] = typeof structured.code === "string" ? structured.code : String(structured.code);
302
- }
303
- if (structured.status !== void 0) {
304
- attributes["error.status"] = structured.status;
305
- }
306
- if (structured.details) {
307
- Object.assign(
308
- attributes,
309
- flattenToAttributes(structured.details, "error.details")
310
- );
311
- }
312
- return attributes;
313
- }
314
- function recordStructuredError(ctx2, error) {
315
- ctx2.recordException(error);
316
- ctx2.setStatus({
317
- code: api.SpanStatusCode.ERROR,
318
- message: error.message
319
- });
320
- ctx2.setAttributes(getStructuredErrorAttributes(error));
321
- }
322
-
323
- // src/request-logger.ts
324
192
  var POST_EMIT_FORK_HINT = "For intentional background work tied to this request, use log.fork('label', fn) when available.";
325
193
  function warnPostEmit(method, detail) {
326
194
  console.warn(
@@ -358,7 +226,7 @@ function resolveContext(ctx2) {
358
226
  "[autotel] getRequestLogger() requires an active span or runWithRequestContext(). Wrap your handler with trace() or use runWithRequestContext()."
359
227
  );
360
228
  }
361
- return chunkHZ3FYBJG_cjs.createTraceContext(span2);
229
+ return chunkKKGM42RQ_cjs.createTraceContext(span2);
362
230
  }
363
231
  function getRequestLogger(ctx2, options) {
364
232
  const activeContext = resolveContext(ctx2);
@@ -366,10 +234,10 @@ function getRequestLogger(ctx2, options) {
366
234
  let emitted = false;
367
235
  let lastSnapshot = null;
368
236
  const addLogEvent = (level, message, fields) => {
369
- const attrs2 = fields ? flattenToAttributes(fields) : void 0;
370
- activeContext.addEvent(`log.${level}`, {
237
+ const attrs2 = fields ? chunkKKGM42RQ_cjs.flattenToAttributes(fields) : void 0;
238
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(activeContext, `log.${level}`, {
371
239
  message,
372
- ...attrs2
240
+ ...attrs2 ?? {}
373
241
  });
374
242
  };
375
243
  const sealCheck = (method, keys) => {
@@ -385,7 +253,7 @@ function getRequestLogger(ctx2, options) {
385
253
  sealCheck("log.set()", Object.keys(fields));
386
254
  if (emitted) return;
387
255
  mergeInto(contextState, fields);
388
- activeContext.setAttributes(flattenToAttributes(fields));
256
+ activeContext.setAttributes(chunkKKGM42RQ_cjs.flattenToAttributes(fields));
389
257
  },
390
258
  info(message, fields) {
391
259
  const keys = fields ? ["message", ...Object.keys(fields).filter((k) => k !== "requestLogs")] : ["message"];
@@ -394,7 +262,7 @@ function getRequestLogger(ctx2, options) {
394
262
  addLogEvent("info", message, fields);
395
263
  if (fields) {
396
264
  mergeInto(contextState, fields);
397
- activeContext.setAttributes(flattenToAttributes(fields));
265
+ activeContext.setAttributes(chunkKKGM42RQ_cjs.flattenToAttributes(fields));
398
266
  }
399
267
  },
400
268
  warn(message, fields) {
@@ -405,7 +273,7 @@ function getRequestLogger(ctx2, options) {
405
273
  activeContext.setAttribute("autotel.log.level", "warn");
406
274
  if (fields) {
407
275
  mergeInto(contextState, fields);
408
- activeContext.setAttributes(flattenToAttributes(fields));
276
+ activeContext.setAttributes(chunkKKGM42RQ_cjs.flattenToAttributes(fields));
409
277
  }
410
278
  },
411
279
  error(error, fields) {
@@ -413,11 +281,11 @@ function getRequestLogger(ctx2, options) {
413
281
  sealCheck("log.error()", keys);
414
282
  if (emitted) return;
415
283
  const err = typeof error === "string" ? new Error(error) : error;
416
- recordStructuredError(activeContext, err);
284
+ chunkKKGM42RQ_cjs.recordStructuredError(activeContext, err);
417
285
  addLogEvent("error", err.message, fields);
418
286
  if (fields) {
419
287
  mergeInto(contextState, fields);
420
- activeContext.setAttributes(flattenToAttributes(fields));
288
+ activeContext.setAttributes(chunkKKGM42RQ_cjs.flattenToAttributes(fields));
421
289
  }
422
290
  activeContext.setAttribute("autotel.log.level", "error");
423
291
  },
@@ -433,7 +301,7 @@ function getRequestLogger(ctx2, options) {
433
301
  ...contextState,
434
302
  ...overrides ?? {}
435
303
  };
436
- const flattened = flattenToAttributes(mergedContext);
304
+ const flattened = chunkKKGM42RQ_cjs.flattenToAttributes(mergedContext);
437
305
  activeContext.setAttributes(flattened);
438
306
  const snapshot = {
439
307
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -442,7 +310,7 @@ function getRequestLogger(ctx2, options) {
442
310
  correlationId: activeContext.correlationId,
443
311
  context: mergedContext
444
312
  };
445
- activeContext.addEvent("log.emit.manual", {
313
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(activeContext, "log.emit.manual", {
446
314
  ...flattened
447
315
  });
448
316
  if (options?.onEmit) {
@@ -454,7 +322,7 @@ function getRequestLogger(ctx2, options) {
454
322
  lastSnapshot = snapshot;
455
323
  return snapshot;
456
324
  },
457
- fork(label, fn) {
325
+ fork(label, fn, forkOptions) {
458
326
  const parentRequestId = activeContext.correlationId;
459
327
  if (typeof parentRequestId !== "string" || parentRequestId.length === 0) {
460
328
  throw new Error(
@@ -462,9 +330,10 @@ function getRequestLogger(ctx2, options) {
462
330
  );
463
331
  }
464
332
  const tracer = api.trace.getTracer("autotel.request-logger");
333
+ const lifecycle = forkOptions?.lifecycle;
465
334
  void tracer.startActiveSpan(`request.fork:${label}`, (childSpan) => {
466
335
  const childContext = {
467
- ...chunkHZ3FYBJG_cjs.createTraceContext(childSpan),
336
+ ...chunkKKGM42RQ_cjs.createTraceContext(childSpan),
468
337
  correlationId: crypto.randomUUID()
469
338
  };
470
339
  requestContextStore.run(childContext, () => {
@@ -473,6 +342,7 @@ function getRequestLogger(ctx2, options) {
473
342
  operation: label,
474
343
  _parentCorrelationId: parentRequestId
475
344
  });
345
+ lifecycle?.onChildEnter?.(childLog);
476
346
  void Promise.resolve().then(() => fn()).then(() => {
477
347
  childLog.emitNow();
478
348
  }).catch((err) => {
@@ -480,6 +350,14 @@ function getRequestLogger(ctx2, options) {
480
350
  childLog.error(error);
481
351
  childLog.emitNow();
482
352
  }).finally(() => {
353
+ try {
354
+ lifecycle?.onChildExit?.(childLog);
355
+ } catch (hookError) {
356
+ console.warn(
357
+ "[autotel] fork onChildExit hook threw:",
358
+ hookError
359
+ );
360
+ }
483
361
  childSpan.end();
484
362
  });
485
363
  });
@@ -487,6 +365,119 @@ function getRequestLogger(ctx2, options) {
487
365
  }
488
366
  };
489
367
  }
368
+
369
+ // src/drain-toolkit.ts
370
+ var DEFAULT_TIMEOUT_MS = 5e3;
371
+ var DEFAULT_RETRIES = 2;
372
+ function delay(ms) {
373
+ return new Promise((resolve) => {
374
+ const t = setTimeout(resolve, ms);
375
+ t.unref?.();
376
+ });
377
+ }
378
+ async function postWithRetry(options) {
379
+ const { name, request: request2, timeoutMs, retries } = options;
380
+ const attempts = Math.max(1, retries);
381
+ let lastError;
382
+ for (let attempt = 1; attempt <= attempts; attempt++) {
383
+ const controller = new AbortController();
384
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
385
+ timeout.unref?.();
386
+ try {
387
+ const response = await fetch(request2.url, {
388
+ method: "POST",
389
+ headers: request2.headers,
390
+ body: request2.body,
391
+ signal: controller.signal
392
+ });
393
+ if (!response.ok) {
394
+ throw new Error(
395
+ `[autotel/${name}] HTTP ${response.status} draining ${request2.url}`
396
+ );
397
+ }
398
+ return;
399
+ } catch (error) {
400
+ lastError = error;
401
+ if (attempt < attempts) {
402
+ await delay(100 * attempt);
403
+ }
404
+ } finally {
405
+ clearTimeout(timeout);
406
+ }
407
+ }
408
+ throw lastError;
409
+ }
410
+ function defineDrain(options) {
411
+ return async (ctx2) => {
412
+ const contexts = Array.isArray(ctx2) ? ctx2 : [ctx2];
413
+ if (contexts.length === 0) return;
414
+ const config = await options.resolve();
415
+ if (!config) return;
416
+ const payloads = options.transform ? options.transform(contexts) : contexts;
417
+ if (payloads.length === 0) return;
418
+ try {
419
+ await options.send(payloads, config);
420
+ } catch (error) {
421
+ console.error(`[autotel/${options.name}] drain failed:`, error);
422
+ }
423
+ };
424
+ }
425
+ function defineHttpDrain(options) {
426
+ return defineDrain({
427
+ name: options.name,
428
+ resolve: options.resolve,
429
+ transform: options.transform,
430
+ send: async (payloads, config) => {
431
+ const request2 = options.encode(payloads, config);
432
+ if (!request2) return;
433
+ const timeoutMs = options.resolveTimeoutMs?.(config) ?? options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
434
+ const retries = options.resolveRetries?.(config) ?? options.retries ?? DEFAULT_RETRIES;
435
+ await postWithRetry({
436
+ name: options.name,
437
+ request: request2,
438
+ timeoutMs,
439
+ retries
440
+ });
441
+ }
442
+ });
443
+ }
444
+
445
+ // src/enricher-toolkit.ts
446
+ function isPlainObject(value) {
447
+ return value !== null && typeof value === "object" && !Array.isArray(value);
448
+ }
449
+ function mergeInto2(target, source) {
450
+ for (const key in source) {
451
+ const sourceVal = source[key];
452
+ if (sourceVal === void 0) continue;
453
+ const targetVal = target[key];
454
+ if (isPlainObject(sourceVal) && isPlainObject(targetVal)) {
455
+ mergeInto2(targetVal, sourceVal);
456
+ } else {
457
+ target[key] = sourceVal;
458
+ }
459
+ }
460
+ }
461
+ function defineEnricher(def, options = {}) {
462
+ return (ctx2) => {
463
+ let computed;
464
+ try {
465
+ computed = def.compute(ctx2);
466
+ } catch (error) {
467
+ console.error(`[autotel/${def.name}] enrich failed:`, error);
468
+ return;
469
+ }
470
+ if (!computed) return;
471
+ if (options.overwrite || !isPlainObject(ctx2.event[def.field])) {
472
+ ctx2.event[def.field] = computed;
473
+ return;
474
+ }
475
+ mergeInto2(
476
+ ctx2.event[def.field],
477
+ computed
478
+ );
479
+ };
480
+ }
490
481
  var GEN_AI_DURATION_BUCKETS_SECONDS = Object.freeze(
491
482
  [0.01, 0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 20, 30, 60, 120, 300]
492
483
  );
@@ -544,19 +535,27 @@ function genAiMetricViews(extra = []) {
544
535
 
545
536
  // src/gen-ai-events.ts
546
537
  function recordPromptSent(ctx2, event = {}) {
547
- ctx2.addEvent("gen_ai.prompt.sent", buildPromptSentAttrs(event));
538
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(ctx2, "gen_ai.prompt.sent", buildPromptSentAttrs(event));
548
539
  }
549
540
  function recordResponseReceived(ctx2, event = {}) {
550
- ctx2.addEvent("gen_ai.response.received", buildResponseAttrs(event));
541
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(
542
+ ctx2,
543
+ "gen_ai.response.received",
544
+ buildResponseAttrs(event)
545
+ );
551
546
  }
552
547
  function recordRetry(ctx2, event) {
553
- ctx2.addEvent("gen_ai.retry", buildRetryAttrs(event));
548
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(ctx2, "gen_ai.retry", buildRetryAttrs(event));
554
549
  }
555
550
  function recordToolCall(ctx2, event) {
556
- ctx2.addEvent("gen_ai.tool.call", buildToolCallAttrs(event));
551
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(ctx2, "gen_ai.tool.call", buildToolCallAttrs(event));
557
552
  }
558
553
  function recordStreamFirstToken(ctx2, event = {}) {
559
- ctx2.addEvent("gen_ai.stream.first_token", buildStreamFirstTokenAttrs(event));
554
+ chunk4P6ZOARG_cjs.emitCorrelatedEvent(
555
+ ctx2,
556
+ "gen_ai.stream.first_token",
557
+ buildStreamFirstTokenAttrs(event)
558
+ );
560
559
  }
561
560
  function buildPromptSentAttrs(event) {
562
561
  const attrs2 = {};
@@ -609,83 +608,83 @@ Object.defineProperty(exports, "createDrainPipeline", {
609
608
  });
610
609
  Object.defineProperty(exports, "getCurrentWorkflowContext", {
611
610
  enumerable: true,
612
- get: function () { return chunk6YGUN7IY_cjs.getCurrentWorkflowContext; }
611
+ get: function () { return chunkMOO75VE4_cjs.getCurrentWorkflowContext; }
613
612
  });
614
613
  Object.defineProperty(exports, "isInWorkflow", {
615
614
  enumerable: true,
616
- get: function () { return chunk6YGUN7IY_cjs.isInWorkflow; }
615
+ get: function () { return chunkMOO75VE4_cjs.isInWorkflow; }
617
616
  });
618
617
  Object.defineProperty(exports, "traceStep", {
619
618
  enumerable: true,
620
- get: function () { return chunk6YGUN7IY_cjs.traceStep; }
619
+ get: function () { return chunkMOO75VE4_cjs.traceStep; }
621
620
  });
622
621
  Object.defineProperty(exports, "traceWorkflow", {
623
622
  enumerable: true,
624
- get: function () { return chunk6YGUN7IY_cjs.traceWorkflow; }
623
+ get: function () { return chunkMOO75VE4_cjs.traceWorkflow; }
625
624
  });
626
625
  Object.defineProperty(exports, "attrs", {
627
626
  enumerable: true,
628
- get: function () { return chunkJKIMEPI2_cjs.attrs; }
627
+ get: function () { return chunkDQ2SUROF_cjs.attrs; }
629
628
  });
630
629
  Object.defineProperty(exports, "autoRedactPII", {
631
630
  enumerable: true,
632
- get: function () { return chunkJKIMEPI2_cjs.autoRedactPII; }
631
+ get: function () { return chunkDQ2SUROF_cjs.autoRedactPII; }
633
632
  });
634
633
  Object.defineProperty(exports, "dbClient", {
635
634
  enumerable: true,
636
- get: function () { return chunkJKIMEPI2_cjs.dbClient; }
635
+ get: function () { return chunkDQ2SUROF_cjs.dbClient; }
637
636
  });
638
637
  Object.defineProperty(exports, "httpClient", {
639
638
  enumerable: true,
640
- get: function () { return chunkJKIMEPI2_cjs.httpClient; }
639
+ get: function () { return chunkDQ2SUROF_cjs.httpClient; }
641
640
  });
642
641
  Object.defineProperty(exports, "httpServer", {
643
642
  enumerable: true,
644
- get: function () { return chunkJKIMEPI2_cjs.httpServer; }
643
+ get: function () { return chunkDQ2SUROF_cjs.httpServer; }
645
644
  });
646
645
  Object.defineProperty(exports, "identify", {
647
646
  enumerable: true,
648
- get: function () { return chunkJKIMEPI2_cjs.identify; }
647
+ get: function () { return chunkDQ2SUROF_cjs.identify; }
649
648
  });
650
649
  Object.defineProperty(exports, "mergeAttrs", {
651
650
  enumerable: true,
652
- get: function () { return chunkJKIMEPI2_cjs.mergeAttrs; }
651
+ get: function () { return chunkDQ2SUROF_cjs.mergeAttrs; }
653
652
  });
654
653
  Object.defineProperty(exports, "mergeServiceResource", {
655
654
  enumerable: true,
656
- get: function () { return chunkJKIMEPI2_cjs.mergeServiceResource; }
655
+ get: function () { return chunkDQ2SUROF_cjs.mergeServiceResource; }
657
656
  });
658
657
  Object.defineProperty(exports, "request", {
659
658
  enumerable: true,
660
- get: function () { return chunkJKIMEPI2_cjs.request; }
659
+ get: function () { return chunkDQ2SUROF_cjs.request; }
661
660
  });
662
661
  Object.defineProperty(exports, "safeSetAttributes", {
663
662
  enumerable: true,
664
- get: function () { return chunkJKIMEPI2_cjs.safeSetAttributes; }
663
+ get: function () { return chunkDQ2SUROF_cjs.safeSetAttributes; }
665
664
  });
666
665
  Object.defineProperty(exports, "setDevice", {
667
666
  enumerable: true,
668
- get: function () { return chunkJKIMEPI2_cjs.setDevice; }
667
+ get: function () { return chunkDQ2SUROF_cjs.setDevice; }
669
668
  });
670
669
  Object.defineProperty(exports, "setError", {
671
670
  enumerable: true,
672
- get: function () { return chunkJKIMEPI2_cjs.setError; }
671
+ get: function () { return chunkDQ2SUROF_cjs.setError; }
673
672
  });
674
673
  Object.defineProperty(exports, "setException", {
675
674
  enumerable: true,
676
- get: function () { return chunkJKIMEPI2_cjs.setException; }
675
+ get: function () { return chunkDQ2SUROF_cjs.setException; }
677
676
  });
678
677
  Object.defineProperty(exports, "setSession", {
679
678
  enumerable: true,
680
- get: function () { return chunkJKIMEPI2_cjs.setSession; }
679
+ get: function () { return chunkDQ2SUROF_cjs.setSession; }
681
680
  });
682
681
  Object.defineProperty(exports, "setUser", {
683
682
  enumerable: true,
684
- get: function () { return chunkJKIMEPI2_cjs.setUser; }
683
+ get: function () { return chunkDQ2SUROF_cjs.setUser; }
685
684
  });
686
685
  Object.defineProperty(exports, "validateAttribute", {
687
686
  enumerable: true,
688
- get: function () { return chunkJKIMEPI2_cjs.validateAttribute; }
687
+ get: function () { return chunkDQ2SUROF_cjs.validateAttribute; }
689
688
  });
690
689
  Object.defineProperty(exports, "httpRequestHeaderAttribute", {
691
690
  enumerable: true,
@@ -713,11 +712,11 @@ Object.defineProperty(exports, "parseError", {
713
712
  });
714
713
  Object.defineProperty(exports, "traceConsumer", {
715
714
  enumerable: true,
716
- get: function () { return chunkOBWXM4NN_cjs.traceConsumer; }
715
+ get: function () { return chunkHKZHUGGN_cjs.traceConsumer; }
717
716
  });
718
717
  Object.defineProperty(exports, "traceProducer", {
719
718
  enumerable: true,
720
- get: function () { return chunkOBWXM4NN_cjs.traceProducer; }
719
+ get: function () { return chunkHKZHUGGN_cjs.traceProducer; }
721
720
  });
722
721
  Object.defineProperty(exports, "BusinessBaggage", {
723
722
  enumerable: true,
@@ -761,171 +760,191 @@ Object.defineProperty(exports, "getMeter", {
761
760
  });
762
761
  Object.defineProperty(exports, "traceDB", {
763
762
  enumerable: true,
764
- get: function () { return chunkYEVCD6DR_cjs.traceDB; }
763
+ get: function () { return chunk7SMNC4LS_cjs.traceDB; }
765
764
  });
766
765
  Object.defineProperty(exports, "traceHTTP", {
767
766
  enumerable: true,
768
- get: function () { return chunkYEVCD6DR_cjs.traceHTTP; }
767
+ get: function () { return chunk7SMNC4LS_cjs.traceHTTP; }
769
768
  });
770
769
  Object.defineProperty(exports, "traceLLM", {
771
770
  enumerable: true,
772
- get: function () { return chunkYEVCD6DR_cjs.traceLLM; }
771
+ get: function () { return chunk7SMNC4LS_cjs.traceLLM; }
773
772
  });
774
773
  Object.defineProperty(exports, "traceMessaging", {
775
774
  enumerable: true,
776
- get: function () { return chunkYEVCD6DR_cjs.traceMessaging; }
775
+ get: function () { return chunk7SMNC4LS_cjs.traceMessaging; }
777
776
  });
778
777
  Object.defineProperty(exports, "ctx", {
779
778
  enumerable: true,
780
- get: function () { return chunkUTZR7P7E_cjs.ctx; }
781
- });
782
- Object.defineProperty(exports, "getEventQueue", {
783
- enumerable: true,
784
- get: function () { return chunkUTZR7P7E_cjs.getEventQueue; }
779
+ get: function () { return chunkQPH5ZKP5_cjs.ctx; }
785
780
  });
786
781
  Object.defineProperty(exports, "instrument", {
787
782
  enumerable: true,
788
- get: function () { return chunkUTZR7P7E_cjs.instrument; }
783
+ get: function () { return chunkQPH5ZKP5_cjs.instrument; }
789
784
  });
790
785
  Object.defineProperty(exports, "span", {
791
786
  enumerable: true,
792
- get: function () { return chunkUTZR7P7E_cjs.span; }
793
- });
794
- Object.defineProperty(exports, "trace", {
795
- enumerable: true,
796
- get: function () { return chunkUTZR7P7E_cjs.trace; }
797
- });
798
- Object.defineProperty(exports, "track", {
799
- enumerable: true,
800
- get: function () { return chunkUTZR7P7E_cjs.track; }
787
+ get: function () { return chunkQPH5ZKP5_cjs.span; }
801
788
  });
802
789
  Object.defineProperty(exports, "withBaggage", {
803
790
  enumerable: true,
804
- get: function () { return chunkUTZR7P7E_cjs.withBaggage; }
791
+ get: function () { return chunkQPH5ZKP5_cjs.withBaggage; }
805
792
  });
806
793
  Object.defineProperty(exports, "withNewContext", {
807
794
  enumerable: true,
808
- get: function () { return chunkUTZR7P7E_cjs.withNewContext; }
795
+ get: function () { return chunkQPH5ZKP5_cjs.withNewContext; }
809
796
  });
810
797
  Object.defineProperty(exports, "withTracing", {
811
798
  enumerable: true,
812
- get: function () { return chunkUTZR7P7E_cjs.withTracing; }
799
+ get: function () { return chunkQPH5ZKP5_cjs.withTracing; }
813
800
  });
814
801
  Object.defineProperty(exports, "createDeterministicTraceId", {
815
802
  enumerable: true,
816
- get: function () { return chunkGML3FBOT_cjs.createDeterministicTraceId; }
803
+ get: function () { return chunkNCSMD3TK_cjs.createDeterministicTraceId; }
817
804
  });
818
805
  Object.defineProperty(exports, "enrichWithTraceContext", {
819
806
  enumerable: true,
820
- get: function () { return chunkGML3FBOT_cjs.enrichWithTraceContext; }
807
+ get: function () { return chunkNCSMD3TK_cjs.enrichWithTraceContext; }
821
808
  });
822
809
  Object.defineProperty(exports, "finalizeSpan", {
823
810
  enumerable: true,
824
- get: function () { return chunkGML3FBOT_cjs.finalizeSpan; }
811
+ get: function () { return chunkNCSMD3TK_cjs.finalizeSpan; }
825
812
  });
826
813
  Object.defineProperty(exports, "flattenMetadata", {
827
814
  enumerable: true,
828
- get: function () { return chunkGML3FBOT_cjs.flattenMetadata; }
815
+ get: function () { return chunkNCSMD3TK_cjs.flattenMetadata; }
829
816
  });
830
817
  Object.defineProperty(exports, "getActiveContext", {
831
818
  enumerable: true,
832
- get: function () { return chunkGML3FBOT_cjs.getActiveContext; }
819
+ get: function () { return chunkNCSMD3TK_cjs.getActiveContext; }
833
820
  });
834
821
  Object.defineProperty(exports, "getActiveSpan", {
835
822
  enumerable: true,
836
- get: function () { return chunkGML3FBOT_cjs.getActiveSpan; }
823
+ get: function () { return chunkNCSMD3TK_cjs.getActiveSpan; }
837
824
  });
838
825
  Object.defineProperty(exports, "getTraceContext", {
839
826
  enumerable: true,
840
- get: function () { return chunkGML3FBOT_cjs.getTraceContext; }
827
+ get: function () { return chunkNCSMD3TK_cjs.getTraceContext; }
841
828
  });
842
829
  Object.defineProperty(exports, "getTracer", {
843
830
  enumerable: true,
844
- get: function () { return chunkGML3FBOT_cjs.getTracer; }
831
+ get: function () { return chunkNCSMD3TK_cjs.getTracer; }
845
832
  });
846
833
  Object.defineProperty(exports, "isTracing", {
847
834
  enumerable: true,
848
- get: function () { return chunkGML3FBOT_cjs.isTracing; }
835
+ get: function () { return chunkNCSMD3TK_cjs.isTracing; }
849
836
  });
850
837
  Object.defineProperty(exports, "resolveTraceUrl", {
851
838
  enumerable: true,
852
- get: function () { return chunkGML3FBOT_cjs.resolveTraceUrl; }
839
+ get: function () { return chunkNCSMD3TK_cjs.resolveTraceUrl; }
853
840
  });
854
841
  Object.defineProperty(exports, "runWithSpan", {
855
842
  enumerable: true,
856
- get: function () { return chunkGML3FBOT_cjs.runWithSpan; }
843
+ get: function () { return chunkNCSMD3TK_cjs.runWithSpan; }
857
844
  });
858
845
  Object.defineProperty(exports, "Event", {
859
846
  enumerable: true,
860
- get: function () { return chunkWZOKY3PW_cjs.Event; }
847
+ get: function () { return chunkDAZ7EGR4_cjs.Event; }
861
848
  });
862
849
  Object.defineProperty(exports, "getEvents", {
863
850
  enumerable: true,
864
- get: function () { return chunkWZOKY3PW_cjs.getEvents; }
851
+ get: function () { return chunkDAZ7EGR4_cjs.getEvents; }
865
852
  });
866
853
  Object.defineProperty(exports, "resetEvents", {
867
854
  enumerable: true,
868
- get: function () { return chunkWZOKY3PW_cjs.resetEvents; }
855
+ get: function () { return chunkDAZ7EGR4_cjs.resetEvents; }
869
856
  });
870
857
  Object.defineProperty(exports, "getOperationContext", {
871
858
  enumerable: true,
872
- get: function () { return chunkD5LMF53P_cjs.getOperationContext; }
859
+ get: function () { return chunkVQTCQKHQ_cjs.getOperationContext; }
873
860
  });
874
861
  Object.defineProperty(exports, "runInOperationContext", {
875
862
  enumerable: true,
876
- get: function () { return chunkD5LMF53P_cjs.runInOperationContext; }
863
+ get: function () { return chunkVQTCQKHQ_cjs.runInOperationContext; }
877
864
  });
878
865
  Object.defineProperty(exports, "CORRELATION_ID_BAGGAGE_KEY", {
879
866
  enumerable: true,
880
- get: function () { return chunkJSNUWSBH_cjs.CORRELATION_ID_BAGGAGE_KEY; }
867
+ get: function () { return chunkKKGM42RQ_cjs.CORRELATION_ID_BAGGAGE_KEY; }
868
+ });
869
+ Object.defineProperty(exports, "createStructuredError", {
870
+ enumerable: true,
871
+ get: function () { return chunkKKGM42RQ_cjs.createStructuredError; }
872
+ });
873
+ Object.defineProperty(exports, "defineBaggageSchema", {
874
+ enumerable: true,
875
+ get: function () { return chunkKKGM42RQ_cjs.defineBaggageSchema; }
876
+ });
877
+ Object.defineProperty(exports, "flattenToAttributes", {
878
+ enumerable: true,
879
+ get: function () { return chunkKKGM42RQ_cjs.flattenToAttributes; }
881
880
  });
882
881
  Object.defineProperty(exports, "generateCorrelationId", {
883
882
  enumerable: true,
884
- get: function () { return chunkJSNUWSBH_cjs.generateCorrelationId; }
883
+ get: function () { return chunkKKGM42RQ_cjs.generateCorrelationId; }
885
884
  });
886
885
  Object.defineProperty(exports, "getCorrelationId", {
887
886
  enumerable: true,
888
- get: function () { return chunkJSNUWSBH_cjs.getCorrelationId; }
887
+ get: function () { return chunkKKGM42RQ_cjs.getCorrelationId; }
888
+ });
889
+ Object.defineProperty(exports, "getEventQueue", {
890
+ enumerable: true,
891
+ get: function () { return chunkKKGM42RQ_cjs.getEventQueue; }
889
892
  });
890
893
  Object.defineProperty(exports, "getOrCreateCorrelationId", {
891
894
  enumerable: true,
892
- get: function () { return chunkJSNUWSBH_cjs.getOrCreateCorrelationId; }
895
+ get: function () { return chunkKKGM42RQ_cjs.getOrCreateCorrelationId; }
896
+ });
897
+ Object.defineProperty(exports, "getStructuredErrorAttributes", {
898
+ enumerable: true,
899
+ get: function () { return chunkKKGM42RQ_cjs.getStructuredErrorAttributes; }
900
+ });
901
+ Object.defineProperty(exports, "recordStructuredError", {
902
+ enumerable: true,
903
+ get: function () { return chunkKKGM42RQ_cjs.recordStructuredError; }
893
904
  });
894
905
  Object.defineProperty(exports, "runWithCorrelationId", {
895
906
  enumerable: true,
896
- get: function () { return chunkJSNUWSBH_cjs.runWithCorrelationId; }
907
+ get: function () { return chunkKKGM42RQ_cjs.runWithCorrelationId; }
897
908
  });
898
909
  Object.defineProperty(exports, "setCorrelationId", {
899
910
  enumerable: true,
900
- get: function () { return chunkJSNUWSBH_cjs.setCorrelationId; }
911
+ get: function () { return chunkKKGM42RQ_cjs.setCorrelationId; }
901
912
  });
902
913
  Object.defineProperty(exports, "setCorrelationIdInBaggage", {
903
914
  enumerable: true,
904
- get: function () { return chunkJSNUWSBH_cjs.setCorrelationIdInBaggage; }
915
+ get: function () { return chunkKKGM42RQ_cjs.setCorrelationIdInBaggage; }
905
916
  });
906
- Object.defineProperty(exports, "defineBaggageSchema", {
917
+ Object.defineProperty(exports, "structuredErrorToJSON", {
918
+ enumerable: true,
919
+ get: function () { return chunkKKGM42RQ_cjs.structuredErrorToJSON; }
920
+ });
921
+ Object.defineProperty(exports, "toAttributeValue", {
907
922
  enumerable: true,
908
- get: function () { return chunkHZ3FYBJG_cjs.defineBaggageSchema; }
923
+ get: function () { return chunkKKGM42RQ_cjs.toAttributeValue; }
924
+ });
925
+ Object.defineProperty(exports, "track", {
926
+ enumerable: true,
927
+ get: function () { return chunkKKGM42RQ_cjs.track; }
909
928
  });
910
929
  Object.defineProperty(exports, "BaggageSpanProcessor", {
911
930
  enumerable: true,
912
- get: function () { return chunk563EL6O6_cjs.BaggageSpanProcessor; }
931
+ get: function () { return chunkBPO2PQ3T_cjs.BaggageSpanProcessor; }
913
932
  });
914
933
  Object.defineProperty(exports, "createStringRedactor", {
915
934
  enumerable: true,
916
- get: function () { return chunk563EL6O6_cjs.createStringRedactor; }
935
+ get: function () { return chunkBPO2PQ3T_cjs.createStringRedactor; }
917
936
  });
918
937
  Object.defineProperty(exports, "init", {
919
938
  enumerable: true,
920
- get: function () { return chunk563EL6O6_cjs.init; }
939
+ get: function () { return chunkBPO2PQ3T_cjs.init; }
921
940
  });
922
941
  Object.defineProperty(exports, "isLoggerLocked", {
923
942
  enumerable: true,
924
- get: function () { return chunk563EL6O6_cjs.isLoggerLocked; }
943
+ get: function () { return chunkBPO2PQ3T_cjs.isLoggerLocked; }
925
944
  });
926
945
  Object.defineProperty(exports, "lockLogger", {
927
946
  enumerable: true,
928
- get: function () { return chunk563EL6O6_cjs.lockLogger; }
947
+ get: function () { return chunkBPO2PQ3T_cjs.lockLogger; }
929
948
  });
930
949
  Object.defineProperty(exports, "FilteringSpanProcessor", {
931
950
  enumerable: true,
@@ -945,23 +964,31 @@ Object.defineProperty(exports, "SpanNameNormalizingProcessor", {
945
964
  });
946
965
  Object.defineProperty(exports, "AttributeRedactingProcessor", {
947
966
  enumerable: true,
948
- get: function () { return chunkCMNGGTQL_cjs.AttributeRedactingProcessor; }
967
+ get: function () { return chunkNXLRY2CE_cjs.AttributeRedactingProcessor; }
949
968
  });
950
969
  Object.defineProperty(exports, "REDACTOR_PATTERNS", {
951
970
  enumerable: true,
952
- get: function () { return chunkCMNGGTQL_cjs.REDACTOR_PATTERNS; }
971
+ get: function () { return chunkNXLRY2CE_cjs.REDACTOR_PATTERNS; }
953
972
  });
954
973
  Object.defineProperty(exports, "REDACTOR_PRESETS", {
955
974
  enumerable: true,
956
- get: function () { return chunkCMNGGTQL_cjs.REDACTOR_PRESETS; }
975
+ get: function () { return chunkNXLRY2CE_cjs.REDACTOR_PRESETS; }
976
+ });
977
+ Object.defineProperty(exports, "builtinPatterns", {
978
+ enumerable: true,
979
+ get: function () { return chunkNXLRY2CE_cjs.builtinPatterns; }
957
980
  });
958
981
  Object.defineProperty(exports, "createAttributeRedactor", {
959
982
  enumerable: true,
960
- get: function () { return chunkCMNGGTQL_cjs.createAttributeRedactor; }
983
+ get: function () { return chunkNXLRY2CE_cjs.createAttributeRedactor; }
961
984
  });
962
985
  Object.defineProperty(exports, "createRedactedSpan", {
963
986
  enumerable: true,
964
- get: function () { return chunkCMNGGTQL_cjs.createRedactedSpan; }
987
+ get: function () { return chunkNXLRY2CE_cjs.createRedactedSpan; }
988
+ });
989
+ Object.defineProperty(exports, "normalizeAttributeRedactorConfig", {
990
+ enumerable: true,
991
+ get: function () { return chunkNXLRY2CE_cjs.normalizeAttributeRedactorConfig; }
965
992
  });
966
993
  Object.defineProperty(exports, "formatDuration", {
967
994
  enumerable: true,
@@ -1050,22 +1077,20 @@ Object.defineProperty(exports, "propagation", {
1050
1077
  exports.GEN_AI_COST_USD_BUCKETS = GEN_AI_COST_USD_BUCKETS;
1051
1078
  exports.GEN_AI_DURATION_BUCKETS_SECONDS = GEN_AI_DURATION_BUCKETS_SECONDS;
1052
1079
  exports.GEN_AI_TOKEN_USAGE_BUCKETS = GEN_AI_TOKEN_USAGE_BUCKETS;
1053
- exports.createStructuredError = createStructuredError;
1054
- exports.flattenToAttributes = flattenToAttributes;
1080
+ exports.defineDrain = defineDrain;
1081
+ exports.defineEnricher = defineEnricher;
1082
+ exports.defineHttpDrain = defineHttpDrain;
1055
1083
  exports.flush = flush;
1056
1084
  exports.genAiMetricViews = genAiMetricViews;
1057
1085
  exports.getRequestLogger = getRequestLogger;
1058
- exports.getStructuredErrorAttributes = getStructuredErrorAttributes;
1059
1086
  exports.llmHistogramAdvice = llmHistogramAdvice;
1060
1087
  exports.recordPromptSent = recordPromptSent;
1061
1088
  exports.recordResponseReceived = recordResponseReceived;
1062
1089
  exports.recordRetry = recordRetry;
1063
1090
  exports.recordStreamFirstToken = recordStreamFirstToken;
1064
- exports.recordStructuredError = recordStructuredError;
1065
1091
  exports.recordToolCall = recordToolCall;
1066
1092
  exports.runWithRequestContext = runWithRequestContext;
1067
1093
  exports.shutdown = shutdown;
1068
- exports.structuredErrorToJSON = structuredErrorToJSON;
1069
- exports.toAttributeValue = toAttributeValue;
1094
+ exports.trace = trace2;
1070
1095
  //# sourceMappingURL=index.cjs.map
1071
1096
  //# sourceMappingURL=index.cjs.map