@morsehq-dev/sdk 0.4.1 → 0.5.0-rc.2

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-GWJYOQNC.js → chunk-3MTJGZGX.js} +10 -4
  14. package/dist/browser/chunk-3MTJGZGX.js.map +1 -0
  15. package/dist/browser/{chunk-EFUQVASI.cjs → chunk-63ZI6PGP.cjs} +17 -15
  16. package/dist/browser/chunk-63ZI6PGP.cjs.map +1 -0
  17. package/dist/browser/{chunk-DXWHT3HK.cjs → chunk-A5EYWAOT.cjs} +428 -63
  18. package/dist/browser/chunk-A5EYWAOT.cjs.map +1 -0
  19. package/dist/browser/{chunk-AYNX24P5.js → chunk-AM6LMQCT.js} +3 -3
  20. package/dist/browser/{chunk-AYNX24P5.js.map → chunk-AM6LMQCT.js.map} +1 -1
  21. package/dist/{chunk-SBGY5NS4.js → browser/chunk-FDE32B3R.js} +6 -4
  22. package/dist/browser/chunk-FDE32B3R.js.map +1 -0
  23. package/dist/browser/{chunk-DOLWR7LD.js → chunk-L6FWDEGJ.js} +4 -4
  24. package/dist/browser/{chunk-DOLWR7LD.js.map → chunk-L6FWDEGJ.js.map} +1 -1
  25. package/dist/browser/{chunk-QWRQJO57.js → chunk-MLDVXMQD.js} +3 -3
  26. package/dist/browser/{chunk-QWRQJO57.js.map → chunk-MLDVXMQD.js.map} +1 -1
  27. package/dist/{chunk-Y7SVGUKY.cjs → browser/chunk-N3PXJCOE.cjs} +7 -7
  28. package/dist/browser/{chunk-YNUZGKUA.cjs.map → chunk-N3PXJCOE.cjs.map} +1 -1
  29. package/dist/browser/chunk-NH54DAJP.js +118 -0
  30. package/dist/browser/chunk-NH54DAJP.js.map +1 -0
  31. package/dist/browser/chunk-NRYB5GJT.js +28 -0
  32. package/dist/browser/chunk-NRYB5GJT.js.map +1 -0
  33. package/dist/browser/{chunk-F3B4UR64.js → chunk-OOGAYEJF.js} +423 -61
  34. package/dist/browser/chunk-OOGAYEJF.js.map +1 -0
  35. package/dist/browser/{chunk-3643DC7K.cjs → chunk-RBNCTHK3.cjs} +5 -2
  36. package/dist/browser/{chunk-3643DC7K.cjs.map → chunk-RBNCTHK3.cjs.map} +1 -1
  37. package/dist/browser/chunk-SOJYLXCR.cjs +126 -0
  38. package/dist/browser/chunk-SOJYLXCR.cjs.map +1 -0
  39. package/dist/browser/{chunk-HGN7J3EU.cjs → chunk-T4NHSVXH.cjs} +12 -12
  40. package/dist/browser/{chunk-HGN7J3EU.cjs.map → chunk-T4NHSVXH.cjs.map} +1 -1
  41. package/dist/browser/chunk-YMEU6XQQ.cjs +31 -0
  42. package/dist/browser/chunk-YMEU6XQQ.cjs.map +1 -0
  43. package/dist/browser/{chunk-M2GZJ3RS.cjs → chunk-YR2FCEWM.cjs} +20 -14
  44. package/dist/browser/chunk-YR2FCEWM.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-LTKGLXAE.js → chunk-3IGQWLWE.js} +447 -76
  68. package/dist/chunk-3IGQWLWE.js.map +1 -0
  69. package/dist/{chunk-4R4SHGOK.js → chunk-4JPZV2VZ.js} +3 -3
  70. package/dist/{chunk-4R4SHGOK.js.map → chunk-4JPZV2VZ.js.map} +1 -1
  71. package/dist/chunk-6DZNK4VX.cjs +31 -0
  72. package/dist/chunk-6DZNK4VX.cjs.map +1 -0
  73. package/dist/{browser/chunk-F7BGQ26H.js → chunk-FCAPLB7A.js} +6 -4
  74. package/dist/chunk-FCAPLB7A.js.map +1 -0
  75. package/dist/{chunk-KJEO52QS.cjs → chunk-HICEJ4LV.cjs} +5 -2
  76. package/dist/{chunk-KJEO52QS.cjs.map → chunk-HICEJ4LV.cjs.map} +1 -1
  77. package/dist/chunk-S4WUABAU.js +28 -0
  78. package/dist/chunk-S4WUABAU.js.map +1 -0
  79. package/dist/{chunk-V5J6J4ZR.js → chunk-SHK2XEPB.js} +4 -4
  80. package/dist/{chunk-V5J6J4ZR.js.map → chunk-SHK2XEPB.js.map} +1 -1
  81. package/dist/{chunk-LQI63FHF.cjs → chunk-SNGYSP7Z.cjs} +20 -14
  82. package/dist/chunk-SNGYSP7Z.cjs.map +1 -0
  83. package/dist/chunk-VHF4GWJ4.cjs +126 -0
  84. package/dist/chunk-VHF4GWJ4.cjs.map +1 -0
  85. package/dist/{chunk-HNCWTENX.cjs → chunk-XCOZIFHC.cjs} +452 -78
  86. package/dist/chunk-XCOZIFHC.cjs.map +1 -0
  87. package/dist/chunk-XJUH6PR5.js +118 -0
  88. package/dist/chunk-XJUH6PR5.js.map +1 -0
  89. package/dist/{browser/chunk-YNUZGKUA.cjs → chunk-Y2QHMV6H.cjs} +7 -7
  90. package/dist/{chunk-Y7SVGUKY.cjs.map → chunk-Y2QHMV6H.cjs.map} +1 -1
  91. package/dist/{chunk-STK4KJQ6.js → chunk-YJYF4NSA.js} +10 -4
  92. package/dist/chunk-YJYF4NSA.js.map +1 -0
  93. package/dist/{chunk-5D6SBSEI.cjs → chunk-Z2IYSTRT.cjs} +17 -15
  94. package/dist/chunk-Z2IYSTRT.cjs.map +1 -0
  95. package/dist/{chunk-QXRJUPDP.cjs → chunk-ZIER4DGK.cjs} +12 -12
  96. package/dist/{chunk-QXRJUPDP.cjs.map → chunk-ZIER4DGK.cjs.map} +1 -1
  97. package/dist/{chunk-AEFUXEKV.js → chunk-ZWOSPXS4.js} +3 -3
  98. package/dist/{chunk-AEFUXEKV.js.map → chunk-ZWOSPXS4.js.map} +1 -1
  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
