@raindrop-ai/ai-sdk 0.0.5 → 0.0.6

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 CHANGED
@@ -16,14 +16,15 @@ yarn add @raindrop-ai/ai-sdk
16
16
 
17
17
  ```ts
18
18
  import * as ai from "ai";
19
- import { createRaindropAISDK } from "@raindrop-ai/ai-sdk";
19
+ import { createRaindropAISDK, eventMetadata } from "@raindrop-ai/ai-sdk";
20
20
 
21
21
  const raindrop = createRaindropAISDK({
22
22
  writeKey: process.env.RAINDROP_WRITE_KEY!,
23
23
  });
24
24
 
25
25
  const { generateText } = raindrop.wrap(ai, {
26
- context: { userId: "user_123", convoId: "convo_456", eventName: "chat_message" },
26
+ // userId is optional here (but recommended). If omitted here, you can still provide it per-call via eventMetadata(). Otherwise events will be skipped.
27
+ context: { convoId: "convo_456", eventName: "chat_message" },
27
28
  // optional: full control over event input/output, metadata, and attachments
28
29
  buildEvent: (messages) => {
29
30
  const lastUser = [...messages].reverse().find((m) => m.role === "user");
@@ -38,6 +39,10 @@ const { generateText } = raindrop.wrap(ai, {
38
39
  const result = await generateText({
39
40
  model: /* your AI SDK model */,
40
41
  prompt: "Hello!",
42
+ experimental_telemetry: {
43
+ isEnabled: true,
44
+ metadata: eventMetadata({ userId: "user_123" }),
45
+ },
41
46
  });
42
47
 
43
48
  // Identify a user (optional)
@@ -49,6 +54,8 @@ await raindrop.users.identify({
49
54
  await raindrop.flush();
50
55
  ```
51
56
 
57
+ If `userId` is missing from both `wrap()` context and `eventMetadata()`, the SDK logs a warning (once) and skips sending events.
58
+
52
59
  ## Runtime support
53
60
 
54
61
  ### Node.js (recommended)
@@ -84,7 +84,7 @@ async function postJson(url, body, headers, opts) {
84
84
  // package.json
85
85
  var package_default = {
86
86
  name: "@raindrop-ai/ai-sdk",
87
- version: "0.0.5"};
87
+ version: "0.0.6"};
88
88
 
89
89
  // src/internal/version.ts
90
90
  var libraryName = package_default.name;
@@ -1239,6 +1239,17 @@ function attrsFromGenAiRequest(options) {
1239
1239
  }
1240
1240
 
1241
1241
  // src/internal/wrap/wrapAISDK.ts
