raindrop-ai 1.0.7 → 1.0.8
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-BMYWLBYI.mjs → chunk-JK73MFZN.mjs} +731 -130
- package/dist/{chunk-J2WYJUH7.mjs → chunk-NELGM2YD.mjs} +22 -9
- package/dist/evals/cli.js +754 -146
- package/dist/evals/cli.mjs +2 -2
- package/dist/{index-BXzOiaVu.d.mts → index-BOTg0MlJ.d.mts} +1205 -1187
- package/dist/{index-BXzOiaVu.d.ts → index-BOTg0MlJ.d.ts} +1205 -1187
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +759 -151
- package/dist/index.mjs +2 -2
- package/dist/tracing/index.d.mts +5 -1
- package/dist/tracing/index.d.ts +5 -1
- package/dist/tracing/index.js +985 -456
- package/dist/tracing/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -241,8 +241,8 @@ function boundEvalEntry(entry) {
|
|
|
241
241
|
return entry;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
function createTrace(origin, event,
|
|
245
|
-
return TraceSchema.parse({ origin, event, entries });
|
|
244
|
+
function createTrace(origin, event, entries2) {
|
|
245
|
+
return TraceSchema.parse({ origin, event, entries: entries2 });
|
|
246
246
|
}
|
|
247
247
|
function traceStepsToEntries(steps) {
|
|
248
248
|
return steps.map((step, index) => {
|
|
@@ -1770,7 +1770,7 @@ function evalScopeAttributes() {
|
|
|
1770
1770
|
return { [EVAL_CORRELATION_ID_ATTRIBUTE]: scope.correlationId };
|
|
1771
1771
|
}
|
|
1772
1772
|
|
|
1773
|
-
// ../core/dist/chunk-
|
|
1773
|
+
// ../core/dist/chunk-R5EQZAA5.js
|
|
1774
1774
|
var require_NameRedactor = __commonJS({
|
|
1775
1775
|
"../redact-pii/dist/built-ins/NameRedactor.js"(exports2) {
|
|
1776
1776
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -2639,9 +2639,9 @@ var SUBAGENT_ABORT_OPERATION_ID = "ai.subagent.failed";
|
|
|
2639
2639
|
var SUBAGENT_ABORT_SPAN_NAME = SUBAGENT_ABORT_OPERATION_ID;
|
|
2640
2640
|
var DEFAULT_DISPATCH_SPAN_NAME = "launch_subagent";
|
|
2641
2641
|
var HANDOFF_TERMINAL_PROPERTY_KEY = HANDOFF_ATTRIBUTE_SUFFIXES.terminal;
|
|
2642
|
-
function defined(
|
|
2642
|
+
function defined(entries2) {
|
|
2643
2643
|
const out = {};
|
|
2644
|
-
for (const [key, value] of Object.entries(
|
|
2644
|
+
for (const [key, value] of Object.entries(entries2)) {
|
|
2645
2645
|
if (typeof value === "string" && value.trim().length > 0) out[key] = value;
|
|
2646
2646
|
}
|
|
2647
2647
|
return out;
|
|
@@ -2715,8 +2715,8 @@ function warnNonConformantIdsOnce(traceId, spanId) {
|
|
|
2715
2715
|
var HANDOFF_HEADER = "x-raindrop-handoff";
|
|
2716
2716
|
var LANGSMITH_TRACE_HEADER = "langsmith-trace";
|
|
2717
2717
|
var LANGSMITH_METADATA_BAGGAGE_KEY = "langsmith-metadata";
|
|
2718
|
-
function encodeBaggage(
|
|
2719
|
-
return Object.entries(
|
|
2718
|
+
function encodeBaggage(entries2) {
|
|
2719
|
+
return Object.entries(entries2).filter((entry) => Boolean(entry[1])).map(([key, value]) => `${key}=${encodeURIComponent(value)}`).join(",");
|
|
2720
2720
|
}
|
|
2721
2721
|
function decodeBaggage(header) {
|
|
2722
2722
|
if (!header) return {};
|
|
@@ -3143,7 +3143,7 @@ async function sendJson(url, body, headers, opts) {
|
|
|
3143
3143
|
resp = await runWithTracingSuppressed(
|
|
3144
3144
|
() => fetch(url, {
|
|
3145
3145
|
method: "POST",
|
|
3146
|
-
redirect: headers["X-Raindrop-Replay-Id"] !== void 0 ? "error" : "follow",
|
|
3146
|
+
redirect: headers["X-Raindrop-Replay-Id"] !== void 0 || opts.followRedirects === false ? "error" : "follow",
|
|
3147
3147
|
headers: {
|
|
3148
3148
|
"Content-Type": "application/json",
|
|
3149
3149
|
...headers
|
|
@@ -3431,7 +3431,8 @@ function mirrorTraceExportToLocalDebugger(body, options = {}) {
|
|
|
3431
3431
|
maxAttempts: 1,
|
|
3432
3432
|
debug: (_a = options.debug) != null ? _a : false,
|
|
3433
3433
|
sdkName: options.sdkName,
|
|
3434
|
-
timeoutMs: LOCAL_DEBUGGER_MIRROR_TIMEOUT_MS
|
|
3434
|
+
timeoutMs: LOCAL_DEBUGGER_MIRROR_TIMEOUT_MS,
|
|
3435
|
+
followRedirects: options.followRedirects
|
|
3435
3436
|
}).catch(() => {
|
|
3436
3437
|
});
|
|
3437
3438
|
}
|
|
@@ -3444,7 +3445,8 @@ function mirrorPartialEventToLocalDebugger(event, options = {}) {
|
|
|
3444
3445
|
maxAttempts: 1,
|
|
3445
3446
|
debug: (_a = options.debug) != null ? _a : false,
|
|
3446
3447
|
sdkName: options.sdkName,
|
|
3447
|
-
timeoutMs: LOCAL_DEBUGGER_MIRROR_TIMEOUT_MS
|
|
3448
|
+
timeoutMs: LOCAL_DEBUGGER_MIRROR_TIMEOUT_MS,
|
|
3449
|
+
followRedirects: options.followRedirects
|
|
3448
3450
|
}).catch(() => {
|
|
3449
3451
|
});
|
|
3450
3452
|
}
|
|
@@ -3465,7 +3467,8 @@ function sendLocalDebuggerLiveEvent(event, options = {}) {
|
|
|
3465
3467
|
{
|
|
3466
3468
|
maxAttempts: 1,
|
|
3467
3469
|
debug: (_b = options.debug) != null ? _b : false,
|
|
3468
|
-
sdkName: options.sdkName
|
|
3470
|
+
sdkName: options.sdkName,
|
|
3471
|
+
followRedirects: options.followRedirects
|
|
3469
3472
|
}
|
|
3470
3473
|
).catch(() => {
|
|
3471
3474
|
});
|
|
@@ -3708,6 +3711,143 @@ var PiiFieldRedactor = class {
|
|
|
3708
3711
|
return out;
|
|
3709
3712
|
}
|
|
3710
3713
|
};
|
|
3714
|
+
var REMOTE_PII_LOOKUP_TIMEOUT_MS = 3e3;
|
|
3715
|
+
var REFRESH_AFTER_MS = 5 * 6e4;
|
|
3716
|
+
var RETRY_AFTER_MS = 3e4;
|
|
3717
|
+
var STATE_KEY2 = /* @__PURE__ */ Symbol.for("raindrop.remotePiiConfig");
|
|
3718
|
+
function entries() {
|
|
3719
|
+
const holder = globalThis;
|
|
3720
|
+
let current = holder[STATE_KEY2];
|
|
3721
|
+
if (!current) {
|
|
3722
|
+
current = /* @__PURE__ */ new Map();
|
|
3723
|
+
holder[STATE_KEY2] = current;
|
|
3724
|
+
}
|
|
3725
|
+
return current;
|
|
3726
|
+
}
|
|
3727
|
+
function isRecord2(value) {
|
|
3728
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3729
|
+
}
|
|
3730
|
+
function baseUrlOf(endpoint) {
|
|
3731
|
+
return endpoint.endsWith("/") ? endpoint : `${endpoint}/`;
|
|
3732
|
+
}
|
|
3733
|
+
function cacheKey(endpoint, writeKey) {
|
|
3734
|
+
return `${baseUrlOf(endpoint)}
|
|
3735
|
+
${writeKey}`;
|
|
3736
|
+
}
|
|
3737
|
+
function parseAnswer(body) {
|
|
3738
|
+
if (!isRecord2(body)) return "unknown";
|
|
3739
|
+
if (!("pii" in body)) return "not_enrolled";
|
|
3740
|
+
const pii = body.pii;
|
|
3741
|
+
if (!isRecord2(pii)) return "unknown";
|
|
3742
|
+
return pii.redact === "on" || pii.redact === "off" ? pii.redact : "unknown";
|
|
3743
|
+
}
|
|
3744
|
+
async function lookup(baseUrl, writeKey) {
|
|
3745
|
+
if (typeof fetch !== "function") return void 0;
|
|
3746
|
+
const controller = typeof AbortController === "function" ? new AbortController() : void 0;
|
|
3747
|
+
const timer = setTimeout(() => controller == null ? void 0 : controller.abort(), REMOTE_PII_LOOKUP_TIMEOUT_MS);
|
|
3748
|
+
if (typeof timer === "object" && "unref" in timer) timer.unref();
|
|
3749
|
+
try {
|
|
3750
|
+
const response = await runWithTracingSuppressed(
|
|
3751
|
+
() => fetch(`${baseUrl}auth`, {
|
|
3752
|
+
method: "POST",
|
|
3753
|
+
headers: { Authorization: `Bearer ${writeKey}`, "Content-Type": "application/json" },
|
|
3754
|
+
body: "{}",
|
|
3755
|
+
signal: controller == null ? void 0 : controller.signal
|
|
3756
|
+
})
|
|
3757
|
+
);
|
|
3758
|
+
if (!response.ok) return void 0;
|
|
3759
|
+
const body = await response.json();
|
|
3760
|
+
return parseAnswer(body);
|
|
3761
|
+
} catch (e) {
|
|
3762
|
+
return void 0;
|
|
3763
|
+
} finally {
|
|
3764
|
+
clearTimeout(timer);
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
function entryFor(endpoint, writeKey) {
|
|
3768
|
+
const key = cacheKey(endpoint, writeKey);
|
|
3769
|
+
const all = entries();
|
|
3770
|
+
let entry = all.get(key);
|
|
3771
|
+
if (!entry) {
|
|
3772
|
+
entry = { known: void 0, pending: void 0, nextLookupAt: 0, settled: false };
|
|
3773
|
+
all.set(key, entry);
|
|
3774
|
+
}
|
|
3775
|
+
if (!entry.pending && Date.now() >= entry.nextLookupAt) {
|
|
3776
|
+
const current = entry;
|
|
3777
|
+
current.pending = lookup(baseUrlOf(endpoint), writeKey).then((answer) => {
|
|
3778
|
+
if (answer !== void 0) current.known = answer;
|
|
3779
|
+
current.nextLookupAt = Date.now() + (answer === void 0 ? RETRY_AFTER_MS : REFRESH_AFTER_MS);
|
|
3780
|
+
current.pending = void 0;
|
|
3781
|
+
current.settled = true;
|
|
3782
|
+
});
|
|
3783
|
+
}
|
|
3784
|
+
return entry;
|
|
3785
|
+
}
|
|
3786
|
+
function remotePiiAnswerNow(endpoint, writeKey) {
|
|
3787
|
+
const entry = entryFor(endpoint, writeKey);
|
|
3788
|
+
if (entry.known !== void 0) return entry.known;
|
|
3789
|
+
return entry.settled ? "unknown" : void 0;
|
|
3790
|
+
}
|
|
3791
|
+
async function remotePiiAnswer(endpoint, writeKey, deadlineAt) {
|
|
3792
|
+
var _a;
|
|
3793
|
+
const entry = entryFor(endpoint, writeKey);
|
|
3794
|
+
const now = remotePiiAnswerNow(endpoint, writeKey);
|
|
3795
|
+
if (now !== void 0 || !entry.pending) return now != null ? now : "unknown";
|
|
3796
|
+
const waitMs = Math.min(
|
|
3797
|
+
REMOTE_PII_LOOKUP_TIMEOUT_MS,
|
|
3798
|
+
deadlineAt === void 0 ? Infinity : Math.max(0, deadlineAt - Date.now())
|
|
3799
|
+
);
|
|
3800
|
+
let timer;
|
|
3801
|
+
await Promise.race([
|
|
3802
|
+
entry.pending,
|
|
3803
|
+
new Promise((resolve2) => {
|
|
3804
|
+
timer = setTimeout(resolve2, waitMs);
|
|
3805
|
+
})
|
|
3806
|
+
]);
|
|
3807
|
+
clearTimeout(timer);
|
|
3808
|
+
return (_a = entry.known) != null ? _a : "unknown";
|
|
3809
|
+
}
|
|
3810
|
+
function resolvePiiRedaction(local, remote, answer) {
|
|
3811
|
+
if (local !== void 0) return local;
|
|
3812
|
+
if (!remote) return false;
|
|
3813
|
+
if (answer === "on") return true;
|
|
3814
|
+
if (answer === "off" || answer === "not_enrolled") return false;
|
|
3815
|
+
const whenUnknown = typeof remote === "object" ? remote.whenUnknown : void 0;
|
|
3816
|
+
return whenUnknown !== "local";
|
|
3817
|
+
}
|
|
3818
|
+
function needsLookup(local, remote, writeKey) {
|
|
3819
|
+
return local === void 0 && Boolean(remote) && Boolean(writeKey);
|
|
3820
|
+
}
|
|
3821
|
+
function piiRedactionNow(local, remote, endpoint, writeKey) {
|
|
3822
|
+
if (!needsLookup(local, remote, writeKey)) return local === true;
|
|
3823
|
+
try {
|
|
3824
|
+
const answer = remotePiiAnswerNow(endpoint, writeKey);
|
|
3825
|
+
return answer === void 0 ? void 0 : resolvePiiRedaction(local, remote, answer);
|
|
3826
|
+
} catch (e) {
|
|
3827
|
+
return resolvePiiRedaction(local, remote, "unknown");
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
async function piiRedaction(local, remote, endpoint, writeKey, deadlineAt) {
|
|
3831
|
+
if (!needsLookup(local, remote, writeKey)) return local === true;
|
|
3832
|
+
try {
|
|
3833
|
+
return resolvePiiRedaction(local, remote, await remotePiiAnswer(endpoint, writeKey, deadlineAt));
|
|
3834
|
+
} catch (e) {
|
|
3835
|
+
return resolvePiiRedaction(local, remote, "unknown");
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
var LOCAL_TRACE_KEY = /* @__PURE__ */ Symbol.for("raindrop.localTracePiiRedaction");
|
|
3839
|
+
function localTraceKeys() {
|
|
3840
|
+
var _a;
|
|
3841
|
+
const holder = globalThis;
|
|
3842
|
+
(_a = holder[LOCAL_TRACE_KEY]) != null ? _a : holder[LOCAL_TRACE_KEY] = /* @__PURE__ */ new Set();
|
|
3843
|
+
return holder[LOCAL_TRACE_KEY];
|
|
3844
|
+
}
|
|
3845
|
+
function requestLocalTracePiiRedaction(endpoint, writeKey) {
|
|
3846
|
+
localTraceKeys().add(cacheKey(endpoint, writeKey != null ? writeKey : ""));
|
|
3847
|
+
}
|
|
3848
|
+
function localTracePiiRedactionRequested(endpoint, writeKey) {
|
|
3849
|
+
return localTraceKeys().has(cacheKey(endpoint, writeKey != null ? writeKey : ""));
|
|
3850
|
+
}
|
|
3711
3851
|
function detectRuntime() {
|
|
3712
3852
|
if (typeof process === "object" && process && typeof process.env === "object" && process.env && typeof process.version === "string") {
|
|
3713
3853
|
return "node";
|
|
@@ -3727,6 +3867,14 @@ function isMissingUserId(value) {
|
|
|
3727
3867
|
const trimmed = value.trim();
|
|
3728
3868
|
return trimmed === "" || PLACEHOLDER_USER_IDS.has(trimmed);
|
|
3729
3869
|
}
|
|
3870
|
+
function snapshotPayload(payload) {
|
|
3871
|
+
try {
|
|
3872
|
+
const json = JSON.stringify(payload);
|
|
3873
|
+
return json === void 0 ? payload : JSON.parse(json);
|
|
3874
|
+
} catch (e) {
|
|
3875
|
+
return payload;
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3730
3878
|
var MAX_DEFERRED_SENDS = 1e3;
|
|
3731
3879
|
var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
|
|
3732
3880
|
function appGitOwnerId(prefix) {
|
|
@@ -3833,7 +3981,7 @@ var EventShipper = class {
|
|
|
3833
3981
|
this.sendChains = /* @__PURE__ */ new Map();
|
|
3834
3982
|
this.deferredSends = /* @__PURE__ */ new Set();
|
|
3835
3983
|
this.hasShutdown = false;
|
|
3836
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
3984
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3837
3985
|
this.appGitContext = (_a = opts.appGitContext) != null ? _a : createAppGitContext(opts.appGit);
|
|
3838
3986
|
this.ownsAppGitContext = opts.appGitContext === void 0;
|
|
3839
3987
|
this.writeKey = (_b = opts.writeKey) == null ? void 0 : _b.trim();
|
|
@@ -3847,6 +3995,7 @@ var EventShipper = class {
|
|
|
3847
3995
|
this.maxTextFieldCharsOpt = opts.maxTextFieldChars;
|
|
3848
3996
|
this.flushTimeoutMs = resolveFlushTimeoutMs(opts.flushTimeoutMs);
|
|
3849
3997
|
this.localDebuggerUrl = (_g = resolveLocalDebuggerBaseUrl(opts.localDebuggerUrl)) != null ? _g : void 0;
|
|
3998
|
+
this.localDebuggerFollowRedirects = (_h = opts.localDebuggerFollowRedirects) != null ? _h : true;
|
|
3850
3999
|
if (this.debug && this.localDebuggerUrl) {
|
|
3851
4000
|
console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);
|
|
3852
4001
|
}
|
|
@@ -3854,12 +4003,15 @@ var EventShipper = class {
|
|
|
3854
4003
|
debug: this.debug,
|
|
3855
4004
|
prefix: this.prefix
|
|
3856
4005
|
});
|
|
3857
|
-
this.redactPii = opts.redactPii ===
|
|
4006
|
+
this.redactPii = typeof opts.redactPii === "boolean" ? opts.redactPii : void 0;
|
|
4007
|
+
this.remotePiiConfig = opts.remotePiiConfig;
|
|
3858
4008
|
this.piiFields = new PiiFieldRedactor({
|
|
3859
4009
|
startupFieldMap: opts.redactPiiFields,
|
|
3860
4010
|
logPrefix: this.prefix
|
|
3861
4011
|
});
|
|
3862
|
-
|
|
4012
|
+
const fields = opts.redactPiiFields;
|
|
4013
|
+
const hasPayloadFields = Boolean(fields && (fields.event || fields.signal || fields.identify));
|
|
4014
|
+
if (hasPayloadFields && this.redactPii !== true && !this.remotePiiConfig) {
|
|
3863
4015
|
rateLimitedLog(
|
|
3864
4016
|
`${this.prefix}.pii_fields_without_redaction`,
|
|
3865
4017
|
() => console.warn(
|
|
@@ -3871,8 +4023,8 @@ var EventShipper = class {
|
|
|
3871
4023
|
const runtime = detectRuntime();
|
|
3872
4024
|
this.context = {
|
|
3873
4025
|
library: {
|
|
3874
|
-
name: (
|
|
3875
|
-
version: (
|
|
4026
|
+
name: (_i = opts.libraryName) != null ? _i : "@raindrop-ai/core",
|
|
4027
|
+
version: (_j = opts.libraryVersion) != null ? _j : "0.0.0"
|
|
3876
4028
|
},
|
|
3877
4029
|
metadata: {
|
|
3878
4030
|
jsRuntime: runtime,
|
|
@@ -4213,7 +4365,7 @@ var EventShipper = class {
|
|
|
4213
4365
|
if (!this.enabled) return;
|
|
4214
4366
|
const destination = currentReplayTraceDestination();
|
|
4215
4367
|
if (destination && destination.kind !== "workshop") return;
|
|
4216
|
-
const
|
|
4368
|
+
const items = [
|
|
4217
4369
|
{
|
|
4218
4370
|
event_id: signal.eventId,
|
|
4219
4371
|
signal_name: signal.name,
|
|
@@ -4227,16 +4379,28 @@ var EventShipper = class {
|
|
|
4227
4379
|
...signal.after ? { after: signal.after } : {}
|
|
4228
4380
|
}
|
|
4229
4381
|
}
|
|
4230
|
-
]
|
|
4231
|
-
|
|
4232
|
-
|
|
4382
|
+
];
|
|
4383
|
+
const known = piiRedactionNow(this.redactPii, this.remotePiiConfig, this.baseUrl, this.writeKey);
|
|
4384
|
+
if (known !== void 0) {
|
|
4385
|
+
const body = known ? items.map((item) => this.piiFields.redact("signal", item)) : items;
|
|
4386
|
+
if (!this.writeKey) return;
|
|
4387
|
+
await this.sendDirect("signal", `${this.baseUrl}signals/track`, body);
|
|
4388
|
+
return;
|
|
4389
|
+
}
|
|
4390
|
+
const snapshot = items.map(snapshotPayload);
|
|
4391
|
+
await this.tracked(async () => {
|
|
4392
|
+
const redact = await this.shouldRedactPii();
|
|
4393
|
+
const body = redact ? snapshot.map((item) => this.piiFields.redact("signal", item)) : snapshot;
|
|
4394
|
+
if (!this.writeKey) return;
|
|
4395
|
+
await this.sendDirect("signal", `${this.baseUrl}signals/track`, body, void 0, false);
|
|
4396
|
+
});
|
|
4233
4397
|
}
|
|
4234
4398
|
async identify(users) {
|
|
4235
4399
|
if (!this.enabled) return;
|
|
4236
4400
|
const destination = currentReplayTraceDestination();
|
|
4237
4401
|
if (destination && destination.kind !== "workshop") return;
|
|
4238
4402
|
const list = Array.isArray(users) ? users : [users];
|
|
4239
|
-
const
|
|
4403
|
+
const rows = list.filter((user) => {
|
|
4240
4404
|
if (!(user == null ? void 0 : user.userId) || !user.userId.trim()) {
|
|
4241
4405
|
if (this.debug) {
|
|
4242
4406
|
console.warn(`${this.prefix} skipping identify: missing userId`);
|
|
@@ -4244,24 +4408,34 @@ var EventShipper = class {
|
|
|
4244
4408
|
return false;
|
|
4245
4409
|
}
|
|
4246
4410
|
return true;
|
|
4247
|
-
}).map(
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
}
|
|
4255
|
-
);
|
|
4411
|
+
}).map((user) => {
|
|
4412
|
+
var _a;
|
|
4413
|
+
return {
|
|
4414
|
+
user_id: user.userId,
|
|
4415
|
+
traits: (_a = user.traits) != null ? _a : {}
|
|
4416
|
+
};
|
|
4417
|
+
});
|
|
4256
4418
|
if (!this.writeKey) return;
|
|
4257
|
-
if (
|
|
4258
|
-
|
|
4419
|
+
if (rows.length === 0) return;
|
|
4420
|
+
const known = piiRedactionNow(this.redactPii, this.remotePiiConfig, this.baseUrl, this.writeKey);
|
|
4421
|
+
if (known !== void 0) {
|
|
4422
|
+
const body = known ? rows.map((user) => this.piiFields.redact("identify", user)) : rows;
|
|
4423
|
+
await this.sendDirect("identify", `${this.baseUrl}users/identify`, body);
|
|
4424
|
+
return;
|
|
4425
|
+
}
|
|
4426
|
+
const snapshot = rows.map(snapshotPayload);
|
|
4427
|
+
await this.tracked(async () => {
|
|
4428
|
+
const redact = await this.shouldRedactPii();
|
|
4429
|
+
const body = redact ? snapshot.map((user) => this.piiFields.redact("identify", user)) : snapshot;
|
|
4430
|
+
await this.sendDirect("identify", `${this.baseUrl}users/identify`, body, void 0, false);
|
|
4431
|
+
});
|
|
4259
4432
|
}
|
|
4260
4433
|
/**
|
|
4261
|
-
* Send a signal or identify body. Tracked so `flush()` waits for it
|
|
4262
|
-
*
|
|
4434
|
+
* Send a signal or identify body. Tracked so `flush()` waits for it, unless
|
|
4435
|
+
* the caller already tracks it (`track: false`). A send a flush deadline
|
|
4436
|
+
* deferred is kept and retried later (outside shutdown).
|
|
4263
4437
|
*/
|
|
4264
|
-
async sendDirect(kind, url, body, deadlineAt) {
|
|
4438
|
+
async sendDirect(kind, url, body, deadlineAt, track = true) {
|
|
4265
4439
|
const opts = this.requestOpts(deadlineAt);
|
|
4266
4440
|
if (!opts) {
|
|
4267
4441
|
this.warnShutdownDrop(kind);
|
|
@@ -4269,7 +4443,7 @@ var EventShipper = class {
|
|
|
4269
4443
|
}
|
|
4270
4444
|
const sending = sendJson(url, body, this.requestHeaders(), opts);
|
|
4271
4445
|
const tracked = sending.then(() => void 0);
|
|
4272
|
-
this.inFlight.add(tracked);
|
|
4446
|
+
if (track) this.inFlight.add(tracked);
|
|
4273
4447
|
let outcome;
|
|
4274
4448
|
try {
|
|
4275
4449
|
outcome = await sending;
|
|
@@ -4315,9 +4489,36 @@ var EventShipper = class {
|
|
|
4315
4489
|
() => console.warn(`${this.prefix} failed to send ${what} (dropping): ${reason}`)
|
|
4316
4490
|
);
|
|
4317
4491
|
}
|
|
4318
|
-
/**
|
|
4319
|
-
|
|
4320
|
-
|
|
4492
|
+
/**
|
|
4493
|
+
* Whether to redact PII: `redactPii`, or when it is unset and
|
|
4494
|
+
* `remotePiiConfig` is on, the org's setting. Waits for the org's answer
|
|
4495
|
+
* before the first send, never past `deadlineAt`.
|
|
4496
|
+
*/
|
|
4497
|
+
async shouldRedactPii(deadlineAt) {
|
|
4498
|
+
return piiRedaction(
|
|
4499
|
+
this.redactPii,
|
|
4500
|
+
this.remotePiiConfig,
|
|
4501
|
+
this.baseUrl,
|
|
4502
|
+
this.writeKey,
|
|
4503
|
+
deadlineAt != null ? deadlineAt : this.shutdownDeadlineAt
|
|
4504
|
+
);
|
|
4505
|
+
}
|
|
4506
|
+
/**
|
|
4507
|
+
* Runs `work` (the org lookup, then one `sendDirect` with `track: false`)
|
|
4508
|
+
* as one in-flight send, so a `flush()` started meanwhile waits for both.
|
|
4509
|
+
*/
|
|
4510
|
+
async tracked(work) {
|
|
4511
|
+
const running = Promise.resolve().then(work);
|
|
4512
|
+
const done = running.then(
|
|
4513
|
+
() => void 0,
|
|
4514
|
+
() => void 0
|
|
4515
|
+
);
|
|
4516
|
+
this.inFlight.add(done);
|
|
4517
|
+
try {
|
|
4518
|
+
await running;
|
|
4519
|
+
} finally {
|
|
4520
|
+
this.inFlight.delete(done);
|
|
4521
|
+
}
|
|
4321
4522
|
}
|
|
4322
4523
|
warnShutdownDrop(what) {
|
|
4323
4524
|
rateLimitedLog(
|
|
@@ -4382,7 +4583,7 @@ var EventShipper = class {
|
|
|
4382
4583
|
return "queued";
|
|
4383
4584
|
}
|
|
4384
4585
|
async sendAccumulated(eventId, accumulated, deadlineAt) {
|
|
4385
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
4586
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4386
4587
|
const sticky = (_a = this.sticky.get(eventId)) != null ? _a : {};
|
|
4387
4588
|
const isPending = (_c = (_b = accumulated.isPending) != null ? _b : sticky.isPending) != null ? _c : true;
|
|
4388
4589
|
const knownEventName = (_d = accumulated.eventName) != null ? _d : sticky.eventName;
|
|
@@ -4438,7 +4639,37 @@ var EventShipper = class {
|
|
|
4438
4639
|
attachments: accumulated.attachments,
|
|
4439
4640
|
is_pending: isPending
|
|
4440
4641
|
};
|
|
4441
|
-
const
|
|
4642
|
+
const known = piiRedactionNow(this.redactPii, this.remotePiiConfig, this.baseUrl, this.writeKey);
|
|
4643
|
+
if (known !== void 0) {
|
|
4644
|
+
const payload = known ? this.piiFields.redact("event", unredacted) : unredacted;
|
|
4645
|
+
return this.shipPartial(eventId, accumulated, payload, { eventName, userId, convoId, isPending }, deadlineAt, true);
|
|
4646
|
+
}
|
|
4647
|
+
const snapshot = snapshotPayload(unredacted);
|
|
4648
|
+
const running = this.shouldRedactPii(deadlineAt).then(
|
|
4649
|
+
(redact) => this.shipPartial(
|
|
4650
|
+
eventId,
|
|
4651
|
+
accumulated,
|
|
4652
|
+
redact ? this.piiFields.redact("event", snapshot) : snapshot,
|
|
4653
|
+
{ eventName, userId, convoId, isPending },
|
|
4654
|
+
deadlineAt,
|
|
4655
|
+
false
|
|
4656
|
+
)
|
|
4657
|
+
);
|
|
4658
|
+
const done = running.then(
|
|
4659
|
+
() => void 0,
|
|
4660
|
+
() => void 0
|
|
4661
|
+
);
|
|
4662
|
+
this.inFlight.add(done);
|
|
4663
|
+
try {
|
|
4664
|
+
return await running;
|
|
4665
|
+
} finally {
|
|
4666
|
+
this.inFlight.delete(done);
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
/** Sends one redacted partial payload; `track: false` when the caller already tracks it. */
|
|
4670
|
+
async shipPartial(eventId, accumulated, payload, meta, deadlineAt, track) {
|
|
4671
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4672
|
+
const { eventName, userId, convoId, isPending } = meta;
|
|
4442
4673
|
const url = `${this.baseUrl}events/track_partial`;
|
|
4443
4674
|
if (this.debug) {
|
|
4444
4675
|
const sent = payload;
|
|
@@ -4449,20 +4680,21 @@ var EventShipper = class {
|
|
|
4449
4680
|
userId,
|
|
4450
4681
|
convoId,
|
|
4451
4682
|
isPending,
|
|
4452
|
-
inputPreview: preview((
|
|
4453
|
-
outputPreview: preview((
|
|
4454
|
-
attachments: (
|
|
4455
|
-
attachmentKinds: (
|
|
4683
|
+
inputPreview: preview((_a = sent.ai_data) == null ? void 0 : _a.input, 120),
|
|
4684
|
+
outputPreview: preview((_b = sent.ai_data) == null ? void 0 : _b.output, 120),
|
|
4685
|
+
attachments: (_d = (_c = sent.attachments) == null ? void 0 : _c.length) != null ? _d : 0,
|
|
4686
|
+
attachmentKinds: (_f = (_e = sent.attachments) == null ? void 0 : _e.map((a) => ({
|
|
4456
4687
|
type: a.type,
|
|
4457
4688
|
role: a.role,
|
|
4458
4689
|
name: a.name,
|
|
4459
4690
|
valuePreview: preview(a.value, 60)
|
|
4460
|
-
}))) != null ?
|
|
4691
|
+
}))) != null ? _f : [],
|
|
4461
4692
|
endpoint: url
|
|
4462
4693
|
});
|
|
4463
4694
|
}
|
|
4464
4695
|
const mirror = this.localDebuggerUrl ? mirrorPartialEventToLocalDebugger(payload, {
|
|
4465
4696
|
baseUrl: this.localDebuggerUrl,
|
|
4697
|
+
followRedirects: this.localDebuggerFollowRedirects,
|
|
4466
4698
|
writeKey: this.writeKey,
|
|
4467
4699
|
debug: this.debug,
|
|
4468
4700
|
sdkName: this.sdkName
|
|
@@ -4481,7 +4713,7 @@ var EventShipper = class {
|
|
|
4481
4713
|
}
|
|
4482
4714
|
const sending = sendJson(url, payload, this.requestHeaders(), opts);
|
|
4483
4715
|
const combined = Promise.all([mirror, sending.then(() => void 0)]).then(() => void 0);
|
|
4484
|
-
this.inFlight.add(combined);
|
|
4716
|
+
if (track) this.inFlight.add(combined);
|
|
4485
4717
|
let outcome;
|
|
4486
4718
|
try {
|
|
4487
4719
|
outcome = await sending;
|
|
@@ -4677,6 +4909,211 @@ var DEFAULT_REDACT_ATTRIBUTE_KEYS = [
|
|
|
4677
4909
|
"ai.response.providerMetadata"
|
|
4678
4910
|
];
|
|
4679
4911
|
var REDACT_JSON_ATTRIBUTE_KEYS = new Set(DEFAULT_REDACT_ATTRIBUTE_KEYS);
|
|
4912
|
+
var CONTENT_KEY_SUFFIX = /(^|\.)(input|output|inputs|outputs|args|arguments|result|results|content|text|messages|prompt|completion|instructions|system_instructions|reasoning|reasoningText|thinking|toolCalls|tool_calls|object|value|values|intent|query|tool_input)$/;
|
|
4913
|
+
var CONTENT_KEYS = /* @__PURE__ */ new Set([
|
|
4914
|
+
"ai.prompt.system",
|
|
4915
|
+
"ai.subagent.result",
|
|
4916
|
+
"agent.session.title",
|
|
4917
|
+
// Failed tool calls carry the tool's output in their error text.
|
|
4918
|
+
"error.message",
|
|
4919
|
+
"exception.message",
|
|
4920
|
+
"exception.stacktrace"
|
|
4921
|
+
]);
|
|
4922
|
+
var NON_CONTENT_PREFIXES = [
|
|
4923
|
+
"traceloop.association.properties.",
|
|
4924
|
+
"ai.telemetry.metadata.",
|
|
4925
|
+
"ai.settings.context.",
|
|
4926
|
+
"raindrop.app."
|
|
4927
|
+
];
|
|
4928
|
+
var JSON_SIMPLE_ESCAPES = {
|
|
4929
|
+
'"': '"',
|
|
4930
|
+
"\\": "\\",
|
|
4931
|
+
"/": "/",
|
|
4932
|
+
b: "\b",
|
|
4933
|
+
f: "\f",
|
|
4934
|
+
n: "\n",
|
|
4935
|
+
r: "\r",
|
|
4936
|
+
t: " "
|
|
4937
|
+
};
|
|
4938
|
+
function decodeJsonEscapes(text) {
|
|
4939
|
+
if (!text.includes("\\")) return text;
|
|
4940
|
+
let out = "";
|
|
4941
|
+
for (let i = 0; i < text.length; i++) {
|
|
4942
|
+
const ch = text[i];
|
|
4943
|
+
if (ch !== "\\" || i + 1 >= text.length) {
|
|
4944
|
+
out += ch;
|
|
4945
|
+
continue;
|
|
4946
|
+
}
|
|
4947
|
+
const next = text[i + 1];
|
|
4948
|
+
const simple = JSON_SIMPLE_ESCAPES[next];
|
|
4949
|
+
if (simple !== void 0) {
|
|
4950
|
+
out += simple;
|
|
4951
|
+
i += 1;
|
|
4952
|
+
} else if (next === "u" && /^[0-9a-fA-F]{4}$/.test(text.slice(i + 2, i + 6))) {
|
|
4953
|
+
out += String.fromCharCode(Number.parseInt(text.slice(i + 2, i + 6), 16));
|
|
4954
|
+
i += 5;
|
|
4955
|
+
} else {
|
|
4956
|
+
out += ch;
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
return out;
|
|
4960
|
+
}
|
|
4961
|
+
function jsonStringBody(value) {
|
|
4962
|
+
return JSON.stringify(value).slice(1, -1);
|
|
4963
|
+
}
|
|
4964
|
+
function redactStringToken(token) {
|
|
4965
|
+
const decoded = decodeJsonEscapes(token.slice(1, -1));
|
|
4966
|
+
const redacted = redactPiiText(decoded);
|
|
4967
|
+
return redacted === decoded ? token : `"${jsonStringBody(redacted)}"`;
|
|
4968
|
+
}
|
|
4969
|
+
function redactLooseJsonText(text) {
|
|
4970
|
+
if (text.startsWith('"')) {
|
|
4971
|
+
const decoded2 = decodeJsonEscapes(text.slice(1));
|
|
4972
|
+
const redacted2 = redactPiiText(decoded2);
|
|
4973
|
+
return redacted2 === decoded2 ? text : `"${jsonStringBody(redacted2)}`;
|
|
4974
|
+
}
|
|
4975
|
+
const decoded = decodeJsonEscapes(text);
|
|
4976
|
+
const redacted = redactPiiText(decoded);
|
|
4977
|
+
return redacted === decoded ? text : redacted;
|
|
4978
|
+
}
|
|
4979
|
+
function stringTokenEnd(text, start) {
|
|
4980
|
+
for (let i = start + 1; i < text.length; i++) {
|
|
4981
|
+
const ch = text[i];
|
|
4982
|
+
if (ch === "\\") i += 1;
|
|
4983
|
+
else if (ch === '"') return i + 1;
|
|
4984
|
+
}
|
|
4985
|
+
return -1;
|
|
4986
|
+
}
|
|
4987
|
+
function redactJsonLike(text, complete) {
|
|
4988
|
+
let out = "";
|
|
4989
|
+
let looseStart = 0;
|
|
4990
|
+
const flushLoose = (end) => {
|
|
4991
|
+
if (end > looseStart) {
|
|
4992
|
+
const loose = text.slice(looseStart, end);
|
|
4993
|
+
out += complete ? loose : redactLooseJsonText(loose);
|
|
4994
|
+
}
|
|
4995
|
+
};
|
|
4996
|
+
let i = text.indexOf('"');
|
|
4997
|
+
while (i !== -1) {
|
|
4998
|
+
const end = stringTokenEnd(text, i);
|
|
4999
|
+
if (end === -1) break;
|
|
5000
|
+
flushLoose(i);
|
|
5001
|
+
let after = end;
|
|
5002
|
+
while (after < text.length && /\s/.test(text[after])) after += 1;
|
|
5003
|
+
const token = text.slice(i, end);
|
|
5004
|
+
out += complete && text[after] === ":" ? token : redactStringToken(token);
|
|
5005
|
+
looseStart = end;
|
|
5006
|
+
i = text.indexOf('"', end);
|
|
5007
|
+
}
|
|
5008
|
+
if (i === -1) {
|
|
5009
|
+
flushLoose(text.length);
|
|
5010
|
+
} else {
|
|
5011
|
+
flushLoose(i);
|
|
5012
|
+
looseStart = i;
|
|
5013
|
+
flushLoose(text.length);
|
|
5014
|
+
}
|
|
5015
|
+
return out;
|
|
5016
|
+
}
|
|
5017
|
+
function redactSpanContent(text) {
|
|
5018
|
+
const head = text.trimStart()[0];
|
|
5019
|
+
if (head !== "{" && head !== "[" && head !== '"') return redactPiiText(text);
|
|
5020
|
+
let complete = true;
|
|
5021
|
+
try {
|
|
5022
|
+
JSON.parse(text);
|
|
5023
|
+
} catch (e) {
|
|
5024
|
+
complete = false;
|
|
5025
|
+
}
|
|
5026
|
+
return redactJsonLike(text, complete);
|
|
5027
|
+
}
|
|
5028
|
+
var NO_SPAN_PII_FIELDS = { exact: /* @__PURE__ */ new Set(), prefixes: [] };
|
|
5029
|
+
function compileSpanPiiFields(names, logPrefix = "[raindrop-ai/core]") {
|
|
5030
|
+
if (!Array.isArray(names) || names.length === 0) return NO_SPAN_PII_FIELDS;
|
|
5031
|
+
const exact = /* @__PURE__ */ new Set();
|
|
5032
|
+
const prefixes = [];
|
|
5033
|
+
for (const name of names) {
|
|
5034
|
+
const valid = typeof name === "string" && !/\s/.test(name) && /^[^*]+\*?$/.test(name);
|
|
5035
|
+
if (!valid) {
|
|
5036
|
+
rateLimitedLog(
|
|
5037
|
+
`${logPrefix}.pii_span_field_invalid`,
|
|
5038
|
+
() => console.warn(
|
|
5039
|
+
`${logPrefix} redactPiiFields: ignoring invalid span attribute ${JSON.stringify(name)}`
|
|
5040
|
+
)
|
|
5041
|
+
);
|
|
5042
|
+
continue;
|
|
5043
|
+
}
|
|
5044
|
+
if (name.endsWith("*")) prefixes.push(name.slice(0, -1));
|
|
5045
|
+
else exact.add(name);
|
|
5046
|
+
}
|
|
5047
|
+
return { exact, prefixes };
|
|
5048
|
+
}
|
|
5049
|
+
function isCallerSelected(key, fields) {
|
|
5050
|
+
return fields.exact.has(key) || fields.prefixes.some((prefix) => key.startsWith(prefix));
|
|
5051
|
+
}
|
|
5052
|
+
function isSpanContentAttributeKey(key, fields = NO_SPAN_PII_FIELDS) {
|
|
5053
|
+
if (isCallerSelected(key, fields)) return true;
|
|
5054
|
+
if (NON_CONTENT_PREFIXES.some((prefix) => key.startsWith(prefix))) return false;
|
|
5055
|
+
return CONTENT_KEYS.has(key) || CONTENT_KEY_SUFFIX.test(key);
|
|
5056
|
+
}
|
|
5057
|
+
function redactOtlpValue(value) {
|
|
5058
|
+
var _a;
|
|
5059
|
+
if (typeof value.stringValue === "string") {
|
|
5060
|
+
const redacted = redactSpanContent(value.stringValue);
|
|
5061
|
+
return redacted === value.stringValue ? value : { ...value, stringValue: redacted };
|
|
5062
|
+
}
|
|
5063
|
+
const values = (_a = value.arrayValue) == null ? void 0 : _a.values;
|
|
5064
|
+
if (!values) return value;
|
|
5065
|
+
let changed = false;
|
|
5066
|
+
const next = values.map((item) => {
|
|
5067
|
+
const redacted = redactOtlpValue(item);
|
|
5068
|
+
if (redacted !== item) changed = true;
|
|
5069
|
+
return redacted;
|
|
5070
|
+
});
|
|
5071
|
+
return changed ? { ...value, arrayValue: { values: next } } : value;
|
|
5072
|
+
}
|
|
5073
|
+
function redactPiiInOtlpAttributes(attributes, fields = NO_SPAN_PII_FIELDS) {
|
|
5074
|
+
let next;
|
|
5075
|
+
for (let i = 0; i < attributes.length; i++) {
|
|
5076
|
+
const attr = attributes[i];
|
|
5077
|
+
if (!attr.value || !isSpanContentAttributeKey(attr.key, fields)) continue;
|
|
5078
|
+
const value = redactOtlpValue(attr.value);
|
|
5079
|
+
if (value === attr.value) continue;
|
|
5080
|
+
next != null ? next : next = attributes.slice();
|
|
5081
|
+
next[i] = { ...attr, value };
|
|
5082
|
+
}
|
|
5083
|
+
return next != null ? next : attributes;
|
|
5084
|
+
}
|
|
5085
|
+
function redactPiiInOtlpSpan(span, fields = NO_SPAN_PII_FIELDS) {
|
|
5086
|
+
var _a;
|
|
5087
|
+
const attributes = span.attributes && redactPiiInOtlpAttributes(span.attributes, fields);
|
|
5088
|
+
const message = (_a = span.status) == null ? void 0 : _a.message;
|
|
5089
|
+
const redactedMessage = message === void 0 ? void 0 : redactSpanContent(message);
|
|
5090
|
+
if (attributes === span.attributes && redactedMessage === message) return span;
|
|
5091
|
+
const status = span.status && redactedMessage !== message ? { ...span.status, message: redactedMessage } : span.status;
|
|
5092
|
+
return { ...span, attributes, status };
|
|
5093
|
+
}
|
|
5094
|
+
function redactPiiInAttributeMap(attributes, fields = NO_SPAN_PII_FIELDS) {
|
|
5095
|
+
let next;
|
|
5096
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
5097
|
+
if (!isSpanContentAttributeKey(key, fields)) continue;
|
|
5098
|
+
let redacted = value;
|
|
5099
|
+
if (typeof value === "string") {
|
|
5100
|
+
redacted = redactSpanContent(value);
|
|
5101
|
+
} else if (Array.isArray(value)) {
|
|
5102
|
+
let changed = false;
|
|
5103
|
+
const items = value.map((item) => {
|
|
5104
|
+
if (typeof item !== "string") return item;
|
|
5105
|
+
const out = redactSpanContent(item);
|
|
5106
|
+
if (out !== item) changed = true;
|
|
5107
|
+
return out;
|
|
5108
|
+
});
|
|
5109
|
+
if (changed) redacted = items;
|
|
5110
|
+
}
|
|
5111
|
+
if (redacted === value) continue;
|
|
5112
|
+
next != null ? next : next = { ...attributes };
|
|
5113
|
+
next[key] = redacted;
|
|
5114
|
+
}
|
|
5115
|
+
return next;
|
|
5116
|
+
}
|
|
4680
5117
|
var UNDELIVERED = Object.freeze({
|
|
4681
5118
|
delivered: false,
|
|
4682
5119
|
timedOut: false,
|
|
@@ -4685,7 +5122,7 @@ var UNDELIVERED = Object.freeze({
|
|
|
4685
5122
|
inFlight: 0
|
|
4686
5123
|
});
|
|
4687
5124
|
var PROMPT_TOOLS_ATTRIBUTE = "ai.prompt.tools";
|
|
4688
|
-
function
|
|
5125
|
+
function isRecord4(value) {
|
|
4689
5126
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4690
5127
|
}
|
|
4691
5128
|
var JSON_SCHEMA_KEYS = [
|
|
@@ -4703,17 +5140,17 @@ var JSON_SCHEMA_KEYS = [
|
|
|
4703
5140
|
"required"
|
|
4704
5141
|
];
|
|
4705
5142
|
function isJsonSchema(value) {
|
|
4706
|
-
if (!
|
|
5143
|
+
if (!isRecord4(value)) return false;
|
|
4707
5144
|
if (typeof value["~standard"] === "object") return false;
|
|
4708
|
-
if (
|
|
5145
|
+
if (isRecord4(value._def) || isRecord4(value._zod)) return false;
|
|
4709
5146
|
if (Object.keys(value).length === 0) return true;
|
|
4710
5147
|
return JSON_SCHEMA_KEYS.some((key) => key in value);
|
|
4711
5148
|
}
|
|
4712
5149
|
function toJsonSchema(value, options) {
|
|
4713
5150
|
if (value === void 0 || value === null) return void 0;
|
|
4714
5151
|
if (isJsonSchema(value)) return value;
|
|
4715
|
-
if (
|
|
4716
|
-
if (
|
|
5152
|
+
if (isRecord4(value) && isJsonSchema(value.jsonSchema)) return value.jsonSchema;
|
|
5153
|
+
if (isRecord4(value) && isJsonSchema(value.json)) return value.json;
|
|
4717
5154
|
if (options == null ? void 0 : options.schema) {
|
|
4718
5155
|
try {
|
|
4719
5156
|
return options.schema(value);
|
|
@@ -4736,23 +5173,23 @@ function functionTool(name, description, schema, options) {
|
|
|
4736
5173
|
}
|
|
4737
5174
|
function normalizeToolDeclaration(tool, options, fallbackName) {
|
|
4738
5175
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4739
|
-
if (!
|
|
5176
|
+
if (!isRecord4(tool)) return void 0;
|
|
4740
5177
|
if (tool.type === "provider-defined" || tool.type === "provider") {
|
|
4741
5178
|
const name2 = (_b = (_a = pickString(tool.name)) != null ? _a : pickString(tool.id)) != null ? _b : fallbackName;
|
|
4742
5179
|
if (name2 === void 0) return void 0;
|
|
4743
5180
|
const declaration = { type: "provider-defined", name: name2 };
|
|
4744
5181
|
const id = pickString(tool.id);
|
|
4745
5182
|
if (id !== void 0) declaration.id = id;
|
|
4746
|
-
if (
|
|
5183
|
+
if (isRecord4(tool.args)) declaration.args = tool.args;
|
|
4747
5184
|
return declaration;
|
|
4748
5185
|
}
|
|
4749
|
-
if (
|
|
5186
|
+
if (isRecord4(tool.toolSpec)) {
|
|
4750
5187
|
const spec = tool.toolSpec;
|
|
4751
5188
|
const name2 = (_c = pickString(spec.name)) != null ? _c : fallbackName;
|
|
4752
5189
|
if (name2 === void 0) return void 0;
|
|
4753
5190
|
return functionTool(name2, spec.description, spec.inputSchema, options);
|
|
4754
5191
|
}
|
|
4755
|
-
if (
|
|
5192
|
+
if (isRecord4(tool.function)) {
|
|
4756
5193
|
const fn = tool.function;
|
|
4757
5194
|
const name2 = (_d = pickString(fn.name)) != null ? _d : fallbackName;
|
|
4758
5195
|
if (name2 === void 0) return void 0;
|
|
@@ -4778,7 +5215,7 @@ function isGeminiToolGroup(tool) {
|
|
|
4778
5215
|
if (Array.isArray(tool.functionDeclarations)) return true;
|
|
4779
5216
|
const keys = Object.keys(tool);
|
|
4780
5217
|
if (keys.length === 0 || NOT_A_GEMINI_GROUP_KEYS.some((key) => key in tool)) return false;
|
|
4781
|
-
return keys.every((key) =>
|
|
5218
|
+
return keys.every((key) => isRecord4(tool[key]));
|
|
4782
5219
|
}
|
|
4783
5220
|
function expandGeminiTool(tool, options) {
|
|
4784
5221
|
const declarations = [];
|
|
@@ -4788,7 +5225,7 @@ function expandGeminiTool(tool, options) {
|
|
|
4788
5225
|
const normalized = normalizeToolDeclaration(declaration, options);
|
|
4789
5226
|
if (normalized) declarations.push(normalized);
|
|
4790
5227
|
}
|
|
4791
|
-
} else if (
|
|
5228
|
+
} else if (isRecord4(value)) {
|
|
4792
5229
|
declarations.push({ type: "provider-defined", id: key, name: key, args: value });
|
|
4793
5230
|
}
|
|
4794
5231
|
}
|
|
@@ -4798,14 +5235,14 @@ function normalizeToolDeclarations(tools, options) {
|
|
|
4798
5235
|
if (tools === void 0 || tools === null) return void 0;
|
|
4799
5236
|
if (Array.isArray(tools)) {
|
|
4800
5237
|
return tools.flatMap((tool) => {
|
|
4801
|
-
if (
|
|
5238
|
+
if (isRecord4(tool) && isGeminiToolGroup(tool)) {
|
|
4802
5239
|
return expandGeminiTool(tool, options);
|
|
4803
5240
|
}
|
|
4804
5241
|
const declaration = normalizeToolDeclaration(tool, options);
|
|
4805
5242
|
return declaration ? [declaration] : [];
|
|
4806
5243
|
});
|
|
4807
5244
|
}
|
|
4808
|
-
if (!
|
|
5245
|
+
if (!isRecord4(tools)) return void 0;
|
|
4809
5246
|
return Object.entries(tools).flatMap(([key, tool]) => {
|
|
4810
5247
|
const declaration = normalizeToolDeclaration(tool, options, key);
|
|
4811
5248
|
return declaration ? [declaration] : [];
|
|
@@ -9134,7 +9571,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
9134
9571
|
// package.json
|
|
9135
9572
|
var package_default = {
|
|
9136
9573
|
name: "raindrop-ai",
|
|
9137
|
-
version: "1.0.
|
|
9574
|
+
version: "1.0.8",
|
|
9138
9575
|
main: "dist/index.js",
|
|
9139
9576
|
module: "dist/index.mjs",
|
|
9140
9577
|
types: "dist/index.d.ts",
|
|
@@ -9429,10 +9866,10 @@ function authHintForKey(writeKey) {
|
|
|
9429
9866
|
if (!writeKey) return void 0;
|
|
9430
9867
|
return (0, import_node_crypto.createHash)("sha256").update(writeKey, "utf8").digest("hex").slice(0, 8);
|
|
9431
9868
|
}
|
|
9432
|
-
var
|
|
9869
|
+
var STATE_KEY3 = /* @__PURE__ */ Symbol.for("raindrop.tracing.multiProjectState");
|
|
9433
9870
|
function getState() {
|
|
9434
9871
|
const holder = globalThis;
|
|
9435
|
-
let state2 = holder[
|
|
9872
|
+
let state2 = holder[STATE_KEY3];
|
|
9436
9873
|
if (!state2) {
|
|
9437
9874
|
state2 = {
|
|
9438
9875
|
foreignClientSeen: false,
|
|
@@ -9444,7 +9881,7 @@ function getState() {
|
|
|
9444
9881
|
multiKeyWarned: false,
|
|
9445
9882
|
pendingMultiKeyWarning: false
|
|
9446
9883
|
};
|
|
9447
|
-
holder[
|
|
9884
|
+
holder[STATE_KEY3] = state2;
|
|
9448
9885
|
}
|
|
9449
9886
|
return state2;
|
|
9450
9887
|
}
|
|
@@ -9672,11 +10109,8 @@ var import_instrumentation_together = require("@traceloop/instrumentation-togeth
|
|
|
9672
10109
|
var import_instrumentation_vertexai = require("@traceloop/instrumentation-vertexai");
|
|
9673
10110
|
var import_weakref = require("weakref");
|
|
9674
10111
|
|
|
9675
|
-
// src/tracing/direct/
|
|
9676
|
-
|
|
9677
|
-
if (!endpoint) return void 0;
|
|
9678
|
-
return endpoint.endsWith("/") ? endpoint : `${endpoint}/`;
|
|
9679
|
-
}
|
|
10112
|
+
// src/tracing/direct/context.ts
|
|
10113
|
+
var import_api = require("@opentelemetry/api");
|
|
9680
10114
|
|
|
9681
10115
|
// src/tracing/direct/ids.ts
|
|
9682
10116
|
function getCrypto2() {
|
|
@@ -9739,6 +10173,55 @@ function base64ToHex2(base64) {
|
|
|
9739
10173
|
throw new Error("No base64 decoder available in this runtime");
|
|
9740
10174
|
}
|
|
9741
10175
|
|
|
10176
|
+
// src/tracing/direct/context.ts
|
|
10177
|
+
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
10178
|
+
var INVALID_SPAN_ID = "0000000000000000";
|
|
10179
|
+
function hexToBase64(hex) {
|
|
10180
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
10181
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
10182
|
+
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
10183
|
+
}
|
|
10184
|
+
return base64Encode2(bytes);
|
|
10185
|
+
}
|
|
10186
|
+
function getExplicitTraceContext(traceId, parentSpanId) {
|
|
10187
|
+
if (!traceId || !parentSpanId || !(0, import_api.isValidTraceId)(traceId) || !(0, import_api.isValidSpanId)(parentSpanId)) {
|
|
10188
|
+
return void 0;
|
|
10189
|
+
}
|
|
10190
|
+
return {
|
|
10191
|
+
traceIdB64: hexToBase64(traceId),
|
|
10192
|
+
parentSpanIdB64: hexToBase64(parentSpanId)
|
|
10193
|
+
};
|
|
10194
|
+
}
|
|
10195
|
+
function getActiveTraceContext() {
|
|
10196
|
+
const activeSpan = import_api.trace.getSpan(import_api.context.active());
|
|
10197
|
+
if (!activeSpan) return {};
|
|
10198
|
+
const spanContext = activeSpan.spanContext();
|
|
10199
|
+
const traceIdHex = spanContext.traceId;
|
|
10200
|
+
const spanIdHex = spanContext.spanId;
|
|
10201
|
+
if (traceIdHex === INVALID_TRACE_ID) return {};
|
|
10202
|
+
return {
|
|
10203
|
+
traceIdB64: hexToBase64(traceIdHex),
|
|
10204
|
+
parentSpanIdB64: spanIdHex !== INVALID_SPAN_ID ? hexToBase64(spanIdHex) : void 0
|
|
10205
|
+
};
|
|
10206
|
+
}
|
|
10207
|
+
function savedParentContext(traceId, parentSpanId) {
|
|
10208
|
+
if (!traceId || !parentSpanId || !(0, import_api.isValidTraceId)(traceId) || !(0, import_api.isValidSpanId)(parentSpanId)) {
|
|
10209
|
+
return void 0;
|
|
10210
|
+
}
|
|
10211
|
+
return import_api.trace.setSpanContext(import_api.context.active(), {
|
|
10212
|
+
traceId,
|
|
10213
|
+
spanId: parentSpanId,
|
|
10214
|
+
traceFlags: import_api.TraceFlags.SAMPLED,
|
|
10215
|
+
isRemote: true
|
|
10216
|
+
});
|
|
10217
|
+
}
|
|
10218
|
+
|
|
10219
|
+
// src/tracing/direct/http.ts
|
|
10220
|
+
function formatEndpoint2(endpoint) {
|
|
10221
|
+
if (!endpoint) return void 0;
|
|
10222
|
+
return endpoint.endsWith("/") ? endpoint : `${endpoint}/`;
|
|
10223
|
+
}
|
|
10224
|
+
|
|
9742
10225
|
// src/tracing/direct/otlp.ts
|
|
9743
10226
|
var libraryVersion = package_default.version;
|
|
9744
10227
|
var SERVICE_NAME = "raindrop-ai";
|
|
@@ -9783,50 +10266,6 @@ function buildExportTraceServiceRequest2(spans) {
|
|
|
9783
10266
|
};
|
|
9784
10267
|
}
|
|
9785
10268
|
|
|
9786
|
-
// src/tracing/direct/context.ts
|
|
9787
|
-
var import_api = require("@opentelemetry/api");
|
|
9788
|
-
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
9789
|
-
var INVALID_SPAN_ID = "0000000000000000";
|
|
9790
|
-
function hexToBase64(hex) {
|
|
9791
|
-
const bytes = new Uint8Array(hex.length / 2);
|
|
9792
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
9793
|
-
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
9794
|
-
}
|
|
9795
|
-
return base64Encode2(bytes);
|
|
9796
|
-
}
|
|
9797
|
-
function getExplicitTraceContext(traceId, parentSpanId) {
|
|
9798
|
-
if (!traceId || !parentSpanId || !(0, import_api.isValidTraceId)(traceId) || !(0, import_api.isValidSpanId)(parentSpanId)) {
|
|
9799
|
-
return void 0;
|
|
9800
|
-
}
|
|
9801
|
-
return {
|
|
9802
|
-
traceIdB64: hexToBase64(traceId),
|
|
9803
|
-
parentSpanIdB64: hexToBase64(parentSpanId)
|
|
9804
|
-
};
|
|
9805
|
-
}
|
|
9806
|
-
function getActiveTraceContext() {
|
|
9807
|
-
const activeSpan = import_api.trace.getSpan(import_api.context.active());
|
|
9808
|
-
if (!activeSpan) return {};
|
|
9809
|
-
const spanContext = activeSpan.spanContext();
|
|
9810
|
-
const traceIdHex = spanContext.traceId;
|
|
9811
|
-
const spanIdHex = spanContext.spanId;
|
|
9812
|
-
if (traceIdHex === INVALID_TRACE_ID) return {};
|
|
9813
|
-
return {
|
|
9814
|
-
traceIdB64: hexToBase64(traceIdHex),
|
|
9815
|
-
parentSpanIdB64: spanIdHex !== INVALID_SPAN_ID ? hexToBase64(spanIdHex) : void 0
|
|
9816
|
-
};
|
|
9817
|
-
}
|
|
9818
|
-
function savedParentContext(traceId, parentSpanId) {
|
|
9819
|
-
if (!traceId || !parentSpanId || !(0, import_api.isValidTraceId)(traceId) || !(0, import_api.isValidSpanId)(parentSpanId)) {
|
|
9820
|
-
return void 0;
|
|
9821
|
-
}
|
|
9822
|
-
return import_api.trace.setSpanContext(import_api.context.active(), {
|
|
9823
|
-
traceId,
|
|
9824
|
-
spanId: parentSpanId,
|
|
9825
|
-
traceFlags: import_api.TraceFlags.SAMPLED,
|
|
9826
|
-
isRemote: true
|
|
9827
|
-
});
|
|
9828
|
-
}
|
|
9829
|
-
|
|
9830
10269
|
// src/tracing/direct/shipper.ts
|
|
9831
10270
|
function serializeAssociationValue(value) {
|
|
9832
10271
|
return stringifyBounded(value);
|
|
@@ -9852,6 +10291,9 @@ var DirectTraceShipper = class {
|
|
|
9852
10291
|
this.cloudEnabled = (_c = opts.cloudEnabled) != null ? _c : true;
|
|
9853
10292
|
this.debug = opts.debug;
|
|
9854
10293
|
this.projectId = opts.projectId;
|
|
10294
|
+
this.redactTracePii = opts.redactTracePii;
|
|
10295
|
+
this.remotePiiConfig = opts.remotePiiConfig;
|
|
10296
|
+
this.spanPiiFields = opts.spanPiiFields;
|
|
9855
10297
|
this.flushIntervalMs = (_d = opts.flushIntervalMs) != null ? _d : 1e3;
|
|
9856
10298
|
this.maxBatchSize = (_e = opts.maxBatchSize) != null ? _e : 50;
|
|
9857
10299
|
this.maxQueueSize = (_f = opts.maxQueueSize) != null ? _f : 5e3;
|
|
@@ -9956,8 +10398,9 @@ var DirectTraceShipper = class {
|
|
|
9956
10398
|
base64ToHex2(span.traceId)
|
|
9957
10399
|
);
|
|
9958
10400
|
const mirrorUrl = (replayDestination == null ? void 0 : replayDestination.kind) === "workshop" ? replayDestination.url : replayDestination ? void 0 : this.localDebuggerUrl;
|
|
9959
|
-
|
|
9960
|
-
|
|
10401
|
+
const mirrored = mirrorUrl && this.redactsNow() ? this.redactSpanPii(span) : span;
|
|
10402
|
+
if (mirrorUrl && mirrored) {
|
|
10403
|
+
const body = buildExportTraceServiceRequest2([mirrored]);
|
|
9961
10404
|
const mirror = mirrorTraceExportToLocalDebugger(body, {
|
|
9962
10405
|
baseUrl: mirrorUrl,
|
|
9963
10406
|
debug: false,
|
|
@@ -9971,6 +10414,23 @@ var DirectTraceShipper = class {
|
|
|
9971
10414
|
console.log(`[raindrop] direct shipper: enqueued span "${params.name}"`);
|
|
9972
10415
|
}
|
|
9973
10416
|
}
|
|
10417
|
+
/**
|
|
10418
|
+
* Whether to redact, never waiting: a local mirror uses what is known now,
|
|
10419
|
+
* and a remote setting still being looked up counts as unknown.
|
|
10420
|
+
*/
|
|
10421
|
+
redactsNow() {
|
|
10422
|
+
var _a;
|
|
10423
|
+
const writeKey = this.cloudEnabled ? this.writeKey : void 0;
|
|
10424
|
+
return (_a = piiRedactionNow(this.redactTracePii, this.remotePiiConfig, this.baseUrl, writeKey)) != null ? _a : resolvePiiRedaction(this.redactTracePii, this.remotePiiConfig, "unknown");
|
|
10425
|
+
}
|
|
10426
|
+
/** The span with PII redacted from its input and output; undefined if redaction failed. */
|
|
10427
|
+
redactSpanPii(span) {
|
|
10428
|
+
try {
|
|
10429
|
+
return redactPiiInOtlpSpan(span, this.spanPiiFields);
|
|
10430
|
+
} catch (e) {
|
|
10431
|
+
return void 0;
|
|
10432
|
+
}
|
|
10433
|
+
}
|
|
9974
10434
|
sendToolSpan(params) {
|
|
9975
10435
|
this.sendSpan({
|
|
9976
10436
|
...params,
|
|
@@ -10024,13 +10484,22 @@ var DirectTraceShipper = class {
|
|
|
10024
10484
|
return summarize2(fates, stillRunning, !settled);
|
|
10025
10485
|
}
|
|
10026
10486
|
async drain(deadlineAt) {
|
|
10027
|
-
var _a;
|
|
10487
|
+
var _a, _b;
|
|
10028
10488
|
const fates = [];
|
|
10029
10489
|
if (!this.enabled) return fates;
|
|
10030
10490
|
if (this.timer) {
|
|
10031
10491
|
clearTimeout(this.timer);
|
|
10032
10492
|
this.timer = void 0;
|
|
10033
10493
|
}
|
|
10494
|
+
if (this.queue.length === 0) return fates;
|
|
10495
|
+
const writeKey = this.cloudEnabled ? this.writeKey : void 0;
|
|
10496
|
+
const redactPii = (_a = piiRedactionNow(this.redactTracePii, this.remotePiiConfig, this.baseUrl, writeKey)) != null ? _a : await piiRedaction(
|
|
10497
|
+
this.redactTracePii,
|
|
10498
|
+
this.remotePiiConfig,
|
|
10499
|
+
this.baseUrl,
|
|
10500
|
+
writeKey,
|
|
10501
|
+
deadlineAt
|
|
10502
|
+
);
|
|
10034
10503
|
while (this.queue.length > 0) {
|
|
10035
10504
|
const batch = this.queue.splice(0, this.maxBatchSize);
|
|
10036
10505
|
const opts = this.requestOpts(deadlineAt);
|
|
@@ -10055,12 +10524,18 @@ var DirectTraceShipper = class {
|
|
|
10055
10524
|
for (const [replayDestination, queuedSpans] of groups) {
|
|
10056
10525
|
if (!replayDestination && !this.cloudEnabled) continue;
|
|
10057
10526
|
if ((replayDestination == null ? void 0 : replayDestination.kind) === "workshop") continue;
|
|
10058
|
-
const
|
|
10527
|
+
const spans = queuedSpans.map((q) => q.span);
|
|
10528
|
+
const outgoing = redactPii ? spans.flatMap((span) => {
|
|
10529
|
+
var _a2;
|
|
10530
|
+
return (_a2 = this.redactSpanPii(span)) != null ? _a2 : [];
|
|
10531
|
+
}) : spans;
|
|
10532
|
+
if (outgoing.length === 0) continue;
|
|
10533
|
+
const body = buildExportTraceServiceRequest2(outgoing);
|
|
10059
10534
|
const url = replayDestination ? replayTraceUrl(replayDestination.url) : `${this.baseUrl}traces`;
|
|
10060
10535
|
const headers = replayDestination ? {
|
|
10061
10536
|
Authorization: `Bearer ${replayDestination.apiKey}`,
|
|
10062
10537
|
"X-Raindrop-Replay-Id": replayDestination.replayId,
|
|
10063
|
-
"X-Raindrop-Project-Id": (
|
|
10538
|
+
"X-Raindrop-Project-Id": (_b = replayDestination.projectId) != null ? _b : "default"
|
|
10064
10539
|
} : { Authorization: `Bearer ${this.writeKey}`, ...projectIdHeaders(this.projectId) };
|
|
10065
10540
|
const sending = sendJson(url, body, headers, opts);
|
|
10066
10541
|
const tracked = sending.then(() => void 0);
|
|
@@ -10082,7 +10557,9 @@ var DirectTraceShipper = class {
|
|
|
10082
10557
|
const reason = outcome.status === "cut_off" ? "cut off at the flush deadline (not resent: it may have reached ingest)" : outcome.status === "deferred" ? "not sent before the shutdown deadline" : "error" in outcome && outcome.error ? outcome.error.message : outcome.status;
|
|
10083
10558
|
rateLimitedLog(
|
|
10084
10559
|
"js-sdk.direct.send_failed",
|
|
10085
|
-
() => console.warn(
|
|
10560
|
+
() => console.warn(
|
|
10561
|
+
`[raindrop] direct: failed to send ${queuedSpans.length} spans (dropping): ${reason}`
|
|
10562
|
+
)
|
|
10086
10563
|
);
|
|
10087
10564
|
} else if (this.debug) {
|
|
10088
10565
|
console.log(`[raindrop] direct: sent ${queuedSpans.length} spans`);
|
|
@@ -10156,6 +10633,93 @@ var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
|
10156
10633
|
var import_sdk_trace_node = require("@opentelemetry/sdk-trace-node");
|
|
10157
10634
|
var import_ai_semantic_conventions = require("@traceloop/ai-semantic-conventions");
|
|
10158
10635
|
var ALL_INSTRUMENTATION_LIBRARIES = "all";
|
|
10636
|
+
function redactSpanPii(span, fields) {
|
|
10637
|
+
const attributes = redactPiiInAttributeMap(span.attributes, fields);
|
|
10638
|
+
const message = span.status.message;
|
|
10639
|
+
const redactedMessage = message === void 0 ? void 0 : redactSpanContent(message);
|
|
10640
|
+
let eventsChanged = false;
|
|
10641
|
+
const events = span.events.map((event) => {
|
|
10642
|
+
const eventAttributes = event.attributes && redactPiiInAttributeMap(event.attributes, fields);
|
|
10643
|
+
if (!eventAttributes) return event;
|
|
10644
|
+
eventsChanged = true;
|
|
10645
|
+
return { ...event, attributes: eventAttributes };
|
|
10646
|
+
});
|
|
10647
|
+
if (!attributes && redactedMessage === message && !eventsChanged) return span;
|
|
10648
|
+
const view = Object.create(span);
|
|
10649
|
+
if (attributes) {
|
|
10650
|
+
Object.defineProperty(view, "attributes", { value: attributes, enumerable: true });
|
|
10651
|
+
}
|
|
10652
|
+
if (redactedMessage !== message) {
|
|
10653
|
+
Object.defineProperty(view, "status", {
|
|
10654
|
+
value: { ...span.status, message: redactedMessage },
|
|
10655
|
+
enumerable: true
|
|
10656
|
+
});
|
|
10657
|
+
}
|
|
10658
|
+
if (eventsChanged) {
|
|
10659
|
+
Object.defineProperty(view, "events", { value: events, enumerable: true });
|
|
10660
|
+
}
|
|
10661
|
+
copyReplayTraceDestination(span, view);
|
|
10662
|
+
return view;
|
|
10663
|
+
}
|
|
10664
|
+
var PiiRedactingSpanExporter = class {
|
|
10665
|
+
constructor(inner, options) {
|
|
10666
|
+
this.inner = inner;
|
|
10667
|
+
this.options = options;
|
|
10668
|
+
/** Exports waiting for the org lookup; flush and shutdown wait for them. */
|
|
10669
|
+
this.pending = /* @__PURE__ */ new Set();
|
|
10670
|
+
}
|
|
10671
|
+
export(spans, resultCallback) {
|
|
10672
|
+
const { local, remote, apiUrl, writeKey, spanFields } = this.options;
|
|
10673
|
+
const exportContext = import_api2.context.active();
|
|
10674
|
+
const run = (redact) => {
|
|
10675
|
+
let outgoing = spans;
|
|
10676
|
+
if (redact) {
|
|
10677
|
+
outgoing = [];
|
|
10678
|
+
for (const span of spans) {
|
|
10679
|
+
try {
|
|
10680
|
+
outgoing.push(redactSpanPii(span, spanFields));
|
|
10681
|
+
} catch (e) {
|
|
10682
|
+
}
|
|
10683
|
+
}
|
|
10684
|
+
}
|
|
10685
|
+
try {
|
|
10686
|
+
import_api2.context.with(exportContext, () => this.inner.export(outgoing, resultCallback));
|
|
10687
|
+
} catch (e) {
|
|
10688
|
+
resultCallback({ code: 1 });
|
|
10689
|
+
}
|
|
10690
|
+
};
|
|
10691
|
+
const sharedRequest = localTracePiiRedactionRequested(apiUrl, writeKey);
|
|
10692
|
+
const known = sharedRequest || piiRedactionNow(local, remote, apiUrl, writeKey);
|
|
10693
|
+
if (known !== void 0) {
|
|
10694
|
+
run(known);
|
|
10695
|
+
return;
|
|
10696
|
+
}
|
|
10697
|
+
const handedOff = piiRedaction(local, remote, apiUrl, writeKey).then(
|
|
10698
|
+
(redact) => new Promise((resolve2) => {
|
|
10699
|
+
const callback = resultCallback;
|
|
10700
|
+
resultCallback = (result) => {
|
|
10701
|
+
resolve2();
|
|
10702
|
+
callback(result);
|
|
10703
|
+
};
|
|
10704
|
+
run(redact || localTracePiiRedactionRequested(apiUrl, writeKey));
|
|
10705
|
+
})
|
|
10706
|
+
);
|
|
10707
|
+
this.pending.add(handedOff);
|
|
10708
|
+
void handedOff.finally(() => this.pending.delete(handedOff));
|
|
10709
|
+
}
|
|
10710
|
+
async drainPending() {
|
|
10711
|
+
if (this.pending.size > 0) await Promise.allSettled([...this.pending]);
|
|
10712
|
+
}
|
|
10713
|
+
async shutdown() {
|
|
10714
|
+
await this.drainPending();
|
|
10715
|
+
return this.inner.shutdown();
|
|
10716
|
+
}
|
|
10717
|
+
async forceFlush() {
|
|
10718
|
+
var _a, _b, _c;
|
|
10719
|
+
await this.drainPending();
|
|
10720
|
+
return (_c = (_b = (_a = this.inner).forceFlush) == null ? void 0 : _b.call(_a)) != null ? _c : Promise.resolve();
|
|
10721
|
+
}
|
|
10722
|
+
};
|
|
10159
10723
|
var TRACER_NAME = "@traceloop/node-server-sdk";
|
|
10160
10724
|
var WORKFLOW_NAME_KEY = /* @__PURE__ */ Symbol.for("raindrop.otelCore.workflowName");
|
|
10161
10725
|
var ENTITY_NAME_KEY = /* @__PURE__ */ Symbol.for("raindrop.otelCore.entityName");
|
|
@@ -10185,12 +10749,12 @@ var AI_PROMPT_MESSAGES = "ai.prompt.messages";
|
|
|
10185
10749
|
var AI_PROMPT_TOKENS = "ai.usage.promptTokens";
|
|
10186
10750
|
var AI_COMPLETION_TOKENS = "ai.usage.completionTokens";
|
|
10187
10751
|
var AI_MODEL_PROVIDER = "ai.model.provider";
|
|
10188
|
-
var
|
|
10752
|
+
var STATE_KEY4 = /* @__PURE__ */ Symbol.for("raindrop.otelCore.state");
|
|
10189
10753
|
function getState2() {
|
|
10190
10754
|
var _a;
|
|
10191
10755
|
const holder = globalThis;
|
|
10192
|
-
(_a = holder[
|
|
10193
|
-
return holder[
|
|
10756
|
+
(_a = holder[STATE_KEY4]) != null ? _a : holder[STATE_KEY4] = {};
|
|
10757
|
+
return holder[STATE_KEY4];
|
|
10194
10758
|
}
|
|
10195
10759
|
function parseHeaders(value) {
|
|
10196
10760
|
const headers = {};
|
|
@@ -10391,7 +10955,8 @@ function createSpanProcessor(options) {
|
|
|
10391
10955
|
const apiKey = options.apiKey || process.env.TRACELOOP_API_KEY;
|
|
10392
10956
|
const resolvedHeaders = (_a = options.headers) != null ? _a : process.env.TRACELOOP_HEADERS ? parseHeaders(process.env.TRACELOOP_HEADERS) : { Authorization: `Bearer ${apiKey}` };
|
|
10393
10957
|
const baseExporter = (_b = options.exporter) != null ? _b : new import_exporter_trace_otlp_proto3.OTLPTraceExporter({ url: `${baseUrl}/v1/traces`, headers: resolvedHeaders });
|
|
10394
|
-
const
|
|
10958
|
+
const routed = options.routeReplayTraces ? new ReplayRoutingSpanExporter(baseExporter) : baseExporter;
|
|
10959
|
+
const exporter = options.piiRedaction ? new PiiRedactingSpanExporter(routed, options.piiRedaction) : routed;
|
|
10395
10960
|
const processor = options.disableBatch ? new import_sdk_trace_base.SimpleSpanProcessor(exporter) : new import_sdk_trace_base.BatchSpanProcessor(exporter);
|
|
10396
10961
|
const originalOnStart = processor.onStart.bind(processor);
|
|
10397
10962
|
const originalOnEnd = processor.onEnd.bind(processor);
|
|
@@ -10582,17 +11147,17 @@ function withTool(config, fn, ...args) {
|
|
|
10582
11147
|
}
|
|
10583
11148
|
|
|
10584
11149
|
// src/tracing/exit-flush.ts
|
|
10585
|
-
var
|
|
11150
|
+
var STATE_KEY5 = /* @__PURE__ */ Symbol.for("raindrop.tracing.exitFlushState");
|
|
10586
11151
|
function getState3() {
|
|
10587
11152
|
const holder = globalThis;
|
|
10588
|
-
let state2 = holder[
|
|
11153
|
+
let state2 = holder[STATE_KEY5];
|
|
10589
11154
|
if (!state2) {
|
|
10590
11155
|
state2 = {
|
|
10591
11156
|
clientFlushers: /* @__PURE__ */ new Set(),
|
|
10592
11157
|
pipelineFlushNeeded: false,
|
|
10593
11158
|
handlerRegistered: false
|
|
10594
11159
|
};
|
|
10595
|
-
holder[
|
|
11160
|
+
holder[STATE_KEY5] = state2;
|
|
10596
11161
|
}
|
|
10597
11162
|
return state2;
|
|
10598
11163
|
}
|
|
@@ -12171,6 +12736,7 @@ function createLocalDebuggerSpanProcessor(options) {
|
|
|
12171
12736
|
disableBatch: options.disableBatching,
|
|
12172
12737
|
exporter: localExporter,
|
|
12173
12738
|
headers: {},
|
|
12739
|
+
piiRedaction: options.piiRedaction,
|
|
12174
12740
|
allowedInstrumentationLibraries: options.allowedInstrumentationLibraries
|
|
12175
12741
|
});
|
|
12176
12742
|
} catch (error) {
|
|
@@ -12514,9 +13080,32 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12514
13080
|
cloudEnabled,
|
|
12515
13081
|
projectId,
|
|
12516
13082
|
flushTimeoutMs,
|
|
13083
|
+
redactTracePii,
|
|
13084
|
+
redactPiiFields,
|
|
13085
|
+
remotePiiConfig,
|
|
12517
13086
|
...otherOptions
|
|
12518
13087
|
} = options;
|
|
12519
13088
|
const cloudEnabledResolved = cloudEnabled != null ? cloudEnabled : true;
|
|
13089
|
+
const localTracePii = typeof redactTracePii === "boolean" ? redactTracePii : void 0;
|
|
13090
|
+
const spanPiiFields = compileSpanPiiFields(redactPiiFields == null ? void 0 : redactPiiFields.span, "[raindrop]");
|
|
13091
|
+
if ((redactPiiFields == null ? void 0 : redactPiiFields.span) && localTracePii !== true && !remotePiiConfig) {
|
|
13092
|
+
rateLimitedLog(
|
|
13093
|
+
"js-sdk.pii_span_fields_without_redaction",
|
|
13094
|
+
() => console.warn(
|
|
13095
|
+
"[raindrop] redactPiiFields.span is set but redactTracePii is off; no span is redacted. Set redactTracePii: true to use it."
|
|
13096
|
+
)
|
|
13097
|
+
);
|
|
13098
|
+
}
|
|
13099
|
+
const piiRedaction2 = {
|
|
13100
|
+
local: localTracePii,
|
|
13101
|
+
remote: remotePiiConfig,
|
|
13102
|
+
apiUrl: directEndpoint != null ? directEndpoint : apiUrl,
|
|
13103
|
+
writeKey: cloudEnabledResolved ? writeKey : void 0,
|
|
13104
|
+
spanFields: spanPiiFields
|
|
13105
|
+
};
|
|
13106
|
+
if (localTracePii === true) {
|
|
13107
|
+
requestLocalTracePiiRedaction(piiRedaction2.apiUrl, piiRedaction2.writeKey);
|
|
13108
|
+
}
|
|
12520
13109
|
const authHint = authHintForKey(writeKey);
|
|
12521
13110
|
const clientTracingExports = !useExternalOtel && cloudEnabledResolved && tracingEnabled !== false;
|
|
12522
13111
|
registerClientKey(authHint, clientTracingExports);
|
|
@@ -12546,7 +13135,10 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12546
13135
|
localDebuggerUrl,
|
|
12547
13136
|
cloudEnabled: cloudEnabledResolved,
|
|
12548
13137
|
projectId,
|
|
12549
|
-
flushTimeoutMs
|
|
13138
|
+
flushTimeoutMs,
|
|
13139
|
+
redactTracePii: localTracePii,
|
|
13140
|
+
remotePiiConfig,
|
|
13141
|
+
spanPiiFields
|
|
12550
13142
|
}) : void 0;
|
|
12551
13143
|
let traceloopInitialized = false;
|
|
12552
13144
|
let claimedPipeline = false;
|
|
@@ -12585,7 +13177,8 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12585
13177
|
disableBatching,
|
|
12586
13178
|
allowedInstrumentationLibraries: ALL_INSTRUMENTATION_LIBRARIES,
|
|
12587
13179
|
localDebuggerUrlOpt: localDebuggerUrl,
|
|
12588
|
-
routeReplayTraces: !cloudEnabledResolved
|
|
13180
|
+
routeReplayTraces: !cloudEnabledResolved,
|
|
13181
|
+
piiRedaction: piiRedaction2
|
|
12589
13182
|
});
|
|
12590
13183
|
if (!cloudEnabledResolved) {
|
|
12591
13184
|
if (localDebuggerProcessor) {
|
|
@@ -12611,7 +13204,8 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12611
13204
|
exporter: new DropSpanExporter(),
|
|
12612
13205
|
routeReplayTraces: true,
|
|
12613
13206
|
disableBatch: disableBatching,
|
|
12614
|
-
allowedInstrumentationLibraries: ALL_INSTRUMENTATION_LIBRARIES
|
|
13207
|
+
allowedInstrumentationLibraries: ALL_INSTRUMENTATION_LIBRARIES,
|
|
13208
|
+
piiRedaction: piiRedaction2
|
|
12615
13209
|
});
|
|
12616
13210
|
initialize({
|
|
12617
13211
|
baseUrl: apiUrl,
|
|
@@ -12683,6 +13277,7 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12683
13277
|
disableBatch: disableBatching,
|
|
12684
13278
|
processor,
|
|
12685
13279
|
exporter: guardedExporter,
|
|
13280
|
+
piiRedaction: piiRedaction2,
|
|
12686
13281
|
instrumentations: createConfiguredInstrumentations(otherOptions)
|
|
12687
13282
|
});
|
|
12688
13283
|
traceloopInitialized = true;
|
|
@@ -12924,7 +13519,8 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12924
13519
|
disableBatching,
|
|
12925
13520
|
allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
|
|
12926
13521
|
localDebuggerUrlOpt: localDebuggerUrl,
|
|
12927
|
-
routeReplayTraces: true
|
|
13522
|
+
routeReplayTraces: true,
|
|
13523
|
+
piiRedaction: piiRedaction2
|
|
12928
13524
|
});
|
|
12929
13525
|
return withV2SpanCompat(
|
|
12930
13526
|
localOnlyProcessor != null ? localOnlyProcessor : {
|
|
@@ -12946,13 +13542,15 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
12946
13542
|
disableBatch: disableBatching,
|
|
12947
13543
|
...processorOptions != null ? processorOptions : {},
|
|
12948
13544
|
routeReplayTraces: true,
|
|
12949
|
-
...headers ? { headers } : {}
|
|
13545
|
+
...headers ? { headers } : {},
|
|
13546
|
+
piiRedaction: piiRedaction2
|
|
12950
13547
|
});
|
|
12951
13548
|
const localDebuggerProcessor = createLocalDebuggerSpanProcessor({
|
|
12952
13549
|
writeKey,
|
|
12953
13550
|
disableBatching,
|
|
12954
13551
|
allowedInstrumentationLibraries: processorOptions == null ? void 0 : processorOptions.allowedInstrumentationLibraries,
|
|
12955
|
-
localDebuggerUrlOpt: localDebuggerUrl
|
|
13552
|
+
localDebuggerUrlOpt: localDebuggerUrl,
|
|
13553
|
+
piiRedaction: piiRedaction2
|
|
12956
13554
|
});
|
|
12957
13555
|
const contextProcessor = new RaindropContextSpanProcessor((properties) => analytics.getAppGitSnapshot(properties));
|
|
12958
13556
|
return withV2SpanCompat(
|
|
@@ -13384,9 +13982,9 @@ var ReplayTraceEvidenceEntrySchema = import_zod6.z.object({
|
|
|
13384
13982
|
});
|
|
13385
13983
|
}
|
|
13386
13984
|
});
|
|
13387
|
-
var ReplayTraceEvidenceSchema = import_zod6.z.array(ReplayTraceEvidenceEntrySchema).superRefine((
|
|
13985
|
+
var ReplayTraceEvidenceSchema = import_zod6.z.array(ReplayTraceEvidenceEntrySchema).superRefine((entries2, context8) => {
|
|
13388
13986
|
const seen = /* @__PURE__ */ new Set();
|
|
13389
|
-
for (const [index, entry] of
|
|
13987
|
+
for (const [index, entry] of entries2.entries()) {
|
|
13390
13988
|
if (seen.has(entry.rowId)) {
|
|
13391
13989
|
context8.addIssue({
|
|
13392
13990
|
code: import_zod6.z.ZodIssueCode.custom,
|
|
@@ -14049,7 +14647,7 @@ async function runReplayRows(client, handle, options) {
|
|
|
14049
14647
|
}
|
|
14050
14648
|
async function readEvalCaseTracePairs(input) {
|
|
14051
14649
|
const deadlineAt = Date.now() + input.waitMs;
|
|
14052
|
-
const
|
|
14650
|
+
const entries2 = await Promise.all(
|
|
14053
14651
|
input.evidence.map(async (evidence) => {
|
|
14054
14652
|
var _a, _b, _c;
|
|
14055
14653
|
let reading = await readEvalCaseTracePair(
|
|
@@ -14090,7 +14688,7 @@ async function readEvalCaseTracePairs(input) {
|
|
|
14090
14688
|
return [evidence.rowId, reading];
|
|
14091
14689
|
})
|
|
14092
14690
|
);
|
|
14093
|
-
return new Map(
|
|
14691
|
+
return new Map(entries2);
|
|
14094
14692
|
}
|
|
14095
14693
|
async function readEvalCaseTracePair(input, evidence, attempt) {
|
|
14096
14694
|
const query = new URLSearchParams({
|
|
@@ -15089,10 +15687,10 @@ function defineAgent(definition) {
|
|
|
15089
15687
|
});
|
|
15090
15688
|
if (typeof definition.run !== "function") throw new Error("An agent requires a run function");
|
|
15091
15689
|
const fields = (_b = definition.parameters) != null ? _b : {};
|
|
15092
|
-
const
|
|
15093
|
-
if (
|
|
15690
|
+
const entries2 = Object.entries(fields);
|
|
15691
|
+
if (entries2.length > MAX_PARAMETERS)
|
|
15094
15692
|
throw new Error(`Agent ${slug} declares more than ${MAX_PARAMETERS} parameters`);
|
|
15095
|
-
const parameters =
|
|
15693
|
+
const parameters = entries2.map(([key, schema2]) => describeParameterField(key, schema2));
|
|
15096
15694
|
const schema = import_zod7.z.object(fields).catchall(ParameterValueSchema);
|
|
15097
15695
|
return {
|
|
15098
15696
|
slug,
|
|
@@ -15561,7 +16159,7 @@ async function publishEvalSuite(client, definition, options = {}) {
|
|
|
15561
16159
|
expectedCurrentVersionId: options.expectedCurrentDatasetVersionId
|
|
15562
16160
|
});
|
|
15563
16161
|
}
|
|
15564
|
-
const
|
|
16162
|
+
const entries2 = suite.evaluators.map((entry) => {
|
|
15565
16163
|
if (typeof entry.evaluator === "string") return entry;
|
|
15566
16164
|
if ("kind" in entry.evaluator && entry.evaluator.kind === "program") {
|
|
15567
16165
|
if (!entry.evaluator.expected) {
|
|
@@ -15574,7 +16172,7 @@ async function publishEvalSuite(client, definition, options = {}) {
|
|
|
15574
16172
|
return entry;
|
|
15575
16173
|
});
|
|
15576
16174
|
const evaluators = [];
|
|
15577
|
-
for (const entry of
|
|
16175
|
+
for (const entry of entries2) {
|
|
15578
16176
|
if (typeof entry.evaluator === "string") {
|
|
15579
16177
|
evaluators.push({
|
|
15580
16178
|
...entry,
|
|
@@ -16403,7 +17001,7 @@ var SELF_DIAGNOSTICS_SIGNALS_DEFAULT = {
|
|
|
16403
17001
|
sentiment: "NEGATIVE"
|
|
16404
17002
|
}
|
|
16405
17003
|
};
|
|
16406
|
-
function
|
|
17004
|
+
function isRecord3(value) {
|
|
16407
17005
|
return typeof value === "object" && value !== null;
|
|
16408
17006
|
}
|
|
16409
17007
|
function normalizeSelfDiagnosticsSignals(signals) {
|
|
@@ -16504,7 +17102,7 @@ var Raindrop = class {
|
|
|
16504
17102
|
* retry schedule.
|
|
16505
17103
|
*/
|
|
16506
17104
|
this.hasShutdown = false;
|
|
16507
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
17105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
16508
17106
|
const writeKey = (_a = config.writeKey) != null ? _a : "";
|
|
16509
17107
|
const disabled = (_b = config.disabled) != null ? _b : false;
|
|
16510
17108
|
const localDebuggerUrlOpt = config.localWorkshopUrl === false ? null : config.localWorkshopUrl;
|
|
@@ -16529,7 +17127,8 @@ var Raindrop = class {
|
|
|
16529
17127
|
debug: this.debugLogs,
|
|
16530
17128
|
prefix: "[raindrop]"
|
|
16531
17129
|
});
|
|
16532
|
-
this.redactPii =
|
|
17130
|
+
this.redactPii = config.redactPii;
|
|
17131
|
+
this.remotePiiConfig = config.remotePiiConfig;
|
|
16533
17132
|
this.piiFields = new PiiFieldRedactor({
|
|
16534
17133
|
startupFieldMap: config.redactPiiFields,
|
|
16535
17134
|
logPrefix: "[raindrop]"
|
|
@@ -16543,7 +17142,7 @@ var Raindrop = class {
|
|
|
16543
17142
|
"[raindrop] 'disableTracing' is deprecated and renamed to 'useExternalOtel'. Please update your config: { useExternalOtel: true }"
|
|
16544
17143
|
);
|
|
16545
17144
|
}
|
|
16546
|
-
const useExternalOtel = (
|
|
17145
|
+
const useExternalOtel = (_i = (_h = config.useExternalOtel) != null ? _h : config.disableTracing) != null ? _i : false;
|
|
16547
17146
|
const disableBatching = resolveDisableBatching(config.disableBatching, {
|
|
16548
17147
|
isProduction: process.env.NODE_ENV === "production",
|
|
16549
17148
|
isLocalDebugger: localDebuggerEnabled(this.localDebuggerUrlOpt)
|
|
@@ -16569,7 +17168,8 @@ var Raindrop = class {
|
|
|
16569
17168
|
maxTextFieldChars: config.maxTextFieldChars,
|
|
16570
17169
|
redactPii: this.redactPii,
|
|
16571
17170
|
redactPiiFields: config.redactPiiFields,
|
|
16572
|
-
|
|
17171
|
+
remotePiiConfig: this.remotePiiConfig,
|
|
17172
|
+
wizardSession: (_j = this.wizardSession) != null ? _j : void 0,
|
|
16573
17173
|
flushTimeoutMs: this.flushTimeoutMs
|
|
16574
17174
|
});
|
|
16575
17175
|
try {
|
|
@@ -16593,7 +17193,10 @@ var Raindrop = class {
|
|
|
16593
17193
|
localDebuggerUrl: this.localDebuggerUrlOpt,
|
|
16594
17194
|
cloudEnabled: !this.localOnly,
|
|
16595
17195
|
projectId: this.projectId,
|
|
16596
|
-
flushTimeoutMs: this.flushTimeoutMs
|
|
17196
|
+
flushTimeoutMs: this.flushTimeoutMs,
|
|
17197
|
+
redactTracePii: config.redactTracePii,
|
|
17198
|
+
redactPiiFields: config.redactPiiFields,
|
|
17199
|
+
remotePiiConfig: this.remotePiiConfig
|
|
16597
17200
|
},
|
|
16598
17201
|
this.debugLogs
|
|
16599
17202
|
);
|
|
@@ -16807,7 +17410,7 @@ var Raindrop = class {
|
|
|
16807
17410
|
const onMissingEventId = (_b = options.onMissingEventId) != null ? _b : "warn";
|
|
16808
17411
|
const execute = async (rawInput, context8) => {
|
|
16809
17412
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
16810
|
-
const input =
|
|
17413
|
+
const input = isRecord3(rawInput) ? rawInput : void 0;
|
|
16811
17414
|
const fallbackCategory = (_a2 = signalKeys[0]) != null ? _a2 : "unknown";
|
|
16812
17415
|
const categoryCandidate = normalizeEventId(input == null ? void 0 : input["category"]);
|
|
16813
17416
|
const category = categoryCandidate && signalKeySet.has(categoryCandidate) ? categoryCandidate : fallbackCategory;
|
|
@@ -17195,9 +17798,14 @@ var Raindrop = class {
|
|
|
17195
17798
|
}
|
|
17196
17799
|
async sendBatchToApi(events, endpoint, deadlineAt) {
|
|
17197
17800
|
const kind = PII_KIND_BY_ENDPOINT[endpoint];
|
|
17198
|
-
const
|
|
17199
|
-
|
|
17200
|
-
);
|
|
17801
|
+
const writeKey = this.localOnly ? void 0 : this.writeKey;
|
|
17802
|
+
let rows = events.map(({ type, ...event }) => event);
|
|
17803
|
+
let redact = kind !== void 0 && piiRedactionNow(this.redactPii, this.remotePiiConfig, this.apiUrl, writeKey);
|
|
17804
|
+
if (redact === void 0) {
|
|
17805
|
+
rows = rows.map(snapshotPayload);
|
|
17806
|
+
redact = await piiRedaction(this.redactPii, this.remotePiiConfig, this.apiUrl, writeKey, deadlineAt);
|
|
17807
|
+
}
|
|
17808
|
+
const body = rows.map((event) => redact && kind ? this.piiFields.redact(kind, event) : event);
|
|
17201
17809
|
this.mirrorBatchToLocalDebugger(endpoint, body);
|
|
17202
17810
|
if (this.localOnly) {
|
|
17203
17811
|
return void 0;
|