@raindrop-ai/ai-sdk 0.0.31 → 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.
@@ -462,6 +462,7 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
462
462
  onLanguageModelCallStart: (_event: any) => void;
463
463
  onLanguageModelCallEnd: (_event: any) => void;
464
464
  onChunk: (event: any) => void;
465
+ private emitProviderExecutedToolSpans;
465
466
  onStepFinish: (event: any) => void;
466
467
  onEmbedStart: (event: any) => void;
467
468
  onEmbedFinish: (event: any) => void;
@@ -893,6 +894,38 @@ type SelfDiagnosticsOptions = {
893
894
  */
894
895
  toolName?: string;
895
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
+ };
896
929
  type WrapAISDKOptions = {
897
930
  context: RaindropAISDKContext | ((info: {
898
931
  operation: string;
@@ -977,6 +1010,14 @@ type EventPatch = {
977
1010
  };
978
1011
  type RaindropAISDKClient = {
979
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;
980
1021
  /**
981
1022
  * Create a TelemetryIntegration instance for direct registration with AI SDK v7+.
982
1023
  * Use with `registerTelemetryIntegration()` from the `ai` package.
@@ -1062,4 +1103,4 @@ type RaindropAISDKClient = {
1062
1103
  };
1063
1104
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
1064
1105
 
1065
- 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 };
@@ -462,6 +462,7 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
462
462
  onLanguageModelCallStart: (_event: any) => void;
463
463
  onLanguageModelCallEnd: (_event: any) => void;
464
464
  onChunk: (event: any) => void;
465
+ private emitProviderExecutedToolSpans;
465
466
  onStepFinish: (event: any) => void;
466
467
  onEmbedStart: (event: any) => void;
467
468
  onEmbedFinish: (event: any) => void;
@@ -893,6 +894,38 @@ type SelfDiagnosticsOptions = {
893
894
  */
894
895
  toolName?: string;
895
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
+ };
896
929
  type WrapAISDKOptions = {
897
930
  context: RaindropAISDKContext | ((info: {
898
931
  operation: string;
@@ -977,6 +1010,14 @@ type EventPatch = {
977
1010
  };
978
1011
  type RaindropAISDKClient = {
979
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;
980
1021
  /**
981
1022
  * Create a TelemetryIntegration instance for direct registration with AI SDK v7+.
982
1023
  * Use with `registerTelemetryIntegration()` from the `ai` package.
@@ -1062,4 +1103,4 @@ type RaindropAISDKClient = {
1062
1103
  };
1063
1104
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
1064
1105
 
1065
- 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 };
@@ -462,6 +462,7 @@ declare class RaindropTelemetryIntegration implements TelemetryIntegration {
462
462
  onLanguageModelCallStart: (_event: any) => void;
463
463
  onLanguageModelCallEnd: (_event: any) => void;
464
464
  onChunk: (event: any) => void;
465
+ private emitProviderExecutedToolSpans;
465
466
  onStepFinish: (event: any) => void;
466
467
  onEmbedStart: (event: any) => void;
467
468
  onEmbedFinish: (event: any) => void;
@@ -893,6 +894,38 @@ type SelfDiagnosticsOptions = {
893
894
  */
894
895
  toolName?: string;
895
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
+ };
896
929
  type WrapAISDKOptions = {
897
930
  context: RaindropAISDKContext | ((info: {
898
931
  operation: string;
@@ -977,6 +1010,14 @@ type EventPatch = {
977
1010
  };
978
1011
  type RaindropAISDKClient = {
979
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;
980
1021
  /**
981
1022
  * Create a TelemetryIntegration instance for direct registration with AI SDK v7+.
982
1023
  * Use with `registerTelemetryIntegration()` from the `ai` package.
@@ -1062,4 +1103,4 @@ type RaindropAISDKClient = {
1062
1103
  };
1063
1104
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
1064
1105
 
1065
- 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 };