@morsehq-dev/sdk 0.4.1 → 0.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anthropic/index.cjs +12 -10
- package/dist/anthropic/index.js +5 -3
- package/dist/anthropic-agent-sdk/index.cjs +52 -34
- package/dist/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/anthropic-agent-sdk/index.js +25 -7
- package/dist/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/anthropic/index.cjs +12 -10
- package/dist/browser/anthropic/index.js +5 -3
- package/dist/browser/anthropic-agent-sdk/index.cjs +52 -34
- package/dist/browser/anthropic-agent-sdk/index.cjs.map +1 -1
- package/dist/browser/anthropic-agent-sdk/index.js +25 -7
- package/dist/browser/anthropic-agent-sdk/index.js.map +1 -1
- package/dist/browser/chunk-32U547L3.js +118 -0
- package/dist/browser/chunk-32U547L3.js.map +1 -0
- package/dist/{chunk-SBGY5NS4.js → browser/chunk-454FDWBM.js} +6 -4
- package/dist/browser/chunk-454FDWBM.js.map +1 -0
- package/dist/browser/{chunk-EFUQVASI.cjs → chunk-5EFKNOO7.cjs} +17 -15
- package/dist/browser/chunk-5EFKNOO7.cjs.map +1 -0
- package/dist/browser/{chunk-DOLWR7LD.js → chunk-5IWGFPKQ.js} +4 -4
- package/dist/browser/{chunk-DOLWR7LD.js.map → chunk-5IWGFPKQ.js.map} +1 -1
- package/dist/browser/{chunk-F3B4UR64.js → chunk-6DOP3MTY.js} +386 -53
- package/dist/browser/chunk-6DOP3MTY.js.map +1 -0
- package/dist/browser/{chunk-GWJYOQNC.js → chunk-A7P3ZBZX.js} +10 -4
- package/dist/browser/chunk-A7P3ZBZX.js.map +1 -0
- package/dist/browser/{chunk-M2GZJ3RS.cjs → chunk-AV35EOER.cjs} +20 -14
- package/dist/browser/chunk-AV35EOER.cjs.map +1 -0
- package/dist/browser/{chunk-AYNX24P5.js → chunk-AZ3SVK3K.js} +3 -3
- package/dist/browser/{chunk-AYNX24P5.js.map → chunk-AZ3SVK3K.js.map} +1 -1
- package/dist/browser/chunk-FNZWJU64.cjs +31 -0
- package/dist/browser/chunk-FNZWJU64.cjs.map +1 -0
- package/dist/browser/chunk-HZZK2EMO.cjs +126 -0
- package/dist/browser/chunk-HZZK2EMO.cjs.map +1 -0
- package/dist/browser/{chunk-QWRQJO57.js → chunk-MLDVXMQD.js} +3 -3
- package/dist/browser/{chunk-QWRQJO57.js.map → chunk-MLDVXMQD.js.map} +1 -1
- package/dist/{chunk-Y7SVGUKY.cjs → browser/chunk-NT37C2TK.cjs} +7 -7
- package/dist/browser/{chunk-YNUZGKUA.cjs.map → chunk-NT37C2TK.cjs.map} +1 -1
- package/dist/browser/{chunk-3643DC7K.cjs → chunk-RBNCTHK3.cjs} +5 -2
- package/dist/browser/{chunk-3643DC7K.cjs.map → chunk-RBNCTHK3.cjs.map} +1 -1
- package/dist/browser/chunk-VFNNU3AX.js +28 -0
- package/dist/browser/chunk-VFNNU3AX.js.map +1 -0
- package/dist/browser/{chunk-HGN7J3EU.cjs → chunk-WY2VLKRR.cjs} +12 -12
- package/dist/browser/{chunk-HGN7J3EU.cjs.map → chunk-WY2VLKRR.cjs.map} +1 -1
- package/dist/browser/{chunk-DXWHT3HK.cjs → chunk-ZGYZZCUK.cjs} +391 -55
- package/dist/browser/chunk-ZGYZZCUK.cjs.map +1 -0
- package/dist/browser/index.cjs +112 -82
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +40 -10
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/integrations/pino.cjs +4 -4
- package/dist/browser/integrations/pino.js +3 -3
- package/dist/browser/langchain/index.cjs +19 -19
- package/dist/browser/langchain/index.js +3 -3
- package/dist/browser/langgraph/index.cjs +34 -26
- package/dist/browser/langgraph/index.cjs.map +1 -1
- package/dist/browser/langgraph/index.js +16 -8
- package/dist/browser/langgraph/index.js.map +1 -1
- package/dist/browser/openai/index.cjs +22 -8
- package/dist/browser/openai/index.cjs.map +1 -1
- package/dist/browser/openai/index.js +17 -3
- package/dist/browser/openai/index.js.map +1 -1
- package/dist/browser/openai-agents/index.cjs +42 -34
- package/dist/browser/openai-agents/index.cjs.map +1 -1
- package/dist/browser/openai-agents/index.js +13 -5
- package/dist/browser/openai-agents/index.js.map +1 -1
- package/dist/browser/vercel-ai/index.cjs +16 -16
- package/dist/browser/vercel-ai/index.js +4 -4
- package/dist/{chunk-4R4SHGOK.js → chunk-4JPZV2VZ.js} +3 -3
- package/dist/{chunk-4R4SHGOK.js.map → chunk-4JPZV2VZ.js.map} +1 -1
- package/dist/{chunk-HNCWTENX.cjs → chunk-5B3IUESN.cjs} +415 -70
- package/dist/chunk-5B3IUESN.cjs.map +1 -0
- package/dist/chunk-5RXSICEJ.js +118 -0
- package/dist/chunk-5RXSICEJ.js.map +1 -0
- package/dist/chunk-7A2EWXZK.cjs +31 -0
- package/dist/chunk-7A2EWXZK.cjs.map +1 -0
- package/dist/{chunk-STK4KJQ6.js → chunk-AAR4FYFO.js} +10 -4
- package/dist/chunk-AAR4FYFO.js.map +1 -0
- package/dist/{chunk-LQI63FHF.cjs → chunk-ADRVMGAW.cjs} +20 -14
- package/dist/chunk-ADRVMGAW.cjs.map +1 -0
- package/dist/{chunk-V5J6J4ZR.js → chunk-CECVNM7R.js} +4 -4
- package/dist/{chunk-V5J6J4ZR.js.map → chunk-CECVNM7R.js.map} +1 -1
- package/dist/{chunk-KJEO52QS.cjs → chunk-HICEJ4LV.cjs} +5 -2
- package/dist/{chunk-KJEO52QS.cjs.map → chunk-HICEJ4LV.cjs.map} +1 -1
- package/dist/{chunk-QXRJUPDP.cjs → chunk-HSY7V4RG.cjs} +12 -12
- package/dist/{chunk-QXRJUPDP.cjs.map → chunk-HSY7V4RG.cjs.map} +1 -1
- package/dist/chunk-LB6ZLJUR.js +28 -0
- package/dist/chunk-LB6ZLJUR.js.map +1 -0
- package/dist/{browser/chunk-F7BGQ26H.js → chunk-O3Q5L2HY.js} +6 -4
- package/dist/chunk-O3Q5L2HY.js.map +1 -0
- package/dist/{chunk-5D6SBSEI.cjs → chunk-RF7NI5VN.cjs} +17 -15
- package/dist/chunk-RF7NI5VN.cjs.map +1 -0
- package/dist/{chunk-AEFUXEKV.js → chunk-TP3N3S2D.js} +3 -3
- package/dist/{chunk-AEFUXEKV.js.map → chunk-TP3N3S2D.js.map} +1 -1
- package/dist/{chunk-LTKGLXAE.js → chunk-UEKQIRRA.js} +410 -68
- package/dist/chunk-UEKQIRRA.js.map +1 -0
- package/dist/{browser/chunk-YNUZGKUA.cjs → chunk-UWQPOWJQ.cjs} +7 -7
- package/dist/{chunk-Y7SVGUKY.cjs.map → chunk-UWQPOWJQ.cjs.map} +1 -1
- package/dist/chunk-VD3KRXSP.cjs +126 -0
- package/dist/chunk-VD3KRXSP.cjs.map +1 -0
- package/dist/index.cjs +119 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -11
- package/dist/index.js.map +1 -1
- package/dist/integrations/pino.cjs +4 -4
- package/dist/integrations/pino.js +3 -3
- package/dist/langchain/index.cjs +19 -19
- package/dist/langchain/index.d.cts +1 -1
- package/dist/langchain/index.d.ts +1 -1
- package/dist/langchain/index.js +3 -3
- package/dist/langgraph/index.cjs +34 -26
- package/dist/langgraph/index.cjs.map +1 -1
- package/dist/langgraph/index.d.cts +1 -1
- package/dist/langgraph/index.d.ts +1 -1
- package/dist/langgraph/index.js +16 -8
- package/dist/langgraph/index.js.map +1 -1
- package/dist/openai/index.cjs +22 -8
- package/dist/openai/index.cjs.map +1 -1
- package/dist/openai/index.js +17 -3
- package/dist/openai/index.js.map +1 -1
- package/dist/openai-agents/index.cjs +42 -34
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.js +13 -5
- package/dist/openai-agents/index.js.map +1 -1
- package/dist/{tracing-BYAqjT5Q.d.cts → tracing-CNlre8TK.d.cts} +1 -0
- package/dist/{tracing-rz9cWQ8d.d.ts → tracing-J8ZgxVzU.d.ts} +1 -0
- package/dist/vercel-ai/index.cjs +16 -16
- package/dist/vercel-ai/index.js +4 -4
- package/package.json +1 -9
- package/dist/browser/chunk-3BGG7GH3.cjs +0 -183
- package/dist/browser/chunk-3BGG7GH3.cjs.map +0 -1
- package/dist/browser/chunk-DXWHT3HK.cjs.map +0 -1
- package/dist/browser/chunk-EFUQVASI.cjs.map +0 -1
- package/dist/browser/chunk-F3B4UR64.js.map +0 -1
- package/dist/browser/chunk-F7BGQ26H.js.map +0 -1
- package/dist/browser/chunk-GWJYOQNC.js.map +0 -1
- package/dist/browser/chunk-M2GZJ3RS.cjs.map +0 -1
- package/dist/browser/chunk-YHV5GL32.js +0 -178
- package/dist/browser/chunk-YHV5GL32.js.map +0 -1
- package/dist/chunk-5D6SBSEI.cjs.map +0 -1
- package/dist/chunk-HNCWTENX.cjs.map +0 -1
- package/dist/chunk-LQI63FHF.cjs.map +0 -1
- package/dist/chunk-LTKGLXAE.js.map +0 -1
- package/dist/chunk-POCQNSVD.js +0 -178
- package/dist/chunk-POCQNSVD.js.map +0 -1
- package/dist/chunk-SBGY5NS4.js.map +0 -1
- package/dist/chunk-STK4KJQ6.js.map +0 -1
- package/dist/chunk-T2KW3P23.cjs +0 -183
- package/dist/chunk-T2KW3P23.cjs.map +0 -1
package/dist/browser/index.cjs
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
3
|
+
var chunkAV35EOER_cjs = require('./chunk-AV35EOER.cjs');
|
|
4
|
+
var chunkWY2VLKRR_cjs = require('./chunk-WY2VLKRR.cjs');
|
|
5
|
+
require('./chunk-HZZK2EMO.cjs');
|
|
6
|
+
var chunkFNZWJU64_cjs = require('./chunk-FNZWJU64.cjs');
|
|
6
7
|
require('./chunk-SWQOPFE4.cjs');
|
|
7
|
-
|
|
8
|
+
require('./chunk-RBNCTHK3.cjs');
|
|
9
|
+
var chunkZGYZZCUK_cjs = require('./chunk-ZGYZZCUK.cjs');
|
|
8
10
|
|
|
9
11
|
// src/_internal/auto-detect.browser.ts
|
|
10
12
|
async function installAdapters() {
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
// src/index.ts
|
|
14
|
-
|
|
16
|
+
chunkZGYZZCUK_cjs.init_env();
|
|
15
17
|
|
|
16
18
|
// src/_internal/db-capture.browser.ts
|
|
17
19
|
function maybeEnableDbCaptureFromEnv() {
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
// src/index.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
chunkZGYZZCUK_cjs.init_otel_provider_browser();
|
|
24
|
+
chunkZGYZZCUK_cjs.init_redaction();
|
|
23
25
|
|
|
24
26
|
// src/_internal/transport.ts
|
|
25
|
-
|
|
27
|
+
chunkZGYZZCUK_cjs.init_diagnostics();
|
|
28
|
+
var SDK_VERSION = "0.5.0-rc.1" ;
|
|
26
29
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
27
30
|
function parseRetryAfter(value) {
|
|
28
31
|
if (!value) return null;
|
|
@@ -126,8 +129,14 @@ var BatchTransport = class {
|
|
|
126
129
|
}
|
|
127
130
|
/** Enqueue an event. Non-blocking. Returns false if the queue is full. */
|
|
128
131
|
track(event) {
|
|
129
|
-
if (this.closed)
|
|
130
|
-
|
|
132
|
+
if (this.closed) {
|
|
133
|
+
chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_SHUTDOWN_DROP, "trace");
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
if (this.queue.length >= this.maxQueueSize) {
|
|
137
|
+
chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_QUEUE_FULL, "trace");
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
131
140
|
this.queue.push(event);
|
|
132
141
|
if (this.queue.length >= this.maxBatchSize) {
|
|
133
142
|
void this.tick();
|
|
@@ -212,8 +221,12 @@ var BatchTransport = class {
|
|
|
212
221
|
body: JSON.stringify(payload),
|
|
213
222
|
signal: controller.signal
|
|
214
223
|
});
|
|
224
|
+
chunkZGYZZCUK_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
|
|
225
|
+
const droppedCount = countPayloadEntries(payload);
|
|
226
|
+
const droppedCategory = categoryOf(payload);
|
|
215
227
|
if (resp.status === 429) {
|
|
216
228
|
await recordQuotaState(resp);
|
|
229
|
+
chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
|
|
217
230
|
}
|
|
218
231
|
if (!resp.ok) {
|
|
219
232
|
let bodySnippet = "";
|
|
@@ -222,7 +235,10 @@ var BatchTransport = class {
|
|
|
222
235
|
bodySnippet = text.slice(0, 200);
|
|
223
236
|
} catch {
|
|
224
237
|
}
|
|
225
|
-
|
|
238
|
+
if (resp.status !== 429) {
|
|
239
|
+
chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
|
|
240
|
+
}
|
|
241
|
+
chunkZGYZZCUK_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
|
|
226
242
|
fingerprint: "morse.transport.post.non_2xx",
|
|
227
243
|
extra: {
|
|
228
244
|
endpoint_host: hostnameOf(url),
|
|
@@ -231,7 +247,8 @@ var BatchTransport = class {
|
|
|
231
247
|
});
|
|
232
248
|
}
|
|
233
249
|
} catch (err) {
|
|
234
|
-
|
|
250
|
+
chunkZGYZZCUK_cjs.recordDrop(chunkZGYZZCUK_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
|
|
251
|
+
chunkZGYZZCUK_cjs.report(err, {
|
|
235
252
|
fingerprint: "morse.transport.post.network",
|
|
236
253
|
extra: {
|
|
237
254
|
endpoint_host: hostnameOf(url),
|
|
@@ -261,11 +278,24 @@ function deriveLogsEndpoint(tracesEndpoint) {
|
|
|
261
278
|
return tracesEndpoint.replace(/\/api\/v1\/.*$/, "/api/v1/logs/ingest");
|
|
262
279
|
}
|
|
263
280
|
}
|
|
281
|
+
function countPayloadEntries(payload) {
|
|
282
|
+
let total = 0;
|
|
283
|
+
for (const value of Object.values(payload)) {
|
|
284
|
+
if (Array.isArray(value)) total += value.length;
|
|
285
|
+
}
|
|
286
|
+
return total || 1;
|
|
287
|
+
}
|
|
288
|
+
function categoryOf(payload) {
|
|
289
|
+
if ("traces" in payload) return "trace";
|
|
290
|
+
if ("logs" in payload) return "log";
|
|
291
|
+
return "record";
|
|
292
|
+
}
|
|
264
293
|
|
|
265
294
|
// src/index.ts
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
295
|
+
chunkZGYZZCUK_cjs.init_tracing();
|
|
296
|
+
chunkZGYZZCUK_cjs.init_diagnostics();
|
|
297
|
+
chunkZGYZZCUK_cjs.init_spans();
|
|
298
|
+
chunkZGYZZCUK_cjs.init_propagation();
|
|
269
299
|
var version = SDK_VERSION;
|
|
270
300
|
var singleton = null;
|
|
271
301
|
var transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -285,9 +315,9 @@ function logDestinationOnce(endpoint) {
|
|
|
285
315
|
}
|
|
286
316
|
function resolveEndpoint(explicit) {
|
|
287
317
|
if (explicit && explicit.length > 0) return explicit;
|
|
288
|
-
const fromEnv =
|
|
318
|
+
const fromEnv = chunkZGYZZCUK_cjs.getEndpoint();
|
|
289
319
|
if (fromEnv) return fromEnv;
|
|
290
|
-
return
|
|
320
|
+
return chunkZGYZZCUK_cjs.DEFAULT_ENDPOINT;
|
|
291
321
|
}
|
|
292
322
|
var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
|
|
293
323
|
function deriveOtlpEndpoint(tracesEndpoint) {
|
|
@@ -302,10 +332,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
|
|
|
302
332
|
}
|
|
303
333
|
}
|
|
304
334
|
function buildSingleton(opts, redaction) {
|
|
305
|
-
if (
|
|
335
|
+
if (chunkZGYZZCUK_cjs.isDisabled()) {
|
|
306
336
|
return null;
|
|
307
337
|
}
|
|
308
|
-
const apiKey = opts.apiKey ??
|
|
338
|
+
const apiKey = opts.apiKey ?? chunkZGYZZCUK_cjs.getApiKey();
|
|
309
339
|
if (!apiKey) {
|
|
310
340
|
if (!noApiKeyWarningEmitted) {
|
|
311
341
|
logger(
|
|
@@ -317,23 +347,23 @@ function buildSingleton(opts, redaction) {
|
|
|
317
347
|
return null;
|
|
318
348
|
}
|
|
319
349
|
const endpoint = resolveEndpoint(opts.endpoint);
|
|
320
|
-
const flushIntervalSeconds = opts.flushIntervalSeconds ??
|
|
350
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkZGYZZCUK_cjs.getFlushIntervalSeconds();
|
|
321
351
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const explicitSource =
|
|
325
|
-
const resolvedSource = explicitSource ??
|
|
326
|
-
|
|
352
|
+
chunkZGYZZCUK_cjs.setTransport(transport);
|
|
353
|
+
chunkZGYZZCUK_cjs.setRedactionConfig(redaction);
|
|
354
|
+
const explicitSource = chunkZGYZZCUK_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
355
|
+
const resolvedSource = explicitSource ?? chunkZGYZZCUK_cjs.getInternalSource() ?? null;
|
|
356
|
+
chunkZGYZZCUK_cjs.setSource(resolvedSource);
|
|
327
357
|
logDestinationOnce(endpoint);
|
|
328
358
|
try {
|
|
329
|
-
|
|
359
|
+
chunkZGYZZCUK_cjs.getEngine().configure({
|
|
330
360
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
331
361
|
apiKey,
|
|
332
|
-
sampleRate:
|
|
362
|
+
sampleRate: chunkZGYZZCUK_cjs.getSampleRate(),
|
|
333
363
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
334
|
-
maxQueueSize:
|
|
335
|
-
maxExportBatchSize:
|
|
336
|
-
maxFieldBytes:
|
|
364
|
+
maxQueueSize: chunkZGYZZCUK_cjs.getMaxQueueSize(),
|
|
365
|
+
maxExportBatchSize: chunkZGYZZCUK_cjs.getMaxBatchSize(),
|
|
366
|
+
maxFieldBytes: chunkZGYZZCUK_cjs.getMaxFieldBytes(),
|
|
337
367
|
// 10s (not the exporter's un-overridden 30s ceiling): a genuine
|
|
338
368
|
// network blip still gets several retries with backoff; a fully dead
|
|
339
369
|
// endpoint fails within a bounded, shutdown-friendly window instead
|
|
@@ -342,32 +372,32 @@ function buildSingleton(opts, redaction) {
|
|
|
342
372
|
redactionConfig: redaction
|
|
343
373
|
});
|
|
344
374
|
} catch (err) {
|
|
345
|
-
|
|
375
|
+
chunkZGYZZCUK_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
|
|
346
376
|
}
|
|
347
377
|
void installAdapters().catch(() => {
|
|
348
378
|
});
|
|
349
379
|
try {
|
|
350
380
|
maybeEnableDbCaptureFromEnv();
|
|
351
381
|
} catch (err) {
|
|
352
|
-
|
|
382
|
+
chunkZGYZZCUK_cjs.report(err, { fingerprint: "morse.db_capture.register" });
|
|
353
383
|
}
|
|
354
384
|
return { apiKey, endpoint, transport, redaction };
|
|
355
385
|
}
|
|
356
386
|
function ensureInitialized() {
|
|
357
|
-
if (
|
|
387
|
+
if (chunkZGYZZCUK_cjs.isDisabled()) return null;
|
|
358
388
|
if (singleton !== null) return singleton;
|
|
359
|
-
singleton = buildSingleton({},
|
|
389
|
+
singleton = buildSingleton({}, chunkZGYZZCUK_cjs.buildRedactionConfig());
|
|
360
390
|
return singleton;
|
|
361
391
|
}
|
|
362
|
-
|
|
392
|
+
chunkWY2VLKRR_cjs._setEnsureInitialized(() => {
|
|
363
393
|
ensureInitialized();
|
|
364
394
|
});
|
|
365
395
|
function init(options = {}) {
|
|
366
|
-
if (
|
|
396
|
+
if (chunkZGYZZCUK_cjs.isDisabled()) {
|
|
367
397
|
logger("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
368
398
|
return;
|
|
369
399
|
}
|
|
370
|
-
const redaction =
|
|
400
|
+
const redaction = chunkZGYZZCUK_cjs.buildRedactionConfig(options.redaction);
|
|
371
401
|
try {
|
|
372
402
|
if (singleton !== null) {
|
|
373
403
|
void singleton.transport.shutdown();
|
|
@@ -375,10 +405,10 @@ function init(options = {}) {
|
|
|
375
405
|
}
|
|
376
406
|
singleton = buildSingleton(options, redaction);
|
|
377
407
|
} catch (err) {
|
|
378
|
-
|
|
408
|
+
chunkZGYZZCUK_cjs.report(err, { fingerprint: "morse.init" });
|
|
379
409
|
}
|
|
380
410
|
}
|
|
381
|
-
var track =
|
|
411
|
+
var track = chunkFNZWJU64_cjs.absorbErrorsSync(
|
|
382
412
|
(options) => {
|
|
383
413
|
const state = ensureInitialized();
|
|
384
414
|
if (!state) return;
|
|
@@ -386,33 +416,33 @@ var track = chunk3BGG7GH3_cjs.absorbErrorsSync(
|
|
|
386
416
|
agent_id: options.agentId,
|
|
387
417
|
...options.runData
|
|
388
418
|
};
|
|
389
|
-
const redacted =
|
|
419
|
+
const redacted = chunkZGYZZCUK_cjs.redactValue(payload, state.redaction);
|
|
390
420
|
state.transport.track(redacted);
|
|
391
421
|
},
|
|
392
422
|
{ fingerprint: "morse.track" }
|
|
393
423
|
);
|
|
394
|
-
var batchTrack =
|
|
424
|
+
var batchTrack = chunkFNZWJU64_cjs.absorbErrorsSync(
|
|
395
425
|
(runs) => {
|
|
396
426
|
const state = ensureInitialized();
|
|
397
427
|
if (!state) return;
|
|
398
428
|
for (const run2 of runs) {
|
|
399
|
-
const redacted =
|
|
429
|
+
const redacted = chunkZGYZZCUK_cjs.redactValue(run2, state.redaction);
|
|
400
430
|
state.transport.track(redacted);
|
|
401
431
|
}
|
|
402
432
|
},
|
|
403
433
|
{ fingerprint: "morse.batch_track" }
|
|
404
434
|
);
|
|
405
|
-
var record =
|
|
435
|
+
var record = chunkFNZWJU64_cjs.absorbErrorsSync(
|
|
406
436
|
(rec) => {
|
|
407
437
|
const state = ensureInitialized();
|
|
408
438
|
if (!state) return;
|
|
409
|
-
const traceId =
|
|
410
|
-
const now =
|
|
439
|
+
const traceId = chunkZGYZZCUK_cjs.generateTraceId();
|
|
440
|
+
const now = chunkZGYZZCUK_cjs.nowIso();
|
|
411
441
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
412
442
|
const span2 = {
|
|
413
443
|
trace_id: traceId,
|
|
414
|
-
span_id:
|
|
415
|
-
type:
|
|
444
|
+
span_id: chunkZGYZZCUK_cjs.generateSpanId(),
|
|
445
|
+
type: chunkZGYZZCUK_cjs.SpanType.AGENT,
|
|
416
446
|
name: rec.agent,
|
|
417
447
|
started_at: now,
|
|
418
448
|
ended_at: now,
|
|
@@ -437,57 +467,57 @@ var record = chunk3BGG7GH3_cjs.absorbErrorsSync(
|
|
|
437
467
|
success: rec.success,
|
|
438
468
|
outcome: rec.outcome
|
|
439
469
|
};
|
|
440
|
-
const entry =
|
|
441
|
-
const redacted =
|
|
442
|
-
|
|
470
|
+
const entry = chunkZGYZZCUK_cjs.buildTraceEntry(traceFields, [span2]);
|
|
471
|
+
const redacted = chunkZGYZZCUK_cjs.redactValue(entry, state.redaction);
|
|
472
|
+
chunkZGYZZCUK_cjs.sendTrace(redacted);
|
|
443
473
|
},
|
|
444
474
|
{ fingerprint: "morse.record" }
|
|
445
475
|
);
|
|
446
476
|
function run(nameOrOpts, fn) {
|
|
447
477
|
const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
|
|
448
478
|
ensureInitialized();
|
|
449
|
-
return
|
|
479
|
+
return chunkZGYZZCUK_cjs.runSync(opts, fn);
|
|
450
480
|
}
|
|
451
481
|
function runTraced(options, fn) {
|
|
452
482
|
ensureInitialized();
|
|
453
|
-
return
|
|
483
|
+
return chunkZGYZZCUK_cjs.runAsync(options, fn);
|
|
454
484
|
}
|
|
455
485
|
function setContext2(dims) {
|
|
456
|
-
|
|
486
|
+
chunkZGYZZCUK_cjs.setContext(dims);
|
|
457
487
|
}
|
|
458
488
|
function startSpan2(options) {
|
|
459
|
-
return
|
|
489
|
+
return chunkZGYZZCUK_cjs.startSpan(options);
|
|
460
490
|
}
|
|
461
491
|
function span(options, fn) {
|
|
462
|
-
return
|
|
492
|
+
return chunkZGYZZCUK_cjs.spanSync(options, fn);
|
|
463
493
|
}
|
|
464
494
|
function spanAsync2(options, fn) {
|
|
465
|
-
return
|
|
495
|
+
return chunkZGYZZCUK_cjs.spanAsync(options, fn);
|
|
466
496
|
}
|
|
467
|
-
var flush =
|
|
497
|
+
var flush = chunkFNZWJU64_cjs.absorbErrorsAsync(
|
|
468
498
|
async () => {
|
|
469
499
|
if (singleton !== null) {
|
|
470
500
|
await singleton.transport.flush();
|
|
471
|
-
await
|
|
501
|
+
await chunkZGYZZCUK_cjs.getEngine().flush();
|
|
472
502
|
}
|
|
473
503
|
},
|
|
474
504
|
{ fingerprint: "morse.flush" }
|
|
475
505
|
);
|
|
476
|
-
var quotaState2 =
|
|
506
|
+
var quotaState2 = chunkFNZWJU64_cjs.absorbErrorsSync(
|
|
477
507
|
() => {
|
|
478
508
|
if (singleton === null) return null;
|
|
479
509
|
return getQuotaState();
|
|
480
510
|
},
|
|
481
511
|
{ fingerprint: "morse.quota_state" }
|
|
482
512
|
);
|
|
483
|
-
var shutdown =
|
|
513
|
+
var shutdown = chunkFNZWJU64_cjs.absorbErrorsAsync(
|
|
484
514
|
async () => {
|
|
485
515
|
if (singleton !== null) {
|
|
486
516
|
await singleton.transport.shutdown();
|
|
487
|
-
await
|
|
488
|
-
|
|
517
|
+
await chunkZGYZZCUK_cjs.getEngine().flush();
|
|
518
|
+
chunkZGYZZCUK_cjs.getEngine().shutdown();
|
|
489
519
|
singleton = null;
|
|
490
|
-
|
|
520
|
+
chunkZGYZZCUK_cjs.setTransport(null);
|
|
491
521
|
}
|
|
492
522
|
},
|
|
493
523
|
{ fingerprint: "morse.shutdown" }
|
|
@@ -496,14 +526,14 @@ function _resetForTesting4() {
|
|
|
496
526
|
if (singleton !== null) {
|
|
497
527
|
void singleton.transport.shutdown();
|
|
498
528
|
singleton = null;
|
|
499
|
-
|
|
529
|
+
chunkZGYZZCUK_cjs.setTransport(null);
|
|
500
530
|
}
|
|
501
|
-
|
|
531
|
+
chunkZGYZZCUK_cjs.getEngine().resetForTesting();
|
|
502
532
|
noApiKeyWarningEmitted = false;
|
|
503
533
|
lastLoggedEndpoint = null;
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
534
|
+
chunkZGYZZCUK_cjs.setSource(null);
|
|
535
|
+
chunkZGYZZCUK_cjs._resetForTesting2();
|
|
536
|
+
chunkZGYZZCUK_cjs._resetForTesting();
|
|
507
537
|
_resetQuotaStateForTesting();
|
|
508
538
|
transportFactory = (opts) => new BatchTransport(opts);
|
|
509
539
|
}
|
|
@@ -511,59 +541,59 @@ function _setTransportFactoryForTesting(factory) {
|
|
|
511
541
|
transportFactory = factory;
|
|
512
542
|
}
|
|
513
543
|
function _getLastTraceForTesting() {
|
|
514
|
-
return
|
|
544
|
+
return chunkZGYZZCUK_cjs.getLastTrace();
|
|
515
545
|
}
|
|
516
546
|
function _getActiveTraceStateForTesting() {
|
|
517
|
-
return
|
|
547
|
+
return chunkZGYZZCUK_cjs.getActiveTraceState();
|
|
518
548
|
}
|
|
519
549
|
|
|
520
550
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
521
551
|
enumerable: true,
|
|
522
|
-
get: function () { return
|
|
552
|
+
get: function () { return chunkAV35EOER_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
523
553
|
});
|
|
524
554
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
525
555
|
enumerable: true,
|
|
526
|
-
get: function () { return
|
|
556
|
+
get: function () { return chunkAV35EOER_cjs.extractAnthropicSegments; }
|
|
527
557
|
});
|
|
528
558
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
529
559
|
enumerable: true,
|
|
530
|
-
get: function () { return
|
|
560
|
+
get: function () { return chunkAV35EOER_cjs.instrumentAnthropic; }
|
|
531
561
|
});
|
|
532
562
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
533
563
|
enumerable: true,
|
|
534
|
-
get: function () { return
|
|
564
|
+
get: function () { return chunkAV35EOER_cjs.isAnthropicWrapped; }
|
|
535
565
|
});
|
|
536
566
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
537
567
|
enumerable: true,
|
|
538
|
-
get: function () { return
|
|
568
|
+
get: function () { return chunkAV35EOER_cjs.uninstallAnthropic; }
|
|
539
569
|
});
|
|
540
570
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
541
571
|
enumerable: true,
|
|
542
|
-
get: function () { return
|
|
572
|
+
get: function () { return chunkAV35EOER_cjs.wrapAnthropic; }
|
|
543
573
|
});
|
|
544
574
|
Object.defineProperty(exports, "log", {
|
|
545
575
|
enumerable: true,
|
|
546
|
-
get: function () { return
|
|
576
|
+
get: function () { return chunkWY2VLKRR_cjs.log; }
|
|
547
577
|
});
|
|
548
578
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
549
579
|
enumerable: true,
|
|
550
|
-
get: function () { return
|
|
580
|
+
get: function () { return chunkZGYZZCUK_cjs.W3C_TRACEPARENT_HEADER; }
|
|
551
581
|
});
|
|
552
582
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
553
583
|
enumerable: true,
|
|
554
|
-
get: function () { return
|
|
584
|
+
get: function () { return chunkZGYZZCUK_cjs.extractTraceparent; }
|
|
555
585
|
});
|
|
556
586
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
557
587
|
enumerable: true,
|
|
558
|
-
get: function () { return
|
|
588
|
+
get: function () { return chunkZGYZZCUK_cjs.formatTraceparent; }
|
|
559
589
|
});
|
|
560
590
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
561
591
|
enumerable: true,
|
|
562
|
-
get: function () { return
|
|
592
|
+
get: function () { return chunkZGYZZCUK_cjs.injectIntoRequestInit; }
|
|
563
593
|
});
|
|
564
594
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
565
595
|
enumerable: true,
|
|
566
|
-
get: function () { return
|
|
596
|
+
get: function () { return chunkZGYZZCUK_cjs.injectTraceparent; }
|
|
567
597
|
});
|
|
568
598
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
569
599
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|