raindrop-ai 0.1.7 → 0.2.0
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-6CO4YGYH.mjs → chunk-XUL7ADVB.mjs} +31 -2
- package/dist/index.d.mts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +41 -3
- package/dist/index.mjs +13 -2
- package/dist/tracing/index.js +30 -2
- package/dist/tracing/index.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
// ../core/dist/chunk-
|
|
1
|
+
// ../core/dist/chunk-Y5LUB7OE.js
|
|
2
|
+
function normalizeFeatureFlags(input) {
|
|
3
|
+
if (Array.isArray(input)) {
|
|
4
|
+
return Object.fromEntries(input.map((name) => [name, "true"]));
|
|
5
|
+
}
|
|
6
|
+
return Object.fromEntries(
|
|
7
|
+
Object.entries(input).map(([k, v]) => [k, String(v)])
|
|
8
|
+
);
|
|
9
|
+
}
|
|
2
10
|
function runWithTracingSuppressed(fn) {
|
|
3
11
|
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
4
12
|
if (typeof hook !== "function") return fn();
|
|
@@ -418,7 +426,7 @@ installTracingSuppressionHook();
|
|
|
418
426
|
// package.json
|
|
419
427
|
var package_default = {
|
|
420
428
|
name: "raindrop-ai",
|
|
421
|
-
version: "0.
|
|
429
|
+
version: "0.2.0",
|
|
422
430
|
main: "dist/index.js",
|
|
423
431
|
module: "dist/index.mjs",
|
|
424
432
|
types: "dist/index.d.ts",
|
|
@@ -1506,6 +1514,26 @@ var LiveInteraction = class {
|
|
|
1506
1514
|
attachments
|
|
1507
1515
|
});
|
|
1508
1516
|
}
|
|
1517
|
+
setFeatureFlag(name, value) {
|
|
1518
|
+
var _a;
|
|
1519
|
+
const normalized = String(value != null ? value : "true");
|
|
1520
|
+
const existing = this.context.featureFlags ? normalizeFeatureFlags(this.context.featureFlags) : {};
|
|
1521
|
+
this.context.featureFlags = { ...existing, [name]: normalized };
|
|
1522
|
+
(_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
|
|
1523
|
+
eventId: this.context.eventId,
|
|
1524
|
+
featureFlags: { [name]: normalized }
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
setFeatureFlags(flags) {
|
|
1528
|
+
var _a;
|
|
1529
|
+
const normalized = normalizeFeatureFlags(flags);
|
|
1530
|
+
const existing = this.context.featureFlags ? normalizeFeatureFlags(this.context.featureFlags) : {};
|
|
1531
|
+
this.context.featureFlags = { ...existing, ...normalized };
|
|
1532
|
+
(_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
|
|
1533
|
+
eventId: this.context.eventId,
|
|
1534
|
+
featureFlags: normalized
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1509
1537
|
setInput(input) {
|
|
1510
1538
|
var _a;
|
|
1511
1539
|
this.context.input = input;
|
|
@@ -2505,6 +2533,7 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
|
|
|
2505
2533
|
};
|
|
2506
2534
|
|
|
2507
2535
|
export {
|
|
2536
|
+
normalizeFeatureFlags,
|
|
2508
2537
|
runWithTracingSuppressed,
|
|
2509
2538
|
DEFAULT_REQUEST_TIMEOUT_MS,
|
|
2510
2539
|
MAX_RETRY_DELAY_MS,
|
package/dist/index.d.mts
CHANGED
|
@@ -103,6 +103,8 @@ type OtherAttachment = BaseAttachment & {
|
|
|
103
103
|
type: "text" | "image" | "iframe";
|
|
104
104
|
};
|
|
105
105
|
type Attachment = CodeAttachment | OtherAttachment;
|
|
106
|
+
type RaindropFeatureFlagValue = string | number | boolean;
|
|
107
|
+
type RaindropFeatureFlags = string[] | Record<string, RaindropFeatureFlagValue>;
|
|
106
108
|
type RaindropPropertyLeaf = string | boolean | number;
|
|
107
109
|
type RaindropPropertyValue = RaindropPropertyLeaf | RaindropPropertyValue[] | {
|
|
108
110
|
[key: string]: RaindropPropertyValue;
|
|
@@ -122,6 +124,7 @@ interface TrackEvent {
|
|
|
122
124
|
eventId?: string;
|
|
123
125
|
event: string;
|
|
124
126
|
properties?: RaindropProperties;
|
|
127
|
+
featureFlags?: RaindropFeatureFlags;
|
|
125
128
|
timestamp?: string;
|
|
126
129
|
userId: string;
|
|
127
130
|
}
|
|
@@ -263,6 +266,7 @@ type AiTrackEvent = Omit<TrackEvent, "type"> & {
|
|
|
263
266
|
model?: string;
|
|
264
267
|
convoId?: string;
|
|
265
268
|
attachments?: Attachment[];
|
|
269
|
+
featureFlags?: RaindropFeatureFlags;
|
|
266
270
|
} & ({
|
|
267
271
|
input: string;
|
|
268
272
|
output?: string;
|
|
@@ -612,6 +616,19 @@ type Interaction = {
|
|
|
612
616
|
* interaction.end("The weather is sunny and warm.");
|
|
613
617
|
*/
|
|
614
618
|
addAttachments(attachments: Attachment[]): void;
|
|
619
|
+
/**
|
|
620
|
+
* Sets a single feature flag on the interaction.
|
|
621
|
+
* @param name The flag name
|
|
622
|
+
* @param value The flag value (defaults to "true")
|
|
623
|
+
*/
|
|
624
|
+
setFeatureFlag(name: string, value?: RaindropFeatureFlagValue): void;
|
|
625
|
+
/**
|
|
626
|
+
* Sets multiple feature flags on the interaction.
|
|
627
|
+
* Accepts an array of flag names (all set to "true") or an object with explicit values.
|
|
628
|
+
* Merges with any previously set flags.
|
|
629
|
+
* @param flags The feature flags to set
|
|
630
|
+
*/
|
|
631
|
+
setFeatureFlags(flags: RaindropFeatureFlags): void;
|
|
615
632
|
/**
|
|
616
633
|
* Sets the input for the interaction.
|
|
617
634
|
*
|
|
@@ -1108,4 +1125,4 @@ declare class Raindrop {
|
|
|
1108
1125
|
private closeWithinDeadline;
|
|
1109
1126
|
}
|
|
1110
1127
|
|
|
1111
|
-
export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, type LocalDebuggerLiveEventInput, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropProperties, type RaindropPropertyLeaf, type RaindropPropertyValue, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
|
|
1128
|
+
export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, type LocalDebuggerLiveEventInput, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropFeatureFlagValue, type RaindropFeatureFlags, type RaindropProperties, type RaindropPropertyLeaf, type RaindropPropertyValue, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -103,6 +103,8 @@ type OtherAttachment = BaseAttachment & {
|
|
|
103
103
|
type: "text" | "image" | "iframe";
|
|
104
104
|
};
|
|
105
105
|
type Attachment = CodeAttachment | OtherAttachment;
|
|
106
|
+
type RaindropFeatureFlagValue = string | number | boolean;
|
|
107
|
+
type RaindropFeatureFlags = string[] | Record<string, RaindropFeatureFlagValue>;
|
|
106
108
|
type RaindropPropertyLeaf = string | boolean | number;
|
|
107
109
|
type RaindropPropertyValue = RaindropPropertyLeaf | RaindropPropertyValue[] | {
|
|
108
110
|
[key: string]: RaindropPropertyValue;
|
|
@@ -122,6 +124,7 @@ interface TrackEvent {
|
|
|
122
124
|
eventId?: string;
|
|
123
125
|
event: string;
|
|
124
126
|
properties?: RaindropProperties;
|
|
127
|
+
featureFlags?: RaindropFeatureFlags;
|
|
125
128
|
timestamp?: string;
|
|
126
129
|
userId: string;
|
|
127
130
|
}
|
|
@@ -263,6 +266,7 @@ type AiTrackEvent = Omit<TrackEvent, "type"> & {
|
|
|
263
266
|
model?: string;
|
|
264
267
|
convoId?: string;
|
|
265
268
|
attachments?: Attachment[];
|
|
269
|
+
featureFlags?: RaindropFeatureFlags;
|
|
266
270
|
} & ({
|
|
267
271
|
input: string;
|
|
268
272
|
output?: string;
|
|
@@ -612,6 +616,19 @@ type Interaction = {
|
|
|
612
616
|
* interaction.end("The weather is sunny and warm.");
|
|
613
617
|
*/
|
|
614
618
|
addAttachments(attachments: Attachment[]): void;
|
|
619
|
+
/**
|
|
620
|
+
* Sets a single feature flag on the interaction.
|
|
621
|
+
* @param name The flag name
|
|
622
|
+
* @param value The flag value (defaults to "true")
|
|
623
|
+
*/
|
|
624
|
+
setFeatureFlag(name: string, value?: RaindropFeatureFlagValue): void;
|
|
625
|
+
/**
|
|
626
|
+
* Sets multiple feature flags on the interaction.
|
|
627
|
+
* Accepts an array of flag names (all set to "true") or an object with explicit values.
|
|
628
|
+
* Merges with any previously set flags.
|
|
629
|
+
* @param flags The feature flags to set
|
|
630
|
+
*/
|
|
631
|
+
setFeatureFlags(flags: RaindropFeatureFlags): void;
|
|
615
632
|
/**
|
|
616
633
|
* Sets the input for the interaction.
|
|
617
634
|
*
|
|
@@ -1108,4 +1125,4 @@ declare class Raindrop {
|
|
|
1108
1125
|
private closeWithinDeadline;
|
|
1109
1126
|
}
|
|
1110
1127
|
|
|
1111
|
-
export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, type LocalDebuggerLiveEventInput, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropProperties, type RaindropPropertyLeaf, type RaindropPropertyValue, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
|
|
1128
|
+
export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, type LocalDebuggerLiveEventInput, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropFeatureFlagValue, type RaindropFeatureFlags, type RaindropProperties, type RaindropPropertyLeaf, type RaindropPropertyValue, type RaindropSpanProcessor, type SelfDiagnoseOptions, type SelfDiagnosticsExecuteContext, type SelfDiagnosticsExecuteResult, type SelfDiagnosticsSignalDefinition, type SelfDiagnosticsSignalDefinitions, type SelfDiagnosticsTool, type SelfDiagnosticsToolInputSchema, type SelfDiagnosticsToolOptions, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
|
package/dist/index.js
CHANGED
|
@@ -5771,7 +5771,15 @@ __export(index_exports, {
|
|
|
5771
5771
|
});
|
|
5772
5772
|
module.exports = __toCommonJS(index_exports);
|
|
5773
5773
|
|
|
5774
|
-
// ../core/dist/chunk-
|
|
5774
|
+
// ../core/dist/chunk-Y5LUB7OE.js
|
|
5775
|
+
function normalizeFeatureFlags(input) {
|
|
5776
|
+
if (Array.isArray(input)) {
|
|
5777
|
+
return Object.fromEntries(input.map((name) => [name, "true"]));
|
|
5778
|
+
}
|
|
5779
|
+
return Object.fromEntries(
|
|
5780
|
+
Object.entries(input).map(([k, v]) => [k, String(v)])
|
|
5781
|
+
);
|
|
5782
|
+
}
|
|
5775
5783
|
function runWithTracingSuppressed(fn) {
|
|
5776
5784
|
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
5777
5785
|
if (typeof hook !== "function") return fn();
|
|
@@ -6188,7 +6196,7 @@ function installTracingSuppressionHook() {
|
|
|
6188
6196
|
}
|
|
6189
6197
|
installTracingSuppressionHook();
|
|
6190
6198
|
|
|
6191
|
-
// ../schemas/dist/chunk-
|
|
6199
|
+
// ../schemas/dist/chunk-VQNKQ4ZC.js
|
|
6192
6200
|
var __defProp2 = Object.defineProperty;
|
|
6193
6201
|
var __export2 = (target, all) => {
|
|
6194
6202
|
for (var name in all)
|
|
@@ -10267,6 +10275,7 @@ var TrackEventSchema = external_exports.object({
|
|
|
10267
10275
|
event_id: external_exports.string(),
|
|
10268
10276
|
event: external_exports.string().min(1, "Event name cannot be empty"),
|
|
10269
10277
|
properties: EventPropertiesSchema.optional(),
|
|
10278
|
+
feature_flags: external_exports.record(external_exports.string()).optional(),
|
|
10270
10279
|
timestamp: external_exports.coerce.date(),
|
|
10271
10280
|
received_at: external_exports.coerce.date(),
|
|
10272
10281
|
user_id: external_exports.coerce.string().min(1, "User ID cannot be empty"),
|
|
@@ -10296,7 +10305,7 @@ var SignalEventSchema = external_exports.object({
|
|
|
10296
10305
|
// package.json
|
|
10297
10306
|
var package_default = {
|
|
10298
10307
|
name: "raindrop-ai",
|
|
10299
|
-
version: "0.
|
|
10308
|
+
version: "0.2.0",
|
|
10300
10309
|
main: "dist/index.js",
|
|
10301
10310
|
module: "dist/index.mjs",
|
|
10302
10311
|
types: "dist/index.d.ts",
|
|
@@ -11464,6 +11473,26 @@ var LiveInteraction = class {
|
|
|
11464
11473
|
attachments
|
|
11465
11474
|
});
|
|
11466
11475
|
}
|
|
11476
|
+
setFeatureFlag(name, value) {
|
|
11477
|
+
var _a;
|
|
11478
|
+
const normalized = String(value != null ? value : "true");
|
|
11479
|
+
const existing = this.context.featureFlags ? normalizeFeatureFlags(this.context.featureFlags) : {};
|
|
11480
|
+
this.context.featureFlags = { ...existing, [name]: normalized };
|
|
11481
|
+
(_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
|
|
11482
|
+
eventId: this.context.eventId,
|
|
11483
|
+
featureFlags: { [name]: normalized }
|
|
11484
|
+
});
|
|
11485
|
+
}
|
|
11486
|
+
setFeatureFlags(flags) {
|
|
11487
|
+
var _a;
|
|
11488
|
+
const normalized = normalizeFeatureFlags(flags);
|
|
11489
|
+
const existing = this.context.featureFlags ? normalizeFeatureFlags(this.context.featureFlags) : {};
|
|
11490
|
+
this.context.featureFlags = { ...existing, ...normalized };
|
|
11491
|
+
(_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
|
|
11492
|
+
eventId: this.context.eventId,
|
|
11493
|
+
featureFlags: normalized
|
|
11494
|
+
});
|
|
11495
|
+
}
|
|
11467
11496
|
setInput(input) {
|
|
11468
11497
|
var _a;
|
|
11469
11498
|
this.context.input = input;
|
|
@@ -12898,6 +12927,7 @@ var Raindrop = class {
|
|
|
12898
12927
|
convoId,
|
|
12899
12928
|
attachments,
|
|
12900
12929
|
properties,
|
|
12930
|
+
featureFlags,
|
|
12901
12931
|
timestamp,
|
|
12902
12932
|
...rest
|
|
12903
12933
|
} = e;
|
|
@@ -12911,6 +12941,7 @@ var Raindrop = class {
|
|
|
12911
12941
|
);
|
|
12912
12942
|
return;
|
|
12913
12943
|
}
|
|
12944
|
+
const normalizedFlags = featureFlags ? normalizeFeatureFlags(featureFlags) : void 0;
|
|
12914
12945
|
const parsed = ClientAiTrack.safeParse({
|
|
12915
12946
|
event_id: customEventId,
|
|
12916
12947
|
// Only custom event id can sent to server
|
|
@@ -12920,6 +12951,7 @@ var Raindrop = class {
|
|
|
12920
12951
|
properties: {
|
|
12921
12952
|
...properties
|
|
12922
12953
|
},
|
|
12954
|
+
...normalizedFlags && Object.keys(normalizedFlags).length > 0 ? { feature_flags: normalizedFlags } : {},
|
|
12923
12955
|
attachments: parsedAttachments.data,
|
|
12924
12956
|
...rest
|
|
12925
12957
|
});
|
|
@@ -13269,6 +13301,9 @@ var Raindrop = class {
|
|
|
13269
13301
|
if (typeof rest.output === "string") {
|
|
13270
13302
|
rest.output = capText(rest.output, this.maxTextFieldChars);
|
|
13271
13303
|
}
|
|
13304
|
+
if (rest.featureFlags) {
|
|
13305
|
+
rest.featureFlags = normalizeFeatureFlags(rest.featureFlags);
|
|
13306
|
+
}
|
|
13272
13307
|
const existingEvent = this.partialEventBuffer.get(eventId) || {};
|
|
13273
13308
|
const mergedEvent = this.deepMergeObjects(
|
|
13274
13309
|
{ ...existingEvent },
|
|
@@ -13366,8 +13401,10 @@ var Raindrop = class {
|
|
|
13366
13401
|
convoId,
|
|
13367
13402
|
attachments,
|
|
13368
13403
|
properties,
|
|
13404
|
+
featureFlags,
|
|
13369
13405
|
...rest
|
|
13370
13406
|
} = accumulatedEvent;
|
|
13407
|
+
const normalizedFlags = featureFlags ? normalizeFeatureFlags(featureFlags) : void 0;
|
|
13371
13408
|
const eventToSend = {
|
|
13372
13409
|
event_id: eventId,
|
|
13373
13410
|
user_id: userId,
|
|
@@ -13383,6 +13420,7 @@ var Raindrop = class {
|
|
|
13383
13420
|
convo_id: convoId
|
|
13384
13421
|
},
|
|
13385
13422
|
properties,
|
|
13423
|
+
...normalizedFlags && Object.keys(normalizedFlags).length > 0 ? { feature_flags: normalizedFlags } : {},
|
|
13386
13424
|
attachments,
|
|
13387
13425
|
is_pending: isPending === void 0 ? true : isPending,
|
|
13388
13426
|
// Spread any other top-level properties captured by AiTrackEvent/TrackEvent
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
SHUTDOWN_DEADLINE_MS,
|
|
6
6
|
capText,
|
|
7
7
|
mirrorPartialEventToLocalDebugger,
|
|
8
|
+
normalizeFeatureFlags,
|
|
8
9
|
normalizeProjectId,
|
|
9
10
|
package_default,
|
|
10
11
|
projectIdHeaders,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
setDefaultMaxTextFieldChars,
|
|
18
19
|
stringifyBounded,
|
|
19
20
|
tracing
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-XUL7ADVB.mjs";
|
|
21
22
|
import {
|
|
22
23
|
__commonJS,
|
|
23
24
|
__toESM
|
|
@@ -5755,7 +5756,7 @@ var require_dist = __commonJS({
|
|
|
5755
5756
|
}
|
|
5756
5757
|
});
|
|
5757
5758
|
|
|
5758
|
-
// ../schemas/dist/chunk-
|
|
5759
|
+
// ../schemas/dist/chunk-VQNKQ4ZC.js
|
|
5759
5760
|
var __defProp = Object.defineProperty;
|
|
5760
5761
|
var __export = (target, all) => {
|
|
5761
5762
|
for (var name in all)
|
|
@@ -9834,6 +9835,7 @@ var TrackEventSchema = external_exports.object({
|
|
|
9834
9835
|
event_id: external_exports.string(),
|
|
9835
9836
|
event: external_exports.string().min(1, "Event name cannot be empty"),
|
|
9836
9837
|
properties: EventPropertiesSchema.optional(),
|
|
9838
|
+
feature_flags: external_exports.record(external_exports.string()).optional(),
|
|
9837
9839
|
timestamp: external_exports.coerce.date(),
|
|
9838
9840
|
received_at: external_exports.coerce.date(),
|
|
9839
9841
|
user_id: external_exports.coerce.string().min(1, "User ID cannot be empty"),
|
|
@@ -10385,6 +10387,7 @@ var Raindrop = class {
|
|
|
10385
10387
|
convoId,
|
|
10386
10388
|
attachments,
|
|
10387
10389
|
properties,
|
|
10390
|
+
featureFlags,
|
|
10388
10391
|
timestamp,
|
|
10389
10392
|
...rest
|
|
10390
10393
|
} = e;
|
|
@@ -10398,6 +10401,7 @@ var Raindrop = class {
|
|
|
10398
10401
|
);
|
|
10399
10402
|
return;
|
|
10400
10403
|
}
|
|
10404
|
+
const normalizedFlags = featureFlags ? normalizeFeatureFlags(featureFlags) : void 0;
|
|
10401
10405
|
const parsed = ClientAiTrack.safeParse({
|
|
10402
10406
|
event_id: customEventId,
|
|
10403
10407
|
// Only custom event id can sent to server
|
|
@@ -10407,6 +10411,7 @@ var Raindrop = class {
|
|
|
10407
10411
|
properties: {
|
|
10408
10412
|
...properties
|
|
10409
10413
|
},
|
|
10414
|
+
...normalizedFlags && Object.keys(normalizedFlags).length > 0 ? { feature_flags: normalizedFlags } : {},
|
|
10410
10415
|
attachments: parsedAttachments.data,
|
|
10411
10416
|
...rest
|
|
10412
10417
|
});
|
|
@@ -10756,6 +10761,9 @@ var Raindrop = class {
|
|
|
10756
10761
|
if (typeof rest.output === "string") {
|
|
10757
10762
|
rest.output = capText(rest.output, this.maxTextFieldChars);
|
|
10758
10763
|
}
|
|
10764
|
+
if (rest.featureFlags) {
|
|
10765
|
+
rest.featureFlags = normalizeFeatureFlags(rest.featureFlags);
|
|
10766
|
+
}
|
|
10759
10767
|
const existingEvent = this.partialEventBuffer.get(eventId) || {};
|
|
10760
10768
|
const mergedEvent = this.deepMergeObjects(
|
|
10761
10769
|
{ ...existingEvent },
|
|
@@ -10853,8 +10861,10 @@ var Raindrop = class {
|
|
|
10853
10861
|
convoId,
|
|
10854
10862
|
attachments,
|
|
10855
10863
|
properties,
|
|
10864
|
+
featureFlags,
|
|
10856
10865
|
...rest
|
|
10857
10866
|
} = accumulatedEvent;
|
|
10867
|
+
const normalizedFlags = featureFlags ? normalizeFeatureFlags(featureFlags) : void 0;
|
|
10858
10868
|
const eventToSend = {
|
|
10859
10869
|
event_id: eventId,
|
|
10860
10870
|
user_id: userId,
|
|
@@ -10870,6 +10880,7 @@ var Raindrop = class {
|
|
|
10870
10880
|
convo_id: convoId
|
|
10871
10881
|
},
|
|
10872
10882
|
properties,
|
|
10883
|
+
...normalizedFlags && Object.keys(normalizedFlags).length > 0 ? { feature_flags: normalizedFlags } : {},
|
|
10873
10884
|
attachments,
|
|
10874
10885
|
is_pending: isPending === void 0 ? true : isPending,
|
|
10875
10886
|
// Spread any other top-level properties captured by AiTrackEvent/TrackEvent
|
package/dist/tracing/index.js
CHANGED
|
@@ -50,7 +50,15 @@ 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-Y5LUB7OE.js
|
|
54
|
+
function normalizeFeatureFlags(input) {
|
|
55
|
+
if (Array.isArray(input)) {
|
|
56
|
+
return Object.fromEntries(input.map((name) => [name, "true"]));
|
|
57
|
+
}
|
|
58
|
+
return Object.fromEntries(
|
|
59
|
+
Object.entries(input).map(([k, v]) => [k, String(v)])
|
|
60
|
+
);
|
|
61
|
+
}
|
|
54
62
|
function runWithTracingSuppressed(fn) {
|
|
55
63
|
const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
|
|
56
64
|
if (typeof hook !== "function") return fn();
|
|
@@ -585,7 +593,7 @@ function base64ToHex(base64) {
|
|
|
585
593
|
// package.json
|
|
586
594
|
var package_default = {
|
|
587
595
|
name: "raindrop-ai",
|
|
588
|
-
version: "0.
|
|
596
|
+
version: "0.2.0",
|
|
589
597
|
main: "dist/index.js",
|
|
590
598
|
module: "dist/index.mjs",
|
|
591
599
|
types: "dist/index.d.ts",
|
|
@@ -1496,6 +1504,26 @@ var LiveInteraction = class {
|
|
|
1496
1504
|
attachments
|
|
1497
1505
|
});
|
|
1498
1506
|
}
|
|
1507
|
+
setFeatureFlag(name, value) {
|
|
1508
|
+
var _a;
|
|
1509
|
+
const normalized = String(value != null ? value : "true");
|
|
1510
|
+
const existing = this.context.featureFlags ? normalizeFeatureFlags(this.context.featureFlags) : {};
|
|
1511
|
+
this.context.featureFlags = { ...existing, [name]: normalized };
|
|
1512
|
+
(_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
|
|
1513
|
+
eventId: this.context.eventId,
|
|
1514
|
+
featureFlags: { [name]: normalized }
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
setFeatureFlags(flags) {
|
|
1518
|
+
var _a;
|
|
1519
|
+
const normalized = normalizeFeatureFlags(flags);
|
|
1520
|
+
const existing = this.context.featureFlags ? normalizeFeatureFlags(this.context.featureFlags) : {};
|
|
1521
|
+
this.context.featureFlags = { ...existing, ...normalized };
|
|
1522
|
+
(_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
|
|
1523
|
+
eventId: this.context.eventId,
|
|
1524
|
+
featureFlags: normalized
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1499
1527
|
setInput(input) {
|
|
1500
1528
|
var _a;
|
|
1501
1529
|
this.context.input = input;
|
package/dist/tracing/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raindrop-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,9 +41,9 @@
|
|
|
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.1.0",
|
|
45
45
|
"@raindrop-ai/redact-pii": "0.1.2",
|
|
46
|
-
"@raindrop-ai/schemas": "0.0
|
|
46
|
+
"@raindrop-ai/schemas": "0.1.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@opentelemetry/api": "^1.9.0",
|