@morsehq-dev/sdk 0.5.0-rc.1 → 0.5.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anthropic/index.cjs +11 -11
- package/dist/anthropic/index.js +4 -4
- package/dist/anthropic-agent-sdk/index.cjs +37 -37
- package/dist/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/anthropic/index.cjs +11 -11
- package/dist/browser/anthropic/index.js +4 -4
- package/dist/browser/anthropic-agent-sdk/index.cjs +37 -37
- package/dist/browser/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/{chunk-HZZK2EMO.cjs → chunk-KFWCOUL3.cjs} +5 -5
- package/dist/browser/{chunk-HZZK2EMO.cjs.map → chunk-KFWCOUL3.cjs.map} +1 -1
- package/dist/browser/{chunk-5IWGFPKQ.js → chunk-KGSLJLWW.js} +4 -4
- package/dist/browser/{chunk-5IWGFPKQ.js.map → chunk-KGSLJLWW.js.map} +1 -1
- package/dist/{chunk-TP3N3S2D.js → browser/chunk-LGG5PL5U.js} +3 -3
- package/dist/browser/{chunk-AZ3SVK3K.js.map → chunk-LGG5PL5U.js.map} +1 -1
- package/dist/browser/{chunk-VFNNU3AX.js → chunk-MI4OUWUZ.js} +3 -3
- package/dist/browser/{chunk-VFNNU3AX.js.map → chunk-MI4OUWUZ.js.map} +1 -1
- package/dist/{chunk-O3Q5L2HY.js → browser/chunk-MOBYR3AP.js} +4 -4
- package/dist/browser/{chunk-454FDWBM.js.map → chunk-MOBYR3AP.js.map} +1 -1
- package/dist/browser/{chunk-A7P3ZBZX.js → chunk-N4Q2WMOE.js} +5 -5
- package/dist/browser/{chunk-A7P3ZBZX.js.map → chunk-N4Q2WMOE.js.map} +1 -1
- package/dist/browser/{chunk-FNZWJU64.cjs → chunk-P7XWSMFX.cjs} +6 -6
- package/dist/browser/{chunk-FNZWJU64.cjs.map → chunk-P7XWSMFX.cjs.map} +1 -1
- package/dist/browser/{chunk-ZGYZZCUK.cjs → chunk-PM5D6VXF.cjs} +49 -14
- package/dist/browser/chunk-PM5D6VXF.cjs.map +1 -0
- package/dist/browser/{chunk-WY2VLKRR.cjs → chunk-QCI2ZDQS.cjs} +12 -12
- package/dist/browser/{chunk-WY2VLKRR.cjs.map → chunk-QCI2ZDQS.cjs.map} +1 -1
- package/dist/browser/{chunk-AV35EOER.cjs → chunk-VSG4EWNL.cjs} +18 -18
- package/dist/browser/{chunk-AV35EOER.cjs.map → chunk-VSG4EWNL.cjs.map} +1 -1
- package/dist/browser/{chunk-32U547L3.js → chunk-WUQXNRD3.js} +3 -3
- package/dist/browser/{chunk-32U547L3.js.map → chunk-WUQXNRD3.js.map} +1 -1
- package/dist/{chunk-RF7NI5VN.cjs → browser/chunk-XLQSSJUZ.cjs} +15 -15
- package/dist/browser/{chunk-5EFKNOO7.cjs.map → chunk-XLQSSJUZ.cjs.map} +1 -1
- package/dist/browser/{chunk-6DOP3MTY.js → chunk-Y3BOPSM3.js} +49 -15
- package/dist/browser/chunk-Y3BOPSM3.js.map +1 -0
- package/dist/{chunk-UWQPOWJQ.cjs → browser/chunk-YSJVJ3Z3.cjs} +7 -7
- package/dist/browser/{chunk-NT37C2TK.cjs.map → chunk-YSJVJ3Z3.cjs.map} +1 -1
- package/dist/browser/index.cjs +90 -89
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +9 -8
- 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 +17 -17
- package/dist/browser/langchain/index.js +2 -2
- package/dist/browser/langgraph/index.cjs +27 -27
- package/dist/browser/langgraph/index.js +5 -5
- package/dist/browser/openai/index.cjs +11 -11
- package/dist/browser/openai/index.js +2 -2
- package/dist/browser/openai-agents/index.cjs +38 -36
- package/dist/browser/openai-agents/index.cjs.map +1 -1
- package/dist/browser/openai-agents/index.js +8 -6
- package/dist/browser/openai-agents/index.js.map +1 -1
- package/dist/browser/vercel-ai/index.cjs +14 -14
- package/dist/browser/vercel-ai/index.js +3 -3
- package/dist/{browser/chunk-NT37C2TK.cjs → chunk-3XQOZXJM.cjs} +7 -7
- package/dist/{chunk-UWQPOWJQ.cjs.map → chunk-3XQOZXJM.cjs.map} +1 -1
- package/dist/{browser/chunk-454FDWBM.js → chunk-7PGR4NJG.js} +4 -4
- package/dist/{chunk-O3Q5L2HY.js.map → chunk-7PGR4NJG.js.map} +1 -1
- package/dist/{browser/chunk-5EFKNOO7.cjs → chunk-DPGUBZVO.cjs} +15 -15
- package/dist/{chunk-RF7NI5VN.cjs.map → chunk-DPGUBZVO.cjs.map} +1 -1
- package/dist/{chunk-5B3IUESN.cjs → chunk-E3G3IE6Y.cjs} +49 -14
- package/dist/chunk-E3G3IE6Y.cjs.map +1 -0
- package/dist/{chunk-CECVNM7R.js → chunk-HCEKAVDR.js} +4 -4
- package/dist/{chunk-CECVNM7R.js.map → chunk-HCEKAVDR.js.map} +1 -1
- package/dist/{chunk-VD3KRXSP.cjs → chunk-NGBJJGOC.cjs} +5 -5
- package/dist/{chunk-VD3KRXSP.cjs.map → chunk-NGBJJGOC.cjs.map} +1 -1
- package/dist/{chunk-HSY7V4RG.cjs → chunk-RK3JPX27.cjs} +12 -12
- package/dist/{chunk-HSY7V4RG.cjs.map → chunk-RK3JPX27.cjs.map} +1 -1
- package/dist/{chunk-5RXSICEJ.js → chunk-T2NESDMT.js} +3 -3
- package/dist/{chunk-5RXSICEJ.js.map → chunk-T2NESDMT.js.map} +1 -1
- package/dist/{chunk-7A2EWXZK.cjs → chunk-TGHDV5MC.cjs} +6 -6
- package/dist/{chunk-7A2EWXZK.cjs.map → chunk-TGHDV5MC.cjs.map} +1 -1
- package/dist/{chunk-LB6ZLJUR.js → chunk-UAJO6JM7.js} +3 -3
- package/dist/{chunk-LB6ZLJUR.js.map → chunk-UAJO6JM7.js.map} +1 -1
- package/dist/{chunk-AAR4FYFO.js → chunk-XHOLQGN6.js} +5 -5
- package/dist/{chunk-AAR4FYFO.js.map → chunk-XHOLQGN6.js.map} +1 -1
- package/dist/{chunk-UEKQIRRA.js → chunk-XZRJXJFA.js} +49 -15
- package/dist/chunk-XZRJXJFA.js.map +1 -0
- package/dist/{chunk-ADRVMGAW.cjs → chunk-YQ6ZA7OE.cjs} +18 -18
- package/dist/{chunk-ADRVMGAW.cjs.map → chunk-YQ6ZA7OE.cjs.map} +1 -1
- package/dist/{browser/chunk-AZ3SVK3K.js → chunk-ZFE75G7S.js} +3 -3
- package/dist/{chunk-TP3N3S2D.js.map → chunk-ZFE75G7S.js.map} +1 -1
- package/dist/index.cjs +97 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -9
- 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 +17 -17
- package/dist/langchain/index.js +2 -2
- package/dist/langgraph/index.cjs +27 -27
- package/dist/langgraph/index.js +5 -5
- package/dist/openai/index.cjs +11 -11
- package/dist/openai/index.js +2 -2
- package/dist/openai-agents/index.cjs +38 -36
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.d.cts +4 -0
- package/dist/openai-agents/index.d.ts +4 -0
- package/dist/openai-agents/index.js +8 -6
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/vercel-ai/index.cjs +14 -14
- package/dist/vercel-ai/index.js +3 -3
- package/package.json +1 -1
- package/dist/browser/chunk-6DOP3MTY.js.map +0 -1
- package/dist/browser/chunk-ZGYZZCUK.cjs.map +0 -1
- package/dist/chunk-5B3IUESN.cjs.map +0 -1
- package/dist/chunk-UEKQIRRA.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunkYQ6ZA7OE_cjs = require('./chunk-YQ6ZA7OE.cjs');
|
|
4
|
+
var chunkRK3JPX27_cjs = require('./chunk-RK3JPX27.cjs');
|
|
5
|
+
require('./chunk-NGBJJGOC.cjs');
|
|
6
|
+
var chunkTGHDV5MC_cjs = require('./chunk-TGHDV5MC.cjs');
|
|
7
7
|
require('./chunk-KBWPNIH4.cjs');
|
|
8
8
|
require('./chunk-HICEJ4LV.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkE3G3IE6Y_cjs = require('./chunk-E3G3IE6Y.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
|
-
|
|
17
|
+
chunkE3G3IE6Y_cjs.init_env();
|
|
18
18
|
var FULL_INSTALL_TARGETS = {
|
|
19
19
|
"@anthropic-ai/sdk": {
|
|
20
|
-
install: (mod) =>
|
|
20
|
+
install: (mod) => chunkYQ6ZA7OE_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 (
|
|
94
|
+
if (chunkE3G3IE6Y_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
|
-
|
|
132
|
+
chunkE3G3IE6Y_cjs.init_env();
|
|
133
133
|
|
|
134
134
|
// src/_internal/db-capture.ts
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
chunkE3G3IE6Y_cjs.init_env();
|
|
136
|
+
chunkE3G3IE6Y_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 =
|
|
250
|
+
const off = chunkE3G3IE6Y_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 (
|
|
272
|
+
if (chunkE3G3IE6Y_cjs.isDbCaptureEnabled()) {
|
|
273
273
|
registerDbInstrumentation();
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
// src/index.ts
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
chunkE3G3IE6Y_cjs.init_otel_provider();
|
|
279
|
+
chunkE3G3IE6Y_cjs.init_redaction();
|
|
280
280
|
|
|
281
281
|
// src/_internal/transport.ts
|
|
282
|
-
|
|
283
|
-
var SDK_VERSION = "0.5.0-rc.
|
|
282
|
+
chunkE3G3IE6Y_cjs.init_diagnostics();
|
|
283
|
+
var SDK_VERSION = "0.5.0-rc.3" ;
|
|
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
|
-
|
|
388
|
+
chunkE3G3IE6Y_cjs.recordDrop(chunkE3G3IE6Y_cjs.REASON_SHUTDOWN_DROP, "trace");
|
|
389
389
|
return false;
|
|
390
390
|
}
|
|
391
391
|
if (this.queue.length >= this.maxQueueSize) {
|
|
392
|
-
|
|
392
|
+
chunkE3G3IE6Y_cjs.recordDrop(chunkE3G3IE6Y_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
|
-
|
|
479
|
+
chunkE3G3IE6Y_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
|
-
|
|
484
|
+
chunkE3G3IE6Y_cjs.recordDrop(chunkE3G3IE6Y_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
|
-
|
|
494
|
+
chunkE3G3IE6Y_cjs.recordDrop(chunkE3G3IE6Y_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
|
|
495
495
|
}
|
|
496
|
-
|
|
496
|
+
chunkE3G3IE6Y_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
|
-
|
|
506
|
-
|
|
505
|
+
chunkE3G3IE6Y_cjs.recordDrop(chunkE3G3IE6Y_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
|
|
506
|
+
chunkE3G3IE6Y_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
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
550
|
+
chunkE3G3IE6Y_cjs.init_tracing();
|
|
551
|
+
chunkE3G3IE6Y_cjs.init_diagnostics();
|
|
552
|
+
chunkE3G3IE6Y_cjs.init_spans();
|
|
553
|
+
chunkE3G3IE6Y_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 =
|
|
573
|
+
const fromEnv = chunkE3G3IE6Y_cjs.getEndpoint();
|
|
574
574
|
if (fromEnv) return fromEnv;
|
|
575
|
-
return
|
|
575
|
+
return chunkE3G3IE6Y_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 (
|
|
590
|
+
if (chunkE3G3IE6Y_cjs.isDisabled()) {
|
|
591
591
|
return null;
|
|
592
592
|
}
|
|
593
|
-
const apiKey = opts.apiKey ??
|
|
593
|
+
const apiKey = opts.apiKey ?? chunkE3G3IE6Y_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 ??
|
|
605
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkE3G3IE6Y_cjs.getFlushIntervalSeconds();
|
|
606
606
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
|
|
607
|
+
chunkE3G3IE6Y_cjs.setTransport(transport);
|
|
608
|
+
chunkE3G3IE6Y_cjs.setRedactionConfig(redaction);
|
|
609
|
+
chunkE3G3IE6Y_cjs.setDiagnosticsClientConfig({ apiKey, endpoint });
|
|
610
|
+
const explicitSource = chunkE3G3IE6Y_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
611
|
+
const resolvedSource = explicitSource ?? chunkE3G3IE6Y_cjs.getInternalSource() ?? null;
|
|
612
|
+
chunkE3G3IE6Y_cjs.setSource(resolvedSource);
|
|
612
613
|
logDestinationOnce(endpoint);
|
|
613
614
|
try {
|
|
614
|
-
|
|
615
|
+
chunkE3G3IE6Y_cjs.getEngine().configure({
|
|
615
616
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
616
617
|
apiKey,
|
|
617
|
-
sampleRate:
|
|
618
|
+
sampleRate: chunkE3G3IE6Y_cjs.getSampleRate(),
|
|
618
619
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
619
|
-
maxQueueSize:
|
|
620
|
-
maxExportBatchSize:
|
|
621
|
-
maxFieldBytes:
|
|
620
|
+
maxQueueSize: chunkE3G3IE6Y_cjs.getMaxQueueSize(),
|
|
621
|
+
maxExportBatchSize: chunkE3G3IE6Y_cjs.getMaxBatchSize(),
|
|
622
|
+
maxFieldBytes: chunkE3G3IE6Y_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
|
-
|
|
631
|
+
chunkE3G3IE6Y_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
|
-
|
|
638
|
+
chunkE3G3IE6Y_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 (
|
|
643
|
+
if (chunkE3G3IE6Y_cjs.isDisabled()) return null;
|
|
643
644
|
if (singleton !== null) return singleton;
|
|
644
|
-
singleton = buildSingleton({},
|
|
645
|
+
singleton = buildSingleton({}, chunkE3G3IE6Y_cjs.buildRedactionConfig());
|
|
645
646
|
return singleton;
|
|
646
647
|
}
|
|
647
|
-
|
|
648
|
+
chunkRK3JPX27_cjs._setEnsureInitialized(() => {
|
|
648
649
|
ensureInitialized();
|
|
649
650
|
});
|
|
650
651
|
function init(options = {}) {
|
|
651
|
-
if (
|
|
652
|
+
if (chunkE3G3IE6Y_cjs.isDisabled()) {
|
|
652
653
|
logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
653
654
|
return;
|
|
654
655
|
}
|
|
655
|
-
const redaction =
|
|
656
|
+
const redaction = chunkE3G3IE6Y_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
|
-
|
|
664
|
+
chunkE3G3IE6Y_cjs.report(err, { fingerprint: "morse.init" });
|
|
664
665
|
}
|
|
665
666
|
}
|
|
666
|
-
var track =
|
|
667
|
+
var track = chunkTGHDV5MC_cjs.absorbErrorsSync(
|
|
667
668
|
(options) => {
|
|
668
669
|
const state = ensureInitialized();
|
|
669
670
|
if (!state) return;
|
|
@@ -671,33 +672,33 @@ var track = chunk7A2EWXZK_cjs.absorbErrorsSync(
|
|
|
671
672
|
agent_id: options.agentId,
|
|
672
673
|
...options.runData
|
|
673
674
|
};
|
|
674
|
-
const redacted =
|
|
675
|
+
const redacted = chunkE3G3IE6Y_cjs.redactValue(payload, state.redaction);
|
|
675
676
|
state.transport.track(redacted);
|
|
676
677
|
},
|
|
677
678
|
{ fingerprint: "morse.track" }
|
|
678
679
|
);
|
|
679
|
-
var batchTrack =
|
|
680
|
+
var batchTrack = chunkTGHDV5MC_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 =
|
|
685
|
+
const redacted = chunkE3G3IE6Y_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 =
|
|
691
|
+
var record = chunkTGHDV5MC_cjs.absorbErrorsSync(
|
|
691
692
|
(rec) => {
|
|
692
693
|
const state = ensureInitialized();
|
|
693
694
|
if (!state) return;
|
|
694
|
-
const traceId =
|
|
695
|
-
const now =
|
|
695
|
+
const traceId = chunkE3G3IE6Y_cjs.generateTraceId();
|
|
696
|
+
const now = chunkE3G3IE6Y_cjs.nowIso();
|
|
696
697
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
697
698
|
const span2 = {
|
|
698
699
|
trace_id: traceId,
|
|
699
|
-
span_id:
|
|
700
|
-
type:
|
|
700
|
+
span_id: chunkE3G3IE6Y_cjs.generateSpanId(),
|
|
701
|
+
type: chunkE3G3IE6Y_cjs.SpanType.AGENT,
|
|
701
702
|
name: rec.agent,
|
|
702
703
|
started_at: now,
|
|
703
704
|
ended_at: now,
|
|
@@ -722,57 +723,57 @@ var record = chunk7A2EWXZK_cjs.absorbErrorsSync(
|
|
|
722
723
|
success: rec.success,
|
|
723
724
|
outcome: rec.outcome
|
|
724
725
|
};
|
|
725
|
-
const entry =
|
|
726
|
-
const redacted =
|
|
727
|
-
|
|
726
|
+
const entry = chunkE3G3IE6Y_cjs.buildTraceEntry(traceFields, [span2]);
|
|
727
|
+
const redacted = chunkE3G3IE6Y_cjs.redactValue(entry, state.redaction);
|
|
728
|
+
chunkE3G3IE6Y_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
|
|
735
|
+
return chunkE3G3IE6Y_cjs.runSync(opts, fn);
|
|
735
736
|
}
|
|
736
737
|
function runTraced(options, fn) {
|
|
737
738
|
ensureInitialized();
|
|
738
|
-
return
|
|
739
|
+
return chunkE3G3IE6Y_cjs.runAsync(options, fn);
|
|
739
740
|
}
|
|
740
741
|
function setContext2(dims) {
|
|
741
|
-
|
|
742
|
+
chunkE3G3IE6Y_cjs.setContext(dims);
|
|
742
743
|
}
|
|
743
744
|
function startSpan2(options) {
|
|
744
|
-
return
|
|
745
|
+
return chunkE3G3IE6Y_cjs.startSpan(options);
|
|
745
746
|
}
|
|
746
747
|
function span(options, fn) {
|
|
747
|
-
return
|
|
748
|
+
return chunkE3G3IE6Y_cjs.spanSync(options, fn);
|
|
748
749
|
}
|
|
749
750
|
function spanAsync2(options, fn) {
|
|
750
|
-
return
|
|
751
|
+
return chunkE3G3IE6Y_cjs.spanAsync(options, fn);
|
|
751
752
|
}
|
|
752
|
-
var flush =
|
|
753
|
+
var flush = chunkTGHDV5MC_cjs.absorbErrorsAsync(
|
|
753
754
|
async () => {
|
|
754
755
|
if (singleton !== null) {
|
|
755
756
|
await singleton.transport.flush();
|
|
756
|
-
await
|
|
757
|
+
await chunkE3G3IE6Y_cjs.getEngine().flush();
|
|
757
758
|
}
|
|
758
759
|
},
|
|
759
760
|
{ fingerprint: "morse.flush" }
|
|
760
761
|
);
|
|
761
|
-
var quotaState2 =
|
|
762
|
+
var quotaState2 = chunkTGHDV5MC_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 =
|
|
769
|
+
var shutdown = chunkTGHDV5MC_cjs.absorbErrorsAsync(
|
|
769
770
|
async () => {
|
|
770
771
|
if (singleton !== null) {
|
|
771
772
|
await singleton.transport.shutdown();
|
|
772
|
-
await
|
|
773
|
-
|
|
773
|
+
await chunkE3G3IE6Y_cjs.getEngine().flush();
|
|
774
|
+
chunkE3G3IE6Y_cjs.getEngine().shutdown();
|
|
774
775
|
singleton = null;
|
|
775
|
-
|
|
776
|
+
chunkE3G3IE6Y_cjs.setTransport(null);
|
|
776
777
|
}
|
|
777
778
|
},
|
|
778
779
|
{ fingerprint: "morse.shutdown" }
|
|
@@ -781,14 +782,14 @@ function _resetForTesting4() {
|
|
|
781
782
|
if (singleton !== null) {
|
|
782
783
|
void singleton.transport.shutdown();
|
|
783
784
|
singleton = null;
|
|
784
|
-
|
|
785
|
+
chunkE3G3IE6Y_cjs.setTransport(null);
|
|
785
786
|
}
|
|
786
|
-
|
|
787
|
+
chunkE3G3IE6Y_cjs.getEngine().resetForTesting();
|
|
787
788
|
noApiKeyWarningEmitted = false;
|
|
788
789
|
lastLoggedEndpoint = null;
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
790
|
+
chunkE3G3IE6Y_cjs.setSource(null);
|
|
791
|
+
chunkE3G3IE6Y_cjs._resetForTesting2();
|
|
792
|
+
chunkE3G3IE6Y_cjs._resetForTesting();
|
|
792
793
|
_resetForTesting3();
|
|
793
794
|
_resetQuotaStateForTesting();
|
|
794
795
|
transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -797,59 +798,59 @@ function _setTransportFactoryForTesting(factory) {
|
|
|
797
798
|
transportFactory = factory;
|
|
798
799
|
}
|
|
799
800
|
function _getLastTraceForTesting() {
|
|
800
|
-
return
|
|
801
|
+
return chunkE3G3IE6Y_cjs.getLastTrace();
|
|
801
802
|
}
|
|
802
803
|
function _getActiveTraceStateForTesting() {
|
|
803
|
-
return
|
|
804
|
+
return chunkE3G3IE6Y_cjs.getActiveTraceState();
|
|
804
805
|
}
|
|
805
806
|
|
|
806
807
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
807
808
|
enumerable: true,
|
|
808
|
-
get: function () { return
|
|
809
|
+
get: function () { return chunkYQ6ZA7OE_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
809
810
|
});
|
|
810
811
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
811
812
|
enumerable: true,
|
|
812
|
-
get: function () { return
|
|
813
|
+
get: function () { return chunkYQ6ZA7OE_cjs.extractAnthropicSegments; }
|
|
813
814
|
});
|
|
814
815
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
815
816
|
enumerable: true,
|
|
816
|
-
get: function () { return
|
|
817
|
+
get: function () { return chunkYQ6ZA7OE_cjs.instrumentAnthropic; }
|
|
817
818
|
});
|
|
818
819
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
819
820
|
enumerable: true,
|
|
820
|
-
get: function () { return
|
|
821
|
+
get: function () { return chunkYQ6ZA7OE_cjs.isAnthropicWrapped; }
|
|
821
822
|
});
|
|
822
823
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
823
824
|
enumerable: true,
|
|
824
|
-
get: function () { return
|
|
825
|
+
get: function () { return chunkYQ6ZA7OE_cjs.uninstallAnthropic; }
|
|
825
826
|
});
|
|
826
827
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
827
828
|
enumerable: true,
|
|
828
|
-
get: function () { return
|
|
829
|
+
get: function () { return chunkYQ6ZA7OE_cjs.wrapAnthropic; }
|
|
829
830
|
});
|
|
830
831
|
Object.defineProperty(exports, "log", {
|
|
831
832
|
enumerable: true,
|
|
832
|
-
get: function () { return
|
|
833
|
+
get: function () { return chunkRK3JPX27_cjs.log; }
|
|
833
834
|
});
|
|
834
835
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
835
836
|
enumerable: true,
|
|
836
|
-
get: function () { return
|
|
837
|
+
get: function () { return chunkE3G3IE6Y_cjs.W3C_TRACEPARENT_HEADER; }
|
|
837
838
|
});
|
|
838
839
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
839
840
|
enumerable: true,
|
|
840
|
-
get: function () { return
|
|
841
|
+
get: function () { return chunkE3G3IE6Y_cjs.extractTraceparent; }
|
|
841
842
|
});
|
|
842
843
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
843
844
|
enumerable: true,
|
|
844
|
-
get: function () { return
|
|
845
|
+
get: function () { return chunkE3G3IE6Y_cjs.formatTraceparent; }
|
|
845
846
|
});
|
|
846
847
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
847
848
|
enumerable: true,
|
|
848
|
-
get: function () { return
|
|
849
|
+
get: function () { return chunkE3G3IE6Y_cjs.injectIntoRequestInit; }
|
|
849
850
|
});
|
|
850
851
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
851
852
|
enumerable: true,
|
|
852
|
-
get: function () { return
|
|
853
|
+
get: function () { return chunkE3G3IE6Y_cjs.injectTraceparent; }
|
|
853
854
|
});
|
|
854
855
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
855
856
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|