1242
+ var warnedMissingUserId = false;
1243
+ function warnMissingUserIdOnce() {
1244
+ if (warnedMissingUserId) return;
1245
+ warnedMissingUserId = true;
1246
+ console.warn(
1247
+ "[raindrop-ai/ai-sdk] userId was not provided in wrap() context or via eventMetadata(). Events will be skipped unless a userId is provided."
1248
+ );
1249
+ }
1250
+ function _resetWarnedMissingUserId() {
1251
+ warnedMissingUserId = false;
1252
+ }
1242
1253
  function extractRaindropMetadata(metadata) {
1243
1254
  if (!metadata || typeof metadata !== "object") return {};
1244
1255
  const result = {};
@@ -1409,6 +1420,7 @@ function setupOperation(params) {
1409
1420
  const telemetry = extractExperimentalTelemetry(arg);
1410
1421
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1411
1422
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1423
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1412
1424
  const eventId = (_c = (_b = (_a = callTimeCtx.eventId) != null ? _a : mergedCtx.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1413
1425
  const ctx = { ...mergedCtx, eventId };
1414
1426
  const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
@@ -1762,6 +1774,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
1762
1774
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1763
1775
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1764
1776
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1777
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1765
1778
  const inherited = await getCurrentParentSpanContext();
1766
1779
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1767
1780
  const ctx = { ...mergedCtx};
@@ -1949,6 +1962,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
1949
1962
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1950
1963
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1951
1964
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1965
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1952
1966
  const inherited = await getCurrentParentSpanContext();
1953
1967
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1954
1968
  const ctx = { ...mergedCtx};
@@ -2676,4 +2690,4 @@ function createRaindropAISDK(opts) {
2676
2690
  };
2677
2691
  }
2678
2692
 
2679
- export { createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent };
2693
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent };
package/dist/index.d.mts CHANGED
@@ -79,6 +79,8 @@ declare function currentSpan(): ContextSpan;
79
79
  */
80
80
  declare function withCurrent<R>(span: ContextSpan, callback: () => R): R;
81
81
 
82
+ declare function _resetWarnedMissingUserId(): void;
83
+
82
84
  /**
83
85
  * Options for creating event metadata for call-time context override.
84
86
  */
@@ -154,7 +156,7 @@ type RaindropAISDKOptions = {
154
156
  };
155
157
  };
156
158
  type RaindropAISDKContext = {
157
- userId: string;
159
+ userId?: string;
158
160
  eventId?: string;
159
161
  eventName?: string;
160
162
  convoId?: string;
@@ -247,4 +249,4 @@ type RaindropAISDKClient = {
247
249
  };
248
250
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
249
251
 
250
- export { type AISDKMessage, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type WrapAISDKOptions, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent };
252
+ export { type AISDKMessage, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type WrapAISDKOptions, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent };
package/dist/index.d.ts CHANGED
@@ -79,6 +79,8 @@ declare function currentSpan(): ContextSpan;
79
79
  */
80
80
  declare function withCurrent<R>(span: ContextSpan, callback: () => R): R;
81
81
 
82
+ declare function _resetWarnedMissingUserId(): void;
83
+
82
84
  /**
83
85
  * Options for creating event metadata for call-time context override.
84
86
  */
@@ -154,7 +156,7 @@ type RaindropAISDKOptions = {
154
156
  };
155
157
  };
156
158
  type RaindropAISDKContext = {
157
- userId: string;
159
+ userId?: string;
158
160
  eventId?: string;
159
161
  eventName?: string;
160
162
  convoId?: string;
@@ -247,4 +249,4 @@ type RaindropAISDKClient = {
247
249
  };
248
250
  declare function createRaindropAISDK(opts: RaindropAISDKOptions): RaindropAISDKClient;
249
251
 
250
- export { type AISDKMessage, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type WrapAISDKOptions, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent };
252
+ export { type AISDKMessage, type Attachment, type BuildEventPatch, ContextManager, type ContextSpan, type EventBuilder, type EventMetadataOptions, type IdentifyInput, type RaindropAISDKClient, type RaindropAISDKContext, type RaindropAISDKOptions, type WrapAISDKOptions, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent };
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ async function postJson(url, body, headers, opts) {
86
86
  // package.json
87
87
  var package_default = {
88
88
  name: "@raindrop-ai/ai-sdk",
89
- version: "0.0.5"};
89
+ version: "0.0.6"};
90
90
 
91
91
  // src/internal/version.ts
92
92
  var libraryName = package_default.name;
@@ -1241,6 +1241,17 @@ function attrsFromGenAiRequest(options) {
1241
1241
  }
1242
1242
 
1243
1243
  // src/internal/wrap/wrapAISDK.ts
1244
+ var warnedMissingUserId = false;
1245
+ function warnMissingUserIdOnce() {
1246
+ if (warnedMissingUserId) return;
1247
+ warnedMissingUserId = true;
1248
+ console.warn(
1249
+ "[raindrop-ai/ai-sdk] userId was not provided in wrap() context or via eventMetadata(). Events will be skipped unless a userId is provided."
1250
+ );
1251
+ }
1252
+ function _resetWarnedMissingUserId() {
1253
+ warnedMissingUserId = false;
1254
+ }
1244
1255
  function extractRaindropMetadata(metadata) {
1245
1256
  if (!metadata || typeof metadata !== "object") return {};
1246
1257
  const result = {};
@@ -1411,6 +1422,7 @@ function setupOperation(params) {
1411
1422
  const telemetry = extractExperimentalTelemetry(arg);
1412
1423
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1413
1424
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1425
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1414
1426
  const eventId = (_c = (_b = (_a = callTimeCtx.eventId) != null ? _a : mergedCtx.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1415
1427
  const ctx = { ...mergedCtx, eventId };
1416
1428
  const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
@@ -1764,6 +1776,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
1764
1776
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1765
1777
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1766
1778
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1779
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1767
1780
  const inherited = await getCurrentParentSpanContext();
1768
1781
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1769
1782
  const ctx = { ...mergedCtx};
@@ -1951,6 +1964,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
1951
1964
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1952
1965
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1953
1966
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1967
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1954
1968
  const inherited = await getCurrentParentSpanContext();
1955
1969
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1956
1970
  const ctx = { ...mergedCtx};
@@ -2678,6 +2692,7 @@ function createRaindropAISDK(opts) {
2678
2692
  };
2679
2693
  }
2680
2694
 
2695
+ exports._resetWarnedMissingUserId = _resetWarnedMissingUserId;
2681
2696
  exports.createRaindropAISDK = createRaindropAISDK;
2682
2697
  exports.currentSpan = currentSpan;
2683
2698
  exports.eventMetadata = eventMetadata;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-5DKYVVJZ.mjs';
1
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-5S6OYWE3.mjs';
@@ -1,4 +1,4 @@
1
- export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.mjs';
1
+ export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.mjs';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
@@ -1,4 +1,4 @@
1
- export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.js';
1
+ export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.js';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
@@ -90,7 +90,7 @@ async function postJson(url, body, headers, opts) {
90
90
  // package.json
91
91
  var package_default = {
92
92
  name: "@raindrop-ai/ai-sdk",
93
- version: "0.0.5"};
93
+ version: "0.0.6"};
94
94
 
95
95
  // src/internal/version.ts
96
96
  var libraryName = package_default.name;
@@ -1245,6 +1245,17 @@ function attrsFromGenAiRequest(options) {
1245
1245
  }
1246
1246
 
1247
1247
  // src/internal/wrap/wrapAISDK.ts
1248
+ var warnedMissingUserId = false;
1249
+ function warnMissingUserIdOnce() {
1250
+ if (warnedMissingUserId) return;
1251
+ warnedMissingUserId = true;
1252
+ console.warn(
1253
+ "[raindrop-ai/ai-sdk] userId was not provided in wrap() context or via eventMetadata(). Events will be skipped unless a userId is provided."
1254
+ );
1255
+ }
1256
+ function _resetWarnedMissingUserId() {
1257
+ warnedMissingUserId = false;
1258
+ }
1248
1259
  function extractRaindropMetadata(metadata) {
1249
1260
  if (!metadata || typeof metadata !== "object") return {};
1250
1261
  const result = {};
@@ -1415,6 +1426,7 @@ function setupOperation(params) {
1415
1426
  const telemetry = extractExperimentalTelemetry(arg);
1416
1427
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1417
1428
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1429
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1418
1430
  const eventId = (_c = (_b = (_a = callTimeCtx.eventId) != null ? _a : mergedCtx.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1419
1431
  const ctx = { ...mergedCtx, eventId };
1420
1432
  const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
@@ -1768,6 +1780,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
1768
1780
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1769
1781
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1770
1782
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1783
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1771
1784
  const inherited = await getCurrentParentSpanContext();
1772
1785
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1773
1786
  const ctx = { ...mergedCtx};
@@ -1955,6 +1968,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
1955
1968
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1956
1969
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1957
1970
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1971
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1958
1972
  const inherited = await getCurrentParentSpanContext();
1959
1973
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1960
1974
  const ctx = { ...mergedCtx};
@@ -2685,6 +2699,7 @@ function createRaindropAISDK(opts) {
2685
2699
  // src/index.node.ts
2686
2700
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
2687
2701
 
2702
+ exports._resetWarnedMissingUserId = _resetWarnedMissingUserId;
2688
2703
  exports.createRaindropAISDK = createRaindropAISDK;
2689
2704
  exports.currentSpan = currentSpan;
2690
2705
  exports.eventMetadata = eventMetadata;
@@ -1,4 +1,4 @@
1
- export { createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-5DKYVVJZ.mjs';
1
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-5S6OYWE3.mjs';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
 
4
4
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
@@ -1,4 +1,4 @@
1
- export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.mjs';
1
+ export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.mjs';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
@@ -1,4 +1,4 @@
1
- export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.js';
1
+ export { AISDKMessage, Attachment, BuildEventPatch, ContextManager, ContextSpan, EventBuilder, EventMetadataOptions, IdentifyInput, RaindropAISDKClient, RaindropAISDKContext, RaindropAISDKOptions, WrapAISDKOptions, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './index.js';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
@@ -90,7 +90,7 @@ async function postJson(url, body, headers, opts) {
90
90
  // package.json
91
91
  var package_default = {
92
92
  name: "@raindrop-ai/ai-sdk",
93
- version: "0.0.5"};
93
+ version: "0.0.6"};
94
94
 
95
95
  // src/internal/version.ts
96
96
  var libraryName = package_default.name;
@@ -1245,6 +1245,17 @@ function attrsFromGenAiRequest(options) {
1245
1245
  }
1246
1246
 
1247
1247
  // src/internal/wrap/wrapAISDK.ts
1248
+ var warnedMissingUserId = false;
1249
+ function warnMissingUserIdOnce() {
1250
+ if (warnedMissingUserId) return;
1251
+ warnedMissingUserId = true;
1252
+ console.warn(
1253
+ "[raindrop-ai/ai-sdk] userId was not provided in wrap() context or via eventMetadata(). Events will be skipped unless a userId is provided."
1254
+ );
1255
+ }
1256
+ function _resetWarnedMissingUserId() {
1257
+ warnedMissingUserId = false;
1258
+ }
1248
1259
  function extractRaindropMetadata(metadata) {
1249
1260
  if (!metadata || typeof metadata !== "object") return {};
1250
1261
  const result = {};
@@ -1415,6 +1426,7 @@ function setupOperation(params) {
1415
1426
  const telemetry = extractExperimentalTelemetry(arg);
1416
1427
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1417
1428
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1429
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1418
1430
  const eventId = (_c = (_b = (_a = callTimeCtx.eventId) != null ? _a : mergedCtx.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1419
1431
  const ctx = { ...mergedCtx, eventId };
1420
1432
  const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;
@@ -1768,6 +1780,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
1768
1780
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1769
1781
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1770
1782
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1783
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1771
1784
  const inherited = await getCurrentParentSpanContext();
1772
1785
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1773
1786
  const ctx = { ...mergedCtx};
@@ -1955,6 +1968,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
1955
1968
  const telemetry = extractExperimentalTelemetry(mergedArgs);
1956
1969
  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);
1957
1970
  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);
1971
+ if (!mergedCtx.userId) warnMissingUserIdOnce();
1958
1972
  const inherited = await getCurrentParentSpanContext();
1959
1973
  const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();
1960
1974
  const ctx = { ...mergedCtx};
@@ -2687,6 +2701,7 @@ if (!globalThis.RAINDROP_ASYNC_LOCAL_STORAGE) {
2687
2701
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
2688
2702
  }
2689
2703
 
2704
+ exports._resetWarnedMissingUserId = _resetWarnedMissingUserId;
2690
2705
  exports.createRaindropAISDK = createRaindropAISDK;
2691
2706
  exports.currentSpan = currentSpan;
2692
2707
  exports.eventMetadata = eventMetadata;
@@ -1,4 +1,4 @@
1
- export { createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-5DKYVVJZ.mjs';
1
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-5S6OYWE3.mjs';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
 
4
4
  if (!globalThis.RAINDROP_ASYNC_LOCAL_STORAGE) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raindrop-ai/ai-sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Standalone Vercel AI SDK integration for Raindrop (events + OTLP/HTTP JSON traces, no OTEL runtime)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",