@raindrop-ai/ai-sdk 0.0.10 → 0.0.11

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.
@@ -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.10"};
87
+ version: "0.0.11"};
88
88
 
89
89
  // src/internal/version.ts
90
90
  var libraryName = package_default.name;
@@ -397,6 +397,9 @@ function base64Encode(bytes) {
397
397
  }
398
398
 
399
399
  // src/internal/otlp.ts
400
+ var SpanStatusCode = {
401
+ ERROR: 2
402
+ };
400
403
  function createSpanIds(parent) {
401
404
  const traceId = parent ? parent.traceIdB64 : base64Encode(randomBytes(16));
402
405
  const spanId = base64Encode(randomBytes(8));
@@ -449,6 +452,7 @@ function buildOtlpSpan(args) {
449
452
  };
450
453
  if (args.ids.parentSpanIdB64) span.parentSpanId = args.ids.parentSpanIdB64;
451
454
  if (attrs.length) span.attributes = attrs;
455
+ if (args.status) span.status = args.status;
452
456
  return span;
453
457
  }
454
458
  function buildExportTraceServiceRequest(spans) {
@@ -509,12 +513,18 @@ var TraceShipper = class {
509
513
  if ((_a = extra == null ? void 0 : extra.attributes) == null ? void 0 : _a.length) {
510
514
  span.attributes.push(...extra.attributes);
511
515
  }
516
+ let status;
517
+ if ((extra == null ? void 0 : extra.error) !== void 0) {
518
+ const message = extra.error instanceof Error ? extra.error.message : String(extra.error);
519
+ status = { code: SpanStatusCode.ERROR, message };
520
+ }
512
521
  const otlp = buildOtlpSpan({
513
522
  ids: span.ids,
514
523
  name: span.name,
515
524
  startTimeUnixNano: span.startTimeUnixNano,
516
525
  endTimeUnixNano: span.endTimeUnixNano,
517
- attributes: span.attributes
526
+ attributes: span.attributes,
527
+ status
518
528
  });
519
529
  this.enqueue(otlp);
520
530
  }
@@ -1760,7 +1770,8 @@ function createFinalize(params) {
1760
1770
  attrInt("ai.usage.cachedInputTokens", usage == null ? void 0 : usage.cachedInputTokens),
1761
1771
  attrInt("ai.toolCall.count", setup.toolCalls.length),
1762
1772
  ...error ? [attrString("error.message", error instanceof Error ? error.message : String(error))] : []
1763
- ]
1773
+ ],
1774
+ error
1764
1775
  });
1765
1776
  }
1766
1777
  if (sendEvents) {
@@ -2116,7 +2127,8 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
2116
2127
  error instanceof Error ? error.message : String(error)
2117
2128
  )
2118
2129
  ] : []
2119
- ]
2130
+ ],
2131
+ error
2120
2132
  });
2121
2133
  }
2122
2134
  if (sendEvents) {
@@ -2309,7 +2321,8 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
2309
2321
  error instanceof Error ? error.message : String(error)
2310
2322
  )
2311
2323
  ] : []
2312
- ]
2324
+ ],
2325
+ error
2313
2326
  });
2314
2327
  }
2315
2328
  if (sendEvents) {
@@ -2442,7 +2455,8 @@ function wrapToolExecute(name, tool, ctx, toolCalls) {
2442
2455
  ctx.traceShipper.endSpan(span, {
2443
2456
  attributes: [
2444
2457
  attrString("error.message", error instanceof Error ? error.message : String(error))
2445
- ]
2458
+ ],
2459
+ error
2446
2460
  });
2447
2461
  } else {
2448
2462
  ctx.traceShipper.endSpan(span, {
@@ -2555,7 +2569,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2555
2569
  "error.message",
2556
2570
  error instanceof Error ? error.message : String(error)
2557
2571
  )
2558
- ]
2572
+ ],
2573
+ error
2559
2574
  });
2560
2575
  throw error;
2561
2576
  }
@@ -2589,7 +2604,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2589
2604
  "error.message",
2590
2605
  error instanceof Error ? error.message : String(error)
2591
2606
  )
2592
- ]
2607
+ ],
2608
+ error
2593
2609
  });
2594
2610
  throw error;
2595
2611
  }
@@ -2643,7 +2659,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2643
2659
  error instanceof Error ? error.message : String(error)
2644
2660
  )
2645
2661
  ] : []
2646
- ]
2662
+ ],
2663
+ error
2647
2664
  });
2648
2665
  };
