@morsehq-dev/sdk 0.5.1-rc.1 → 0.6.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 +11 -11
- package/dist/anthropic/index.d.cts +1 -1
- package/dist/anthropic/index.d.ts +1 -1
- package/dist/anthropic/index.js +4 -4
- package/dist/anthropic-agent-sdk/index.cjs +44 -40
- package/dist/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/anthropic-agent-sdk/index.d.cts +1 -1
- package/dist/anthropic-agent-sdk/index.d.ts +1 -1
- package/dist/anthropic-agent-sdk/index.js +10 -6
- 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 +44 -40
- package/dist/browser/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/browser/anthropic-agent-sdk/index.js +10 -6
- package/dist/browser/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/{chunk-ZOOYJTDT.cjs → chunk-33WDUUKZ.cjs} +18 -18
- package/dist/browser/{chunk-ZOOYJTDT.cjs.map → chunk-33WDUUKZ.cjs.map} +1 -1
- package/dist/browser/{chunk-E6WORBIU.cjs → chunk-3I7IGP3P.cjs} +5 -5
- package/dist/browser/chunk-3I7IGP3P.cjs.map +1 -0
- package/dist/{chunk-FHQGPQFR.js → browser/chunk-3OYHDDOJ.js} +27 -5
- package/dist/browser/chunk-3OYHDDOJ.js.map +1 -0
- package/dist/browser/{chunk-HJTUPXNE.cjs → chunk-4IUHXUCJ.cjs} +21 -4
- package/dist/browser/chunk-4IUHXUCJ.cjs.map +1 -0
- package/dist/browser/{chunk-AX6NEG6X.js → chunk-5TYTCLKA.js} +4 -4
- package/dist/browser/{chunk-AX6NEG6X.js.map → chunk-5TYTCLKA.js.map} +1 -1
- package/dist/browser/{chunk-5IMBYZUB.js → chunk-6JHMFFPE.js} +3 -3
- package/dist/browser/chunk-6JHMFFPE.js.map +1 -0
- package/dist/{chunk-2UFTRWUS.cjs → browser/chunk-FKYI3N5N.cjs} +7 -7
- package/dist/browser/{chunk-FYIQARMI.cjs.map → chunk-FKYI3N5N.cjs.map} +1 -1
- package/dist/browser/{chunk-TIMAH323.js → chunk-FPTUHYDJ.js} +3 -3
- package/dist/browser/{chunk-TIMAH323.js.map → chunk-FPTUHYDJ.js.map} +1 -1
- package/dist/browser/{chunk-YXCWAU36.cjs → chunk-IDKQZ4X5.cjs} +38 -15
- package/dist/browser/chunk-IDKQZ4X5.cjs.map +1 -0
- package/dist/browser/{chunk-HNOHWDK3.cjs → chunk-LIP3XCTK.cjs} +12 -12
- package/dist/browser/{chunk-HNOHWDK3.cjs.map → chunk-LIP3XCTK.cjs.map} +1 -1
- package/dist/browser/{chunk-RDNSY73W.js → chunk-OUQAH27A.js} +3 -3
- package/dist/browser/{chunk-RDNSY73W.js.map → chunk-OUQAH27A.js.map} +1 -1
- package/dist/browser/{chunk-Z26QGUMP.cjs → chunk-PSNZZBQJ.cjs} +6 -6
- package/dist/browser/{chunk-Z26QGUMP.cjs.map → chunk-PSNZZBQJ.cjs.map} +1 -1
- package/dist/browser/{chunk-7G266PKE.js → chunk-PXHTLCEU.js} +21 -5
- package/dist/browser/chunk-PXHTLCEU.js.map +1 -0
- package/dist/browser/{chunk-VSHCKROM.js → chunk-TRVACYUN.js} +5 -5
- package/dist/browser/{chunk-VSHCKROM.js.map → chunk-TRVACYUN.js.map} +1 -1
- package/dist/browser/index.cjs +99 -99
- 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 +28 -26
- package/dist/browser/langchain/index.cjs.map +1 -1
- package/dist/browser/langchain/index.js +13 -11
- package/dist/browser/langchain/index.js.map +1 -1
- package/dist/browser/langgraph/index.cjs +32 -30
- package/dist/browser/langgraph/index.cjs.map +1 -1
- package/dist/browser/langgraph/index.js +10 -8
- package/dist/browser/langgraph/index.js.map +1 -1
- package/dist/browser/openai/index.cjs +11 -11
- package/dist/browser/openai/index.js +2 -2
- package/dist/browser/openai-agents/index.cjs +63 -35
- package/dist/browser/openai-agents/index.cjs.map +1 -1
- package/dist/browser/openai-agents/index.js +33 -5
- 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/{chunk-ZTBAMSCC.cjs → chunk-7DALGJL2.cjs} +72 -20
- package/dist/chunk-7DALGJL2.cjs.map +1 -0
- package/dist/{chunk-KALB7HJ5.cjs → chunk-B7TGG62X.cjs} +12 -12
- package/dist/{chunk-KALB7HJ5.cjs.map → chunk-B7TGG62X.cjs.map} +1 -1
- package/dist/{chunk-GATTHW3X.cjs → chunk-COZFARLL.cjs} +5 -5
- package/dist/chunk-COZFARLL.cjs.map +1 -0
- package/dist/{chunk-XBI4AMCW.cjs → chunk-DXTNU2KT.cjs} +38 -15
- package/dist/chunk-DXTNU2KT.cjs.map +1 -0
- package/dist/{chunk-5MJS5ECA.js → chunk-ERH3TNXZ.js} +3 -3
- package/dist/{chunk-5MJS5ECA.js.map → chunk-ERH3TNXZ.js.map} +1 -1
- package/dist/{chunk-QLJAATBR.cjs → chunk-ESJJXXB6.cjs} +6 -6
- package/dist/{chunk-QLJAATBR.cjs.map → chunk-ESJJXXB6.cjs.map} +1 -1
- package/dist/{chunk-HCN6Z56N.cjs → chunk-ETRNCI5Z.cjs} +18 -18
- package/dist/{chunk-HCN6Z56N.cjs.map → chunk-ETRNCI5Z.cjs.map} +1 -1
- package/dist/{browser/chunk-PIZVCAW7.js → chunk-GULJAURY.js} +27 -5
- package/dist/chunk-GULJAURY.js.map +1 -0
- package/dist/{chunk-YGKEP2GY.js → chunk-HJV35HWL.js} +72 -21
- package/dist/chunk-HJV35HWL.js.map +1 -0
- package/dist/{chunk-ZMRXUZ5L.js → chunk-L7AD4KUD.js} +3 -3
- package/dist/chunk-L7AD4KUD.js.map +1 -0
- package/dist/{chunk-GQVNZPRF.js → chunk-QBDTQTMN.js} +3 -3
- package/dist/{chunk-GQVNZPRF.js.map → chunk-QBDTQTMN.js.map} +1 -1
- package/dist/{browser/chunk-FYIQARMI.cjs → chunk-WG4H5JC6.cjs} +7 -7
- package/dist/{chunk-2UFTRWUS.cjs.map → chunk-WG4H5JC6.cjs.map} +1 -1
- package/dist/{chunk-62FWHZXN.js → chunk-XS4P7XPV.js} +5 -5
- package/dist/{chunk-62FWHZXN.js.map → chunk-XS4P7XPV.js.map} +1 -1
- package/dist/{chunk-4WUG3RMJ.js → chunk-YVLEDBN7.js} +4 -4
- package/dist/{chunk-4WUG3RMJ.js.map → chunk-YVLEDBN7.js.map} +1 -1
- package/dist/index.cjs +106 -106
- 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 +9 -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 +28 -26
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.d.cts +3 -3
- package/dist/langchain/index.d.ts +3 -3
- package/dist/langchain/index.js +13 -11
- package/dist/langchain/index.js.map +1 -1
- package/dist/langgraph/index.cjs +32 -30
- package/dist/langgraph/index.cjs.map +1 -1
- package/dist/langgraph/index.d.cts +3 -3
- package/dist/langgraph/index.d.ts +3 -3
- package/dist/langgraph/index.js +10 -8
- package/dist/langgraph/index.js.map +1 -1
- package/dist/openai/index.cjs +11 -11
- package/dist/openai/index.js +2 -2
- package/dist/openai-agents/index.cjs +63 -35
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.d.cts +13 -4
- package/dist/openai-agents/index.d.ts +13 -4
- package/dist/openai-agents/index.js +33 -5
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/{spans-DZtMuBvc.d.cts → spans-CBMWNg2C.d.cts} +1 -0
- package/dist/{spans-DZtMuBvc.d.ts → spans-CBMWNg2C.d.ts} +1 -0
- package/dist/{tracing-J8ZgxVzU.d.ts → tracing-BMWTyexr.d.ts} +1 -1
- package/dist/{tracing-CNlre8TK.d.cts → tracing-Bh-cbvr6.d.cts} +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-5IMBYZUB.js.map +0 -1
- package/dist/browser/chunk-7G266PKE.js.map +0 -1
- package/dist/browser/chunk-E6WORBIU.cjs.map +0 -1
- package/dist/browser/chunk-HJTUPXNE.cjs.map +0 -1
- package/dist/browser/chunk-PIZVCAW7.js.map +0 -1
- package/dist/browser/chunk-YXCWAU36.cjs.map +0 -1
- package/dist/chunk-FHQGPQFR.js.map +0 -1
- package/dist/chunk-GATTHW3X.cjs.map +0 -1
- package/dist/chunk-XBI4AMCW.cjs.map +0 -1
- package/dist/chunk-YGKEP2GY.js.map +0 -1
- package/dist/chunk-ZMRXUZ5L.js.map +0 -1
- package/dist/chunk-ZTBAMSCC.cjs.map +0 -1
package/dist/browser/index.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunk33WDUUKZ_cjs = require('./chunk-33WDUUKZ.cjs');
|
|
4
|
+
var chunkLIP3XCTK_cjs = require('./chunk-LIP3XCTK.cjs');
|
|
5
|
+
require('./chunk-3I7IGP3P.cjs');
|
|
6
|
+
var chunkPSNZZBQJ_cjs = require('./chunk-PSNZZBQJ.cjs');
|
|
7
7
|
require('./chunk-SWQOPFE4.cjs');
|
|
8
8
|
require('./chunk-RBNCTHK3.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunk4IUHXUCJ_cjs = require('./chunk-4IUHXUCJ.cjs');
|
|
10
10
|
|
|
11
11
|
// src/_internal/auto-detect.browser.ts
|
|
12
12
|
async function installAdapters() {
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// src/index.ts
|
|
16
|
-
|
|
16
|
+
chunk4IUHXUCJ_cjs.init_env();
|
|
17
17
|
|
|
18
18
|
// src/_internal/db-capture.browser.ts
|
|
19
19
|
function maybeEnableDbCaptureFromEnv() {
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// src/index.ts
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
chunk4IUHXUCJ_cjs.init_otel_provider_browser();
|
|
24
|
+
chunk4IUHXUCJ_cjs.init_redaction();
|
|
25
25
|
|
|
26
26
|
// src/_internal/transport.ts
|
|
27
|
-
|
|
28
|
-
var SDK_VERSION = "0.
|
|
27
|
+
chunk4IUHXUCJ_cjs.init_diagnostics();
|
|
28
|
+
var SDK_VERSION = "0.6.0-rc.1" ;
|
|
29
29
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
30
30
|
var MAX_SEND_ATTEMPTS = 3;
|
|
31
31
|
var BACKOFF_BASE_MS = 500;
|
|
@@ -36,9 +36,9 @@ function backoffDelayMs(attempt) {
|
|
|
36
36
|
return base * (0.5 + Math.random());
|
|
37
37
|
}
|
|
38
38
|
function dropReasonFor(attempt, closed, deadline) {
|
|
39
|
-
if (closed) return
|
|
40
|
-
if (attempt === 1 && Date.now() >= deadline) return
|
|
41
|
-
return
|
|
39
|
+
if (closed) return chunk4IUHXUCJ_cjs.REASON_SHUTDOWN_DROP;
|
|
40
|
+
if (attempt === 1 && Date.now() >= deadline) return chunk4IUHXUCJ_cjs.REASON_SEND_FAILED;
|
|
41
|
+
return chunk4IUHXUCJ_cjs.REASON_RETRY_EXHAUSTED;
|
|
42
42
|
}
|
|
43
43
|
function withDeadline(promise, deadline) {
|
|
44
44
|
const remaining = Math.max(0, deadline - Date.now());
|
|
@@ -159,11 +159,11 @@ var BatchTransport = class {
|
|
|
159
159
|
/** Enqueue an event. Non-blocking. Returns false if the queue is full. */
|
|
160
160
|
track(event) {
|
|
161
161
|
if (this.closed) {
|
|
162
|
-
|
|
162
|
+
chunk4IUHXUCJ_cjs.recordDrop(chunk4IUHXUCJ_cjs.REASON_SHUTDOWN_DROP, "trace");
|
|
163
163
|
return false;
|
|
164
164
|
}
|
|
165
165
|
if (this.queue.length >= this.maxQueueSize) {
|
|
166
|
-
|
|
166
|
+
chunk4IUHXUCJ_cjs.recordDrop(chunk4IUHXUCJ_cjs.REASON_QUEUE_FULL, "trace");
|
|
167
167
|
return false;
|
|
168
168
|
}
|
|
169
169
|
this.queue.push(event);
|
|
@@ -241,8 +241,8 @@ var BatchTransport = class {
|
|
|
241
241
|
try {
|
|
242
242
|
body = JSON.stringify(payload);
|
|
243
243
|
} catch (err) {
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
chunk4IUHXUCJ_cjs.recordDrop(chunk4IUHXUCJ_cjs.REASON_ENCODE_FAILED, categoryOf(payload), countPayloadEntries(payload));
|
|
245
|
+
chunk4IUHXUCJ_cjs.report(err, {
|
|
246
246
|
fingerprint: "morse.transport.post.encode",
|
|
247
247
|
extra: { endpoint_host: hostnameOf(url), sdk_version: SDK_VERSION }
|
|
248
248
|
});
|
|
@@ -254,7 +254,7 @@ var BatchTransport = class {
|
|
|
254
254
|
const lastAttempt = attempt >= MAX_SEND_ATTEMPTS;
|
|
255
255
|
const outOfTime = Date.now() >= deadline;
|
|
256
256
|
if (outOfTime && attempt > 1) {
|
|
257
|
-
|
|
257
|
+
chunk4IUHXUCJ_cjs.recordDrop(chunk4IUHXUCJ_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
260
|
const controller = new AbortController();
|
|
@@ -273,7 +273,7 @@ var BatchTransport = class {
|
|
|
273
273
|
}),
|
|
274
274
|
deadline
|
|
275
275
|
);
|
|
276
|
-
|
|
276
|
+
chunk4IUHXUCJ_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
|
|
277
277
|
if (resp.ok) return;
|
|
278
278
|
if (resp.status === 429) await recordQuotaState(resp);
|
|
279
279
|
let bodySnippet = "";
|
|
@@ -281,13 +281,13 @@ var BatchTransport = class {
|
|
|
281
281
|
bodySnippet = (await resp.text()).slice(0, 200);
|
|
282
282
|
} catch {
|
|
283
283
|
}
|
|
284
|
-
|
|
284
|
+
chunk4IUHXUCJ_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
|
|
285
285
|
fingerprint: "morse.transport.post.non_2xx",
|
|
286
286
|
extra: { endpoint_host: hostnameOf(url), sdk_version: SDK_VERSION }
|
|
287
287
|
});
|
|
288
288
|
if (resp.status === 429) {
|
|
289
289
|
if (lastAttempt) {
|
|
290
|
-
|
|
290
|
+
chunk4IUHXUCJ_cjs.recordDrop(chunk4IUHXUCJ_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
293
|
const retryAfter = parseRetryAfter(resp.headers.get("Retry-After"));
|
|
@@ -295,26 +295,26 @@ var BatchTransport = class {
|
|
|
295
295
|
continue;
|
|
296
296
|
}
|
|
297
297
|
if (resp.status < 500) {
|
|
298
|
-
|
|
299
|
-
resp.status === 401 || resp.status === 403 ?
|
|
298
|
+
chunk4IUHXUCJ_cjs.recordDrop(
|
|
299
|
+
resp.status === 401 || resp.status === 403 ? chunk4IUHXUCJ_cjs.REASON_AUTH_REJECTED : chunk4IUHXUCJ_cjs.REASON_ENDPOINT_REJECTED,
|
|
300
300
|
droppedCategory,
|
|
301
301
|
droppedCount
|
|
302
302
|
);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
305
|
if (lastAttempt || this.closed || Date.now() >= deadline) {
|
|
306
|
-
|
|
306
|
+
chunk4IUHXUCJ_cjs.recordDrop(dropReasonFor(attempt, this.closed, deadline), droppedCategory, droppedCount);
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
309
|
await sleepUntil(backoffDelayMs(attempt), deadline);
|
|
310
310
|
continue;
|
|
311
311
|
} catch (err) {
|
|
312
|
-
|
|
312
|
+
chunk4IUHXUCJ_cjs.report(err, {
|
|
313
313
|
fingerprint: "morse.transport.post.network",
|
|
314
314
|
extra: { endpoint_host: hostnameOf(url), sdk_version: SDK_VERSION }
|
|
315
315
|
});
|
|
316
316
|
if (lastAttempt || this.closed || Date.now() >= deadline) {
|
|
317
|
-
|
|
317
|
+
chunk4IUHXUCJ_cjs.recordDrop(dropReasonFor(attempt, this.closed, deadline), droppedCategory, droppedCount);
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
320
|
await sleepUntil(backoffDelayMs(attempt), deadline);
|
|
@@ -357,10 +357,10 @@ function categoryOf(payload) {
|
|
|
357
357
|
}
|
|
358
358
|
|
|
359
359
|
// src/index.ts
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
360
|
+
chunk4IUHXUCJ_cjs.init_tracing();
|
|
361
|
+
chunk4IUHXUCJ_cjs.init_diagnostics();
|
|
362
|
+
chunk4IUHXUCJ_cjs.init_spans();
|
|
363
|
+
chunk4IUHXUCJ_cjs.init_propagation();
|
|
364
364
|
var version = SDK_VERSION;
|
|
365
365
|
var singleton = null;
|
|
366
366
|
var transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -380,9 +380,9 @@ function logDestinationOnce(endpoint) {
|
|
|
380
380
|
}
|
|
381
381
|
function resolveEndpoint(explicit) {
|
|
382
382
|
if (explicit && explicit.length > 0) return explicit;
|
|
383
|
-
const fromEnv =
|
|
383
|
+
const fromEnv = chunk4IUHXUCJ_cjs.getEndpoint();
|
|
384
384
|
if (fromEnv) return fromEnv;
|
|
385
|
-
return
|
|
385
|
+
return chunk4IUHXUCJ_cjs.DEFAULT_ENDPOINT;
|
|
386
386
|
}
|
|
387
387
|
var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
|
|
388
388
|
function deriveOtlpEndpoint(tracesEndpoint) {
|
|
@@ -397,10 +397,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
|
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
function buildSingleton(opts, redaction) {
|
|
400
|
-
if (
|
|
400
|
+
if (chunk4IUHXUCJ_cjs.isDisabled()) {
|
|
401
401
|
return null;
|
|
402
402
|
}
|
|
403
|
-
const apiKey = opts.apiKey ??
|
|
403
|
+
const apiKey = opts.apiKey ?? chunk4IUHXUCJ_cjs.getApiKey();
|
|
404
404
|
if (!apiKey) {
|
|
405
405
|
if (!noApiKeyWarningEmitted) {
|
|
406
406
|
logger(
|
|
@@ -412,24 +412,24 @@ function buildSingleton(opts, redaction) {
|
|
|
412
412
|
return null;
|
|
413
413
|
}
|
|
414
414
|
const endpoint = resolveEndpoint(opts.endpoint);
|
|
415
|
-
const flushIntervalSeconds = opts.flushIntervalSeconds ??
|
|
415
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunk4IUHXUCJ_cjs.getFlushIntervalSeconds();
|
|
416
416
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const explicitSource =
|
|
421
|
-
const resolvedSource = explicitSource ??
|
|
422
|
-
|
|
417
|
+
chunk4IUHXUCJ_cjs.setTransport(transport);
|
|
418
|
+
chunk4IUHXUCJ_cjs.setRedactionConfig(redaction);
|
|
419
|
+
chunk4IUHXUCJ_cjs.setDiagnosticsClientConfig({ apiKey, endpoint });
|
|
420
|
+
const explicitSource = chunk4IUHXUCJ_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
421
|
+
const resolvedSource = explicitSource ?? chunk4IUHXUCJ_cjs.getInternalSource() ?? null;
|
|
422
|
+
chunk4IUHXUCJ_cjs.setSource(resolvedSource);
|
|
423
423
|
logDestinationOnce(endpoint);
|
|
424
424
|
try {
|
|
425
|
-
|
|
425
|
+
chunk4IUHXUCJ_cjs.getEngine().configure({
|
|
426
426
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
427
427
|
apiKey,
|
|
428
|
-
sampleRate:
|
|
428
|
+
sampleRate: chunk4IUHXUCJ_cjs.getSampleRate(),
|
|
429
429
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
430
|
-
maxQueueSize:
|
|
431
|
-
maxExportBatchSize:
|
|
432
|
-
maxFieldBytes:
|
|
430
|
+
maxQueueSize: chunk4IUHXUCJ_cjs.getMaxQueueSize(),
|
|
431
|
+
maxExportBatchSize: chunk4IUHXUCJ_cjs.getMaxBatchSize(),
|
|
432
|
+
maxFieldBytes: chunk4IUHXUCJ_cjs.getMaxFieldBytes(),
|
|
433
433
|
// 10s (not the exporter's un-overridden 30s ceiling): a genuine
|
|
434
434
|
// network blip still gets several retries with backoff; a fully dead
|
|
435
435
|
// endpoint fails within a bounded, shutdown-friendly window instead
|
|
@@ -438,32 +438,32 @@ function buildSingleton(opts, redaction) {
|
|
|
438
438
|
redactionConfig: redaction
|
|
439
439
|
});
|
|
440
440
|
} catch (err) {
|
|
441
|
-
|
|
441
|
+
chunk4IUHXUCJ_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
|
|
442
442
|
}
|
|
443
443
|
void installAdapters().catch(() => {
|
|
444
444
|
});
|
|
445
445
|
try {
|
|
446
446
|
maybeEnableDbCaptureFromEnv();
|
|
447
447
|
} catch (err) {
|
|
448
|
-
|
|
448
|
+
chunk4IUHXUCJ_cjs.report(err, { fingerprint: "morse.db_capture.register" });
|
|
449
449
|
}
|
|
450
450
|
return { apiKey, endpoint, transport, redaction };
|
|
451
451
|
}
|
|
452
452
|
function ensureInitialized() {
|
|
453
|
-
if (
|
|
453
|
+
if (chunk4IUHXUCJ_cjs.isDisabled()) return null;
|
|
454
454
|
if (singleton !== null) return singleton;
|
|
455
|
-
singleton = buildSingleton({},
|
|
455
|
+
singleton = buildSingleton({}, chunk4IUHXUCJ_cjs.buildRedactionConfig());
|
|
456
456
|
return singleton;
|
|
457
457
|
}
|
|
458
|
-
|
|
458
|
+
chunkLIP3XCTK_cjs._setEnsureInitialized(() => {
|
|
459
459
|
ensureInitialized();
|
|
460
460
|
});
|
|
461
461
|
function init(options = {}) {
|
|
462
|
-
if (
|
|
462
|
+
if (chunk4IUHXUCJ_cjs.isDisabled()) {
|
|
463
463
|
logger("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
|
-
const redaction =
|
|
466
|
+
const redaction = chunk4IUHXUCJ_cjs.buildRedactionConfig(options.redaction);
|
|
467
467
|
try {
|
|
468
468
|
if (singleton !== null) {
|
|
469
469
|
void singleton.transport.shutdown();
|
|
@@ -471,10 +471,10 @@ function init(options = {}) {
|
|
|
471
471
|
}
|
|
472
472
|
singleton = buildSingleton(options, redaction);
|
|
473
473
|
} catch (err) {
|
|
474
|
-
|
|
474
|
+
chunk4IUHXUCJ_cjs.report(err, { fingerprint: "morse.init" });
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
var track =
|
|
477
|
+
var track = chunkPSNZZBQJ_cjs.absorbErrorsSync(
|
|
478
478
|
(options) => {
|
|
479
479
|
const state = ensureInitialized();
|
|
480
480
|
if (!state) return;
|
|
@@ -482,33 +482,33 @@ var track = chunkZ26QGUMP_cjs.absorbErrorsSync(
|
|
|
482
482
|
agent_id: options.agentId,
|
|
483
483
|
...options.runData
|
|
484
484
|
};
|
|
485
|
-
const redacted =
|
|
485
|
+
const redacted = chunk4IUHXUCJ_cjs.redactValue(payload, state.redaction);
|
|
486
486
|
state.transport.track(redacted);
|
|
487
487
|
},
|
|
488
488
|
{ fingerprint: "morse.track" }
|
|
489
489
|
);
|
|
490
|
-
var batchTrack =
|
|
490
|
+
var batchTrack = chunkPSNZZBQJ_cjs.absorbErrorsSync(
|
|
491
491
|
(runs) => {
|
|
492
492
|
const state = ensureInitialized();
|
|
493
493
|
if (!state) return;
|
|
494
494
|
for (const run2 of runs) {
|
|
495
|
-
const redacted =
|
|
495
|
+
const redacted = chunk4IUHXUCJ_cjs.redactValue(run2, state.redaction);
|
|
496
496
|
state.transport.track(redacted);
|
|
497
497
|
}
|
|
498
498
|
},
|
|
499
499
|
{ fingerprint: "morse.batch_track" }
|
|
500
500
|
);
|
|
501
|
-
var record =
|
|
501
|
+
var record = chunkPSNZZBQJ_cjs.absorbErrorsSync(
|
|
502
502
|
(rec) => {
|
|
503
503
|
const state = ensureInitialized();
|
|
504
504
|
if (!state) return;
|
|
505
|
-
const traceId =
|
|
506
|
-
const now =
|
|
505
|
+
const traceId = chunk4IUHXUCJ_cjs.generateTraceId();
|
|
506
|
+
const now = chunk4IUHXUCJ_cjs.nowIso();
|
|
507
507
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
508
508
|
const span2 = {
|
|
509
509
|
trace_id: traceId,
|
|
510
|
-
span_id:
|
|
511
|
-
type:
|
|
510
|
+
span_id: chunk4IUHXUCJ_cjs.generateSpanId(),
|
|
511
|
+
type: chunk4IUHXUCJ_cjs.SpanType.AGENT,
|
|
512
512
|
name: rec.agent,
|
|
513
513
|
started_at: now,
|
|
514
514
|
ended_at: now,
|
|
@@ -533,58 +533,58 @@ var record = chunkZ26QGUMP_cjs.absorbErrorsSync(
|
|
|
533
533
|
success: rec.success,
|
|
534
534
|
outcome: rec.outcome
|
|
535
535
|
};
|
|
536
|
-
const entry =
|
|
537
|
-
const redacted =
|
|
538
|
-
|
|
536
|
+
const entry = chunk4IUHXUCJ_cjs.buildTraceEntry(traceFields, [span2]);
|
|
537
|
+
const redacted = chunk4IUHXUCJ_cjs.redactValue(entry, state.redaction);
|
|
538
|
+
chunk4IUHXUCJ_cjs.sendTrace(redacted);
|
|
539
539
|
},
|
|
540
540
|
{ fingerprint: "morse.record" }
|
|
541
541
|
);
|
|
542
542
|
function run(nameOrOpts, fn) {
|
|
543
543
|
const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
|
|
544
544
|
ensureInitialized();
|
|
545
|
-
return
|
|
545
|
+
return chunk4IUHXUCJ_cjs.runSync(opts, fn);
|
|
546
546
|
}
|
|
547
547
|
function runTraced(options, fn) {
|
|
548
548
|
ensureInitialized();
|
|
549
|
-
return
|
|
549
|
+
return chunk4IUHXUCJ_cjs.runAsync(options, fn);
|
|
550
550
|
}
|
|
551
551
|
function setContext2(dims) {
|
|
552
|
-
|
|
552
|
+
chunk4IUHXUCJ_cjs.setContext(dims);
|
|
553
553
|
}
|
|
554
554
|
function startSpan2(options) {
|
|
555
|
-
return
|
|
555
|
+
return chunk4IUHXUCJ_cjs.startSpan(options);
|
|
556
556
|
}
|
|
557
557
|
function span(options, fn) {
|
|
558
|
-
return
|
|
558
|
+
return chunk4IUHXUCJ_cjs.spanSync(options, fn);
|
|
559
559
|
}
|
|
560
560
|
function spanAsync2(options, fn) {
|
|
561
|
-
return
|
|
561
|
+
return chunk4IUHXUCJ_cjs.spanAsync(options, fn);
|
|
562
562
|
}
|
|
563
|
-
var flush =
|
|
563
|
+
var flush = chunkPSNZZBQJ_cjs.absorbErrorsAsync(
|
|
564
564
|
async () => {
|
|
565
565
|
if (singleton !== null) {
|
|
566
566
|
await singleton.transport.flush();
|
|
567
|
-
await
|
|
567
|
+
await chunk4IUHXUCJ_cjs.getEngine().flush();
|
|
568
568
|
}
|
|
569
569
|
},
|
|
570
570
|
{ fingerprint: "morse.flush" }
|
|
571
571
|
);
|
|
572
|
-
var quotaState2 =
|
|
572
|
+
var quotaState2 = chunkPSNZZBQJ_cjs.absorbErrorsSync(
|
|
573
573
|
() => {
|
|
574
574
|
if (singleton === null) return null;
|
|
575
575
|
return getQuotaState();
|
|
576
576
|
},
|
|
577
577
|
{ fingerprint: "morse.quota_state" }
|
|
578
578
|
);
|
|
579
|
-
var shutdown =
|
|
579
|
+
var shutdown = chunkPSNZZBQJ_cjs.absorbErrorsAsync(
|
|
580
580
|
async () => {
|
|
581
581
|
if (singleton !== null) {
|
|
582
582
|
await singleton.transport.shutdown();
|
|
583
|
-
await
|
|
584
|
-
|
|
585
|
-
await
|
|
583
|
+
await chunk4IUHXUCJ_cjs.getEngine().flush();
|
|
584
|
+
chunk4IUHXUCJ_cjs.getEngine().shutdown();
|
|
585
|
+
await chunk4IUHXUCJ_cjs.flushOnce();
|
|
586
586
|
singleton = null;
|
|
587
|
-
|
|
587
|
+
chunk4IUHXUCJ_cjs.setTransport(null);
|
|
588
588
|
}
|
|
589
589
|
},
|
|
590
590
|
{ fingerprint: "morse.shutdown" }
|
|
@@ -593,14 +593,14 @@ function _resetForTesting4() {
|
|
|
593
593
|
if (singleton !== null) {
|
|
594
594
|
void singleton.transport.shutdown();
|
|
595
595
|
singleton = null;
|
|
596
|
-
|
|
596
|
+
chunk4IUHXUCJ_cjs.setTransport(null);
|
|
597
597
|
}
|
|
598
|
-
|
|
598
|
+
chunk4IUHXUCJ_cjs.getEngine().resetForTesting();
|
|
599
599
|
noApiKeyWarningEmitted = false;
|
|
600
600
|
lastLoggedEndpoint = null;
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
601
|
+
chunk4IUHXUCJ_cjs.setSource(null);
|
|
602
|
+
chunk4IUHXUCJ_cjs._resetForTesting2();
|
|
603
|
+
chunk4IUHXUCJ_cjs._resetForTesting();
|
|
604
604
|
_resetQuotaStateForTesting();
|
|
605
605
|
transportFactory = (opts) => new BatchTransport(opts);
|
|
606
606
|
}
|
|
@@ -608,59 +608,59 @@ function _setTransportFactoryForTesting(factory) {
|
|
|
608
608
|
transportFactory = factory;
|
|
609
609
|
}
|
|
610
610
|
function _getLastTraceForTesting() {
|
|
611
|
-
return
|
|
611
|
+
return chunk4IUHXUCJ_cjs.getLastTrace();
|
|
612
612
|
}
|
|
613
613
|
function _getActiveTraceStateForTesting() {
|
|
614
|
-
return
|
|
614
|
+
return chunk4IUHXUCJ_cjs.getActiveTraceState();
|
|
615
615
|
}
|
|
616
616
|
|
|
617
617
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
618
618
|
enumerable: true,
|
|
619
|
-
get: function () { return
|
|
619
|
+
get: function () { return chunk33WDUUKZ_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
620
620
|
});
|
|
621
621
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
622
622
|
enumerable: true,
|
|
623
|
-
get: function () { return
|
|
623
|
+
get: function () { return chunk33WDUUKZ_cjs.extractAnthropicSegments; }
|
|
624
624
|
});
|
|
625
625
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
626
626
|
enumerable: true,
|
|
627
|
-
get: function () { return
|
|
627
|
+
get: function () { return chunk33WDUUKZ_cjs.instrumentAnthropic; }
|
|
628
628
|
});
|
|
629
629
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
630
630
|
enumerable: true,
|
|
631
|
-
get: function () { return
|
|
631
|
+
get: function () { return chunk33WDUUKZ_cjs.isAnthropicWrapped; }
|
|
632
632
|
});
|
|
633
633
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
634
634
|
enumerable: true,
|
|
635
|
-
get: function () { return
|
|
635
|
+
get: function () { return chunk33WDUUKZ_cjs.uninstallAnthropic; }
|
|
636
636
|
});
|
|
637
637
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
638
638
|
enumerable: true,
|
|
639
|
-
get: function () { return
|
|
639
|
+
get: function () { return chunk33WDUUKZ_cjs.wrapAnthropic; }
|
|
640
640
|
});
|
|
641
641
|
Object.defineProperty(exports, "log", {
|
|
642
642
|
enumerable: true,
|
|
643
|
-
get: function () { return
|
|
643
|
+
get: function () { return chunkLIP3XCTK_cjs.log; }
|
|
644
644
|
});
|
|
645
645
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
646
646
|
enumerable: true,
|
|
647
|
-
get: function () { return
|
|
647
|
+
get: function () { return chunk4IUHXUCJ_cjs.W3C_TRACEPARENT_HEADER; }
|
|
648
648
|
});
|
|
649
649
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
650
650
|
enumerable: true,
|
|
651
|
-
get: function () { return
|
|
651
|
+
get: function () { return chunk4IUHXUCJ_cjs.extractTraceparent; }
|
|
652
652
|
});
|
|
653
653
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
654
654
|
enumerable: true,
|
|
655
|
-
get: function () { return
|
|
655
|
+
get: function () { return chunk4IUHXUCJ_cjs.formatTraceparent; }
|
|
656
656
|
});
|
|
657
657
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
658
658
|
enumerable: true,
|
|
659
|
-
get: function () { return
|
|
659
|
+
get: function () { return chunk4IUHXUCJ_cjs.injectIntoRequestInit; }
|
|
660
660
|
});
|
|
661
661
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
662
662
|
enumerable: true,
|
|
663
|
-
get: function () { return
|
|
663
|
+
get: function () { return chunk4IUHXUCJ_cjs.injectTraceparent; }
|
|
664
664
|
});
|
|
665
665
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
666
666
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|
package/dist/browser/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { MAX_SEGMENT_CONTENT_BYTES, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from './chunk-
|
|
2
|
-
import { _setEnsureInitialized } from './chunk-
|
|
3
|
-
export { log } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import { absorbErrorsSync, absorbErrorsAsync } from './chunk-
|
|
1
|
+
export { MAX_SEGMENT_CONTENT_BYTES, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from './chunk-TRVACYUN.js';
|
|
2
|
+
import { _setEnsureInitialized } from './chunk-5TYTCLKA.js';
|
|
3
|
+
export { log } from './chunk-5TYTCLKA.js';
|
|
4
|
+
import './chunk-6JHMFFPE.js';
|
|
5
|
+
import { absorbErrorsSync, absorbErrorsAsync } from './chunk-OUQAH27A.js';
|
|
6
6
|
import './chunk-4FALQMOZ.js';
|
|
7
7
|
import './chunk-MLDVXMQD.js';
|
|
8
|
-
import { init_env, init_otel_provider_browser, init_redaction, init_diagnostics, init_tracing, init_spans, init_propagation, redactValue, generateTraceId, nowIso, SpanType, generateSpanId, buildTraceEntry, sendTrace, isDisabled, buildRedactionConfig, getApiKey, getFlushIntervalSeconds, setTransport, setRedactionConfig, setDiagnosticsClientConfig, isValidInternalSource, getInternalSource, setSource, getEngine, getMaxFieldBytes, getMaxBatchSize, getMaxQueueSize, getSampleRate, report, getEndpoint, DEFAULT_ENDPOINT, recordDrop, REASON_SHUTDOWN_DROP, REASON_QUEUE_FULL, REASON_ENCODE_FAILED, REASON_RETRY_EXHAUSTED, setLevel, REASON_QUOTA_REJECTED, REASON_AUTH_REJECTED, REASON_ENDPOINT_REJECTED, REASON_SEND_FAILED, runSync, runAsync, setContext, startSpan, spanSync, spanAsync, flushOnce, _resetForTesting2, _resetForTesting, getLastTrace, getActiveTraceState } from './chunk-
|
|
9
|
-
export { W3C_TRACEPARENT_HEADER, extractTraceparent, formatTraceparent, injectIntoRequestInit, injectTraceparent } from './chunk-
|
|
8
|
+
import { init_env, init_otel_provider_browser, init_redaction, init_diagnostics, init_tracing, init_spans, init_propagation, redactValue, generateTraceId, nowIso, SpanType, generateSpanId, buildTraceEntry, sendTrace, isDisabled, buildRedactionConfig, getApiKey, getFlushIntervalSeconds, setTransport, setRedactionConfig, setDiagnosticsClientConfig, isValidInternalSource, getInternalSource, setSource, getEngine, getMaxFieldBytes, getMaxBatchSize, getMaxQueueSize, getSampleRate, report, getEndpoint, DEFAULT_ENDPOINT, recordDrop, REASON_SHUTDOWN_DROP, REASON_QUEUE_FULL, REASON_ENCODE_FAILED, REASON_RETRY_EXHAUSTED, setLevel, REASON_QUOTA_REJECTED, REASON_AUTH_REJECTED, REASON_ENDPOINT_REJECTED, REASON_SEND_FAILED, runSync, runAsync, setContext, startSpan, spanSync, spanAsync, flushOnce, _resetForTesting2, _resetForTesting, getLastTrace, getActiveTraceState } from './chunk-PXHTLCEU.js';
|
|
9
|
+
export { W3C_TRACEPARENT_HEADER, extractTraceparent, formatTraceparent, injectIntoRequestInit, injectTraceparent } from './chunk-PXHTLCEU.js';
|
|
10
10
|
|
|
11
11
|
// src/_internal/auto-detect.browser.ts
|
|
12
12
|
async function installAdapters() {
|
|
@@ -25,7 +25,7 @@ init_redaction();
|
|
|
25
25
|
|
|
26
26
|
// src/_internal/transport.ts
|
|
27
27
|
init_diagnostics();
|
|
28
|
-
var SDK_VERSION = "0.
|
|
28
|
+
var SDK_VERSION = "0.6.0-rc.1" ;
|
|
29
29
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
30
30
|
var MAX_SEND_ATTEMPTS = 3;
|
|
31
31
|
var BACKOFF_BASE_MS = 500;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkLIP3XCTK_cjs = require('../chunk-LIP3XCTK.cjs');
|
|
4
|
+
require('../chunk-PSNZZBQJ.cjs');
|
|
5
|
+
require('../chunk-4IUHXUCJ.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
|
+
chunkLIP3XCTK_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-5TYTCLKA.js';
|
|
2
|
+
import '../chunk-OUQAH27A.js';
|
|
3
|
+
import '../chunk-PXHTLCEU.js';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
|
|
6
6
|
function pinoLevelToSeverity(level) {
|