@morsehq-dev/sdk 0.4.1-rc.1 → 0.5.0-rc.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.
Files changed (149) hide show
  1. package/dist/anthropic/index.cjs +12 -10
  2. package/dist/anthropic/index.js +5 -3
  3. package/dist/anthropic-agent-sdk/index.cjs +52 -34
  4. package/dist/anthropic-agent-sdk/index.cjs.map +1 -1
  5. package/dist/anthropic-agent-sdk/index.js +25 -7
  6. package/dist/anthropic-agent-sdk/index.js.map +1 -1
  7. package/dist/browser/anthropic/index.cjs +12 -10
  8. package/dist/browser/anthropic/index.js +5 -3
  9. package/dist/browser/anthropic-agent-sdk/index.cjs +52 -34
  10. package/dist/browser/anthropic-agent-sdk/index.cjs.map +1 -1
  11. package/dist/browser/anthropic-agent-sdk/index.js +25 -7
  12. package/dist/browser/anthropic-agent-sdk/index.js.map +1 -1
  13. package/dist/browser/chunk-32U547L3.js +118 -0
  14. package/dist/browser/chunk-32U547L3.js.map +1 -0
  15. package/dist/{chunk-SBGY5NS4.js → browser/chunk-454FDWBM.js} +6 -4
  16. package/dist/browser/chunk-454FDWBM.js.map +1 -0
  17. package/dist/browser/{chunk-EFUQVASI.cjs → chunk-5EFKNOO7.cjs} +17 -15
  18. package/dist/browser/chunk-5EFKNOO7.cjs.map +1 -0
  19. package/dist/browser/{chunk-DOLWR7LD.js → chunk-5IWGFPKQ.js} +4 -4
  20. package/dist/browser/{chunk-DOLWR7LD.js.map → chunk-5IWGFPKQ.js.map} +1 -1
  21. package/dist/browser/{chunk-F3B4UR64.js → chunk-6DOP3MTY.js} +386 -53
  22. package/dist/browser/chunk-6DOP3MTY.js.map +1 -0
  23. package/dist/browser/{chunk-GWJYOQNC.js → chunk-A7P3ZBZX.js} +10 -4
  24. package/dist/browser/chunk-A7P3ZBZX.js.map +1 -0
  25. package/dist/browser/{chunk-M2GZJ3RS.cjs → chunk-AV35EOER.cjs} +20 -14
  26. package/dist/browser/chunk-AV35EOER.cjs.map +1 -0
  27. package/dist/browser/{chunk-AYNX24P5.js → chunk-AZ3SVK3K.js} +3 -3
  28. package/dist/browser/{chunk-AYNX24P5.js.map → chunk-AZ3SVK3K.js.map} +1 -1
  29. package/dist/browser/chunk-FNZWJU64.cjs +31 -0
  30. package/dist/browser/chunk-FNZWJU64.cjs.map +1 -0
  31. package/dist/browser/chunk-HZZK2EMO.cjs +126 -0
  32. package/dist/browser/chunk-HZZK2EMO.cjs.map +1 -0
  33. package/dist/browser/{chunk-QWRQJO57.js → chunk-MLDVXMQD.js} +3 -3
  34. package/dist/browser/{chunk-QWRQJO57.js.map → chunk-MLDVXMQD.js.map} +1 -1
  35. package/dist/{chunk-Y7SVGUKY.cjs → browser/chunk-NT37C2TK.cjs} +7 -7
  36. package/dist/browser/{chunk-YNUZGKUA.cjs.map → chunk-NT37C2TK.cjs.map} +1 -1
  37. package/dist/browser/{chunk-3643DC7K.cjs → chunk-RBNCTHK3.cjs} +5 -2
  38. package/dist/browser/{chunk-3643DC7K.cjs.map → chunk-RBNCTHK3.cjs.map} +1 -1
  39. package/dist/browser/chunk-VFNNU3AX.js +28 -0
  40. package/dist/browser/chunk-VFNNU3AX.js.map +1 -0
  41. package/dist/browser/{chunk-HGN7J3EU.cjs → chunk-WY2VLKRR.cjs} +12 -12
  42. package/dist/browser/{chunk-HGN7J3EU.cjs.map → chunk-WY2VLKRR.cjs.map} +1 -1
  43. package/dist/browser/{chunk-DXWHT3HK.cjs → chunk-ZGYZZCUK.cjs} +391 -55
  44. package/dist/browser/chunk-ZGYZZCUK.cjs.map +1 -0
  45. package/dist/browser/index.cjs +112 -82
  46. package/dist/browser/index.cjs.map +1 -1
  47. package/dist/browser/index.js +40 -10
  48. package/dist/browser/index.js.map +1 -1
  49. package/dist/browser/integrations/pino.cjs +4 -4
  50. package/dist/browser/integrations/pino.js +3 -3
  51. package/dist/browser/langchain/index.cjs +19 -19
  52. package/dist/browser/langchain/index.js +3 -3
  53. package/dist/browser/langgraph/index.cjs +34 -26
  54. package/dist/browser/langgraph/index.cjs.map +1 -1
  55. package/dist/browser/langgraph/index.js +16 -8
  56. package/dist/browser/langgraph/index.js.map +1 -1
  57. package/dist/browser/openai/index.cjs +22 -8
  58. package/dist/browser/openai/index.cjs.map +1 -1
  59. package/dist/browser/openai/index.js +17 -3
  60. package/dist/browser/openai/index.js.map +1 -1
  61. package/dist/browser/openai-agents/index.cjs +42 -34
  62. package/dist/browser/openai-agents/index.cjs.map +1 -1
  63. package/dist/browser/openai-agents/index.js +13 -5
  64. package/dist/browser/openai-agents/index.js.map +1 -1
  65. package/dist/browser/vercel-ai/index.cjs +16 -16
  66. package/dist/browser/vercel-ai/index.js +4 -4
  67. package/dist/{chunk-4R4SHGOK.js → chunk-4JPZV2VZ.js} +3 -3
  68. package/dist/{chunk-4R4SHGOK.js.map → chunk-4JPZV2VZ.js.map} +1 -1
  69. package/dist/{chunk-HNCWTENX.cjs → chunk-5B3IUESN.cjs} +415 -70
  70. package/dist/chunk-5B3IUESN.cjs.map +1 -0
  71. package/dist/chunk-5RXSICEJ.js +118 -0
  72. package/dist/chunk-5RXSICEJ.js.map +1 -0
  73. package/dist/chunk-7A2EWXZK.cjs +31 -0
  74. package/dist/chunk-7A2EWXZK.cjs.map +1 -0
  75. package/dist/{chunk-STK4KJQ6.js → chunk-AAR4FYFO.js} +10 -4
  76. package/dist/chunk-AAR4FYFO.js.map +1 -0
  77. package/dist/{chunk-LQI63FHF.cjs → chunk-ADRVMGAW.cjs} +20 -14
  78. package/dist/chunk-ADRVMGAW.cjs.map +1 -0
  79. package/dist/{chunk-V5J6J4ZR.js → chunk-CECVNM7R.js} +4 -4
  80. package/dist/{chunk-V5J6J4ZR.js.map → chunk-CECVNM7R.js.map} +1 -1
  81. package/dist/{chunk-KJEO52QS.cjs → chunk-HICEJ4LV.cjs} +5 -2
  82. package/dist/{chunk-KJEO52QS.cjs.map → chunk-HICEJ4LV.cjs.map} +1 -1
  83. package/dist/{chunk-QXRJUPDP.cjs → chunk-HSY7V4RG.cjs} +12 -12
  84. package/dist/{chunk-QXRJUPDP.cjs.map → chunk-HSY7V4RG.cjs.map} +1 -1
  85. package/dist/chunk-LB6ZLJUR.js +28 -0
  86. package/dist/chunk-LB6ZLJUR.js.map +1 -0
  87. package/dist/{browser/chunk-F7BGQ26H.js → chunk-O3Q5L2HY.js} +6 -4
  88. package/dist/chunk-O3Q5L2HY.js.map +1 -0
  89. package/dist/{chunk-5D6SBSEI.cjs → chunk-RF7NI5VN.cjs} +17 -15
  90. package/dist/chunk-RF7NI5VN.cjs.map +1 -0
  91. package/dist/{chunk-AEFUXEKV.js → chunk-TP3N3S2D.js} +3 -3
  92. package/dist/{chunk-AEFUXEKV.js.map → chunk-TP3N3S2D.js.map} +1 -1
  93. package/dist/{chunk-LTKGLXAE.js → chunk-UEKQIRRA.js} +410 -68
  94. package/dist/chunk-UEKQIRRA.js.map +1 -0
  95. package/dist/{browser/chunk-YNUZGKUA.cjs → chunk-UWQPOWJQ.cjs} +7 -7
  96. package/dist/{chunk-Y7SVGUKY.cjs.map → chunk-UWQPOWJQ.cjs.map} +1 -1
  97. package/dist/chunk-VD3KRXSP.cjs +126 -0
  98. package/dist/chunk-VD3KRXSP.cjs.map +1 -0
  99. package/dist/index.cjs +119 -89
  100. package/dist/index.cjs.map +1 -1
  101. package/dist/index.d.cts +2 -2
  102. package/dist/index.d.ts +2 -2
  103. package/dist/index.js +41 -11
  104. package/dist/index.js.map +1 -1
  105. package/dist/integrations/pino.cjs +4 -4
  106. package/dist/integrations/pino.js +3 -3
  107. package/dist/langchain/index.cjs +19 -19
  108. package/dist/langchain/index.d.cts +1 -1
  109. package/dist/langchain/index.d.ts +1 -1
  110. package/dist/langchain/index.js +3 -3
  111. package/dist/langgraph/index.cjs +34 -26
  112. package/dist/langgraph/index.cjs.map +1 -1
  113. package/dist/langgraph/index.d.cts +1 -1
  114. package/dist/langgraph/index.d.ts +1 -1
  115. package/dist/langgraph/index.js +16 -8
  116. package/dist/langgraph/index.js.map +1 -1
  117. package/dist/openai/index.cjs +22 -8
  118. package/dist/openai/index.cjs.map +1 -1
  119. package/dist/openai/index.js +17 -3
  120. package/dist/openai/index.js.map +1 -1
  121. package/dist/openai-agents/index.cjs +42 -34
  122. package/dist/openai-agents/index.cjs.map +1 -1
  123. package/dist/openai-agents/index.js +13 -5
  124. package/dist/openai-agents/index.js.map +1 -1
  125. package/dist/{tracing-BYAqjT5Q.d.cts → tracing-CNlre8TK.d.cts} +1 -0
  126. package/dist/{tracing-rz9cWQ8d.d.ts → tracing-J8ZgxVzU.d.ts} +1 -0
  127. package/dist/vercel-ai/index.cjs +16 -16
  128. package/dist/vercel-ai/index.js +4 -4
  129. package/package.json +1 -9
  130. package/dist/browser/chunk-3BGG7GH3.cjs +0 -183
  131. package/dist/browser/chunk-3BGG7GH3.cjs.map +0 -1
  132. package/dist/browser/chunk-DXWHT3HK.cjs.map +0 -1
  133. package/dist/browser/chunk-EFUQVASI.cjs.map +0 -1
  134. package/dist/browser/chunk-F3B4UR64.js.map +0 -1
  135. package/dist/browser/chunk-F7BGQ26H.js.map +0 -1
  136. package/dist/browser/chunk-GWJYOQNC.js.map +0 -1
  137. package/dist/browser/chunk-M2GZJ3RS.cjs.map +0 -1
  138. package/dist/browser/chunk-YHV5GL32.js +0 -178
  139. package/dist/browser/chunk-YHV5GL32.js.map +0 -1
  140. package/dist/chunk-5D6SBSEI.cjs.map +0 -1
  141. package/dist/chunk-HNCWTENX.cjs.map +0 -1
  142. package/dist/chunk-LQI63FHF.cjs.map +0 -1
  143. package/dist/chunk-LTKGLXAE.js.map +0 -1
  144. package/dist/chunk-POCQNSVD.js +0 -178
  145. package/dist/chunk-POCQNSVD.js.map +0 -1
  146. package/dist/chunk-SBGY5NS4.js.map +0 -1
  147. package/dist/chunk-STK4KJQ6.js.map +0 -1
  148. package/dist/chunk-T2KW3P23.cjs +0 -183
  149. package/dist/chunk-T2KW3P23.cjs.map +0 -1
