@raindrop-ai/ai-sdk 0.0.25 → 0.0.26
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 +30 -4
- package/dist/{chunk-AUFHKHNR.mjs → chunk-76JSTQY3.mjs} +205 -88
- package/dist/{index-sxjvhkYW.d.mts → index-7aDHuHHR.d.mts} +70 -11
- package/dist/{index-sxjvhkYW.d.ts → index-7aDHuHHR.d.ts} +70 -11
- package/dist/index.browser.d.mts +70 -11
- package/dist/index.browser.d.ts +70 -11
- package/dist/index.browser.js +208 -87
- package/dist/index.browser.mjs +205 -88
- package/dist/index.node.d.mts +1 -1
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +208 -87
- 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 +208 -87
- package/dist/index.workers.mjs +1 -1
- package/package.json +1 -1
|
@@ -224,22 +224,16 @@ declare class TraceShipper extends TraceShipper$1 {
|
|
|
224
224
|
constructor(opts: ConstructorParameters<typeof TraceShipper$1>[0]);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
/**
|
|
228
|
-
* Raindrop TelemetryIntegration for AI SDK v7+
|
|
229
|
-
*
|
|
230
|
-
* Implements the AI SDK's TelemetryIntegration interface to capture traces and
|
|
231
|
-
* events natively, replacing the Proxy-based wrapping used for v4-v6.
|
|
232
|
-
*
|
|
233
|
-
* Modeled after the upstream OpenTelemetryIntegration but uses Raindrop's
|
|
234
|
-
* TraceShipper (OTLP/HTTP) + EventShipper instead of the OTel Tracer API.
|
|
235
|
-
*/
|
|
236
|
-
|
|
237
227
|
type Listener<T> = (event: T) => PromiseLike<void> | void;
|
|
238
228
|
interface TelemetryIntegration {
|
|
239
229
|
onStart?: Listener<any>;
|
|
240
230
|
onStepStart?: Listener<any>;
|
|
231
|
+
onToolExecutionStart?: Listener<any>;
|
|
232
|
+
onToolExecutionEnd?: Listener<any>;
|
|
241
233
|
onToolCallStart?: Listener<any>;
|
|
242
234
|
onToolCallFinish?: Listener<any>;
|
|
235
|
+
onLanguageModelCallStart?: Listener<any>;
|
|
236
|
+
onLanguageModelCallEnd?: Listener<any>;
|
|
243
237
|
onChunk?: Listener<any>;
|
|
244
238
|
onStepFinish?: Listener<any>;
|
|
245
239
|
onEmbedStart?: Listener<any>;
|
|
@@ -287,8 +281,14 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
|
|
|
287
281
|
private extractInputText;
|
|
288
282
|
onStart: (event: any) => void;
|
|
289
283
|
onStepStart: (event: any) => void;
|
|
284
|
+
private toolExecutionStart;
|
|
285
|
+
private toolExecutionEnd;
|
|
286
|
+
onToolExecutionStart: (event: any) => void;
|
|
287
|
+
onToolExecutionEnd: (event: any) => void;
|
|
290
288
|
onToolCallStart: (event: any) => void;
|
|
291
289
|
onToolCallFinish: (event: any) => void;
|
|
290
|
+
onLanguageModelCallStart: (_event: any) => void;
|
|
291
|
+
onLanguageModelCallEnd: (_event: any) => void;
|
|
292
292
|
onChunk: (event: any) => void;
|
|
293
293
|
onStepFinish: (event: any) => void;
|
|
294
294
|
onEmbedStart: (event: any) => void;
|
|
@@ -309,6 +309,65 @@ type IdentifyInput = {
|
|
|
309
309
|
traits?: Record<string, unknown>;
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
+
type RaindropCallMetadata = {
|
|
313
|
+
userId?: string;
|
|
314
|
+
eventId?: string;
|
|
315
|
+
/** True when the eventId was auto-generated by `eventMetadata()` rather than user-provided. */
|
|
316
|
+
eventIdGenerated?: boolean;
|
|
317
|
+
convoId?: string;
|
|
318
|
+
eventName?: string;
|
|
319
|
+
properties?: Record<string, unknown>;
|
|
320
|
+
/**
|
|
321
|
+
* Raw `metadata` record, preserved so the integration can write the
|
|
322
|
+
* full set of `raindrop.*` keys onto root spans (the trace shipper
|
|
323
|
+
* relies on this to surface metadata in the dashboard span attributes).
|
|
324
|
+
*/
|
|
325
|
+
rawMetadata?: Record<string, unknown>;
|
|
326
|
+
};
|
|
327
|
+
declare global {
|
|
328
|
+
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
|
329
|
+
getStore(): T | undefined;
|
|
330
|
+
run<R>(store: T, callback: () => R): R;
|
|
331
|
+
enterWith?(store: T): void;
|
|
332
|
+
}) | undefined;
|
|
333
|
+
}
|
|
334
|
+
/** Test helper — allow tests to drop a stale fallback storage between runs. */
|
|
335
|
+
declare function _resetRaindropCallMetadataStorage(): void;
|
|
336
|
+
/**
|
|
337
|
+
* Returns the active per-call Raindrop metadata, or `undefined` if no
|
|
338
|
+
* call is currently in scope. Safe to call from any telemetry callback.
|
|
339
|
+
*/
|
|
340
|
+
declare function getCurrentRaindropCallMetadata(): RaindropCallMetadata | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* Runs `fn` with `metadata` bound as the active per-call Raindrop metadata.
|
|
343
|
+
* Visible to nested async work via `AsyncLocalStorage` when available.
|
|
344
|
+
*/
|
|
345
|
+
declare function runWithRaindropCallMetadata<R>(metadata: RaindropCallMetadata, fn: () => R): R;
|
|
346
|
+
/**
|
|
347
|
+
* Inspect the first argument to an AI SDK function call (the call
|
|
348
|
+
* options object) and pull out any Raindrop metadata routed via one of:
|
|
349
|
+
*
|
|
350
|
+
* 1. top-level `metadata` — convention inherited from the v4-v6 Proxy
|
|
351
|
+
* path (`extractRaindropCallOptions` in `wrap/wrapAISDK.ts`). Some
|
|
352
|
+
* callers route `eventMetadata()` here to bypass framework-specific
|
|
353
|
+
* `experimental_telemetry` typings;
|
|
354
|
+
* 2. `telemetry.metadata` — the v7 beta.111+ stable name (anticipated;
|
|
355
|
+
* the v7 dispatcher does not currently forward `metadata`, but the
|
|
356
|
+
* shape is what users will pass once it lands);
|
|
357
|
+
* 3. `experimental_telemetry.metadata` — the documented and currently
|
|
358
|
+
* working channel for v6 + every published v7 beta.
|
|
359
|
+
*
|
|
360
|
+
* Priority is `(1) > (2) > (3)` to stay consistent with the v4-v6 path's
|
|
361
|
+
* `extractRaindropCallOptions`. If you ever change this order, the
|
|
362
|
+
* self-diagnostics injection in `wrapAISDK.ts` (which mutates the v3
|
|
363
|
+
* source only) becomes a re-read hazard — see the comment by
|
|
364
|
+
* `mergedAlsMetadata` in that file.
|
|
365
|
+
*
|
|
366
|
+
* Returns `undefined` when there is no Raindrop metadata to propagate,
|
|
367
|
+
* so callers can skip the ALS push entirely.
|
|
368
|
+
*/
|
|
369
|
+
declare function readRaindropCallMetadataFromArgs(args: readonly unknown[]): RaindropCallMetadata | undefined;
|
|
370
|
+
|
|
312
371
|
declare function _resetWarnedMissingUserId(): void;
|
|
313
372
|
|
|
314
373
|
/**
|
|
@@ -688,4 +747,4 @@ type RaindropAISDKClient = {
|
|
|
688
747
|
};
|
|
689
748
|
declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
|
|
690
749
|
|
|
691
|
-
export { type AISDKChatRequestLike as A, type BuildEventPatch as B, ContextManager as C, type EndSpanArgs as E, type IdentifyInput as I, type RaindropAISDKClient as R, type SelfDiagnosticsOptions as S, type TraceSpan as T, type WrapAISDKOptions as W,
|
|
750
|
+
export { type AISDKChatRequestLike as A, type BuildEventPatch as B, ContextManager as C, readRaindropCallMetadataFromArgs as D, type EndSpanArgs as E, runWithRaindropCallMetadata as F, withCurrent as G, type IdentifyInput as I, type RaindropAISDKClient as R, type SelfDiagnosticsOptions as S, type TraceSpan as T, type WrapAISDKOptions as W, _resetRaindropCallMetadataStorage as _, type AISDKChatRequestMessageLike as a, type AISDKMessage as b, type AgentCallMetadata as c, type AgentWithMetadata as d, type Attachment as e, type ContextSpan as f, type CreateSpanArgs as g, type EventBuilder as h, type EventMetadataOptions as i, type RaindropAISDKContext as j, type RaindropAISDKOptions as k, type RaindropCallMetadata as l, RaindropTelemetryIntegration as m, type RaindropTelemetryIntegrationOptions as n, type SelfDiagnosticsSignalDefinition as o, type SelfDiagnosticsSignalDefinitions as p, type StartSpanArgs as q, type WrappedAI as r, type WrappedAISDK as s, _resetWarnedMissingUserId as t, createRaindropAISDK as u, currentSpan as v, eventMetadata as w, eventMetadataFromChatRequest as x, getContextManager as y, getCurrentRaindropCallMetadata as z };
|
package/dist/index.browser.d.mts
CHANGED
|
@@ -224,22 +224,16 @@ declare class TraceShipper extends TraceShipper$1 {
|
|
|
224
224
|
constructor(opts: ConstructorParameters<typeof TraceShipper$1>[0]);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
/**
|
|
228
|
-
* Raindrop TelemetryIntegration for AI SDK v7+
|
|
229
|
-
*
|
|
230
|
-
* Implements the AI SDK's TelemetryIntegration interface to capture traces and
|
|
231
|
-
* events natively, replacing the Proxy-based wrapping used for v4-v6.
|
|
232
|
-
*
|
|
233
|
-
* Modeled after the upstream OpenTelemetryIntegration but uses Raindrop's
|
|
234
|
-
* TraceShipper (OTLP/HTTP) + EventShipper instead of the OTel Tracer API.
|
|
235
|
-
*/
|
|
236
|
-
|
|
237
227
|
type Listener<T> = (event: T) => PromiseLike<void> | void;
|
|
238
228
|
interface TelemetryIntegration {
|
|
239
229
|
onStart?: Listener<any>;
|
|
240
230
|
onStepStart?: Listener<any>;
|
|
231
|
+
onToolExecutionStart?: Listener<any>;
|
|
232
|
+
onToolExecutionEnd?: Listener<any>;
|
|
241
233
|
onToolCallStart?: Listener<any>;
|
|
242
234
|
onToolCallFinish?: Listener<any>;
|
|
235
|
+
onLanguageModelCallStart?: Listener<any>;
|
|
236
|
+
onLanguageModelCallEnd?: Listener<any>;
|
|
243
237
|
onChunk?: Listener<any>;
|
|
244
238
|
onStepFinish?: Listener<any>;
|
|
245
239
|
onEmbedStart?: Listener<any>;
|
|
@@ -287,8 +281,14 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
|
|
|
287
281
|
private extractInputText;
|
|
288
282
|
onStart: (event: any) => void;
|
|
289
283
|
onStepStart: (event: any) => void;
|
|
284
|
+
private toolExecutionStart;
|
|
285
|
+
private toolExecutionEnd;
|
|
286
|
+
onToolExecutionStart: (event: any) => void;
|
|
287
|
+
onToolExecutionEnd: (event: any) => void;
|
|
290
288
|
onToolCallStart: (event: any) => void;
|
|
291
289
|
onToolCallFinish: (event: any) => void;
|
|
290
|
+
onLanguageModelCallStart: (_event: any) => void;
|
|
291
|
+
onLanguageModelCallEnd: (_event: any) => void;
|
|
292
292
|
onChunk: (event: any) => void;
|
|
293
293
|
onStepFinish: (event: any) => void;
|
|
294
294
|
onEmbedStart: (event: any) => void;
|
|
@@ -309,6 +309,65 @@ type IdentifyInput = {
|
|
|
309
309
|
traits?: Record<string, unknown>;
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
+
type RaindropCallMetadata = {
|
|
313
|
+
userId?: string;
|
|
314
|
+
eventId?: string;
|
|
315
|
+
/** True when the eventId was auto-generated by `eventMetadata()` rather than user-provided. */
|
|
316
|
+
eventIdGenerated?: boolean;
|
|
317
|
+
convoId?: string;
|
|
318
|
+
eventName?: string;
|
|
319
|
+
properties?: Record<string, unknown>;
|
|
320
|
+
/**
|
|
321
|
+
* Raw `metadata` record, preserved so the integration can write the
|
|
322
|
+
* full set of `raindrop.*` keys onto root spans (the trace shipper
|
|
323
|
+
* relies on this to surface metadata in the dashboard span attributes).
|
|
324
|
+
*/
|
|
325
|
+
rawMetadata?: Record<string, unknown>;
|
|
326
|
+
};
|
|
327
|
+
declare global {
|
|
328
|
+
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
|
329
|
+
getStore(): T | undefined;
|
|
330
|
+
run<R>(store: T, callback: () => R): R;
|
|
331
|
+
enterWith?(store: T): void;
|
|
332
|
+
}) | undefined;
|
|
333
|
+
}
|
|
334
|
+
/** Test helper — allow tests to drop a stale fallback storage between runs. */
|
|
335
|
+
declare function _resetRaindropCallMetadataStorage(): void;
|
|
336
|
+
/**
|
|
337
|
+
* Returns the active per-call Raindrop metadata, or `undefined` if no
|
|
338
|
+
* call is currently in scope. Safe to call from any telemetry callback.
|
|
339
|
+
*/
|
|
340
|
+
declare function getCurrentRaindropCallMetadata(): RaindropCallMetadata | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* Runs `fn` with `metadata` bound as the active per-call Raindrop metadata.
|
|
343
|
+
* Visible to nested async work via `AsyncLocalStorage` when available.
|
|
344
|
+
*/
|
|
345
|
+
declare function runWithRaindropCallMetadata<R>(metadata: RaindropCallMetadata, fn: () => R): R;
|
|
346
|
+
/**
|
|
347
|
+
* Inspect the first argument to an AI SDK function call (the call
|
|
348
|
+
* options object) and pull out any Raindrop metadata routed via one of:
|
|
349
|
+
*
|
|
350
|
+
* 1. top-level `metadata` — convention inherited from the v4-v6 Proxy
|
|
351
|
+
* path (`extractRaindropCallOptions` in `wrap/wrapAISDK.ts`). Some
|
|
352
|
+
* callers route `eventMetadata()` here to bypass framework-specific
|
|
353
|
+
* `experimental_telemetry` typings;
|
|
354
|
+
* 2. `telemetry.metadata` — the v7 beta.111+ stable name (anticipated;
|
|
355
|
+
* the v7 dispatcher does not currently forward `metadata`, but the
|
|
356
|
+
* shape is what users will pass once it lands);
|
|
357
|
+
* 3. `experimental_telemetry.metadata` — the documented and currently
|
|
358
|
+
* working channel for v6 + every published v7 beta.
|
|
359
|
+
*
|
|
360
|
+
* Priority is `(1) > (2) > (3)` to stay consistent with the v4-v6 path's
|
|
361
|
+
* `extractRaindropCallOptions`. If you ever change this order, the
|
|
362
|
+
* self-diagnostics injection in `wrapAISDK.ts` (which mutates the v3
|
|
363
|
+
* source only) becomes a re-read hazard — see the comment by
|
|
364
|
+
* `mergedAlsMetadata` in that file.
|
|
365
|
+
*
|
|
366
|
+
* Returns `undefined` when there is no Raindrop metadata to propagate,
|
|
367
|
+
* so callers can skip the ALS push entirely.
|
|
368
|
+
*/
|
|
369
|
+
declare function readRaindropCallMetadataFromArgs(args: readonly unknown[]): RaindropCallMetadata | undefined;
|
|
370
|
+
|
|
312
371
|
declare function _resetWarnedMissingUserId(): void;
|
|
313
372
|
|
|
314
373
|
/**
|
|
@@ -688,4 +747,4 @@ type RaindropAISDKClient = {
|
|
|
688
747
|
};
|
|
689
748
|
declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
|
|
690
749
|
|
|
691
|
-
export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type StartSpanArgs, type TraceSpan, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent };
|
|
750
|
+
export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type StartSpanArgs, type TraceSpan, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentRaindropCallMetadata, readRaindropCallMetadataFromArgs, runWithRaindropCallMetadata, withCurrent };
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -224,22 +224,16 @@ declare class TraceShipper extends TraceShipper$1 {
|
|
|
224
224
|
constructor(opts: ConstructorParameters<typeof TraceShipper$1>[0]);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
/**
|
|
228
|
-
* Raindrop TelemetryIntegration for AI SDK v7+
|
|
229
|
-
*
|
|
230
|
-
* Implements the AI SDK's TelemetryIntegration interface to capture traces and
|
|
231
|
-
* events natively, replacing the Proxy-based wrapping used for v4-v6.
|
|
232
|
-
*
|
|
233
|
-
* Modeled after the upstream OpenTelemetryIntegration but uses Raindrop's
|
|
234
|
-
* TraceShipper (OTLP/HTTP) + EventShipper instead of the OTel Tracer API.
|
|
235
|
-
*/
|
|
236
|
-
|
|
237
227
|
type Listener<T> = (event: T) => PromiseLike<void> | void;
|
|
238
228
|
interface TelemetryIntegration {
|
|
239
229
|
onStart?: Listener<any>;
|
|
240
230
|
onStepStart?: Listener<any>;
|
|
231
|
+
onToolExecutionStart?: Listener<any>;
|
|
232
|
+
onToolExecutionEnd?: Listener<any>;
|
|
241
233
|
onToolCallStart?: Listener<any>;
|
|
242
234
|
onToolCallFinish?: Listener<any>;
|
|
235
|
+
onLanguageModelCallStart?: Listener<any>;
|
|
236
|
+
onLanguageModelCallEnd?: Listener<any>;
|
|
243
237
|
onChunk?: Listener<any>;
|
|
244
238
|
onStepFinish?: Listener<any>;
|
|
245
239
|
onEmbedStart?: Listener<any>;
|
|
@@ -287,8 +281,14 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
|
|
|
287
281
|
private extractInputText;
|
|
288
282
|
onStart: (event: any) => void;
|
|
289
283
|
onStepStart: (event: any) => void;
|
|
284
|
+
private toolExecutionStart;
|
|
285
|
+
private toolExecutionEnd;
|
|
286
|
+
onToolExecutionStart: (event: any) => void;
|
|
287
|
+
onToolExecutionEnd: (event: any) => void;
|
|
290
288
|
onToolCallStart: (event: any) => void;
|
|
291
289
|
onToolCallFinish: (event: any) => void;
|
|
290
|
+
onLanguageModelCallStart: (_event: any) => void;
|
|
291
|
+
onLanguageModelCallEnd: (_event: any) => void;
|
|
292
292
|
onChunk: (event: any) => void;
|
|
293
293
|
onStepFinish: (event: any) => void;
|
|
294
294
|
onEmbedStart: (event: any) => void;
|
|
@@ -309,6 +309,65 @@ type IdentifyInput = {
|
|
|
309
309
|
traits?: Record<string, unknown>;
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
+
type RaindropCallMetadata = {
|
|
313
|
+
userId?: string;
|
|
314
|
+
eventId?: string;
|
|
315
|
+
/** True when the eventId was auto-generated by `eventMetadata()` rather than user-provided. */
|
|
316
|
+
eventIdGenerated?: boolean;
|
|
317
|
+
convoId?: string;
|
|
318
|
+
eventName?: string;
|
|
319
|
+
properties?: Record<string, unknown>;
|
|
320
|
+
/**
|
|
321
|
+
* Raw `metadata` record, preserved so the integration can write the
|
|
322
|
+
* full set of `raindrop.*` keys onto root spans (the trace shipper
|
|
323
|
+
* relies on this to surface metadata in the dashboard span attributes).
|
|
324
|
+
*/
|
|
325
|
+
rawMetadata?: Record<string, unknown>;
|
|
326
|
+
};
|
|
327
|
+
declare global {
|
|
328
|
+
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
|
329
|
+
getStore(): T | undefined;
|
|
330
|
+
run<R>(store: T, callback: () => R): R;
|
|
331
|
+
enterWith?(store: T): void;
|
|
332
|
+
}) | undefined;
|
|
333
|
+
}
|
|
334
|
+
/** Test helper — allow tests to drop a stale fallback storage between runs. */
|
|
335
|
+
declare function _resetRaindropCallMetadataStorage(): void;
|
|
336
|
+
/**
|
|
337
|
+
* Returns the active per-call Raindrop metadata, or `undefined` if no
|
|
338
|
+
* call is currently in scope. Safe to call from any telemetry callback.
|
|
339
|
+
*/
|
|
340
|
+
declare function getCurrentRaindropCallMetadata(): RaindropCallMetadata | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* Runs `fn` with `metadata` bound as the active per-call Raindrop metadata.
|
|
343
|
+
* Visible to nested async work via `AsyncLocalStorage` when available.
|
|
344
|
+
*/
|
|
345
|
+
declare function runWithRaindropCallMetadata<R>(metadata: RaindropCallMetadata, fn: () => R): R;
|
|
346
|
+
/**
|
|
347
|
+
* Inspect the first argument to an AI SDK function call (the call
|
|
348
|
+
* options object) and pull out any Raindrop metadata routed via one of:
|
|
349
|
+
*
|
|
350
|
+
* 1. top-level `metadata` — convention inherited from the v4-v6 Proxy
|
|
351
|
+
* path (`extractRaindropCallOptions` in `wrap/wrapAISDK.ts`). Some
|
|
352
|
+
* callers route `eventMetadata()` here to bypass framework-specific
|
|
353
|
+
* `experimental_telemetry` typings;
|
|
354
|
+
* 2. `telemetry.metadata` — the v7 beta.111+ stable name (anticipated;
|
|
355
|
+
* the v7 dispatcher does not currently forward `metadata`, but the
|
|
356
|
+
* shape is what users will pass once it lands);
|
|
357
|
+
* 3. `experimental_telemetry.metadata` — the documented and currently
|
|
358
|
+
* working channel for v6 + every published v7 beta.
|
|
359
|
+
*
|
|
360
|
+
* Priority is `(1) > (2) > (3)` to stay consistent with the v4-v6 path's
|
|
361
|
+
* `extractRaindropCallOptions`. If you ever change this order, the
|
|
362
|
+
* self-diagnostics injection in `wrapAISDK.ts` (which mutates the v3
|
|
363
|
+
* source only) becomes a re-read hazard — see the comment by
|
|
364
|
+
* `mergedAlsMetadata` in that file.
|
|
365
|
+
*
|
|
366
|
+
* Returns `undefined` when there is no Raindrop metadata to propagate,
|
|
367
|
+
* so callers can skip the ALS push entirely.
|
|
368
|
+
*/
|
|
369
|
+
declare function readRaindropCallMetadataFromArgs(args: readonly unknown[]): RaindropCallMetadata | undefined;
|
|
370
|
+
|
|
312
371
|
declare function _resetWarnedMissingUserId(): void;
|
|
313
372
|
|
|
314
373
|
/**
|
|
@@ -688,4 +747,4 @@ type RaindropAISDKClient = {
|
|
|
688
747
|
};
|
|
689
748
|
declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
|
|
690
749
|
|
|
691
|
-
export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type StartSpanArgs, type TraceSpan, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent };
|
|
750
|
+
export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type StartSpanArgs, type TraceSpan, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentRaindropCallMetadata, readRaindropCallMetadataFromArgs, runWithRaindropCallMetadata, withCurrent };
|