@morsehq-dev/sdk 0.4.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.
- package/dist/anthropic/index.cjs +12 -10
- package/dist/anthropic/index.js +5 -3
- package/dist/anthropic-agent-sdk/index.cjs +52 -34
- package/dist/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/anthropic-agent-sdk/index.js +25 -7
- package/dist/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/anthropic/index.cjs +12 -10
- package/dist/browser/anthropic/index.js +5 -3
- package/dist/browser/anthropic-agent-sdk/index.cjs +52 -34
- package/dist/browser/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/browser/anthropic-agent-sdk/index.js +25 -7
- package/dist/browser/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/chunk-32U547L3.js +118 -0
- package/dist/browser/chunk-32U547L3.js.map +1 -0
- package/dist/{chunk-SBGY5NS4.js → browser/chunk-454FDWBM.js} +6 -4
- package/dist/browser/chunk-454FDWBM.js.map +1 -0
- package/dist/browser/{chunk-EFUQVASI.cjs → chunk-5EFKNOO7.cjs} +17 -15
- package/dist/browser/chunk-5EFKNOO7.cjs.map +1 -0
- package/dist/browser/{chunk-DOLWR7LD.js → chunk-5IWGFPKQ.js} +4 -4
- package/dist/browser/{chunk-DOLWR7LD.js.map → chunk-5IWGFPKQ.js.map} +1 -1
- package/dist/browser/{chunk-F3B4UR64.js → chunk-6DOP3MTY.js} +386 -53
- package/dist/browser/chunk-6DOP3MTY.js.map +1 -0
- package/dist/browser/{chunk-GWJYOQNC.js → chunk-A7P3ZBZX.js} +10 -4
- package/dist/browser/chunk-A7P3ZBZX.js.map +1 -0
- package/dist/browser/{chunk-M2GZJ3RS.cjs → chunk-AV35EOER.cjs} +20 -14
- package/dist/browser/chunk-AV35EOER.cjs.map +1 -0
- package/dist/browser/{chunk-AYNX24P5.js → chunk-AZ3SVK3K.js} +3 -3
- package/dist/browser/{chunk-AYNX24P5.js.map → chunk-AZ3SVK3K.js.map} +1 -1
- package/dist/browser/chunk-FNZWJU64.cjs +31 -0
- package/dist/browser/chunk-FNZWJU64.cjs.map +1 -0
- package/dist/browser/chunk-HZZK2EMO.cjs +126 -0
- package/dist/browser/chunk-HZZK2EMO.cjs.map +1 -0
- package/dist/browser/{chunk-QWRQJO57.js → chunk-MLDVXMQD.js} +3 -3
- package/dist/browser/{chunk-QWRQJO57.js.map → chunk-MLDVXMQD.js.map} +1 -1
- package/dist/{chunk-Y7SVGUKY.cjs → browser/chunk-NT37C2TK.cjs} +7 -7
- package/dist/browser/{chunk-YNUZGKUA.cjs.map → chunk-NT37C2TK.cjs.map} +1 -1
- package/dist/browser/{chunk-3643DC7K.cjs → chunk-RBNCTHK3.cjs} +5 -2
- package/dist/browser/{chunk-3643DC7K.cjs.map → chunk-RBNCTHK3.cjs.map} +1 -1
- package/dist/browser/chunk-VFNNU3AX.js +28 -0
- package/dist/browser/chunk-VFNNU3AX.js.map +1 -0
- package/dist/browser/{chunk-HGN7J3EU.cjs → chunk-WY2VLKRR.cjs} +12 -12
- package/dist/browser/{chunk-HGN7J3EU.cjs.map → chunk-WY2VLKRR.cjs.map} +1 -1
- package/dist/browser/{chunk-DXWHT3HK.cjs → chunk-ZGYZZCUK.cjs} +391 -55
- package/dist/browser/chunk-ZGYZZCUK.cjs.map +1 -0
- package/dist/browser/index.cjs +112 -82
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +40 -10
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/integrations/pino.cjs +4 -4
- package/dist/browser/integrations/pino.js +3 -3
- package/dist/browser/langchain/index.cjs +19 -19
- package/dist/browser/langchain/index.js +3 -3
- package/dist/browser/langgraph/index.cjs +34 -26
- package/dist/browser/langgraph/index.cjs.map +1 -1
- package/dist/browser/langgraph/index.js +16 -8
- package/dist/browser/langgraph/index.js.map +1 -1
- package/dist/browser/openai/index.cjs +22 -8
- package/dist/browser/openai/index.cjs.map +1 -1
- package/dist/browser/openai/index.js +17 -3
- package/dist/browser/openai/index.js.map +1 -1
- package/dist/browser/openai-agents/index.cjs +42 -34
- package/dist/browser/openai-agents/index.cjs.map +1 -1
- package/dist/browser/openai-agents/index.js +13 -5
- package/dist/browser/openai-agents/index.js.map +1 -1
- package/dist/browser/vercel-ai/index.cjs +16 -16
- package/dist/browser/vercel-ai/index.js +4 -4
- package/dist/{chunk-4R4SHGOK.js → chunk-4JPZV2VZ.js} +3 -3
- package/dist/{chunk-4R4SHGOK.js.map → chunk-4JPZV2VZ.js.map} +1 -1
- package/dist/{chunk-HNCWTENX.cjs → chunk-5B3IUESN.cjs} +415 -70
- package/dist/chunk-5B3IUESN.cjs.map +1 -0
- package/dist/chunk-5RXSICEJ.js +118 -0
- package/dist/chunk-5RXSICEJ.js.map +1 -0
- package/dist/chunk-7A2EWXZK.cjs +31 -0
- package/dist/chunk-7A2EWXZK.cjs.map +1 -0
- package/dist/{chunk-STK4KJQ6.js → chunk-AAR4FYFO.js} +10 -4
- package/dist/chunk-AAR4FYFO.js.map +1 -0
- package/dist/{chunk-LQI63FHF.cjs → chunk-ADRVMGAW.cjs} +20 -14
- package/dist/chunk-ADRVMGAW.cjs.map +1 -0
- package/dist/{chunk-V5J6J4ZR.js → chunk-CECVNM7R.js} +4 -4
- package/dist/{chunk-V5J6J4ZR.js.map → chunk-CECVNM7R.js.map} +1 -1
- package/dist/{chunk-KJEO52QS.cjs → chunk-HICEJ4LV.cjs} +5 -2
- package/dist/{chunk-KJEO52QS.cjs.map → chunk-HICEJ4LV.cjs.map} +1 -1
- package/dist/{chunk-QXRJUPDP.cjs → chunk-HSY7V4RG.cjs} +12 -12
- package/dist/{chunk-QXRJUPDP.cjs.map → chunk-HSY7V4RG.cjs.map} +1 -1
- package/dist/chunk-LB6ZLJUR.js +28 -0
- package/dist/chunk-LB6ZLJUR.js.map +1 -0
- package/dist/{browser/chunk-F7BGQ26H.js → chunk-O3Q5L2HY.js} +6 -4
- package/dist/chunk-O3Q5L2HY.js.map +1 -0
- package/dist/{chunk-5D6SBSEI.cjs → chunk-RF7NI5VN.cjs} +17 -15
- package/dist/chunk-RF7NI5VN.cjs.map +1 -0
- package/dist/{chunk-AEFUXEKV.js → chunk-TP3N3S2D.js} +3 -3
- package/dist/{chunk-AEFUXEKV.js.map → chunk-TP3N3S2D.js.map} +1 -1
- package/dist/{chunk-LTKGLXAE.js → chunk-UEKQIRRA.js} +410 -68
- package/dist/chunk-UEKQIRRA.js.map +1 -0
- package/dist/{browser/chunk-YNUZGKUA.cjs → chunk-UWQPOWJQ.cjs} +7 -7
- package/dist/{chunk-Y7SVGUKY.cjs.map → chunk-UWQPOWJQ.cjs.map} +1 -1
- package/dist/chunk-VD3KRXSP.cjs +126 -0
- package/dist/chunk-VD3KRXSP.cjs.map +1 -0
- package/dist/index.cjs +119 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/dist/integrations/pino.cjs +4 -4
- package/dist/integrations/pino.js +3 -3
- package/dist/langchain/index.cjs +19 -19
- package/dist/langchain/index.d.cts +1 -1
- package/dist/langchain/index.d.ts +1 -1
- package/dist/langchain/index.js +3 -3
- package/dist/langgraph/index.cjs +34 -26
- package/dist/langgraph/index.cjs.map +1 -1
- package/dist/langgraph/index.d.cts +1 -1
- package/dist/langgraph/index.d.ts +1 -1
- package/dist/langgraph/index.js +16 -8
- package/dist/langgraph/index.js.map +1 -1
- package/dist/openai/index.cjs +22 -8
- package/dist/openai/index.cjs.map +1 -1
- package/dist/openai/index.js +17 -3
- package/dist/openai/index.js.map +1 -1
- package/dist/openai-agents/index.cjs +42 -34
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.js +13 -5
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/{tracing-BYAqjT5Q.d.cts → tracing-CNlre8TK.d.cts} +1 -0
- package/dist/{tracing-rz9cWQ8d.d.ts → tracing-J8ZgxVzU.d.ts} +1 -0
- package/dist/vercel-ai/index.cjs +16 -16
- package/dist/vercel-ai/index.js +4 -4
- package/package.json +1 -9
- package/dist/browser/chunk-3BGG7GH3.cjs +0 -183
- package/dist/browser/chunk-3BGG7GH3.cjs.map +0 -1
- package/dist/browser/chunk-DXWHT3HK.cjs.map +0 -1
- package/dist/browser/chunk-EFUQVASI.cjs.map +0 -1
- package/dist/browser/chunk-F3B4UR64.js.map +0 -1
- package/dist/browser/chunk-F7BGQ26H.js.map +0 -1
- package/dist/browser/chunk-GWJYOQNC.js.map +0 -1
- package/dist/browser/chunk-M2GZJ3RS.cjs.map +0 -1
- package/dist/browser/chunk-YHV5GL32.js +0 -178
- package/dist/browser/chunk-YHV5GL32.js.map +0 -1
- package/dist/chunk-5D6SBSEI.cjs.map +0 -1
- package/dist/chunk-HNCWTENX.cjs.map +0 -1
- package/dist/chunk-LQI63FHF.cjs.map +0 -1
- package/dist/chunk-LTKGLXAE.js.map +0 -1
- package/dist/chunk-POCQNSVD.js +0 -178
- package/dist/chunk-POCQNSVD.js.map +0 -1
- package/dist/chunk-SBGY5NS4.js.map +0 -1
- package/dist/chunk-STK4KJQ6.js.map +0 -1
- package/dist/chunk-T2KW3P23.cjs +0 -183
- 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
|
|
4
|
-
var
|
|
5
|
-
|
|
3
|
+
var chunkADRVMGAW_cjs = require('./chunk-ADRVMGAW.cjs');
|
|
4
|
+
var chunkHSY7V4RG_cjs = require('./chunk-HSY7V4RG.cjs');
|
|
5
|
+
require('./chunk-VD3KRXSP.cjs');
|
|
6
|
+
var chunk7A2EWXZK_cjs = require('./chunk-7A2EWXZK.cjs');
|
|
6
7
|
require('./chunk-KBWPNIH4.cjs');
|
|
7
|
-
|
|
8
|
+
require('./chunk-HICEJ4LV.cjs');
|
|
9
|
+
var chunk5B3IUESN_cjs = require('./chunk-5B3IUESN.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
|
-
|
|
17
|
+
chunk5B3IUESN_cjs.init_env();
|
|
16
18
|
var FULL_INSTALL_TARGETS = {
|
|
17
19
|
"@anthropic-ai/sdk": {
|
|
18
|
-
install: (mod) =>
|
|
20
|
+
install: (mod) => chunkADRVMGAW_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 (
|
|
94
|
+
if (chunk5B3IUESN_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
|
-
|
|
132
|
+
chunk5B3IUESN_cjs.init_env();
|
|
131
133
|
|
|
132
134
|
// src/_internal/db-capture.ts
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
chunk5B3IUESN_cjs.init_env();
|
|
136
|
+
chunk5B3IUESN_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 =
|
|
250
|
+
const off = chunk5B3IUESN_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 (
|
|
272
|
+
if (chunk5B3IUESN_cjs.isDbCaptureEnabled()) {
|
|
271
273
|
registerDbInstrumentation();
|
|
272
274
|
}
|
|
273
275
|
}
|
|
274
276
|
|
|
275
277
|
// src/index.ts
|
|
276
|
-
|
|
277
|
-
|
|
278
|
+
chunk5B3IUESN_cjs.init_otel_provider();
|
|
279
|
+
chunk5B3IUESN_cjs.init_redaction();
|
|
278
280
|
|
|
279
281
|
// src/_internal/transport.ts
|
|
280
|
-
|
|
282
|
+
chunk5B3IUESN_cjs.init_diagnostics();
|
|
283
|
+
var SDK_VERSION = "0.5.0-rc.1" ;
|
|
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)
|
|
385
|
-
|
|
387
|
+
if (this.closed) {
|
|
388
|
+
chunk5B3IUESN_cjs.recordDrop(chunk5B3IUESN_cjs.REASON_SHUTDOWN_DROP, "trace");
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
if (this.queue.length >= this.maxQueueSize) {
|
|
392
|
+
chunk5B3IUESN_cjs.recordDrop(chunk5B3IUESN_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
|
+
chunk5B3IUESN_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
|
+
chunk5B3IUESN_cjs.recordDrop(chunk5B3IUESN_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
|
-
|
|
493
|
+
if (resp.status !== 429) {
|
|
494
|
+
chunk5B3IUESN_cjs.recordDrop(chunk5B3IUESN_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
|
|
495
|
+
}
|
|
496
|
+
chunk5B3IUESN_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
|
-
|
|
505
|
+
chunk5B3IUESN_cjs.recordDrop(chunk5B3IUESN_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
|
|
506
|
+
chunk5B3IUESN_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
|
-
|
|
522
|
-
|
|
523
|
-
|
|
550
|
+
chunk5B3IUESN_cjs.init_tracing();
|
|
551
|
+
chunk5B3IUESN_cjs.init_diagnostics();
|
|
552
|
+
chunk5B3IUESN_cjs.init_spans();
|
|
553
|
+
chunk5B3IUESN_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 =
|
|
573
|
+
const fromEnv = chunk5B3IUESN_cjs.getEndpoint();
|
|
544
574
|
if (fromEnv) return fromEnv;
|
|
545
|
-
return
|
|
575
|
+
return chunk5B3IUESN_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 (
|
|
590
|
+
if (chunk5B3IUESN_cjs.isDisabled()) {
|
|
561
591
|
return null;
|
|
562
592
|
}
|
|
563
|
-
const apiKey = opts.apiKey ??
|
|
593
|
+
const apiKey = opts.apiKey ?? chunk5B3IUESN_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 ??
|
|
605
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunk5B3IUESN_cjs.getFlushIntervalSeconds();
|
|
576
606
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
const explicitSource =
|
|
580
|
-
const resolvedSource = explicitSource ??
|
|
581
|
-
|
|
607
|
+
chunk5B3IUESN_cjs.setTransport(transport);
|
|
608
|
+
chunk5B3IUESN_cjs.setRedactionConfig(redaction);
|
|
609
|
+
const explicitSource = chunk5B3IUESN_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
610
|
+
const resolvedSource = explicitSource ?? chunk5B3IUESN_cjs.getInternalSource() ?? null;
|
|
611
|
+
chunk5B3IUESN_cjs.setSource(resolvedSource);
|
|
582
612
|
logDestinationOnce(endpoint);
|
|
583
613
|
try {
|
|
584
|
-
|
|
614
|
+
chunk5B3IUESN_cjs.getEngine().configure({
|
|
585
615
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
586
616
|
apiKey,
|
|
587
|
-
sampleRate:
|
|
617
|
+
sampleRate: chunk5B3IUESN_cjs.getSampleRate(),
|
|
588
618
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
589
|
-
maxQueueSize:
|
|
590
|
-
maxExportBatchSize:
|
|
591
|
-
maxFieldBytes:
|
|
619
|
+
maxQueueSize: chunk5B3IUESN_cjs.getMaxQueueSize(),
|
|
620
|
+
maxExportBatchSize: chunk5B3IUESN_cjs.getMaxBatchSize(),
|
|
621
|
+
maxFieldBytes: chunk5B3IUESN_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
|
-
|
|
630
|
+
chunk5B3IUESN_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
|
-
|
|
637
|
+
chunk5B3IUESN_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 (
|
|
642
|
+
if (chunk5B3IUESN_cjs.isDisabled()) return null;
|
|
613
643
|
if (singleton !== null) return singleton;
|
|
614
|
-
singleton = buildSingleton({},
|
|
644
|
+
singleton = buildSingleton({}, chunk5B3IUESN_cjs.buildRedactionConfig());
|
|
615
645
|
return singleton;
|
|
616
646
|
}
|
|
617
|
-
|
|
647
|
+
chunkHSY7V4RG_cjs._setEnsureInitialized(() => {
|
|
618
648
|
ensureInitialized();
|
|
619
649
|
});
|
|
620
650
|
function init(options = {}) {
|
|
621
|
-
if (
|
|
651
|
+
if (chunk5B3IUESN_cjs.isDisabled()) {
|
|
622
652
|
logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
623
653
|
return;
|
|
624
654
|
}
|
|
625
|
-
const redaction =
|
|
655
|
+
const redaction = chunk5B3IUESN_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
|
-
|
|
663
|
+
chunk5B3IUESN_cjs.report(err, { fingerprint: "morse.init" });
|
|
634
664
|
}
|
|
635
665
|
}
|
|
636
|
-
var track =
|
|
666
|
+
var track = chunk7A2EWXZK_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 =
|
|
674
|
+
const redacted = chunk5B3IUESN_cjs.redactValue(payload, state.redaction);
|
|
645
675
|
state.transport.track(redacted);
|
|
646
676
|
},
|
|
647
677
|
{ fingerprint: "morse.track" }
|
|
648
678
|
);
|
|
649
|
-
var batchTrack =
|
|
679
|
+
var batchTrack = chunk7A2EWXZK_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 =
|
|
684
|
+
const redacted = chunk5B3IUESN_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 =
|
|
690
|
+
var record = chunk7A2EWXZK_cjs.absorbErrorsSync(
|
|
661
691
|
(rec) => {
|
|
662
692
|
const state = ensureInitialized();
|
|
663
693
|
if (!state) return;
|
|
664
|
-
const traceId =
|
|
665
|
-
const now =
|
|
694
|
+
const traceId = chunk5B3IUESN_cjs.generateTraceId();
|
|
695
|
+
const now = chunk5B3IUESN_cjs.nowIso();
|
|
666
696
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
667
697
|
const span2 = {
|
|
668
698
|
trace_id: traceId,
|
|
669
|
-
span_id:
|
|
670
|
-
type:
|
|
699
|
+
span_id: chunk5B3IUESN_cjs.generateSpanId(),
|
|
700
|
+
type: chunk5B3IUESN_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 =
|
|
696
|
-
const redacted =
|
|
697
|
-
|
|
725
|
+
const entry = chunk5B3IUESN_cjs.buildTraceEntry(traceFields, [span2]);
|
|
726
|
+
const redacted = chunk5B3IUESN_cjs.redactValue(entry, state.redaction);
|
|
727
|
+
chunk5B3IUESN_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
|
|
734
|
+
return chunk5B3IUESN_cjs.runSync(opts, fn);
|
|
705
735
|
}
|
|
706
736
|
function runTraced(options, fn) {
|
|
707
737
|
ensureInitialized();
|
|
708
|
-
return
|
|
738
|
+
return chunk5B3IUESN_cjs.runAsync(options, fn);
|
|
709
739
|
}
|
|
710
740
|
function setContext2(dims) {
|
|
711
|
-
|
|
741
|
+
chunk5B3IUESN_cjs.setContext(dims);
|
|
712
742
|
}
|
|
713
743
|
function startSpan2(options) {
|
|
714
|
-
return
|
|
744
|
+
return chunk5B3IUESN_cjs.startSpan(options);
|
|
715
745
|
}
|
|
716
746
|
function span(options, fn) {
|
|
717
|
-
return
|
|
747
|
+
return chunk5B3IUESN_cjs.spanSync(options, fn);
|
|
718
748
|
}
|
|
719
749
|
function spanAsync2(options, fn) {
|
|
720
|
-
return
|
|
750
|
+
return chunk5B3IUESN_cjs.spanAsync(options, fn);
|
|
721
751
|
}
|
|
722
|
-
var flush =
|
|
752
|
+
var flush = chunk7A2EWXZK_cjs.absorbErrorsAsync(
|
|
723
753
|
async () => {
|
|
724
754
|
if (singleton !== null) {
|
|
725
755
|
await singleton.transport.flush();
|
|
726
|
-
await
|
|
756
|
+
await chunk5B3IUESN_cjs.getEngine().flush();
|
|
727
757
|
}
|
|
728
758
|
},
|
|
729
759
|
{ fingerprint: "morse.flush" }
|
|
730
760
|
);
|
|
731
|
-
var quotaState2 =
|
|
761
|
+
var quotaState2 = chunk7A2EWXZK_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 =
|
|
768
|
+
var shutdown = chunk7A2EWXZK_cjs.absorbErrorsAsync(
|
|
739
769
|
async () => {
|
|
740
770
|
if (singleton !== null) {
|
|
741
771
|
await singleton.transport.shutdown();
|
|
742
|
-
await
|
|
743
|
-
|
|
772
|
+
await chunk5B3IUESN_cjs.getEngine().flush();
|
|
773
|
+
chunk5B3IUESN_cjs.getEngine().shutdown();
|
|
744
774
|
singleton = null;
|
|
745
|
-
|
|
775
|
+
chunk5B3IUESN_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
|
-
|
|
784
|
+
chunk5B3IUESN_cjs.setTransport(null);
|
|
755
785
|
}
|
|
756
|
-
|
|
786
|
+
chunk5B3IUESN_cjs.getEngine().resetForTesting();
|
|
757
787
|
noApiKeyWarningEmitted = false;
|
|
758
788
|
lastLoggedEndpoint = null;
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
789
|
+
chunk5B3IUESN_cjs.setSource(null);
|
|
790
|
+
chunk5B3IUESN_cjs._resetForTesting2();
|
|
791
|
+
chunk5B3IUESN_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
|
|
800
|
+
return chunk5B3IUESN_cjs.getLastTrace();
|
|
771
801
|
}
|
|
772
802
|
function _getActiveTraceStateForTesting() {
|
|
773
|
-
return
|
|
803
|
+
return chunk5B3IUESN_cjs.getActiveTraceState();
|
|
774
804
|
}
|
|
775
805
|
|
|
776
806
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
777
807
|
enumerable: true,
|
|
778
|
-
get: function () { return
|
|
808
|
+
get: function () { return chunkADRVMGAW_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
779
809
|
});
|
|
780
810
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
781
811
|
enumerable: true,
|
|
782
|
-
get: function () { return
|
|
812
|
+
get: function () { return chunkADRVMGAW_cjs.extractAnthropicSegments; }
|
|
783
813
|
});
|
|
784
814
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
785
815
|
enumerable: true,
|
|
786
|
-
get: function () { return
|
|
816
|
+
get: function () { return chunkADRVMGAW_cjs.instrumentAnthropic; }
|
|
787
817
|
});
|
|
788
818
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
789
819
|
enumerable: true,
|
|
790
|
-
get: function () { return
|
|
820
|
+
get: function () { return chunkADRVMGAW_cjs.isAnthropicWrapped; }
|
|
791
821
|
});
|
|
792
822
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
793
823
|
enumerable: true,
|
|
794
|
-
get: function () { return
|
|
824
|
+
get: function () { return chunkADRVMGAW_cjs.uninstallAnthropic; }
|
|
795
825
|
});
|
|
796
826
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
797
827
|
enumerable: true,
|
|
798
|
-
get: function () { return
|
|
828
|
+
get: function () { return chunkADRVMGAW_cjs.wrapAnthropic; }
|
|
799
829
|
});
|
|
800
830
|
Object.defineProperty(exports, "log", {
|
|
801
831
|
enumerable: true,
|
|
802
|
-
get: function () { return
|
|
832
|
+
get: function () { return chunkHSY7V4RG_cjs.log; }
|
|
803
833
|
});
|
|
804
834
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
805
835
|
enumerable: true,
|
|
806
|
-
get: function () { return
|
|
836
|
+
get: function () { return chunk5B3IUESN_cjs.W3C_TRACEPARENT_HEADER; }
|
|
807
837
|
});
|
|
808
838
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
809
839
|
enumerable: true,
|
|
810
|
-
get: function () { return
|
|
840
|
+
get: function () { return chunk5B3IUESN_cjs.extractTraceparent; }
|
|
811
841
|
});
|
|
812
842
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
813
843
|
enumerable: true,
|
|
814
|
-
get: function () { return
|
|
844
|
+
get: function () { return chunk5B3IUESN_cjs.formatTraceparent; }
|
|
815
845
|
});
|
|
816
846
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
817
847
|
enumerable: true,
|
|
818
|
-
get: function () { return
|
|
848
|
+
get: function () { return chunk5B3IUESN_cjs.injectIntoRequestInit; }
|
|
819
849
|
});
|
|
820
850
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
821
851
|
enumerable: true,
|
|
822
|
-
get: function () { return
|
|
852
|
+
get: function () { return chunk5B3IUESN_cjs.injectTraceparent; }
|
|
823
853
|
});
|
|
824
854
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
825
855
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|