@raindrop-ai/ai-sdk 0.0.40 → 0.1.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.
@@ -1,4 +1,12 @@
1
- // ../core/dist/chunk-SK6EJEO7.js
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 getCrypto() {
3
11
  const c = globalThis.crypto;
4
12
  return c;
@@ -53,6 +61,20 @@ function base64Encode(bytes) {
53
61
  }
54
62
  return out;
55
63
  }
64
+ function runWithTracingSuppressed(fn) {
65
+ const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
66
+ if (typeof hook !== "function") return fn();
67
+ let started = false;
68
+ try {
69
+ return hook(() => {
70
+ started = true;
71
+ return fn();
72
+ });
73
+ } catch (err) {
74
+ if (started) throw err;
75
+ return fn();
76
+ }
77
+ }
56
78
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
57
79
  var MAX_RETRY_DELAY_MS = 3e4;
58
80
  function wait(ms) {
@@ -163,15 +185,17 @@ async function postJson(url, body, headers, opts) {
163
185
  const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
164
186
  await withRetry(
165
187
  async () => {
166
- const resp = await fetch(url, {
167
- method: "POST",
168
- headers: {
169
- "Content-Type": "application/json",
170
- ...headers
171
- },
172
- body: JSON.stringify(body),
173
- signal: AbortSignal.timeout(timeoutMs)
174
- });
188
+ const resp = await runWithTracingSuppressed(
189
+ () => fetch(url, {
190
+ method: "POST",
191
+ headers: {
192
+ "Content-Type": "application/json",
193
+ ...headers
194
+ },
195
+ body: JSON.stringify(body),
196
+ signal: AbortSignal.timeout(timeoutMs)
197
+ })
198
+ );
175
199
  if (!resp.ok) {
176
200
  const text = await resp.text().catch(() => "");
177
201
  const err = new Error(
@@ -417,13 +441,16 @@ function projectIdHeaders(projectId) {
417
441
  var SHUTDOWN_DEADLINE_MS = 1e4;
418
442
  var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
419
443
  function mergePatches(target, source) {
420
- var _a, _b, _c, _d;
444
+ var _a, _b, _c, _d, _e, _f;
421
445
  const out = { ...target, ...source };
422
446
  if (target.properties || source.properties) {
423
447
  out.properties = { ...(_a = target.properties) != null ? _a : {}, ...(_b = source.properties) != null ? _b : {} };
424
448
  }
449
+ if (target.featureFlags || source.featureFlags) {
450
+ out.featureFlags = { ...(_c = target.featureFlags) != null ? _c : {}, ...(_d = source.featureFlags) != null ? _d : {} };
451
+ }
425
452
  if (target.attachments || source.attachments) {
426
- out.attachments = [...(_c = target.attachments) != null ? _c : [], ...(_d = source.attachments) != null ? _d : []];
453
+ out.attachments = [...(_e = target.attachments) != null ? _e : [], ...(_f = source.attachments) != null ? _f : []];
427
454
  }
428
455
  return out;
429
456
  }
@@ -693,6 +720,7 @@ var EventShipper = class {
693
720
  ...wizardSession ? { "raindrop.wizardSession": wizardSession } : {},
694
721
  $context: this.context
695
722
  },
723
+ ...accumulated.featureFlags && Object.keys(accumulated.featureFlags).length > 0 ? { feature_flags: accumulated.featureFlags } : {},
696
724
  attachments: accumulated.attachments,
697
725
  is_pending: isPending
698
726
  };
@@ -1281,7 +1309,7 @@ async function* asyncGeneratorWithCurrent(span, gen) {
1281
1309
  // package.json
1282
1310
  var package_default = {
1283
1311
  name: "@raindrop-ai/ai-sdk",
1284
- version: "0.0.40"};
1312
+ version: "0.1.0"};
1285
1313
 
1286
1314
  // src/internal/version.ts
1287
1315
  var libraryName = package_default.name;
@@ -2703,6 +2731,20 @@ var RaindropTelemetryIntegration = class {
2703
2731
  } else if (properties && typeof properties === "object") {
2704
2732
  result.properties = properties;
2705
2733
  }
2734
+ const featureFlags = metadata["raindrop.featureFlags"];
2735
+ if (typeof featureFlags === "string") {
2736
+ try {
2737
+ const parsed = JSON.parse(featureFlags);
2738
+ if (parsed && typeof parsed === "object") {
2739
+ result.featureFlags = normalizeFeatureFlags(parsed);
2740
+ }
2741
+ } catch (e) {
2742
+ }
2743
+ } else if (featureFlags && typeof featureFlags === "object") {
2744
+ result.featureFlags = normalizeFeatureFlags(
2745
+ featureFlags
2746
+ );
2747
+ }
2706
2748
  return result;
2707
2749
  }
2708
2750
  /**
@@ -2917,7 +2959,7 @@ var RaindropTelemetryIntegration = class {
2917
2959
  * same event ID into a separate canonical row.
2918
2960
  */
2919
2961
  finalizeGenerateEvent(state, output, model, keepPending = false) {
2920
- var _a, _b, _c, _d, _e, _f, _g, _h;
2962
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2921
2963
  const suppressSubagentEvent = state.subagentName !== void 0 && state.subagentToolCallSpan !== void 0;
2922
2964
  if (!this.sendEvents || suppressSubagentEvent) return;
2923
2965
  const callMeta = this.extractRaindropMetadata(state.metadata);
@@ -2930,7 +2972,11 @@ var RaindropTelemetryIntegration = class {
2930
2972
  ...(_f = this.defaultContext) == null ? void 0 : _f.properties,
2931
2973
  ...callMeta.properties
2932
2974
  };
2933
- const convoId = (_h = callMeta.convoId) != null ? _h : (_g = this.defaultContext) == null ? void 0 : _g.convoId;
2975
+ const featureFlags = {
2976
+ ...(_g = this.defaultContext) == null ? void 0 : _g.featureFlags,
2977
+ ...callMeta.featureFlags
2978
+ };
2979
+ const convoId = (_i = callMeta.convoId) != null ? _i : (_h = this.defaultContext) == null ? void 0 : _h.convoId;
2934
2980
  void this.eventShipper.patch(state.eventId, {
2935
2981
  eventName,
2936
2982
  userId,
@@ -2939,6 +2985,7 @@ var RaindropTelemetryIntegration = class {
2939
2985
  output: cappedOutput,
2940
2986
  model,
2941
2987
  properties: Object.keys(properties).length > 0 ? properties : void 0,
2988
+ featureFlags: Object.keys(featureFlags).length > 0 ? featureFlags : void 0,
2942
2989
  isPending: keepPending
2943
2990
  }).catch((err) => {
2944
2991
  if (this.debug) {
@@ -3262,6 +3309,20 @@ function extractRaindropMetadata(metadata) {
3262
3309
  } else if (properties && typeof properties === "object") {
3263
3310
  result.properties = properties;
3264
3311
  }
3312
+ const featureFlags = metadata["raindrop.featureFlags"];
3313
+ if (typeof featureFlags === "string") {
3314
+ try {
3315
+ const parsed = JSON.parse(featureFlags);
3316
+ if (parsed && typeof parsed === "object") {
3317
+ result.featureFlags = normalizeFeatureFlags(parsed);
3318
+ }
3319
+ } catch (e) {
3320
+ }
3321
+ } else if (featureFlags && typeof featureFlags === "object") {
3322
+ result.featureFlags = normalizeFeatureFlags(
3323
+ featureFlags
3324
+ );
3325
+ }
3265
3326
  return result;
3266
3327
  }
3267
3328
  function mergeContexts(wrapTime, callTime) {
@@ -3276,6 +3337,10 @@ function mergeContexts(wrapTime, callTime) {
3276
3337
  ...callTime.properties
3277
3338
  };
3278
3339
  }
3340
+ if (callTime.featureFlags) {
3341
+ const wrapTimeFlags = wrapTime.featureFlags ? normalizeFeatureFlags(wrapTime.featureFlags) : {};
3342
+ result.featureFlags = { ...wrapTimeFlags, ...callTime.featureFlags };
3343
+ }
3279
3344
  return result;
3280
3345
  }
3281
3346
  function detectAISDKVersion(aiSDK) {
@@ -3588,6 +3653,7 @@ function createFinalize(params) {
3588
3653
  output: defaultOutput,
3589
3654
  model,
3590
3655
  properties: setup.ctx.properties,
3656
+ featureFlags: setup.ctx.featureFlags ? normalizeFeatureFlags(setup.ctx.featureFlags) : void 0,
3591
3657
  attachments: mergeAttachments(setup.ctx.attachments, inputAttachments, outputAttachments)
3592
3658
  };
3593
3659
  const built = await maybeBuildEvent(options.buildEvent, allMessages);
@@ -3641,6 +3707,7 @@ function createFinalize(params) {
3641
3707
  output,
3642
3708
  model: finalModel,
3643
3709
  properties: patch.properties,
3710
+ featureFlags: patch.featureFlags,
3644
3711
  attachments: patch.attachments,
3645
3712
  isPending: keepEventPending
3646
3713
  }).catch((err) => {
@@ -3872,7 +3939,8 @@ function wrapAISDK(aiSDK, deps) {
3872
3939
  eventId: wrapTimeCtx.eventId,
3873
3940
  eventName: wrapTimeCtx.eventName,
3874
3941
  convoId: wrapTimeCtx.convoId,
3875
- properties: wrapTimeCtx.properties
3942
+ properties: wrapTimeCtx.properties,
3943
+ featureFlags: wrapTimeCtx.featureFlags ? normalizeFeatureFlags(wrapTimeCtx.featureFlags) : void 0
3876
3944
  }
3877
3945
  });
3878
3946
  const registerFn = resolveRegisterTelemetry(aiSDK);
@@ -4148,6 +4216,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
4148
4216
  output: outputText,
4149
4217
  model,
4150
4218
  properties: ctx.properties,
4219
+ featureFlags: ctx.featureFlags ? normalizeFeatureFlags(ctx.featureFlags) : void 0,
4151
4220
  attachments: mergeAttachments(ctx.attachments, inputAttachments, outputAttachments)
4152
4221
  };
4153
4222
  const built = await maybeBuildEvent(deps.options.buildEvent, allMessages);
@@ -4215,6 +4284,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
4215
4284
  output,
4216
4285
  model: finalModel,
4217
4286
  properties: patch.properties,
4287
+ featureFlags: patch.featureFlags,
4218
4288
  attachments: patch.attachments,
4219
4289
  isPending: false
4220
4290
  }).catch((err) => {
@@ -4356,6 +4426,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
4356
4426
  output: outputText,
4357
4427
  model,
4358
4428
  properties: ctx.properties,
4429
+ featureFlags: ctx.featureFlags ? normalizeFeatureFlags(ctx.featureFlags) : void 0,
4359
4430
  attachments: mergeAttachments(ctx.attachments, inputAttachments, outputAttachments)
4360
4431
  };
4361
4432
  const built = await maybeBuildEvent(deps.options.buildEvent, allMessages);
@@ -4423,6 +4494,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
4423
4494
  output,
4424
4495
  model: finalModel,
4425
4496
  properties: patch.properties,
4497
+ featureFlags: patch.featureFlags,
4426
4498
  attachments: patch.attachments,
4427
4499
  isPending: false
4428
4500
  }).catch((err) => {
@@ -5020,7 +5092,7 @@ async function maybeBuildEvent(buildEvent, messages) {
5020
5092
  }
5021
5093
  }
5022
5094
  function mergeBuildEventPatch(defaults, override) {
5023
- var _a, _b, _c, _d, _e, _f, _g, _h;
5095
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5024
5096
  if (!override) return defaults;
5025
5097
  return {
5026
5098
  eventName: (_a = override.eventName) != null ? _a : defaults.eventName,
@@ -5028,7 +5100,8 @@ function mergeBuildEventPatch(defaults, override) {
5028
5100
  output: (_c = override.output) != null ? _c : defaults.output,
5029
5101
  model: (_d = override.model) != null ? _d : defaults.model,
5030
5102
  properties: override.properties !== void 0 ? { ...(_e = defaults.properties) != null ? _e : {}, ...(_f = override.properties) != null ? _f : {} } : defaults.properties,
5031
- attachments: override.attachments !== void 0 ? [...(_g = defaults.attachments) != null ? _g : [], ...(_h = override.attachments) != null ? _h : []] : defaults.attachments
5103
+ featureFlags: override.featureFlags !== void 0 ? { ...(_g = defaults.featureFlags) != null ? _g : {}, ...(_h = override.featureFlags) != null ? _h : {} } : defaults.featureFlags,
5104
+ attachments: override.attachments !== void 0 ? [...(_i = defaults.attachments) != null ? _i : [], ...(_j = override.attachments) != null ? _j : []] : defaults.attachments
5032
5105
  };
5033
5106
  }
5034
5107
  function mergeAttachments(...groups) {
@@ -5059,6 +5132,8 @@ function eventMetadata(options) {
5059
5132
  if (options.convoId) result["raindrop.convoId"] = options.convoId;
5060
5133
  if (options.eventName) result["raindrop.eventName"] = options.eventName;
5061
5134
  if (options.properties) result["raindrop.properties"] = JSON.stringify(options.properties);
5135
+ if (options.featureFlags)
5136
+ result["raindrop.featureFlags"] = JSON.stringify(normalizeFeatureFlags(options.featureFlags));
5062
5137
  return result;
5063
5138
  }
5064
5139
  function deriveChatTurnMessageId(request) {
@@ -5163,7 +5238,8 @@ function createRaindropAISDK(opts) {
5163
5238
  "eventId",
5164
5239
  "eventName",
5165
5240
  "convoId",
5166
- "properties"
5241
+ "properties",
5242
+ "featureFlags"
5167
5243
  ];
5168
5244
  let context;
5169
5245
  let subagentWrapping;
@@ -5195,6 +5271,9 @@ function createRaindropAISDK(opts) {
5195
5271
  async setProperties(eventId, properties) {
5196
5272
  await eventShipper.patch(eventId, { properties });
5197
5273
  },
5274
+ async setFeatureFlags(eventId, featureFlags) {
5275
+ await eventShipper.patch(eventId, { featureFlags: normalizeFeatureFlags(featureFlags) });
5276
+ },
5198
5277
  async finish(eventId, patch) {
5199
5278
  await eventShipper.finish(eventId, patch);
5200
5279
  }
@@ -5295,4 +5374,4 @@ function raindrop(options = {}) {
5295
5374
  return client.createTelemetryIntegration({ context, subagentWrapping });
5296
5375
  }
5297
5376
 
5298
- export { DEFAULT_MAX_TEXT_FIELD_CHARS2 as DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER2 as TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText2 as capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent };
5377
+ export { DEFAULT_MAX_TEXT_FIELD_CHARS2 as DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER2 as TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText2 as capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, normalizeFeatureFlags, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent };
@@ -1,4 +1,4 @@
1
- export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D82pma6B.mjs';
1
+ export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, F as FeatureFlagValue, l as FeatureFlags, I as IdentifyInput, O as OtlpAnyValue, m as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, n as RaindropAISDKClient, o as RaindropAISDKContext, p as RaindropAISDKOptions, q as RaindropCallMetadata, r as RaindropTelemetryIntegration, s as RaindropTelemetryIntegrationOptions, t as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, u as SelfDiagnosticsSignalDefinition, v as SelfDiagnosticsSignalDefinitions, w as SelfDiagnosticsTool, x as SelfDiagnosticsToolInput, y as SelfDiagnosticsToolOptions, z as SelfDiagnosticsToolResult, G as StartSpanArgs, T as TRUNCATION_MARKER, H as TraceSpan, J as TransformSpanHook, W as WrapAISDKOptions, K as WrappedAI, L as WrappedAISDK, _ as _resetParentToolContextStorage, M as _resetRaindropCallMetadataStorage, N as _resetWarnedMissingUserId, Q as boundedStringify, U as capText, V as clearParentToolContext, X as createRaindropAISDK, Y as currentSpan, Z as defaultTransformSpan, $ as enterParentToolContext, a0 as eventMetadata, a1 as eventMetadataFromChatRequest, a2 as getContextManager, a3 as getCurrentParentToolContext, a4 as getCurrentRaindropCallMetadata, a5 as normalizeFeatureFlags, a6 as raindrop, a7 as readRaindropCallMetadataFromArgs, a8 as redactJsonAttributeValue, a9 as redactSecretsInObject, aa as runWithParentToolContext, ab as runWithRaindropCallMetadata, ac as withCurrent } from './index-CUR4qgwL.mjs';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
@@ -1,4 +1,4 @@
1
- export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D82pma6B.js';
1
+ export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, F as FeatureFlagValue, l as FeatureFlags, I as IdentifyInput, O as OtlpAnyValue, m as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, n as RaindropAISDKClient, o as RaindropAISDKContext, p as RaindropAISDKOptions, q as RaindropCallMetadata, r as RaindropTelemetryIntegration, s as RaindropTelemetryIntegrationOptions, t as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, u as SelfDiagnosticsSignalDefinition, v as SelfDiagnosticsSignalDefinitions, w as SelfDiagnosticsTool, x as SelfDiagnosticsToolInput, y as SelfDiagnosticsToolOptions, z as SelfDiagnosticsToolResult, G as StartSpanArgs, T as TRUNCATION_MARKER, H as TraceSpan, J as TransformSpanHook, W as WrapAISDKOptions, K as WrappedAI, L as WrappedAISDK, _ as _resetParentToolContextStorage, M as _resetRaindropCallMetadataStorage, N as _resetWarnedMissingUserId, Q as boundedStringify, U as capText, V as clearParentToolContext, X as createRaindropAISDK, Y as currentSpan, Z as defaultTransformSpan, $ as enterParentToolContext, a0 as eventMetadata, a1 as eventMetadataFromChatRequest, a2 as getContextManager, a3 as getCurrentParentToolContext, a4 as getCurrentRaindropCallMetadata, a5 as normalizeFeatureFlags, a6 as raindrop, a7 as readRaindropCallMetadataFromArgs, a8 as redactJsonAttributeValue, a9 as redactSecretsInObject, aa as runWithParentToolContext, ab as runWithRaindropCallMetadata, ac as withCurrent } from './index-CUR4qgwL.js';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
@@ -4,7 +4,15 @@ var async_hooks = require('async_hooks');
4
4
 
5
5
  // src/index.node.ts
6
6
 
7
- // ../core/dist/chunk-SK6EJEO7.js
7
+ // ../core/dist/chunk-Y5LUB7OE.js
8
+ function normalizeFeatureFlags(input) {
9
+ if (Array.isArray(input)) {
10
+ return Object.fromEntries(input.map((name) => [name, "true"]));
11
+ }
12
+ return Object.fromEntries(
13
+ Object.entries(input).map(([k, v]) => [k, String(v)])
14
+ );
15
+ }
8
16
  function getCrypto() {
9
17
  const c = globalThis.crypto;
10
18
  return c;
@@ -59,6 +67,20 @@ function base64Encode(bytes) {
59
67
  }
60
68
  return out;
61
69
  }
70
+ function runWithTracingSuppressed(fn) {
71
+ const hook = globalThis.RAINDROP_SUPPRESS_TRACING;
72
+ if (typeof hook !== "function") return fn();
73
+ let started = false;
74
+ try {
75
+ return hook(() => {
76
+ started = true;
77
+ return fn();
78
+ });
79
+ } catch (err) {
80
+ if (started) throw err;
81
+ return fn();
82
+ }
83
+ }
62
84
  var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
63
85
  var MAX_RETRY_DELAY_MS = 3e4;
64
86
  function wait(ms) {
@@ -169,15 +191,17 @@ async function postJson(url, body, headers, opts) {
169
191
  const timeoutMs = (_a = opts.timeoutMs) != null ? _a : DEFAULT_REQUEST_TIMEOUT_MS;
170
192
  await withRetry(
171
193
  async () => {
172
- const resp = await fetch(url, {
173
- method: "POST",
174
- headers: {
175
- "Content-Type": "application/json",
176
- ...headers
177
- },
178
- body: JSON.stringify(body),
179
- signal: AbortSignal.timeout(timeoutMs)
180
- });
194
+ const resp = await runWithTracingSuppressed(
195
+ () => fetch(url, {
196
+ method: "POST",
197
+ headers: {
198
+ "Content-Type": "application/json",
199
+ ...headers
200
+ },
201
+ body: JSON.stringify(body),
202
+ signal: AbortSignal.timeout(timeoutMs)
203
+ })
204
+ );
181
205
  if (!resp.ok) {
182
206
  const text = await resp.text().catch(() => "");
183
207
  const err = new Error(
@@ -423,13 +447,16 @@ function projectIdHeaders(projectId) {
423
447
  var SHUTDOWN_DEADLINE_MS = 1e4;
424
448
  var POST_SHUTDOWN_TIMEOUT_MS = 5e3;
425
449
  function mergePatches(target, source) {
426
- var _a, _b, _c, _d;
450
+ var _a, _b, _c, _d, _e, _f;
427
451
  const out = { ...target, ...source };
428
452
  if (target.properties || source.properties) {
429
453
  out.properties = { ...(_a = target.properties) != null ? _a : {}, ...(_b = source.properties) != null ? _b : {} };
430
454
  }
455
+ if (target.featureFlags || source.featureFlags) {
456
+ out.featureFlags = { ...(_c = target.featureFlags) != null ? _c : {}, ...(_d = source.featureFlags) != null ? _d : {} };
457
+ }
431
458
  if (target.attachments || source.attachments) {
432
- out.attachments = [...(_c = target.attachments) != null ? _c : [], ...(_d = source.attachments) != null ? _d : []];
459
+ out.attachments = [...(_e = target.attachments) != null ? _e : [], ...(_f = source.attachments) != null ? _f : []];
433
460
  }
434
461
  return out;
435
462
  }
@@ -699,6 +726,7 @@ var EventShipper = class {
699
726
  ...wizardSession ? { "raindrop.wizardSession": wizardSession } : {},
700
727
  $context: this.context
701
728
  },
729
+ ...accumulated.featureFlags && Object.keys(accumulated.featureFlags).length > 0 ? { feature_flags: accumulated.featureFlags } : {},
702
730
  attachments: accumulated.attachments,
703
731
  is_pending: isPending
704
732
  };
@@ -1284,11 +1312,36 @@ async function* asyncGeneratorWithCurrent(span, gen) {
1284
1312
  }
1285
1313
  }
1286
1314
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = async_hooks.AsyncLocalStorage;
1315
+ var SUPPRESS_TRACING_KEY = /* @__PURE__ */ Symbol.for(
1316
+ "OpenTelemetry SDK Context Key SUPPRESS_TRACING"
1317
+ );
1318
+ function findOtelContextManager() {
1319
+ var _a;
1320
+ for (const sym of Object.getOwnPropertySymbols(globalThis)) {
1321
+ if (!((_a = sym.description) == null ? void 0 : _a.startsWith("opentelemetry.js.api."))) continue;
1322
+ const api = globalThis[sym];
1323
+ const cm = api == null ? void 0 : api.context;
1324
+ if (cm && typeof cm.with === "function" && typeof cm.active === "function") {
1325
+ return cm;
1326
+ }
1327
+ }
1328
+ return void 0;
1329
+ }
1330
+ function installTracingSuppressionHook() {
1331
+ if (typeof globalThis.RAINDROP_SUPPRESS_TRACING === "function") return;
1332
+ const hook = (fn) => {
1333
+ const cm = findOtelContextManager();
1334
+ if (!cm) return fn();
1335
+ return cm.with(cm.active().setValue(SUPPRESS_TRACING_KEY, true), fn);
1336
+ };
1337
+ globalThis.RAINDROP_SUPPRESS_TRACING = hook;
1338
+ }
1339
+ installTracingSuppressionHook();
1287
1340
 
1288
1341
  // package.json
1289
1342
  var package_default = {
1290
1343
  name: "@raindrop-ai/ai-sdk",
1291
- version: "0.0.40"};
1344
+ version: "0.1.0"};
1292
1345
 
1293
1346
  // src/internal/version.ts
1294
1347
  var libraryName = package_default.name;
@@ -2710,6 +2763,20 @@ var RaindropTelemetryIntegration = class {
2710
2763
  } else if (properties && typeof properties === "object") {
2711
2764
  result.properties = properties;
2712
2765
  }
2766
+ const featureFlags = metadata["raindrop.featureFlags"];
2767
+ if (typeof featureFlags === "string") {
2768
+ try {
2769
+ const parsed = JSON.parse(featureFlags);
2770
+ if (parsed && typeof parsed === "object") {
2771
+ result.featureFlags = normalizeFeatureFlags(parsed);
2772
+ }
2773
+ } catch (e) {
2774
+ }
2775
+ } else if (featureFlags && typeof featureFlags === "object") {
2776
+ result.featureFlags = normalizeFeatureFlags(
2777
+ featureFlags
2778
+ );
2779
+ }
2713
2780
  return result;
2714
2781
  }
2715
2782
  /**
@@ -2924,7 +2991,7 @@ var RaindropTelemetryIntegration = class {
2924
2991
  * same event ID into a separate canonical row.
2925
2992
  */
2926
2993
  finalizeGenerateEvent(state, output, model, keepPending = false) {
2927
- var _a, _b, _c, _d, _e, _f, _g, _h;
2994
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2928
2995
  const suppressSubagentEvent = state.subagentName !== void 0 && state.subagentToolCallSpan !== void 0;
2929
2996
  if (!this.sendEvents || suppressSubagentEvent) return;
2930
2997
  const callMeta = this.extractRaindropMetadata(state.metadata);
@@ -2937,7 +3004,11 @@ var RaindropTelemetryIntegration = class {
2937
3004
  ...(_f = this.defaultContext) == null ? void 0 : _f.properties,
2938
3005
  ...callMeta.properties
2939
3006
  };
2940
- const convoId = (_h = callMeta.convoId) != null ? _h : (_g = this.defaultContext) == null ? void 0 : _g.convoId;
3007
+ const featureFlags = {
3008
+ ...(_g = this.defaultContext) == null ? void 0 : _g.featureFlags,
3009
+ ...callMeta.featureFlags
3010
+ };
3011
+ const convoId = (_i = callMeta.convoId) != null ? _i : (_h = this.defaultContext) == null ? void 0 : _h.convoId;
2941
3012
  void this.eventShipper.patch(state.eventId, {
2942
3013
  eventName,
2943
3014
  userId,
@@ -2946,6 +3017,7 @@ var RaindropTelemetryIntegration = class {
2946
3017
  output: cappedOutput,
2947
3018
  model,
2948
3019
  properties: Object.keys(properties).length > 0 ? properties : void 0,
3020
+ featureFlags: Object.keys(featureFlags).length > 0 ? featureFlags : void 0,
2949
3021
  isPending: keepPending
2950
3022
  }).catch((err) => {
2951
3023
  if (this.debug) {
@@ -3269,6 +3341,20 @@ function extractRaindropMetadata(metadata) {
3269
3341
  } else if (properties && typeof properties === "object") {
3270
3342
  result.properties = properties;
3271
3343
  }
3344
+ const featureFlags = metadata["raindrop.featureFlags"];
3345
+ if (typeof featureFlags === "string") {
3346
+ try {
3347
+ const parsed = JSON.parse(featureFlags);
3348
+ if (parsed && typeof parsed === "object") {
3349
+ result.featureFlags = normalizeFeatureFlags(parsed);
3350
+ }
3351
+ } catch (e) {
3352
+ }
3353
+ } else if (featureFlags && typeof featureFlags === "object") {
3354
+ result.featureFlags = normalizeFeatureFlags(
3355
+ featureFlags
3356
+ );
3357
+ }
3272
3358
  return result;
3273
3359
  }
3274
3360
  function mergeContexts(wrapTime, callTime) {
@@ -3283,6 +3369,10 @@ function mergeContexts(wrapTime, callTime) {
3283
3369
  ...callTime.properties
3284
3370
  };
3285
3371
  }
3372
+ if (callTime.featureFlags) {
3373
+ const wrapTimeFlags = wrapTime.featureFlags ? normalizeFeatureFlags(wrapTime.featureFlags) : {};
3374
+ result.featureFlags = { ...wrapTimeFlags, ...callTime.featureFlags };
3375
+ }
3286
3376
  return result;
3287
3377
  }
3288
3378
  function detectAISDKVersion(aiSDK) {
@@ -3595,6 +3685,7 @@ function createFinalize(params) {
3595
3685
  output: defaultOutput,
3596
3686
  model,
3597
3687
  properties: setup.ctx.properties,
3688
+ featureFlags: setup.ctx.featureFlags ? normalizeFeatureFlags(setup.ctx.featureFlags) : void 0,
3598
3689
  attachments: mergeAttachments(setup.ctx.attachments, inputAttachments, outputAttachments)
3599
3690
  };
3600
3691
  const built = await maybeBuildEvent(options.buildEvent, allMessages);
@@ -3648,6 +3739,7 @@ function createFinalize(params) {
3648
3739
  output,
3649
3740
  model: finalModel,
3650
3741
  properties: patch.properties,
3742
+ featureFlags: patch.featureFlags,
3651
3743
  attachments: patch.attachments,
3652
3744
  isPending: keepEventPending
3653
3745
  }).catch((err) => {
@@ -3879,7 +3971,8 @@ function wrapAISDK(aiSDK, deps) {
3879
3971
  eventId: wrapTimeCtx.eventId,
3880
3972
  eventName: wrapTimeCtx.eventName,
3881
3973
  convoId: wrapTimeCtx.convoId,
3882
- properties: wrapTimeCtx.properties
3974
+ properties: wrapTimeCtx.properties,
3975
+ featureFlags: wrapTimeCtx.featureFlags ? normalizeFeatureFlags(wrapTimeCtx.featureFlags) : void 0
3883
3976
  }
3884
3977
  });
3885
3978
  const registerFn = resolveRegisterTelemetry(aiSDK);
@@ -4155,6 +4248,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
4155
4248
  output: outputText,
4156
4249
  model,
4157
4250
  properties: ctx.properties,
4251
+ featureFlags: ctx.featureFlags ? normalizeFeatureFlags(ctx.featureFlags) : void 0,
4158
4252
  attachments: mergeAttachments(ctx.attachments, inputAttachments, outputAttachments)
4159
4253
  };
4160
4254
  const built = await maybeBuildEvent(deps.options.buildEvent, allMessages);
@@ -4222,6 +4316,7 @@ function wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK,
4222
4316
  output,
4223
4317
  model: finalModel,
4224
4318
  properties: patch.properties,
4319
+ featureFlags: patch.featureFlags,
4225
4320
  attachments: patch.attachments,
4226
4321
  isPending: false
4227
4322
  }).catch((err) => {
@@ -4363,6 +4458,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
4363
4458
  output: outputText,
4364
4459
  model,
4365
4460
  properties: ctx.properties,
4461
+ featureFlags: ctx.featureFlags ? normalizeFeatureFlags(ctx.featureFlags) : void 0,
4366
4462
  attachments: mergeAttachments(ctx.attachments, inputAttachments, outputAttachments)
4367
4463
  };
4368
4464
  const built = await maybeBuildEvent(deps.options.buildEvent, allMessages);
@@ -4430,6 +4526,7 @@ function wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps
4430
4526
  output,
4431
4527
  model: finalModel,
4432
4528
  properties: patch.properties,
4529
+ featureFlags: patch.featureFlags,
4433
4530
  attachments: patch.attachments,
4434
4531
  isPending: false
4435
4532
  }).catch((err) => {
@@ -5027,7 +5124,7 @@ async function maybeBuildEvent(buildEvent, messages) {
5027
5124
  }
5028
5125
  }
5029
5126
  function mergeBuildEventPatch(defaults, override) {
5030
- var _a, _b, _c, _d, _e, _f, _g, _h;
5127
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5031
5128
  if (!override) return defaults;
5032
5129
  return {
5033
5130
  eventName: (_a = override.eventName) != null ? _a : defaults.eventName,
@@ -5035,7 +5132,8 @@ function mergeBuildEventPatch(defaults, override) {
5035
5132
  output: (_c = override.output) != null ? _c : defaults.output,
5036
5133
  model: (_d = override.model) != null ? _d : defaults.model,
5037
5134
  properties: override.properties !== void 0 ? { ...(_e = defaults.properties) != null ? _e : {}, ...(_f = override.properties) != null ? _f : {} } : defaults.properties,
5038
- attachments: override.attachments !== void 0 ? [...(_g = defaults.attachments) != null ? _g : [], ...(_h = override.attachments) != null ? _h : []] : defaults.attachments
5135
+ featureFlags: override.featureFlags !== void 0 ? { ...(_g = defaults.featureFlags) != null ? _g : {}, ...(_h = override.featureFlags) != null ? _h : {} } : defaults.featureFlags,
5136
+ attachments: override.attachments !== void 0 ? [...(_i = defaults.attachments) != null ? _i : [], ...(_j = override.attachments) != null ? _j : []] : defaults.attachments
5039
5137
  };
5040
5138
  }
5041
5139
  function mergeAttachments(...groups) {
@@ -5066,6 +5164,8 @@ function eventMetadata(options) {
5066
5164
  if (options.convoId) result["raindrop.convoId"] = options.convoId;
5067
5165
  if (options.eventName) result["raindrop.eventName"] = options.eventName;
5068
5166
  if (options.properties) result["raindrop.properties"] = JSON.stringify(options.properties);
5167
+ if (options.featureFlags)
5168
+ result["raindrop.featureFlags"] = JSON.stringify(normalizeFeatureFlags(options.featureFlags));
5069
5169
  return result;
5070
5170
  }
5071
5171
  function deriveChatTurnMessageId(request) {
@@ -5170,7 +5270,8 @@ function createRaindropAISDK(opts) {
5170
5270
  "eventId",
5171
5271
  "eventName",
5172
5272
  "convoId",
5173
- "properties"
5273
+ "properties",
5274
+ "featureFlags"
5174
5275
  ];
5175
5276
  let context;
5176
5277
  let subagentWrapping;
@@ -5202,6 +5303,9 @@ function createRaindropAISDK(opts) {
5202
5303
  async setProperties(eventId, properties) {
5203
5304
  await eventShipper.patch(eventId, { properties });
5204
5305
  },
5306
+ async setFeatureFlags(eventId, featureFlags) {
5307
+ await eventShipper.patch(eventId, { featureFlags: normalizeFeatureFlags(featureFlags) });
5308
+ },
5205
5309
  async finish(eventId, patch) {
5206
5310
  await eventShipper.finish(eventId, patch);
5207
5311
  }
@@ -5326,6 +5430,7 @@ exports.eventMetadataFromChatRequest = eventMetadataFromChatRequest;
5326
5430
  exports.getContextManager = getContextManager;
5327
5431
  exports.getCurrentParentToolContext = getCurrentParentToolContext;
5328
5432
  exports.getCurrentRaindropCallMetadata = getCurrentRaindropCallMetadata;
5433
+ exports.normalizeFeatureFlags = normalizeFeatureFlags;
5329
5434
  exports.raindrop = raindrop;
5330
5435
  exports.readRaindropCallMetadataFromArgs = readRaindropCallMetadataFromArgs;
5331
5436
  exports.redactJsonAttributeValue = redactJsonAttributeValue;
@@ -1,4 +1,4 @@
1
- export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-KTT4YMAW.mjs';
1
+ export { DEFAULT_MAX_TEXT_FIELD_CHARS, DEFAULT_REDACT_ATTRIBUTE_KEYS, DEFAULT_SECRET_KEY_NAMES, REDACTED_PLACEHOLDER, RaindropTelemetryIntegration, TRUNCATION_MARKER, _resetParentToolContextStorage, _resetRaindropCallMetadataStorage, _resetWarnedMissingUserId, boundedStringify, capText, clearParentToolContext, createRaindropAISDK, currentSpan, defaultTransformSpan, enterParentToolContext, eventMetadata, eventMetadataFromChatRequest, getContextManager, getCurrentParentToolContext, getCurrentRaindropCallMetadata, normalizeFeatureFlags, raindrop, readRaindropCallMetadataFromArgs, redactJsonAttributeValue, redactSecretsInObject, runWithParentToolContext, runWithRaindropCallMetadata, withCurrent } from './chunk-ETGFVXYM.mjs';
2
2
  import { AsyncLocalStorage } from 'async_hooks';
3
3
 
4
4
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
@@ -1,4 +1,4 @@
1
- export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, I as IdentifyInput, O as OtlpAnyValue, l as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, m as RaindropAISDKClient, n as RaindropAISDKContext, o as RaindropAISDKOptions, p as RaindropCallMetadata, q as RaindropTelemetryIntegration, r as RaindropTelemetryIntegrationOptions, s as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, t as SelfDiagnosticsSignalDefinition, u as SelfDiagnosticsSignalDefinitions, v as SelfDiagnosticsTool, w as SelfDiagnosticsToolInput, x as SelfDiagnosticsToolOptions, y as SelfDiagnosticsToolResult, z as StartSpanArgs, T as TRUNCATION_MARKER, F as TraceSpan, G as TransformSpanHook, W as WrapAISDKOptions, H as WrappedAI, J as WrappedAISDK, _ as _resetParentToolContextStorage, K as _resetRaindropCallMetadataStorage, L as _resetWarnedMissingUserId, M as boundedStringify, N as capText, Q as clearParentToolContext, U as createRaindropAISDK, V as currentSpan, X as defaultTransformSpan, Y as enterParentToolContext, Z as eventMetadata, $ as eventMetadataFromChatRequest, a0 as getContextManager, a1 as getCurrentParentToolContext, a2 as getCurrentRaindropCallMetadata, a3 as raindrop, a4 as readRaindropCallMetadataFromArgs, a5 as redactJsonAttributeValue, a6 as redactSecretsInObject, a7 as runWithParentToolContext, a8 as runWithRaindropCallMetadata, a9 as withCurrent } from './index-D82pma6B.mjs';
1
+ export { A as AISDKChatRequestLike, a as AISDKChatRequestMessageLike, b as AISDKMessage, c as AgentCallMetadata, d as AgentWithMetadata, e as Attachment, B as BuildEventPatch, C as ContextManager, f as ContextSpan, g as CreateSpanArgs, D as DEFAULT_MAX_TEXT_FIELD_CHARS, h as DEFAULT_REDACT_ATTRIBUTE_KEYS, i as DEFAULT_SECRET_KEY_NAMES, E as EndSpanArgs, j as EventBuilder, k as EventMetadataOptions, F as FeatureFlagValue, l as FeatureFlags, I as IdentifyInput, O as OtlpAnyValue, m as OtlpSpan, P as ParentToolContext, R as REDACTED_PLACEHOLDER, n as RaindropAISDKClient, o as RaindropAISDKContext, p as RaindropAISDKOptions, q as RaindropCallMetadata, r as RaindropTelemetryIntegration, s as RaindropTelemetryIntegrationOptions, t as RaindropTelemetryOptions, S as SelfDiagnosticsOptions, u as SelfDiagnosticsSignalDefinition, v as SelfDiagnosticsSignalDefinitions, w as SelfDiagnosticsTool, x as SelfDiagnosticsToolInput, y as SelfDiagnosticsToolOptions, z as SelfDiagnosticsToolResult, G as StartSpanArgs, T as TRUNCATION_MARKER, H as TraceSpan, J as TransformSpanHook, W as WrapAISDKOptions, K as WrappedAI, L as WrappedAISDK, _ as _resetParentToolContextStorage, M as _resetRaindropCallMetadataStorage, N as _resetWarnedMissingUserId, Q as boundedStringify, U as capText, V as clearParentToolContext, X as createRaindropAISDK, Y as currentSpan, Z as defaultTransformSpan, $ as enterParentToolContext, a0 as eventMetadata, a1 as eventMetadataFromChatRequest, a2 as getContextManager, a3 as getCurrentParentToolContext, a4 as getCurrentRaindropCallMetadata, a5 as normalizeFeatureFlags, a6 as raindrop, a7 as readRaindropCallMetadataFromArgs, a8 as redactJsonAttributeValue, a9 as redactSecretsInObject, aa as runWithParentToolContext, ab as runWithRaindropCallMetadata, ac as withCurrent } from './index-CUR4qgwL.mjs';
2
2
 
3
3
  declare global {
4
4
  var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {