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

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 (108) hide show
  1. package/README.md +34 -0
  2. package/dist/anthropic/index.cjs +11 -11
  3. package/dist/anthropic/index.js +4 -4
  4. package/dist/anthropic-agent-sdk/index.cjs +37 -37
  5. package/dist/anthropic-agent-sdk/index.js +6 -6
  6. package/dist/browser/anthropic/index.cjs +11 -11
  7. package/dist/browser/anthropic/index.js +4 -4
  8. package/dist/browser/anthropic-agent-sdk/index.cjs +37 -37
  9. package/dist/browser/anthropic-agent-sdk/index.js +6 -6
  10. package/dist/browser/{chunk-63ZI6PGP.cjs → chunk-255AHH2W.cjs} +15 -15
  11. package/dist/browser/{chunk-63ZI6PGP.cjs.map → chunk-255AHH2W.cjs.map} +1 -1
  12. package/dist/browser/{chunk-T4NHSVXH.cjs → chunk-36QTJJT7.cjs} +12 -12
  13. package/dist/browser/{chunk-T4NHSVXH.cjs.map → chunk-36QTJJT7.cjs.map} +1 -1
  14. package/dist/browser/{chunk-A5EYWAOT.cjs → chunk-3H2OJLC2.cjs} +13 -6
  15. package/dist/browser/chunk-3H2OJLC2.cjs.map +1 -0
  16. package/dist/browser/{chunk-YMEU6XQQ.cjs → chunk-3STFITZF.cjs} +6 -6
  17. package/dist/browser/{chunk-YMEU6XQQ.cjs.map → chunk-3STFITZF.cjs.map} +1 -1
  18. package/dist/{chunk-Y2QHMV6H.cjs → browser/chunk-6J6F5LJI.cjs} +7 -7
  19. package/dist/browser/{chunk-N3PXJCOE.cjs.map → chunk-6J6F5LJI.cjs.map} +1 -1
  20. package/dist/{chunk-ZWOSPXS4.js → browser/chunk-E2OVLWAF.js} +3 -3
  21. package/dist/browser/{chunk-AM6LMQCT.js.map → chunk-E2OVLWAF.js.map} +1 -1
  22. package/dist/browser/{chunk-L6FWDEGJ.js → chunk-JR6JN7IZ.js} +4 -4
  23. package/dist/browser/{chunk-L6FWDEGJ.js.map → chunk-JR6JN7IZ.js.map} +1 -1
  24. package/dist/browser/{chunk-NH54DAJP.js → chunk-KXVSMY6L.js} +3 -3
  25. package/dist/browser/{chunk-NH54DAJP.js.map → chunk-KXVSMY6L.js.map} +1 -1
  26. package/dist/browser/{chunk-3MTJGZGX.js → chunk-PIWO5L5N.js} +5 -5
  27. package/dist/browser/{chunk-3MTJGZGX.js.map → chunk-PIWO5L5N.js.map} +1 -1
  28. package/dist/browser/{chunk-SOJYLXCR.cjs → chunk-VOZBYSWK.cjs} +5 -5
  29. package/dist/browser/{chunk-SOJYLXCR.cjs.map → chunk-VOZBYSWK.cjs.map} +1 -1
  30. package/dist/browser/{chunk-FDE32B3R.js → chunk-VZA2EPY3.js} +4 -4
  31. package/dist/browser/{chunk-FDE32B3R.js.map → chunk-VZA2EPY3.js.map} +1 -1
  32. package/dist/browser/{chunk-NRYB5GJT.js → chunk-WIWUEI5Z.js} +3 -3
  33. package/dist/browser/{chunk-NRYB5GJT.js.map → chunk-WIWUEI5Z.js.map} +1 -1
  34. package/dist/browser/{chunk-OOGAYEJF.js → chunk-XD4VWCAC.js} +12 -7
  35. package/dist/browser/chunk-XD4VWCAC.js.map +1 -0
  36. package/dist/browser/{chunk-YR2FCEWM.cjs → chunk-YD7TO4PD.cjs} +18 -18
  37. package/dist/browser/{chunk-YR2FCEWM.cjs.map → chunk-YD7TO4PD.cjs.map} +1 -1
  38. package/dist/browser/index.cjs +91 -89
  39. package/dist/browser/index.cjs.map +1 -1
  40. package/dist/browser/index.js +10 -8
  41. package/dist/browser/index.js.map +1 -1
  42. package/dist/browser/integrations/pino.cjs +4 -4
  43. package/dist/browser/integrations/pino.js +3 -3
  44. package/dist/browser/langchain/index.cjs +17 -17
  45. package/dist/browser/langchain/index.js +2 -2
  46. package/dist/browser/langgraph/index.cjs +27 -27
  47. package/dist/browser/langgraph/index.js +5 -5
  48. package/dist/browser/openai/index.cjs +11 -11
  49. package/dist/browser/openai/index.js +2 -2
  50. package/dist/browser/openai-agents/index.cjs +38 -36
  51. package/dist/browser/openai-agents/index.cjs.map +1 -1
  52. package/dist/browser/openai-agents/index.js +8 -6
  53. package/dist/browser/openai-agents/index.js.map +1 -1
  54. package/dist/browser/vercel-ai/index.cjs +14 -14
  55. package/dist/browser/vercel-ai/index.js +3 -3
  56. package/dist/{chunk-YJYF4NSA.js → chunk-2O2FFJLK.js} +5 -5
  57. package/dist/{chunk-YJYF4NSA.js.map → chunk-2O2FFJLK.js.map} +1 -1
  58. package/dist/{browser/chunk-N3PXJCOE.cjs → chunk-7ZNGY236.cjs} +7 -7
  59. package/dist/{chunk-Y2QHMV6H.cjs.map → chunk-7ZNGY236.cjs.map} +1 -1
  60. package/dist/{chunk-FCAPLB7A.js → chunk-BNMTY7PE.js} +4 -4
  61. package/dist/{chunk-FCAPLB7A.js.map → chunk-BNMTY7PE.js.map} +1 -1
  62. package/dist/{chunk-3IGQWLWE.js → chunk-ELBY4SJ7.js} +12 -7
  63. package/dist/chunk-ELBY4SJ7.js.map +1 -0
  64. package/dist/{chunk-XCOZIFHC.cjs → chunk-HA5RY4N5.cjs} +13 -6
  65. package/dist/chunk-HA5RY4N5.cjs.map +1 -0
  66. package/dist/{chunk-VHF4GWJ4.cjs → chunk-HZKXILBF.cjs} +5 -5
  67. package/dist/{chunk-VHF4GWJ4.cjs.map → chunk-HZKXILBF.cjs.map} +1 -1
  68. package/dist/{browser/chunk-AM6LMQCT.js → chunk-JFFZBCTP.js} +3 -3
  69. package/dist/{chunk-ZWOSPXS4.js.map → chunk-JFFZBCTP.js.map} +1 -1
  70. package/dist/{chunk-SHK2XEPB.js → chunk-MBOISGKD.js} +4 -4
  71. package/dist/{chunk-SHK2XEPB.js.map → chunk-MBOISGKD.js.map} +1 -1
  72. package/dist/{chunk-S4WUABAU.js → chunk-Q6NQQ2LO.js} +3 -3
  73. package/dist/{chunk-S4WUABAU.js.map → chunk-Q6NQQ2LO.js.map} +1 -1
  74. package/dist/{chunk-6DZNK4VX.cjs → chunk-RDFDPK2X.cjs} +6 -6
  75. package/dist/{chunk-6DZNK4VX.cjs.map → chunk-RDFDPK2X.cjs.map} +1 -1
  76. package/dist/{chunk-ZIER4DGK.cjs → chunk-ULWGK6F5.cjs} +12 -12
  77. package/dist/{chunk-ZIER4DGK.cjs.map → chunk-ULWGK6F5.cjs.map} +1 -1
  78. package/dist/{chunk-SNGYSP7Z.cjs → chunk-VM3QM22Z.cjs} +18 -18
  79. package/dist/{chunk-SNGYSP7Z.cjs.map → chunk-VM3QM22Z.cjs.map} +1 -1
  80. package/dist/{chunk-Z2IYSTRT.cjs → chunk-WLNADB4J.cjs} +15 -15
  81. package/dist/{chunk-Z2IYSTRT.cjs.map → chunk-WLNADB4J.cjs.map} +1 -1
  82. package/dist/{chunk-XJUH6PR5.js → chunk-YPP5DDPO.js} +3 -3
  83. package/dist/{chunk-XJUH6PR5.js.map → chunk-YPP5DDPO.js.map} +1 -1
  84. package/dist/index.cjs +98 -96
  85. package/dist/index.cjs.map +1 -1
  86. package/dist/index.js +11 -9
  87. package/dist/index.js.map +1 -1
  88. package/dist/integrations/pino.cjs +4 -4
  89. package/dist/integrations/pino.js +3 -3
  90. package/dist/langchain/index.cjs +17 -17
  91. package/dist/langchain/index.js +2 -2
  92. package/dist/langgraph/index.cjs +27 -27
  93. package/dist/langgraph/index.js +5 -5
  94. package/dist/openai/index.cjs +11 -11
  95. package/dist/openai/index.js +2 -2
  96. package/dist/openai-agents/index.cjs +38 -36
  97. package/dist/openai-agents/index.cjs.map +1 -1
  98. package/dist/openai-agents/index.d.cts +4 -0
  99. package/dist/openai-agents/index.d.ts +4 -0
  100. package/dist/openai-agents/index.js +8 -6
  101. package/dist/openai-agents/index.js.map +1 -1
  102. package/dist/vercel-ai/index.cjs +14 -14
  103. package/dist/vercel-ai/index.js +3 -3
  104. package/package.json +14 -13
  105. package/dist/browser/chunk-A5EYWAOT.cjs.map +0 -1
  106. package/dist/browser/chunk-OOGAYEJF.js.map +0 -1
  107. package/dist/chunk-3IGQWLWE.js.map +0 -1
  108. package/dist/chunk-XCOZIFHC.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
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');
3
+ var chunkVM3QM22Z_cjs = require('./chunk-VM3QM22Z.cjs');
4
+ var chunkULWGK6F5_cjs = require('./chunk-ULWGK6F5.cjs');
5
+ require('./chunk-HZKXILBF.cjs');
6
+ var chunkRDFDPK2X_cjs = require('./chunk-RDFDPK2X.cjs');
7
7
  require('./chunk-KBWPNIH4.cjs');