@@ -1,28 +1,31 @@
1
1
  'use strict';
2
2
 
3
- var chunkM2GZJ3RS_cjs = require('./chunk-M2GZJ3RS.cjs');
4
- var chunkHGN7J3EU_cjs = require('./chunk-HGN7J3EU.cjs');
5
- var chunk3BGG7GH3_cjs = require('./chunk-3BGG7GH3.cjs');
3
+ var chunkAV35EOER_cjs = require('./chunk-AV35EOER.cjs');
4
+ var chunkWY2VLKRR_cjs = require('./chunk-WY2VLKRR.cjs');
5
+ require('./chunk-HZZK2EMO.cjs');
6
+ var chunkFNZWJU64_cjs = require('./chunk-FNZWJU64.cjs');
6
7
  require('./chunk-SWQOPFE4.cjs');
7
- var chunkDXWHT3HK_cjs = require('./chunk-DXWHT3HK.cjs');
8
+ require('./chunk-RBNCTHK3.cjs');
9
+ var chunkZGYZZCUK_cjs = require('./chunk-ZGYZZCUK.cjs');
8
10
 
9
11
  // src/_internal/auto-detect.browser.ts
10
12
  async function installAdapters() {
11
13
  }
12
14
 
13
15
  // src/index.ts
14
- chunkDXWHT3HK_cjs.init_env();
16
+ chunkZGYZZCUK_cjs.init_env();
15
17
 
