raindrop-ai 0.2.2 → 0.2.3-otelv2

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.
@@ -4,7 +4,7 @@ if (!globalThis.RAINDROP_ASYNC_LOCAL_STORAGE) {
4
4
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = AsyncLocalStorage;
5
5
  }
6
6
 
7
- // ../core/dist/chunk-ITAZONWL.js
7
+ // ../core/dist/chunk-QTUH3BHZ.js
8
8
  function normalizeFeatureFlags(input) {
9
9
  if (Array.isArray(input)) {
10
10
  return Object.fromEntries(input.map((name) => [name, "true"]));
@@ -597,7 +597,7 @@ installTracingSuppressionHook();
597
597
  // package.json
598
598
  var package_default = {
599
599
  name: "raindrop-ai",
600
- version: "0.2.2",
600
+ version: "0.2.3",
601
601
  main: "dist/index.js",
602
602
  module: "dist/index.mjs",
603
603
  types: "dist/index.d.ts",
@@ -3150,6 +3150,7 @@ export {
3150
3150
  capText,
3151
3151
  stringifyBounded,
3152
3152
  resolveLocalDebuggerBaseUrl,
3153
+ localDebuggerEnabled,
3153
3154
  mirrorPartialEventToLocalDebugger,
3154
3155
  normalizeProjectId,
3155
3156
  projectIdHeaders,
package/dist/index.d.mts CHANGED
@@ -943,6 +943,23 @@ interface AnalyticsConfig {
943
943
  } & Record<string, unknown>;
944
944
  }
945
945
  declare const MAX_INGEST_SIZE_BYTES: number;
946
+ /**
947
+ * Resolve the effective `disableBatching` flag that decides whether tracing
948
+ * uses `SimpleSpanProcessor` (immediate export) or `BatchSpanProcessor`.
949
+ *
950
+ * Precedence:
951
+ * 1. An explicit `config.disableBatching` always wins, in both directions.
952
+ * 2. Otherwise, batching is disabled when NOT in production (existing
953
+ * behavior) OR when the local debugger (Workshop) is active — so spans
954
+ * deliver immediately to Workshop even under `NODE_ENV=production`.
955
+ *
956
+ * Production behavior for consumers is unchanged: with no local debugger and
957
+ * no explicit config, this returns `false` (i.e. batching stays on).
958
+ */
959
+ declare function resolveDisableBatching(explicit: boolean | undefined, signals: {
960
+ isProduction: boolean;
961
+ isLocalDebugger: boolean;
962
+ }): boolean;
946
963
  declare class Raindrop {
947
964
  private wizardSession;
948
965
  private writeKey;
@@ -1156,4 +1173,4 @@ declare class Raindrop {
1156
1173
  private closeWithinDeadline;
1157
1174
  }
1158
1175
 
1159
- 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 };
1176
+ 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, resolveDisableBatching };
package/dist/index.d.ts CHANGED
@@ -943,6 +943,23 @@ interface AnalyticsConfig {
943
943
  } & Record<string, unknown>;
944
944
  }
945
945
  declare const MAX_INGEST_SIZE_BYTES: number;
946
+ /**
947
+ * Resolve the effective `disableBatching` flag that decides whether tracing
948
+ * uses `SimpleSpanProcessor` (immediate export) or `BatchSpanProcessor`.
949
+ *
950
+ * Precedence:
951
+ * 1. An explicit `config.disableBatching` always wins, in both directions.
952
+ * 2. Otherwise, batching is disabled when NOT in production (existing
953
+ * behavior) OR when the local debugger (Workshop) is active — so spans
954
+ * deliver immediately to Workshop even under `NODE_ENV=production`.
955
+ *
956
+ * Production behavior for consumers is unchanged: with no local debugger and
957
+ * no explicit config, this returns `false` (i.e. batching stays on).
958
+ */
959
+ declare function resolveDisableBatching(explicit: boolean | undefined, signals: {
960
+ isProduction: boolean;
961
+ isLocalDebugger: boolean;
962
+ }): boolean;
946
963
  declare class Raindrop {
947
964
  private wizardSession;
948
965
  private writeKey;
@@ -1156,4 +1173,4 @@ declare class Raindrop {
1156
1173
  private closeWithinDeadline;
1157
1174
  }
1158
1175
 
1159
- 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 };
1176
+ 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, resolveDisableBatching };
package/dist/index.js CHANGED
@@ -5767,7 +5767,8 @@ var index_exports = {};
5767
5767
  __export(index_exports, {
5768
5768
  MAX_INGEST_SIZE_BYTES: () => MAX_INGEST_SIZE_BYTES,
5769
5769
  Raindrop: () => Raindrop,
5770
- default: () => index_default
5770
+ default: () => index_default,
5771
+ resolveDisableBatching: () => resolveDisableBatching
5771
5772
  });