2649
2666
  const wrappedStream = new RS({
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.10"};
89
+ version: "0.0.11"};
90
90
 
91
91
  // src/internal/version.ts
92
92
  var libraryName = package_default.name;
@@ -399,6 +399,9 @@ function base64Encode(bytes) {
399
399
  }
400
400
 
401
401
  // src/internal/otlp.ts
402
+ var SpanStatusCode = {
403
+ ERROR: 2
404
+ };
402
405
  function createSpanIds(parent) {
403
406
  const traceId = parent ? parent.traceIdB64 : base64Encode(randomBytes(16));
404
407
  const spanId = base64Encode(randomBytes(8));
@@ -451,6 +454,7 @@ function buildOtlpSpan(args) {
451
454
  };
452
455
  if (args.ids.parentSpanIdB64) span.parentSpanId = args.ids.parentSpanIdB64;
453
456
  if (attrs.length) span.attributes = attrs;
457
+ if (args.status) span.status = args.status;
454
458
  return span;
455
459
  }
456
460
  function buildExportTraceServiceRequest(spans) {
@@ -511,12 +515,18 @@ var TraceShipper = class {
511
515
  if ((_a = extra == null ? void 0 : extra.attributes) == null ? void 0 : _a.length) {
512
516
  span.attributes.push(...extra.attributes);
513
517
  }
518
+ let status;
519
+ if ((extra == null ? void 0 : extra.error) !== void 0) {
520
+ const message = extra.error instanceof Error ? extra.error.message : String(extra.error);
521
+ status = { code: SpanStatusCode.ERROR, message };
522
+ }
514
523
  const otlp = buildOtlpSpan({
515
524
  ids: span.ids,
516
525
  name: span.name,
517
526
  startTimeUnixNano: span.startTimeUnixNano,
518
527
  endTimeUnixNano: span.endTimeUnixNano,
519
- attributes: span.attributes
528
+ attributes: span.attributes,
529
+ status
520
530
  });
521
531
  this.enqueue(otlp);
522
532
  }
@@ -1762,7 +1772,8 @@ function createFinalize(params) {
1762
1772
  attrInt("ai.usage.cachedInputTokens", usage == null ? void 0 : usage.cachedInputTokens),
1763
1773
  attrInt("ai.toolCall.count", setup.toolCalls.length),
1764
1774
  ...error ? [attrString("error.message", error instanceof Error ? error.message : String(error))] : []
1765
- ]
1775
+ ],
1776
+ error
1766
1777
  });
1767
1778
  }
1768
1779
  if (sendEvents) {
@@ -2118,7 +2129,8 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
2118
2129
  error instanceof Error ? error.message : String(error)
2119
2130
  )
2120
2131
  ] : []
2121
- ]
2132
+ ],
2133
+ error
2122
2134
  });
2123
2135
  }
2124
2136
  if (sendEvents) {
@@ -2311,7 +2323,8 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
2311
2323
  error instanceof Error ? error.message : String(error)
2312
2324
  )
2313
2325
  ] : []
2314
- ]
2326
+ ],
2327
+ error
2315
2328
  });
2316
2329
  }
2317
2330
  if (sendEvents) {
@@ -2444,7 +2457,8 @@ function wrapToolExecute(name, tool, ctx, toolCalls) {
2444
2457
  ctx.traceShipper.endSpan(span, {
2445
2458
  attributes: [
2446
2459
  attrString("error.message", error instanceof Error ? error.message : String(error))
2447
- ]
2460
+ ],
2461
+ error
2448
2462
  });
2449
2463
  } else {
2450
2464
  ctx.traceShipper.endSpan(span, {
@@ -2557,7 +2571,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2557
2571
  "error.message",
2558
2572
  error instanceof Error ? error.message : String(error)
2559
2573
  )
2560
- ]
2574
+ ],
2575
+ error
2561
2576
  });
2562
2577
  throw error;
2563
2578
  }
@@ -2591,7 +2606,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2591
2606
  "error.message",
2592
2607
  error instanceof Error ? error.message : String(error)
2593
2608
  )
2594
- ]
2609
+ ],
2610
+ error
2595
2611
  });
2596
2612
  throw error;
2597
2613
  }
@@ -2645,7 +2661,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2645
2661
  error instanceof Error ? error.message : String(error)
2646
2662
  )
2647
2663
  ] : []
2648
- ]
2664
+ ],
2665
+ error
2649
2666
  });
2650
2667
  };
