@morsehq-dev/sdk 0.5.0-rc.4 → 0.5.0-rc.6
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/README.md +17 -12
- package/dist/anthropic/index.cjs +11 -11
- package/dist/anthropic/index.js +4 -4
- package/dist/anthropic-agent-sdk/index.cjs +157 -102
- package/dist/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/anthropic-agent-sdk/index.d.cts +57 -34
- package/dist/anthropic-agent-sdk/index.d.ts +57 -34
- package/dist/anthropic-agent-sdk/index.js +126 -72
- package/dist/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/anthropic/index.cjs +11 -11
- package/dist/browser/anthropic/index.js +4 -4
- package/dist/browser/anthropic-agent-sdk/index.cjs +157 -102
- package/dist/browser/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/browser/anthropic-agent-sdk/index.js +126 -72
- package/dist/browser/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/{chunk-WIWUEI5Z.js → chunk-2LZCQD3J.js} +3 -3
- package/dist/browser/{chunk-WIWUEI5Z.js.map → chunk-2LZCQD3J.js.map} +1 -1
- package/dist/browser/{chunk-3STFITZF.cjs → chunk-6YPVIGD2.cjs} +6 -6
- package/dist/browser/{chunk-3STFITZF.cjs.map → chunk-6YPVIGD2.cjs.map} +1 -1
- package/dist/browser/{chunk-YD7TO4PD.cjs → chunk-DQ4JWHYH.cjs} +18 -18
- package/dist/browser/{chunk-YD7TO4PD.cjs.map → chunk-DQ4JWHYH.cjs.map} +1 -1
- package/dist/browser/{chunk-JR6JN7IZ.js → chunk-FDWPKINR.js} +4 -4
- package/dist/browser/{chunk-JR6JN7IZ.js.map → chunk-FDWPKINR.js.map} +1 -1
- package/dist/browser/{chunk-E2OVLWAF.js → chunk-IXCAR4UA.js} +3 -3
- package/dist/browser/{chunk-E2OVLWAF.js.map → chunk-IXCAR4UA.js.map} +1 -1
- package/dist/browser/{chunk-PIWO5L5N.js → chunk-JNF26SQM.js} +5 -5
- package/dist/browser/{chunk-PIWO5L5N.js.map → chunk-JNF26SQM.js.map} +1 -1
- package/dist/browser/{chunk-XD4VWCAC.js → chunk-MIHCAKQ2.js} +23 -15
- package/dist/browser/chunk-MIHCAKQ2.js.map +1 -0
- package/dist/browser/{chunk-6J6F5LJI.cjs → chunk-NK6D2G5O.cjs} +7 -7
- package/dist/browser/{chunk-6J6F5LJI.cjs.map → chunk-NK6D2G5O.cjs.map} +1 -1
- package/dist/browser/{chunk-KXVSMY6L.js → chunk-PHE4P3DN.js} +3 -3
- package/dist/browser/{chunk-KXVSMY6L.js.map → chunk-PHE4P3DN.js.map} +1 -1
- package/dist/browser/{chunk-255AHH2W.cjs → chunk-PNUCUOUA.cjs} +15 -15
- package/dist/browser/{chunk-255AHH2W.cjs.map → chunk-PNUCUOUA.cjs.map} +1 -1
- package/dist/browser/{chunk-36QTJJT7.cjs → chunk-TGN4FEKB.cjs} +12 -12
- package/dist/browser/{chunk-36QTJJT7.cjs.map → chunk-TGN4FEKB.cjs.map} +1 -1
- package/dist/{chunk-BNMTY7PE.js → browser/chunk-TIZ5QRK2.js} +4 -4
- package/dist/browser/{chunk-VZA2EPY3.js.map → chunk-TIZ5QRK2.js.map} +1 -1
- package/dist/browser/{chunk-3H2OJLC2.cjs → chunk-WG45SF7N.cjs} +23 -15
- package/dist/browser/chunk-WG45SF7N.cjs.map +1 -0
- package/dist/browser/{chunk-VOZBYSWK.cjs → chunk-ZAISDHUV.cjs} +5 -5
- package/dist/browser/{chunk-VOZBYSWK.cjs.map → chunk-ZAISDHUV.cjs.map} +1 -1
- package/dist/browser/index.cjs +91 -91
- package/dist/browser/index.js +8 -8
- 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 +34 -34
- package/dist/browser/openai-agents/index.js +4 -4
- package/dist/browser/vercel-ai/index.cjs +14 -14
- package/dist/browser/vercel-ai/index.js +3 -3
- package/dist/{chunk-YPP5DDPO.js → chunk-2GWOF5JM.js} +3 -3
- package/dist/{chunk-YPP5DDPO.js.map → chunk-2GWOF5JM.js.map} +1 -1
- package/dist/{chunk-VM3QM22Z.cjs → chunk-4QY5O46P.cjs} +18 -18
- package/dist/{chunk-VM3QM22Z.cjs.map → chunk-4QY5O46P.cjs.map} +1 -1
- package/dist/{chunk-ELBY4SJ7.js → chunk-5YJXFU5U.js} +23 -15
- package/dist/chunk-5YJXFU5U.js.map +1 -0
- package/dist/{chunk-HZKXILBF.cjs → chunk-AT3YR5SP.cjs} +5 -5
- package/dist/{chunk-HZKXILBF.cjs.map → chunk-AT3YR5SP.cjs.map} +1 -1
- package/dist/{chunk-7ZNGY236.cjs → chunk-B3WEUUUK.cjs} +7 -7
- package/dist/{chunk-7ZNGY236.cjs.map → chunk-B3WEUUUK.cjs.map} +1 -1
- package/dist/{chunk-MBOISGKD.js → chunk-DK3RX7RS.js} +4 -4
- package/dist/{chunk-MBOISGKD.js.map → chunk-DK3RX7RS.js.map} +1 -1
- package/dist/{chunk-ULWGK6F5.cjs → chunk-K4FHTOBB.cjs} +12 -12
- package/dist/{chunk-ULWGK6F5.cjs.map → chunk-K4FHTOBB.cjs.map} +1 -1
- package/dist/{browser/chunk-VZA2EPY3.js → chunk-LEDIWC2M.js} +4 -4
- package/dist/{chunk-BNMTY7PE.js.map → chunk-LEDIWC2M.js.map} +1 -1
- package/dist/{chunk-Q6NQQ2LO.js → chunk-QTATKDEI.js} +3 -3
- package/dist/{chunk-Q6NQQ2LO.js.map → chunk-QTATKDEI.js.map} +1 -1
- package/dist/{chunk-JFFZBCTP.js → chunk-T5UFHQLZ.js} +3 -3
- package/dist/{chunk-JFFZBCTP.js.map → chunk-T5UFHQLZ.js.map} +1 -1
- package/dist/{chunk-RDFDPK2X.cjs → chunk-TEWSIQ6E.cjs} +6 -6
- package/dist/{chunk-RDFDPK2X.cjs.map → chunk-TEWSIQ6E.cjs.map} +1 -1
- package/dist/{chunk-HA5RY4N5.cjs → chunk-UV5FUVNK.cjs} +23 -15
- package/dist/chunk-UV5FUVNK.cjs.map +1 -0
- package/dist/{chunk-2O2FFJLK.js → chunk-Z2AYPTB2.js} +5 -5
- package/dist/{chunk-2O2FFJLK.js.map → chunk-Z2AYPTB2.js.map} +1 -1
- package/dist/{chunk-WLNADB4J.cjs → chunk-ZFZTJXIO.cjs} +15 -15
- package/dist/{chunk-WLNADB4J.cjs.map → chunk-ZFZTJXIO.cjs.map} +1 -1
- package/dist/index.cjs +104 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -10
- 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 +34 -34
- package/dist/openai-agents/index.js +4 -4
- 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-3H2OJLC2.cjs.map +0 -1
- package/dist/browser/chunk-XD4VWCAC.js.map +0 -1
- package/dist/chunk-ELBY4SJ7.js.map +0 -1
- package/dist/chunk-HA5RY4N5.cjs.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 chunk4QY5O46P_cjs = require('./chunk-4QY5O46P.cjs');
|
|
4
|
+
var chunkK4FHTOBB_cjs = require('./chunk-K4FHTOBB.cjs');
|
|
5
|
+
require('./chunk-AT3YR5SP.cjs');
|
|
6
|
+
var chunkTEWSIQ6E_cjs = require('./chunk-TEWSIQ6E.cjs');
|
|
7
7
|
require('./chunk-KBWPNIH4.cjs');
|
|
8
8
|
require('./chunk-HICEJ4LV.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkUV5FUVNK_cjs = require('./chunk-UV5FUVNK.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,16 +14,21 @@ 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
|
+
chunkUV5FUVNK_cjs.init_env();
|
|
18
18
|
var FULL_INSTALL_TARGETS = {
|
|
19
19
|
"@anthropic-ai/sdk": {
|
|
20
|
-
install: (mod) =>
|
|
20
|
+
install: (mod) => chunk4QY5O46P_cjs.instrumentAnthropic({ anthropicModule: mod })
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
var DETECT_ONLY_TARGETS = {
|
|
24
24
|
"@openai/agents": "wrapRunnerWithFullInstrumentation(runner) from '@morsehq-dev/sdk/openai-agents'",
|
|
25
25
|
"@langchain/langgraph": "new MorseCallbackHandler() from '@morsehq-dev/sdk/langgraph', passed via { callbacks: [...] }",
|
|
26
|
-
|
|
26
|
+
// MHQ-936: same shape as `ai` below. The package exports a top-level
|
|
27
|
+
// `query` that is read-only and non-configurable, so it cannot be patched
|
|
28
|
+
// in place; and it has no client class to patch a prototype on
|
|
29
|
+
// (`ClaudeSDKClient` is the *Python* package's API and has never existed
|
|
30
|
+
// here). wrapClaudeAgentQuery() returns a traced replacement instead.
|
|
31
|
+
"@anthropic-ai/claude-agent-sdk": "wrapClaudeAgentQuery(query) from '@morsehq-dev/sdk/anthropic-agent-sdk' \u2014 call its returned function in place of the package's own query()",
|
|
27
32
|
// MHQ-758: `ai`'s exports can't be patched in place (frozen ESM getters,
|
|
28
33
|
// no prototype to patch) — createTracedVercelAI() returns replacement
|
|
29
34
|
// functions instead. See `../vercel-ai/index.ts`'s module doc.
|
|
@@ -91,7 +96,7 @@ function uninstallLazyHook() {
|
|
|
91
96
|
originalRequire = null;
|
|
92
97
|
}
|
|
93
98
|
async function installAdapters() {
|
|
94
|
-
if (
|
|
99
|
+
if (chunkUV5FUVNK_cjs.isAutoDetectDisabled()) return;
|
|
95
100
|
const nodeRequire = getNodeRequire();
|
|
96
101
|
if (!nodeRequire) return;
|
|
97
102
|
const installPromises = [];
|
|
@@ -129,11 +134,11 @@ function _resetForTesting3() {
|
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
// src/index.ts
|
|
132
|
-
|
|
137
|
+
chunkUV5FUVNK_cjs.init_env();
|
|
133
138
|
|
|
134
139
|
// src/_internal/db-capture.ts
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
chunkUV5FUVNK_cjs.init_env();
|
|
141
|
+
chunkUV5FUVNK_cjs.init_otel_provider();
|
|
137
142
|
var SEMCONV_DB_SYSTEM_NAME = "db.system.name";
|
|
138
143
|
var SEMCONV_DB_QUERY_TEXT = "db.query.text";
|
|
139
144
|
var DB_SYSTEM_NAME_SQLITE = "sqlite";
|
|
@@ -247,7 +252,7 @@ function registerDbInstrumentation() {
|
|
|
247
252
|
disableDbCapture();
|
|
248
253
|
try {
|
|
249
254
|
const instrumentations = buildDbInstrumentations();
|
|
250
|
-
const off =
|
|
255
|
+
const off = chunkUV5FUVNK_cjs.getEngine().registerInstrumentations(instrumentations);
|
|
251
256
|
if (off === null) return false;
|
|
252
257
|
unregister = off;
|
|
253
258
|
registeredInstrumentations = instrumentations;
|
|
@@ -269,18 +274,18 @@ function disableDbCapture() {
|
|
|
269
274
|
registeredInstrumentations = null;
|
|
270
275
|
}
|
|
271
276
|
function maybeEnableDbCaptureFromEnv() {
|
|
272
|
-
if (
|
|
277
|
+
if (chunkUV5FUVNK_cjs.isDbCaptureEnabled()) {
|
|
273
278
|
registerDbInstrumentation();
|
|
274
279
|
}
|
|
275
280
|
}
|
|
276
281
|
|
|
277
282
|
// src/index.ts
|
|
278
|
-
|
|
279
|
-
|
|
283
|
+
chunkUV5FUVNK_cjs.init_otel_provider();
|
|
284
|
+
chunkUV5FUVNK_cjs.init_redaction();
|
|
280
285
|
|
|
281
286
|
// src/_internal/transport.ts
|
|
282
|
-
|
|
283
|
-
var SDK_VERSION = "0.5.0-rc.
|
|
287
|
+
chunkUV5FUVNK_cjs.init_diagnostics();
|
|
288
|
+
var SDK_VERSION = "0.5.0-rc.6" ;
|
|
284
289
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
285
290
|
function parseRetryAfter(value) {
|
|
286
291
|
if (!value) return null;
|
|
@@ -385,11 +390,11 @@ var BatchTransport = class {
|
|
|
385
390
|
/** Enqueue an event. Non-blocking. Returns false if the queue is full. */
|
|
386
391
|
track(event) {
|
|
387
392
|
if (this.closed) {
|
|
388
|
-
|
|
393
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_SHUTDOWN_DROP, "trace");
|
|
389
394
|
return false;
|
|
390
395
|
}
|
|
391
396
|
if (this.queue.length >= this.maxQueueSize) {
|
|
392
|
-
|
|
397
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_QUEUE_FULL, "trace");
|
|
393
398
|
return false;
|
|
394
399
|
}
|
|
395
400
|
this.queue.push(event);
|
|
@@ -476,12 +481,12 @@ var BatchTransport = class {
|
|
|
476
481
|
body: JSON.stringify(payload),
|
|
477
482
|
signal: controller.signal
|
|
478
483
|
});
|
|
479
|
-
|
|
484
|
+
chunkUV5FUVNK_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
|
|
480
485
|
const droppedCount = countPayloadEntries(payload);
|
|
481
486
|
const droppedCategory = categoryOf(payload);
|
|
482
487
|
if (resp.status === 429) {
|
|
483
488
|
await recordQuotaState(resp);
|
|
484
|
-
|
|
489
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
|
|
485
490
|
}
|
|
486
491
|
if (!resp.ok) {
|
|
487
492
|
let bodySnippet = "";
|
|
@@ -491,9 +496,9 @@ var BatchTransport = class {
|
|
|
491
496
|
} catch {
|
|
492
497
|
}
|
|
493
498
|
if (resp.status !== 429) {
|
|
494
|
-
|
|
499
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
|
|
495
500
|
}
|
|
496
|
-
|
|
501
|
+
chunkUV5FUVNK_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
|
|
497
502
|
fingerprint: "morse.transport.post.non_2xx",
|
|
498
503
|
extra: {
|
|
499
504
|
endpoint_host: hostnameOf(url),
|
|
@@ -502,8 +507,8 @@ var BatchTransport = class {
|
|
|
502
507
|
});
|
|
503
508
|
}
|
|
504
509
|
} catch (err) {
|
|
505
|
-
|
|
506
|
-
|
|
510
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
|
|
511
|
+
chunkUV5FUVNK_cjs.report(err, {
|
|
507
512
|
fingerprint: "morse.transport.post.network",
|
|
508
513
|
extra: {
|
|
509
514
|
endpoint_host: hostnameOf(url),
|
|
@@ -547,10 +552,10 @@ function categoryOf(payload) {
|
|
|
547
552
|
}
|
|
548
553
|
|
|
549
554
|
// src/index.ts
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
555
|
+
chunkUV5FUVNK_cjs.init_tracing();
|
|
556
|
+
chunkUV5FUVNK_cjs.init_diagnostics();
|
|
557
|
+
chunkUV5FUVNK_cjs.init_spans();
|
|
558
|
+
chunkUV5FUVNK_cjs.init_propagation();
|
|
554
559
|
var version = SDK_VERSION;
|
|
555
560
|
var singleton = null;
|
|
556
561
|
var transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -570,9 +575,9 @@ function logDestinationOnce(endpoint) {
|
|
|
570
575
|
}
|
|
571
576
|
function resolveEndpoint(explicit) {
|
|
572
577
|
if (explicit && explicit.length > 0) return explicit;
|
|
573
|
-
const fromEnv =
|
|
578
|
+
const fromEnv = chunkUV5FUVNK_cjs.getEndpoint();
|
|
574
579
|
if (fromEnv) return fromEnv;
|
|
575
|
-
return
|
|
580
|
+
return chunkUV5FUVNK_cjs.DEFAULT_ENDPOINT;
|
|
576
581
|
}
|
|
577
582
|
var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
|
|
578
583
|
function deriveOtlpEndpoint(tracesEndpoint) {
|
|
@@ -587,10 +592,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
|
|
|
587
592
|
}
|
|
588
593
|
}
|
|
589
594
|
function buildSingleton(opts, redaction) {
|
|
590
|
-
if (
|
|
595
|
+
if (chunkUV5FUVNK_cjs.isDisabled()) {
|
|
591
596
|
return null;
|
|
592
597
|
}
|
|
593
|
-
const apiKey = opts.apiKey ??
|
|
598
|
+
const apiKey = opts.apiKey ?? chunkUV5FUVNK_cjs.getApiKey();
|
|
594
599
|
if (!apiKey) {
|
|
595
600
|
if (!noApiKeyWarningEmitted) {
|
|
596
601
|
logger2(
|
|
@@ -602,24 +607,24 @@ function buildSingleton(opts, redaction) {
|
|
|
602
607
|
return null;
|
|
603
608
|
}
|
|
604
609
|
const endpoint = resolveEndpoint(opts.endpoint);
|
|
605
|
-
const flushIntervalSeconds = opts.flushIntervalSeconds ??
|
|
610
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkUV5FUVNK_cjs.getFlushIntervalSeconds();
|
|
606
611
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const explicitSource =
|
|
611
|
-
const resolvedSource = explicitSource ??
|
|
612
|
-
|
|
612
|
+
chunkUV5FUVNK_cjs.setTransport(transport);
|
|
613
|
+
chunkUV5FUVNK_cjs.setRedactionConfig(redaction);
|
|
614
|
+
chunkUV5FUVNK_cjs.setDiagnosticsClientConfig({ apiKey, endpoint });
|
|
615
|
+
const explicitSource = chunkUV5FUVNK_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
616
|
+
const resolvedSource = explicitSource ?? chunkUV5FUVNK_cjs.getInternalSource() ?? null;
|
|
617
|
+
chunkUV5FUVNK_cjs.setSource(resolvedSource);
|
|
613
618
|
logDestinationOnce(endpoint);
|
|
614
619
|
try {
|
|
615
|
-
|
|
620
|
+
chunkUV5FUVNK_cjs.getEngine().configure({
|
|
616
621
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
617
622
|
apiKey,
|
|
618
|
-
sampleRate:
|
|
623
|
+
sampleRate: chunkUV5FUVNK_cjs.getSampleRate(),
|
|
619
624
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
620
|
-
maxQueueSize:
|
|
621
|
-
maxExportBatchSize:
|
|
622
|
-
maxFieldBytes:
|
|
625
|
+
maxQueueSize: chunkUV5FUVNK_cjs.getMaxQueueSize(),
|
|
626
|
+
maxExportBatchSize: chunkUV5FUVNK_cjs.getMaxBatchSize(),
|
|
627
|
+
maxFieldBytes: chunkUV5FUVNK_cjs.getMaxFieldBytes(),
|
|
623
628
|
// 10s (not the exporter's un-overridden 30s ceiling): a genuine
|
|
624
629
|
// network blip still gets several retries with backoff; a fully dead
|
|
625
630
|
// endpoint fails within a bounded, shutdown-friendly window instead
|
|
@@ -628,32 +633,32 @@ function buildSingleton(opts, redaction) {
|
|
|
628
633
|
redactionConfig: redaction
|
|
629
634
|
});
|
|
630
635
|
} catch (err) {
|
|
631
|
-
|
|
636
|
+
chunkUV5FUVNK_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
|
|
632
637
|
}
|
|
633
638
|
void installAdapters().catch(() => {
|
|
634
639
|
});
|
|
635
640
|
try {
|
|
636
641
|
maybeEnableDbCaptureFromEnv();
|
|
637
642
|
} catch (err) {
|
|
638
|
-
|
|
643
|
+
chunkUV5FUVNK_cjs.report(err, { fingerprint: "morse.db_capture.register" });
|
|
639
644
|
}
|
|
640
645
|
return { apiKey, endpoint, transport, redaction };
|
|
641
646
|
}
|
|
642
647
|
function ensureInitialized() {
|
|
643
|
-
if (
|
|
648
|
+
if (chunkUV5FUVNK_cjs.isDisabled()) return null;
|
|
644
649
|
if (singleton !== null) return singleton;
|
|
645
|
-
singleton = buildSingleton({},
|
|
650
|
+
singleton = buildSingleton({}, chunkUV5FUVNK_cjs.buildRedactionConfig());
|
|
646
651
|
return singleton;
|
|
647
652
|
}
|
|
648
|
-
|
|
653
|
+
chunkK4FHTOBB_cjs._setEnsureInitialized(() => {
|
|
649
654
|
ensureInitialized();
|
|
650
655
|
});
|
|
651
656
|
function init(options = {}) {
|
|
652
|
-
if (
|
|
657
|
+
if (chunkUV5FUVNK_cjs.isDisabled()) {
|
|
653
658
|
logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
654
659
|
return;
|
|
655
660
|
}
|
|
656
|
-
const redaction =
|
|
661
|
+
const redaction = chunkUV5FUVNK_cjs.buildRedactionConfig(options.redaction);
|
|
657
662
|
try {
|
|
658
663
|
if (singleton !== null) {
|
|
659
664
|
void singleton.transport.shutdown();
|
|
@@ -661,10 +666,10 @@ function init(options = {}) {
|
|
|
661
666
|
}
|
|
662
667
|
singleton = buildSingleton(options, redaction);
|
|
663
668
|
} catch (err) {
|
|
664
|
-
|
|
669
|
+
chunkUV5FUVNK_cjs.report(err, { fingerprint: "morse.init" });
|
|
665
670
|
}
|
|
666
671
|
}
|
|
667
|
-
var track =
|
|
672
|
+
var track = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
668
673
|
(options) => {
|
|
669
674
|
const state = ensureInitialized();
|
|
670
675
|
if (!state) return;
|
|
@@ -672,33 +677,33 @@ var track = chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
|
672
677
|
agent_id: options.agentId,
|
|
673
678
|
...options.runData
|
|
674
679
|
};
|
|
675
|
-
const redacted =
|
|
680
|
+
const redacted = chunkUV5FUVNK_cjs.redactValue(payload, state.redaction);
|
|
676
681
|
state.transport.track(redacted);
|
|
677
682
|
},
|
|
678
683
|
{ fingerprint: "morse.track" }
|
|
679
684
|
);
|
|
680
|
-
var batchTrack =
|
|
685
|
+
var batchTrack = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
681
686
|
(runs) => {
|
|
682
687
|
const state = ensureInitialized();
|
|
683
688
|
if (!state) return;
|
|
684
689
|
for (const run2 of runs) {
|
|
685
|
-
const redacted =
|
|
690
|
+
const redacted = chunkUV5FUVNK_cjs.redactValue(run2, state.redaction);
|
|
686
691
|
state.transport.track(redacted);
|
|
687
692
|
}
|
|
688
693
|
},
|
|
689
694
|
{ fingerprint: "morse.batch_track" }
|
|
690
695
|
);
|
|
691
|
-
var record =
|
|
696
|
+
var record = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
692
697
|
(rec) => {
|
|
693
698
|
const state = ensureInitialized();
|
|
694
699
|
if (!state) return;
|
|
695
|
-
const traceId =
|
|
696
|
-
const now =
|
|
700
|
+
const traceId = chunkUV5FUVNK_cjs.generateTraceId();
|
|
701
|
+
const now = chunkUV5FUVNK_cjs.nowIso();
|
|
697
702
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
698
703
|
const span2 = {
|
|
699
704
|
trace_id: traceId,
|
|
700
|
-
span_id:
|
|
701
|
-
type:
|
|
705
|
+
span_id: chunkUV5FUVNK_cjs.generateSpanId(),
|
|
706
|
+
type: chunkUV5FUVNK_cjs.SpanType.AGENT,
|
|
702
707
|
name: rec.agent,
|
|
703
708
|
started_at: now,
|
|
704
709
|
ended_at: now,
|
|
@@ -723,58 +728,58 @@ var record = chunkRDFDPK2X_cjs.absorbErrorsSync(
|
|
|
723
728
|
success: rec.success,
|
|
724
729
|
outcome: rec.outcome
|
|
725
730
|
};
|
|
726
|
-
const entry =
|
|
727
|
-
const redacted =
|
|
728
|
-
|
|
731
|
+
const entry = chunkUV5FUVNK_cjs.buildTraceEntry(traceFields, [span2]);
|
|
732
|
+
const redacted = chunkUV5FUVNK_cjs.redactValue(entry, state.redaction);
|
|
733
|
+
chunkUV5FUVNK_cjs.sendTrace(redacted);
|
|
729
734
|
},
|
|
730
735
|
{ fingerprint: "morse.record" }
|
|
731
736
|
);
|
|
732
737
|
function run(nameOrOpts, fn) {
|
|
733
738
|
const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
|
|
734
739
|
ensureInitialized();
|
|
735
|
-
return
|
|
740
|
+
return chunkUV5FUVNK_cjs.runSync(opts, fn);
|
|
736
741
|
}
|
|
737
742
|
function runTraced(options, fn) {
|
|
738
743
|
ensureInitialized();
|
|
739
|
-
return
|
|
744
|
+
return chunkUV5FUVNK_cjs.runAsync(options, fn);
|
|
740
745
|
}
|
|
741
746
|
function setContext2(dims) {
|
|
742
|
-
|
|
747
|
+
chunkUV5FUVNK_cjs.setContext(dims);
|
|
743
748
|
}
|
|
744
749
|
function startSpan2(options) {
|
|
745
|
-
return
|
|
750
|
+
return chunkUV5FUVNK_cjs.startSpan(options);
|
|
746
751
|
}
|
|
747
752
|
function span(options, fn) {
|
|
748
|
-
return
|
|
753
|
+
return chunkUV5FUVNK_cjs.spanSync(options, fn);
|
|
749
754
|
}
|
|
750
755
|
function spanAsync2(options, fn) {
|
|
751
|
-
return
|
|
756
|
+
return chunkUV5FUVNK_cjs.spanAsync(options, fn);
|
|
752
757
|
}
|
|
753
|
-
var flush =
|
|
758
|
+
var flush = chunkTEWSIQ6E_cjs.absorbErrorsAsync(
|
|
754
759
|
async () => {
|
|
755
760
|
if (singleton !== null) {
|
|
756
761
|
await singleton.transport.flush();
|
|
757
|
-
await
|
|
762
|
+
await chunkUV5FUVNK_cjs.getEngine().flush();
|
|
758
763
|
}
|
|
759
764
|
},
|
|
760
765
|
{ fingerprint: "morse.flush" }
|
|
761
766
|
);
|
|
762
|
-
var quotaState2 =
|
|
767
|
+
var quotaState2 = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
763
768
|
() => {
|
|
764
769
|
if (singleton === null) return null;
|
|
765
770
|
return getQuotaState();
|
|
766
771
|
},
|
|
767
772
|
{ fingerprint: "morse.quota_state" }
|
|
768
773
|
);
|
|
769
|
-
var shutdown =
|
|
774
|
+
var shutdown = chunkTEWSIQ6E_cjs.absorbErrorsAsync(
|
|
770
775
|
async () => {
|
|
771
776
|
if (singleton !== null) {
|
|
772
777
|
await singleton.transport.shutdown();
|
|
773
|
-
await
|
|
774
|
-
|
|
775
|
-
await
|
|
778
|
+
await chunkUV5FUVNK_cjs.getEngine().flush();
|
|
779
|
+
chunkUV5FUVNK_cjs.getEngine().shutdown();
|
|
780
|
+
await chunkUV5FUVNK_cjs.flushOnce();
|
|
776
781
|
singleton = null;
|
|
777
|
-
|
|
782
|
+
chunkUV5FUVNK_cjs.setTransport(null);
|
|
778
783
|
}
|
|
779
784
|
},
|
|
780
785
|
{ fingerprint: "morse.shutdown" }
|
|
@@ -783,14 +788,14 @@ function _resetForTesting4() {
|
|
|
783
788
|
if (singleton !== null) {
|
|
784
789
|
void singleton.transport.shutdown();
|
|
785
790
|
singleton = null;
|
|
786
|
-
|
|
791
|
+
chunkUV5FUVNK_cjs.setTransport(null);
|
|
787
792
|
}
|
|
788
|
-
|
|
793
|
+
chunkUV5FUVNK_cjs.getEngine().resetForTesting();
|
|
789
794
|
noApiKeyWarningEmitted = false;
|
|
790
795
|
lastLoggedEndpoint = null;
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
796
|
+
chunkUV5FUVNK_cjs.setSource(null);
|
|
797
|
+
chunkUV5FUVNK_cjs._resetForTesting2();
|
|
798
|
+
chunkUV5FUVNK_cjs._resetForTesting();
|
|
794
799
|
_resetForTesting3();
|
|
795
800
|
_resetQuotaStateForTesting();
|
|
796
801
|
transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -799,59 +804,59 @@ function _setTransportFactoryForTesting(factory) {
|
|
|
799
804
|
transportFactory = factory;
|
|
800
805
|
}
|
|
801
806
|
function _getLastTraceForTesting() {
|
|
802
|
-
return
|
|
807
|
+
return chunkUV5FUVNK_cjs.getLastTrace();
|
|
803
808
|
}
|
|
804
809
|
function _getActiveTraceStateForTesting() {
|
|
805
|
-
return
|
|
810
|
+
return chunkUV5FUVNK_cjs.getActiveTraceState();
|
|
806
811
|
}
|
|
807
812
|
|
|
808
813
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
809
814
|
enumerable: true,
|
|
810
|
-
get: function () { return
|
|
815
|
+
get: function () { return chunk4QY5O46P_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
811
816
|
});
|
|
812
817
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
813
818
|
enumerable: true,
|
|
814
|
-
get: function () { return
|
|
819
|
+
get: function () { return chunk4QY5O46P_cjs.extractAnthropicSegments; }
|
|
815
820
|
});
|
|
816
821
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
817
822
|
enumerable: true,
|
|
818
|
-
get: function () { return
|
|
823
|
+
get: function () { return chunk4QY5O46P_cjs.instrumentAnthropic; }
|
|
819
824
|
});
|
|
820
825
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
821
826
|
enumerable: true,
|
|
822
|
-
get: function () { return
|
|
827
|
+
get: function () { return chunk4QY5O46P_cjs.isAnthropicWrapped; }
|
|
823
828
|
});
|
|
824
829
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
825
830
|
enumerable: true,
|
|
826
|
-
get: function () { return
|
|
831
|
+
get: function () { return chunk4QY5O46P_cjs.uninstallAnthropic; }
|
|
827
832
|
});
|
|
828
833
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
829
834
|
enumerable: true,
|
|
830
|
-
get: function () { return
|
|
835
|
+
get: function () { return chunk4QY5O46P_cjs.wrapAnthropic; }
|
|
831
836
|
});
|
|
832
837
|
Object.defineProperty(exports, "log", {
|
|
833
838
|
enumerable: true,
|
|
834
|
-
get: function () { return
|
|
839
|
+
get: function () { return chunkK4FHTOBB_cjs.log; }
|
|
835
840
|
});
|
|
836
841
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
837
842
|
enumerable: true,
|
|
838
|
-
get: function () { return
|
|
843
|
+
get: function () { return chunkUV5FUVNK_cjs.W3C_TRACEPARENT_HEADER; }
|
|
839
844
|
});
|
|
840
845
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
841
846
|
enumerable: true,
|
|
842
|
-
get: function () { return
|
|
847
|
+
get: function () { return chunkUV5FUVNK_cjs.extractTraceparent; }
|
|
843
848
|
});
|
|
844
849
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
845
850
|
enumerable: true,
|
|
846
|
-
get: function () { return
|
|
851
|
+
get: function () { return chunkUV5FUVNK_cjs.formatTraceparent; }
|
|
847
852
|
});
|
|
848
853
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
849
854
|
enumerable: true,
|
|
850
|
-
get: function () { return
|
|
855
|
+
get: function () { return chunkUV5FUVNK_cjs.injectIntoRequestInit; }
|
|
851
856
|
});
|
|
852
857
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
853
858
|
enumerable: true,
|
|
854
|
-
get: function () { return
|
|
859
|
+
get: function () { return chunkUV5FUVNK_cjs.injectTraceparent; }
|
|
855
860
|
});
|
|
856
861
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
857
862
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|