package/dist/index.cjs CHANGED
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkLQI63FHF_cjs = require('./chunk-LQI63FHF.cjs');
4
- var chunkQXRJUPDP_cjs = require('./chunk-QXRJUPDP.cjs');
5
- var chunkT2KW3P23_cjs = require('./chunk-T2KW3P23.cjs');
3
+ var chunkSNGYSP7Z_cjs = require('./chunk-SNGYSP7Z.cjs');
4
+ var chunkZIER4DGK_cjs = require('./chunk-ZIER4DGK.cjs');
5
+ require('./chunk-VHF4GWJ4.cjs');
6
+ var chunk6DZNK4VX_cjs = require('./chunk-6DZNK4VX.cjs');
6
7
  require('./chunk-KBWPNIH4.cjs');
7
- var chunkHNCWTENX_cjs = require('./chunk-HNCWTENX.cjs');
8
+ require('./chunk-HICEJ4LV.cjs');
9
+ var chunkXCOZIFHC_cjs = require('./chunk-XCOZIFHC.cjs');
8
10
  var module$1 = require('module');
9
11
  var instrumentationPg = require('@opentelemetry/instrumentation-pg');
10
12
  var instrumentationMysql2 = require('@opentelemetry/instrumentation-mysql2');
@@ -12,10 +14,10 @@ var instrumentation = require('@opentelemetry/instrumentation');
12
14
  var api = require('@opentelemetry/api');
13
15
 