16
18
  // src/_internal/db-capture.browser.ts
17
19
  function maybeEnableDbCaptureFromEnv() {
18
20
  }
19
21
 
20
22
  // src/index.ts
21
- chunkDXWHT3HK_cjs.init_otel_provider_browser();
22
- chunkDXWHT3HK_cjs.init_redaction();
23
+ chunkZGYZZCUK_cjs.init_otel_provider_browser();
24
+ chunkZGYZZCUK_cjs.init_redaction();
23
25
 
24
26
  // src/_internal/transport.ts
25
- var SDK_VERSION = "0.4.1-rc.1" ;
27
+ chunkZGYZZCUK_cjs.init_diagnostics();
28
+ var SDK_VERSION = "0.5.0-rc.1" ;
26
29
  var RETRY_AFTER_CAP_SECONDS = 30;
27
30
  function parseRetryAfter(value) {
28
31
  if (!value) return null;
@@ -126,8 +129,14 @@ var BatchTransport = class {
126
129
  }
127
130
  /** Enqueue an event. Non-blocking. Returns false if the queue is full. */
128
131
  track(event) {
129
- if (this.closed) return false;
130
- if (this.queue.length >= this.maxQueueSize) return false;
132
+ if (this.closed) {
133
+ chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_SHUTDOWN_DROP, "trace");
134
+ return false;
135
+ }
136
+ if (this.queue.length >= this.maxQueueSize) {
137
+ chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_QUEUE_FULL, "trace");
138
+ return false;
139
+ }
131
140
  this.queue.push(event);
