raindrop-ai 0.1.6 → 0.1.7
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-IRFBHPGQ.mjs → chunk-6CO4YGYH.mjs} +64 -20
- package/dist/index.d.mts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +102 -53
- package/dist/index.mjs +41 -34
- package/dist/tracing/index.js +63 -20
- package/dist/tracing/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
// ../core/dist/chunk-
|
|
1
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
2
|
+
function runWithTracingSuppressed(fn) {
|
|
3
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
4
|
+
if (typeof hook !== "function") return fn();
|
|
5
|
+
let started = false;
|
|
6
|
+
try {
|
|
7
|
+
return hook(() => {
|
|
8
|
+
started = true;
|
|
9
|
+
return fn();
|
|
10
|
+
});
|
|
11
|
+
} catch (err) {
|
|
12
|
+
if (started) throw err;
|
|
13
|
+
return fn();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
2
16
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
3
17
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
4
18
|
function wait(ms) {
|
|
@@ -109,15 +123,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
109
123
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
110
124
|
await withRetry(
|
|
111
125
|
async () => {
|
|
112
|
-
const resp = await
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
const resp = await runWithTracingSuppressed(
|
|
127
|
+
() => fetch(url, {
|
|
128
|
+
method: "POST",
|
|
129
|
+
headers: {
|
|
130
|
+
"Content-Type": "application/json",
|
|
131
|
+
...headers
|
|
132
|
+
},
|
|
133
|
+
body: JSON.stringify(body),
|
|
134
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
135
|
+
})
|
|
136
|
+
);
|
|
121
137
|
if (!resp.ok) {
|
|
122
138
|
const text = await resp.text().catch(() => "");
|
|
123
139
|
const err = new Error(
|
|
@@ -373,11 +389,36 @@ var REDACT_JSON_ATTRIBUTE_KEYS = new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
|
|
|
373
389
|
// ../core/dist/index.node.js
|
|
374
390
|
import { AsyncLocalStorage } from "async_hooks";
|
|
375
391
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
|
|
392
|
+
var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
|
|
393
|
+
"OpenTelemetry SDK Context Key SUPPRESS_TRACING"
|
|
394
|
+
);
|
|
395
|
+
function findOtelContextManager() {
|
|
396
|
+
var _a;
|
|
397
|
+
for (const sym of Object.getOwnPropertySymbols(globalThis)) {
|
|
398
|
+
if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
|
|
399
|
+
const api = globalThis[sym];
|
|
400
|
+
const cm = api == null ? void 0 : api.context;
|
|
401
|
+
if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
|
|
402
|
+
return cm;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return void 0;
|
|
406
|
+
}
|
|
407
|
+
function installTracingSuppressionHook() {
|
|
408
|
+
if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
|
|
409
|
+
const hook = (fn) => {
|
|
410
|
+
const cm = findOtelContextManager();
|
|
411
|
+
if (!cm) return fn();
|
|
412
|
+
return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
|
|
413
|
+
};
|
|
414
|
+
globalThis.RAINDROP_SUPPRESS_TRACING = hook;
|
|
415
|
+
}
|
|
416
|
+
installTracingSuppressionHook();
|
|
376
417
|
|
|
377
418
|
// package.json
|
|
378
419
|
var package_default = {
|
|
379
420
|
name: "raindrop-ai",
|
|
380
|
-
version: "0.1.
|
|
421
|
+
version: "0.1.7",
|
|
381
422
|
main: "dist/index.js",
|
|
382
423
|
module: "dist/index.mjs",
|
|
383
424
|
types: "dist/index.d.ts",
|
|
@@ -572,15 +613,17 @@ async function postJson2(url, body, headers, opts) {
|
|
|
572
613
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
573
614
|
await withRetry2(
|
|
574
615
|
async () => {
|
|
575
|
-
const resp = await
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
616
|
+
const resp = await runWithTracingSuppressed(
|
|
617
|
+
() => fetch(url, {
|
|
618
|
+
method: "POST",
|
|
619
|
+
headers: {
|
|
620
|
+
"Content-Type": "application/json",
|
|
621
|
+
...headers
|
|
622
|
+
},
|
|
623
|
+
body: JSON.stringify(body),
|
|
624
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
625
|
+
})
|
|
626
|
+
);
|
|
584
627
|
if (!resp.ok) {
|
|
585
628
|
const text = await resp.text().catch(() => "");
|
|
586
629
|
const err = new Error(
|
|
@@ -2462,6 +2505,7 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
2462
2505
|
};
|
|
2463
2506
|
|
|
2464
2507
|
export {
|
|
2508
|
+
runWithTracingSuppressed,
|
|
2465
2509
|
DEFAULT_REQUEST_TIMEOUT_MS,
|
|
2466
2510
|
MAX_RETRY_DELAY_MS,
|
|
2467
2511
|
redactUrlForLog,
|
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,42 @@ type LocalDebuggerLiveEventInput$1 = {
|
|
|
13
13
|
metadata?: Record<string, unknown>;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Run telemetry egress with OpenTelemetry tracing suppressed.
|
|
18
|
+
*
|
|
19
|
+
* Why this exists
|
|
20
|
+
* ---------------
|
|
21
|
+
* Raindrop integrations ship spans/events over HTTP with the global `fetch`
|
|
22
|
+
* (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
|
|
23
|
+
* fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
|
|
24
|
+
* every Eve agent installs — that instrumentation wraps *our own* telemetry
|
|
25
|
+
* POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
|
|
26
|
+
* very exporter that issued the request, so they get shipped right back to
|
|
27
|
+
* Raindrop and Workshop as standalone "runs" (and, because each export issues
|
|
28
|
+
* another fetch, they feed back on themselves). The result is a run list
|
|
29
|
+
* flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
|
|
30
|
+
* `.../live` entries that drown out the real agent turns — especially with
|
|
31
|
+
* sub-agents, where every sandbox runs its own instrumentation.
|
|
32
|
+
*
|
|
33
|
+
* The OTel-blessed fix is to mark the active context as "tracing suppressed"
|
|
34
|
+
* around the request; instrumentations check `isTracingSuppressed` and return
|
|
35
|
+
* a no-op span instead of recording one. We do this through a hook stashed on
|
|
36
|
+
* `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
|
|
37
|
+
* - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
|
|
38
|
+
* hard-depends on them, and the hook is simply absent when they (and thus
|
|
39
|
+
* any instrumentation to suppress) are not installed; and
|
|
40
|
+
* - the browser bundle never pulls in `node:module`, mirroring how core
|
|
41
|
+
* injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
|
|
42
|
+
*
|
|
43
|
+
* When no hook is present the callback runs unchanged, so suppression is a
|
|
44
|
+
* best-effort no-op rather than a hard requirement.
|
|
45
|
+
*/
|
|
46
|
+
/** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
|
|
47
|
+
type SuppressTracingHook = <T>(fn: () => T) => T;
|
|
48
|
+
declare global {
|
|
49
|
+
var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
16
52
|
type ParentSpanContext = {
|
|
17
53
|
traceIdB64: string;
|
|
18
54
|
spanIdB64: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,42 @@ type LocalDebuggerLiveEventInput$1 = {
|
|
|
13
13
|
metadata?: Record<string, unknown>;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Run telemetry egress with OpenTelemetry tracing suppressed.
|
|
18
|
+
*
|
|
19
|
+
* Why this exists
|
|
20
|
+
* ---------------
|
|
21
|
+
* Raindrop integrations ship spans/events over HTTP with the global `fetch`
|
|
22
|
+
* (see {@link ../http.ts `postJson`}). When the host app also runs an OTel
|
|
23
|
+
* fetch/undici instrumentation — e.g. `@vercel/otel`'s `registerOTel`, which
|
|
24
|
+
* every Eve agent installs — that instrumentation wraps *our own* telemetry
|
|
25
|
+
* POSTs in a `fetch POST <endpoint>` span. Those spans are then handed to the
|
|
26
|
+
* very exporter that issued the request, so they get shipped right back to
|
|
27
|
+
* Raindrop and Workshop as standalone "runs" (and, because each export issues
|
|
28
|
+
* another fetch, they feed back on themselves). The result is a run list
|
|
29
|
+
* flooded with `fetch POST .../v1/traces`, `.../events/track_partial` and
|
|
30
|
+
* `.../live` entries that drown out the real agent turns — especially with
|
|
31
|
+
* sub-agents, where every sandbox runs its own instrumentation.
|
|
32
|
+
*
|
|
33
|
+
* The OTel-blessed fix is to mark the active context as "tracing suppressed"
|
|
34
|
+
* around the request; instrumentations check `isTracingSuppressed` and return
|
|
35
|
+
* a no-op span instead of recording one. We do this through a hook stashed on
|
|
36
|
+
* `globalThis` by the Node entrypoint ({@link ../index.node.ts}) so that:
|
|
37
|
+
* - `@opentelemetry/api` / `@opentelemetry/core` stay *optional* — core never
|
|
38
|
+
* hard-depends on them, and the hook is simply absent when they (and thus
|
|
39
|
+
* any instrumentation to suppress) are not installed; and
|
|
40
|
+
* - the browser bundle never pulls in `node:module`, mirroring how core
|
|
41
|
+
* injects `AsyncLocalStorage` via `RAINDROP_ASYNC_LOCAL_STORAGE`.
|
|
42
|
+
*
|
|
43
|
+
* When no hook is present the callback runs unchanged, so suppression is a
|
|
44
|
+
* best-effort no-op rather than a hard requirement.
|
|
45
|
+
*/
|
|
46
|
+
/** Hook signature: run `fn` with OTel tracing suppressed, returning its value. */
|
|
47
|
+
type SuppressTracingHook = <T>(fn: () => T) => T;
|
|
48
|
+
declare global {
|
|
49
|
+
var RAINDROP_SUPPRESS_TRACING: SuppressTracingHook | undefined;
|
|
50
|
+
}
|
|
51
|
+
|
|
16
52
|
type ParentSpanContext = {
|
|
17
53
|
traceIdB64: string;
|
|
18
54
|
spanIdB64: string;
|
package/dist/index.js
CHANGED
|
@@ -5771,7 +5771,21 @@ __export(index_exports, {
|
|
|
5771
5771
|
});
|
|
5772
5772
|
module.exports = __toCommonJS(index_exports);
|
|
5773
5773
|
|
|
5774
|
-
// ../core/dist/chunk-
|
|
5774
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
5775
|
+
function runWithTracingSuppressed(fn) {
|
|
5776
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
5777
|
+
if (typeof hook !== "function") return fn();
|
|
5778
|
+
let started = false;
|
|
5779
|
+
try {
|
|
5780
|
+
return hook(() => {
|
|
5781
|
+
started = true;
|
|
5782
|
+
return fn();
|
|
5783
|
+
});
|
|
5784
|
+
} catch (err) {
|
|
5785
|
+
if (started) throw err;
|
|
5786
|
+
return fn();
|
|
5787
|
+
}
|
|
5788
|
+
}
|
|
5775
5789
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
5776
5790
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
5777
5791
|
function wait(ms) {
|
|
@@ -5882,15 +5896,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
5882
5896
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
5883
5897
|
await withRetry(
|
|
5884
5898
|
async () => {
|
|
5885
|
-
const resp = await
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5899
|
+
const resp = await runWithTracingSuppressed(
|
|
5900
|
+
() => fetch(url, {
|
|
5901
|
+
method: "POST",
|
|
5902
|
+
headers: {
|
|
5903
|
+
"Content-Type": "application/json",
|
|
5904
|
+
...headers
|
|
5905
|
+
},
|
|
5906
|
+
body: JSON.stringify(body),
|
|
5907
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
5908
|
+
})
|
|
5909
|
+
);
|
|
5894
5910
|
if (!resp.ok) {
|
|
5895
5911
|
const text = await resp.text().catch(() => "");
|
|
5896
5912
|
const err = new Error(
|
|
@@ -6146,6 +6162,31 @@ var REDACT_JSON_ATTRIBUTE_KEYS = new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
|
|
|
6146
6162
|
// ../core/dist/index.node.js
|
|
6147
6163
|
var import_async_hooks = require("async_hooks");
|
|
6148
6164
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = import_async_hooks.AsyncLocalStorage;
|
|
6165
|
+
var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
|
|
6166
|
+
"OpenTelemetry SDK Context Key SUPPRESS_TRACING"
|
|
6167
|
+
);
|
|
6168
|
+
function findOtelContextManager() {
|
|
6169
|
+
var _a;
|
|
6170
|
+
for (const sym of Object.getOwnPropertySymbols(globalThis)) {
|
|
6171
|
+
if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
|
|
6172
|
+
const api = globalThis[sym];
|
|
6173
|
+
const cm = api == null ? void 0 : api.context;
|
|
6174
|
+
if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
|
|
6175
|
+
return cm;
|
|
6176
|
+
}
|
|
6177
|
+
}
|
|
6178
|
+
return void 0;
|
|
6179
|
+
}
|
|
6180
|
+
function installTracingSuppressionHook() {
|
|
6181
|
+
if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
|
|
6182
|
+
const hook = (fn) => {
|
|
6183
|
+
const cm = findOtelContextManager();
|
|
6184
|
+
if (!cm) return fn();
|
|
6185
|
+
return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
|
|
6186
|
+
};
|
|
6187
|
+
globalThis.RAINDROP_SUPPRESS_TRACING = hook;
|
|
6188
|
+
}
|
|
6189
|
+
installTracingSuppressionHook();
|
|
6149
6190
|
|
|
6150
6191
|
// ../schemas/dist/chunk-HIOHOVGI.js
|
|
6151
6192
|
var __defProp2 = Object.defineProperty;
|
|
@@ -10255,7 +10296,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
10255
10296
|
// package.json
|
|
10256
10297
|
var package_default = {
|
|
10257
10298
|
name: "raindrop-ai",
|
|
10258
|
-
version: "0.1.
|
|
10299
|
+
version: "0.1.7",
|
|
10259
10300
|
main: "dist/index.js",
|
|
10260
10301
|
module: "dist/index.mjs",
|
|
10261
10302
|
types: "dist/index.d.ts",
|
|
@@ -10536,15 +10577,17 @@ async function postJson2(url, body, headers, opts) {
|
|
|
10536
10577
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
10537
10578
|
await withRetry2(
|
|
10538
10579
|
async () => {
|
|
10539
|
-
const resp = await
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
|
-
|
|
10545
|
-
|
|
10546
|
-
|
|
10547
|
-
|
|
10580
|
+
const resp = await runWithTracingSuppressed(
|
|
10581
|
+
() => fetch(url, {
|
|
10582
|
+
method: "POST",
|
|
10583
|
+
headers: {
|
|
10584
|
+
"Content-Type": "application/json",
|
|
10585
|
+
...headers
|
|
10586
|
+
},
|
|
10587
|
+
body: JSON.stringify(body),
|
|
10588
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
10589
|
+
})
|
|
10590
|
+
);
|
|
10548
10591
|
if (!resp.ok) {
|
|
10549
10592
|
const text = await resp.text().catch(() => "");
|
|
10550
10593
|
const err = new Error(
|
|
@@ -13063,14 +13106,16 @@ var Raindrop = class {
|
|
|
13063
13106
|
const headers = { "Content-Type": "application/json" };
|
|
13064
13107
|
if (this.writeKey) headers.Authorization = `Bearer ${this.writeKey}`;
|
|
13065
13108
|
try {
|
|
13066
|
-
void
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13073
|
-
|
|
13109
|
+
void runWithTracingSuppressed(
|
|
13110
|
+
() => fetch(`${localUrl}${endpoint}`, {
|
|
13111
|
+
method: "POST",
|
|
13112
|
+
headers,
|
|
13113
|
+
body: JSON.stringify(body),
|
|
13114
|
+
// Bounded like the cloud paths: a black-holed Workshop URL must not
|
|
13115
|
+
// pin connections indefinitely (fire-and-forget still holds sockets).
|
|
13116
|
+
signal: AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT_MS)
|
|
13117
|
+
})
|
|
13118
|
+
).catch(() => {
|
|
13074
13119
|
});
|
|
13075
13120
|
} catch (e) {
|
|
13076
13121
|
}
|
|
@@ -13114,19 +13159,21 @@ var Raindrop = class {
|
|
|
13114
13159
|
try {
|
|
13115
13160
|
const response = await withRetry3(
|
|
13116
13161
|
async () => {
|
|
13117
|
-
const resp = await
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13162
|
+
const resp = await runWithTracingSuppressed(
|
|
13163
|
+
() => fetch(this.apiUrl + endpoint, {
|
|
13164
|
+
method: "post",
|
|
13165
|
+
headers: {
|
|
13166
|
+
"Content-Type": "application/json",
|
|
13167
|
+
Authorization: `Bearer ${this.writeKey}`,
|
|
13168
|
+
...projectIdHeaders(this.projectId)
|
|
13169
|
+
},
|
|
13170
|
+
body: JSON.stringify(body),
|
|
13171
|
+
// Bounded: a dead or black-holed endpoint must never pin this
|
|
13172
|
+
// request (and the flush/close paths awaiting it) until the OS
|
|
13173
|
+
// gives up.
|
|
13174
|
+
signal: AbortSignal.timeout(budget.timeoutMs)
|
|
13175
|
+
})
|
|
13176
|
+
);
|
|
13130
13177
|
if (!resp.ok) {
|
|
13131
13178
|
const text = await resp.text().catch(() => "");
|
|
13132
13179
|
const err = new Error(
|
|
@@ -13392,18 +13439,20 @@ var Raindrop = class {
|
|
|
13392
13439
|
try {
|
|
13393
13440
|
const response = await withRetry3(
|
|
13394
13441
|
async () => {
|
|
13395
|
-
const resp = await
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13442
|
+
const resp = await runWithTracingSuppressed(
|
|
13443
|
+
() => fetch(this.apiUrl + endpoint, {
|
|
13444
|
+
method: "POST",
|
|
13445
|
+
headers: {
|
|
13446
|
+
"Content-Type": "application/json",
|
|
13447
|
+
Authorization: `Bearer ${this.writeKey}`,
|
|
13448
|
+
...projectIdHeaders(this.projectId)
|
|
13449
|
+
},
|
|
13450
|
+
body: JSON.stringify(event),
|
|
13451
|
+
// Send the single event object
|
|
13452
|
+
// Bounded: see sendBatchToApi.
|
|
13453
|
+
signal: AbortSignal.timeout(budget.timeoutMs)
|
|
13454
|
+
})
|
|
13455
|
+
);
|
|
13407
13456
|
if (!resp.ok) {
|
|
13408
13457
|
const errorBody = await resp.text().catch(() => "");
|
|
13409
13458
|
const err = new Error(
|
package/dist/index.mjs
CHANGED
|
@@ -13,10 +13,11 @@ import {
|
|
|
13
13
|
redactUrlForLog,
|
|
14
14
|
resolveLocalDebuggerBaseUrl,
|
|
15
15
|
resolveMaxTextFieldChars,
|
|
16
|
+
runWithTracingSuppressed,
|
|
16
17
|
setDefaultMaxTextFieldChars,
|
|
17
18
|
stringifyBounded,
|
|
18
19
|
tracing
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6CO4YGYH.mjs";
|
|
20
21
|
import {
|
|
21
22
|
__commonJS,
|
|
22
23
|
__toESM
|
|
@@ -10592,14 +10593,16 @@ var Raindrop = class {
|
|
|
10592
10593
|
const headers = { "Content-Type": "application/json" };
|
|
10593
10594
|
if (this.writeKey) headers.Authorization = `Bearer ${this.writeKey}`;
|
|
10594
10595
|
try {
|
|
10595
|
-
void
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10596
|
+
void runWithTracingSuppressed(
|
|
10597
|
+
() => fetch(`${localUrl}${endpoint}`, {
|
|
10598
|
+
method: "POST",
|
|
10599
|
+
headers,
|
|
10600
|
+
body: JSON.stringify(body),
|
|
10601
|
+
// Bounded like the cloud paths: a black-holed Workshop URL must not
|
|
10602
|
+
// pin connections indefinitely (fire-and-forget still holds sockets).
|
|
10603
|
+
signal: AbortSignal.timeout(DEFAULT_REQUEST_TIMEOUT_MS)
|
|
10604
|
+
})
|
|
10605
|
+
).catch(() => {
|
|
10603
10606
|
});
|
|
10604
10607
|
} catch (e) {
|
|
10605
10608
|
}
|
|
@@ -10643,19 +10646,21 @@ var Raindrop = class {
|
|
|
10643
10646
|
try {
|
|
10644
10647
|
const response = await withRetry(
|
|
10645
10648
|
async () => {
|
|
10646
|
-
const resp = await
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10649
|
+
const resp = await runWithTracingSuppressed(
|
|
10650
|
+
() => fetch(this.apiUrl + endpoint, {
|
|
10651
|
+
method: "post",
|
|
10652
|
+
headers: {
|
|
10653
|
+
"Content-Type": "application/json",
|
|
10654
|
+
Authorization: `Bearer ${this.writeKey}`,
|
|
10655
|
+
...projectIdHeaders(this.projectId)
|
|
10656
|
+
},
|
|
10657
|
+
body: JSON.stringify(body),
|
|
10658
|
+
// Bounded: a dead or black-holed endpoint must never pin this
|
|
10659
|
+
// request (and the flush/close paths awaiting it) until the OS
|
|
10660
|
+
// gives up.
|
|
10661
|
+
signal: AbortSignal.timeout(budget.timeoutMs)
|
|
10662
|
+
})
|
|
10663
|
+
);
|
|
10659
10664
|
if (!resp.ok) {
|
|
10660
10665
|
const text = await resp.text().catch(() => "");
|
|
10661
10666
|
const err = new Error(
|
|
@@ -10921,18 +10926,20 @@ var Raindrop = class {
|
|
|
10921
10926
|
try {
|
|
10922
10927
|
const response = await withRetry(
|
|
10923
10928
|
async () => {
|
|
10924
|
-
const resp = await
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10929
|
+
const resp = await runWithTracingSuppressed(
|
|
10930
|
+
() => fetch(this.apiUrl + endpoint, {
|
|
10931
|
+
method: "POST",
|
|
10932
|
+
headers: {
|
|
10933
|
+
"Content-Type": "application/json",
|
|
10934
|
+
Authorization: `Bearer ${this.writeKey}`,
|
|
10935
|
+
...projectIdHeaders(this.projectId)
|
|
10936
|
+
},
|
|
10937
|
+
body: JSON.stringify(event),
|
|
10938
|
+
// Send the single event object
|
|
10939
|
+
// Bounded: see sendBatchToApi.
|
|
10940
|
+
signal: AbortSignal.timeout(budget.timeoutMs)
|
|
10941
|
+
})
|
|
10942
|
+
);
|
|
10936
10943
|
if (!resp.ok) {
|
|
10937
10944
|
const errorBody = await resp.text().catch(() => "");
|
|
10938
10945
|
const err = new Error(
|
package/dist/tracing/index.js
CHANGED
|
@@ -50,7 +50,21 @@ var import_instrumentation_vertexai = require("@traceloop/instrumentation-vertex
|
|
|
50
50
|
var traceloop3 = __toESM(require("@traceloop/node-server-sdk"));
|
|
51
51
|
var import_weakref = require("weakref");
|
|
52
52
|
|
|
53
|
-
// ../core/dist/chunk-
|
|
53
|
+
// ../core/dist/chunk-WKRW55KX.js
|
|
54
|
+
function runWithTracingSuppressed(fn) {
|
|
55
|
+
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
56
|
+
if (typeof hook !== "function") return fn();
|
|
57
|
+
let started = false;
|
|
58
|
+
try {
|
|
59
|
+
return hook(() => {
|
|
60
|
+
started = true;
|
|
61
|
+
return fn();
|
|
62
|
+
});
|
|
63
|
+
} catch (err) {
|
|
64
|
+
if (started) throw err;
|
|
65
|
+
return fn();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
54
68
|
var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
55
69
|
var MAX_RETRY_DELAY_MS = 3e4;
|
|
56
70
|
function wait(ms) {
|
|
@@ -161,15 +175,17 @@ async function postJson(url, body, headers, opts) {
|
|
|
161
175
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
162
176
|
await withRetry(
|
|
163
177
|
async () => {
|
|
164
|
-
const resp = await
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
const resp = await runWithTracingSuppressed(
|
|
179
|
+
() => fetch(url, {
|
|
180
|
+
method: "POST",
|
|
181
|
+
headers: {
|
|
182
|
+
"Content-Type": "application/json",
|
|
183
|
+
...headers
|
|
184
|
+
},
|
|
185
|
+
body: JSON.stringify(body),
|
|
186
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
187
|
+
})
|
|
188
|
+
);
|
|
173
189
|
if (!resp.ok) {
|
|
174
190
|
const text = await resp.text().catch(() => "");
|
|
175
191
|
const err = new Error(
|
|
@@ -387,6 +403,31 @@ var REDACT_JSON_ATTRIBUTE_KEYS = new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
|
|
|
387
403
|
// ../core/dist/index.node.js
|
|
388
404
|
var import_async_hooks = require("async_hooks");
|
|
389
405
|
globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = import_async_hooks.AsyncLocalStorage;
|
|
406
|
+
var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
|
|
407
|
+
"OpenTelemetry SDK Context Key SUPPRESS_TRACING"
|
|
408
|
+
);
|
|
409
|
+
function findOtelContextManager() {
|
|
410
|
+
var _a;
|
|
411
|
+
for (const sym of Object.getOwnPropertySymbols(globalThis)) {
|
|
412
|
+
if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
|
|
413
|
+
const api = globalThis[sym];
|
|
414
|
+
const cm = api == null ? void 0 : api.context;
|
|
415
|
+
if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
|
|
416
|
+
return cm;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return void 0;
|
|
420
|
+
}
|
|
421
|
+
function installTracingSuppressionHook() {
|
|
422
|
+
if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
|
|
423
|
+
const hook = (fn) => {
|
|
424
|
+
const cm = findOtelContextManager();
|
|
425
|
+
if (!cm) return fn();
|
|
426
|
+
return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
|
|
427
|
+
};
|
|
428
|
+
globalThis.RAINDROP_SUPPRESS_TRACING = hook;
|
|
429
|
+
}
|
|
430
|
+
installTracingSuppressionHook();
|
|
390
431
|
|
|
391
432
|
// src/tracing/direct/http.ts
|
|
392
433
|
function wait2(ms) {
|
|
@@ -454,15 +495,17 @@ async function postJson2(url, body, headers, opts) {
|
|
|
454
495
|
const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
455
496
|
await withRetry2(
|
|
456
497
|
async () => {
|
|
457
|
-
const resp = await
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
498
|
+
const resp = await runWithTracingSuppressed(
|
|
499
|
+
() => fetch(url, {
|
|
500
|
+
method: "POST",
|
|
501
|
+
headers: {
|
|
502
|
+
"Content-Type": "application/json",
|
|
503
|
+
...headers
|
|
504
|
+
},
|
|
505
|
+
body: JSON.stringify(body),
|
|
506
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
507
|
+
})
|
|
508
|
+
);
|
|
466
509
|
if (!resp.ok) {
|
|
467
510
|
const text = await resp.text().catch(() => "");
|
|
468
511
|
const err = new Error(
|
|
@@ -542,7 +585,7 @@ function base64ToHex(base64) {
|
|
|
542
585
|
// package.json
|
|
543
586
|
var package_default = {
|
|
544
587
|
name: "raindrop-ai",
|
|
545
|
-
version: "0.1.
|
|
588
|
+
version: "0.1.7",
|
|
546
589
|
main: "dist/index.js",
|
|
547
590
|
module: "dist/index.mjs",
|
|
548
591
|
types: "dist/index.d.ts",
|
package/dist/tracing/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raindrop-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "^5.3.3",
|
|
42
42
|
"vite": "^7.3.2",
|
|
43
43
|
"vitest": "^4.0.10",
|
|
44
|
-
"@raindrop-ai/core": "0.0.
|
|
44
|
+
"@raindrop-ai/core": "0.0.5",
|
|
45
45
|
"@raindrop-ai/redact-pii": "0.1.2",
|
|
46
46
|
"@raindrop-ai/schemas": "0.0.1"
|
|
47
47
|
},
|