@raindrop-ai/ai-sdk 0.0.30 → 0.0.32

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.
@@ -378,7 +378,9 @@ interface TelemetryIntegration {
378
378
  onStepFinish?: Listener<any>;
379
379
  onEmbedStart?: Listener<any>;
380
380
  onEmbedFinish?: Listener<any>;
381
+ onEmbedEnd?: Listener<any>;
381
382
  onFinish?: Listener<any>;
383
+ onEnd?: Listener<any>;
382
384
  onError?: Listener<any>;
383
385
  executeTool?: <T>(params: {
384
386
  callId: string;
@@ -460,10 +462,13 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
460
462
  onLanguageModelCallStart: (_event: any) => void;
461
463
  onLanguageModelCallEnd: (_event: any) => void;
462
464
  onChunk: (event: any) => void;
465
+ private emitProviderExecutedToolSpans;
463
466
  onStepFinish: (event: any) => void;
464
467
  onEmbedStart: (event: any) => void;
465
468
  onEmbedFinish: (event: any) => void;
469
+ onEmbedEnd: (event: any) => void;
466
470
  onFinish: (event: any) => void;
471
+ onEnd: (event: any) => void;
467
472
  private finishGenerate;
468
473
  private finishEmbed;
469
474
  onError: (error: unknown) => void;
@@ -889,6 +894,38 @@ type SelfDiagnosticsOptions = {
889
894
  */
890
895
  toolName?: string;
891
896
  };
897
+ type SelfDiagnosticsToolOptions = Omit<SelfDiagnosticsOptions, "enabled"> & {
898
+ /** Fixed Raindrop event ID to attach diagnostic signals to. */
899
+ eventId?: string;
900
+ /** Dynamic event ID resolver, useful when one tool instance serves many runs. */
901
+ getEventId?: () => string | undefined;
902
+ /** Behavior when no event ID can be resolved. Default: "warn" */
903
+ onMissingEventId?: "warn" | "ignore" | "throw";
904
+ };
905
+ type SelfDiagnosticsToolInput = {
906
+ category: string;
907
+ detail: string;
908
+ };
909
+ type SelfDiagnosticsToolResult = {
910
+ acknowledged: true;
911
+ category: string;
912
+ } | {
913
+ acknowledged: false;
914
+ category: string;
915
+ reason: "missing_event_id";
916
+ };
917
+ type SelfDiagnosticsTool = {
918
+ name: string;
919
+ description: string;
920
+ /**
921
+ * AI SDK v4 tool schema. This is the same cross-version schema object as
922
+ * `inputSchema`; both fields are exposed so the tool works on AI SDK v4-v7.
923
+ */
924
+ parameters: any;
925
+ /** AI SDK v5+ tool schema. */
926
+ inputSchema: any;
927
+ execute(input: SelfDiagnosticsToolInput): Promise<SelfDiagnosticsToolResult>;
928
+ };
892
929
  type WrapAISDKOptions = {
893
930
  context: RaindropAISDKContext | ((info: {
894
931
  operation: string;
@@ -973,6 +1010,14 @@ type EventPatch = {
973
1010
  };
974
1011
  type RaindropAISDKClient = {
975
1012
  wrap<T extends object>(aiSDK: T, options?: WrapAISDKOptions): WrappedAISDK<T>;
1013
+ /**
1014
+ * Create a standalone AI SDK self-diagnostics tool.
1015
+ *
1016
+ * The tool automatically uses the active Raindrop event while executing
1017
+ * under `createTelemetryIntegration()` with tracing enabled. Pass `eventId`
1018
+ * or `getEventId` when no active trace context is available.
1019
+ */
1020
+ createSelfDiagnosticsTool(options?: SelfDiagnosticsToolOptions): SelfDiagnosticsTool;
976
1021
  /**
977
1022
  * Create a TelemetryIntegration instance for direct registration with AI SDK v7+.
978
1023
  * Use with `registerTelemetryIntegration()` from the `ai` package.
@@ -1058,4 +1103,4 @@ type RaindropAISDKClient = {
1058
1103
  };
1059
1104
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
1060
1105
 
1061
- export { withCurrent as $, type AISDKChatRequestLike as A, type BuildEventPatch as B, ContextManager as C, DEFAULT_REDACT_ATTRIBUTE_KEYS as D, type EndSpanArgs as E, createRaindropAISDK as F, currentSpan as G, defaultTransformSpan as H, type IdentifyInput as I, enterParentToolContext as J, eventMetadata as K, eventMetadataFromChatRequest as L, getContextManager as M, getCurrentParentToolContext as N, type OtlpAnyValue as O, type ParentToolContext as P, getCurrentRaindropCallMetadata as Q, REDACTED_PLACEHOLDER as R, type SelfDiagnosticsOptions as S, type TraceSpan as T, readRaindropCallMetadataFromArgs as U, redactJsonAttributeValue as V, type WrapAISDKOptions as W, redactSecretsInObject as X, runWithParentToolContext as Y, runWithRaindropCallMetadata as Z, _resetParentToolContextStorage 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, DEFAULT_SECRET_KEY_NAMES as h, type EventBuilder as i, type EventMetadataOptions as j, type OtlpSpan as k, type RaindropAISDKClient as l, type RaindropAISDKContext as m, type RaindropAISDKOptions as n, type RaindropCallMetadata as o, RaindropTelemetryIntegration as p, type RaindropTelemetryIntegrationOptions as q, type SelfDiagnosticsSignalDefinition as r, type SelfDiagnosticsSignalDefinitions as s, type StartSpanArgs as t, type TransformSpanHook as u, type WrappedAI as v, type WrappedAISDK as w, _resetRaindropCallMetadataStorage as x, _resetWarnedMissingUserId as y, clearParentToolContext as z };
1106
+ export { redactJsonAttributeValue as $, type AISDKChatRequestLike as A, type BuildEventPatch as B, ContextManager as C, DEFAULT_REDACT_ATTRIBUTE_KEYS as D, type EndSpanArgs as E, type WrappedAISDK as F, _resetRaindropCallMetadataStorage as G, _resetWarnedMissingUserId as H, type IdentifyInput as I, clearParentToolContext as J, createRaindropAISDK as K, currentSpan as L, defaultTransformSpan as M, enterParentToolContext as N, type OtlpAnyValue as O, type ParentToolContext as P, eventMetadata as Q, REDACTED_PLACEHOLDER as R, type SelfDiagnosticsOptions as S, type TraceSpan as T, eventMetadataFromChatRequest as U, getContextManager as V, type WrapAISDKOptions as W, getCurrentParentToolContext as X, getCurrentRaindropCallMetadata as Y, readRaindropCallMetadataFromArgs as Z, _resetParentToolContextStorage as _, type AISDKChatRequestMessageLike as a, redactSecretsInObject as a0, runWithParentToolContext as a1, runWithRaindropCallMetadata as a2, withCurrent as a3, type AISDKMessage as b, type AgentCallMetadata as c, type AgentWithMetadata as d, type Attachment as e, type ContextSpan as f, type CreateSpanArgs as g, DEFAULT_SECRET_KEY_NAMES as h, type EventBuilder as i, type EventMetadataOptions as j, type OtlpSpan as k, type RaindropAISDKClient as l, type RaindropAISDKContext as m, type RaindropAISDKOptions as n, type RaindropCallMetadata as o, RaindropTelemetryIntegration as p, type RaindropTelemetryIntegrationOptions as q, type SelfDiagnosticsSignalDefinition as r, type SelfDiagnosticsSignalDefinitions as s, type SelfDiagnosticsTool as t, type SelfDiagnosticsToolInput as u, type SelfDiagnosticsToolOptions as v, type SelfDiagnosticsToolResult as w, type StartSpanArgs as x, type TransformSpanHook as y, type WrappedAI as z };
@@ -378,7 +378,9 @@ interface TelemetryIntegration {
378
378
  onStepFinish?: Listener<any>;
379
379
  onEmbedStart?: Listener<any>;
380
380
  onEmbedFinish?: Listener<any>;
381
+ onEmbedEnd?: Listener<any>;
381
382
  onFinish?: Listener<any>;
383
+ onEnd?: Listener<any>;
382
384
  onError?: Listener<any>;
383
385
  executeTool?: <T>(params: {
384
386
  callId: string;
@@ -460,10 +462,13 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
460
462
  onLanguageModelCallStart: (_event: any) => void;
461
463
  onLanguageModelCallEnd: (_event: any) => void;
462
464
  onChunk: (event: any) => void;
465
+ private emitProviderExecutedToolSpans;
463
466
  onStepFinish: (event: any) => void;
464
467
  onEmbedStart: (event: any) => void;
465
468
  onEmbedFinish: (event: any) => void;
469
+ onEmbedEnd: (event: any) => void;
466
470
  onFinish: (event: any) => void;
471
+ onEnd: (event: any) => void;
467
472
  private finishGenerate;
468
473
  private finishEmbed;
469
474
  onError: (error: unknown) => void;
@@ -889,6 +894,38 @@ type SelfDiagnosticsOptions = {
889
894
  */
890
895
  toolName?: string;
891
896
  };
897
+ type SelfDiagnosticsToolOptions = Omit<SelfDiagnosticsOptions, "enabled"> & {
898
+ /** Fixed Raindrop event ID to attach diagnostic signals to. */
899
+ eventId?: string;
900
+ /** Dynamic event ID resolver, useful when one tool instance serves many runs. */
901
+ getEventId?: () => string | undefined;
902
+ /** Behavior when no event ID can be resolved. Default: "warn" */
903
+ onMissingEventId?: "warn" | "ignore" | "throw";
904
+ };
905
+ type SelfDiagnosticsToolInput = {
906
+ category: string;
907
+ detail: string;
908
+ };
909
+ type SelfDiagnosticsToolResult = {
910
+ acknowledged: true;
911
+ category: string;
912
+ } | {
913
+ acknowledged: false;
914
+ category: string;
915
+ reason: "missing_event_id";
916
+ };
917
+ type SelfDiagnosticsTool = {
918
+ name: string;
919
+ description: string;
920
+ /**
921
+ * AI SDK v4 tool schema. This is the same cross-version schema object as
922
+ * `inputSchema`; both fields are exposed so the tool works on AI SDK v4-v7.
923
+ */
924
+ parameters: any;
925
+ /** AI SDK v5+ tool schema. */
926
+ inputSchema: any;
927
+ execute(input: SelfDiagnosticsToolInput): Promise<SelfDiagnosticsToolResult>;
928
+ };
892
929
  type WrapAISDKOptions = {
893
930
  context: RaindropAISDKContext | ((info: {
894
931
  operation: string;
@@ -973,6 +1010,14 @@ type EventPatch = {
973
1010
  };
974
1011
  type RaindropAISDKClient = {
975
1012
  wrap<T extends object>(aiSDK: T, options?: WrapAISDKOptions): WrappedAISDK<T>;
1013
+ /**
1014
+ * Create a standalone AI SDK self-diagnostics tool.
1015
+ *
1016
+ * The tool automatically uses the active Raindrop event while executing
1017
+ * under `createTelemetryIntegration()` with tracing enabled. Pass `eventId`
1018
+ * or `getEventId` when no active trace context is available.
1019
+ */
1020
+ createSelfDiagnosticsTool(options?: SelfDiagnosticsToolOptions): SelfDiagnosticsTool;
976
1021
  /**
977
1022
  * Create a TelemetryIntegration instance for direct registration with AI SDK v7+.
978
1023
  * Use with `registerTelemetryIntegration()` from the `ai` package.
@@ -1058,4 +1103,4 @@ type RaindropAISDKClient = {
1058
1103
  };
1059
1104
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
1060
1105
 
1061
- export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, type ParentToolContext, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type StartSpanArgs, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent };
1106
+ export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, type ParentToolContext, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInput, type SelfDiagnosticsToolOptions, type SelfDiagnosticsToolResult, type StartSpanArgs, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent };
@@ -378,7 +378,9 @@ interface TelemetryIntegration {
378
378
  onStepFinish?: Listener<any>;
379
379
  onEmbedStart?: Listener<any>;
380
380
  onEmbedFinish?: Listener<any>;
381
+ onEmbedEnd?: Listener<any>;
381
382
  onFinish?: Listener<any>;
383
+ onEnd?: Listener<any>;
382
384
  onError?: Listener<any>;
383
385
  executeTool?: <T>(params: {
384
386
  callId: string;
@@ -460,10 +462,13 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
460
462
  onLanguageModelCallStart: (_event: any) => void;
461
463
  onLanguageModelCallEnd: (_event: any) => void;
462
464
  onChunk: (event: any) => void;
465
+ private emitProviderExecutedToolSpans;
463
466
  onStepFinish: (event: any) => void;
464
467
  onEmbedStart: (event: any) => void;
465
468
  onEmbedFinish: (event: any) => void;
469
+ onEmbedEnd: (event: any) => void;
466
470
  onFinish: (event: any) => void;
471
+ onEnd: (event: any) => void;
467
472
  private finishGenerate;
468
473
  private finishEmbed;
469
474
  onError: (error: unknown) => void;
@@ -889,6 +894,38 @@ type SelfDiagnosticsOptions = {
889
894
  */
890
895
  toolName?: string;
891
896
  };
897
+ type SelfDiagnosticsToolOptions = Omit<SelfDiagnosticsOptions, "enabled"> & {
898
+ /** Fixed Raindrop event ID to attach diagnostic signals to. */
899
+ eventId?: string;
900
+ /** Dynamic event ID resolver, useful when one tool instance serves many runs. */
901
+ getEventId?: () => string | undefined;
902
+ /** Behavior when no event ID can be resolved. Default: "warn" */
903
+ onMissingEventId?: "warn" | "ignore" | "throw";
904
+ };
905
+ type SelfDiagnosticsToolInput = {
906
+ category: string;
907
+ detail: string;
908
+ };
909
+ type SelfDiagnosticsToolResult = {
910
+ acknowledged: true;
911
+ category: string;
912
+ } | {
913
+ acknowledged: false;
914
+ category: string;
915
+ reason: "missing_event_id";
916
+ };
917
+ type SelfDiagnosticsTool = {
918
+ name: string;
919
+ description: string;
920
+ /**
921
+ * AI SDK v4 tool schema. This is the same cross-version schema object as
922
+ * `inputSchema`; both fields are exposed so the tool works on AI SDK v4-v7.
923
+ */
924
+ parameters: any;
925
+ /** AI SDK v5+ tool schema. */
926
+ inputSchema: any;
927
+ execute(input: SelfDiagnosticsToolInput): Promise<SelfDiagnosticsToolResult>;
928
+ };
892
929
  type WrapAISDKOptions = {
893
930
  context: RaindropAISDKContext | ((info: {
894
931
  operation: string;
@@ -973,6 +1010,14 @@ type EventPatch = {
973
1010
  };
974
1011
  type RaindropAISDKClient = {
975
1012
  wrap<T extends object>(aiSDK: T, options?: WrapAISDKOptions): WrappedAISDK<T>;
1013
+ /**
1014
+ * Create a standalone AI SDK self-diagnostics tool.
1015
+ *
1016
+ * The tool automatically uses the active Raindrop event while executing
1017
+ * under `createTelemetryIntegration()` with tracing enabled. Pass `eventId`
1018
+ * or `getEventId` when no active trace context is available.
1019
+ */
1020
+ createSelfDiagnosticsTool(options?: SelfDiagnosticsToolOptions): SelfDiagnosticsTool;
976
1021
  /**
977
1022
  * Create a TelemetryIntegration instance for direct registration with AI SDK v7+.
978
1023
  * Use with `registerTelemetryIntegration()` from the `ai` package.
@@ -1058,4 +1103,4 @@ type RaindropAISDKClient = {
1058
1103
  };
1059
1104
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
1060
1105
 
1061
- export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, type ParentToolContext, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type StartSpanArgs, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent };
1106
+ export { type AISDKChatRequestLike, type AISDKChatRequestMessageLike, type AISDKMessage, type AgentCallMetadata, type AgentWithMetadata, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type CreateSpanArgs, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, type EndSpanArgs, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type OtlpAnyValue, type OtlpSpan, type ParentToolContext, REDACTED_PLACEHOLDER, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type RaindropCallMetadata, RaindropTelemetryIntegration, type RaindropTelemetryIntegrationOptions, type SelfDiagnosticsOptions, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInput, type SelfDiagnosticsToolOptions, type SelfDiagnosticsToolResult, type StartSpanArgs, type TraceSpan, type TransformSpanHook, type WrapAISDKOptions, type WrappedAI, type WrappedAISDK, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent };