@raindrop-ai/ai-sdk 0.0.34 → 0.0.36
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/{chunk-OLOFN54C.mjs → chunk-NHSRCEYN.mjs} +58 -78
- package/dist/{index-HYjRP6nV.d.mts → index-Crm3oDAG.d.mts} +25 -1
- package/dist/{index-HYjRP6nV.d.ts → index-Crm3oDAG.d.ts} +25 -1
- package/dist/index.browser.d.mts +25 -1
- package/dist/index.browser.d.ts +25 -1
- package/dist/index.browser.js +58 -78
- package/dist/index.browser.mjs +58 -78
- package/dist/index.node.d.mts +1 -1
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +58 -78
- package/dist/index.node.mjs +1 -1
- package/dist/index.workers.d.mts +1 -1
- package/dist/index.workers.d.ts +1 -1
- package/dist/index.workers.js +58 -78
- package/dist/index.workers.mjs +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
2
|
|
|
3
|
-
// ../core/dist/chunk-
|
|
3
|
+
// ../core/dist/chunk-SK6EJEO7.js
|
|
4
4
|
function getCrypto() {
|
|
5
5
|
const c = globalThis.crypto;
|
|
6
6
|
return c;
|
|
@@ -397,6 +397,25 @@ function sendLocalDebuggerLiveEvent(event, options = {}) {
|
|
|
397
397
|
).catch(() => {
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
+
var PROJECT_ID_HEADER = "X-Raindrop-Project-Id";
|
|
401
|
+
var PROJECT_ID_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
402
|
+
function isValidProjectIdSlug(value) {
|
|
403
|
+
return PROJECT_ID_SLUG_PATTERN.test(value);
|
|
404
|
+
}
|
|
405
|
+
function normalizeProjectId(raw, opts) {
|
|
406
|
+
if (typeof raw !== "string") return void 0;
|
|
407
|
+
const trimmed = raw.trim();
|
|
408
|
+
if (!trimmed) return void 0;
|
|
409
|
+
if (!isValidProjectIdSlug(trimmed) && opts.debug) {
|
|
410
|
+
console.warn(
|
|
411
|
+
`${opts.prefix} projectId "${trimmed}" does not match slug ${PROJECT_ID_SLUG_PATTERN.source}; sending anyway \u2014 backend may reject with HTTP 400`
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
return trimmed;
|
|
415
|
+
}
|
|
416
|
+
function projectIdHeaders(projectId) {
|
|
417
|
+
return projectId ? { [PROJECT_ID_HEADER]: projectId } : {};
|
|
418
|
+
}
|
|
400
419
|
var SHUTDOWN_DEADLINE_MS = 1e4;
|
|
401
420
|
var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
402
421
|
function mergePatches(target, source) {
|
|
@@ -431,6 +450,10 @@ var EventShipper = class {
|
|
|
431
450
|
if (this.debug && this.localDebuggerUrl) {
|
|
432
451
|
console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
|
|
433
452
|
}
|
|
453
|
+
this.projectId = normalizeProjectId(opts.projectId, {
|
|
454
|
+
debug: this.debug,
|
|
455
|
+
prefix: this.prefix
|
|
456
|
+
});
|
|
434
457
|
const isNode = typeof process !== "undefined" && typeof process.version === "string";
|
|
435
458
|
this.context = {
|
|
436
459
|
library: {
|
|
@@ -449,6 +472,9 @@ var EventShipper = class {
|
|
|
449
472
|
authHeaders() {
|
|
450
473
|
return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};
|
|
451
474
|
}
|
|
475
|
+
requestHeaders() {
|
|
476
|
+
return { ...this.authHeaders(), ...projectIdHeaders(this.projectId) };
|
|
477
|
+
}
|
|
452
478
|
/**
|
|
453
479
|
* Build the retry/timeout options for one POST, honoring the shutdown
|
|
454
480
|
* deadline. Returns `null` when the shutdown drain window is exhausted —
|
|
@@ -578,7 +604,7 @@ var EventShipper = class {
|
|
|
578
604
|
return;
|
|
579
605
|
}
|
|
580
606
|
try {
|
|
581
|
-
await postJson(url, body, this.
|
|
607
|
+
await postJson(url, body, this.requestHeaders(), opts);
|
|
582
608
|
} catch (err) {
|
|
583
609
|
const msg = err instanceof Error ? err.message : String(err);
|
|
584
610
|
rateLimitedLog(
|
|
@@ -614,7 +640,7 @@ var EventShipper = class {
|
|
|
614
640
|
return;
|
|
615
641
|
}
|
|
616
642
|
try {
|
|
617
|
-
await postJson(url, body, this.
|
|
643
|
+
await postJson(url, body, this.requestHeaders(), opts);
|
|
618
644
|
} catch (err) {
|
|
619
645
|
const msg = err instanceof Error ? err.message : String(err);
|
|
620
646
|
rateLimitedLog(
|
|
@@ -710,7 +736,7 @@ var EventShipper = class {
|
|
|
710
736
|
if (!isPending) this.sticky.delete(eventId);
|
|
711
737
|
return;
|
|
712
738
|
}
|
|
713
|
-
const p = postJson(url, payload, this.
|
|
739
|
+
const p = postJson(url, payload, this.requestHeaders(), opts);
|
|
714
740
|
this.inFlight.add(p);
|
|
715
741
|
try {
|
|
716
742
|
try {
|
|
@@ -857,6 +883,10 @@ var TraceShipper = class {
|
|
|
857
883
|
if (this.debug && this.localDebuggerUrl) {
|
|
858
884
|
console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
|
|
859
885
|
}
|
|
886
|
+
this.projectId = normalizeProjectId(opts.projectId, {
|
|
887
|
+
debug: this.debug,
|
|
888
|
+
prefix: this.prefix
|
|
889
|
+
});
|
|
860
890
|
this.transformSpanHook = opts.transformSpan;
|
|
861
891
|
this.disableDefaultRedaction = opts.disableDefaultRedaction === true;
|
|
862
892
|
this.maxTextFieldCharsOpt = opts.maxTextFieldChars;
|
|
@@ -933,6 +963,9 @@ var TraceShipper = class {
|
|
|
933
963
|
authHeaders() {
|
|
934
964
|
return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};
|
|
935
965
|
}
|
|
966
|
+
requestHeaders() {
|
|
967
|
+
return { ...this.authHeaders(), ...projectIdHeaders(this.projectId) };
|
|
968
|
+
}
|
|
936
969
|
startSpan(args) {
|
|
937
970
|
var _a, _b;
|
|
938
971
|
const ids = createSpanIds(args.parent);
|
|
@@ -1064,7 +1097,7 @@ var TraceShipper = class {
|
|
|
1064
1097
|
endpoint: url
|
|
1065
1098
|
});
|
|
1066
1099
|
}
|
|
1067
|
-
const p = postJson(url, body, this.
|
|
1100
|
+
const p = postJson(url, body, this.requestHeaders(), opts);
|
|
1068
1101
|
this.inFlight.add(p);
|
|
1069
1102
|
try {
|
|
1070
1103
|
try {
|
|
@@ -2142,10 +2175,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2142
2175
|
};
|
|
2143
2176
|
/** Flush and stop the background flush timers. */
|
|
2144
2177
|
this.shutdown = async () => {
|
|
2145
|
-
await Promise.all([
|
|
2146
|
-
this.eventShipper.shutdown(),
|
|
2147
|
-
this.traceShipper.shutdown()
|
|
2148
|
-
]);
|
|
2178
|
+
await Promise.all([this.eventShipper.shutdown(), this.traceShipper.shutdown()]);
|
|
2149
2179
|
};
|
|
2150
2180
|
// ── onStart ─────────────────────────────────────────────────────────────
|
|
2151
2181
|
this.onStart = (event) => {
|
|
@@ -2164,12 +2194,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2164
2194
|
const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;
|
|
2165
2195
|
const eventId = (_d = (_c = (_b = explicitEventId != null ? explicitEventId : (_a = this.defaultContext) == null ? void 0 : _a.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : callMeta.eventId) != null ? _d : randomUUID();
|
|
2166
2196
|
const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
|
|
2167
|
-
const { operationName, resourceName } = opName(
|
|
2168
|
-
event.operationId,
|
|
2169
|
-
functionId
|
|
2170
|
-
);
|
|
2197
|
+
const { operationName, resourceName } = opName(event.operationId, functionId);
|
|
2171
2198
|
const parentToolContext = !isEmbed && this.subagentWrapping ? getCurrentParentToolContext() : void 0;
|
|
2172
|
-
const metadataSubagentName = !isEmbed && this.subagentWrapping && parentToolContext === void 0 ? typeof (metadata == null ? void 0 : metadata["ash.subagent.name"]) === "string" ? metadata["ash.subagent.name"] : void 0 : void 0;
|
|
2199
|
+
const metadataSubagentName = !isEmbed && this.subagentWrapping && parentToolContext === void 0 ? typeof (metadata == null ? void 0 : metadata["eve.subagent.name"]) === "string" ? metadata["eve.subagent.name"] : typeof (metadata == null ? void 0 : metadata["ash.subagent.name"]) === "string" ? metadata["ash.subagent.name"] : void 0 : void 0;
|
|
2173
2200
|
const subagentName = (_e = parentToolContext == null ? void 0 : parentToolContext.toolName) != null ? _e : metadataSubagentName;
|
|
2174
2201
|
let subagentToolCallSpan;
|
|
2175
2202
|
let rootParentOverride;
|
|
@@ -2221,12 +2248,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2221
2248
|
})
|
|
2222
2249
|
)
|
|
2223
2250
|
] : [];
|
|
2224
|
-
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [
|
|
2225
|
-
attrString(
|
|
2226
|
-
"ai.values",
|
|
2227
|
-
safeJsonWithUint8(event.value)
|
|
2228
|
-
)
|
|
2229
|
-
] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2251
|
+
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [attrString("ai.values", safeJsonWithUint8(event.value))] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2230
2252
|
rootSpan = this.traceShipper.startSpan({
|
|
2231
2253
|
name: event.operationId,
|
|
2232
2254
|
parent: rootParentOverride != null ? rootParentOverride : inheritedParent,
|
|
@@ -2280,19 +2302,11 @@ var RaindropTelemetryIntegration = class {
|
|
|
2280
2302
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2281
2303
|
const isStream = state.operationId === "ai.streamText" || state.operationId === "ai.streamObject";
|
|
2282
2304
|
const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;
|
|
2283
|
-
const { operationName, resourceName } = opName(
|
|
2284
|
-
stepOperationId,
|
|
2285
|
-
state.functionId
|
|
2286
|
-
);
|
|
2305
|
+
const { operationName, resourceName } = opName(stepOperationId, state.functionId);
|
|
2287
2306
|
const inputAttrs = [];
|
|
2288
2307
|
if (state.recordInputs) {
|
|
2289
2308
|
if (event.promptMessages) {
|
|
2290
|
-
inputAttrs.push(
|
|
2291
|
-
attrString(
|
|
2292
|
-
"ai.prompt.messages",
|
|
2293
|
-
safeJsonWithUint8(event.promptMessages)
|
|
2294
|
-
)
|
|
2295
|
-
);
|
|
2309
|
+
inputAttrs.push(attrString("ai.prompt.messages", safeJsonWithUint8(event.promptMessages)));
|
|
2296
2310
|
}
|
|
2297
2311
|
if (event.stepTools) {
|
|
2298
2312
|
inputAttrs.push(
|
|
@@ -2307,10 +2321,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2307
2321
|
}
|
|
2308
2322
|
if (event.stepToolChoice != null) {
|
|
2309
2323
|
inputAttrs.push(
|
|
2310
|
-
attrString(
|
|
2311
|
-
"ai.prompt.toolChoice",
|
|
2312
|
-
safeJsonWithUint8(event.stepToolChoice)
|
|
2313
|
-
)
|
|
2324
|
+
attrString("ai.prompt.toolChoice", safeJsonWithUint8(event.stepToolChoice))
|
|
2314
2325
|
);
|
|
2315
2326
|
}
|
|
2316
2327
|
}
|
|
@@ -2445,16 +2456,8 @@ var RaindropTelemetryIntegration = class {
|
|
|
2445
2456
|
this.onEmbedStart = (event) => {
|
|
2446
2457
|
const state = this.getState(event.callId);
|
|
2447
2458
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2448
|
-
const { operationName, resourceName } = opName(
|
|
2449
|
-
|
|
2450
|
-
state.functionId
|
|
2451
|
-
);
|
|
2452
|
-
const inputAttrs = state.recordInputs ? [
|
|
2453
|
-
attrString(
|
|
2454
|
-
"ai.values",
|
|
2455
|
-
safeJsonWithUint8(event.values)
|
|
2456
|
-
)
|
|
2457
|
-
] : [];
|
|
2459
|
+
const { operationName, resourceName } = opName(event.operationId, state.functionId);
|
|
2460
|
+
const inputAttrs = state.recordInputs ? [attrString("ai.values", safeJsonWithUint8(event.values))] : [];
|
|
2458
2461
|
const embedSpan = this.traceShipper.startSpan({
|
|
2459
2462
|
name: event.operationId,
|
|
2460
2463
|
parent: state.rootParent,
|
|
@@ -2478,12 +2481,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2478
2481
|
if (!embedSpan) return;
|
|
2479
2482
|
const outputAttrs = [];
|
|
2480
2483
|
if (state.recordOutputs) {
|
|
2481
|
-
outputAttrs.push(
|
|
2482
|
-
attrString(
|
|
2483
|
-
"ai.embeddings",
|
|
2484
|
-
safeJsonWithUint8(event.embeddings)
|
|
2485
|
-
)
|
|
2486
|
-
);
|
|
2484
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embeddings)));
|
|
2487
2485
|
}
|
|
2488
2486
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
2489
2487
|
outputAttrs.push(attrInt("ai.usage.tokens", event.usage.tokens));
|
|
@@ -2701,10 +2699,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2701
2699
|
toolExecutionStart(event) {
|
|
2702
2700
|
const { toolCall } = event;
|
|
2703
2701
|
const priorParent = getCurrentParentToolContext();
|
|
2704
|
-
this.priorParentContexts.set(
|
|
2705
|
-
toolCall.toolCallId,
|
|
2706
|
-
priorParent != null ? priorParent : null
|
|
2707
|
-
);
|
|
2702
|
+
this.priorParentContexts.set(toolCall.toolCallId, priorParent != null ? priorParent : null);
|
|
2708
2703
|
enterParentToolContext({
|
|
2709
2704
|
parentCallId: event.callId,
|
|
2710
2705
|
toolCallId: toolCall.toolCallId,
|
|
@@ -2713,10 +2708,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2713
2708
|
const state = this.getState(event.callId);
|
|
2714
2709
|
state == null ? void 0 : state.parentContextToolCallIds.add(toolCall.toolCallId);
|
|
2715
2710
|
if (!(state == null ? void 0 : state.stepParent)) return;
|
|
2716
|
-
const { operationName, resourceName } = opName(
|
|
2717
|
-
"ai.toolCall",
|
|
2718
|
-
state.functionId
|
|
2719
|
-
);
|
|
2711
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2720
2712
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(toolCall.input))] : [];
|
|
2721
2713
|
const toolSpan = this.traceShipper.startSpan({
|
|
2722
2714
|
name: "ai.toolCall",
|
|
@@ -2793,10 +2785,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2793
2785
|
}
|
|
2794
2786
|
}
|
|
2795
2787
|
for (const call of providerToolCalls) {
|
|
2796
|
-
const { operationName, resourceName } = opName(
|
|
2797
|
-
"ai.toolCall",
|
|
2798
|
-
state.functionId
|
|
2799
|
-
);
|
|
2788
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2800
2789
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(call.input))] : [];
|
|
2801
2790
|
const toolSpan = this.traceShipper.startSpan({
|
|
2802
2791
|
name: "ai.toolCall",
|
|
@@ -2819,12 +2808,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2819
2808
|
if ((resultPart == null ? void 0 : resultPart.type) === "tool-error") {
|
|
2820
2809
|
this.traceShipper.endSpan(toolSpan, { error: resultPart.error });
|
|
2821
2810
|
} else {
|
|
2822
|
-
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [
|
|
2823
|
-
attrString(
|
|
2824
|
-
"ai.toolCall.result",
|
|
2825
|
-
safeJsonWithUint8(resultPart.output)
|
|
2826
|
-
)
|
|
2827
|
-
] : [];
|
|
2811
|
+
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [attrString("ai.toolCall.result", safeJsonWithUint8(resultPart.output))] : [];
|
|
2828
2812
|
this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });
|
|
2829
2813
|
}
|
|
2830
2814
|
this.emitLive(state, "tool_result", call.toolName);
|
|
@@ -2874,9 +2858,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2874
2858
|
attrInt("ai.usage.cachedInputTokens", usage.cachedInputTokens)
|
|
2875
2859
|
);
|
|
2876
2860
|
}
|
|
2877
|
-
outputAttrs.push(
|
|
2878
|
-
attrInt("ai.toolCall.count", state.toolCallCount)
|
|
2879
|
-
);
|
|
2861
|
+
outputAttrs.push(attrInt("ai.toolCall.count", state.toolCallCount));
|
|
2880
2862
|
this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });
|
|
2881
2863
|
}
|
|
2882
2864
|
this.finalizeGenerateEvent(
|
|
@@ -2929,13 +2911,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2929
2911
|
const isMany = state.operationId === "ai.embedMany";
|
|
2930
2912
|
if (state.recordOutputs) {
|
|
2931
2913
|
if (isMany) {
|
|
2932
|
-
outputAttrs.push(
|
|
2933
|
-
attrString("ai.embeddings", safeJsonWithUint8(event.embedding))
|
|
2934
|
-
);
|
|
2914
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embedding)));
|
|
2935
2915
|
} else {
|
|
2936
|
-
outputAttrs.push(
|
|
2937
|
-
attrString("ai.embedding", safeJsonWithUint8(event.embedding))
|
|
2938
|
-
);
|
|
2916
|
+
outputAttrs.push(attrString("ai.embedding", safeJsonWithUint8(event.embedding)));
|
|
2939
2917
|
}
|
|
2940
2918
|
}
|
|
2941
2919
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
@@ -5014,7 +4992,7 @@ function extractNestedTokens(usage, key) {
|
|
|
5014
4992
|
// package.json
|
|
5015
4993
|
var package_default = {
|
|
5016
4994
|
name: "@raindrop-ai/ai-sdk",
|
|
5017
|
-
version: "0.0.
|
|
4995
|
+
version: "0.0.36"};
|
|
5018
4996
|
|
|
5019
4997
|
// src/internal/version.ts
|
|
5020
4998
|
var libraryName = package_default.name;
|
|
@@ -5124,6 +5102,7 @@ function createRaindropAISDK(opts) {
|
|
|
5124
5102
|
enabled: eventsEnabled,
|
|
5125
5103
|
debug: ((_c = opts.events) == null ? void 0 : _c.debug) === true || envDebug,
|
|
5126
5104
|
partialFlushMs: (_d = opts.events) == null ? void 0 : _d.partialFlushMs,
|
|
5105
|
+
projectId: opts.projectId,
|
|
5127
5106
|
localDebuggerUrl
|
|
5128
5107
|
});
|
|
5129
5108
|
const traceShipper = new TraceShipper2({
|
|
@@ -5135,6 +5114,7 @@ function createRaindropAISDK(opts) {
|
|
|
5135
5114
|
flushIntervalMs: (_g = opts.traces) == null ? void 0 : _g.flushIntervalMs,
|
|
5136
5115
|
maxBatchSize: (_h = opts.traces) == null ? void 0 : _h.maxBatchSize,
|
|
5137
5116
|
maxQueueSize: (_i = opts.traces) == null ? void 0 : _i.maxQueueSize,
|
|
5117
|
+
projectId: opts.projectId,
|
|
5138
5118
|
localDebuggerUrl,
|
|
5139
5119
|
transformSpan: (_j = opts.traces) == null ? void 0 : _j.transformSpan,
|
|
5140
5120
|
disableDefaultRedaction: (_k = opts.traces) == null ? void 0 : _k.disableDefaultRedaction
|
|
@@ -83,6 +83,13 @@ type EventShipperOptions = {
|
|
|
83
83
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
84
84
|
*/
|
|
85
85
|
localDebuggerUrl?: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Optional project slug. When set, every outbound cloud request includes an
|
|
88
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
89
|
+
* values are ignored. Slug format is validated on construction but never
|
|
90
|
+
* throws — the backend returns 400 on invalid values.
|
|
91
|
+
*/
|
|
92
|
+
projectId?: string;
|
|
86
93
|
/**
|
|
87
94
|
* Per-field character cap applied to event input/output BEFORE buffering
|
|
88
95
|
* or serialization, so oversized payloads cost the cap — not the payload —
|
|
@@ -101,6 +108,7 @@ declare class EventShipper$1 {
|
|
|
101
108
|
private sdkName;
|
|
102
109
|
private prefix;
|
|
103
110
|
private defaultEventName;
|
|
111
|
+
private projectId;
|
|
104
112
|
private context;
|
|
105
113
|
private buffers;
|
|
106
114
|
private sticky;
|
|
@@ -124,6 +132,7 @@ declare class EventShipper$1 {
|
|
|
124
132
|
constructor(opts: EventShipperOptions);
|
|
125
133
|
isDebugEnabled(): boolean;
|
|
126
134
|
private authHeaders;
|
|
135
|
+
private requestHeaders;
|
|
127
136
|
/**
|
|
128
137
|
* Build the retry/timeout options for one POST, honoring the shutdown
|
|
129
138
|
* deadline. Returns `null` when the shutdown drain window is exhausted —
|
|
@@ -254,6 +263,13 @@ type TraceShipperOptions = {
|
|
|
254
263
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
255
264
|
*/
|
|
256
265
|
localDebuggerUrl?: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* Optional project slug. When set, every OTLP trace export includes an
|
|
268
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
269
|
+
* values are ignored. Slug format is validated on construction but never
|
|
270
|
+
* throws — the backend returns 400 on invalid values.
|
|
271
|
+
*/
|
|
272
|
+
projectId?: string;
|
|
257
273
|
/**
|
|
258
274
|
* Per-span hook that fires for every OTLP span right before the span is
|
|
259
275
|
* shipped (both to the Raindrop API and to a local debugger). Lets callers
|
|
@@ -311,6 +327,7 @@ declare class TraceShipper$1 {
|
|
|
311
327
|
private flushIntervalMs;
|
|
312
328
|
private maxBatchSize;
|
|
313
329
|
private maxQueueSize;
|
|
330
|
+
private projectId;
|
|
314
331
|
private queue;
|
|
315
332
|
private timer;
|
|
316
333
|
private inFlight;
|
|
@@ -361,6 +378,7 @@ declare class TraceShipper$1 {
|
|
|
361
378
|
private redactSpan;
|
|
362
379
|
isDebugEnabled(): boolean;
|
|
363
380
|
private authHeaders;
|
|
381
|
+
private requestHeaders;
|
|
364
382
|
startSpan(args: {
|
|
365
383
|
name: string;
|
|
366
384
|
parent?: {
|
|
@@ -685,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
685
703
|
* Problem
|
|
686
704
|
* ───────
|
|
687
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
688
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
689
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
690
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
691
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -899,6 +917,12 @@ type RaindropAISDKOptions = {
|
|
|
899
917
|
*/
|
|
900
918
|
writeKey?: string;
|
|
901
919
|
endpoint?: string;
|
|
920
|
+
/**
|
|
921
|
+
* Optional Raindrop project slug. When set, every outbound cloud request
|
|
922
|
+
* carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
|
|
923
|
+
* resolves to `default` server-side; byte-identical to prior behavior).
|
|
924
|
+
*/
|
|
925
|
+
projectId?: string;
|
|
902
926
|
/**
|
|
903
927
|
* Force-enable (or opt out of) Workshop / local-debugger mirroring.
|
|
904
928
|
*
|
|
@@ -83,6 +83,13 @@ type EventShipperOptions = {
|
|
|
83
83
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
84
84
|
*/
|
|
85
85
|
localDebuggerUrl?: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Optional project slug. When set, every outbound cloud request includes an
|
|
88
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
89
|
+
* values are ignored. Slug format is validated on construction but never
|
|
90
|
+
* throws — the backend returns 400 on invalid values.
|
|
91
|
+
*/
|
|
92
|
+
projectId?: string;
|
|
86
93
|
/**
|
|
87
94
|
* Per-field character cap applied to event input/output BEFORE buffering
|
|
88
95
|
* or serialization, so oversized payloads cost the cap — not the payload —
|
|
@@ -101,6 +108,7 @@ declare class EventShipper$1 {
|
|
|
101
108
|
private sdkName;
|
|
102
109
|
private prefix;
|
|
103
110
|
private defaultEventName;
|
|
111
|
+
private projectId;
|
|
104
112
|
private context;
|
|
105
113
|
private buffers;
|
|
106
114
|
private sticky;
|
|
@@ -124,6 +132,7 @@ declare class EventShipper$1 {
|
|
|
124
132
|
constructor(opts: EventShipperOptions);
|
|
125
133
|
isDebugEnabled(): boolean;
|
|
126
134
|
private authHeaders;
|
|
135
|
+
private requestHeaders;
|
|
127
136
|
/**
|
|
128
137
|
* Build the retry/timeout options for one POST, honoring the shutdown
|
|
129
138
|
* deadline. Returns `null` when the shutdown drain window is exhausted —
|
|
@@ -254,6 +263,13 @@ type TraceShipperOptions = {
|
|
|
254
263
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
255
264
|
*/
|
|
256
265
|
localDebuggerUrl?: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* Optional project slug. When set, every OTLP trace export includes an
|
|
268
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
269
|
+
* values are ignored. Slug format is validated on construction but never
|
|
270
|
+
* throws — the backend returns 400 on invalid values.
|
|
271
|
+
*/
|
|
272
|
+
projectId?: string;
|
|
257
273
|
/**
|
|
258
274
|
* Per-span hook that fires for every OTLP span right before the span is
|
|
259
275
|
* shipped (both to the Raindrop API and to a local debugger). Lets callers
|
|
@@ -311,6 +327,7 @@ declare class TraceShipper$1 {
|
|
|
311
327
|
private flushIntervalMs;
|
|
312
328
|
private maxBatchSize;
|
|
313
329
|
private maxQueueSize;
|
|
330
|
+
private projectId;
|
|
314
331
|
private queue;
|
|
315
332
|
private timer;
|
|
316
333
|
private inFlight;
|
|
@@ -361,6 +378,7 @@ declare class TraceShipper$1 {
|
|
|
361
378
|
private redactSpan;
|
|
362
379
|
isDebugEnabled(): boolean;
|
|
363
380
|
private authHeaders;
|
|
381
|
+
private requestHeaders;
|
|
364
382
|
startSpan(args: {
|
|
365
383
|
name: string;
|
|
366
384
|
parent?: {
|
|
@@ -685,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
685
703
|
* Problem
|
|
686
704
|
* ───────
|
|
687
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
688
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
689
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
690
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
691
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -899,6 +917,12 @@ type RaindropAISDKOptions = {
|
|
|
899
917
|
*/
|
|
900
918
|
writeKey?: string;
|
|
901
919
|
endpoint?: string;
|
|
920
|
+
/**
|
|
921
|
+
* Optional Raindrop project slug. When set, every outbound cloud request
|
|
922
|
+
* carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
|
|
923
|
+
* resolves to `default` server-side; byte-identical to prior behavior).
|
|
924
|
+
*/
|
|
925
|
+
projectId?: string;
|
|
902
926
|
/**
|
|
903
927
|
* Force-enable (or opt out of) Workshop / local-debugger mirroring.
|
|
904
928
|
*
|
package/dist/index.browser.d.mts
CHANGED
|
@@ -83,6 +83,13 @@ type EventShipperOptions = {
|
|
|
83
83
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
84
84
|
*/
|
|
85
85
|
localDebuggerUrl?: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Optional project slug. When set, every outbound cloud request includes an
|
|
88
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
89
|
+
* values are ignored. Slug format is validated on construction but never
|
|
90
|
+
* throws — the backend returns 400 on invalid values.
|
|
91
|
+
*/
|
|
92
|
+
projectId?: string;
|
|
86
93
|
/**
|
|
87
94
|
* Per-field character cap applied to event input/output BEFORE buffering
|
|
88
95
|
* or serialization, so oversized payloads cost the cap — not the payload —
|
|
@@ -101,6 +108,7 @@ declare class EventShipper$1 {
|
|
|
101
108
|
private sdkName;
|
|
102
109
|
private prefix;
|
|
103
110
|
private defaultEventName;
|
|
111
|
+
private projectId;
|
|
104
112
|
private context;
|
|
105
113
|
private buffers;
|
|
106
114
|
private sticky;
|
|
@@ -124,6 +132,7 @@ declare class EventShipper$1 {
|
|
|
124
132
|
constructor(opts: EventShipperOptions);
|
|
125
133
|
isDebugEnabled(): boolean;
|
|
126
134
|
private authHeaders;
|
|
135
|
+
private requestHeaders;
|
|
127
136
|
/**
|
|
128
137
|
* Build the retry/timeout options for one POST, honoring the shutdown
|
|
129
138
|
* deadline. Returns `null` when the shutdown drain window is exhausted —
|
|
@@ -254,6 +263,13 @@ type TraceShipperOptions = {
|
|
|
254
263
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
255
264
|
*/
|
|
256
265
|
localDebuggerUrl?: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* Optional project slug. When set, every OTLP trace export includes an
|
|
268
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
269
|
+
* values are ignored. Slug format is validated on construction but never
|
|
270
|
+
* throws — the backend returns 400 on invalid values.
|
|
271
|
+
*/
|
|
272
|
+
projectId?: string;
|
|
257
273
|
/**
|
|
258
274
|
* Per-span hook that fires for every OTLP span right before the span is
|
|
259
275
|
* shipped (both to the Raindrop API and to a local debugger). Lets callers
|
|
@@ -311,6 +327,7 @@ declare class TraceShipper$1 {
|
|
|
311
327
|
private flushIntervalMs;
|
|
312
328
|
private maxBatchSize;
|
|
313
329
|
private maxQueueSize;
|
|
330
|
+
private projectId;
|
|
314
331
|
private queue;
|
|
315
332
|
private timer;
|
|
316
333
|
private inFlight;
|
|
@@ -361,6 +378,7 @@ declare class TraceShipper$1 {
|
|
|
361
378
|
private redactSpan;
|
|
362
379
|
isDebugEnabled(): boolean;
|
|
363
380
|
private authHeaders;
|
|
381
|
+
private requestHeaders;
|
|
364
382
|
startSpan(args: {
|
|
365
383
|
name: string;
|
|
366
384
|
parent?: {
|
|
@@ -685,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
685
703
|
* Problem
|
|
686
704
|
* ───────
|
|
687
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
688
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
689
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
690
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
691
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -899,6 +917,12 @@ type RaindropAISDKOptions = {
|
|
|
899
917
|
*/
|
|
900
918
|
writeKey?: string;
|
|
901
919
|
endpoint?: string;
|
|
920
|
+
/**
|
|
921
|
+
* Optional Raindrop project slug. When set, every outbound cloud request
|
|
922
|
+
* carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
|
|
923
|
+
* resolves to `default` server-side; byte-identical to prior behavior).
|
|
924
|
+
*/
|
|
925
|
+
projectId?: string;
|
|
902
926
|
/**
|
|
903
927
|
* Force-enable (or opt out of) Workshop / local-debugger mirroring.
|
|
904
928
|
*
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -83,6 +83,13 @@ type EventShipperOptions = {
|
|
|
83
83
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
84
84
|
*/
|
|
85
85
|
localDebuggerUrl?: string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Optional project slug. When set, every outbound cloud request includes an
|
|
88
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
89
|
+
* values are ignored. Slug format is validated on construction but never
|
|
90
|
+
* throws — the backend returns 400 on invalid values.
|
|
91
|
+
*/
|
|
92
|
+
projectId?: string;
|
|
86
93
|
/**
|
|
87
94
|
* Per-field character cap applied to event input/output BEFORE buffering
|
|
88
95
|
* or serialization, so oversized payloads cost the cap — not the payload —
|
|
@@ -101,6 +108,7 @@ declare class EventShipper$1 {
|
|
|
101
108
|
private sdkName;
|
|
102
109
|
private prefix;
|
|
103
110
|
private defaultEventName;
|
|
111
|
+
private projectId;
|
|
104
112
|
private context;
|
|
105
113
|
private buffers;
|
|
106
114
|
private sticky;
|
|
@@ -124,6 +132,7 @@ declare class EventShipper$1 {
|
|
|
124
132
|
constructor(opts: EventShipperOptions);
|
|
125
133
|
isDebugEnabled(): boolean;
|
|
126
134
|
private authHeaders;
|
|
135
|
+
private requestHeaders;
|
|
127
136
|
/**
|
|
128
137
|
* Build the retry/timeout options for one POST, honoring the shutdown
|
|
129
138
|
* deadline. Returns `null` when the shutdown drain window is exhausted —
|
|
@@ -254,6 +263,13 @@ type TraceShipperOptions = {
|
|
|
254
263
|
* Pass `null` to opt out of all mirroring (including auto-detect).
|
|
255
264
|
*/
|
|
256
265
|
localDebuggerUrl?: string | null;
|
|
266
|
+
/**
|
|
267
|
+
* Optional project slug. When set, every OTLP trace export includes an
|
|
268
|
+
* `X-Raindrop-Project-Id: <projectId>` header. Empty / whitespace-only
|
|
269
|
+
* values are ignored. Slug format is validated on construction but never
|
|
270
|
+
* throws — the backend returns 400 on invalid values.
|
|
271
|
+
*/
|
|
272
|
+
projectId?: string;
|
|
257
273
|
/**
|
|
258
274
|
* Per-span hook that fires for every OTLP span right before the span is
|
|
259
275
|
* shipped (both to the Raindrop API and to a local debugger). Lets callers
|
|
@@ -311,6 +327,7 @@ declare class TraceShipper$1 {
|
|
|
311
327
|
private flushIntervalMs;
|
|
312
328
|
private maxBatchSize;
|
|
313
329
|
private maxQueueSize;
|
|
330
|
+
private projectId;
|
|
314
331
|
private queue;
|
|
315
332
|
private timer;
|
|
316
333
|
private inFlight;
|
|
@@ -361,6 +378,7 @@ declare class TraceShipper$1 {
|
|
|
361
378
|
private redactSpan;
|
|
362
379
|
isDebugEnabled(): boolean;
|
|
363
380
|
private authHeaders;
|
|
381
|
+
private requestHeaders;
|
|
364
382
|
startSpan(args: {
|
|
365
383
|
name: string;
|
|
366
384
|
parent?: {
|
|
@@ -685,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
685
703
|
* Problem
|
|
686
704
|
* ───────
|
|
687
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
688
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
689
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
690
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
691
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -899,6 +917,12 @@ type RaindropAISDKOptions = {
|
|
|
899
917
|
*/
|
|
900
918
|
writeKey?: string;
|
|
901
919
|
endpoint?: string;
|
|
920
|
+
/**
|
|
921
|
+
* Optional Raindrop project slug. When set, every outbound cloud request
|
|
922
|
+
* carries an `X-Raindrop-Project-Id` header. Unset → no header (the project
|
|
923
|
+
* resolves to `default` server-side; byte-identical to prior behavior).
|
|
924
|
+
*/
|
|
925
|
+
projectId?: string;
|
|
902
926
|
/**
|
|
903
927
|
* Force-enable (or opt out of) Workshop / local-debugger mirroring.
|
|
904
928
|
*
|