@raindrop-ai/ai-sdk 0.0.19 → 0.0.21

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
@@ -5,6 +5,7 @@ Standalone Vercel AI SDK integration for Raindrop:
5
5
  - **Events**: sends a `track_partial` payload to `POST /v1/events/track_partial` when the model finishes
6
6
  - **Standalone traces**: ships spans directly to `POST /v1/traces` as **OTLP/HTTP JSON**
7
7
  - **No OpenTelemetry SDK init**: avoids global OTEL registration conflicts
8
+ - **Native v7 telemetry**: opt-in callback-based integration via AI SDK v7's `TelemetryIntegration` interface (no Proxy wrapping)
8
9
 
9
10
  ## Install
10
11
 
@@ -54,6 +55,27 @@ await raindrop.users.identify({
54
55
  await raindrop.flush();
55
56
  ```
56
57
 
58
+ ### AI SDK v7+ native telemetry (opt-in)
59
+
60
+ On AI SDK v7+, you can use the native `TelemetryIntegration` callback interface instead of Proxy wrapping. This avoids Proxy overhead and works with all AI SDK entry points (including `ToolLoopAgent`).
61
+
62
+ ```ts
63
+ // Option A: wrap() with nativeTelemetry flag
64
+ const { generateText } = raindrop.wrap(ai, {
65
+ context: { userId: "user_123" },
66
+ nativeTelemetry: true,
67
+ });
68
+
69
+ // Option B: direct registration (no wrap needed)
70
+ import { registerTelemetryIntegration } from "ai";
71
+
72
+ registerTelemetryIntegration(
73
+ raindrop.createTelemetryIntegration({ userId: "user_123" })
74
+ );
75
+ ```
76
+
77
+ Setting `nativeTelemetry: true` on pre-v7 throws a clear error. The Proxy path remains the default and supports features not yet available on the native path (`buildEvent`, output attachment extraction).
78
+
57
79
  If `userId` is missing from both `wrap()` context and `eventMetadata()`, the SDK logs a warning (once) and skips sending events.
58
80
 
59
81
  ## Runtime support
@@ -101,11 +123,12 @@ but it uses the same synchronous fallback described above rather than real
101
123
 
102
124
  This package is tested against multiple Vercel AI SDK versions:
103
125
 
104
- | Version | Status |
105
- |---------|--------|
106
- | v4.x | ✅ Supported |
107
- | v5.x | ✅ Supported |
108
- | v6.x | ✅ Supported |
126
+ | Version | Status | Integration |
127
+ |---------|--------|-------------|
128
+ | v4.x | ✅ Supported | Proxy |
129
+ | v5.x | ✅ Supported | Proxy |
130
+ | v6.x | ✅ Supported | Proxy |
131
+ | v7.x (beta) | ✅ Supported | Proxy (default) or native `TelemetryIntegration` (opt-in) |
109
132
 
110
133
  ### Version Differences Handled
111
134
 
@@ -130,10 +153,15 @@ packages/ai-sdk/
130
153
  │ │ ├── ai-sdk.v5.test.ts
131
154
  │ │ ├── wrapper.test.ts
132
155
  │ │ └── http-payloads.test.ts
133
- └── v6/ # AI SDK v6 (pins ai@^6.0.0)
134
- ├── ai-sdk.v6.test.ts
135
- ├── wrapper.test.ts
136
- └── http-payloads.test.ts
156
+ ├── v6/ # AI SDK v6 (pins ai@^6.0.0)
157
+ ├── ai-sdk.v6.test.ts
158
+ ├── wrapper.test.ts
159
+ └── http-payloads.test.ts
160
+ │ └── v7/ # AI SDK v7 beta (native telemetry + proxy)
161
+ │ ├── telemetry-integration.test.ts # Unit tests for all callbacks
162
+ │ ├── e2e-native-telemetry.test.ts # E2E with real AI SDK + MSW
163
+ │ ├── e2e-subagent-nesting.test.ts # Subagent span hierarchy
164
+ │ └── wrapper.test.ts
137
165
  ```
138
166
 
139
167
  ### Running Tests
@@ -146,6 +174,7 @@ pnpm test
146
174
  pnpm test:v4
147
175
  pnpm test:v5
148
176
  pnpm test:v6
177
+ pnpm test:v7
149
178
 
150
179
  # Quick smoke test (real LLM calls, single version)
151
180
  pnpm smoke:min
@@ -158,6 +187,11 @@ Each version runs:
158
187
  - **HTTP payload tests** - MSW-based payload validation for each spec version
159
188
  - **Version-specific tests** - API differences (finishReason format, usage naming)
160
189
 
190
+ v7 additionally runs:
191
+ - **Telemetry integration tests** - All callback lifecycles with mock shippers
192
+ - **E2E native telemetry** - Real AI SDK v7 with MSW-intercepted payloads
193
+ - **Subagent nesting** - Span hierarchy for nested generateText inside tool execution
194
+
161
195
  ## Notes
162
196
 
163
197
  - Spans include `ai.telemetry.metadata.raindrop.eventId` for correlation, and **omit** `ai.telemetry.metadata.raindrop.userId` to prevent duplicate span→event creation server-side.