raindrop-ai 0.0.72 → 0.0.73-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.
@@ -213,7 +213,6 @@ var _setImplementation = (impl) => {
213
213
  };
214
214
 
215
215
  export {
216
- NonLiveInteraction,
217
216
  tracing,
218
217
  _setImplementation
219
218
  };
package/dist/index.js CHANGED
@@ -128,7 +128,7 @@ var CategorizationRequestSchema = import_zod.z.object({
128
128
  // package.json
129
129
  var package_default = {
130
130
  name: "raindrop-ai",
131
- version: "0.0.72",
131
+ version: "0.0.73",
132
132
  main: "dist/index.js",
133
133
  module: "dist/index.mjs",
134
134
  types: "dist/index.d.ts",
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "./chunk-PGSDYIYM.mjs";
3
+ } from "./chunk-TMIUTKIT.mjs";
4
4
 
5
5
  // ../schemas/src/ingest/index.ts
6
6
  import { z } from "zod";
@@ -104,7 +104,7 @@ var CategorizationRequestSchema = z.object({
104
104
  // package.json
105
105
  var package_default = {
106
106
  name: "raindrop-ai",
107
- version: "0.0.72",
107
+ version: "0.0.73",
108
108
  main: "dist/index.js",
109
109
  module: "dist/index.mjs",
110
110
  types: "dist/index.d.ts",
@@ -242,77 +242,6 @@ var NoOpSpan = class {
242
242
  };
243
243
  var NO_OP_SPAN = new NoOpSpan();
244
244
 
245
- // src/tracing/nonLiveInteraction.ts
246
- var NonLiveInteraction = class {
247
- constructor(context2, traceId, analytics) {
248
- this.context = context2;
249
- this.analytics = analytics;
250
- }
251
- withSpan(_params, fn, thisArg, ...args) {
252
- var _a;
253
- if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
254
- console.log("[raindrop] using withSpan in nonLiveInteraction");
255
- }
256
- try {
257
- return Promise.resolve(fn.apply(thisArg, args));
258
- } catch (error) {
259
- return Promise.reject(error);
260
- }
261
- }
262
- withTool(_params, fn, thisArg, ...args) {
263
- var _a;
264
- if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
265
- console.log("[raindrop] using withTool in nonLiveInteraction");
266
- }
267
- try {
268
- return Promise.resolve(fn.apply(thisArg, args));
269
- } catch (error) {
270
- return Promise.reject(error);
271
- }
272
- }
273
- startSpan(_params) {
274
- return NO_OP_SPAN;
275
- }
276
- setProperties(_properties) {
277
- var _a;
278
- (_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
279
- eventId: this.context.eventId,
280
- properties: _properties
281
- });
282
- }
283
- setProperty(_key, _value) {
284
- var _a;
285
- (_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
286
- eventId: this.context.eventId,
287
- properties: {
288
- [_key]: _value
289
- }
290
- });
291
- }
292
- addAttachments(_attachments) {
293
- var _a;
294
- (_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
295
- eventId: this.context.eventId,
296
- attachments: _attachments
297
- });
298
- }
299
- setInput(_input) {
300
- var _a;
301
- (_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
302
- eventId: this.context.eventId,
303
- input: _input
304
- });
305
- }
306
- finish(resultEvent) {
307
- var _a;
308
- (_a = this.analytics) == null ? void 0 : _a._trackAiPartial({
309
- ...resultEvent,
310
- eventId: this.context.eventId,
311
- isPending: false
312
- });
313
- }
314
- };
315
-
316
245
  // src/tracing/tracer-core.ts
317
246
  var getGlobalRegistry = () => {
318
247
  if (typeof globalThis !== "undefined") {
@@ -402,10 +331,15 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
402
331
  return interactionByEventId;
403
332
  }
404
333
  const traceId = getCurrentTraceId();
405
- if (!traceId) {
406
- return new NonLiveInteraction({ eventId }, void 0, analytics);
334
+ if (traceId) {
335
+ const interactionByTraceId = activeInteractions.get(traceId);
336
+ if (interactionByTraceId) {
337
+ return interactionByTraceId;
338
+ }
407
339
  }
408
- return activeInteractions.get(traceId) || new NonLiveInteraction({ eventId }, void 0, analytics);
340
+ const interaction = new LiveInteraction({ eventId }, traceId, analytics);
341
+ activeInteractionsByEventId.set(eventId, interaction);
342
+ return interaction;
409
343
  },
410
344
  tracer(globalProperties) {
411
345
  return new LiveTracer(globalProperties);
@@ -1,7 +1,6 @@
1
1
  import {
2
- NonLiveInteraction,
3
2
  _setImplementation
4
- } from "../chunk-PGSDYIYM.mjs";
3
+ } from "../chunk-TMIUTKIT.mjs";
5
4
 
6
5
  // src/tracing/index.ts
7
6
  import { context, trace as trace2 } from "@opentelemetry/api";
@@ -223,10 +222,15 @@ var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
223
222
  return interactionByEventId;
224
223
  }
225
224
  const traceId = getCurrentTraceId();
226
- if (!traceId) {
227
- return new NonLiveInteraction({ eventId }, void 0, analytics);
225
+ if (traceId) {
226
+ const interactionByTraceId = activeInteractions.get(traceId);
227
+ if (interactionByTraceId) {
228
+ return interactionByTraceId;
229
+ }
228
230
  }
229
- return activeInteractions.get(traceId) || new NonLiveInteraction({ eventId }, void 0, analytics);
231
+ const interaction = new LiveInteraction({ eventId }, traceId, analytics);
232
+ activeInteractionsByEventId.set(eventId, interaction);
233
+ return interaction;
230
234
  },
231
235
  tracer(globalProperties) {
232
236
  return new LiveTracer(globalProperties);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.72",
3
+ "version": "0.0.73-otelv2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "zod": "^3.23.8"
51
51
  },
52
52
  "optionalDependencies": {
53
- "@traceloop/node-server-sdk": "0.19.0-otel-v1"
53
+ "@traceloop/node-server-sdk": "0.22.2"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public",