@raindrop-ai/ai-sdk 0.0.40 → 0.0.41
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/dist/{chunk-KTT4YMAW.mjs → chunk-3EYXAZ2H.mjs} +52 -11
- package/dist/{index-D82pma6B.d.mts → index-BCojLiWV.d.mts} +36 -0
- package/dist/{index-D82pma6B.d.ts → index-BCojLiWV.d.ts} +36 -0
- package/dist/index.browser.d.mts +36 -0
- package/dist/index.browser.d.ts +36 -0
- package/dist/index.browser.js +27 -11
- package/dist/index.browser.mjs +27 -11
- package/dist/index.node.d.mts +1 -1
- package/dist/index.node.d.ts +1 -1
- package/dist/index.node.js +52 -11
- package/dist/index.node.mjs +1 -1
- package/dist/index.workers.d.mts +1 -1
- package/dist/index.workers.d.ts +1 -1
- package/dist/index.workers.js +52 -11
- package/dist/index.workers.mjs +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
2
|
|
|
3
|
-
// ../core/dist/chunk-
|
|
3
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
4
4
|
function getCrypto() {
|
|
5
5
|
const c = globalThis.crypto;
|
|
6
6
|
return c;
|
|
@@ -55,6 +55,20 @@ function base64Encode(bytes) {
|
|
|
55
55
|
}
|
|
56
56
|
return out;
|
|
57
57
|
}
|
|
58
|
+
function runWithTracingSuppressed(fn) {
|
|
59
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
60
|
+
if (typeof hook !== "function") return fn();
|
|
61
|
+
let started = false;
|
|
62
|
+
try {
|
|
63
|
+
return hook(() => {
|
|
64
|
+
started = true;
|
|
65
|
+
return fn();
|
|
66
|
+
});
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (started) throw err;
|
|
69
|
+
return fn();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
59
73
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
60
74
|
function wait(ms) {
|
|
@@ -165,15 +179,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
165
179
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
166
180
|
await withRetry(
|
|
167
181
|
async () => {
|
|
168
|
-
const resp = await
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
182
|
+
const resp = await runWithTracingSuppressed(
|
|
183
|
+
() => fetch(url, {
|
|
184
|
+
method: "POST",
|
|
185
|
+
headers: {
|
|
186
|
+
"Content-Type": "application/json",
|
|
187
|
+
...headers
|
|
188
|
+
},
|
|
189
|
+
body: JSON.stringify(body),
|
|
190
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
191
|
+
})
|
|
192
|
+
);
|
|
177
193
|
if (!resp.ok) {
|
|
178
194
|
const text = await resp.text().catch(() => "");
|
|
179
195
|
const err = new Error(
|
|
@@ -1280,6 +1296,31 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1280
1296
|
}
|
|
1281
1297
|
}
|
|
1282
1298
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
|
|
1299
|
+
var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
|
|
1300
|
+
"OpenTelemetry SDK Context Key SUPPRESS_TRACING"
|
|
1301
|
+
);
|
|
1302
|
+
function findOtelContextManager() {
|
|
1303
|
+
var _a;
|
|
1304
|
+
for (const sym of Object.getOwnPropertySymbols(globalThis)) {
|
|
1305
|
+
if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
|
|
1306
|
+
const api = globalThis[sym];
|
|
1307
|
+
const cm = api == null ? void 0 : api.context;
|
|
1308
|
+
if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
|
|
1309
|
+
return cm;
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
return void 0;
|
|
1313
|
+
}
|
|
1314
|
+
function installTracingSuppressionHook() {
|
|
1315
|
+
if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
|
|
1316
|
+
const hook = (fn) => {
|
|
1317
|
+
const cm = findOtelContextManager();
|
|
1318
|
+
if (!cm) return fn();
|
|
1319
|
+
return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
|
|
1320
|
+
};
|
|
1321
|
+
globalThis.RAINDROP_SUPPRESS_TRACING = hook;
|
|
1322
|
+
}
|
|
1323
|
+
installTracingSuppressionHook();
|
|
1283
1324
|
|
|
1284
1325
|
// src/internal/truncation.ts
|
|
1285
1326
|
var TRUNCATION_MARKER2 = "...[truncated by raindrop]";
|
|
@@ -5017,7 +5058,7 @@ function extractNestedTokens(usage, key) {
|
|
|
5017
5058
|
// package.json
|
|
5018
5059
|
var package_default = {
|
|
5019
5060
|
name: "@raindrop-ai/ai-sdk",
|
|
5020
|
-
version: "0.0.
|
|
5061
|
+
version: "0.0.41"};
|
|
5021
5062
|
|
|
5022
5063
|
// src/internal/version.ts
|
|
5023
5064
|
var libraryName = package_default.name;
|
|
@@ -416,6 +416,42 @@ declare class TraceShipper$1 {
|
|
|
416
416
|
shutdown(): Promise<void>;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Run telemetry egress with OpenTelemetry tracing suppressed.
|
|
421
|
+
*
|
|
422
|
+
* Why this exists
|
|
423
|
+
* ---------------
|
|
424
|
+
* Raindrop integrations ship spans/events over HTTP with the global `fetch`
|
|
425
|
+
* (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
|
|
426
|
+
* fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
|
|
427
|
+
* every Eve agent installs — that instrumentation wraps *our own* telemetry
|
|
428
|
+
* POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
|
|
429
|
+
* very exporter that issued the request, so they get shipped right back to
|
|
430
|
+
* Raindrop and Workshop as standalone "runs" (and, because each export issues
|
|
431
|
+
* another fetch, they feed back on themselves). The result is a run list
|
|
432
|
+
* flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
|
|
433
|
+
* `.../live` entries that drown out the real agent turns — especially with
|
|
434
|
+
* sub-agents, where every sandbox runs its own instrumentation.
|
|
435
|
+
*
|
|
436
|
+
* The OTel-blessed fix is to mark the active context as "tracing suppressed"
|
|
437
|
+
* around the request; instrumentations check `isTracingSuppressed` and return
|
|
438
|
+
* a no-op span instead of recording one. We do this through a hook stashed on
|
|
439
|
+
* `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
|
|
440
|
+
* - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
|
|
441
|
+
* hard-depends on them, and the hook is simply absent when they (and thus
|
|
442
|
+
* any instrumentation to suppress) are not installed; and
|
|
443
|
+
* - the browser bundle never pulls in `node:module`, mirroring how core
|
|
444
|
+
* injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
|
|
445
|
+
*
|
|
446
|
+
* When no hook is present the callback runs unchanged, so suppression is a
|
|
447
|
+
* best-effort no-op rather than a hard requirement.
|
|
448
|
+
*/
|
|
449
|
+
/** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
|
|
450
|
+
type SuppressTracingHook = <T>(fn: () => T) => T;
|
|
451
|
+
declare global {
|
|
452
|
+
var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
|
|
453
|
+
}
|
|
454
|
+
|
|
419
455
|
type ParentSpanContext = {
|
|
420
456
|
traceIdB64: string;
|
|
421
457
|
spanIdB64: string;
|
|
@@ -416,6 +416,42 @@ declare class TraceShipper$1 {
|
|
|
416
416
|
shutdown(): Promise<void>;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Run telemetry egress with OpenTelemetry tracing suppressed.
|
|
421
|
+
*
|
|
422
|
+
* Why this exists
|
|
423
|
+
* ---------------
|
|
424
|
+
* Raindrop integrations ship spans/events over HTTP with the global `fetch`
|
|
425
|
+
* (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
|
|
426
|
+
* fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
|
|
427
|
+
* every Eve agent installs — that instrumentation wraps *our own* telemetry
|
|
428
|
+
* POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
|
|
429
|
+
* very exporter that issued the request, so they get shipped right back to
|
|
430
|
+
* Raindrop and Workshop as standalone "runs" (and, because each export issues
|
|
431
|
+
* another fetch, they feed back on themselves). The result is a run list
|
|
432
|
+
* flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
|
|
433
|
+
* `.../live` entries that drown out the real agent turns — especially with
|
|
434
|
+
* sub-agents, where every sandbox runs its own instrumentation.
|
|
435
|
+
*
|
|
436
|
+
* The OTel-blessed fix is to mark the active context as "tracing suppressed"
|
|
437
|
+
* around the request; instrumentations check `isTracingSuppressed` and return
|
|
438
|
+
* a no-op span instead of recording one. We do this through a hook stashed on
|
|
439
|
+
* `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
|
|
440
|
+
* - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
|
|
441
|
+
* hard-depends on them, and the hook is simply absent when they (and thus
|
|
442
|
+
* any instrumentation to suppress) are not installed; and
|
|
443
|
+
* - the browser bundle never pulls in `node:module`, mirroring how core
|
|
444
|
+
* injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
|
|
445
|
+
*
|
|
446
|
+
* When no hook is present the callback runs unchanged, so suppression is a
|
|
447
|
+
* best-effort no-op rather than a hard requirement.
|
|
448
|
+
*/
|
|
449
|
+
/** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
|
|
450
|
+
type SuppressTracingHook = <T>(fn: () => T) => T;
|
|
451
|
+
declare global {
|
|
452
|
+
var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
|
|
453
|
+
}
|
|
454
|
+
|
|
419
455
|
type ParentSpanContext = {
|
|
420
456
|
traceIdB64: string;
|
|
421
457
|
spanIdB64: string;
|
package/dist/index.browser.d.mts
CHANGED
|
@@ -416,6 +416,42 @@ declare class TraceShipper$1 {
|
|
|
416
416
|
shutdown(): Promise<void>;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Run telemetry egress with OpenTelemetry tracing suppressed.
|
|
421
|
+
*
|
|
422
|
+
* Why this exists
|
|
423
|
+
* ---------------
|
|
424
|
+
* Raindrop integrations ship spans/events over HTTP with the global `fetch`
|
|
425
|
+
* (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
|
|
426
|
+
* fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
|
|
427
|
+
* every Eve agent installs — that instrumentation wraps *our own* telemetry
|
|
428
|
+
* POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
|
|
429
|
+
* very exporter that issued the request, so they get shipped right back to
|
|
430
|
+
* Raindrop and Workshop as standalone "runs" (and, because each export issues
|
|
431
|
+
* another fetch, they feed back on themselves). The result is a run list
|
|
432
|
+
* flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
|
|
433
|
+
* `.../live` entries that drown out the real agent turns — especially with
|
|
434
|
+
* sub-agents, where every sandbox runs its own instrumentation.
|
|
435
|
+
*
|
|
436
|
+
* The OTel-blessed fix is to mark the active context as "tracing suppressed"
|
|
437
|
+
* around the request; instrumentations check `isTracingSuppressed` and return
|
|
438
|
+
* a no-op span instead of recording one. We do this through a hook stashed on
|
|
439
|
+
* `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
|
|
440
|
+
* - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
|
|
441
|
+
* hard-depends on them, and the hook is simply absent when they (and thus
|
|
442
|
+
* any instrumentation to suppress) are not installed; and
|
|
443
|
+
* - the browser bundle never pulls in `node:module`, mirroring how core
|
|
444
|
+
* injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
|
|
445
|
+
*
|
|
446
|
+
* When no hook is present the callback runs unchanged, so suppression is a
|
|
447
|
+
* best-effort no-op rather than a hard requirement.
|
|
448
|
+
*/
|
|
449
|
+
/** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
|
|
450
|
+
type SuppressTracingHook = <T>(fn: () => T) => T;
|
|
451
|
+
declare global {
|
|
452
|
+
var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
|
|
453
|
+
}
|
|
454
|
+
|
|
419
455
|
type ParentSpanContext = {
|
|
420
456
|
traceIdB64: string;
|
|
421
457
|
spanIdB64: string;
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -416,6 +416,42 @@ declare class TraceShipper$1 {
|
|
|
416
416
|
shutdown(): Promise<void>;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Run telemetry egress with OpenTelemetry tracing suppressed.
|
|
421
|
+
*
|
|
422
|
+
* Why this exists
|
|
423
|
+
* ---------------
|
|
424
|
+
* Raindrop integrations ship spans/events over HTTP with the global `fetch`
|
|
425
|
+
* (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
|
|
426
|
+
* fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
|
|
427
|
+
* every Eve agent installs — that instrumentation wraps *our own* telemetry
|
|
428
|
+
* POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
|
|
429
|
+
* very exporter that issued the request, so they get shipped right back to
|
|
430
|
+
* Raindrop and Workshop as standalone "runs" (and, because each export issues
|
|
431
|
+
* another fetch, they feed back on themselves). The result is a run list
|
|
432
|
+
* flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
|
|
433
|
+
* `.../live` entries that drown out the real agent turns — especially with
|
|
434
|
+
* sub-agents, where every sandbox runs its own instrumentation.
|
|
435
|
+
*
|
|
436
|
+
* The OTel-blessed fix is to mark the active context as "tracing suppressed"
|
|
437
|
+
* around the request; instrumentations check `isTracingSuppressed` and return
|
|
438
|
+
* a no-op span instead of recording one. We do this through a hook stashed on
|
|
439
|
+
* `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
|
|
440
|
+
* - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
|
|
441
|
+
* hard-depends on them, and the hook is simply absent when they (and thus
|
|
442
|
+
* any instrumentation to suppress) are not installed; and
|
|
443
|
+
* - the browser bundle never pulls in `node:module`, mirroring how core
|
|
444
|
+
* injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
|
|
445
|
+
*
|
|
446
|
+
* When no hook is present the callback runs unchanged, so suppression is a
|
|
447
|
+
* best-effort no-op rather than a hard requirement.
|
|
448
|
+
*/
|
|
449
|
+
/** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
|
|
450
|
+
type SuppressTracingHook = <T>(fn: () => T) => T;
|
|
451
|
+
declare global {
|
|
452
|
+
var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
|
|
453
|
+
}
|
|
454
|
+
|
|
419
455
|
type ParentSpanContext = {
|
|
420
456
|
traceIdB64: string;
|
|
421
457
|
spanIdB64: string;
|
package/dist/index.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// ../core/dist/chunk-
|
|
3
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
4
4
|
function getCrypto() {
|
|
5
5
|
const c = globalThis.crypto;
|
|
6
6
|
return c;
|
|
@@ -55,6 +55,20 @@ function base64Encode(bytes) {
|
|
|
55
55
|
}
|
|
56
56
|
return out;
|
|
57
57
|
}
|
|
58
|
+
function runWithTracingSuppressed(fn) {
|
|
59
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
60
|
+
if (typeof hook !== "function") return fn();
|
|
61
|
+
let started = false;
|
|
62
|
+
try {
|
|
63
|
+
return hook(() => {
|
|
64
|
+
started = true;
|
|
65
|
+
return fn();
|
|
66
|
+
});
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (started) throw err;
|
|
69
|
+
return fn();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
59
73
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
60
74
|
function wait(ms) {
|
|
@@ -165,15 +179,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
165
179
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
166
180
|
await withRetry(
|
|
167
181
|
async () => {
|
|
168
|
-
const resp = await
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
182
|
+
const resp = await runWithTracingSuppressed(
|
|
183
|
+
() => fetch(url, {
|
|
184
|
+
method: "POST",
|
|
185
|
+
headers: {
|
|
186
|
+
"Content-Type": "application/json",
|
|
187
|
+
...headers
|
|
188
|
+
},
|
|
189
|
+
body: JSON.stringify(body),
|
|
190
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
191
|
+
})
|
|
192
|
+
);
|
|
177
193
|
if (!resp.ok) {
|
|
178
194
|
const text = await resp.text().catch(() => "");
|
|
179
195
|
const err = new Error(
|
|
@@ -1283,7 +1299,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1283
1299
|
// package.json
|
|
1284
1300
|
var package_default = {
|
|
1285
1301
|
name: "@raindrop-ai/ai-sdk",
|
|
1286
|
-
version: "0.0.
|
|
1302
|
+
version: "0.0.41"};
|
|
1287
1303
|
|
|
1288
1304
|
// src/internal/version.ts
|
|
1289
1305
|
var libraryName = package_default.name;
|
package/dist/index.browser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../core/dist/chunk-
|
|
1
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
2
2
|
function getCrypto() {
|
|
3
3
|
const c = globalThis.crypto;
|
|
4
4
|
return c;
|
|
@@ -53,6 +53,20 @@ function base64Encode(bytes) {
|
|
|
53
53
|
}
|
|
54
54
|
return out;
|
|
55
55
|
}
|
|
56
|
+
function runWithTracingSuppressed(fn) {
|
|
57
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
58
|
+
if (typeof hook !== "function") return fn();
|
|
59
|
+
let started = false;
|
|
60
|
+
try {
|
|
61
|
+
return hook(() => {
|
|
62
|
+
started = true;
|
|
63
|
+
return fn();
|
|
64
|
+
});
|
|
65
|
+
} catch (err) {
|
|
66
|
+
if (started) throw err;
|
|
67
|
+
return fn();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
56
70
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
57
71
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
58
72
|
function wait(ms) {
|
|
@@ -163,15 +177,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
163
177
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
164
178
|
await withRetry(
|
|
165
179
|
async () => {
|
|
166
|
-
const resp = await
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
const resp = await runWithTracingSuppressed(
|
|
181
|
+
() => fetch(url, {
|
|
182
|
+
method: "POST",
|
|
183
|
+
headers: {
|
|
184
|
+
"Content-Type": "application/json",
|
|
185
|
+
...headers
|
|
186
|
+
},
|
|
187
|
+
body: JSON.stringify(body),
|
|
188
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
189
|
+
})
|
|
190
|
+
);
|
|
175
191
|
if (!resp.ok) {
|
|
176
192
|
const text = await resp.text().catch(() => "");
|
|
177
193
|
const err = new Error(
|
|
@@ -1281,7 +1297,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1281
1297
|
// package.json
|
|
1282
1298
|
var package_default = {
|
|
1283
1299
|
name: "@raindrop-ai/ai-sdk",
|
|
1284
|
-
version: "0.0.
|
|
1300
|
+
version: "0.0.41"};
|
|
1285
1301
|
|
|
1286
1302
|
// src/internal/version.ts
|
|
1287
1303
|
var libraryName = package_default.name;
|
package/dist/index.node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-BCojLiWV.mjs';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-BCojLiWV.js';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.node.js
CHANGED
|
@@ -4,7 +4,7 @@ var async_hooks = require('async_hooks');
|
|
|
4
4
|
|
|
5
5
|
// src/index.node.ts
|
|
6
6
|
|
|
7
|
-
// ../core/dist/chunk-
|
|
7
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
8
8
|
function getCrypto() {
|
|
9
9
|
const c = globalThis.crypto;
|
|
10
10
|
return c;
|
|
@@ -59,6 +59,20 @@ function base64Encode(bytes) {
|
|
|
59
59
|
}
|
|
60
60
|
return out;
|
|
61
61
|
}
|
|
62
|
+
function runWithTracingSuppressed(fn) {
|
|
63
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
64
|
+
if (typeof hook !== "function") return fn();
|
|
65
|
+
let started = false;
|
|
66
|
+
try {
|
|
67
|
+
return hook(() => {
|
|
68
|
+
started = true;
|
|
69
|
+
return fn();
|
|
70
|
+
});
|
|
71
|
+
} catch (err) {
|
|
72
|
+
if (started) throw err;
|
|
73
|
+
return fn();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
62
76
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
63
77
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
64
78
|
function wait(ms) {
|
|
@@ -169,15 +183,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
169
183
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
170
184
|
await withRetry(
|
|
171
185
|
async () => {
|
|
172
|
-
const resp = await
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
186
|
+
const resp = await runWithTracingSuppressed(
|
|
187
|
+
() => fetch(url, {
|
|
188
|
+
method: "POST",
|
|
189
|
+
headers: {
|
|
190
|
+
"Content-Type": "application/json",
|
|
191
|
+
...headers
|
|
192
|
+
},
|
|
193
|
+
body: JSON.stringify(body),
|
|
194
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
195
|
+
})
|
|
196
|
+
);
|
|
181
197
|
if (!resp.ok) {
|
|
182
198
|
const text = await resp.text().catch(() => "");
|
|
183
199
|
const err = new Error(
|
|
@@ -1284,11 +1300,36 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1284
1300
|
}
|
|
1285
1301
|
}
|
|
1286
1302
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
|
|
1303
|
+
var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
|
|
1304
|
+
"OpenTelemetry SDK Context Key SUPPRESS_TRACING"
|
|
1305
|
+
);
|
|
1306
|
+
function findOtelContextManager() {
|
|
1307
|
+
var _a;
|
|
1308
|
+
for (const sym of Object.getOwnPropertySymbols(globalThis)) {
|
|
1309
|
+
if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
|
|
1310
|
+
const api = globalThis[sym];
|
|
1311
|
+
const cm = api == null ? void 0 : api.context;
|
|
1312
|
+
if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
|
|
1313
|
+
return cm;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
return void 0;
|
|
1317
|
+
}
|
|
1318
|
+
function installTracingSuppressionHook() {
|
|
1319
|
+
if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
|
|
1320
|
+
const hook = (fn) => {
|
|
1321
|
+
const cm = findOtelContextManager();
|
|
1322
|
+
if (!cm) return fn();
|
|
1323
|
+
return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
|
|
1324
|
+
};
|
|
1325
|
+
globalThis.RAINDROP_SUPPRESS_TRACING = hook;
|
|
1326
|
+
}
|
|
1327
|
+
installTracingSuppressionHook();
|
|
1287
1328
|
|
|
1288
1329
|
// package.json
|
|
1289
1330
|
var package_default = {
|
|
1290
1331
|
name: "@raindrop-ai/ai-sdk",
|
|
1291
|
-
version: "0.0.
|
|
1332
|
+
version: "0.0.41"};
|
|
1292
1333
|
|
|
1293
1334
|
// src/internal/version.ts
|
|
1294
1335
|
var libraryName = package_default.name;
|
package/dist/index.node.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-
|
|
1
|
+
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-3EYXAZ2H.mjs';
|
|
2
2
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
3
|
|
|
4
4
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
|
package/dist/index.workers.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-BCojLiWV.mjs';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.workers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-
|
|
1
|
+
export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-BCojLiWV.js';
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
|
package/dist/index.workers.js
CHANGED
|
@@ -4,7 +4,7 @@ var async_hooks = require('async_hooks');
|
|
|
4
4
|
|
|
5
5
|
// src/index.workers.ts
|
|
6
6
|
|
|
7
|
-
// ../core/dist/chunk-
|
|
7
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
8
8
|
function getCrypto() {
|
|
9
9
|
const c = globalThis.crypto;
|
|
10
10
|
return c;
|
|
@@ -59,6 +59,20 @@ function base64Encode(bytes) {
|
|
|
59
59
|
}
|
|
60
60
|
return out;
|
|
61
61
|
}
|
|
62
|
+
function runWithTracingSuppressed(fn) {
|
|
63
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
64
|
+
if (typeof hook !== "function") return fn();
|
|
65
|
+
let started = false;
|
|
66
|
+
try {
|
|
67
|
+
return hook(() => {
|
|
68
|
+
started = true;
|
|
69
|
+
return fn();
|
|
70
|
+
});
|
|
71
|
+
} catch (err) {
|
|
72
|
+
if (started) throw err;
|
|
73
|
+
return fn();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
62
76
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
63
77
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
64
78
|
function wait(ms) {
|
|
@@ -169,15 +183,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
169
183
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
170
184
|
await withRetry(
|
|
171
185
|
async () => {
|
|
172
|
-
const resp = await
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
186
|
+
const resp = await runWithTracingSuppressed(
|
|
187
|
+
() => fetch(url, {
|
|
188
|
+
method: "POST",
|
|
189
|
+
headers: {
|
|
190
|
+
"Content-Type": "application/json",
|
|
191
|
+
...headers
|
|
192
|
+
},
|
|
193
|
+
body: JSON.stringify(body),
|
|
194
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
195
|
+
})
|
|
196
|
+
);
|
|
181
197
|
if (!resp.ok) {
|
|
182
198
|
const text = await resp.text().catch(() => "");
|
|
183
199
|
const err = new Error(
|
|
@@ -1284,11 +1300,36 @@ async function* asyncGeneratorWithCurrent(span, gen) {
|
|
|
1284
1300
|
}
|
|
1285
1301
|
}
|
|
1286
1302
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
|
|
1303
|
+
var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
|
|
1304
|
+
"OpenTelemetry SDK Context Key SUPPRESS_TRACING"
|
|
1305
|
+
);
|
|
1306
|
+
function findOtelContextManager() {
|
|
1307
|
+
var _a;
|
|
1308
|
+
for (const sym of Object.getOwnPropertySymbols(globalThis)) {
|
|
1309
|
+
if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
|
|
1310
|
+
const api = globalThis[sym];
|
|
1311
|
+
const cm = api == null ? void 0 : api.context;
|
|
1312
|
+
if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
|
|
1313
|
+
return cm;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
return void 0;
|
|
1317
|
+
}
|
|
1318
|
+
function installTracingSuppressionHook() {
|
|
1319
|
+
if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
|
|
1320
|
+
const hook = (fn) => {
|
|
1321
|
+
const cm = findOtelContextManager();
|
|
1322
|
+
if (!cm) return fn();
|
|
1323
|
+
return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
|
|
1324
|
+
};
|
|
1325
|
+
globalThis.RAINDROP_SUPPRESS_TRACING = hook;
|
|
1326
|
+
}
|
|
1327
|
+
installTracingSuppressionHook();
|
|
1287
1328
|
|
|
1288
1329
|
// package.json
|
|
1289
1330
|
var package_default = {
|
|
1290
1331
|
name: "@raindrop-ai/ai-sdk",
|
|
1291
|
-
version: "0.0.
|
|
1332
|
+
version: "0.0.41"};
|
|
1292
1333
|
|
|
1293
1334
|
// src/internal/version.ts
|
|
1294
1335
|
var libraryName = package_default.name;
|
package/dist/index.workers.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-
|
|
1
|
+
export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-3EYXAZ2H.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.
|
|
3
|
+
"version": "0.0.41",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"tsup": "^8.4.0",
|
|
38
38
|
"tsx": "^4.20.3",
|
|
39
39
|
"typescript": "^5.3.3",
|
|
40
|
-
"@raindrop-ai/core": "0.0.
|
|
40
|
+
"@raindrop-ai/core": "0.0.5"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"ai": ">=4 <8"
|