5772
5773
  module.exports = __toCommonJS(index_exports);
5773
5774
 
@@ -5777,7 +5778,7 @@ if (!globalThis.RAINDROP_ASYNC_LOCAL_STORAGE) {
5777
5778
  globalThis.RAINDROP_ASYNC_LOCAL_STORAGE = import_node_async_hooks.AsyncLocalStorage;
5778
5779
  }
5779
5780
 
5780
- // ../core/dist/chunk-ITAZONWL.js
5781
+ // ../core/dist/chunk-QTUH3BHZ.js
5781
5782
  function normalizeFeatureFlags(input) {
5782
5783
  if (Array.isArray(input)) {
5783
5784
  return Object.fromEntries(input.map((name) => [name, "true"]));
@@ -10476,7 +10477,7 @@ var SignalEventSchema = external_exports.object({
10476
10477
  // package.json
10477
10478
  var package_default = {
10478
10479
  name: "raindrop-ai",
10479
- version: "0.2.2",
10480
+ version: "0.2.3",
10480
10481
  main: "dist/index.js",
10481
10482
  module: "dist/index.mjs",
10482
10483
  types: "dist/index.d.ts",
@@ -13279,6 +13280,9 @@ async function withRetry3(operation, opName, maxAttempts, debugLogs = false) {
13279
13280
  }
13280
13281
  throw lastError instanceof Error ? lastError : new Error(String(lastError));
13281
13282
  }
13283
+ function resolveDisableBatching(explicit, signals) {
13284
+ return explicit != null ? explicit : !signals.isProduction || signals.isLocalDebugger;
13285
+ }
13282
13286
  var Raindrop = class {
13283
13287
  constructor(config) {
13284
13288
  this.flushTimer = null;
@@ -13296,7 +13300,7 @@ var Raindrop = class {
13296
13300
  * retry schedule.
13297
13301
  */
13298
13302
  this.hasShutdown = false;
13299
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
13303
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13300
13304
  setDefaultMaxTextFieldChars(config.maxTextFieldChars);
13301
13305
  this.maxTextFieldChars = resolveMaxTextFieldChars(config.maxTextFieldChars);
13302
13306
  this.writeKey = (_a = config.writeKey) != null ? _a : "";
@@ -13326,8 +13330,10 @@ var Raindrop = class {
13326
13330
  }
13327
13331
  const useExternalOtel = (_j = (_i = config.useExternalOtel) != null ? _i : config.disableTracing) != null ? _j : false;
13328
13332
  const url = new URL(this.apiUrl);
13329
- const isProduction = process.env.NODE_ENV === "production";
13330
- const disableBatching = (_k = config.disableBatching) != null ? _k : !isProduction;
13333
+ const disableBatching = resolveDisableBatching(config.disableBatching, {
13334
+ isProduction: process.env.NODE_ENV === "production",
13335
+ isLocalDebugger: localDebuggerEnabled(this.localDebuggerUrlOpt)
13336
+ });
13331
13337
  this._tracing = tracing(
13332
13338
  this,
13333
13339
  url.origin,
@@ -14271,7 +14277,8 @@ var index_default = Raindrop;
14271
14277
  // Annotate the CommonJS export names for ESM import in node:
14272
14278
  0 && (module.exports = {
14273
14279
  MAX_INGEST_SIZE_BYTES,
14274
- Raindrop
14280
+ Raindrop,
14281
+ resolveDisableBatching
14275
14282
  });
14276
14283
  /*! Bundled license information:
14277
14284
 
package/dist/index.mjs CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  SHUTDOWN_DEADLINE_MS,
6
6
  authHintForKey,
7
7
  capText,
8
+ localDebuggerEnabled,
8
9
  mirrorPartialEventToLocalDebugger,
9
10
  normalizeFeatureFlags,
10
11
  normalizeProjectId,
@@ -20,7 +21,7 @@ import {
20
21
  stringifyBounded,
21
22
  tracing,
22
23
  withRoutingContext
23
- } from "./chunk-2EGS66V2.mjs";
24
+ } from "./chunk-7UHYFSYI.mjs";
24
25
  import {
25
26
  __commonJS,
26
27
  __toESM
@@ -10136,6 +10137,9 @@ async function withRetry(operation, opName, maxAttempts, debugLogs = false) {
10136
10137
  }
10137
10138
  throw lastError instanceof Error ? lastError : new Error(String(lastError));
10138
10139
  }
10140
+ function resolveDisableBatching(explicit, signals) {
10141
+ return explicit != null ? explicit : !signals.isProduction || signals.isLocalDebugger;
10142
+ }
10139
10143
  var Raindrop = class {
10140
10144
  constructor(config) {
10141
10145
  this.flushTimer = null;
@@ -10153,7 +10157,7 @@ var Raindrop = class {
10153
10157
  * retry schedule.
10154
10158
  */
10155
10159
  this.hasShutdown = false;
10156
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
10160
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10157
10161
  setDefaultMaxTextFieldChars(config.maxTextFieldChars);
10158
10162
  this.maxTextFieldChars = resolveMaxTextFieldChars(config.maxTextFieldChars);
10159
10163
  this.writeKey = (_a = config.writeKey) != null ? _a : "";
@@ -10183,8 +10187,10 @@ var Raindrop = class {
10183
10187
  }
10184
10188
  const useExternalOtel = (_j = (_i = config.useExternalOtel) != null ? _i : config.disableTracing) != null ? _j : false;
10185
10189
  const url = new URL(this.apiUrl);
10186
- const isProduction = process.env.NODE_ENV === "production";
10187
- const disableBatching = (_k = config.disableBatching) != null ? _k : !isProduction;
10190
+ const disableBatching = resolveDisableBatching(config.disableBatching, {
10191
+ isProduction: process.env.NODE_ENV === "production",
10192
+ isLocalDebugger: localDebuggerEnabled(this.localDebuggerUrlOpt)
10193
+ });
10188
10194
  this._tracing = tracing(
10189
10195
  this,
10190
10196
  url.origin,
@@ -11128,7 +11134,8 @@ var index_default = Raindrop;
11128
11134
  export {
11129
11135
  MAX_INGEST_SIZE_BYTES,
11130
11136
  Raindrop,
11131
- index_default as default
11137
+ index_default as default,
11138
+ resolveDisableBatching
11132
11139
  };
11133
11140
  /*! Bundled license information:
11134
11141
 
@@ -56,7 +56,7 @@ var import_instrumentation_vertexai = require("@traceloop/instrumentation-vertex
56
56
  var traceloop4 = __toESM(require("@traceloop/node-server-sdk"));
57
57
  var import_weakref = require("weakref");
58
58
 
59
- // ../core/dist/chunk-ITAZONWL.js
59
+ // ../core/dist/chunk-QTUH3BHZ.js
60
60
  function normalizeFeatureFlags(input) {
61
61
  if (Array.isArray(input)) {
62
62
  return Object.fromEntries(input.map((name) => [name, "true"]));
@@ -764,7 +764,7 @@ function base64ToHex(base64) {
764
764
  // package.json
765
765
  var package_default = {
766
766
  name: "raindrop-ai",
767
- version: "0.2.2",
767
+ version: "0.2.3",
768
768
  main: "dist/index.js",
769
769
  module: "dist/index.mjs",
770
770
  types: "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "../chunk-2EGS66V2.mjs";
3
+ } from "../chunk-7UHYFSYI.mjs";
4
4
  import "../chunk-UJCSKKID.mjs";
5
5
 
6
6
  // src/tracing/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.2.2",
3
+ "version": "0.2.3-otelv2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -32,24 +32,23 @@
32
32
  "dist/**"
33
33
  ],
34
34
  "devDependencies": {
35
- "ai": "^6.0.0",
36
35
  "@opentelemetry/resources": "^2.0.1",
37
36
  "@types/node": "^20.11.17",
37
+ "ai": "^6.0.0",
38
38
  "msw": "^2.12.8",
39
39
  "tsup": "^8.4.0",
40
40
  "tsx": "^4.20.3",
41
41
  "typescript": "^5.3.3",
42
42
  "vite": "^7.3.2",
43
43
  "vitest": "^4.0.10",
44
+ "@raindrop-ai/core": "0.1.3",
44
45
  "@raindrop-ai/redact-pii": "0.1.2",
45
- "@raindrop-ai/schemas": "0.1.0",
46
- "@raindrop-ai/core": "0.1.1"
46
+ "@raindrop-ai/schemas": "0.1.0"
47
47
  },
48
48
  "dependencies": {
49
49
  "@opentelemetry/api": "^1.9.0",
50
- "@opentelemetry/exporter-trace-otlp-http": "^0.57.2",
50
+ "@opentelemetry/exporter-trace-otlp-http": "^0.203.0",
51
51
  "@opentelemetry/exporter-trace-otlp-proto": "^0.57.2",
52
- "@traceloop/node-server-sdk": "0.19.0-otel-v1",
53
52
  "weakref": "^0.2.1",
54
53
  "zod": "^3.23.8"
55
54
  },
@@ -93,6 +92,9 @@
93
92
  },
94
93
  "clean": true
95
94
  },
95
+ "optionalDependencies": {
96
+ "@traceloop/node-server-sdk": "0.22.2"
97
+ },
96
98
  "scripts": {
97
99
  "build": "tsup",
98
100
  "dev": "tsup --watch",