132
141
  if (this.queue.length >= this.maxBatchSize) {
133
142
  void this.tick();
@@ -212,8 +221,12 @@ var BatchTransport = class {
212
221
  body: JSON.stringify(payload),
213
222
  signal: controller.signal
214
223
  });
224
+ chunkZGYZZCUK_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
225
+ const droppedCount = countPayloadEntries(payload);
226
+ const droppedCategory = categoryOf(payload);
215
227
  if (resp.status === 429) {
216
228
  await recordQuotaState(resp);
229
+ chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
217
230
  }
218
231
  if (!resp.ok) {
219
232
  let bodySnippet = "";
@@ -222,7 +235,10 @@ var BatchTransport = class {
222
235
  bodySnippet = text.slice(0, 200);
223
236
  } catch {
224
237
  }
225
- chunk3BGG7GH3_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
238
+ if (resp.status !== 429) {
239
+ chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
240
+ }
241
+ chunkZGYZZCUK_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
226
242
  fingerprint: "morse.transport.post.non_2xx",
227
243
  extra: {
228
244
  endpoint_host: hostnameOf(url),
@@ -231,7 +247,8 @@ var BatchTransport = class {
231
247
  });
232
248
  }
233
249
  } catch (err) {
234
- chunk3BGG7GH3_cjs.report(err, {
250
+ chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
251
+ chunkZGYZZCUK_cjs.report(err, {
235
252
  fingerprint: "morse.transport.post.network",
236
253
  extra: {
237
254
  endpoint_host: hostnameOf(url),
@@ -261,11 +278,24 @@ function deriveLogsEndpoint(tracesEndpoint) {
261
278
  return tracesEndpoint.replace(/\/api\/v1\/.*$/, "/api/v1/logs/ingest");
262
279
  }
263
280
  }
281
+ function countPayloadEntries(payload) {
282
+ let total = 0;
283
+ for (const value of Object.values(payload)) {
284
+ if (Array.isArray(value)) total += value.length;
285
+ }
286
+ return total || 1;
287
+ }
288
+ function categoryOf(payload) {
289
+ if ("traces" in payload) return "trace";
290
+ if ("logs" in payload) return "log";
291
+ return "record";
292
+ }
264
293
 
265
294
  // src/index.ts
266
- chunkDXWHT3HK_cjs.init_tracing();
267
- chunkDXWHT3HK_cjs.init_spans();
268
- chunkDXWHT3HK_cjs.init_propagation();
295
+ chunkZGYZZCUK_cjs.init_tracing();
296
+ chunkZGYZZCUK_cjs.init_diagnostics();
297
+ chunkZGYZZCUK_cjs.init_spans();
298
+ chunkZGYZZCUK_cjs.init_propagation();
269
299
  var version = SDK_VERSION;
270
300
  var singleton = null;
271
301
  var transportFactory = (opts) => new BatchTransport(opts);
@@ -285,9 +315,9 @@ function logDestinationOnce(endpoint) {
285
315
  }
286
316
  function resolveEndpoint(explicit) {
287
317
  if (explicit && explicit.length > 0) return explicit;
288
- const fromEnv = chunkDXWHT3HK_cjs.getEndpoint();
318
+ const fromEnv = chunkZGYZZCUK_cjs.getEndpoint();
289
319
  if (fromEnv) return fromEnv;
290
- return chunkDXWHT3HK_cjs.DEFAULT_ENDPOINT;
320
+ return chunkZGYZZCUK_cjs.DEFAULT_ENDPOINT;
291
321
  }
292
322
  var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
293
323
  function deriveOtlpEndpoint(tracesEndpoint) {
@@ -302,10 +332,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
302
332
  }
303
333
  }
304
334
  function buildSingleton(opts, redaction) {
305
- if (chunkDXWHT3HK_cjs.isDisabled()) {
335
+ if (chunkZGYZZCUK_cjs.isDisabled()) {
306
336
  return null;
307
337
  }
308
- const apiKey = opts.apiKey ?? chunkDXWHT3HK_cjs.getApiKey();
338
+ const apiKey = opts.apiKey ?? chunkZGYZZCUK_cjs.getApiKey();
309
339
  if (!apiKey) {
310
340
  if (!noApiKeyWarningEmitted) {
311
341
  logger(
@@ -317,23 +347,23 @@ function buildSingleton(opts, redaction) {
317
347
  return null;
318
348
  }
319
349
  const endpoint = resolveEndpoint(opts.endpoint);
320
- const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkDXWHT3HK_cjs.getFlushIntervalSeconds();
350
+ const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkZGYZZCUK_cjs.getFlushIntervalSeconds();
321
351
  const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
322
- chunkDXWHT3HK_cjs.setTransport(transport);
323
- chunkDXWHT3HK_cjs.setRedactionConfig(redaction);
324
- const explicitSource = chunkDXWHT3HK_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
325
- const resolvedSource = explicitSource ?? chunkDXWHT3HK_cjs.getInternalSource() ?? null;
326
- chunkDXWHT3HK_cjs.setSource(resolvedSource);
352
+ chunkZGYZZCUK_cjs.setTransport(transport);
353
+ chunkZGYZZCUK_cjs.setRedactionConfig(redaction);
354
+ const explicitSource = chunkZGYZZCUK_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
355
+ const resolvedSource = explicitSource ?? chunkZGYZZCUK_cjs.getInternalSource() ?? null;
356
+ chunkZGYZZCUK_cjs.setSource(resolvedSource);
327
357
  logDestinationOnce(endpoint);
328
358
  try {
329
- chunkDXWHT3HK_cjs.getEngine().configure({
359
+ chunkZGYZZCUK_cjs.getEngine().configure({
330
360
  endpoint: deriveOtlpEndpoint(endpoint),
331
361
  apiKey,
332
- sampleRate: chunkDXWHT3HK_cjs.getSampleRate(),
362
+ sampleRate: chunkZGYZZCUK_cjs.getSampleRate(),
333
363
  scheduleDelayMillis: flushIntervalSeconds * 1e3,
334
- maxQueueSize: chunkDXWHT3HK_cjs.getMaxQueueSize(),
335
- maxExportBatchSize: chunkDXWHT3HK_cjs.getMaxBatchSize(),
336
- maxFieldBytes: chunkDXWHT3HK_cjs.getMaxFieldBytes(),
364
+ maxQueueSize: chunkZGYZZCUK_cjs.getMaxQueueSize(),
365
+ maxExportBatchSize: chunkZGYZZCUK_cjs.getMaxBatchSize(),
366
+ maxFieldBytes: chunkZGYZZCUK_cjs.getMaxFieldBytes(),
337
367
  // 10s (not the exporter's un-overridden 30s ceiling): a genuine
338
368
  // network blip still gets several retries with backoff; a fully dead
339
369
  // endpoint fails within a bounded, shutdown-friendly window instead
@@ -342,32 +372,32 @@ function buildSingleton(opts, redaction) {
342
372
  redactionConfig: redaction
343
373
  });
344
374
  } catch (err) {
345
- chunk3BGG7GH3_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
375
+ chunkZGYZZCUK_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
346
376
  }
347
377
  void installAdapters().catch(() => {
348
378
  });
349
379
  try {
350
380
  maybeEnableDbCaptureFromEnv();
351
381
  } catch (err) {
352
- chunk3BGG7GH3_cjs.report(err, { fingerprint: "morse.db_capture.register" });
382
+ chunkZGYZZCUK_cjs.report(err, { fingerprint: "morse.db_capture.register" });
353
383
  }
354
384
  return { apiKey, endpoint, transport, redaction };
355
385
  }
356
386
  function ensureInitialized() {
357
- if (chunkDXWHT3HK_cjs.isDisabled()) return null;
387
+ if (chunkZGYZZCUK_cjs.isDisabled()) return null;
358
388
  if (singleton !== null) return singleton;
359
- singleton = buildSingleton({}, chunkDXWHT3HK_cjs.buildRedactionConfig());
389
+ singleton = buildSingleton({}, chunkZGYZZCUK_cjs.buildRedactionConfig());
360
390
  return singleton;
361
391
  }
362
- chunkHGN7J3EU_cjs._setEnsureInitialized(() => {
392
+ chunkWY2VLKRR_cjs._setEnsureInitialized(() => {
363
393
  ensureInitialized();
364
394
  });
365
395
  function init(options = {}) {
366
- if (chunkDXWHT3HK_cjs.isDisabled()) {
396
+ if (chunkZGYZZCUK_cjs.isDisabled()) {
367
397
  logger("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
368
398
  return;
369
399
  }
370
- const redaction = chunkDXWHT3HK_cjs.buildRedactionConfig(options.redaction);
400
+ const redaction = chunkZGYZZCUK_cjs.buildRedactionConfig(options.redaction);
371
401
  try {
372
402
  if (singleton !== null) {
373
403
  void singleton.transport.shutdown();
@@ -375,10 +405,10 @@ function init(options = {}) {
375
405
  }
376
406
  singleton = buildSingleton(options, redaction);
377
407
  } catch (err) {
378
- chunk3BGG7GH3_cjs.report(err, { fingerprint: "morse.init" });
408
+ chunkZGYZZCUK_cjs.report(err, { fingerprint: "morse.init" });
379
409
  }
380
410
  }
381
- var track = chunk3BGG7GH3_cjs.absorbErrorsSync(
411
+ var track = chunkFNZWJU64_cjs.absorbErrorsSync(
382
412
  (options) => {
383
413
  const state = ensureInitialized();
384
414
  if (!state) return;
@@ -386,33 +416,33 @@ var track = chunk3BGG7GH3_cjs.absorbErrorsSync(
386
416
  agent_id: options.agentId,
387
417
  ...options.runData
388
418
  };
389
- const redacted = chunkDXWHT3HK_cjs.redactValue(payload, state.redaction);
419
+ const redacted = chunkZGYZZCUK_cjs.redactValue(payload, state.redaction);
390
420
  state.transport.track(redacted);
391
421
  },
392
422
  { fingerprint: "morse.track" }
393
423
  );
394
- var batchTrack = chunk3BGG7GH3_cjs.absorbErrorsSync(
424
+ var batchTrack = chunkFNZWJU64_cjs.absorbErrorsSync(
395
425
  (runs) => {
396
426
  const state = ensureInitialized();
397
427
  if (!state) return;
398
428
  for (const run2 of runs) {
399
- const redacted = chunkDXWHT3HK_cjs.redactValue(run2, state.redaction);
429
+ const redacted = chunkZGYZZCUK_cjs.redactValue(run2, state.redaction);
400
430
  state.transport.track(redacted);
401
431
  }
402
432
  },
403
433
  { fingerprint: "morse.batch_track" }
404
434
  );
405
- var record = chunk3BGG7GH3_cjs.absorbErrorsSync(
435
+ var record = chunkFNZWJU64_cjs.absorbErrorsSync(
406
436
  (rec) => {
407
437
  const state = ensureInitialized();
408
438
  if (!state) return;
409
- const traceId = chunkDXWHT3HK_cjs.generateTraceId();
410
- const now = chunkDXWHT3HK_cjs.nowIso();
439
+ const traceId = chunkZGYZZCUK_cjs.generateTraceId();
440
+ const now = chunkZGYZZCUK_cjs.nowIso();
411
441
  const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
412
442
  const span2 = {
413
443
  trace_id: traceId,
414
- span_id: chunkDXWHT3HK_cjs.generateSpanId(),
415
- type: chunkDXWHT3HK_cjs.SpanType.AGENT,
444
+ span_id: chunkZGYZZCUK_cjs.generateSpanId(),
445
+ type: chunkZGYZZCUK_cjs.SpanType.AGENT,
416
446
  name: rec.agent,
417
447
  started_at: now,
418
448
  ended_at: now,
@@ -437,57 +467,57 @@ var record = chunk3BGG7GH3_cjs.absorbErrorsSync(
437
467
  success: rec.success,
438
468
  outcome: rec.outcome
439
469
  };
440
- const entry = chunkDXWHT3HK_cjs.buildTraceEntry(traceFields, [span2]);
441
- const redacted = chunkDXWHT3HK_cjs.redactValue(entry, state.redaction);
442
- chunkDXWHT3HK_cjs.sendTrace(redacted);
470
+ const entry = chunkZGYZZCUK_cjs.buildTraceEntry(traceFields, [span2]);
471
+ const redacted = chunkZGYZZCUK_cjs.redactValue(entry, state.redaction);
472
+ chunkZGYZZCUK_cjs.sendTrace(redacted);
443
473
  },
444
474
  { fingerprint: "morse.record" }
445
475
  );
446
476
  function run(nameOrOpts, fn) {
447
477
  const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
448
478
  ensureInitialized();
449
- return chunkDXWHT3HK_cjs.runSync(opts, fn);
479
+ return chunkZGYZZCUK_cjs.runSync(opts, fn);
450
480
  }
451
481
  function runTraced(options, fn) {
452
482
  ensureInitialized();
453
- return chunkDXWHT3HK_cjs.runAsync(options, fn);
483
+ return chunkZGYZZCUK_cjs.runAsync(options, fn);
454
484
  }
455
485
  function setContext2(dims) {
456
- chunkDXWHT3HK_cjs.setContext(dims);
486
+ chunkZGYZZCUK_cjs.setContext(dims);
457
487
  }
458
488
  function startSpan2(options) {
459
- return chunkDXWHT3HK_cjs.startSpan(options);
489
+ return chunkZGYZZCUK_cjs.startSpan(options);
460
490
  }
461
491
  function span(options, fn) {
462
- return chunkDXWHT3HK_cjs.spanSync(options, fn);
492
+ return chunkZGYZZCUK_cjs.spanSync(options, fn);
463
493
  }
464
494
  function spanAsync2(options, fn) {
465
- return chunkDXWHT3HK_cjs.spanAsync(options, fn);
495
+ return chunkZGYZZCUK_cjs.spanAsync(options, fn);
466
496
  }
467
- var flush = chunk3BGG7GH3_cjs.absorbErrorsAsync(
497
+ var flush = chunkFNZWJU64_cjs.absorbErrorsAsync(
468
498
  async () => {
469
499
  if (singleton !== null) {
470
500
  await singleton.transport.flush();
471
- await chunkDXWHT3HK_cjs.getEngine().flush();
501
+ await chunkZGYZZCUK_cjs.getEngine().flush();
472
502
  }
473
503
  },
474
504
  { fingerprint: "morse.flush" }
475
505
  );
476
- var quotaState2 = chunk3BGG7GH3_cjs.absorbErrorsSync(
506
+ var quotaState2 = chunkFNZWJU64_cjs.absorbErrorsSync(
477
507
  () => {
478
508
  if (singleton === null) return null;
479
509
  return getQuotaState();
480
510
  },
481
511
  { fingerprint: "morse.quota_state" }
482
512
  );
483
- var shutdown = chunk3BGG7GH3_cjs.absorbErrorsAsync(
513
+ var shutdown = chunkFNZWJU64_cjs.absorbErrorsAsync(
484
514
  async () => {
485
515
  if (singleton !== null) {
486
516
  await singleton.transport.shutdown();
487
- await chunkDXWHT3HK_cjs.getEngine().flush();
488
- chunkDXWHT3HK_cjs.getEngine().shutdown();
517
+ await chunkZGYZZCUK_cjs.getEngine().flush();
518
+ chunkZGYZZCUK_cjs.getEngine().shutdown();
489
519
  singleton = null;
490
- chunkDXWHT3HK_cjs.setTransport(null);
520
+ chunkZGYZZCUK_cjs.setTransport(null);
491
521
  }
492
522
  },
493
523
  { fingerprint: "morse.shutdown" }
@@ -496,14 +526,14 @@ function _resetForTesting4() {
496
526
  if (singleton !== null) {
497
527
  void singleton.transport.shutdown();
498
528
  singleton = null;
499
- chunkDXWHT3HK_cjs.setTransport(null);
529
+ chunkZGYZZCUK_cjs.setTransport(null);
500
530
  }
501
- chunkDXWHT3HK_cjs.getEngine().resetForTesting();
531
+ chunkZGYZZCUK_cjs.getEngine().resetForTesting();
502
532
  noApiKeyWarningEmitted = false;
503
533
  lastLoggedEndpoint = null;
504
- chunkDXWHT3HK_cjs.setSource(null);
505
- chunkDXWHT3HK_cjs._resetForTesting();
506
- chunk3BGG7GH3_cjs._resetForTesting();
534
+ chunkZGYZZCUK_cjs.setSource(null);
535
+ chunkZGYZZCUK_cjs._resetForTesting2();
536
+ chunkZGYZZCUK_cjs._resetForTesting();
507
537
  _resetQuotaStateForTesting();
508
538
  transportFactory = (opts) => new BatchTransport(opts);
509
539
  }
@@ -511,59 +541,59 @@ function _setTransportFactoryForTesting(factory) {
511
541
  transportFactory = factory;
512
542
  }
513
543
  function _getLastTraceForTesting() {
514
- return chunkDXWHT3HK_cjs.getLastTrace();
544
+ return chunkZGYZZCUK_cjs.getLastTrace();
515
545
  }
516
546
  function _getActiveTraceStateForTesting() {
517
- return chunkDXWHT3HK_cjs.getActiveTraceState();
547
+ return chunkZGYZZCUK_cjs.getActiveTraceState();
518
548
  }
519
549
 
520
550
  Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
521
551
  enumerable: true,
522
- get: function () { return chunkM2GZJ3RS_cjs.MAX_SEGMENT_CONTENT_BYTES; }
552
+ get: function () { return chunkAV35EOER_cjs.MAX_SEGMENT_CONTENT_BYTES; }
523
553
  });
524
554
  Object.defineProperty(exports, "extractAnthropicSegments", {
525
555
  enumerable: true,
526
- get: function () { return chunkM2GZJ3RS_cjs.extractAnthropicSegments; }
556
+ get: function () { return chunkAV35EOER_cjs.extractAnthropicSegments; }
527
557
  });
528
558
  Object.defineProperty(exports, "instrumentAnthropic", {
529
559
  enumerable: true,
530
- get: function () { return chunkM2GZJ3RS_cjs.instrumentAnthropic; }
560
+ get: function () { return chunkAV35EOER_cjs.instrumentAnthropic; }
531
561
  });
532
562
  Object.defineProperty(exports, "isAnthropicWrapped", {
533
563
  enumerable: true,
534
- get: function () { return chunkM2GZJ3RS_cjs.isAnthropicWrapped; }
564
+ get: function () { return chunkAV35EOER_cjs.isAnthropicWrapped; }
535
565
  });
536
566
  Object.defineProperty(exports, "uninstallAnthropic", {
537
567
  enumerable: true,
538
- get: function () { return chunkM2GZJ3RS_cjs.uninstallAnthropic; }
568
+ get: function () { return chunkAV35EOER_cjs.uninstallAnthropic; }
539
569
  });
540
570
  Object.defineProperty(exports, "wrapAnthropic", {
541
571
  enumerable: true,
542
- get: function () { return chunkM2GZJ3RS_cjs.wrapAnthropic; }
572
+ get: function () { return chunkAV35EOER_cjs.wrapAnthropic; }
543
573
  });
544
574
  Object.defineProperty(exports, "log", {
545
575
  enumerable: true,
546
- get: function () { return chunkHGN7J3EU_cjs.log; }
576
+ get: function () { return chunkWY2VLKRR_cjs.log; }
547
577
  });
548
578
  Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
549
579
  enumerable: true,
550
- get: function () { return chunkDXWHT3HK_cjs.W3C_TRACEPARENT_HEADER; }
580
+ get: function () { return chunkZGYZZCUK_cjs.W3C_TRACEPARENT_HEADER; }
551
581
  });
552
582
  Object.defineProperty(exports, "extractTraceparent", {
553
583
  enumerable: true,
554
- get: function () { return chunkDXWHT3HK_cjs.extractTraceparent; }
584
+ get: function () { return chunkZGYZZCUK_cjs.extractTraceparent; }
555
585
  });
556
586
  Object.defineProperty(exports, "formatTraceparent", {
557
587
  enumerable: true,
558
- get: function () { return chunkDXWHT3HK_cjs.formatTraceparent; }
588
+ get: function () { return chunkZGYZZCUK_cjs.formatTraceparent; }
559
589
  });
560
590
  Object.defineProperty(exports, "injectIntoRequestInit", {
561
591
  enumerable: true,
562
- get: function () { return chunkDXWHT3HK_cjs.injectIntoRequestInit; }
592
+ get: function () { return chunkZGYZZCUK_cjs.injectIntoRequestInit; }
563
593
  });
564
594
  Object.defineProperty(exports, "injectTraceparent", {
565
595
  enumerable: true,
566
- get: function () { return chunkDXWHT3HK_cjs.injectTraceparent; }
596
+ get: function () { return chunkZGYZZCUK_cjs.injectTraceparent; }
567
597
  });
568
598
  exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
569
599
  exports._getLastTraceForTesting = _getLastTraceForTesting;