@raindrop-ai/ai-sdk 0.0.22 → 0.0.24

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raindrop AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -55,6 +55,66 @@ await raindrop.users.identify({
55
55
  await raindrop.flush();
56
56
  ```
57
57
 
58
+ ## Manual Traces
59
+
60
+ Create trace spans manually alongside, or instead of, auto-instrumented ones.
61
+
62
+ Use `createSpan` when the timing is already known:
63
+
64
+ ```ts
65
+ const eventId = "evt_123";
66
+
67
+ raindrop.traces.createSpan({
68
+ name: "SET theme=dark",
69
+ eventId,
70
+ operationId: "ai.toolCall",
71
+ input: "SET theme=dark",
72
+ output: "OK",
73
+ durationMs: 12,
74
+ });
75
+ ```
76
+
77
+ Use `startSpan` / `endSpan` when you want to time an operation in real time:
78
+
79
+ ```ts
80
+ const span = raindrop.traces.startSpan({
81
+ name: "database_query",
82
+ eventId: "evt_123",
83
+ operationId: "ai.toolCall",
84
+ });
85
+
86
+ try {
87
+ await db.query("SELECT ...");
88
+ raindrop.traces.endSpan(span);
89
+ } catch (err) {
90
+ raindrop.traces.endSpan(span, { error: err instanceof Error ? err : String(err) });
91
+ }
92
+ ```
93
+
94
+ Pass a span as `parent` to build nested trace trees:
95
+
96
+ ```ts
97
+ const eventId = "evt_456";
98
+
99
+ const agentTurn = raindrop.traces.startSpan({
100
+ name: "agent_turn",
101
+ eventId,
102
+ });
103
+
104
+ raindrop.traces.createSpan({
105
+ name: "grep_search",
106
+ eventId,
107
+ parent: agentTurn,
108
+ operationId: "ai.toolCall",
109
+ input: { pattern: "execute" },
110
+ output: { matches: 12 },
111
+ durationMs: 120,
112
+ });
113
+
114
+ raindrop.traces.endSpan(agentTurn);
115
+ await raindrop.flush();
116
+ ```
117
+
58
118
  ### AI SDK v7+ native telemetry (opt-in)
59
119
 
60
120
  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`).
@@ -4007,7 +4007,7 @@ function extractNestedTokens(usage, key) {
4007
4007
  // package.json
4008
4008
  var package_default = {
4009
4009
  name: "@raindrop-ai/ai-sdk",
4010
- version: "0.0.22"};
4010
+ version: "0.0.24"};
4011
4011
 
4012
4012
  // src/internal/version.ts
4013
4013
  var libraryName = package_default.name;
@@ -832,7 +832,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
832
832
  // package.json
833
833
  var package_default = {
834
834
  name: "@raindrop-ai/ai-sdk",
835
- version: "0.0.22"};
835
+ version: "0.0.24"};
836
836
 
837
837
  // src/internal/version.ts
838
838
  var libraryName = package_default.name;
@@ -830,7 +830,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
830
830
  // package.json
831
831
  var package_default = {
832
832
  name: "@raindrop-ai/ai-sdk",
833
- version: "0.0.22"};
833
+ version: "0.0.24"};
834
834
 
835
835
  // src/internal/version.ts
836
836
  var libraryName = package_default.name;
@@ -837,7 +837,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
837
837
  // package.json
838
838
  var package_default = {
839
839
  name: "@raindrop-ai/ai-sdk",
840
- version: "0.0.22"};
840
+ version: "0.0.24"};
841
841
 
842
842
  // src/internal/version.ts
843
843
  var libraryName = package_default.name;
@@ -1,4 +1,4 @@
1
- export { RaindropTelemetryIntegration, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent } from './chunk-7NLWLLB4.mjs';
1
+ export { RaindropTelemetryIntegration, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent } from './chunk-WHP2SVAR.mjs';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
 
4
4
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
@@ -837,7 +837,7 @@ globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
837
837
  // package.json
838
838
  var package_default = {
839
839
  name: "@raindrop-ai/ai-sdk",
840
- version: "0.0.22"};
840
+ version: "0.0.24"};
841
841
 
842
842
  // src/internal/version.ts
843
843
  var libraryName = package_default.name;
@@ -1,4 +1,4 @@
1
- export { RaindropTelemetryIntegration, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent } from './chunk-7NLWLLB4.mjs';
1
+ export { RaindropTelemetryIntegration, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent } from './chunk-WHP2SVAR.mjs';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
 
4
4
  if (!globalThis.RAINDROP_ASYNC_LOCAL_STORAGE) {
package/package.json CHANGED
@@ -1,10 +1,20 @@
1
1
  {
2
2
  "name": "@raindrop-ai/ai-sdk",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "Standalone Vercel AI SDK integration for Raindrop (events + OTLP/HTTP JSON traces, no OTEL runtime)",
5
5
  "main": "dist/index.node.js",
6
6
  "module": "dist/index.node.mjs",
7
7
  "types": "dist/index.node.d.ts",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/raindrop-ai/raindrop-js.git",
12
+ "directory": "packages/ai-sdk"
13
+ },
14
+ "homepage": "https://github.com/raindrop-ai/raindrop-js/tree/main/packages/ai-sdk#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/raindrop-ai/raindrop-js/issues"
17
+ },
8
18
  "exports": {
9
19
  ".": {
10
20
  "types": "./dist/index.node.d.ts",
@@ -26,6 +36,20 @@
26
36
  "files": [
27
37
  "dist/**"
28
38
  ],
39
+ "devDependencies": {
40
+ "@types/node": "^20.11.17",
41
+ "msw": "^2.12.7",
42
+ "tsup": "^8.4.0",
43
+ "tsx": "^4.20.3",
44
+ "typescript": "^5.3.3",
45
+ "@raindrop-ai/core": "0.0.1"
46
+ },
47
+ "peerDependencies": {
48
+ "ai": ">=4 <8"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
29
53
  "scripts": {
30
54
  "build": "tsup",
31
55
  "dev": "tsup --watch",
@@ -40,19 +64,5 @@
40
64
  "test:v6": "pnpm build && cd tests/v6 && pnpm install --ignore-workspace --lockfile=false && pnpm test",
41
65
  "test:v7": "pnpm build && cd tests/v7 && pnpm install --ignore-workspace --lockfile=false && pnpm test",
42
66
  "test:install": "cd tests/v4 && pnpm install --ignore-workspace --lockfile=false && cd ../v5 && pnpm install --ignore-workspace --lockfile=false && cd ../v6 && pnpm install --ignore-workspace --lockfile=false && cd ../v7 && pnpm install --ignore-workspace --lockfile=false"
43
- },
44
- "devDependencies": {
45
- "@raindrop-ai/core": "workspace:*",
46
- "@types/node": "^20.11.17",
47
- "msw": "^2.12.7",
48
- "tsup": "^8.4.0",
49
- "tsx": "^4.20.3",
50
- "typescript": "^5.3.3"
51
- },
52
- "peerDependencies": {
53
- "ai": ">=4 <8"
54
- },
55
- "publishConfig": {
56
- "access": "public"
57
67
  }
58
- }
68
+ }