@raindrop-ai/ai-sdk 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/dist/{chunk-XPZBPNLC.mjs → chunk-ZIGZX4D5.mjs} +18 -73
- package/dist/{index-DFLIiW1D.d.mts → index-D-E1YSku.d.mts} +2 -3
- package/dist/{index-DFLIiW1D.d.ts → index-D-E1YSku.d.ts} +2 -3
- package/dist/index.browser.d.mts +2 -3
- package/dist/index.browser.d.ts +2 -3
- package/dist/index.browser.js +18 -73
- package/dist/index.browser.mjs +18 -73
- package/dist/index.node.d.mts +1 -1
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +18 -73
- 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 +18 -73
- package/dist/index.workers.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,10 +145,9 @@ ready-to-register telemetry integration. The `writeKey` defaults to the
|
|
|
145
145
|
|
|
146
146
|
```ts
|
|
147
147
|
import { generateText, registerTelemetry } from "ai";
|
|
148
|
-
import { OpenTelemetry } from "@ai-sdk/otel";
|
|
149
148
|
import { raindrop } from "@raindrop-ai/ai-sdk";
|
|
150
149
|
|
|
151
|
-
registerTelemetry(
|
|
150
|
+
registerTelemetry(raindrop());
|
|
152
151
|
|
|
153
152
|
const result = await generateText({
|
|
154
153
|
model: anthropic("claude-sonnet-4-5"),
|
|
@@ -157,9 +156,9 @@ const result = await generateText({
|
|
|
157
156
|
});
|
|
158
157
|
```
|
|
159
158
|
|
|
160
|
-
`raindrop()` is self-contained — `@ai-sdk/otel`
|
|
161
|
-
|
|
162
|
-
`
|
|
159
|
+
`raindrop()` is self-contained — no `@ai-sdk/otel` or OpenTelemetry setup is
|
|
160
|
+
required. Pass `context` and `subagentWrapping` to customise behaviour, e.g.
|
|
161
|
+
`raindrop({ context: { userId: "user_123" } })`.
|
|
163
162
|
|
|
164
163
|
For short-lived scripts that exit before the background flush timer fires, keep
|
|
165
164
|
the reference and drain it before exiting:
|
|
@@ -2175,10 +2175,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2175
2175
|
};
|
|
2176
2176
|
/** Flush and stop the background flush timers. */
|
|
2177
2177
|
this.shutdown = async () => {
|
|
2178
|
-
await Promise.all([
|
|
2179
|
-
this.eventShipper.shutdown(),
|
|
2180
|
-
this.traceShipper.shutdown()
|
|
2181
|
-
]);
|
|
2178
|
+
await Promise.all([this.eventShipper.shutdown(), this.traceShipper.shutdown()]);
|
|
2182
2179
|
};
|
|
2183
2180
|
// ── onStart ─────────────────────────────────────────────────────────────
|
|
2184
2181
|
this.onStart = (event) => {
|
|
@@ -2197,12 +2194,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2197
2194
|
const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;
|
|
2198
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();
|
|
2199
2196
|
const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
|
|
2200
|
-
const { operationName, resourceName } = opName(
|
|
2201
|
-
event.operationId,
|
|
2202
|
-
functionId
|
|
2203
|
-
);
|
|
2197
|
+
const { operationName, resourceName } = opName(event.operationId, functionId);
|
|
2204
2198
|
const parentToolContext = !isEmbed && this.subagentWrapping ? getCurrentParentToolContext() : void 0;
|
|
2205
|
-
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;
|
|
2206
2200
|
const subagentName = (_e = parentToolContext == null ? void 0 : parentToolContext.toolName) != null ? _e : metadataSubagentName;
|
|
2207
2201
|
let subagentToolCallSpan;
|
|
2208
2202
|
let rootParentOverride;
|
|
@@ -2254,12 +2248,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2254
2248
|
})
|
|
2255
2249
|
)
|
|
2256
2250
|
] : [];
|
|
2257
|
-
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [
|
|
2258
|
-
attrString(
|
|
2259
|
-
"ai.values",
|
|
2260
|
-
safeJsonWithUint8(event.value)
|
|
2261
|
-
)
|
|
2262
|
-
] : [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))] : [];
|
|
2263
2252
|
rootSpan = this.traceShipper.startSpan({
|
|
2264
2253
|
name: event.operationId,
|
|
2265
2254
|
parent: rootParentOverride != null ? rootParentOverride : inheritedParent,
|
|
@@ -2313,19 +2302,11 @@ var RaindropTelemetryIntegration = class {
|
|
|
2313
2302
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2314
2303
|
const isStream = state.operationId === "ai.streamText" || state.operationId === "ai.streamObject";
|
|
2315
2304
|
const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;
|
|
2316
|
-
const { operationName, resourceName } = opName(
|
|
2317
|
-
stepOperationId,
|
|
2318
|
-
state.functionId
|
|
2319
|
-
);
|
|
2305
|
+
const { operationName, resourceName } = opName(stepOperationId, state.functionId);
|
|
2320
2306
|
const inputAttrs = [];
|
|
2321
2307
|
if (state.recordInputs) {
|
|
2322
2308
|
if (event.promptMessages) {
|
|
2323
|
-
inputAttrs.push(
|
|
2324
|
-
attrString(
|
|
2325
|
-
"ai.prompt.messages",
|
|
2326
|
-
safeJsonWithUint8(event.promptMessages)
|
|
2327
|
-
)
|
|
2328
|
-
);
|
|
2309
|
+
inputAttrs.push(attrString("ai.prompt.messages", safeJsonWithUint8(event.promptMessages)));
|
|
2329
2310
|
}
|
|
2330
2311
|
if (event.stepTools) {
|
|
2331
2312
|
inputAttrs.push(
|
|
@@ -2340,10 +2321,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2340
2321
|
}
|
|
2341
2322
|
if (event.stepToolChoice != null) {
|
|
2342
2323
|
inputAttrs.push(
|
|
2343
|
-
attrString(
|
|
2344
|
-
"ai.prompt.toolChoice",
|
|
2345
|
-
safeJsonWithUint8(event.stepToolChoice)
|
|
2346
|
-
)
|
|
2324
|
+
attrString("ai.prompt.toolChoice", safeJsonWithUint8(event.stepToolChoice))
|
|
2347
2325
|
);
|
|
2348
2326
|
}
|
|
2349
2327
|
}
|
|
@@ -2478,16 +2456,8 @@ var RaindropTelemetryIntegration = class {
|
|
|
2478
2456
|
this.onEmbedStart = (event) => {
|
|
2479
2457
|
const state = this.getState(event.callId);
|
|
2480
2458
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2481
|
-
const { operationName, resourceName } = opName(
|
|
2482
|
-
|
|
2483
|
-
state.functionId
|
|
2484
|
-
);
|
|
2485
|
-
const inputAttrs = state.recordInputs ? [
|
|
2486
|
-
attrString(
|
|
2487
|
-
"ai.values",
|
|
2488
|
-
safeJsonWithUint8(event.values)
|
|
2489
|
-
)
|
|
2490
|
-
] : [];
|
|
2459
|
+
const { operationName, resourceName } = opName(event.operationId, state.functionId);
|
|
2460
|
+
const inputAttrs = state.recordInputs ? [attrString("ai.values", safeJsonWithUint8(event.values))] : [];
|
|
2491
2461
|
const embedSpan = this.traceShipper.startSpan({
|
|
2492
2462
|
name: event.operationId,
|
|
2493
2463
|
parent: state.rootParent,
|
|
@@ -2511,12 +2481,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2511
2481
|
if (!embedSpan) return;
|
|
2512
2482
|
const outputAttrs = [];
|
|
2513
2483
|
if (state.recordOutputs) {
|
|
2514
|
-
outputAttrs.push(
|
|
2515
|
-
attrString(
|
|
2516
|
-
"ai.embeddings",
|
|
2517
|
-
safeJsonWithUint8(event.embeddings)
|
|
2518
|
-
)
|
|
2519
|
-
);
|
|
2484
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embeddings)));
|
|
2520
2485
|
}
|
|
2521
2486
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
2522
2487
|
outputAttrs.push(attrInt("ai.usage.tokens", event.usage.tokens));
|
|
@@ -2734,10 +2699,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2734
2699
|
toolExecutionStart(event) {
|
|
2735
2700
|
const { toolCall } = event;
|
|
2736
2701
|
const priorParent = getCurrentParentToolContext();
|
|
2737
|
-
this.priorParentContexts.set(
|
|
2738
|
-
toolCall.toolCallId,
|
|
2739
|
-
priorParent != null ? priorParent : null
|
|
2740
|
-
);
|
|
2702
|
+
this.priorParentContexts.set(toolCall.toolCallId, priorParent != null ? priorParent : null);
|
|
2741
2703
|
enterParentToolContext({
|
|
2742
2704
|
parentCallId: event.callId,
|
|
2743
2705
|
toolCallId: toolCall.toolCallId,
|
|
@@ -2746,10 +2708,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2746
2708
|
const state = this.getState(event.callId);
|
|
2747
2709
|
state == null ? void 0 : state.parentContextToolCallIds.add(toolCall.toolCallId);
|
|
2748
2710
|
if (!(state == null ? void 0 : state.stepParent)) return;
|
|
2749
|
-
const { operationName, resourceName } = opName(
|
|
2750
|
-
"ai.toolCall",
|
|
2751
|
-
state.functionId
|
|
2752
|
-
);
|
|
2711
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2753
2712
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(toolCall.input))] : [];
|
|
2754
2713
|
const toolSpan = this.traceShipper.startSpan({
|
|
2755
2714
|
name: "ai.toolCall",
|
|
@@ -2826,10 +2785,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2826
2785
|
}
|
|
2827
2786
|
}
|
|
2828
2787
|
for (const call of providerToolCalls) {
|
|
2829
|
-
const { operationName, resourceName } = opName(
|
|
2830
|
-
"ai.toolCall",
|
|
2831
|
-
state.functionId
|
|
2832
|
-
);
|
|
2788
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2833
2789
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(call.input))] : [];
|
|
2834
2790
|
const toolSpan = this.traceShipper.startSpan({
|
|
2835
2791
|
name: "ai.toolCall",
|
|
@@ -2852,12 +2808,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2852
2808
|
if ((resultPart == null ? void 0 : resultPart.type) === "tool-error") {
|
|
2853
2809
|
this.traceShipper.endSpan(toolSpan, { error: resultPart.error });
|
|
2854
2810
|
} else {
|
|
2855
|
-
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [
|
|
2856
|
-
attrString(
|
|
2857
|
-
"ai.toolCall.result",
|
|
2858
|
-
safeJsonWithUint8(resultPart.output)
|
|
2859
|
-
)
|
|
2860
|
-
] : [];
|
|
2811
|
+
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [attrString("ai.toolCall.result", safeJsonWithUint8(resultPart.output))] : [];
|
|
2861
2812
|
this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });
|
|
2862
2813
|
}
|
|
2863
2814
|
this.emitLive(state, "tool_result", call.toolName);
|
|
@@ -2907,9 +2858,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2907
2858
|
attrInt("ai.usage.cachedInputTokens", usage.cachedInputTokens)
|
|
2908
2859
|
);
|
|
2909
2860
|
}
|
|
2910
|
-
outputAttrs.push(
|
|
2911
|
-
attrInt("ai.toolCall.count", state.toolCallCount)
|
|
2912
|
-
);
|
|
2861
|
+
outputAttrs.push(attrInt("ai.toolCall.count", state.toolCallCount));
|
|
2913
2862
|
this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });
|
|
2914
2863
|
}
|
|
2915
2864
|
this.finalizeGenerateEvent(
|
|
@@ -2962,13 +2911,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2962
2911
|
const isMany = state.operationId === "ai.embedMany";
|
|
2963
2912
|
if (state.recordOutputs) {
|
|
2964
2913
|
if (isMany) {
|
|
2965
|
-
outputAttrs.push(
|
|
2966
|
-
attrString("ai.embeddings", safeJsonWithUint8(event.embedding))
|
|
2967
|
-
);
|
|
2914
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embedding)));
|
|
2968
2915
|
} else {
|
|
2969
|
-
outputAttrs.push(
|
|
2970
|
-
attrString("ai.embedding", safeJsonWithUint8(event.embedding))
|
|
2971
|
-
);
|
|
2916
|
+
outputAttrs.push(attrString("ai.embedding", safeJsonWithUint8(event.embedding)));
|
|
2972
2917
|
}
|
|
2973
2918
|
}
|
|
2974
2919
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
@@ -5047,7 +4992,7 @@ function extractNestedTokens(usage, key) {
|
|
|
5047
4992
|
// package.json
|
|
5048
4993
|
var package_default = {
|
|
5049
4994
|
name: "@raindrop-ai/ai-sdk",
|
|
5050
|
-
version: "0.0.
|
|
4995
|
+
version: "0.0.37"};
|
|
5051
4996
|
|
|
5052
4997
|
// src/internal/version.ts
|
|
5053
4998
|
var libraryName = package_default.name;
|
|
@@ -703,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
703
703
|
* Problem
|
|
704
704
|
* ───────
|
|
705
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
706
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
707
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
708
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
709
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -1296,10 +1296,9 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
|
|
|
1296
1296
|
* @example
|
|
1297
1297
|
* ```ts
|
|
1298
1298
|
* import { generateText, registerTelemetry } from "ai";
|
|
1299
|
-
* import { OpenTelemetry } from "@ai-sdk/otel";
|
|
1300
1299
|
* import { raindrop } from "@raindrop-ai/ai-sdk";
|
|
1301
1300
|
*
|
|
1302
|
-
* registerTelemetry(
|
|
1301
|
+
* registerTelemetry(raindrop());
|
|
1303
1302
|
*
|
|
1304
1303
|
* await generateText({
|
|
1305
1304
|
* model: anthropic("claude-sonnet-4-5"),
|
|
@@ -703,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
703
703
|
* Problem
|
|
704
704
|
* ───────
|
|
705
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
706
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
707
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
708
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
709
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -1296,10 +1296,9 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
|
|
|
1296
1296
|
* @example
|
|
1297
1297
|
* ```ts
|
|
1298
1298
|
* import { generateText, registerTelemetry } from "ai";
|
|
1299
|
-
* import { OpenTelemetry } from "@ai-sdk/otel";
|
|
1300
1299
|
* import { raindrop } from "@raindrop-ai/ai-sdk";
|
|
1301
1300
|
*
|
|
1302
|
-
* registerTelemetry(
|
|
1301
|
+
* registerTelemetry(raindrop());
|
|
1303
1302
|
*
|
|
1304
1303
|
* await generateText({
|
|
1305
1304
|
* model: anthropic("claude-sonnet-4-5"),
|
package/dist/index.browser.d.mts
CHANGED
|
@@ -703,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
703
703
|
* Problem
|
|
704
704
|
* ───────
|
|
705
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
706
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
707
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
708
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
709
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -1296,10 +1296,9 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
|
|
|
1296
1296
|
* @example
|
|
1297
1297
|
* ```ts
|
|
1298
1298
|
* import { generateText, registerTelemetry } from "ai";
|
|
1299
|
-
* import { OpenTelemetry } from "@ai-sdk/otel";
|
|
1300
1299
|
* import { raindrop } from "@raindrop-ai/ai-sdk";
|
|
1301
1300
|
*
|
|
1302
|
-
* registerTelemetry(
|
|
1301
|
+
* registerTelemetry(raindrop());
|
|
1303
1302
|
*
|
|
1304
1303
|
* await generateText({
|
|
1305
1304
|
* model: anthropic("claude-sonnet-4-5"),
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -703,7 +703,7 @@ declare function _resetWarnedMissingUserId(): void;
|
|
|
703
703
|
* Problem
|
|
704
704
|
* ───────
|
|
705
705
|
* When a tool's `execute` callback recursively calls `streamText` /
|
|
706
|
-
* `generateText` (which is exactly how
|
|
706
|
+
* `generateText` (which is exactly how Eve lowers sub-agents, but also a
|
|
707
707
|
* common pattern in hand-rolled agent loops, Mastra, Claude Agent SDK,
|
|
708
708
|
* etc.), the inner generation's telemetry events are dispatched with no
|
|
709
709
|
* connection back to the outer tool call. The AI SDK fires `onStart` for
|
|
@@ -1296,10 +1296,9 @@ type RaindropTelemetryOptions = RaindropAISDKOptions & {
|
|
|
1296
1296
|
* @example
|
|
1297
1297
|
* ```ts
|
|
1298
1298
|
* import { generateText, registerTelemetry } from "ai";
|
|
1299
|
-
* import { OpenTelemetry } from "@ai-sdk/otel";
|
|
1300
1299
|
* import { raindrop } from "@raindrop-ai/ai-sdk";
|
|
1301
1300
|
*
|
|
1302
|
-
* registerTelemetry(
|
|
1301
|
+
* registerTelemetry(raindrop());
|
|
1303
1302
|
*
|
|
1304
1303
|
* await generateText({
|
|
1305
1304
|
* model: anthropic("claude-sonnet-4-5"),
|
package/dist/index.browser.js
CHANGED
|
@@ -1283,7 +1283,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1283
1283
|
// package.json
|
|
1284
1284
|
var package_default = {
|
|
1285
1285
|
name: "@raindrop-ai/ai-sdk",
|
|
1286
|
-
version: "0.0.
|
|
1286
|
+
version: "0.0.37"};
|
|
1287
1287
|
|
|
1288
1288
|
// src/internal/version.ts
|
|
1289
1289
|
var libraryName = package_default.name;
|
|
@@ -2196,10 +2196,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2196
2196
|
};
|
|
2197
2197
|
/** Flush and stop the background flush timers. */
|
|
2198
2198
|
this.shutdown = async () => {
|
|
2199
|
-
await Promise.all([
|
|
2200
|
-
this.eventShipper.shutdown(),
|
|
2201
|
-
this.traceShipper.shutdown()
|
|
2202
|
-
]);
|
|
2199
|
+
await Promise.all([this.eventShipper.shutdown(), this.traceShipper.shutdown()]);
|
|
2203
2200
|
};
|
|
2204
2201
|
// ── onStart ─────────────────────────────────────────────────────────────
|
|
2205
2202
|
this.onStart = (event) => {
|
|
@@ -2218,12 +2215,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2218
2215
|
const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;
|
|
2219
2216
|
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();
|
|
2220
2217
|
const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
|
|
2221
|
-
const { operationName, resourceName } = opName(
|
|
2222
|
-
event.operationId,
|
|
2223
|
-
functionId
|
|
2224
|
-
);
|
|
2218
|
+
const { operationName, resourceName } = opName(event.operationId, functionId);
|
|
2225
2219
|
const parentToolContext = !isEmbed && this.subagentWrapping ? getCurrentParentToolContext() : void 0;
|
|
2226
|
-
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;
|
|
2220
|
+
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;
|
|
2227
2221
|
const subagentName = (_e = parentToolContext == null ? void 0 : parentToolContext.toolName) != null ? _e : metadataSubagentName;
|
|
2228
2222
|
let subagentToolCallSpan;
|
|
2229
2223
|
let rootParentOverride;
|
|
@@ -2275,12 +2269,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2275
2269
|
})
|
|
2276
2270
|
)
|
|
2277
2271
|
] : [];
|
|
2278
|
-
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [
|
|
2279
|
-
attrString(
|
|
2280
|
-
"ai.values",
|
|
2281
|
-
safeJsonWithUint8(event.value)
|
|
2282
|
-
)
|
|
2283
|
-
] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2272
|
+
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [attrString("ai.values", safeJsonWithUint8(event.value))] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2284
2273
|
rootSpan = this.traceShipper.startSpan({
|
|
2285
2274
|
name: event.operationId,
|
|
2286
2275
|
parent: rootParentOverride != null ? rootParentOverride : inheritedParent,
|
|
@@ -2334,19 +2323,11 @@ var RaindropTelemetryIntegration = class {
|
|
|
2334
2323
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2335
2324
|
const isStream = state.operationId === "ai.streamText" || state.operationId === "ai.streamObject";
|
|
2336
2325
|
const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;
|
|
2337
|
-
const { operationName, resourceName } = opName(
|
|
2338
|
-
stepOperationId,
|
|
2339
|
-
state.functionId
|
|
2340
|
-
);
|
|
2326
|
+
const { operationName, resourceName } = opName(stepOperationId, state.functionId);
|
|
2341
2327
|
const inputAttrs = [];
|
|
2342
2328
|
if (state.recordInputs) {
|
|
2343
2329
|
if (event.promptMessages) {
|
|
2344
|
-
inputAttrs.push(
|
|
2345
|
-
attrString(
|
|
2346
|
-
"ai.prompt.messages",
|
|
2347
|
-
safeJsonWithUint8(event.promptMessages)
|
|
2348
|
-
)
|
|
2349
|
-
);
|
|
2330
|
+
inputAttrs.push(attrString("ai.prompt.messages", safeJsonWithUint8(event.promptMessages)));
|
|
2350
2331
|
}
|
|
2351
2332
|
if (event.stepTools) {
|
|
2352
2333
|
inputAttrs.push(
|
|
@@ -2361,10 +2342,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2361
2342
|
}
|
|
2362
2343
|
if (event.stepToolChoice != null) {
|
|
2363
2344
|
inputAttrs.push(
|
|
2364
|
-
attrString(
|
|
2365
|
-
"ai.prompt.toolChoice",
|
|
2366
|
-
safeJsonWithUint8(event.stepToolChoice)
|
|
2367
|
-
)
|
|
2345
|
+
attrString("ai.prompt.toolChoice", safeJsonWithUint8(event.stepToolChoice))
|
|
2368
2346
|
);
|
|
2369
2347
|
}
|
|
2370
2348
|
}
|
|
@@ -2499,16 +2477,8 @@ var RaindropTelemetryIntegration = class {
|
|
|
2499
2477
|
this.onEmbedStart = (event) => {
|
|
2500
2478
|
const state = this.getState(event.callId);
|
|
2501
2479
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2502
|
-
const { operationName, resourceName } = opName(
|
|
2503
|
-
|
|
2504
|
-
state.functionId
|
|
2505
|
-
);
|
|
2506
|
-
const inputAttrs = state.recordInputs ? [
|
|
2507
|
-
attrString(
|
|
2508
|
-
"ai.values",
|
|
2509
|
-
safeJsonWithUint8(event.values)
|
|
2510
|
-
)
|
|
2511
|
-
] : [];
|
|
2480
|
+
const { operationName, resourceName } = opName(event.operationId, state.functionId);
|
|
2481
|
+
const inputAttrs = state.recordInputs ? [attrString("ai.values", safeJsonWithUint8(event.values))] : [];
|
|
2512
2482
|
const embedSpan = this.traceShipper.startSpan({
|
|
2513
2483
|
name: event.operationId,
|
|
2514
2484
|
parent: state.rootParent,
|
|
@@ -2532,12 +2502,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2532
2502
|
if (!embedSpan) return;
|
|
2533
2503
|
const outputAttrs = [];
|
|
2534
2504
|
if (state.recordOutputs) {
|
|
2535
|
-
outputAttrs.push(
|
|
2536
|
-
attrString(
|
|
2537
|
-
"ai.embeddings",
|
|
2538
|
-
safeJsonWithUint8(event.embeddings)
|
|
2539
|
-
)
|
|
2540
|
-
);
|
|
2505
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embeddings)));
|
|
2541
2506
|
}
|
|
2542
2507
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
2543
2508
|
outputAttrs.push(attrInt("ai.usage.tokens", event.usage.tokens));
|
|
@@ -2755,10 +2720,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2755
2720
|
toolExecutionStart(event) {
|
|
2756
2721
|
const { toolCall } = event;
|
|
2757
2722
|
const priorParent = getCurrentParentToolContext();
|
|
2758
|
-
this.priorParentContexts.set(
|
|
2759
|
-
toolCall.toolCallId,
|
|
2760
|
-
priorParent != null ? priorParent : null
|
|
2761
|
-
);
|
|
2723
|
+
this.priorParentContexts.set(toolCall.toolCallId, priorParent != null ? priorParent : null);
|
|
2762
2724
|
enterParentToolContext({
|
|
2763
2725
|
parentCallId: event.callId,
|
|
2764
2726
|
toolCallId: toolCall.toolCallId,
|
|
@@ -2767,10 +2729,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2767
2729
|
const state = this.getState(event.callId);
|
|
2768
2730
|
state == null ? void 0 : state.parentContextToolCallIds.add(toolCall.toolCallId);
|
|
2769
2731
|
if (!(state == null ? void 0 : state.stepParent)) return;
|
|
2770
|
-
const { operationName, resourceName } = opName(
|
|
2771
|
-
"ai.toolCall",
|
|
2772
|
-
state.functionId
|
|
2773
|
-
);
|
|
2732
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2774
2733
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(toolCall.input))] : [];
|
|
2775
2734
|
const toolSpan = this.traceShipper.startSpan({
|
|
2776
2735
|
name: "ai.toolCall",
|
|
@@ -2847,10 +2806,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2847
2806
|
}
|
|
2848
2807
|
}
|
|
2849
2808
|
for (const call of providerToolCalls) {
|
|
2850
|
-
const { operationName, resourceName } = opName(
|
|
2851
|
-
"ai.toolCall",
|
|
2852
|
-
state.functionId
|
|
2853
|
-
);
|
|
2809
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2854
2810
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(call.input))] : [];
|
|
2855
2811
|
const toolSpan = this.traceShipper.startSpan({
|
|
2856
2812
|
name: "ai.toolCall",
|
|
@@ -2873,12 +2829,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2873
2829
|
if ((resultPart == null ? void 0 : resultPart.type) === "tool-error") {
|
|
2874
2830
|
this.traceShipper.endSpan(toolSpan, { error: resultPart.error });
|
|
2875
2831
|
} else {
|
|
2876
|
-
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [
|
|
2877
|
-
attrString(
|
|
2878
|
-
"ai.toolCall.result",
|
|
2879
|
-
safeJsonWithUint8(resultPart.output)
|
|
2880
|
-
)
|
|
2881
|
-
] : [];
|
|
2832
|
+
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [attrString("ai.toolCall.result", safeJsonWithUint8(resultPart.output))] : [];
|
|
2882
2833
|
this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });
|
|
2883
2834
|
}
|
|
2884
2835
|
this.emitLive(state, "tool_result", call.toolName);
|
|
@@ -2928,9 +2879,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2928
2879
|
attrInt("ai.usage.cachedInputTokens", usage.cachedInputTokens)
|
|
2929
2880
|
);
|
|
2930
2881
|
}
|
|
2931
|
-
outputAttrs.push(
|
|
2932
|
-
attrInt("ai.toolCall.count", state.toolCallCount)
|
|
2933
|
-
);
|
|
2882
|
+
outputAttrs.push(attrInt("ai.toolCall.count", state.toolCallCount));
|
|
2934
2883
|
this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });
|
|
2935
2884
|
}
|
|
2936
2885
|
this.finalizeGenerateEvent(
|
|
@@ -2983,13 +2932,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2983
2932
|
const isMany = state.operationId === "ai.embedMany";
|
|
2984
2933
|
if (state.recordOutputs) {
|
|
2985
2934
|
if (isMany) {
|
|
2986
|
-
outputAttrs.push(
|
|
2987
|
-
attrString("ai.embeddings", safeJsonWithUint8(event.embedding))
|
|
2988
|
-
);
|
|
2935
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embedding)));
|
|
2989
2936
|
} else {
|
|
2990
|
-
outputAttrs.push(
|
|
2991
|
-
attrString("ai.embedding", safeJsonWithUint8(event.embedding))
|
|
2992
|
-
);
|
|
2937
|
+
outputAttrs.push(attrString("ai.embedding", safeJsonWithUint8(event.embedding)));
|
|
2993
2938
|
}
|
|
2994
2939
|
}
|
|
2995
2940
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
package/dist/index.browser.mjs
CHANGED
|
@@ -1281,7 +1281,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1281
1281
|
// package.json
|
|
1282
1282
|
var package_default = {
|
|
1283
1283
|
name: "@raindrop-ai/ai-sdk",
|
|
1284
|
-
version: "0.0.
|
|
1284
|
+
version: "0.0.37"};
|
|
1285
1285
|
|
|
1286
1286
|
// src/internal/version.ts
|
|
1287
1287
|
var libraryName = package_default.name;
|
|
@@ -2194,10 +2194,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2194
2194
|
};
|
|
2195
2195
|
/** Flush and stop the background flush timers. */
|
|
2196
2196
|
this.shutdown = async () => {
|
|
2197
|
-
await Promise.all([
|
|
2198
|
-
this.eventShipper.shutdown(),
|
|
2199
|
-
this.traceShipper.shutdown()
|
|
2200
|
-
]);
|
|
2197
|
+
await Promise.all([this.eventShipper.shutdown(), this.traceShipper.shutdown()]);
|
|
2201
2198
|
};
|
|
2202
2199
|
// ── onStart ─────────────────────────────────────────────────────────────
|
|
2203
2200
|
this.onStart = (event) => {
|
|
@@ -2216,12 +2213,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2216
2213
|
const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;
|
|
2217
2214
|
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();
|
|
2218
2215
|
const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
|
|
2219
|
-
const { operationName, resourceName } = opName(
|
|
2220
|
-
event.operationId,
|
|
2221
|
-
functionId
|
|
2222
|
-
);
|
|
2216
|
+
const { operationName, resourceName } = opName(event.operationId, functionId);
|
|
2223
2217
|
const parentToolContext = !isEmbed && this.subagentWrapping ? getCurrentParentToolContext() : void 0;
|
|
2224
|
-
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;
|
|
2218
|
+
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;
|
|
2225
2219
|
const subagentName = (_e = parentToolContext == null ? void 0 : parentToolContext.toolName) != null ? _e : metadataSubagentName;
|
|
2226
2220
|
let subagentToolCallSpan;
|
|
2227
2221
|
let rootParentOverride;
|
|
@@ -2273,12 +2267,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2273
2267
|
})
|
|
2274
2268
|
)
|
|
2275
2269
|
] : [];
|
|
2276
|
-
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [
|
|
2277
|
-
attrString(
|
|
2278
|
-
"ai.values",
|
|
2279
|
-
safeJsonWithUint8(event.value)
|
|
2280
|
-
)
|
|
2281
|
-
] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2270
|
+
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [attrString("ai.values", safeJsonWithUint8(event.value))] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2282
2271
|
rootSpan = this.traceShipper.startSpan({
|
|
2283
2272
|
name: event.operationId,
|
|
2284
2273
|
parent: rootParentOverride != null ? rootParentOverride : inheritedParent,
|
|
@@ -2332,19 +2321,11 @@ var RaindropTelemetryIntegration = class {
|
|
|
2332
2321
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2333
2322
|
const isStream = state.operationId === "ai.streamText" || state.operationId === "ai.streamObject";
|
|
2334
2323
|
const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;
|
|
2335
|
-
const { operationName, resourceName } = opName(
|
|
2336
|
-
stepOperationId,
|
|
2337
|
-
state.functionId
|
|
2338
|
-
);
|
|
2324
|
+
const { operationName, resourceName } = opName(stepOperationId, state.functionId);
|
|
2339
2325
|
const inputAttrs = [];
|
|
2340
2326
|
if (state.recordInputs) {
|
|
2341
2327
|
if (event.promptMessages) {
|
|
2342
|
-
inputAttrs.push(
|
|
2343
|
-
attrString(
|
|
2344
|
-
"ai.prompt.messages",
|
|
2345
|
-
safeJsonWithUint8(event.promptMessages)
|
|
2346
|
-
)
|
|
2347
|
-
);
|
|
2328
|
+
inputAttrs.push(attrString("ai.prompt.messages", safeJsonWithUint8(event.promptMessages)));
|
|
2348
2329
|
}
|
|
2349
2330
|
if (event.stepTools) {
|
|
2350
2331
|
inputAttrs.push(
|
|
@@ -2359,10 +2340,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2359
2340
|
}
|
|
2360
2341
|
if (event.stepToolChoice != null) {
|
|
2361
2342
|
inputAttrs.push(
|
|
2362
|
-
attrString(
|
|
2363
|
-
"ai.prompt.toolChoice",
|
|
2364
|
-
safeJsonWithUint8(event.stepToolChoice)
|
|
2365
|
-
)
|
|
2343
|
+
attrString("ai.prompt.toolChoice", safeJsonWithUint8(event.stepToolChoice))
|
|
2366
2344
|
);
|
|
2367
2345
|
}
|
|
2368
2346
|
}
|
|
@@ -2497,16 +2475,8 @@ var RaindropTelemetryIntegration = class {
|
|
|
2497
2475
|
this.onEmbedStart = (event) => {
|
|
2498
2476
|
const state = this.getState(event.callId);
|
|
2499
2477
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2500
|
-
const { operationName, resourceName } = opName(
|
|
2501
|
-
|
|
2502
|
-
state.functionId
|
|
2503
|
-
);
|
|
2504
|
-
const inputAttrs = state.recordInputs ? [
|
|
2505
|
-
attrString(
|
|
2506
|
-
"ai.values",
|
|
2507
|
-
safeJsonWithUint8(event.values)
|
|
2508
|
-
)
|
|
2509
|
-
] : [];
|
|
2478
|
+
const { operationName, resourceName } = opName(event.operationId, state.functionId);
|
|
2479
|
+
const inputAttrs = state.recordInputs ? [attrString("ai.values", safeJsonWithUint8(event.values))] : [];
|
|
2510
2480
|
const embedSpan = this.traceShipper.startSpan({
|
|
2511
2481
|
name: event.operationId,
|
|
2512
2482
|
parent: state.rootParent,
|
|
@@ -2530,12 +2500,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2530
2500
|
if (!embedSpan) return;
|
|
2531
2501
|
const outputAttrs = [];
|
|
2532
2502
|
if (state.recordOutputs) {
|
|
2533
|
-
outputAttrs.push(
|
|
2534
|
-
attrString(
|
|
2535
|
-
"ai.embeddings",
|
|
2536
|
-
safeJsonWithUint8(event.embeddings)
|
|
2537
|
-
)
|
|
2538
|
-
);
|
|
2503
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embeddings)));
|
|
2539
2504
|
}
|
|
2540
2505
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
2541
2506
|
outputAttrs.push(attrInt("ai.usage.tokens", event.usage.tokens));
|
|
@@ -2753,10 +2718,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2753
2718
|
toolExecutionStart(event) {
|
|
2754
2719
|
const { toolCall } = event;
|
|
2755
2720
|
const priorParent = getCurrentParentToolContext();
|
|
2756
|
-
this.priorParentContexts.set(
|
|
2757
|
-
toolCall.toolCallId,
|
|
2758
|
-
priorParent != null ? priorParent : null
|
|
2759
|
-
);
|
|
2721
|
+
this.priorParentContexts.set(toolCall.toolCallId, priorParent != null ? priorParent : null);
|
|
2760
2722
|
enterParentToolContext({
|
|
2761
2723
|
parentCallId: event.callId,
|
|
2762
2724
|
toolCallId: toolCall.toolCallId,
|
|
@@ -2765,10 +2727,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2765
2727
|
const state = this.getState(event.callId);
|
|
2766
2728
|
state == null ? void 0 : state.parentContextToolCallIds.add(toolCall.toolCallId);
|
|
2767
2729
|
if (!(state == null ? void 0 : state.stepParent)) return;
|
|
2768
|
-
const { operationName, resourceName } = opName(
|
|
2769
|
-
"ai.toolCall",
|
|
2770
|
-
state.functionId
|
|
2771
|
-
);
|
|
2730
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2772
2731
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(toolCall.input))] : [];
|
|
2773
2732
|
const toolSpan = this.traceShipper.startSpan({
|
|
2774
2733
|
name: "ai.toolCall",
|
|
@@ -2845,10 +2804,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2845
2804
|
}
|
|
2846
2805
|
}
|
|
2847
2806
|
for (const call of providerToolCalls) {
|
|
2848
|
-
const { operationName, resourceName } = opName(
|
|
2849
|
-
"ai.toolCall",
|
|
2850
|
-
state.functionId
|
|
2851
|
-
);
|
|
2807
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2852
2808
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(call.input))] : [];
|
|
2853
2809
|
const toolSpan = this.traceShipper.startSpan({
|
|
2854
2810
|
name: "ai.toolCall",
|
|
@@ -2871,12 +2827,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2871
2827
|
if ((resultPart == null ? void 0 : resultPart.type) === "tool-error") {
|
|
2872
2828
|
this.traceShipper.endSpan(toolSpan, { error: resultPart.error });
|
|
2873
2829
|
} else {
|
|
2874
|
-
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [
|
|
2875
|
-
attrString(
|
|
2876
|
-
"ai.toolCall.result",
|
|
2877
|
-
safeJsonWithUint8(resultPart.output)
|
|
2878
|
-
)
|
|
2879
|
-
] : [];
|
|
2830
|
+
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [attrString("ai.toolCall.result", safeJsonWithUint8(resultPart.output))] : [];
|
|
2880
2831
|
this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });
|
|
2881
2832
|
}
|
|
2882
2833
|
this.emitLive(state, "tool_result", call.toolName);
|
|
@@ -2926,9 +2877,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2926
2877
|
attrInt("ai.usage.cachedInputTokens", usage.cachedInputTokens)
|
|
2927
2878
|
);
|
|
2928
2879
|
}
|
|
2929
|
-
outputAttrs.push(
|
|
2930
|
-
attrInt("ai.toolCall.count", state.toolCallCount)
|
|
2931
|
-
);
|
|
2880
|
+
outputAttrs.push(attrInt("ai.toolCall.count", state.toolCallCount));
|
|
2932
2881
|
this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });
|
|
2933
2882
|
}
|
|
2934
2883
|
this.finalizeGenerateEvent(
|
|
@@ -2981,13 +2930,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2981
2930
|
const isMany = state.operationId === "ai.embedMany";
|
|
2982
2931
|
if (state.recordOutputs) {
|
|
2983
2932
|
if (isMany) {
|
|
2984
|
-
outputAttrs.push(
|
|
2985
|
-
attrString("ai.embeddings", safeJsonWithUint8(event.embedding))
|
|
2986
|
-
);
|
|
2933
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embedding)));
|
|
2987
2934
|
} else {
|
|
2988
|
-
outputAttrs.push(
|
|
2989
|
-
attrString("ai.embedding", safeJsonWithUint8(event.embedding))
|
|
2990
|
-
);
|
|
2935
|
+
outputAttrs.push(attrString("ai.embedding", safeJsonWithUint8(event.embedding)));
|
|
2991
2936
|
}
|
|
2992
2937
|
}
|
|
2993
2938
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
package/dist/index.node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D-E1YSku.mjs';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D-E1YSku.js';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.node.js
CHANGED
|
@@ -1288,7 +1288,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
|
|
|
1288
1288
|
// package.json
|
|
1289
1289
|
var package_default = {
|
|
1290
1290
|
name: "@raindrop-ai/ai-sdk",
|
|
1291
|
-
version: "0.0.
|
|
1291
|
+
version: "0.0.37"};
|
|
1292
1292
|
|
|
1293
1293
|
// src/internal/version.ts
|
|
1294
1294
|
var libraryName = package_default.name;
|
|
@@ -2201,10 +2201,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2201
2201
|
};
|
|
2202
2202
|
/** Flush and stop the background flush timers. */
|
|
2203
2203
|
this.shutdown = async () => {
|
|
2204
|
-
await Promise.all([
|
|
2205
|
-
this.eventShipper.shutdown(),
|
|
2206
|
-
this.traceShipper.shutdown()
|
|
2207
|
-
]);
|
|
2204
|
+
await Promise.all([this.eventShipper.shutdown(), this.traceShipper.shutdown()]);
|
|
2208
2205
|
};
|
|
2209
2206
|
// ── onStart ─────────────────────────────────────────────────────────────
|
|
2210
2207
|
this.onStart = (event) => {
|
|
@@ -2223,12 +2220,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2223
2220
|
const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;
|
|
2224
2221
|
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();
|
|
2225
2222
|
const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
|
|
2226
|
-
const { operationName, resourceName } = opName(
|
|
2227
|
-
event.operationId,
|
|
2228
|
-
functionId
|
|
2229
|
-
);
|
|
2223
|
+
const { operationName, resourceName } = opName(event.operationId, functionId);
|
|
2230
2224
|
const parentToolContext = !isEmbed && this.subagentWrapping ? getCurrentParentToolContext() : void 0;
|
|
2231
|
-
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;
|
|
2225
|
+
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;
|
|
2232
2226
|
const subagentName = (_e = parentToolContext == null ? void 0 : parentToolContext.toolName) != null ? _e : metadataSubagentName;
|
|
2233
2227
|
let subagentToolCallSpan;
|
|
2234
2228
|
let rootParentOverride;
|
|
@@ -2280,12 +2274,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2280
2274
|
})
|
|
2281
2275
|
)
|
|
2282
2276
|
] : [];
|
|
2283
|
-
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [
|
|
2284
|
-
attrString(
|
|
2285
|
-
"ai.values",
|
|
2286
|
-
safeJsonWithUint8(event.value)
|
|
2287
|
-
)
|
|
2288
|
-
] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2277
|
+
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [attrString("ai.values", safeJsonWithUint8(event.value))] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2289
2278
|
rootSpan = this.traceShipper.startSpan({
|
|
2290
2279
|
name: event.operationId,
|
|
2291
2280
|
parent: rootParentOverride != null ? rootParentOverride : inheritedParent,
|
|
@@ -2339,19 +2328,11 @@ var RaindropTelemetryIntegration = class {
|
|
|
2339
2328
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2340
2329
|
const isStream = state.operationId === "ai.streamText" || state.operationId === "ai.streamObject";
|
|
2341
2330
|
const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;
|
|
2342
|
-
const { operationName, resourceName } = opName(
|
|
2343
|
-
stepOperationId,
|
|
2344
|
-
state.functionId
|
|
2345
|
-
);
|
|
2331
|
+
const { operationName, resourceName } = opName(stepOperationId, state.functionId);
|
|
2346
2332
|
const inputAttrs = [];
|
|
2347
2333
|
if (state.recordInputs) {
|
|
2348
2334
|
if (event.promptMessages) {
|
|
2349
|
-
inputAttrs.push(
|
|
2350
|
-
attrString(
|
|
2351
|
-
"ai.prompt.messages",
|
|
2352
|
-
safeJsonWithUint8(event.promptMessages)
|
|
2353
|
-
)
|
|
2354
|
-
);
|
|
2335
|
+
inputAttrs.push(attrString("ai.prompt.messages", safeJsonWithUint8(event.promptMessages)));
|
|
2355
2336
|
}
|
|
2356
2337
|
if (event.stepTools) {
|
|
2357
2338
|
inputAttrs.push(
|
|
@@ -2366,10 +2347,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2366
2347
|
}
|
|
2367
2348
|
if (event.stepToolChoice != null) {
|
|
2368
2349
|
inputAttrs.push(
|
|
2369
|
-
attrString(
|
|
2370
|
-
"ai.prompt.toolChoice",
|
|
2371
|
-
safeJsonWithUint8(event.stepToolChoice)
|
|
2372
|
-
)
|
|
2350
|
+
attrString("ai.prompt.toolChoice", safeJsonWithUint8(event.stepToolChoice))
|
|
2373
2351
|
);
|
|
2374
2352
|
}
|
|
2375
2353
|
}
|
|
@@ -2504,16 +2482,8 @@ var RaindropTelemetryIntegration = class {
|
|
|
2504
2482
|
this.onEmbedStart = (event) => {
|
|
2505
2483
|
const state = this.getState(event.callId);
|
|
2506
2484
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2507
|
-
const { operationName, resourceName } = opName(
|
|
2508
|
-
|
|
2509
|
-
state.functionId
|
|
2510
|
-
);
|
|
2511
|
-
const inputAttrs = state.recordInputs ? [
|
|
2512
|
-
attrString(
|
|
2513
|
-
"ai.values",
|
|
2514
|
-
safeJsonWithUint8(event.values)
|
|
2515
|
-
)
|
|
2516
|
-
] : [];
|
|
2485
|
+
const { operationName, resourceName } = opName(event.operationId, state.functionId);
|
|
2486
|
+
const inputAttrs = state.recordInputs ? [attrString("ai.values", safeJsonWithUint8(event.values))] : [];
|
|
2517
2487
|
const embedSpan = this.traceShipper.startSpan({
|
|
2518
2488
|
name: event.operationId,
|
|
2519
2489
|
parent: state.rootParent,
|
|
@@ -2537,12 +2507,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2537
2507
|
if (!embedSpan) return;
|
|
2538
2508
|
const outputAttrs = [];
|
|
2539
2509
|
if (state.recordOutputs) {
|
|
2540
|
-
outputAttrs.push(
|
|
2541
|
-
attrString(
|
|
2542
|
-
"ai.embeddings",
|
|
2543
|
-
safeJsonWithUint8(event.embeddings)
|
|
2544
|
-
)
|
|
2545
|
-
);
|
|
2510
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embeddings)));
|
|
2546
2511
|
}
|
|
2547
2512
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
2548
2513
|
outputAttrs.push(attrInt("ai.usage.tokens", event.usage.tokens));
|
|
@@ -2760,10 +2725,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2760
2725
|
toolExecutionStart(event) {
|
|
2761
2726
|
const { toolCall } = event;
|
|
2762
2727
|
const priorParent = getCurrentParentToolContext();
|
|
2763
|
-
this.priorParentContexts.set(
|
|
2764
|
-
toolCall.toolCallId,
|
|
2765
|
-
priorParent != null ? priorParent : null
|
|
2766
|
-
);
|
|
2728
|
+
this.priorParentContexts.set(toolCall.toolCallId, priorParent != null ? priorParent : null);
|
|
2767
2729
|
enterParentToolContext({
|
|
2768
2730
|
parentCallId: event.callId,
|
|
2769
2731
|
toolCallId: toolCall.toolCallId,
|
|
@@ -2772,10 +2734,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2772
2734
|
const state = this.getState(event.callId);
|
|
2773
2735
|
state == null ? void 0 : state.parentContextToolCallIds.add(toolCall.toolCallId);
|
|
2774
2736
|
if (!(state == null ? void 0 : state.stepParent)) return;
|
|
2775
|
-
const { operationName, resourceName } = opName(
|
|
2776
|
-
"ai.toolCall",
|
|
2777
|
-
state.functionId
|
|
2778
|
-
);
|
|
2737
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2779
2738
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(toolCall.input))] : [];
|
|
2780
2739
|
const toolSpan = this.traceShipper.startSpan({
|
|
2781
2740
|
name: "ai.toolCall",
|
|
@@ -2852,10 +2811,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2852
2811
|
}
|
|
2853
2812
|
}
|
|
2854
2813
|
for (const call of providerToolCalls) {
|
|
2855
|
-
const { operationName, resourceName } = opName(
|
|
2856
|
-
"ai.toolCall",
|
|
2857
|
-
state.functionId
|
|
2858
|
-
);
|
|
2814
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2859
2815
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(call.input))] : [];
|
|
2860
2816
|
const toolSpan = this.traceShipper.startSpan({
|
|
2861
2817
|
name: "ai.toolCall",
|
|
@@ -2878,12 +2834,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2878
2834
|
if ((resultPart == null ? void 0 : resultPart.type) === "tool-error") {
|
|
2879
2835
|
this.traceShipper.endSpan(toolSpan, { error: resultPart.error });
|
|
2880
2836
|
} else {
|
|
2881
|
-
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [
|
|
2882
|
-
attrString(
|
|
2883
|
-
"ai.toolCall.result",
|
|
2884
|
-
safeJsonWithUint8(resultPart.output)
|
|
2885
|
-
)
|
|
2886
|
-
] : [];
|
|
2837
|
+
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [attrString("ai.toolCall.result", safeJsonWithUint8(resultPart.output))] : [];
|
|
2887
2838
|
this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });
|
|
2888
2839
|
}
|
|
2889
2840
|
this.emitLive(state, "tool_result", call.toolName);
|
|
@@ -2933,9 +2884,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2933
2884
|
attrInt("ai.usage.cachedInputTokens", usage.cachedInputTokens)
|
|
2934
2885
|
);
|
|
2935
2886
|
}
|
|
2936
|
-
outputAttrs.push(
|
|
2937
|
-
attrInt("ai.toolCall.count", state.toolCallCount)
|
|
2938
|
-
);
|
|
2887
|
+
outputAttrs.push(attrInt("ai.toolCall.count", state.toolCallCount));
|
|
2939
2888
|
this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });
|
|
2940
2889
|
}
|
|
2941
2890
|
this.finalizeGenerateEvent(
|
|
@@ -2988,13 +2937,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2988
2937
|
const isMany = state.operationId === "ai.embedMany";
|
|
2989
2938
|
if (state.recordOutputs) {
|
|
2990
2939
|
if (isMany) {
|
|
2991
|
-
outputAttrs.push(
|
|
2992
|
-
attrString("ai.embeddings", safeJsonWithUint8(event.embedding))
|
|
2993
|
-
);
|
|
2940
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embedding)));
|
|
2994
2941
|
} else {
|
|
2995
|
-
outputAttrs.push(
|
|
2996
|
-
attrString("ai.embedding", safeJsonWithUint8(event.embedding))
|
|
2997
|
-
);
|
|
2942
|
+
outputAttrs.push(attrString("ai.embedding", safeJsonWithUint8(event.embedding)));
|
|
2998
2943
|
}
|
|
2999
2944
|
}
|
|
3000
2945
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
package/dist/index.node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-
|
|
1
|
+
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-ZIGZX4D5.mjs';
|
|
2
2
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
3
|
|
|
4
4
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
|
package/dist/index.workers.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D-E1YSku.mjs';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.workers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D-E1YSku.js';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.workers.js
CHANGED
|
@@ -1288,7 +1288,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
|
|
|
1288
1288
|
// package.json
|
|
1289
1289
|
var package_default = {
|
|
1290
1290
|
name: "@raindrop-ai/ai-sdk",
|
|
1291
|
-
version: "0.0.
|
|
1291
|
+
version: "0.0.37"};
|
|
1292
1292
|
|
|
1293
1293
|
// src/internal/version.ts
|
|
1294
1294
|
var libraryName = package_default.name;
|
|
@@ -2201,10 +2201,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2201
2201
|
};
|
|
2202
2202
|
/** Flush and stop the background flush timers. */
|
|
2203
2203
|
this.shutdown = async () => {
|
|
2204
|
-
await Promise.all([
|
|
2205
|
-
this.eventShipper.shutdown(),
|
|
2206
|
-
this.traceShipper.shutdown()
|
|
2207
|
-
]);
|
|
2204
|
+
await Promise.all([this.eventShipper.shutdown(), this.traceShipper.shutdown()]);
|
|
2208
2205
|
};
|
|
2209
2206
|
// ── onStart ─────────────────────────────────────────────────────────────
|
|
2210
2207
|
this.onStart = (event) => {
|
|
@@ -2223,12 +2220,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2223
2220
|
const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;
|
|
2224
2221
|
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();
|
|
2225
2222
|
const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
|
|
2226
|
-
const { operationName, resourceName } = opName(
|
|
2227
|
-
event.operationId,
|
|
2228
|
-
functionId
|
|
2229
|
-
);
|
|
2223
|
+
const { operationName, resourceName } = opName(event.operationId, functionId);
|
|
2230
2224
|
const parentToolContext = !isEmbed && this.subagentWrapping ? getCurrentParentToolContext() : void 0;
|
|
2231
|
-
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;
|
|
2225
|
+
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;
|
|
2232
2226
|
const subagentName = (_e = parentToolContext == null ? void 0 : parentToolContext.toolName) != null ? _e : metadataSubagentName;
|
|
2233
2227
|
let subagentToolCallSpan;
|
|
2234
2228
|
let rootParentOverride;
|
|
@@ -2280,12 +2274,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2280
2274
|
})
|
|
2281
2275
|
)
|
|
2282
2276
|
] : [];
|
|
2283
|
-
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [
|
|
2284
|
-
attrString(
|
|
2285
|
-
"ai.values",
|
|
2286
|
-
safeJsonWithUint8(event.value)
|
|
2287
|
-
)
|
|
2288
|
-
] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2277
|
+
const embedAttrs = isEmbed && recordInputs ? event.operationId === "ai.embedMany" ? [attrString("ai.values", safeJsonWithUint8(event.value))] : [attrString("ai.value", safeJsonWithUint8(event.value))] : [];
|
|
2289
2278
|
rootSpan = this.traceShipper.startSpan({
|
|
2290
2279
|
name: event.operationId,
|
|
2291
2280
|
parent: rootParentOverride != null ? rootParentOverride : inheritedParent,
|
|
@@ -2339,19 +2328,11 @@ var RaindropTelemetryIntegration = class {
|
|
|
2339
2328
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2340
2329
|
const isStream = state.operationId === "ai.streamText" || state.operationId === "ai.streamObject";
|
|
2341
2330
|
const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;
|
|
2342
|
-
const { operationName, resourceName } = opName(
|
|
2343
|
-
stepOperationId,
|
|
2344
|
-
state.functionId
|
|
2345
|
-
);
|
|
2331
|
+
const { operationName, resourceName } = opName(stepOperationId, state.functionId);
|
|
2346
2332
|
const inputAttrs = [];
|
|
2347
2333
|
if (state.recordInputs) {
|
|
2348
2334
|
if (event.promptMessages) {
|
|
2349
|
-
inputAttrs.push(
|
|
2350
|
-
attrString(
|
|
2351
|
-
"ai.prompt.messages",
|
|
2352
|
-
safeJsonWithUint8(event.promptMessages)
|
|
2353
|
-
)
|
|
2354
|
-
);
|
|
2335
|
+
inputAttrs.push(attrString("ai.prompt.messages", safeJsonWithUint8(event.promptMessages)));
|
|
2355
2336
|
}
|
|
2356
2337
|
if (event.stepTools) {
|
|
2357
2338
|
inputAttrs.push(
|
|
@@ -2366,10 +2347,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2366
2347
|
}
|
|
2367
2348
|
if (event.stepToolChoice != null) {
|
|
2368
2349
|
inputAttrs.push(
|
|
2369
|
-
attrString(
|
|
2370
|
-
"ai.prompt.toolChoice",
|
|
2371
|
-
safeJsonWithUint8(event.stepToolChoice)
|
|
2372
|
-
)
|
|
2350
|
+
attrString("ai.prompt.toolChoice", safeJsonWithUint8(event.stepToolChoice))
|
|
2373
2351
|
);
|
|
2374
2352
|
}
|
|
2375
2353
|
}
|
|
@@ -2504,16 +2482,8 @@ var RaindropTelemetryIntegration = class {
|
|
|
2504
2482
|
this.onEmbedStart = (event) => {
|
|
2505
2483
|
const state = this.getState(event.callId);
|
|
2506
2484
|
if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;
|
|
2507
|
-
const { operationName, resourceName } = opName(
|
|
2508
|
-
|
|
2509
|
-
state.functionId
|
|
2510
|
-
);
|
|
2511
|
-
const inputAttrs = state.recordInputs ? [
|
|
2512
|
-
attrString(
|
|
2513
|
-
"ai.values",
|
|
2514
|
-
safeJsonWithUint8(event.values)
|
|
2515
|
-
)
|
|
2516
|
-
] : [];
|
|
2485
|
+
const { operationName, resourceName } = opName(event.operationId, state.functionId);
|
|
2486
|
+
const inputAttrs = state.recordInputs ? [attrString("ai.values", safeJsonWithUint8(event.values))] : [];
|
|
2517
2487
|
const embedSpan = this.traceShipper.startSpan({
|
|
2518
2488
|
name: event.operationId,
|
|
2519
2489
|
parent: state.rootParent,
|
|
@@ -2537,12 +2507,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2537
2507
|
if (!embedSpan) return;
|
|
2538
2508
|
const outputAttrs = [];
|
|
2539
2509
|
if (state.recordOutputs) {
|
|
2540
|
-
outputAttrs.push(
|
|
2541
|
-
attrString(
|
|
2542
|
-
"ai.embeddings",
|
|
2543
|
-
safeJsonWithUint8(event.embeddings)
|
|
2544
|
-
)
|
|
2545
|
-
);
|
|
2510
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embeddings)));
|
|
2546
2511
|
}
|
|
2547
2512
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
|
2548
2513
|
outputAttrs.push(attrInt("ai.usage.tokens", event.usage.tokens));
|
|
@@ -2760,10 +2725,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2760
2725
|
toolExecutionStart(event) {
|
|
2761
2726
|
const { toolCall } = event;
|
|
2762
2727
|
const priorParent = getCurrentParentToolContext();
|
|
2763
|
-
this.priorParentContexts.set(
|
|
2764
|
-
toolCall.toolCallId,
|
|
2765
|
-
priorParent != null ? priorParent : null
|
|
2766
|
-
);
|
|
2728
|
+
this.priorParentContexts.set(toolCall.toolCallId, priorParent != null ? priorParent : null);
|
|
2767
2729
|
enterParentToolContext({
|
|
2768
2730
|
parentCallId: event.callId,
|
|
2769
2731
|
toolCallId: toolCall.toolCallId,
|
|
@@ -2772,10 +2734,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2772
2734
|
const state = this.getState(event.callId);
|
|
2773
2735
|
state == null ? void 0 : state.parentContextToolCallIds.add(toolCall.toolCallId);
|
|
2774
2736
|
if (!(state == null ? void 0 : state.stepParent)) return;
|
|
2775
|
-
const { operationName, resourceName } = opName(
|
|
2776
|
-
"ai.toolCall",
|
|
2777
|
-
state.functionId
|
|
2778
|
-
);
|
|
2737
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2779
2738
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(toolCall.input))] : [];
|
|
2780
2739
|
const toolSpan = this.traceShipper.startSpan({
|
|
2781
2740
|
name: "ai.toolCall",
|
|
@@ -2852,10 +2811,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2852
2811
|
}
|
|
2853
2812
|
}
|
|
2854
2813
|
for (const call of providerToolCalls) {
|
|
2855
|
-
const { operationName, resourceName } = opName(
|
|
2856
|
-
"ai.toolCall",
|
|
2857
|
-
state.functionId
|
|
2858
|
-
);
|
|
2814
|
+
const { operationName, resourceName } = opName("ai.toolCall", state.functionId);
|
|
2859
2815
|
const inputAttrs = state.recordInputs ? [attrString("ai.toolCall.args", safeJsonWithUint8(call.input))] : [];
|
|
2860
2816
|
const toolSpan = this.traceShipper.startSpan({
|
|
2861
2817
|
name: "ai.toolCall",
|
|
@@ -2878,12 +2834,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2878
2834
|
if ((resultPart == null ? void 0 : resultPart.type) === "tool-error") {
|
|
2879
2835
|
this.traceShipper.endSpan(toolSpan, { error: resultPart.error });
|
|
2880
2836
|
} else {
|
|
2881
|
-
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [
|
|
2882
|
-
attrString(
|
|
2883
|
-
"ai.toolCall.result",
|
|
2884
|
-
safeJsonWithUint8(resultPart.output)
|
|
2885
|
-
)
|
|
2886
|
-
] : [];
|
|
2837
|
+
const outputAttrs = state.recordOutputs && resultPart && "output" in resultPart ? [attrString("ai.toolCall.result", safeJsonWithUint8(resultPart.output))] : [];
|
|
2887
2838
|
this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });
|
|
2888
2839
|
}
|
|
2889
2840
|
this.emitLive(state, "tool_result", call.toolName);
|
|
@@ -2933,9 +2884,7 @@ var RaindropTelemetryIntegration = class {
|
|
|
2933
2884
|
attrInt("ai.usage.cachedInputTokens", usage.cachedInputTokens)
|
|
2934
2885
|
);
|
|
2935
2886
|
}
|
|
2936
|
-
outputAttrs.push(
|
|
2937
|
-
attrInt("ai.toolCall.count", state.toolCallCount)
|
|
2938
|
-
);
|
|
2887
|
+
outputAttrs.push(attrInt("ai.toolCall.count", state.toolCallCount));
|
|
2939
2888
|
this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });
|
|
2940
2889
|
}
|
|
2941
2890
|
this.finalizeGenerateEvent(
|
|
@@ -2988,13 +2937,9 @@ var RaindropTelemetryIntegration = class {
|
|
|
2988
2937
|
const isMany = state.operationId === "ai.embedMany";
|
|
2989
2938
|
if (state.recordOutputs) {
|
|
2990
2939
|
if (isMany) {
|
|
2991
|
-
outputAttrs.push(
|
|
2992
|
-
attrString("ai.embeddings", safeJsonWithUint8(event.embedding))
|
|
2993
|
-
);
|
|
2940
|
+
outputAttrs.push(attrString("ai.embeddings", safeJsonWithUint8(event.embedding)));
|
|
2994
2941
|
} else {
|
|
2995
|
-
outputAttrs.push(
|
|
2996
|
-
attrString("ai.embedding", safeJsonWithUint8(event.embedding))
|
|
2997
|
-
);
|
|
2942
|
+
outputAttrs.push(attrString("ai.embedding", safeJsonWithUint8(event.embedding)));
|
|
2998
2943
|
}
|
|
2999
2944
|
}
|
|
3000
2945
|
if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {
|
package/dist/index.workers.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-
|
|
1
|
+
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-ZIGZX4D5.mjs';
|
|
2
2
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
3
|
|
|
4
4
|
if (!globalThis.RAINDROP_ASYNC_LOCAL_STORAGE) {
|
package/package.json
CHANGED