8
8
  require('./chunk-HICEJ4LV.cjs');
9
- var chunkXCOZIFHC_cjs = require('./chunk-XCOZIFHC.cjs');
9
+ var chunkHA5RY4N5_cjs = require('./chunk-HA5RY4N5.cjs');
10
10
  var module$1 = require('module');
11
11
  var instrumentationPg = require('@opentelemetry/instrumentation-pg');
12
12
  var instrumentationMysql2 = require('@opentelemetry/instrumentation-mysql2');
@@ -14,10 +14,10 @@ var instrumentation = require('@opentelemetry/instrumentation');
14
14
  var api = require('@opentelemetry/api');
15
15
 
16
16
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
17
- chunkXCOZIFHC_cjs.init_env();
17
+ chunkHA5RY4N5_cjs.init_env();
18
18
  var FULL_INSTALL_TARGETS = {
19
19
  "@anthropic-ai/sdk": {
20
- install: (mod) => chunkSNGYSP7Z_cjs.instrumentAnthropic({ anthropicModule: mod })
20
+ install: (mod) => chunkVM3QM22Z_cjs.instrumentAnthropic({ anthropicModule: mod })
21
21
  }
22
22
  };
23
23
  var DETECT_ONLY_TARGETS = {
@@ -91,7 +91,7 @@ function uninstallLazyHook() {
91
91
  originalRequire = null;
92
92
  }
93
93
  async function installAdapters() {
94
- if (chunkXCOZIFHC_cjs.isAutoDetectDisabled()) return;
94
+ if (chunkHA5RY4N5_cjs.isAutoDetectDisabled()) return;
95
95
  const nodeRequire = getNodeRequire();
96
96
  if (!nodeRequire) return;
97
97
  const installPromises = [];
@@ -129,11 +129,11 @@ function _resetForTesting3() {
129
129
  }
130
130
 
131
131
  // src/index.ts
132
- chunkXCOZIFHC_cjs.init_env();
132
+ chunkHA5RY4N5_cjs.init_env();
133
133
 
134
134
  // src/_internal/db-capture.ts
135
- chunkXCOZIFHC_cjs.init_env();
136
- chunkXCOZIFHC_cjs.init_otel_provider();
135
+ chunkHA5RY4N5_cjs.init_env();
136
+ chunkHA5RY4N5_cjs.init_otel_provider();
137
137
  var SEMCONV_DB_SYSTEM_NAME = "db.system.name";
138
138
  var SEMCONV_DB_QUERY_TEXT = "db.query.text";
139
139
  var DB_SYSTEM_NAME_SQLITE = "sqlite";
@@ -247,7 +247,7 @@ function registerDbInstrumentation() {
247
247
  disableDbCapture();
248
248
  try {
249
249
  const instrumentations = buildDbInstrumentations();
250
- const off = chunkXCOZIFHC_cjs.getEngine().registerInstrumentations(instrumentations);
250
+ const off = chunkHA5RY4N5_cjs.getEngine().registerInstrumentations(instrumentations);
251
251
  if (off === null) return false;
252
252
  unregister = off;
253
253
  registeredInstrumentations = instrumentations;
@@ -269,18 +269,18 @@ function disableDbCapture() {
269
269
  registeredInstrumentations = null;
270
270
  }
271
271
  function maybeEnableDbCaptureFromEnv() {
272
- if (chunkXCOZIFHC_cjs.isDbCaptureEnabled()) {
272
+ if (chunkHA5RY4N5_cjs.isDbCaptureEnabled()) {
273
273
  registerDbInstrumentation();
274
274
  }
275
275
  }
276
276
 
277
277
  // src/index.ts
278
- chunkXCOZIFHC_cjs.init_otel_provider();
279
- chunkXCOZIFHC_cjs.init_redaction();
278
+ chunkHA5RY4N5_cjs.init_otel_provider();
279
+ chunkHA5RY4N5_cjs.init_redaction();
280
280
 
281
281
  // src/_internal/transport.ts
282
- chunkXCOZIFHC_cjs.init_diagnostics();
283
- var SDK_VERSION = "0.5.0-rc.2" ;
282
+ chunkHA5RY4N5_cjs.init_diagnostics();
283
+ var SDK_VERSION = "0.5.0-rc.4" ;
284
284
  var RETRY_AFTER_CAP_SECONDS = 30;
285
285
  function parseRetryAfter(value) {
286
286
  if (!value) return null;
@@ -385,11 +385,11 @@ var BatchTransport = class {
385
385
  /** Enqueue an event. Non-blocking. Returns false if the queue is full. */
386
386
  track(event) {
387
387
  if (this.closed) {
388
- chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_SHUTDOWN_DROP, "trace");
388
+ chunkHA5RY4N5_cjs.recordDrop(chunkHA5RY4N5_cjs.REASON_SHUTDOWN_DROP, "trace");
389
389
  return false;
390
390
  }
391
391
  if (this.queue.length >= this.maxQueueSize) {
392
- chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_QUEUE_FULL, "trace");
392
+ chunkHA5RY4N5_cjs.recordDrop(chunkHA5RY4N5_cjs.REASON_QUEUE_FULL, "trace");
393
393
  return false;
394
394
  }
395
395
  this.queue.push(event);
@@ -476,12 +476,12 @@ var BatchTransport = class {
476
476
  body: JSON.stringify(payload),
477
477
  signal: controller.signal
478
478
  });
479
- chunkXCOZIFHC_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
479
+ chunkHA5RY4N5_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
480
480
  const droppedCount = countPayloadEntries(payload);
481
481
  const droppedCategory = categoryOf(payload);
482
482
  if (resp.status === 429) {
483
483
  await recordQuotaState(resp);
484
- chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
484
+ chunkHA5RY4N5_cjs.recordDrop(chunkHA5RY4N5_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
485
485
  }
486
486
  if (!resp.ok) {
487
487
  let bodySnippet = "";
@@ -491,9 +491,9 @@ var BatchTransport = class {
491
491
  } catch {
492
492
  }
493
493
  if (resp.status !== 429) {
494
- chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
494
+ chunkHA5RY4N5_cjs.recordDrop(chunkHA5RY4N5_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
495
495
  }
496
- chunkXCOZIFHC_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
496
+ chunkHA5RY4N5_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
497
497
  fingerprint: "morse.transport.post.non_2xx",
498
498
  extra: {
499
499
  endpoint_host: hostnameOf(url),
@@ -502,8 +502,8 @@ var BatchTransport = class {
502
502
  });
503
503
  }
504
504
  } catch (err) {
505
- chunkXCOZIFHC_cjs.recordDrop(chunkXCOZIFHC_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
506
- chunkXCOZIFHC_cjs.report(err, {
505
+ chunkHA5RY4N5_cjs.recordDrop(chunkHA5RY4N5_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
506
+ chunkHA5RY4N5_cjs.report(err, {
507
507
  fingerprint: "morse.transport.post.network",
508
508
  extra: {
509
509
  endpoint_host: hostnameOf(url),
@@ -547,10 +547,10 @@ function categoryOf(payload) {
547
547
  }
548
548
 
549
549
  // src/index.ts
550
- chunkXCOZIFHC_cjs.init_tracing();
551
- chunkXCOZIFHC_cjs.init_diagnostics();
552
- chunkXCOZIFHC_cjs.init_spans();
553
- chunkXCOZIFHC_cjs.init_propagation();
550
+ chunkHA5RY4N5_cjs.init_tracing();
551
+ chunkHA5RY4N5_cjs.init_diagnostics();
552
+ chunkHA5RY4N5_cjs.init_spans();
553
+ chunkHA5RY4N5_cjs.init_propagation();
554
554
  var version = SDK_VERSION;
555
555
  var singleton = null;
556
556
  var transportFactory = (opts) => new BatchTransport(opts);
@@ -570,9 +570,9 @@ function logDestinationOnce(endpoint) {
570
570
  }
571
571
  function resolveEndpoint(explicit) {
572
572
  if (explicit && explicit.length > 0) return explicit;
573
- const fromEnv = chunkXCOZIFHC_cjs.getEndpoint();
573
+ const fromEnv = chunkHA5RY4N5_cjs.getEndpoint();
574
574
  if (fromEnv) return fromEnv;
575
- return chunkXCOZIFHC_cjs.DEFAULT_ENDPOINT;
575
+ return chunkHA5RY4N5_cjs.DEFAULT_ENDPOINT;
576
576
  }
577
577
  var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
578
578
  function deriveOtlpEndpoint(tracesEndpoint) {
@@ -587,10 +587,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
587
587
  }
588
588
  }
589
589
  function buildSingleton(opts, redaction) {
590
- if (chunkXCOZIFHC_cjs.isDisabled()) {
590
+ if (chunkHA5RY4N5_cjs.isDisabled()) {
591
591
  return null;
592
592
  }
593
- const apiKey = opts.apiKey ?? chunkXCOZIFHC_cjs.getApiKey();
593
+ const apiKey = opts.apiKey ?? chunkHA5RY4N5_cjs.getApiKey();
594
594
  if (!apiKey) {
595
595
  if (!noApiKeyWarningEmitted) {
596
596
  logger2(
@@ -602,23 +602,24 @@ function buildSingleton(opts, redaction) {
602
602
  return null;
603
603
  }
604
604
  const endpoint = resolveEndpoint(opts.endpoint);
605
- const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkXCOZIFHC_cjs.getFlushIntervalSeconds();
605
+ const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkHA5RY4N5_cjs.getFlushIntervalSeconds();
606
606
  const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
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);
607
+ chunkHA5RY4N5_cjs.setTransport(transport);
608
+ chunkHA5RY4N5_cjs.setRedactionConfig(redaction);
609
+ chunkHA5RY4N5_cjs.setDiagnosticsClientConfig({ apiKey, endpoint });
610
+ const explicitSource = chunkHA5RY4N5_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
611
+ const resolvedSource = explicitSource ?? chunkHA5RY4N5_cjs.getInternalSource() ?? null;
612
+ chunkHA5RY4N5_cjs.setSource(resolvedSource);
612
613
  logDestinationOnce(endpoint);
613
614
  try {
614
- chunkXCOZIFHC_cjs.getEngine().configure({
615
+ chunkHA5RY4N5_cjs.getEngine().configure({
615
616
  endpoint: deriveOtlpEndpoint(endpoint),
616
617
  apiKey,
617
- sampleRate: chunkXCOZIFHC_cjs.getSampleRate(),
618
+ sampleRate: chunkHA5RY4N5_cjs.getSampleRate(),
618
619
  scheduleDelayMillis: flushIntervalSeconds * 1e3,
619
- maxQueueSize: chunkXCOZIFHC_cjs.getMaxQueueSize(),
620
- maxExportBatchSize: chunkXCOZIFHC_cjs.getMaxBatchSize(),
621
- maxFieldBytes: chunkXCOZIFHC_cjs.getMaxFieldBytes(),
620
+ maxQueueSize: chunkHA5RY4N5_cjs.getMaxQueueSize(),
621
+ maxExportBatchSize: chunkHA5RY4N5_cjs.getMaxBatchSize(),
622
+ maxFieldBytes: chunkHA5RY4N5_cjs.getMaxFieldBytes(),
622
623
  // 10s (not the exporter's un-overridden 30s ceiling): a genuine
623
624
  // network blip still gets several retries with backoff; a fully dead
624
625
  // endpoint fails within a bounded, shutdown-friendly window instead
@@ -627,32 +628,32 @@ function buildSingleton(opts, redaction) {
627
628
  redactionConfig: redaction
628
629
  });
629
630
  } catch (err) {
630
- chunkXCOZIFHC_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
631
+ chunkHA5RY4N5_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
631
632
  }
632
633
  void installAdapters().catch(() => {
633
634
  });
634
635
  try {
635
636
  maybeEnableDbCaptureFromEnv();
636
637
  } catch (err) {
637
- chunkXCOZIFHC_cjs.report(err, { fingerprint: "morse.db_capture.register" });
638
+ chunkHA5RY4N5_cjs.report(err, { fingerprint: "morse.db_capture.register" });
638
639
  }
639
640
  return { apiKey, endpoint, transport, redaction };
640
641
  }
641
642
  function ensureInitialized() {
642
- if (chunkXCOZIFHC_cjs.isDisabled()) return null;
643
+ if (chunkHA5RY4N5_cjs.isDisabled()) return null;
643
644
  if (singleton !== null) return singleton;
644
- singleton = buildSingleton({}, chunkXCOZIFHC_cjs.buildRedactionConfig());
645
+ singleton = buildSingleton({}, chunkHA5RY4N5_cjs.buildRedactionConfig());
645
646
  return singleton;
646
647
  }
647
- chunkZIER4DGK_cjs._setEnsureInitialized(() => {
648
+ chunkULWGK6F5_cjs._setEnsureInitialized(() => {
648
649
  ensureInitialized();
649
650
  });
650
651
  function init(options = {}) {
651
- if (chunkXCOZIFHC_cjs.isDisabled()) {
652
+ if (chunkHA5RY4N5_cjs.isDisabled()) {
652
653
  logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
653
654
  return;
654
655
  }
655
- const redaction = chunkXCOZIFHC_cjs.buildRedactionConfig(options.redaction);
656
+ const redaction = chunkHA5RY4N5_cjs.buildRedactionConfig(options.redaction);
656
657
  try {
657
658
  if (singleton !== null) {
658
659
  void singleton.transport.shutdown();
@@ -660,10 +661,10 @@ function init(options = {}) {
660
661
  }
661
662
  singleton = buildSingleton(options, redaction);
662
663
  } catch (err) {
663
- chunkXCOZIFHC_cjs.report(err, { fingerprint: "morse.init" });
664
+ chunkHA5RY4N5_cjs.report(err, { fingerprint: "morse.init" });
664
665
  }
665
666
  }
666
- var track = chunk6DZNK4VX_cjs.absorbErrorsSync(
667
+ var track = chunkRDFDPK2X_cjs.absorbErrorsSync(
667
668
  (options) => {
668
669
  const state = ensureInitialized();
669
670
  if (!state) return;
@@ -671,33 +672,33 @@ var track = chunk6DZNK4VX_cjs.absorbErrorsSync(
671
672
  agent_id: options.agentId,
672
673
  ...options.runData
673
674
  };
674
- const redacted = chunkXCOZIFHC_cjs.redactValue(payload, state.redaction);
675
+ const redacted = chunkHA5RY4N5_cjs.redactValue(payload, state.redaction);
675
676
  state.transport.track(redacted);
676
677
  },
677
678
  { fingerprint: "morse.track" }
678
679
  );
679
- var batchTrack = chunk6DZNK4VX_cjs.absorbErrorsSync(
680
+ var batchTrack = chunkRDFDPK2X_cjs.absorbErrorsSync(
680
681
  (runs) => {
681
682
  const state = ensureInitialized();
682
683
  if (!state) return;
683
684
  for (const run2 of runs) {
684
- const redacted = chunkXCOZIFHC_cjs.redactValue(run2, state.redaction);
685
+ const redacted = chunkHA5RY4N5_cjs.redactValue(run2, state.redaction);
685
686
  state.transport.track(redacted);
686
687
  }
687
688
  },
688
689
  { fingerprint: "morse.batch_track" }
689
690
  );
690
- var record = chunk6DZNK4VX_cjs.absorbErrorsSync(
691
+ var record = chunkRDFDPK2X_cjs.absorbErrorsSync(
691
692
  (rec) => {
692
693
  const state = ensureInitialized();
693
694
  if (!state) return;
694
- const traceId = chunkXCOZIFHC_cjs.generateTraceId();
695
- const now = chunkXCOZIFHC_cjs.nowIso();
695
+ const traceId = chunkHA5RY4N5_cjs.generateTraceId();
696
+ const now = chunkHA5RY4N5_cjs.nowIso();
696
697
  const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
697
698
  const span2 = {
698
699
  trace_id: traceId,
699
- span_id: chunkXCOZIFHC_cjs.generateSpanId(),
700
- type: chunkXCOZIFHC_cjs.SpanType.AGENT,
700
+ span_id: chunkHA5RY4N5_cjs.generateSpanId(),
701
+ type: chunkHA5RY4N5_cjs.SpanType.AGENT,
701
702
  name: rec.agent,
702
703
  started_at: now,
703
704
  ended_at: now,
@@ -722,57 +723,58 @@ var record = chunk6DZNK4VX_cjs.absorbErrorsSync(
722
723
  success: rec.success,
723
724
  outcome: rec.outcome
724
725
  };
725
- const entry = chunkXCOZIFHC_cjs.buildTraceEntry(traceFields, [span2]);
726
- const redacted = chunkXCOZIFHC_cjs.redactValue(entry, state.redaction);
727
- chunkXCOZIFHC_cjs.sendTrace(redacted);
726
+ const entry = chunkHA5RY4N5_cjs.buildTraceEntry(traceFields, [span2]);
727
+ const redacted = chunkHA5RY4N5_cjs.redactValue(entry, state.redaction);
728
+ chunkHA5RY4N5_cjs.sendTrace(redacted);
728
729
  },
729
730
  { fingerprint: "morse.record" }
730
731
  );
731
732
  function run(nameOrOpts, fn) {
732
733
  const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
733
734
  ensureInitialized();
734
- return chunkXCOZIFHC_cjs.runSync(opts, fn);
735
+ return chunkHA5RY4N5_cjs.runSync(opts, fn);
735
736
  }
736
737
  function runTraced(options, fn) {
737
738
  ensureInitialized();
738
- return chunkXCOZIFHC_cjs.runAsync(options, fn);
739
+ return chunkHA5RY4N5_cjs.runAsync(options, fn);
739
740
  }
740
741
  function setContext2(dims) {
741
- chunkXCOZIFHC_cjs.setContext(dims);
742
+ chunkHA5RY4N5_cjs.setContext(dims);
742
743
  }
743
744
  function startSpan2(options) {
744
- return chunkXCOZIFHC_cjs.startSpan(options);
745
+ return chunkHA5RY4N5_cjs.startSpan(options);
745
746
  }
746
747
  function span(options, fn) {
747
- return chunkXCOZIFHC_cjs.spanSync(options, fn);
748
+ return chunkHA5RY4N5_cjs.spanSync(options, fn);
748
749
  }
749
750
  function spanAsync2(options, fn) {
750
- return chunkXCOZIFHC_cjs.spanAsync(options, fn);
751
+ return chunkHA5RY4N5_cjs.spanAsync(options, fn);
751
752
  }
752
- var flush = chunk6DZNK4VX_cjs.absorbErrorsAsync(
753
+ var flush = chunkRDFDPK2X_cjs.absorbErrorsAsync(
753
754
  async () => {
754
755
  if (singleton !== null) {
755
756
  await singleton.transport.flush();
756
- await chunkXCOZIFHC_cjs.getEngine().flush();
757
+ await chunkHA5RY4N5_cjs.getEngine().flush();
757
758
  }
758
759
  },
759
760
  { fingerprint: "morse.flush" }
760
761
  );
761
- var quotaState2 = chunk6DZNK4VX_cjs.absorbErrorsSync(
762
+ var quotaState2 = chunkRDFDPK2X_cjs.absorbErrorsSync(
762
763
  () => {
763
764
  if (singleton === null) return null;
764
765
  return getQuotaState();
765
766
  },
766
767
  { fingerprint: "morse.quota_state" }
767
768
  );
768
- var shutdown = chunk6DZNK4VX_cjs.absorbErrorsAsync(
769
+ var shutdown = chunkRDFDPK2X_cjs.absorbErrorsAsync(
769
770
  async () => {
770
771
  if (singleton !== null) {
771
772
  await singleton.transport.shutdown();
772
- await chunkXCOZIFHC_cjs.getEngine().flush();
773
- chunkXCOZIFHC_cjs.getEngine().shutdown();
773
+ await chunkHA5RY4N5_cjs.getEngine().flush();
774
+ chunkHA5RY4N5_cjs.getEngine().shutdown();
775
+ await chunkHA5RY4N5_cjs.flushOnce();
774
776
  singleton = null;
775
- chunkXCOZIFHC_cjs.setTransport(null);
777
+ chunkHA5RY4N5_cjs.setTransport(null);
776
778
  }
777
779
  },
778
780
  { fingerprint: "morse.shutdown" }
@@ -781,14 +783,14 @@ function _resetForTesting4() {
781
783
  if (singleton !== null) {
782
784
  void singleton.transport.shutdown();
783
785
  singleton = null;
784
- chunkXCOZIFHC_cjs.setTransport(null);
786
+ chunkHA5RY4N5_cjs.setTransport(null);
785
787
  }
786
- chunkXCOZIFHC_cjs.getEngine().resetForTesting();
788
+ chunkHA5RY4N5_cjs.getEngine().resetForTesting();
787
789
  noApiKeyWarningEmitted = false;
788
790
  lastLoggedEndpoint = null;
789
- chunkXCOZIFHC_cjs.setSource(null);
790
- chunkXCOZIFHC_cjs._resetForTesting2();
791
- chunkXCOZIFHC_cjs._resetForTesting();
791
+ chunkHA5RY4N5_cjs.setSource(null);
792
+ chunkHA5RY4N5_cjs._resetForTesting2();
793
+ chunkHA5RY4N5_cjs._resetForTesting();
792
794
  _resetForTesting3();
793
795
  _resetQuotaStateForTesting();
794
796
  transportFactory = (opts) => new BatchTransport(opts);
@@ -797,59 +799,59 @@ function _setTransportFactoryForTesting(factory) {
797
799
  transportFactory = factory;
798
800
  }
799
801
  function _getLastTraceForTesting() {
800
- return chunkXCOZIFHC_cjs.getLastTrace();
802
+ return chunkHA5RY4N5_cjs.getLastTrace();
801
803
  }
802
804
  function _getActiveTraceStateForTesting() {
803
- return chunkXCOZIFHC_cjs.getActiveTraceState();
805
+ return chunkHA5RY4N5_cjs.getActiveTraceState();
804
806
  }
805
807
 
806
808
  Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
807
809
  enumerable: true,
808
- get: function () { return chunkSNGYSP7Z_cjs.MAX_SEGMENT_CONTENT_BYTES; }
810
+ get: function () { return chunkVM3QM22Z_cjs.MAX_SEGMENT_CONTENT_BYTES; }
809
811
  });
810
812
  Object.defineProperty(exports, "extractAnthropicSegments", {
811
813
  enumerable: true,
812
- get: function () { return chunkSNGYSP7Z_cjs.extractAnthropicSegments; }
814
+ get: function () { return chunkVM3QM22Z_cjs.extractAnthropicSegments; }
813
815
  });
814
816
  Object.defineProperty(exports, "instrumentAnthropic", {
815
817
  enumerable: true,
816
- get: function () { return chunkSNGYSP7Z_cjs.instrumentAnthropic; }
818
+ get: function () { return chunkVM3QM22Z_cjs.instrumentAnthropic; }
817
819
  });
818
820
  Object.defineProperty(exports, "isAnthropicWrapped", {
819
821
  enumerable: true,
820
- get: function () { return chunkSNGYSP7Z_cjs.isAnthropicWrapped; }
822
+ get: function () { return chunkVM3QM22Z_cjs.isAnthropicWrapped; }
821
823
  });
822
824
  Object.defineProperty(exports, "uninstallAnthropic", {
823
825
  enumerable: true,
824
- get: function () { return chunkSNGYSP7Z_cjs.uninstallAnthropic; }
826
+ get: function () { return chunkVM3QM22Z_cjs.uninstallAnthropic; }
825
827
  });
826
828
  Object.defineProperty(exports, "wrapAnthropic", {
827
829
  enumerable: true,
828
- get: function () { return chunkSNGYSP7Z_cjs.wrapAnthropic; }
830
+ get: function () { return chunkVM3QM22Z_cjs.wrapAnthropic; }
829
831
  });
830
832
  Object.defineProperty(exports, "log", {
831
833
  enumerable: true,
832
- get: function () { return chunkZIER4DGK_cjs.log; }
834
+ get: function () { return chunkULWGK6F5_cjs.log; }
833
835
  });
834
836
  Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
835
837
  enumerable: true,
836
- get: function () { return chunkXCOZIFHC_cjs.W3C_TRACEPARENT_HEADER; }
838
+ get: function () { return chunkHA5RY4N5_cjs.W3C_TRACEPARENT_HEADER; }
837
839
  });
838
840
  Object.defineProperty(exports, "extractTraceparent", {
839
841
  enumerable: true,
840
- get: function () { return chunkXCOZIFHC_cjs.extractTraceparent; }
842
+ get: function () { return chunkHA5RY4N5_cjs.extractTraceparent; }
841
843
  });
842
844
  Object.defineProperty(exports, "formatTraceparent", {
843
845
  enumerable: true,
844
- get: function () { return chunkXCOZIFHC_cjs.formatTraceparent; }
846
+ get: function () { return chunkHA5RY4N5_cjs.formatTraceparent; }
845
847
  });
846
848
  Object.defineProperty(exports, "injectIntoRequestInit", {
847
849
  enumerable: true,
848
- get: function () { return chunkXCOZIFHC_cjs.injectIntoRequestInit; }
850
+ get: function () { return chunkHA5RY4N5_cjs.injectIntoRequestInit; }
849
851
  });
850
852
  Object.defineProperty(exports, "injectTraceparent", {
851
853
  enumerable: true,
852
- get: function () { return chunkXCOZIFHC_cjs.injectTraceparent; }
854
+ get: function () { return chunkHA5RY4N5_cjs.injectTraceparent; }
853
855
  });
854
856
  exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
855
857
  exports._getLastTraceForTesting = _getLastTraceForTesting;