14
16
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
- chunkHNCWTENX_cjs.init_env();
17
+ chunkXCOZIFHC_cjs.init_env();
16
18
  var FULL_INSTALL_TARGETS = {
17
19
  "@anthropic-ai/sdk": {
18
- install: (mod) => chunkLQI63FHF_cjs.instrumentAnthropic({ anthropicModule: mod })
20
+ install: (mod) => chunkSNGYSP7Z_cjs.instrumentAnthropic({ anthropicModule: mod })
19
21
  }
20
22
  };
21
23
  var DETECT_ONLY_TARGETS = {
@@ -89,7 +91,7 @@ function uninstallLazyHook() {
89
91
  originalRequire = null;
90
92
  }
91
93
  async function installAdapters() {
92
- if (chunkHNCWTENX_cjs.isAutoDetectDisabled()) return;
94
+ if (chunkXCOZIFHC_cjs.isAutoDetectDisabled()) return;
93
95
  const nodeRequire = getNodeRequire();
94
96
  if (!nodeRequire) return;
95
97
  const installPromises = [];
@@ -127,11 +129,11 @@ function _resetForTesting3() {
127
129
  }
128
130
 
129
131
  // src/index.ts
130
- chunkHNCWTENX_cjs.init_env();
132
+ chunkXCOZIFHC_cjs.init_env();
131
133
 
132
134
  // src/_internal/db-capture.ts
133
- chunkHNCWTENX_cjs.init_env();
134
- chunkHNCWTENX_cjs.init_otel_provider();
135
+ chunkXCOZIFHC_cjs.init_env();
136
+ chunkXCOZIFHC_cjs.init_otel_provider();
135
137
  var SEMCONV_DB_SYSTEM_NAME = "db.system.name";
136
138
  var SEMCONV_DB_QUERY_TEXT = "db.query.text";
137
139
  var DB_SYSTEM_NAME_SQLITE = "sqlite";
@@ -245,7 +247,7 @@ function registerDbInstrumentation() {
245
247
  disableDbCapture();
246
248
  try {
247
249
  const instrumentations = buildDbInstrumentations();
248
- const off = chunkHNCWTENX_cjs.getEngine().registerInstrumentations(instrumentations);
250
+ const off = chunkXCOZIFHC_cjs.getEngine().registerInstrumentations(instrumentations);
249
251
  if (off === null) return false;
250
252
  unregister = off;
251
253
  registeredInstrumentations = instrumentations;
@@ -267,17 +269,18 @@ function disableDbCapture() {
267
269
  registeredInstrumentations = null;
268
270
  }
269
271
  function maybeEnableDbCaptureFromEnv() {
270
- if (chunkHNCWTENX_cjs.isDbCaptureEnabled()) {
272
+ if (chunkXCOZIFHC_cjs.isDbCaptureEnabled()) {
271
273
  registerDbInstrumentation();
272
274
  }
273
275
  }
274
276
 
275
277
  // src/index.ts
276
- chunkHNCWTENX_cjs.init_otel_provider();
277
- chunkHNCWTENX_cjs.init_redaction();
278
+ chunkXCOZIFHC_cjs.init_otel_provider();
279
+ chunkXCOZIFHC_cjs.init_redaction();
278
280
 
279
281
  // src/_internal/transport.ts
280
- var SDK_VERSION = "0.4.1" ;
282
+ chunkXCOZIFHC_cjs.init_diagnostics();
283
+ var SDK_VERSION = "0.5.0-rc.2" ;
281
284
  var RETRY_AFTER_CAP_SECONDS = 30;
282
285
  function parseRetryAfter(value) {
283
286
  if (!value) return null;
@@ -381,8 +384,14 @@ var BatchTransport = class {
381
384
  }
382
385
  /** Enqueue an event. Non-blocking. Returns false if the queue is full. */
383
386
  track(event) {
384
- if (this.closed) return false;
385
- if (this.queue.length >= this.maxQueueSize) return false;
387
+ if (this.closed) {
388
+ chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_SHUTDOWN_DROP, "trace");
389
+ return false;
390
+ }
391
+ if (this.queue.length >= this.maxQueueSize) {
392
+ chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_QUEUE_FULL, "trace");
393
+ return false;
394
+ }
386
395
  this.queue.push(event);
387
396
  if (this.queue.length >= this.maxBatchSize) {
388
397
  void this.tick();
@@ -467,8 +476,12 @@ var BatchTransport = class {
467
476
  body: JSON.stringify(payload),
468
477
  signal: controller.signal
469
478
  });
479
+ chunkXCOZIFHC_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
480
+ const droppedCount = countPayloadEntries(payload);
481
+ const droppedCategory = categoryOf(payload);
470
482
  if (resp.status === 429) {
471
483
  await recordQuotaState(resp);
484
+ chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
472
485
  }
473
486
  if (!resp.ok) {
474
487
  let bodySnippet = "";
@@ -477,7 +490,10 @@ var BatchTransport = class {
477
490
  bodySnippet = text.slice(0, 200);
478
491
  } catch {
479
492
  }
480
- chunkT2KW3P23_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
493
+ if (resp.status !== 429) {
494
+ chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
495
+ }
496
+ chunkXCOZIFHC_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
481
497
  fingerprint: "morse.transport.post.non_2xx",
482
498
  extra: {
483
499
  endpoint_host: hostnameOf(url),
@@ -486,7 +502,8 @@ var BatchTransport = class {
486
502
  });
487
503
  }
488
504
  } catch (err) {
489
- chunkT2KW3P23_cjs.report(err, {
505
+ chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
506
+ chunkXCOZIFHC_cjs.report(err, {
490
507
  fingerprint: "morse.transport.post.network",
491
508
  extra: {
492
509
  endpoint_host: hostnameOf(url),
@@ -516,11 +533,24 @@ function deriveLogsEndpoint(tracesEndpoint) {
516
533
  return tracesEndpoint.replace(/\/api\/v1\/.*$/, "/api/v1/logs/ingest");
517
534
  }
518
535
  }
536
+ function countPayloadEntries(payload) {
537
+ let total = 0;
538
+ for (const value of Object.values(payload)) {
539
+ if (Array.isArray(value)) total += value.length;
540
+ }
541
+ return total || 1;
542
+ }
543
+ function categoryOf(payload) {
544
+ if ("traces" in payload) return "trace";
545
+ if ("logs" in payload) return "log";
546
+ return "record";
547
+ }
519
548
 
520
549
  // src/index.ts
521
- chunkHNCWTENX_cjs.init_tracing();
522
- chunkHNCWTENX_cjs.init_spans();
523
- chunkHNCWTENX_cjs.init_propagation();
550
+ chunkXCOZIFHC_cjs.init_tracing();
551
+ chunkXCOZIFHC_cjs.init_diagnostics();
552
+ chunkXCOZIFHC_cjs.init_spans();
553
+ chunkXCOZIFHC_cjs.init_propagation();
524
554
  var version = SDK_VERSION;
525
555
  var singleton = null;
526
556
  var transportFactory = (opts) => new BatchTransport(opts);
@@ -540,9 +570,9 @@ function logDestinationOnce(endpoint) {
540
570
  }
541
571
  function resolveEndpoint(explicit) {
542
572
  if (explicit && explicit.length > 0) return explicit;
543
- const fromEnv = chunkHNCWTENX_cjs.getEndpoint();
573
+ const fromEnv = chunkXCOZIFHC_cjs.getEndpoint();
544
574
  if (fromEnv) return fromEnv;
545
- return chunkHNCWTENX_cjs.DEFAULT_ENDPOINT;
575
+ return chunkXCOZIFHC_cjs.DEFAULT_ENDPOINT;
546
576
  }
547
577
  var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
548
578
  function deriveOtlpEndpoint(tracesEndpoint) {
@@ -557,10 +587,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
557
587
  }
558
588
  }
559
589
  function buildSingleton(opts, redaction) {
560
- if (chunkHNCWTENX_cjs.isDisabled()) {
590
+ if (chunkXCOZIFHC_cjs.isDisabled()) {
561
591
  return null;
562
592
  }
563
- const apiKey = opts.apiKey ?? chunkHNCWTENX_cjs.getApiKey();
593
+ const apiKey = opts.apiKey ?? chunkXCOZIFHC_cjs.getApiKey();
564
594
  if (!apiKey) {
565
595
  if (!noApiKeyWarningEmitted) {
566
596
  logger2(
@@ -572,23 +602,23 @@ function buildSingleton(opts, redaction) {
572
602
  return null;
573
603
  }
574
604
  const endpoint = resolveEndpoint(opts.endpoint);
575
- const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkHNCWTENX_cjs.getFlushIntervalSeconds();
605
+ const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkXCOZIFHC_cjs.getFlushIntervalSeconds();
576
606
  const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
577
- chunkHNCWTENX_cjs.setTransport(transport);
578
- chunkHNCWTENX_cjs.setRedactionConfig(redaction);
579
- const explicitSource = chunkHNCWTENX_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
580
- const resolvedSource = explicitSource ?? chunkHNCWTENX_cjs.getInternalSource() ?? null;
581
- chunkHNCWTENX_cjs.setSource(resolvedSource);
607
+ chunkXCOZIFHC_cjs.setTransport(transport);
608
+ chunkXCOZIFHC_cjs.setRedactionConfig(redaction);
609
+ const explicitSource = chunkXCOZIFHC_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
610
+ const resolvedSource = explicitSource ?? chunkXCOZIFHC_cjs.getInternalSource() ?? null;
611
+ chunkXCOZIFHC_cjs.setSource(resolvedSource);
582
612
  logDestinationOnce(endpoint);
583
613
  try {
584
- chunkHNCWTENX_cjs.getEngine().configure({
614
+ chunkXCOZIFHC_cjs.getEngine().configure({
585
615
  endpoint: deriveOtlpEndpoint(endpoint),
586
616
  apiKey,
587
- sampleRate: chunkHNCWTENX_cjs.getSampleRate(),
617
+ sampleRate: chunkXCOZIFHC_cjs.getSampleRate(),
588
618
  scheduleDelayMillis: flushIntervalSeconds * 1e3,
589
- maxQueueSize: chunkHNCWTENX_cjs.getMaxQueueSize(),
590
- maxExportBatchSize: chunkHNCWTENX_cjs.getMaxBatchSize(),
591
- maxFieldBytes: chunkHNCWTENX_cjs.getMaxFieldBytes(),
619
+ maxQueueSize: chunkXCOZIFHC_cjs.getMaxQueueSize(),
620
+ maxExportBatchSize: chunkXCOZIFHC_cjs.getMaxBatchSize(),
621
+ maxFieldBytes: chunkXCOZIFHC_cjs.getMaxFieldBytes(),
592
622
  // 10s (not the exporter's un-overridden 30s ceiling): a genuine
593
623
  // network blip still gets several retries with backoff; a fully dead
594
624
  // endpoint fails within a bounded, shutdown-friendly window instead
@@ -597,32 +627,32 @@ function buildSingleton(opts, redaction) {
597
627
  redactionConfig: redaction
598
628
  });
599
629
  } catch (err) {
600
- chunkT2KW3P23_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
630
+ chunkXCOZIFHC_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
601
631
  }
602
632
  void installAdapters().catch(() => {
603
633
  });
604
634
  try {
605
635
  maybeEnableDbCaptureFromEnv();
606
636
  } catch (err) {
607
- chunkT2KW3P23_cjs.report(err, { fingerprint: "morse.db_capture.register" });
637
+ chunkXCOZIFHC_cjs.report(err, { fingerprint: "morse.db_capture.register" });
608
638
  }
609
639
  return { apiKey, endpoint, transport, redaction };
610
640
  }
611
641
  function ensureInitialized() {
612
- if (chunkHNCWTENX_cjs.isDisabled()) return null;
642
+ if (chunkXCOZIFHC_cjs.isDisabled()) return null;
613
643
  if (singleton !== null) return singleton;
614
- singleton = buildSingleton({}, chunkHNCWTENX_cjs.buildRedactionConfig());
644
+ singleton = buildSingleton({}, chunkXCOZIFHC_cjs.buildRedactionConfig());
615
645
  return singleton;
616
646
  }
617
- chunkQXRJUPDP_cjs._setEnsureInitialized(() => {
647
+ chunkZIER4DGK_cjs._setEnsureInitialized(() => {
618
648
  ensureInitialized();
619
649
  });
620
650
  function init(options = {}) {
621
- if (chunkHNCWTENX_cjs.isDisabled()) {
651
+ if (chunkXCOZIFHC_cjs.isDisabled()) {
622
652
  logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
623
653
  return;
624
654
  }
625
- const redaction = chunkHNCWTENX_cjs.buildRedactionConfig(options.redaction);
655
+ const redaction = chunkXCOZIFHC_cjs.buildRedactionConfig(options.redaction);
626
656
  try {
627
657
  if (singleton !== null) {
628
658
  void singleton.transport.shutdown();
@@ -630,10 +660,10 @@ function init(options = {}) {
630
660
  }
631
661
  singleton = buildSingleton(options, redaction);
632
662
  } catch (err) {
633
- chunkT2KW3P23_cjs.report(err, { fingerprint: "morse.init" });
663
+ chunkXCOZIFHC_cjs.report(err, { fingerprint: "morse.init" });
634
664
  }
635
665
  }
636
- var track = chunkT2KW3P23_cjs.absorbErrorsSync(
666
+ var track = chunk6DZNK4VX_cjs.absorbErrorsSync(
637
667
  (options) => {
638
668
  const state = ensureInitialized();
639
669
  if (!state) return;
@@ -641,33 +671,33 @@ var track = chunkT2KW3P23_cjs.absorbErrorsSync(
641
671
  agent_id: options.agentId,
642
672
  ...options.runData
643
673
  };
644
- const redacted = chunkHNCWTENX_cjs.redactValue(payload, state.redaction);
674
+ const redacted = chunkXCOZIFHC_cjs.redactValue(payload, state.redaction);
645
675
  state.transport.track(redacted);
646
676
  },
647
677
  { fingerprint: "morse.track" }
648
678
  );
649
- var batchTrack = chunkT2KW3P23_cjs.absorbErrorsSync(
679
+ var batchTrack = chunk6DZNK4VX_cjs.absorbErrorsSync(
650
680
  (runs) => {
651
681
  const state = ensureInitialized();
652
682
  if (!state) return;
653
683
  for (const run2 of runs) {
654
- const redacted = chunkHNCWTENX_cjs.redactValue(run2, state.redaction);
684
+ const redacted = chunkXCOZIFHC_cjs.redactValue(run2, state.redaction);
655
685
  state.transport.track(redacted);
656
686
  }
657
687
  },
658
688
  { fingerprint: "morse.batch_track" }
659
689
  );
660
- var record = chunkT2KW3P23_cjs.absorbErrorsSync(
690
+ var record = chunk6DZNK4VX_cjs.absorbErrorsSync(
661
691
  (rec) => {
662
692
  const state = ensureInitialized();
663
693
  if (!state) return;
664
- const traceId = chunkHNCWTENX_cjs.generateTraceId();
665
- const now = chunkHNCWTENX_cjs.nowIso();
694
+ const traceId = chunkXCOZIFHC_cjs.generateTraceId();
695
+ const now = chunkXCOZIFHC_cjs.nowIso();
666
696
  const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
667
697
  const span2 = {
668
698
  trace_id: traceId,
669
- span_id: chunkHNCWTENX_cjs.generateSpanId(),
670
- type: chunkHNCWTENX_cjs.SpanType.AGENT,
699
+ span_id: chunkXCOZIFHC_cjs.generateSpanId(),
700
+ type: chunkXCOZIFHC_cjs.SpanType.AGENT,
671
701
  name: rec.agent,
672
702
  started_at: now,
673
703
  ended_at: now,
@@ -692,57 +722,57 @@ var record = chunkT2KW3P23_cjs.absorbErrorsSync(
692
722
  success: rec.success,
693
723
  outcome: rec.outcome
694
724
  };
695
- const entry = chunkHNCWTENX_cjs.buildTraceEntry(traceFields, [span2]);
696
- const redacted = chunkHNCWTENX_cjs.redactValue(entry, state.redaction);
697
- chunkHNCWTENX_cjs.sendTrace(redacted);
725
+ const entry = chunkXCOZIFHC_cjs.buildTraceEntry(traceFields, [span2]);
726
+ const redacted = chunkXCOZIFHC_cjs.redactValue(entry, state.redaction);
727
+ chunkXCOZIFHC_cjs.sendTrace(redacted);
698
728
  },
699
729
  { fingerprint: "morse.record" }
700
730
  );
701
731
  function run(nameOrOpts, fn) {
702
732
  const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
703
733
  ensureInitialized();
704
- return chunkHNCWTENX_cjs.runSync(opts, fn);
734
+ return chunkXCOZIFHC_cjs.runSync(opts, fn);
705
735
  }
706
736
  function runTraced(options, fn) {
707
737
  ensureInitialized();
708
- return chunkHNCWTENX_cjs.runAsync(options, fn);
738
+ return chunkXCOZIFHC_cjs.runAsync(options, fn);
709
739
  }
710
740
  function setContext2(dims) {
711
- chunkHNCWTENX_cjs.setContext(dims);
741
+ chunkXCOZIFHC_cjs.setContext(dims);
712
742
  }
713
743
  function startSpan2(options) {
714
- return chunkHNCWTENX_cjs.startSpan(options);
744
+ return chunkXCOZIFHC_cjs.startSpan(options);
715
745
  }
716
746
  function span(options, fn) {
717
- return chunkHNCWTENX_cjs.spanSync(options, fn);
747
+ return chunkXCOZIFHC_cjs.spanSync(options, fn);
718
748
  }
719
749
  function spanAsync2(options, fn) {
720
- return chunkHNCWTENX_cjs.spanAsync(options, fn);
750
+ return chunkXCOZIFHC_cjs.spanAsync(options, fn);
721
751
  }
722
- var flush = chunkT2KW3P23_cjs.absorbErrorsAsync(
752
+ var flush = chunk6DZNK4VX_cjs.absorbErrorsAsync(
723
753
  async () => {
724
754
  if (singleton !== null) {
725
755
  await singleton.transport.flush();
726
- await chunkHNCWTENX_cjs.getEngine().flush();
756
+ await chunkXCOZIFHC_cjs.getEngine().flush();
727
757
  }
728
758
  },
729
759
  { fingerprint: "morse.flush" }
730
760
  );
731
- var quotaState2 = chunkT2KW3P23_cjs.absorbErrorsSync(
761
+ var quotaState2 = chunk6DZNK4VX_cjs.absorbErrorsSync(
732
762
  () => {
733
763
  if (singleton === null) return null;
734
764
  return getQuotaState();
735
765
  },
736
766
  { fingerprint: "morse.quota_state" }
737
767
  );
738
- var shutdown = chunkT2KW3P23_cjs.absorbErrorsAsync(
768
+ var shutdown = chunk6DZNK4VX_cjs.absorbErrorsAsync(
739
769
  async () => {
740
770
  if (singleton !== null) {
741
771
  await singleton.transport.shutdown();
742
- await chunkHNCWTENX_cjs.getEngine().flush();
743
- chunkHNCWTENX_cjs.getEngine().shutdown();
772
+ await chunkXCOZIFHC_cjs.getEngine().flush();
773
+ chunkXCOZIFHC_cjs.getEngine().shutdown();
744
774
  singleton = null;
745
- chunkHNCWTENX_cjs.setTransport(null);
775
+ chunkXCOZIFHC_cjs.setTransport(null);
746
776
  }
747
777
  },
748
778
  { fingerprint: "morse.shutdown" }
@@ -751,14 +781,14 @@ function _resetForTesting4() {
751
781
  if (singleton !== null) {
752
782
  void singleton.transport.shutdown();
753
783
  singleton = null;
754
- chunkHNCWTENX_cjs.setTransport(null);
784
+ chunkXCOZIFHC_cjs.setTransport(null);
755
785
  }
756
- chunkHNCWTENX_cjs.getEngine().resetForTesting();
786
+ chunkXCOZIFHC_cjs.getEngine().resetForTesting();
757
787
  noApiKeyWarningEmitted = false;
758
788
  lastLoggedEndpoint = null;
759
- chunkHNCWTENX_cjs.setSource(null);
760
- chunkHNCWTENX_cjs._resetForTesting();
761
- chunkT2KW3P23_cjs._resetForTesting();
789
+ chunkXCOZIFHC_cjs.setSource(null);
790
+ chunkXCOZIFHC_cjs._resetForTesting2();
791
+ chunkXCOZIFHC_cjs._resetForTesting();
762
792
  _resetForTesting3();
763
793
  _resetQuotaStateForTesting();
764
794
  transportFactory = (opts) => new BatchTransport(opts);
@@ -767,59 +797,59 @@ function _setTransportFactoryForTesting(factory) {
767
797
  transportFactory = factory;
768
798
  }
769
799
  function _getLastTraceForTesting() {
770
- return chunkHNCWTENX_cjs.getLastTrace();
800
+ return chunkXCOZIFHC_cjs.getLastTrace();
771
801
  }
772
802
  function _getActiveTraceStateForTesting() {
773
- return chunkHNCWTENX_cjs.getActiveTraceState();
803
+ return chunkXCOZIFHC_cjs.getActiveTraceState();
774
804
  }
775
805
 
776
806
  Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
777
807
  enumerable: true,
778
- get: function () { return chunkLQI63FHF_cjs.MAX_SEGMENT_CONTENT_BYTES; }
808
+ get: function () { return chunkSNGYSP7Z_cjs.MAX_SEGMENT_CONTENT_BYTES; }
779
809
  });
780
810
  Object.defineProperty(exports, "extractAnthropicSegments", {
781
811
  enumerable: true,
782
- get: function () { return chunkLQI63FHF_cjs.extractAnthropicSegments; }
812
+ get: function () { return chunkSNGYSP7Z_cjs.extractAnthropicSegments; }
783
813
  });
784
814
  Object.defineProperty(exports, "instrumentAnthropic", {
785
815
  enumerable: true,
786
- get: function () { return chunkLQI63FHF_cjs.instrumentAnthropic; }
816
+ get: function () { return chunkSNGYSP7Z_cjs.instrumentAnthropic; }
787
817
  });
788
818
  Object.defineProperty(exports, "isAnthropicWrapped", {
789
819
  enumerable: true,
790
- get: function () { return chunkLQI63FHF_cjs.isAnthropicWrapped; }
820
+ get: function () { return chunkSNGYSP7Z_cjs.isAnthropicWrapped; }
791
821
  });
792
822
  Object.defineProperty(exports, "uninstallAnthropic", {
793
823
  enumerable: true,
794
- get: function () { return chunkLQI63FHF_cjs.uninstallAnthropic; }
824
+ get: function () { return chunkSNGYSP7Z_cjs.uninstallAnthropic; }
795
825
  });
796
826
  Object.defineProperty(exports, "wrapAnthropic", {
797
827
  enumerable: true,
798
- get: function () { return chunkLQI63FHF_cjs.wrapAnthropic; }
828
+ get: function () { return chunkSNGYSP7Z_cjs.wrapAnthropic; }
799
829
  });
800
830
  Object.defineProperty(exports, "log", {
801
831
  enumerable: true,
802
- get: function () { return chunkQXRJUPDP_cjs.log; }
832
+ get: function () { return chunkZIER4DGK_cjs.log; }
803
833
  });
804
834
  Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
805
835
  enumerable: true,
806
- get: function () { return chunkHNCWTENX_cjs.W3C_TRACEPARENT_HEADER; }
836
+ get: function () { return chunkXCOZIFHC_cjs.W3C_TRACEPARENT_HEADER; }
807
837
  });
808
838
  Object.defineProperty(exports, "extractTraceparent", {
809
839
  enumerable: true,
810
- get: function () { return chunkHNCWTENX_cjs.extractTraceparent; }
840
+ get: function () { return chunkXCOZIFHC_cjs.extractTraceparent; }
811
841
  });
812
842
  Object.defineProperty(exports, "formatTraceparent", {
813
843
  enumerable: true,
814
- get: function () { return chunkHNCWTENX_cjs.formatTraceparent; }
844
+ get: function () { return chunkXCOZIFHC_cjs.formatTraceparent; }
815
845
  });
816
846
  Object.defineProperty(exports, "injectIntoRequestInit", {
817
847
  enumerable: true,
818
- get: function () { return chunkHNCWTENX_cjs.injectIntoRequestInit; }
848
+ get: function () { return chunkXCOZIFHC_cjs.injectIntoRequestInit; }
819
849
  });
820
850
  Object.defineProperty(exports, "injectTraceparent", {
821
851
  enumerable: true,
822
- get: function () { return chunkHNCWTENX_cjs.injectTraceparent; }
852
+ get: function () { return chunkXCOZIFHC_cjs.injectTraceparent; }
823
853
  });
824
854
  exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
825
855
  exports._getLastTraceForTesting = _getLastTraceForTesting;