2651
2668
  const wrappedStream = new RS({
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-ZVQRZCBO.mjs';
1
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-MUDB4FLO.mjs';
@@ -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.10"};
93
+ version: "0.0.11"};
94
94
 
95
95
  // src/internal/version.ts
96
96
  var libraryName = package_default.name;
@@ -403,6 +403,9 @@ function base64Encode(bytes) {
403
403
  }
404
404
 
405
405
  // src/internal/otlp.ts
406
+ var SpanStatusCode = {
407
+ ERROR: 2
408
+ };
406
409
  function createSpanIds(parent) {
407
410
  const traceId = parent ? parent.traceIdB64 : base64Encode(randomBytes(16));
408
411
  const spanId = base64Encode(randomBytes(8));
@@ -455,6 +458,7 @@ function buildOtlpSpan(args) {
455
458
  };
456
459
  if (args.ids.parentSpanIdB64) span.parentSpanId = args.ids.parentSpanIdB64;
457
460
  if (attrs.length) span.attributes = attrs;
461
+ if (args.status) span.status = args.status;
458
462
  return span;
459
463
  }
460
464
  function buildExportTraceServiceRequest(spans) {
@@ -515,12 +519,18 @@ var TraceShipper = class {
515
519
  if ((_a = extra == null ? void 0 : extra.attributes) == null ? void 0 : _a.length) {
516
520
  span.attributes.push(...extra.attributes);
517
521
  }
522
+ let status;
523
+ if ((extra == null ? void 0 : extra.error) !== void 0) {
524
+ const message = extra.error instanceof Error ? extra.error.message : String(extra.error);
525
+ status = { code: SpanStatusCode.ERROR, message };
526
+ }
518
527
  const otlp = buildOtlpSpan({
519
528
  ids: span.ids,
520
529
  name: span.name,
521
530
  startTimeUnixNano: span.startTimeUnixNano,
522
531
  endTimeUnixNano: span.endTimeUnixNano,
523
- attributes: span.attributes
532
+ attributes: span.attributes,
533
+ status
524
534
  });
525
535
  this.enqueue(otlp);
526
536
  }
@@ -1766,7 +1776,8 @@ function createFinalize(params) {
1766
1776
  attrInt("ai.usage.cachedInputTokens", usage == null ? void 0 : usage.cachedInputTokens),
1767
1777
  attrInt("ai.toolCall.count", setup.toolCalls.length),
1768
1778
  ...error ? [attrString("error.message", error instanceof Error ? error.message : String(error))] : []
1769
- ]
1779
+ ],
1780
+ error
1770
1781
  });
1771
1782
  }
1772
1783
  if (sendEvents) {
@@ -2122,7 +2133,8 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
2122
2133
  error instanceof Error ? error.message : String(error)
2123
2134
  )
2124
2135
  ] : []
2125
- ]
2136
+ ],
2137
+ error
2126
2138
  });
2127
2139
  }
2128
2140
  if (sendEvents) {
@@ -2315,7 +2327,8 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
2315
2327
  error instanceof Error ? error.message : String(error)
2316
2328
  )
2317
2329
  ] : []
2318
- ]
2330
+ ],
2331
+ error
2319
2332
  });
2320
2333
  }
2321
2334
  if (sendEvents) {
@@ -2448,7 +2461,8 @@ function wrapToolExecute(name, tool, ctx, toolCalls) {
2448
2461
  ctx.traceShipper.endSpan(span, {
2449
2462
  attributes: [
2450
2463
  attrString("error.message", error instanceof Error ? error.message : String(error))
2451
- ]
2464
+ ],
2465
+ error
2452
2466
  });
2453
2467
  } else {
2454
2468
  ctx.traceShipper.endSpan(span, {
@@ -2561,7 +2575,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2561
2575
  "error.message",
2562
2576
  error instanceof Error ? error.message : String(error)
2563
2577
  )
2564
- ]
2578
+ ],
2579
+ error
2565
2580
  });
2566
2581
  throw error;
2567
2582
  }
@@ -2595,7 +2610,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2595
2610
  "error.message",
2596
2611
  error instanceof Error ? error.message : String(error)
2597
2612
  )
2598
- ]
2613
+ ],
2614
+ error
2599
2615
  });
2600
2616
  throw error;
2601
2617
  }
@@ -2649,7 +2665,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2649
2665
  error instanceof Error ? error.message : String(error)
2650
2666
  )
2651
2667
  ] : []
2652
- ]
2668
+ ],
2669
+ error
2653
2670
  });
2654
2671
  };
