@morsehq-dev/sdk 0.4.0 → 0.4.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 +10 -10
- package/dist/anthropic/index.js +3 -3
- package/dist/anthropic-agent-sdk/index.cjs +32 -32
- package/dist/anthropic-agent-sdk/index.js +5 -5
- package/dist/browser/anthropic/index.cjs +10 -10
- package/dist/browser/anthropic/index.js +3 -3
- package/dist/browser/anthropic-agent-sdk/index.cjs +32 -32
- package/dist/browser/anthropic-agent-sdk/index.js +5 -5
- package/dist/{chunk-7EO7MQBA.cjs → browser/chunk-3BGG7GH3.cjs} +6 -6
- package/dist/browser/{chunk-KRBADE6R.cjs.map → chunk-3BGG7GH3.cjs.map} +1 -1
- package/dist/browser/{chunk-JBOYFQSB.js → chunk-AYNX24P5.js} +3 -3
- package/dist/browser/{chunk-JBOYFQSB.js.map → chunk-AYNX24P5.js.map} +1 -1
- package/dist/{chunk-ME5JALGT.js → browser/chunk-DOLWR7LD.js} +4 -4
- package/dist/browser/{chunk-7MSXWGAH.js.map → chunk-DOLWR7LD.js.map} +1 -1
- package/dist/browser/{chunk-O4HG3OSK.cjs → chunk-DXWHT3HK.cjs} +13 -4
- package/dist/browser/chunk-DXWHT3HK.cjs.map +1 -0
- package/dist/browser/{chunk-B7DEUDP6.cjs → chunk-EFUQVASI.cjs} +15 -15
- package/dist/browser/{chunk-B7DEUDP6.cjs.map → chunk-EFUQVASI.cjs.map} +1 -1
- package/dist/browser/{chunk-5J2QBK75.js → chunk-F3B4UR64.js} +13 -4
- package/dist/browser/chunk-F3B4UR64.js.map +1 -0
- package/dist/{chunk-HDAFUKQ3.js → browser/chunk-F7BGQ26H.js} +4 -4
- package/dist/browser/{chunk-TYDG747E.js.map → chunk-F7BGQ26H.js.map} +1 -1
- package/dist/browser/{chunk-YAOBFRKP.js → chunk-GWJYOQNC.js} +4 -4
- package/dist/browser/{chunk-YAOBFRKP.js.map → chunk-GWJYOQNC.js.map} +1 -1
- package/dist/browser/{chunk-TZRSDDFP.cjs → chunk-HGN7J3EU.cjs} +12 -12
- package/dist/browser/{chunk-TZRSDDFP.cjs.map → chunk-HGN7J3EU.cjs.map} +1 -1
- package/dist/browser/{chunk-Z22Q2ONC.cjs → chunk-M2GZJ3RS.cjs} +14 -14
- package/dist/browser/{chunk-Z22Q2ONC.cjs.map → chunk-M2GZJ3RS.cjs.map} +1 -1
- package/dist/browser/{chunk-NQG2IAQS.js → chunk-YHV5GL32.js} +3 -3
- package/dist/browser/{chunk-NQG2IAQS.js.map → chunk-YHV5GL32.js.map} +1 -1
- package/dist/{chunk-VXDBDPDR.cjs → browser/chunk-YNUZGKUA.cjs} +7 -7
- package/dist/browser/{chunk-MCJYZH6W.cjs.map → chunk-YNUZGKUA.cjs.map} +1 -1
- package/dist/browser/index.cjs +80 -80
- package/dist/browser/index.js +7 -7
- 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 +21 -21
- package/dist/browser/langgraph/index.js +4 -4
- package/dist/browser/openai/index.cjs +5 -5
- package/dist/browser/openai/index.js +1 -1
- package/dist/browser/openai-agents/index.cjs +32 -32
- 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-KZBCOZIQ.cjs → chunk-5D6SBSEI.cjs} +15 -15
- package/dist/{chunk-KZBCOZIQ.cjs.map → chunk-5D6SBSEI.cjs.map} +1 -1
- package/dist/{chunk-ZKUGOWER.js → chunk-AEFUXEKV.js} +3 -3
- package/dist/{chunk-ZKUGOWER.js.map → chunk-AEFUXEKV.js.map} +1 -1
- package/dist/{chunk-FJUNILZT.cjs → chunk-HNCWTENX.cjs} +13 -4
- package/dist/chunk-HNCWTENX.cjs.map +1 -0
- package/dist/{chunk-7YCENA54.cjs → chunk-LQI63FHF.cjs} +14 -14
- package/dist/{chunk-7YCENA54.cjs.map → chunk-LQI63FHF.cjs.map} +1 -1
- package/dist/{chunk-TQWI4UYO.js → chunk-LTKGLXAE.js} +13 -4
- package/dist/chunk-LTKGLXAE.js.map +1 -0
- package/dist/{chunk-RTL23YOQ.js → chunk-POCQNSVD.js} +3 -3
- package/dist/{chunk-RTL23YOQ.js.map → chunk-POCQNSVD.js.map} +1 -1
- package/dist/{chunk-PVHDEPRE.cjs → chunk-QXRJUPDP.cjs} +12 -12
- package/dist/{chunk-PVHDEPRE.cjs.map → chunk-QXRJUPDP.cjs.map} +1 -1
- package/dist/{browser/chunk-TYDG747E.js → chunk-SBGY5NS4.js} +4 -4
- package/dist/{chunk-HDAFUKQ3.js.map → chunk-SBGY5NS4.js.map} +1 -1
- package/dist/{chunk-CKFOGDUF.js → chunk-STK4KJQ6.js} +4 -4
- package/dist/{chunk-CKFOGDUF.js.map → chunk-STK4KJQ6.js.map} +1 -1
- package/dist/{browser/chunk-KRBADE6R.cjs → chunk-T2KW3P23.cjs} +6 -6
- package/dist/{chunk-7EO7MQBA.cjs.map → chunk-T2KW3P23.cjs.map} +1 -1
- package/dist/{browser/chunk-7MSXWGAH.js → chunk-V5J6J4ZR.js} +4 -4
- package/dist/{chunk-ME5JALGT.js.map → chunk-V5J6J4ZR.js.map} +1 -1
- package/dist/{browser/chunk-MCJYZH6W.cjs → chunk-Y7SVGUKY.cjs} +7 -7
- package/dist/{chunk-VXDBDPDR.cjs.map → chunk-Y7SVGUKY.cjs.map} +1 -1
- package/dist/index.cjs +87 -87
- package/dist/index.js +8 -8
- 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 +21 -21
- package/dist/langgraph/index.js +4 -4
- package/dist/openai/index.cjs +5 -5
- package/dist/openai/index.js +1 -1
- package/dist/openai-agents/index.cjs +32 -32
- 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-5J2QBK75.js.map +0 -1
- package/dist/browser/chunk-O4HG3OSK.cjs.map +0 -1
- package/dist/chunk-FJUNILZT.cjs.map +0 -1
- package/dist/chunk-TQWI4UYO.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkLQI63FHF_cjs = require('./chunk-LQI63FHF.cjs');
|
|
4
|
+
var chunkQXRJUPDP_cjs = require('./chunk-QXRJUPDP.cjs');
|
|
5
|
+
var chunkT2KW3P23_cjs = require('./chunk-T2KW3P23.cjs');
|
|
6
6
|
require('./chunk-KBWPNIH4.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkHNCWTENX_cjs = require('./chunk-HNCWTENX.cjs');
|
|
8
8
|
var module$1 = require('module');
|
|
9
9
|
var instrumentationPg = require('@opentelemetry/instrumentation-pg');
|
|
10
10
|
var instrumentationMysql2 = require('@opentelemetry/instrumentation-mysql2');
|
|
@@ -12,10 +12,10 @@ var instrumentation = require('@opentelemetry/instrumentation');
|
|
|
12
12
|
var api = require('@opentelemetry/api');
|
|
13
13
|
|
|
14
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
15
|
-
|
|
15
|
+
chunkHNCWTENX_cjs.init_env();
|
|
16
16
|
var FULL_INSTALL_TARGETS = {
|
|
17
17
|
"@anthropic-ai/sdk": {
|
|
18
|
-
install: (mod) =>
|
|
18
|
+
install: (mod) => chunkLQI63FHF_cjs.instrumentAnthropic({ anthropicModule: mod })
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
var DETECT_ONLY_TARGETS = {
|
|
@@ -89,7 +89,7 @@ function uninstallLazyHook() {
|
|
|
89
89
|
originalRequire = null;
|
|
90
90
|
}
|
|
91
91
|
async function installAdapters() {
|
|
92
|
-
if (
|
|
92
|
+
if (chunkHNCWTENX_cjs.isAutoDetectDisabled()) return;
|
|
93
93
|
const nodeRequire = getNodeRequire();
|
|
94
94
|
if (!nodeRequire) return;
|
|
95
95
|
const installPromises = [];
|
|
@@ -127,11 +127,11 @@ function _resetForTesting3() {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
// src/index.ts
|
|
130
|
-
|
|
130
|
+
chunkHNCWTENX_cjs.init_env();
|
|
131
131
|
|
|
132
132
|
// src/_internal/db-capture.ts
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
chunkHNCWTENX_cjs.init_env();
|
|
134
|
+
chunkHNCWTENX_cjs.init_otel_provider();
|
|
135
135
|
var SEMCONV_DB_SYSTEM_NAME = "db.system.name";
|
|
136
136
|
var SEMCONV_DB_QUERY_TEXT = "db.query.text";
|
|
137
137
|
var DB_SYSTEM_NAME_SQLITE = "sqlite";
|
|
@@ -245,7 +245,7 @@ function registerDbInstrumentation() {
|
|
|
245
245
|
disableDbCapture();
|
|
246
246
|
try {
|
|
247
247
|
const instrumentations = buildDbInstrumentations();
|
|
248
|
-
const off =
|
|
248
|
+
const off = chunkHNCWTENX_cjs.getEngine().registerInstrumentations(instrumentations);
|
|
249
249
|
if (off === null) return false;
|
|
250
250
|
unregister = off;
|
|
251
251
|
registeredInstrumentations = instrumentations;
|
|
@@ -267,17 +267,17 @@ function disableDbCapture() {
|
|
|
267
267
|
registeredInstrumentations = null;
|
|
268
268
|
}
|
|
269
269
|
function maybeEnableDbCaptureFromEnv() {
|
|
270
|
-
if (
|
|
270
|
+
if (chunkHNCWTENX_cjs.isDbCaptureEnabled()) {
|
|
271
271
|
registerDbInstrumentation();
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
// src/index.ts
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
chunkHNCWTENX_cjs.init_otel_provider();
|
|
277
|
+
chunkHNCWTENX_cjs.init_redaction();
|
|
278
278
|
|
|
279
279
|
// src/_internal/transport.ts
|
|
280
|
-
var SDK_VERSION = "0.4.
|
|
280
|
+
var SDK_VERSION = "0.4.1" ;
|
|
281
281
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
282
282
|
function parseRetryAfter(value) {
|
|
283
283
|
if (!value) return null;
|
|
@@ -477,7 +477,7 @@ var BatchTransport = class {
|
|
|
477
477
|
bodySnippet = text.slice(0, 200);
|
|
478
478
|
} catch {
|
|
479
479
|
}
|
|
480
|
-
|
|
480
|
+
chunkT2KW3P23_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
|
|
481
481
|
fingerprint: "morse.transport.post.non_2xx",
|
|
482
482
|
extra: {
|
|
483
483
|
endpoint_host: hostnameOf(url),
|
|
@@ -486,7 +486,7 @@ var BatchTransport = class {
|
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
} catch (err) {
|
|
489
|
-
|
|
489
|
+
chunkT2KW3P23_cjs.report(err, {
|
|
490
490
|
fingerprint: "morse.transport.post.network",
|
|
491
491
|
extra: {
|
|
492
492
|
endpoint_host: hostnameOf(url),
|
|
@@ -518,9 +518,9 @@ function deriveLogsEndpoint(tracesEndpoint) {
|
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
// src/index.ts
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
521
|
+
chunkHNCWTENX_cjs.init_tracing();
|
|
522
|
+
chunkHNCWTENX_cjs.init_spans();
|
|
523
|
+
chunkHNCWTENX_cjs.init_propagation();
|
|
524
524
|
var version = SDK_VERSION;
|
|
525
525
|
var singleton = null;
|
|
526
526
|
var transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -540,9 +540,9 @@ function logDestinationOnce(endpoint) {
|
|
|
540
540
|
}
|
|
541
541
|
function resolveEndpoint(explicit) {
|
|
542
542
|
if (explicit && explicit.length > 0) return explicit;
|
|
543
|
-
const fromEnv =
|
|
543
|
+
const fromEnv = chunkHNCWTENX_cjs.getEndpoint();
|
|
544
544
|
if (fromEnv) return fromEnv;
|
|
545
|
-
return
|
|
545
|
+
return chunkHNCWTENX_cjs.DEFAULT_ENDPOINT;
|
|
546
546
|
}
|
|
547
547
|
var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
|
|
548
548
|
function deriveOtlpEndpoint(tracesEndpoint) {
|
|
@@ -557,10 +557,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
|
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
function buildSingleton(opts, redaction) {
|
|
560
|
-
if (
|
|
560
|
+
if (chunkHNCWTENX_cjs.isDisabled()) {
|
|
561
561
|
return null;
|
|
562
562
|
}
|
|
563
|
-
const apiKey = opts.apiKey ??
|
|
563
|
+
const apiKey = opts.apiKey ?? chunkHNCWTENX_cjs.getApiKey();
|
|
564
564
|
if (!apiKey) {
|
|
565
565
|
if (!noApiKeyWarningEmitted) {
|
|
566
566
|
logger2(
|
|
@@ -572,23 +572,23 @@ function buildSingleton(opts, redaction) {
|
|
|
572
572
|
return null;
|
|
573
573
|
}
|
|
574
574
|
const endpoint = resolveEndpoint(opts.endpoint);
|
|
575
|
-
const flushIntervalSeconds = opts.flushIntervalSeconds ??
|
|
575
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkHNCWTENX_cjs.getFlushIntervalSeconds();
|
|
576
576
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
const explicitSource =
|
|
580
|
-
const resolvedSource = explicitSource ??
|
|
581
|
-
|
|
577
|
+
chunkHNCWTENX_cjs.setTransport(transport);
|
|
578
|
+
chunkHNCWTENX_cjs.setRedactionConfig(redaction);
|
|
579
|
+
const explicitSource = chunkHNCWTENX_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
580
|
+
const resolvedSource = explicitSource ?? chunkHNCWTENX_cjs.getInternalSource() ?? null;
|
|
581
|
+
chunkHNCWTENX_cjs.setSource(resolvedSource);
|
|
582
582
|
logDestinationOnce(endpoint);
|
|
583
583
|
try {
|
|
584
|
-
|
|
584
|
+
chunkHNCWTENX_cjs.getEngine().configure({
|
|
585
585
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
586
586
|
apiKey,
|
|
587
|
-
sampleRate:
|
|
587
|
+
sampleRate: chunkHNCWTENX_cjs.getSampleRate(),
|
|
588
588
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
589
|
-
maxQueueSize:
|
|
590
|
-
maxExportBatchSize:
|
|
591
|
-
maxFieldBytes:
|
|
589
|
+
maxQueueSize: chunkHNCWTENX_cjs.getMaxQueueSize(),
|
|
590
|
+
maxExportBatchSize: chunkHNCWTENX_cjs.getMaxBatchSize(),
|
|
591
|
+
maxFieldBytes: chunkHNCWTENX_cjs.getMaxFieldBytes(),
|
|
592
592
|
// 10s (not the exporter's un-overridden 30s ceiling): a genuine
|
|
593
593
|
// network blip still gets several retries with backoff; a fully dead
|
|
594
594
|
// endpoint fails within a bounded, shutdown-friendly window instead
|
|
@@ -597,32 +597,32 @@ function buildSingleton(opts, redaction) {
|
|
|
597
597
|
redactionConfig: redaction
|
|
598
598
|
});
|
|
599
599
|
} catch (err) {
|
|
600
|
-
|
|
600
|
+
chunkT2KW3P23_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
|
|
601
601
|
}
|
|
602
602
|
void installAdapters().catch(() => {
|
|
603
603
|
});
|
|
604
604
|
try {
|
|
605
605
|
maybeEnableDbCaptureFromEnv();
|
|
606
606
|
} catch (err) {
|
|
607
|
-
|
|
607
|
+
chunkT2KW3P23_cjs.report(err, { fingerprint: "morse.db_capture.register" });
|
|
608
608
|
}
|
|
609
609
|
return { apiKey, endpoint, transport, redaction };
|
|
610
610
|
}
|
|
611
611
|
function ensureInitialized() {
|
|
612
|
-
if (
|
|
612
|
+
if (chunkHNCWTENX_cjs.isDisabled()) return null;
|
|
613
613
|
if (singleton !== null) return singleton;
|
|
614
|
-
singleton = buildSingleton({},
|
|
614
|
+
singleton = buildSingleton({}, chunkHNCWTENX_cjs.buildRedactionConfig());
|
|
615
615
|
return singleton;
|
|
616
616
|
}
|
|
617
|
-
|
|
617
|
+
chunkQXRJUPDP_cjs._setEnsureInitialized(() => {
|
|
618
618
|
ensureInitialized();
|
|
619
619
|
});
|
|
620
620
|
function init(options = {}) {
|
|
621
|
-
if (
|
|
621
|
+
if (chunkHNCWTENX_cjs.isDisabled()) {
|
|
622
622
|
logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
623
623
|
return;
|
|
624
624
|
}
|
|
625
|
-
const redaction =
|
|
625
|
+
const redaction = chunkHNCWTENX_cjs.buildRedactionConfig(options.redaction);
|
|
626
626
|
try {
|
|
627
627
|
if (singleton !== null) {
|
|
628
628
|
void singleton.transport.shutdown();
|
|
@@ -630,10 +630,10 @@ function init(options = {}) {
|
|
|
630
630
|
}
|
|
631
631
|
singleton = buildSingleton(options, redaction);
|
|
632
632
|
} catch (err) {
|
|
633
|
-
|
|
633
|
+
chunkT2KW3P23_cjs.report(err, { fingerprint: "morse.init" });
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
var track =
|
|
636
|
+
var track = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
637
637
|
(options) => {
|
|
638
638
|
const state = ensureInitialized();
|
|
639
639
|
if (!state) return;
|
|
@@ -641,33 +641,33 @@ var track = chunk7EO7MQBA_cjs.absorbErrorsSync(
|
|
|
641
641
|
agent_id: options.agentId,
|
|
642
642
|
...options.runData
|
|
643
643
|
};
|
|
644
|
-
const redacted =
|
|
644
|
+
const redacted = chunkHNCWTENX_cjs.redactValue(payload, state.redaction);
|
|
645
645
|
state.transport.track(redacted);
|
|
646
646
|
},
|
|
647
647
|
{ fingerprint: "morse.track" }
|
|
648
648
|
);
|
|
649
|
-
var batchTrack =
|
|
649
|
+
var batchTrack = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
650
650
|
(runs) => {
|
|
651
651
|
const state = ensureInitialized();
|
|
652
652
|
if (!state) return;
|
|
653
653
|
for (const run2 of runs) {
|
|
654
|
-
const redacted =
|
|
654
|
+
const redacted = chunkHNCWTENX_cjs.redactValue(run2, state.redaction);
|
|
655
655
|
state.transport.track(redacted);
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
658
|
{ fingerprint: "morse.batch_track" }
|
|
659
659
|
);
|
|
660
|
-
var record =
|
|
660
|
+
var record = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
661
661
|
(rec) => {
|
|
662
662
|
const state = ensureInitialized();
|
|
663
663
|
if (!state) return;
|
|
664
|
-
const traceId =
|
|
665
|
-
const now =
|
|
664
|
+
const traceId = chunkHNCWTENX_cjs.generateTraceId();
|
|
665
|
+
const now = chunkHNCWTENX_cjs.nowIso();
|
|
666
666
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
667
667
|
const span2 = {
|
|
668
668
|
trace_id: traceId,
|
|
669
|
-
span_id:
|
|
670
|
-
type:
|
|
669
|
+
span_id: chunkHNCWTENX_cjs.generateSpanId(),
|
|
670
|
+
type: chunkHNCWTENX_cjs.SpanType.AGENT,
|
|
671
671
|
name: rec.agent,
|
|
672
672
|
started_at: now,
|
|
673
673
|
ended_at: now,
|
|
@@ -692,57 +692,57 @@ var record = chunk7EO7MQBA_cjs.absorbErrorsSync(
|
|
|
692
692
|
success: rec.success,
|
|
693
693
|
outcome: rec.outcome
|
|
694
694
|
};
|
|
695
|
-
const entry =
|
|
696
|
-
const redacted =
|
|
697
|
-
|
|
695
|
+
const entry = chunkHNCWTENX_cjs.buildTraceEntry(traceFields, [span2]);
|
|
696
|
+
const redacted = chunkHNCWTENX_cjs.redactValue(entry, state.redaction);
|
|
697
|
+
chunkHNCWTENX_cjs.sendTrace(redacted);
|
|
698
698
|
},
|
|
699
699
|
{ fingerprint: "morse.record" }
|
|
700
700
|
);
|
|
701
701
|
function run(nameOrOpts, fn) {
|
|
702
702
|
const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
|
|
703
703
|
ensureInitialized();
|
|
704
|
-
return
|
|
704
|
+
return chunkHNCWTENX_cjs.runSync(opts, fn);
|
|
705
705
|
}
|
|
706
706
|
function runTraced(options, fn) {
|
|
707
707
|
ensureInitialized();
|
|
708
|
-
return
|
|
708
|
+
return chunkHNCWTENX_cjs.runAsync(options, fn);
|
|
709
709
|
}
|
|
710
710
|
function setContext2(dims) {
|
|
711
|
-
|
|
711
|
+
chunkHNCWTENX_cjs.setContext(dims);
|
|
712
712
|
}
|
|
713
713
|
function startSpan2(options) {
|
|
714
|
-
return
|
|
714
|
+
return chunkHNCWTENX_cjs.startSpan(options);
|
|
715
715
|
}
|
|
716
716
|
function span(options, fn) {
|
|
717
|
-
return
|
|
717
|
+
return chunkHNCWTENX_cjs.spanSync(options, fn);
|
|
718
718
|
}
|
|
719
719
|
function spanAsync2(options, fn) {
|
|
720
|
-
return
|
|
720
|
+
return chunkHNCWTENX_cjs.spanAsync(options, fn);
|
|
721
721
|
}
|
|
722
|
-
var flush =
|
|
722
|
+
var flush = chunkT2KW3P23_cjs.absorbErrorsAsync(
|
|
723
723
|
async () => {
|
|
724
724
|
if (singleton !== null) {
|
|
725
725
|
await singleton.transport.flush();
|
|
726
|
-
await
|
|
726
|
+
await chunkHNCWTENX_cjs.getEngine().flush();
|
|
727
727
|
}
|
|
728
728
|
},
|
|
729
729
|
{ fingerprint: "morse.flush" }
|
|
730
730
|
);
|
|
731
|
-
var quotaState2 =
|
|
731
|
+
var quotaState2 = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
732
732
|
() => {
|
|
733
733
|
if (singleton === null) return null;
|
|
734
734
|
return getQuotaState();
|
|
735
735
|
},
|
|
736
736
|
{ fingerprint: "morse.quota_state" }
|
|
737
737
|
);
|
|
738
|
-
var shutdown =
|
|
738
|
+
var shutdown = chunkT2KW3P23_cjs.absorbErrorsAsync(
|
|
739
739
|
async () => {
|
|
740
740
|
if (singleton !== null) {
|
|
741
741
|
await singleton.transport.shutdown();
|
|
742
|
-
await
|
|
743
|
-
|
|
742
|
+
await chunkHNCWTENX_cjs.getEngine().flush();
|
|
743
|
+
chunkHNCWTENX_cjs.getEngine().shutdown();
|
|
744
744
|
singleton = null;
|
|
745
|
-
|
|
745
|
+
chunkHNCWTENX_cjs.setTransport(null);
|
|
746
746
|
}
|
|
747
747
|
},
|
|
748
748
|
{ fingerprint: "morse.shutdown" }
|
|
@@ -751,14 +751,14 @@ function _resetForTesting4() {
|
|
|
751
751
|
if (singleton !== null) {
|
|
752
752
|
void singleton.transport.shutdown();
|
|
753
753
|
singleton = null;
|
|
754
|
-
|
|
754
|
+
chunkHNCWTENX_cjs.setTransport(null);
|
|
755
755
|
}
|
|
756
|
-
|
|
756
|
+
chunkHNCWTENX_cjs.getEngine().resetForTesting();
|
|
757
757
|
noApiKeyWarningEmitted = false;
|
|
758
758
|
lastLoggedEndpoint = null;
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
759
|
+
chunkHNCWTENX_cjs.setSource(null);
|
|
760
|
+
chunkHNCWTENX_cjs._resetForTesting();
|
|
761
|
+
chunkT2KW3P23_cjs._resetForTesting();
|
|
762
762
|
_resetForTesting3();
|
|
763
763
|
_resetQuotaStateForTesting();
|
|
764
764
|
transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -767,59 +767,59 @@ function _setTransportFactoryForTesting(factory) {
|
|
|
767
767
|
transportFactory = factory;
|
|
768
768
|
}
|
|
769
769
|
function _getLastTraceForTesting() {
|
|
770
|
-
return
|
|
770
|
+
return chunkHNCWTENX_cjs.getLastTrace();
|
|
771
771
|
}
|
|
772
772
|
function _getActiveTraceStateForTesting() {
|
|
773
|
-
return
|
|
773
|
+
return chunkHNCWTENX_cjs.getActiveTraceState();
|
|
774
774
|
}
|
|
775
775
|
|
|
776
776
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
777
777
|
enumerable: true,
|
|
778
|
-
get: function () { return
|
|
778
|
+
get: function () { return chunkLQI63FHF_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
779
779
|
});
|
|
780
780
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
781
781
|
enumerable: true,
|
|
782
|
-
get: function () { return
|
|
782
|
+
get: function () { return chunkLQI63FHF_cjs.extractAnthropicSegments; }
|
|
783
783
|
});
|
|
784
784
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
785
785
|
enumerable: true,
|
|
786
|
-
get: function () { return
|
|
786
|
+
get: function () { return chunkLQI63FHF_cjs.instrumentAnthropic; }
|
|
787
787
|
});
|
|
788
788
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
789
789
|
enumerable: true,
|
|
790
|
-
get: function () { return
|
|
790
|
+
get: function () { return chunkLQI63FHF_cjs.isAnthropicWrapped; }
|
|
791
791
|
});
|
|
792
792
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
793
793
|
enumerable: true,
|
|
794
|
-
get: function () { return
|
|
794
|
+
get: function () { return chunkLQI63FHF_cjs.uninstallAnthropic; }
|
|
795
795
|
});
|
|
796
796
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
797
797
|
enumerable: true,
|
|
798
|
-
get: function () { return
|
|
798
|
+
get: function () { return chunkLQI63FHF_cjs.wrapAnthropic; }
|
|
799
799
|
});
|
|
800
800
|
Object.defineProperty(exports, "log", {
|
|
801
801
|
enumerable: true,
|
|
802
|
-
get: function () { return
|
|
802
|
+
get: function () { return chunkQXRJUPDP_cjs.log; }
|
|
803
803
|
});
|
|
804
804
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
805
805
|
enumerable: true,
|
|
806
|
-
get: function () { return
|
|
806
|
+
get: function () { return chunkHNCWTENX_cjs.W3C_TRACEPARENT_HEADER; }
|
|
807
807
|
});
|
|
808
808
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
809
809
|
enumerable: true,
|
|
810
|
-
get: function () { return
|
|
810
|
+
get: function () { return chunkHNCWTENX_cjs.extractTraceparent; }
|
|
811
811
|
});
|
|
812
812
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
813
813
|
enumerable: true,
|
|
814
|
-
get: function () { return
|
|
814
|
+
get: function () { return chunkHNCWTENX_cjs.formatTraceparent; }
|
|
815
815
|
});
|
|
816
816
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
817
817
|
enumerable: true,
|
|
818
|
-
get: function () { return
|
|
818
|
+
get: function () { return chunkHNCWTENX_cjs.injectIntoRequestInit; }
|
|
819
819
|
});
|
|
820
820
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
821
821
|
enumerable: true,
|
|
822
|
-
get: function () { return
|
|
822
|
+
get: function () { return chunkHNCWTENX_cjs.injectTraceparent; }
|
|
823
823
|
});
|
|
824
824
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
825
825
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { instrumentAnthropic } from './chunk-
|
|
2
|
-
export { MAX_SEGMENT_CONTENT_BYTES, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from './chunk-
|
|
3
|
-
import { _setEnsureInitialized } from './chunk-
|
|
4
|
-
export { log } from './chunk-
|
|
5
|
-
import { absorbErrorsSync, absorbErrorsAsync, report, _resetForTesting as _resetForTesting$1 } from './chunk-
|
|
1
|
+
import { instrumentAnthropic } from './chunk-STK4KJQ6.js';
|
|
2
|
+
export { MAX_SEGMENT_CONTENT_BYTES, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from './chunk-STK4KJQ6.js';
|
|
3
|
+
import { _setEnsureInitialized } from './chunk-V5J6J4ZR.js';
|
|
4
|
+
export { log } from './chunk-V5J6J4ZR.js';
|
|
5
|
+
import { absorbErrorsSync, absorbErrorsAsync, report, _resetForTesting as _resetForTesting$1 } from './chunk-POCQNSVD.js';
|
|
6
6
|
import './chunk-XTKMUJWI.js';
|
|
7
|
-
import { init_env, init_otel_provider, init_redaction, init_tracing, init_spans, init_propagation, redactValue, generateTraceId, nowIso, SpanType, generateSpanId, buildTraceEntry, sendTrace, isDisabled, buildRedactionConfig, getApiKey, getFlushIntervalSeconds, setTransport, setRedactionConfig, isValidInternalSource, getInternalSource, setSource, getEngine, getMaxFieldBytes, getMaxBatchSize, getMaxQueueSize, getSampleRate, getEndpoint, DEFAULT_ENDPOINT, isAutoDetectDisabled, isDbCaptureEnabled, runSync, runAsync, setContext, startSpan, spanSync, spanAsync, _resetForTesting, getLastTrace, getActiveTraceState } from './chunk-
|
|
8
|
-
export { W3C_TRACEPARENT_HEADER, extractTraceparent, formatTraceparent, injectIntoRequestInit, injectTraceparent } from './chunk-
|
|
7
|
+
import { init_env, init_otel_provider, init_redaction, init_tracing, init_spans, init_propagation, redactValue, generateTraceId, nowIso, SpanType, generateSpanId, buildTraceEntry, sendTrace, isDisabled, buildRedactionConfig, getApiKey, getFlushIntervalSeconds, setTransport, setRedactionConfig, isValidInternalSource, getInternalSource, setSource, getEngine, getMaxFieldBytes, getMaxBatchSize, getMaxQueueSize, getSampleRate, getEndpoint, DEFAULT_ENDPOINT, isAutoDetectDisabled, isDbCaptureEnabled, runSync, runAsync, setContext, startSpan, spanSync, spanAsync, _resetForTesting, getLastTrace, getActiveTraceState } from './chunk-LTKGLXAE.js';
|
|
8
|
+
export { W3C_TRACEPARENT_HEADER, extractTraceparent, formatTraceparent, injectIntoRequestInit, injectTraceparent } from './chunk-LTKGLXAE.js';
|
|
9
9
|
import { createRequire, Module } from 'module';
|
|
10
10
|
import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';
|
|
11
11
|
import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';
|
|
@@ -277,7 +277,7 @@ init_otel_provider();
|
|
|
277
277
|
init_redaction();
|
|
278
278
|
|
|
279
279
|
// src/_internal/transport.ts
|
|
280
|
-
var SDK_VERSION = "0.4.
|
|
280
|
+
var SDK_VERSION = "0.4.1" ;
|
|
281
281
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
282
282
|
function parseRetryAfter(value) {
|
|
283
283
|
if (!value) return null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkQXRJUPDP_cjs = require('../chunk-QXRJUPDP.cjs');
|
|
4
|
+
require('../chunk-T2KW3P23.cjs');
|
|
5
|
+
require('../chunk-HNCWTENX.cjs');
|
|
6
6
|
var stream = require('stream');
|
|
7
7
|
|
|
8
8
|
function pinoLevelToSeverity(level) {
|
|
@@ -36,7 +36,7 @@ function forwardPinoRecord(record) {
|
|
|
36
36
|
const msg = typeof record.msg === "string" ? record.msg : "";
|
|
37
37
|
const serviceName = typeof record.name === "string" && record.name.length > 0 ? record.name : void 0;
|
|
38
38
|
const attributes = pickAttributes(record);
|
|
39
|
-
|
|
39
|
+
chunkQXRJUPDP_cjs.log(msg, {
|
|
40
40
|
severity,
|
|
41
41
|
attributes,
|
|
42
42
|
...serviceName ? { serviceName } : {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { log } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { log } from '../chunk-V5J6J4ZR.js';
|
|
2
|
+
import '../chunk-POCQNSVD.js';
|
|
3
|
+
import '../chunk-LTKGLXAE.js';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
|
|
6
6
|
function pinoLevelToSeverity(level) {
|
package/dist/langchain/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkT2KW3P23_cjs = require('../chunk-T2KW3P23.cjs');
|
|
4
4
|
var chunkKJEO52QS_cjs = require('../chunk-KJEO52QS.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkHNCWTENX_cjs = require('../chunk-HNCWTENX.cjs');
|
|
6
6
|
|
|
7
7
|
// src/langchain/callback-handler.ts
|
|
8
|
-
|
|
8
|
+
chunkHNCWTENX_cjs.init_tracing();
|
|
9
9
|
var ADAPTER = "langchain-js";
|
|
10
10
|
var HANDLER_NAME = "morse_callback_handler";
|
|
11
11
|
var DEFAULT_AGENT_NAME = "langchain-agent";
|
|
@@ -205,7 +205,7 @@ var MorseCallbackHandler = class {
|
|
|
205
205
|
openSpan(runId, name, type, inputData, extraMetadata) {
|
|
206
206
|
if (typeof runId !== "string" || runId.length === 0) return null;
|
|
207
207
|
const metadata = { ...extraMetadata ?? {}, adapter: ADAPTER };
|
|
208
|
-
const handle =
|
|
208
|
+
const handle = chunkHNCWTENX_cjs.startSpan({ name, type, metadata });
|
|
209
209
|
if (handle === null) return null;
|
|
210
210
|
const wrapped = coerceStateValue(inputData);
|
|
211
211
|
if (wrapped !== void 0) handle.span.input_data = wrapped;
|
|
@@ -302,26 +302,26 @@ var MorseCallbackHandler = class {
|
|
|
302
302
|
return this.spanStack.get(runId);
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
|
-
var _handleChainStart =
|
|
305
|
+
var _handleChainStart = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
306
306
|
(self, chain, inputs, runId) => {
|
|
307
307
|
const chainName = resolveNameIdFirst(chain, "chain");
|
|
308
308
|
self._openSpan(runId, chainName, "agent", inputs);
|
|
309
309
|
},
|
|
310
310
|
{ fingerprint: "morse.langchain.handleChainStart" }
|
|
311
311
|
);
|
|
312
|
-
var _handleChainEnd =
|
|
312
|
+
var _handleChainEnd = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
313
313
|
(self, outputs, runId) => {
|
|
314
314
|
self._closeSpan(runId, outputs);
|
|
315
315
|
},
|
|
316
316
|
{ fingerprint: "morse.langchain.handleChainEnd" }
|
|
317
317
|
);
|
|
318
|
-
var _handleChainError =
|
|
318
|
+
var _handleChainError = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
319
319
|
(self, err, runId) => {
|
|
320
320
|
self._closeSpan(runId, void 0, err ?? new Error("langchain chain error"));
|
|
321
321
|
},
|
|
322
322
|
{ fingerprint: "morse.langchain.handleChainError" }
|
|
323
323
|
);
|
|
324
|
-
var _handleLLMStart =
|
|
324
|
+
var _handleLLMStart = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
325
325
|
(self, llm, prompts, runId, extraParams) => {
|
|
326
326
|
const llmName = resolveNameIdFirst(llm, "llm");
|
|
327
327
|
const invocationParams = extraParams?.invocation_params;
|
|
@@ -354,7 +354,7 @@ function toolsFromExtra(extra) {
|
|
|
354
354
|
const invocationParams = extra?.invocation_params;
|
|
355
355
|
return invocationParams?.tools;
|
|
356
356
|
}
|
|
357
|
-
var _handleChatModelStart =
|
|
357
|
+
var _handleChatModelStart = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
358
358
|
(self, llm, messages, runId, extraParams) => {
|
|
359
359
|
const llmName = resolveNameIdFirst(llm, "llm");
|
|
360
360
|
const invocationParams = extraParams?.invocation_params;
|
|
@@ -369,7 +369,7 @@ var _handleChatModelStart = chunk7EO7MQBA_cjs.absorbErrorsSync(
|
|
|
369
369
|
},
|
|
370
370
|
{ fingerprint: "morse.langchain.handleChatModelStart" }
|
|
371
371
|
);
|
|
372
|
-
var _handleLLMEnd =
|
|
372
|
+
var _handleLLMEnd = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
373
373
|
(self, response, runId) => {
|
|
374
374
|
const handle = self._getSpan(runId);
|
|
375
375
|
const outputText = extractOutputText(response);
|
|
@@ -392,32 +392,32 @@ var _handleLLMEnd = chunk7EO7MQBA_cjs.absorbErrorsSync(
|
|
|
392
392
|
},
|
|
393
393
|
{ fingerprint: "morse.langchain.handleLLMEnd" }
|
|
394
394
|
);
|
|
395
|
-
var _handleLLMError =
|
|
395
|
+
var _handleLLMError = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
396
396
|
(self, err, runId) => {
|
|
397
397
|
self._closeSpan(runId, void 0, err ?? new Error("langchain llm error"));
|
|
398
398
|
},
|
|
399
399
|
{ fingerprint: "morse.langchain.handleLLMError" }
|
|
400
400
|
);
|
|
401
|
-
var _handleToolStart =
|
|
401
|
+
var _handleToolStart = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
402
402
|
(self, tool, input, runId) => {
|
|
403
403
|
const toolName = resolveNameNameFirst(tool, "tool");
|
|
404
404
|
self._openSpan(runId, toolName, "tool", { input });
|
|
405
405
|
},
|
|
406
406
|
{ fingerprint: "morse.langchain.handleToolStart" }
|
|
407
407
|
);
|
|
408
|
-
var _handleToolEnd =
|
|
408
|
+
var _handleToolEnd = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
409
409
|
(self, output, runId) => {
|
|
410
410
|
self._closeSpan(runId, { output: String(output) });
|
|
411
411
|
},
|
|
412
412
|
{ fingerprint: "morse.langchain.handleToolEnd" }
|
|
413
413
|
);
|
|
414
|
-
var _handleToolError =
|
|
414
|
+
var _handleToolError = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
415
415
|
(self, err, runId) => {
|
|
416
416
|
self._closeSpan(runId, void 0, err ?? new Error("langchain tool error"));
|
|
417
417
|
},
|
|
418
418
|
{ fingerprint: "morse.langchain.handleToolError" }
|
|
419
419
|
);
|
|
420
|
-
var _handleRetrieverStart =
|
|
420
|
+
var _handleRetrieverStart = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
421
421
|
(self, retriever, query, runId) => {
|
|
422
422
|
const idPath = retriever?.id;
|
|
423
423
|
const retrieverName = (Array.isArray(idPath) && idPath.length > 0 ? idPath[idPath.length - 1] : void 0) || "retriever";
|
|
@@ -425,7 +425,7 @@ var _handleRetrieverStart = chunk7EO7MQBA_cjs.absorbErrorsSync(
|
|
|
425
425
|
},
|
|
426
426
|
{ fingerprint: "morse.langchain.handleRetrieverStart" }
|
|
427
427
|
);
|
|
428
|
-
var _handleRetrieverEnd =
|
|
428
|
+
var _handleRetrieverEnd = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
429
429
|
(self, documents, runId) => {
|
|
430
430
|
const docsOut = [];
|
|
431
431
|
for (const doc of documents ?? []) {
|
|
@@ -455,7 +455,7 @@ var _handleRetrieverEnd = chunk7EO7MQBA_cjs.absorbErrorsSync(
|
|
|
455
455
|
},
|
|
456
456
|
{ fingerprint: "morse.langchain.handleRetrieverEnd" }
|
|
457
457
|
);
|
|
458
|
-
var _handleRetrieverError =
|
|
458
|
+
var _handleRetrieverError = chunkT2KW3P23_cjs.absorbErrorsSync(
|
|
459
459
|
(self, err, runId) => {
|
|
460
460
|
self._closeSpan(runId, void 0, err ?? new Error("langchain retriever error"));
|
|
461
461
|
},
|
package/dist/langchain/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { absorbErrorsSync } from '../chunk-
|
|
1
|
+
import { absorbErrorsSync } from '../chunk-POCQNSVD.js';
|
|
2
2
|
import { decomposeOpenAiMessages } from '../chunk-4R4SHGOK.js';
|
|
3
|
-
import { init_tracing, startSpan } from '../chunk-
|
|
3
|
+
import { init_tracing, startSpan } from '../chunk-LTKGLXAE.js';
|
|
4
4
|
|
|
5
5
|
// src/langchain/callback-handler.ts
|
|
6
6
|
init_tracing();
|