2655
2672
  const wrappedStream = new RS({
@@ -1,4 +1,4 @@
1
- export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-ZVQRZCBO.mjs';
1
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-MUDB4FLO.mjs';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
 
4
4
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
@@ -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.10"};
93
+ version: "0.0.11"};
94
94
 
95
95
  // src/internal/version.ts
96
96
  var libraryName = package_default.name;
@@ -403,6 +403,9 @@ function base64Encode(bytes) {
403
403
  }
404
404
 
405
405
  // src/internal/otlp.ts
406
+ var SpanStatusCode = {
407
+ ERROR: 2
408
+ };
406
409
  function createSpanIds(parent) {
407
410
  const traceId = parent ? parent.traceIdB64 : base64Encode(randomBytes(16));
408
411
  const spanId = base64Encode(randomBytes(8));
@@ -455,6 +458,7 @@ function buildOtlpSpan(args) {
455
458
  };
456
459
  if (args.ids.parentSpanIdB64) span.parentSpanId = args.ids.parentSpanIdB64;
457
460
  if (attrs.length) span.attributes = attrs;
461
+ if (args.status) span.status = args.status;
458
462
  return span;
459
463
  }
460
464
  function buildExportTraceServiceRequest(spans) {
@@ -515,12 +519,18 @@ var TraceShipper = class {
515
519
  if ((_a = extra == null ? void 0 : extra.attributes) == null ? void 0 : _a.length) {
516
520
  span.attributes.push(...extra.attributes);
517
521
  }
522
+ let status;
523
+ if ((extra == null ? void 0 : extra.error) !== void 0) {
524
+ const message = extra.error instanceof Error ? extra.error.message : String(extra.error);
525
+ status = { code: SpanStatusCode.ERROR, message };
526
+ }
518
527
  const otlp = buildOtlpSpan({
519
528
  ids: span.ids,
520
529
  name: span.name,
521
530
  startTimeUnixNano: span.startTimeUnixNano,
522
531
  endTimeUnixNano: span.endTimeUnixNano,
523
- attributes: span.attributes
532
+ attributes: span.attributes,
533
+ status
524
534
  });
525
535
  this.enqueue(otlp);
526
536
  }
@@ -1766,7 +1776,8 @@ function createFinalize(params) {
1766
1776
  attrInt("ai.usage.cachedInputTokens", usage == null ? void 0 : usage.cachedInputTokens),
1767
1777
  attrInt("ai.toolCall.count", setup.toolCalls.length),
1768
1778
  ...error ? [attrString("error.message", error instanceof Error ? error.message : String(error))] : []
1769
- ]
1779
+ ],
1780
+ error
1770
1781
  });
1771
1782
  }
1772
1783
  if (sendEvents) {
@@ -2122,7 +2133,8 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
2122
2133
  error instanceof Error ? error.message : String(error)
2123
2134
  )
2124
2135
  ] : []
2125
- ]
2136
+ ],
2137
+ error
2126
2138
  });
2127
2139
  }
2128
2140
  if (sendEvents) {
@@ -2315,7 +2327,8 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
2315
2327
  error instanceof Error ? error.message : String(error)
2316
2328
  )
2317
2329
  ] : []
2318
- ]
2330
+ ],
2331
+ error
2319
2332
  });
2320
2333
  }
2321
2334
  if (sendEvents) {
@@ -2448,7 +2461,8 @@ function wrapToolExecute(name, tool, ctx, toolCalls) {
2448
2461
  ctx.traceShipper.endSpan(span, {
2449
2462
  attributes: [
2450
2463
  attrString("error.message", error instanceof Error ? error.message : String(error))
2451
- ]
2464
+ ],
2465
+ error
2452
2466
  });
2453
2467
  } else {
2454
2468
  ctx.traceShipper.endSpan(span, {
@@ -2561,7 +2575,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2561
2575
  "error.message",
2562
2576
  error instanceof Error ? error.message : String(error)
2563
2577
  )
2564
- ]
2578
+ ],
2579
+ error
2565
2580
  });
2566
2581
  throw error;
2567
2582
  }
@@ -2595,7 +2610,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2595
2610
  "error.message",
2596
2611
  error instanceof Error ? error.message : String(error)
2597
2612
  )
2598
- ]
2613
+ ],
2614
+ error
2599
2615
  });
2600
2616
  throw error;
2601
2617
  }
@@ -2649,7 +2665,8 @@ function wrapModel(args, aiSDK, outerOperationId, ctx) {
2649
2665
  error instanceof Error ? error.message : String(error)
2650
2666
  )
2651
2667
  ] : []
2652
- ]
2668
+ ],
2669
+ error
2653
2670
  });
2654
2671
  };
2655
2672
  const wrappedStream = new RS({
@@ -1,4 +1,4 @@
1
- export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-ZVQRZCBO.mjs';
1
+ export { _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, getContextManager, withCurrent } from './chunk-MUDB4FLO.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.10",
3
+ "version": "0.0.11",
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",