raindrop-ai 0.0.77 → 0.0.78

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,5 +1,5 @@
1
1
  // src/tracing/tracer-core.ts
2
- import { context as context2, trace as trace2 } from "@opentelemetry/api";
2
+ import { context, trace as trace3 } from "@opentelemetry/api";
3
3
  import { AnthropicInstrumentation } from "@traceloop/instrumentation-anthropic";
4
4
  import { BedrockInstrumentation } from "@traceloop/instrumentation-bedrock";
5
5
  import { ChromaDBInstrumentation } from "@traceloop/instrumentation-chromadb";
@@ -16,23 +16,54 @@ import * as traceloop3 from "@traceloop/node-server-sdk";
16
16
  import { WeakValueMap } from "weakref";
17
17
 
18
18
  // src/tracing/liveInteraction.ts
19
- import { trace } from "@opentelemetry/api";
19
+ import { SpanStatusCode, trace } from "@opentelemetry/api";
20
20
  import * as traceloop from "@traceloop/node-server-sdk";
21
- function getPropertiesFromContext(context3) {
21
+ function getPropertiesFromContext(context2) {
22
22
  const properties = {
23
- ...context3.userId && { user_id: context3.userId },
24
- ...context3.convoId && { convo_id: context3.convoId },
25
- ...context3.eventId && { event_id: context3.eventId },
26
- ...context3.properties || {}
23
+ ...context2.userId && { user_id: context2.userId },
24
+ ...context2.convoId && { convo_id: context2.convoId },
25
+ ...context2.eventId && { event_id: context2.eventId },
26
+ ...context2.properties || {}
27
27
  };
28
- if (context3.attachments && context3.attachments.length > 0) {
29
- properties.attachments = JSON.stringify(context3.attachments);
28
+ if (context2.attachments && context2.attachments.length > 0) {
29
+ properties.attachments = JSON.stringify(context2.attachments);
30
30
  }
31
31
  return properties;
32
32
  }
33
+ function setAssociationProperties(span, properties) {
34
+ Object.entries(properties).forEach(([key, value]) => {
35
+ span.setAttribute("traceloop.association.properties." + key, String(value));
36
+ });
37
+ }
38
+ var LiveToolSpan = class {
39
+ constructor(span) {
40
+ this.hasError = false;
41
+ this.span = span;
42
+ }
43
+ setInput(input) {
44
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
45
+ this.span.setAttribute("traceloop.entity.input", inputStr);
46
+ }
47
+ setOutput(output) {
48
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
49
+ this.span.setAttribute("traceloop.entity.output", outputStr);
50
+ }
51
+ setError(error) {
52
+ this.hasError = true;
53
+ const errorMessage = error instanceof Error ? error.message : String(error);
54
+ this.span.setStatus({ code: SpanStatusCode.ERROR, message: errorMessage });
55
+ this.span.recordException(error instanceof Error ? error : new Error(errorMessage));
56
+ }
57
+ end() {
58
+ if (!this.hasError) {
59
+ this.span.setStatus({ code: SpanStatusCode.OK });
60
+ }
61
+ this.span.end();
62
+ }
63
+ };
33
64
  var LiveInteraction = class {
34
- constructor(context3, traceId, analytics) {
35
- this.context = context3;
65
+ constructor(context2, traceId, analytics) {
66
+ this.context = context2;
36
67
  this.analytics = analytics;
37
68
  this.tracer = trace.getTracer("traceloop.tracer");
38
69
  this.traceId = traceId;
@@ -91,13 +122,29 @@ var LiveInteraction = class {
91
122
  startSpan(params) {
92
123
  const { name, properties = {} } = params;
93
124
  const span = this.tracer.startSpan(name);
94
- span.setAttributes(getPropertiesFromContext(this.context));
125
+ const contextProperties = getPropertiesFromContext(this.context);
126
+ setAssociationProperties(span, contextProperties);
95
127
  span.setAttribute("traceloop.span.kind", "task");
96
- Object.entries(properties).forEach(([key, value]) => {
97
- span.setAttribute("traceloop.association.properties." + key, String(value));
98
- });
128
+ setAssociationProperties(span, properties);
99
129
  return span;
100
130
  }
131
+ startToolSpan(params) {
132
+ var _a;
133
+ const { name, properties = {}, inputParameters } = params;
134
+ const span = this.tracer.startSpan(name);
135
+ const contextProperties = getPropertiesFromContext(this.context);
136
+ setAssociationProperties(span, contextProperties);
137
+ span.setAttribute("traceloop.span.kind", "tool");
138
+ setAssociationProperties(span, properties);
139
+ if (inputParameters !== void 0) {
140
+ const inputStr = typeof inputParameters === "string" ? inputParameters : JSON.stringify(inputParameters);
141
+ span.setAttribute("traceloop.entity.input", inputStr);
142
+ }
143
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
144
+ console.log(`[raindrop] startToolSpan: started tool span "${name}"`);
145
+ }
146
+ return new LiveToolSpan(span);
147
+ }
101
148
  setProperties(properties) {
102
149
  var _a;
103
150
  this.context.properties = { ...this.context.properties, ...properties };
@@ -162,12 +209,54 @@ var LiveInteraction = class {
162
209
  isPending: false
163
210
  });
164
211
  }
212
+ trackTool(params) {
213
+ var _a;
214
+ const { name, input, output, durationMs, startTime, error, properties = {} } = params;
215
+ const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
216
+ const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
217
+ const span = this.tracer.startSpan(name, {
218
+ startTime: startTimeMs
219
+ });
220
+ const contextProperties = getPropertiesFromContext(this.context);
221
+ setAssociationProperties(span, contextProperties);
222
+ span.setAttribute("traceloop.span.kind", "tool");
223
+ setAssociationProperties(span, properties);
224
+ if (input !== void 0) {
225
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
226
+ span.setAttribute("traceloop.entity.input", inputStr);
227
+ }
228
+ if (output !== void 0) {
229
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
230
+ span.setAttribute("traceloop.entity.output", outputStr);
231
+ }
232
+ if (durationMs !== void 0) {
233
+ span.setAttribute("traceloop.entity.duration_ms", durationMs);
234
+ }
235
+ if (error) {
236
+ const errorMessage = error instanceof Error ? error.message : String(error);
237
+ span.setStatus({ code: SpanStatusCode.ERROR, message: errorMessage });
238
+ span.recordException(error instanceof Error ? error : new Error(errorMessage));
239
+ } else {
240
+ span.setStatus({ code: SpanStatusCode.OK });
241
+ }
242
+ span.end(endTimeMs);
243
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
244
+ console.log(`[raindrop] trackTool: logged tool span "${name}"`, {
245
+ input,
246
+ output,
247
+ durationMs,
248
+ error: error ? String(error) : void 0
249
+ });
250
+ }
251
+ }
165
252
  };
166
253
 
167
254
  // src/tracing/liveTracer.ts
255
+ import { SpanStatusCode as SpanStatusCode2, trace as trace2 } from "@opentelemetry/api";
168
256
  import * as traceloop2 from "@traceloop/node-server-sdk";
169
257
  var LiveTracer = class {
170
258
  constructor(globalProperties) {
259
+ this.tracer = trace2.getTracer("traceloop.tracer");
171
260
  this.globalProperties = globalProperties || {};
172
261
  }
173
262
  async withSpan(params, fn, thisArg, ...args) {
@@ -192,6 +281,40 @@ var LiveTracer = class {
192
281
  ...args
193
282
  );
194
283
  }
284
+ trackTool(params) {
285
+ const { name, input, output, durationMs, startTime, error, properties = {} } = params;
286
+ const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
287
+ const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
288
+ const span = this.tracer.startSpan(name, {
289
+ startTime: startTimeMs
290
+ });
291
+ Object.entries(this.globalProperties).forEach(([key, value]) => {
292
+ span.setAttribute("traceloop.association.properties." + key, String(value));
293
+ });
294
+ Object.entries(properties).forEach(([key, value]) => {
295
+ span.setAttribute("traceloop.association.properties." + key, String(value));
296
+ });
297
+ span.setAttribute("traceloop.span.kind", "tool");
298
+ if (input !== void 0) {
299
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
300
+ span.setAttribute("traceloop.entity.input", inputStr);
301
+ }
302
+ if (output !== void 0) {
303
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
304
+ span.setAttribute("traceloop.entity.output", outputStr);
305
+ }
306
+ if (durationMs !== void 0) {
307
+ span.setAttribute("traceloop.entity.duration_ms", durationMs);
308
+ }
309
+ if (error) {
310
+ const errorMessage = error instanceof Error ? error.message : String(error);
311
+ span.setStatus({ code: SpanStatusCode2.ERROR, message: errorMessage });
312
+ span.recordException(error instanceof Error ? error : new Error(errorMessage));
313
+ } else {
314
+ span.setStatus({ code: SpanStatusCode2.OK });
315
+ }
316
+ span.end(endTimeMs);
317
+ }
195
318
  };
196
319
 
197
320
  // src/tracing/tracer-core.ts
@@ -267,7 +390,7 @@ var activeInteractions = new WeakValueMap();
267
390
  var activeInteractionsByEventId = new WeakValueMap();
268
391
  function getCurrentTraceId() {
269
392
  var _a;
270
- return (_a = trace2.getSpan(context2.active())) == null ? void 0 : _a.spanContext().traceId;
393
+ return (_a = trace3.getSpan(context.active())) == null ? void 0 : _a.spanContext().traceId;
271
394
  }
272
395
  var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
273
396
  const { logLevel, useExternalOtel, tracingEnabled, disableBatching, ...otherOptions } = options;
package/dist/index.d.mts CHANGED
@@ -197,6 +197,69 @@ interface ToolParams {
197
197
  traceContent?: boolean;
198
198
  suppressTracing?: boolean;
199
199
  }
200
+ /**
201
+ * Parameters for directly logging a tool span without wrapping a function.
202
+ *
203
+ * Use this when you want to record a tool invocation that has already completed,
204
+ * rather than wrapping the tool call with withTool().
205
+ *
206
+ * @property name - Name of the tool for identification in traces
207
+ * @property input - The input provided to the tool (will be JSON stringified if object)
208
+ * @property output - The output returned by the tool (will be JSON stringified if object)
209
+ * @property durationMs - Duration of the tool execution in milliseconds
210
+ * @property startTime - Optional start time of the tool execution
211
+ * @property error - Optional error if the tool failed
212
+ * @property properties - Optional key-value pairs for additional metadata
213
+ */
214
+ interface TrackToolParams {
215
+ name: string;
216
+ input?: unknown;
217
+ output?: unknown;
218
+ durationMs?: number;
219
+ startTime?: Date | number;
220
+ error?: Error | string;
221
+ properties?: Record<string, string>;
222
+ }
223
+ /**
224
+ * A wrapper around an OpenTelemetry span for tool invocations.
225
+ *
226
+ * Provides a clean API for setting tool input, output, and error status
227
+ * without needing to know the internal traceloop attribute names.
228
+ *
229
+ * @example
230
+ * ```typescript
231
+ * const toolSpan = interaction.startToolSpan({ name: "web_search" });
232
+ * try {
233
+ * const result = await performSearch(query);
234
+ * toolSpan.setOutput(result);
235
+ * } catch (error) {
236
+ * toolSpan.setError(error);
237
+ * } finally {
238
+ * toolSpan.end();
239
+ * }
240
+ * ```
241
+ */
242
+ interface ToolSpan {
243
+ /**
244
+ * Sets the input for this tool span.
245
+ * @param input The input value (will be JSON stringified if object)
246
+ */
247
+ setInput(input: unknown): void;
248
+ /**
249
+ * Sets the output for this tool span.
250
+ * @param output The output value (will be JSON stringified if object)
251
+ */
252
+ setOutput(output: unknown): void;
253
+ /**
254
+ * Marks this tool span as failed with an error.
255
+ * @param error The error that occurred
256
+ */
257
+ setError(error: Error | string): void;
258
+ /**
259
+ * Ends this tool span. Must be called when the tool execution is complete.
260
+ */
261
+ end(): void;
262
+ }
200
263
  /**
201
264
  * Represents an active tracing interaction for tracking and analyzing AI interactions.
202
265
  *
@@ -293,6 +356,33 @@ type Interaction = {
293
356
  * @returns A span that can be used to record a task
294
357
  */
295
358
  startSpan(params: SpanParams): Span;
359
+ /**
360
+ * Creates a tool span that can be used to manually record a tool invocation.
361
+ *
362
+ * Similar to startSpan but sets the span kind to "tool" instead of "task".
363
+ * Use this when you want manual control over the span lifecycle for tool calls.
364
+ * Returns a ToolSpan wrapper with convenient methods for setting input, output, and errors.
365
+ *
366
+ * @param params ToolParams object with tool configuration
367
+ * @returns A ToolSpan wrapper for recording the tool execution
368
+ *
369
+ * @example
370
+ * ```typescript
371
+ * const interaction = raindrop.begin({ userId: "user-123", event: "agent_run" });
372
+ *
373
+ * // Start a tool span with manual control
374
+ * const toolSpan = interaction.startToolSpan({ name: "web_search" });
375
+ * try {
376
+ * const result = await performSearch(query);
377
+ * toolSpan.setOutput(result);
378
+ * } catch (error) {
379
+ * toolSpan.setError(error);
380
+ * } finally {
381
+ * toolSpan.end();
382
+ * }
383
+ * ```
384
+ */
385
+ startToolSpan(params: ToolParams): ToolSpan;
296
386
  /**
297
387
  * Sets multiple properties on the interaction context.
298
388
  *
@@ -411,6 +501,41 @@ type Interaction = {
411
501
  * ```
412
502
  */
413
503
  vercelAiSdkMetadata(): Record<string, string>;
504
+ /**
505
+ * Logs a tool span directly without wrapping a function.
506
+ *
507
+ * Use this when you want to record a tool invocation that has already completed,
508
+ * rather than wrapping the tool call with withTool(). This is useful for:
509
+ * - Recording tool calls from external systems
510
+ * - Logging tools that were executed outside of the tracing context
511
+ * - Retroactively adding tool spans with known input/output/duration
512
+ *
513
+ * @param params TrackToolParams object with tool execution details
514
+ *
515
+ * @example
516
+ * ```typescript
517
+ * const interaction = raindrop.begin({ userId: "user-123", event: "agent_run" });
518
+ *
519
+ * // Record a tool that was already executed
520
+ * interaction.trackTool({
521
+ * name: "web_search",
522
+ * input: { query: "weather in NYC" },
523
+ * output: { results: ["Sunny, 72°F"] },
524
+ * durationMs: 150,
525
+ * });
526
+ *
527
+ * // Record a failed tool
528
+ * interaction.trackTool({
529
+ * name: "database_query",
530
+ * input: { sql: "SELECT * FROM users" },
531
+ * error: new Error("Connection timeout"),
532
+ * durationMs: 5000,
533
+ * });
534
+ *
535
+ * interaction.finish({ output: "Here's the weather..." });
536
+ * ```
537
+ */
538
+ trackTool(params: TrackToolParams): void;
414
539
  };
415
540
  type Tracer = {
416
541
  /**
@@ -420,6 +545,29 @@ type Tracer = {
420
545
  * @returns A span that can be used to record a task
421
546
  */
422
547
  withSpan<T>(params: SpanParams, fn: (...args: any[]) => Promise<T> | T, thisArg?: any, ...args: any[]): Promise<T>;
548
+ /**
549
+ * Logs a tool span directly without wrapping a function.
550
+ *
551
+ * Use this when you want to record a tool invocation that has already completed,
552
+ * rather than wrapping the tool call. This is useful for batch jobs or
553
+ * non-interactive use-cases where you only care about tracing and token usage.
554
+ *
555
+ * @param params TrackToolParams object with tool execution details
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * const tracer = raindrop.tracer({ job_id: "batch-123" });
560
+ *
561
+ * // Record a tool that was already executed
562
+ * tracer.trackTool({
563
+ * name: "web_search",
564
+ * input: { query: "weather in NYC" },
565
+ * output: { results: ["Sunny, 72°F"] },
566
+ * durationMs: 150,
567
+ * });
568
+ * ```
569
+ */
570
+ trackTool(params: TrackToolParams): void;
423
571
  };
424
572
 
425
573
  interface AnalyticsConfig {
@@ -632,4 +780,4 @@ declare class Raindrop {
632
780
  close(): Promise<void>;
633
781
  }
634
782
 
635
- export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropSpanProcessor, type SignalEvent, type SpanParams, type ToolParams, type TraceContext, type Tracer, type WorkflowParams, Raindrop as default };
783
+ export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropSpanProcessor, 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
@@ -197,6 +197,69 @@ interface ToolParams {
197
197
  traceContent?: boolean;
198
198
  suppressTracing?: boolean;
199
199
  }
200
+ /**
201
+ * Parameters for directly logging a tool span without wrapping a function.
202
+ *
203
+ * Use this when you want to record a tool invocation that has already completed,
204
+ * rather than wrapping the tool call with withTool().
205
+ *
206
+ * @property name - Name of the tool for identification in traces
207
+ * @property input - The input provided to the tool (will be JSON stringified if object)
208
+ * @property output - The output returned by the tool (will be JSON stringified if object)
209
+ * @property durationMs - Duration of the tool execution in milliseconds
210
+ * @property startTime - Optional start time of the tool execution
211
+ * @property error - Optional error if the tool failed
212
+ * @property properties - Optional key-value pairs for additional metadata
213
+ */
214
+ interface TrackToolParams {
215
+ name: string;
216
+ input?: unknown;
217
+ output?: unknown;
218
+ durationMs?: number;
219
+ startTime?: Date | number;
220
+ error?: Error | string;
221
+ properties?: Record<string, string>;
222
+ }
223
+ /**
224
+ * A wrapper around an OpenTelemetry span for tool invocations.
225
+ *
226
+ * Provides a clean API for setting tool input, output, and error status
227
+ * without needing to know the internal traceloop attribute names.
228
+ *
229
+ * @example
230
+ * ```typescript
231
+ * const toolSpan = interaction.startToolSpan({ name: "web_search" });
232
+ * try {
233
+ * const result = await performSearch(query);
234
+ * toolSpan.setOutput(result);
235
+ * } catch (error) {
236
+ * toolSpan.setError(error);
237
+ * } finally {
238
+ * toolSpan.end();
239
+ * }
240
+ * ```
241
+ */
242
+ interface ToolSpan {
243
+ /**
244
+ * Sets the input for this tool span.
245
+ * @param input The input value (will be JSON stringified if object)
246
+ */
247
+ setInput(input: unknown): void;
248
+ /**
249
+ * Sets the output for this tool span.
250
+ * @param output The output value (will be JSON stringified if object)
251
+ */
252
+ setOutput(output: unknown): void;
253
+ /**
254
+ * Marks this tool span as failed with an error.
255
+ * @param error The error that occurred
256
+ */
257
+ setError(error: Error | string): void;
258
+ /**
259
+ * Ends this tool span. Must be called when the tool execution is complete.
260
+ */
261
+ end(): void;
262
+ }
200
263
  /**
201
264
  * Represents an active tracing interaction for tracking and analyzing AI interactions.
202
265
  *
@@ -293,6 +356,33 @@ type Interaction = {
293
356
  * @returns A span that can be used to record a task
294
357
  */
295
358
  startSpan(params: SpanParams): Span;
359
+ /**
360
+ * Creates a tool span that can be used to manually record a tool invocation.
361
+ *
362
+ * Similar to startSpan but sets the span kind to "tool" instead of "task".
363
+ * Use this when you want manual control over the span lifecycle for tool calls.
364
+ * Returns a ToolSpan wrapper with convenient methods for setting input, output, and errors.
365
+ *
366
+ * @param params ToolParams object with tool configuration
367
+ * @returns A ToolSpan wrapper for recording the tool execution
368
+ *
369
+ * @example
370
+ * ```typescript
371
+ * const interaction = raindrop.begin({ userId: "user-123", event: "agent_run" });
372
+ *
373
+ * // Start a tool span with manual control
374
+ * const toolSpan = interaction.startToolSpan({ name: "web_search" });
375
+ * try {
376
+ * const result = await performSearch(query);
377
+ * toolSpan.setOutput(result);
378
+ * } catch (error) {
379
+ * toolSpan.setError(error);
380
+ * } finally {
381
+ * toolSpan.end();
382
+ * }
383
+ * ```
384
+ */
385
+ startToolSpan(params: ToolParams): ToolSpan;
296
386
  /**
297
387
  * Sets multiple properties on the interaction context.
298
388
  *
@@ -411,6 +501,41 @@ type Interaction = {
411
501
  * ```
412
502
  */
413
503
  vercelAiSdkMetadata(): Record<string, string>;
504
+ /**
505
+ * Logs a tool span directly without wrapping a function.
506
+ *
507
+ * Use this when you want to record a tool invocation that has already completed,
508
+ * rather than wrapping the tool call with withTool(). This is useful for:
509
+ * - Recording tool calls from external systems
510
+ * - Logging tools that were executed outside of the tracing context
511
+ * - Retroactively adding tool spans with known input/output/duration
512
+ *
513
+ * @param params TrackToolParams object with tool execution details
514
+ *
515
+ * @example
516
+ * ```typescript
517
+ * const interaction = raindrop.begin({ userId: "user-123", event: "agent_run" });
518
+ *
519
+ * // Record a tool that was already executed
520
+ * interaction.trackTool({
521
+ * name: "web_search",
522
+ * input: { query: "weather in NYC" },
523
+ * output: { results: ["Sunny, 72°F"] },
524
+ * durationMs: 150,
525
+ * });
526
+ *
527
+ * // Record a failed tool
528
+ * interaction.trackTool({
529
+ * name: "database_query",
530
+ * input: { sql: "SELECT * FROM users" },
531
+ * error: new Error("Connection timeout"),
532
+ * durationMs: 5000,
533
+ * });
534
+ *
535
+ * interaction.finish({ output: "Here's the weather..." });
536
+ * ```
537
+ */
538
+ trackTool(params: TrackToolParams): void;
414
539
  };
415
540
  type Tracer = {
416
541
  /**
@@ -420,6 +545,29 @@ type Tracer = {
420
545
  * @returns A span that can be used to record a task
421
546
  */
422
547
  withSpan<T>(params: SpanParams, fn: (...args: any[]) => Promise<T> | T, thisArg?: any, ...args: any[]): Promise<T>;
548
+ /**
549
+ * Logs a tool span directly without wrapping a function.
550
+ *
551
+ * Use this when you want to record a tool invocation that has already completed,
552
+ * rather than wrapping the tool call. This is useful for batch jobs or
553
+ * non-interactive use-cases where you only care about tracing and token usage.
554
+ *
555
+ * @param params TrackToolParams object with tool execution details
556
+ *
557
+ * @example
558
+ * ```typescript
559
+ * const tracer = raindrop.tracer({ job_id: "batch-123" });
560
+ *
561
+ * // Record a tool that was already executed
562
+ * tracer.trackTool({
563
+ * name: "web_search",
564
+ * input: { query: "weather in NYC" },
565
+ * output: { results: ["Sunny, 72°F"] },
566
+ * durationMs: 150,
567
+ * });
568
+ * ```
569
+ */
570
+ trackTool(params: TrackToolParams): void;
423
571
  };
424
572
 
425
573
  interface AnalyticsConfig {
@@ -632,4 +780,4 @@ declare class Raindrop {
632
780
  close(): Promise<void>;
633
781
  }
634
782
 
635
- export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropSpanProcessor, type SignalEvent, type SpanParams, type ToolParams, type TraceContext, type Tracer, type WorkflowParams, Raindrop as default };
783
+ export { type AiTrackEvent, type Attachment, type AttachmentType, type BeginInteractionOptions, type FinishInteractionOptions, type IdentifyEvent, type Interaction, MAX_INGEST_SIZE_BYTES, type PartialAiTrackEvent, Raindrop, type RaindropSpanProcessor, type SignalEvent, type SpanParams, type ToolParams, type ToolSpan, type TraceContext, type Tracer, type TrackToolParams, type WorkflowParams, Raindrop as default };
package/dist/index.js CHANGED
@@ -138,7 +138,7 @@ var CategorizationRequestSchema = import_zod.z.object({
138
138
  // package.json
139
139
  var package_default = {
140
140
  name: "raindrop-ai",
141
- version: "0.0.77",
141
+ version: "0.0.78",
142
142
  main: "dist/index.js",
143
143
  module: "dist/index.mjs",
144
144
  types: "dist/index.d.ts",
@@ -316,7 +316,7 @@ function redactPII(event) {
316
316
  }
317
317
 
318
318
  // src/tracing/tracer-core.ts
319
- var import_api2 = require("@opentelemetry/api");
319
+ var import_api3 = require("@opentelemetry/api");
320
320
  var import_instrumentation_anthropic = require("@traceloop/instrumentation-anthropic");
321
321
  var import_instrumentation_bedrock = require("@traceloop/instrumentation-bedrock");
322
322
  var import_instrumentation_chromadb = require("@traceloop/instrumentation-chromadb");
@@ -332,21 +332,52 @@ var import_weakref = require("weakref");
332
332
  // src/tracing/liveInteraction.ts
333
333
  var import_api = require("@opentelemetry/api");
334
334
  var traceloop = __toESM(require("@traceloop/node-server-sdk"));
335
- function getPropertiesFromContext(context3) {
335
+ function getPropertiesFromContext(context2) {
336
336
  const properties = {
337
- ...context3.userId && { user_id: context3.userId },
338
- ...context3.convoId && { convo_id: context3.convoId },
339
- ...context3.eventId && { event_id: context3.eventId },
340
- ...context3.properties || {}
337
+ ...context2.userId && { user_id: context2.userId },
338
+ ...context2.convoId && { convo_id: context2.convoId },
339
+ ...context2.eventId && { event_id: context2.eventId },
340
+ ...context2.properties || {}
341
341
  };
342
- if (context3.attachments && context3.attachments.length > 0) {
343
- properties.attachments = JSON.stringify(context3.attachments);
342
+ if (context2.attachments && context2.attachments.length > 0) {
343
+ properties.attachments = JSON.stringify(context2.attachments);
344
344
  }
345
345
  return properties;
346
346
  }
347
+ function setAssociationProperties(span, properties) {
348
+ Object.entries(properties).forEach(([key, value]) => {
349
+ span.setAttribute("traceloop.association.properties." + key, String(value));
350
+ });
351
+ }
352
+ var LiveToolSpan = class {
353
+ constructor(span) {
354
+ this.hasError = false;
355
+ this.span = span;
356
+ }
357
+ setInput(input) {
358
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
359
+ this.span.setAttribute("traceloop.entity.input", inputStr);
360
+ }
361
+ setOutput(output) {
362
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
363
+ this.span.setAttribute("traceloop.entity.output", outputStr);
364
+ }
365
+ setError(error) {
366
+ this.hasError = true;
367
+ const errorMessage = error instanceof Error ? error.message : String(error);
368
+ this.span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: errorMessage });
369
+ this.span.recordException(error instanceof Error ? error : new Error(errorMessage));
370
+ }
371
+ end() {
372
+ if (!this.hasError) {
373
+ this.span.setStatus({ code: import_api.SpanStatusCode.OK });
374
+ }
375
+ this.span.end();
376
+ }
377
+ };
347
378
  var LiveInteraction = class {
348
- constructor(context3, traceId, analytics) {
349
- this.context = context3;
379
+ constructor(context2, traceId, analytics) {
380
+ this.context = context2;
350
381
  this.analytics = analytics;
351
382
  this.tracer = import_api.trace.getTracer("traceloop.tracer");
352
383
  this.traceId = traceId;
@@ -405,13 +436,29 @@ var LiveInteraction = class {
405
436
  startSpan(params) {
406
437
  const { name, properties = {} } = params;
407
438
  const span = this.tracer.startSpan(name);
408
- span.setAttributes(getPropertiesFromContext(this.context));
439
+ const contextProperties = getPropertiesFromContext(this.context);
440
+ setAssociationProperties(span, contextProperties);
409
441
  span.setAttribute("traceloop.span.kind", "task");
410
- Object.entries(properties).forEach(([key, value]) => {
411
- span.setAttribute("traceloop.association.properties." + key, String(value));
412
- });
442
+ setAssociationProperties(span, properties);
413
443
  return span;
414
444
  }
445
+ startToolSpan(params) {
446
+ var _a;
447
+ const { name, properties = {}, inputParameters } = params;
448
+ const span = this.tracer.startSpan(name);
449
+ const contextProperties = getPropertiesFromContext(this.context);
450
+ setAssociationProperties(span, contextProperties);
451
+ span.setAttribute("traceloop.span.kind", "tool");
452
+ setAssociationProperties(span, properties);
453
+ if (inputParameters !== void 0) {
454
+ const inputStr = typeof inputParameters === "string" ? inputParameters : JSON.stringify(inputParameters);
455
+ span.setAttribute("traceloop.entity.input", inputStr);
456
+ }
457
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
458
+ console.log(`[raindrop] startToolSpan: started tool span "${name}"`);
459
+ }
460
+ return new LiveToolSpan(span);
461
+ }
415
462
  setProperties(properties) {
416
463
  var _a;
417
464
  this.context.properties = { ...this.context.properties, ...properties };
@@ -476,12 +523,54 @@ var LiveInteraction = class {
476
523
  isPending: false
477
524
  });
478
525
  }
526
+ trackTool(params) {
527
+ var _a;
528
+ const { name, input, output, durationMs, startTime, error, properties = {} } = params;
529
+ const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
530
+ const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
531
+ const span = this.tracer.startSpan(name, {
532
+ startTime: startTimeMs
533
+ });
534
+ const contextProperties = getPropertiesFromContext(this.context);
535
+ setAssociationProperties(span, contextProperties);
536
+ span.setAttribute("traceloop.span.kind", "tool");
537
+ setAssociationProperties(span, properties);
538
+ if (input !== void 0) {
539
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
540
+ span.setAttribute("traceloop.entity.input", inputStr);
541
+ }
542
+ if (output !== void 0) {
543
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
544
+ span.setAttribute("traceloop.entity.output", outputStr);
545
+ }
546
+ if (durationMs !== void 0) {
547
+ span.setAttribute("traceloop.entity.duration_ms", durationMs);
548
+ }
549
+ if (error) {
550
+ const errorMessage = error instanceof Error ? error.message : String(error);
551
+ span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: errorMessage });
552
+ span.recordException(error instanceof Error ? error : new Error(errorMessage));
553
+ } else {
554
+ span.setStatus({ code: import_api.SpanStatusCode.OK });
555
+ }
556
+ span.end(endTimeMs);
557
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
558
+ console.log(`[raindrop] trackTool: logged tool span "${name}"`, {
559
+ input,
560
+ output,
561
+ durationMs,
562
+ error: error ? String(error) : void 0
563
+ });
564
+ }
565
+ }
479
566
  };
480
567
 
481
568
  // src/tracing/liveTracer.ts
569
+ var import_api2 = require("@opentelemetry/api");
482
570
  var traceloop2 = __toESM(require("@traceloop/node-server-sdk"));
483
571
  var LiveTracer = class {
484
572
  constructor(globalProperties) {
573
+ this.tracer = import_api2.trace.getTracer("traceloop.tracer");
485
574
  this.globalProperties = globalProperties || {};
486
575
  }
487
576
  async withSpan(params, fn, thisArg, ...args) {
@@ -506,6 +595,40 @@ var LiveTracer = class {
506
595
  ...args
507
596
  );
508
597
  }
598
+ trackTool(params) {
599
+ const { name, input, output, durationMs, startTime, error, properties = {} } = params;
600
+ const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
601
+ const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
602
+ const span = this.tracer.startSpan(name, {
603
+ startTime: startTimeMs
604
+ });
605
+ Object.entries(this.globalProperties).forEach(([key, value]) => {
606
+ span.setAttribute("traceloop.association.properties." + key, String(value));
607
+ });
608
+ Object.entries(properties).forEach(([key, value]) => {
609
+ span.setAttribute("traceloop.association.properties." + key, String(value));
610
+ });
611
+ span.setAttribute("traceloop.span.kind", "tool");
612
+ if (input !== void 0) {
613
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
614
+ span.setAttribute("traceloop.entity.input", inputStr);
615
+ }
616
+ if (output !== void 0) {
617
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
618
+ span.setAttribute("traceloop.entity.output", outputStr);
619
+ }
620
+ if (durationMs !== void 0) {
621
+ span.setAttribute("traceloop.entity.duration_ms", durationMs);
622
+ }
623
+ if (error) {
624
+ const errorMessage = error instanceof Error ? error.message : String(error);
625
+ span.setStatus({ code: import_api2.SpanStatusCode.ERROR, message: errorMessage });
626
+ span.recordException(error instanceof Error ? error : new Error(errorMessage));
627
+ } else {
628
+ span.setStatus({ code: import_api2.SpanStatusCode.OK });
629
+ }
630
+ span.end(endTimeMs);
631
+ }
509
632
  };
510
633
 
511
634
  // src/tracing/tracer-core.ts
@@ -581,7 +704,7 @@ var activeInteractions = new import_weakref.WeakValueMap();
581
704
  var activeInteractionsByEventId = new import_weakref.WeakValueMap();
582
705
  function getCurrentTraceId() {
583
706
  var _a;
584
- return (_a = import_api2.trace.getSpan(import_api2.context.active())) == null ? void 0 : _a.spanContext().traceId;
707
+ return (_a = import_api3.trace.getSpan(import_api3.context.active())) == null ? void 0 : _a.spanContext().traceId;
585
708
  }
586
709
  var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
587
710
  const { logLevel, useExternalOtel, tracingEnabled, disableBatching, ...otherOptions } = options;
@@ -1190,7 +1313,7 @@ var Raindrop = class {
1190
1313
  }
1191
1314
  getContext() {
1192
1315
  const runtime = detectRuntime();
1193
- const context3 = {
1316
+ const context2 = {
1194
1317
  library: {
1195
1318
  name: package_default.name,
1196
1319
  version: package_default.version
@@ -1200,9 +1323,9 @@ var Raindrop = class {
1200
1323
  }
1201
1324
  };
1202
1325
  if (runtime === "node") {
1203
- context3.metadata.nodeVersion = process.version;
1326
+ context2.metadata.nodeVersion = process.version;
1204
1327
  }
1205
- return context3;
1328
+ return context2;
1206
1329
  }
1207
1330
  formatZodError(error) {
1208
1331
  return error.issues.map((issue) => `(path: ${issue.path.join(".")}): ${issue.message}`).join(", ");
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "./chunk-7PZNI6M6.mjs";
3
+ } from "./chunk-B5UZWYFP.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.77",
107
+ version: "0.0.78",
108
108
  main: "dist/index.js",
109
109
  module: "dist/index.mjs",
110
110
  types: "dist/index.d.ts",
@@ -36,7 +36,7 @@ __export(tracing_exports, {
36
36
  module.exports = __toCommonJS(tracing_exports);
37
37
 
38
38
  // src/tracing/tracer-core.ts
39
- var import_api2 = require("@opentelemetry/api");
39
+ var import_api3 = require("@opentelemetry/api");
40
40
  var import_instrumentation_anthropic = require("@traceloop/instrumentation-anthropic");
41
41
  var import_instrumentation_bedrock = require("@traceloop/instrumentation-bedrock");
42
42
  var import_instrumentation_chromadb = require("@traceloop/instrumentation-chromadb");
@@ -52,21 +52,52 @@ var import_weakref = require("weakref");
52
52
  // src/tracing/liveInteraction.ts
53
53
  var import_api = require("@opentelemetry/api");
54
54
  var traceloop = __toESM(require("@traceloop/node-server-sdk"));
55
- function getPropertiesFromContext(context3) {
55
+ function getPropertiesFromContext(context2) {
56
56
  const properties = {
57
- ...context3.userId && { user_id: context3.userId },
58
- ...context3.convoId && { convo_id: context3.convoId },
59
- ...context3.eventId && { event_id: context3.eventId },
60
- ...context3.properties || {}
57
+ ...context2.userId && { user_id: context2.userId },
58
+ ...context2.convoId && { convo_id: context2.convoId },
59
+ ...context2.eventId && { event_id: context2.eventId },
60
+ ...context2.properties || {}
61
61
  };
62
- if (context3.attachments && context3.attachments.length > 0) {
63
- properties.attachments = JSON.stringify(context3.attachments);
62
+ if (context2.attachments && context2.attachments.length > 0) {
63
+ properties.attachments = JSON.stringify(context2.attachments);
64
64
  }
65
65
  return properties;
66
66
  }
67
+ function setAssociationProperties(span, properties) {
68
+ Object.entries(properties).forEach(([key, value]) => {
69
+ span.setAttribute("traceloop.association.properties." + key, String(value));
70
+ });
71
+ }
72
+ var LiveToolSpan = class {
73
+ constructor(span) {
74
+ this.hasError = false;
75
+ this.span = span;
76
+ }
77
+ setInput(input) {
78
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
79
+ this.span.setAttribute("traceloop.entity.input", inputStr);
80
+ }
81
+ setOutput(output) {
82
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
83
+ this.span.setAttribute("traceloop.entity.output", outputStr);
84
+ }
85
+ setError(error) {
86
+ this.hasError = true;
87
+ const errorMessage = error instanceof Error ? error.message : String(error);
88
+ this.span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: errorMessage });
89
+ this.span.recordException(error instanceof Error ? error : new Error(errorMessage));
90
+ }
91
+ end() {
92
+ if (!this.hasError) {
93
+ this.span.setStatus({ code: import_api.SpanStatusCode.OK });
94
+ }
95
+ this.span.end();
96
+ }
97
+ };
67
98
  var LiveInteraction = class {
68
- constructor(context3, traceId, analytics) {
69
- this.context = context3;
99
+ constructor(context2, traceId, analytics) {
100
+ this.context = context2;
70
101
  this.analytics = analytics;
71
102
  this.tracer = import_api.trace.getTracer("traceloop.tracer");
72
103
  this.traceId = traceId;
@@ -125,13 +156,29 @@ var LiveInteraction = class {
125
156
  startSpan(params) {
126
157
  const { name, properties = {} } = params;
127
158
  const span = this.tracer.startSpan(name);
128
- span.setAttributes(getPropertiesFromContext(this.context));
159
+ const contextProperties = getPropertiesFromContext(this.context);
160
+ setAssociationProperties(span, contextProperties);
129
161
  span.setAttribute("traceloop.span.kind", "task");
130
- Object.entries(properties).forEach(([key, value]) => {
131
- span.setAttribute("traceloop.association.properties." + key, String(value));
132
- });
162
+ setAssociationProperties(span, properties);
133
163
  return span;
134
164
  }
165
+ startToolSpan(params) {
166
+ var _a;
167
+ const { name, properties = {}, inputParameters } = params;
168
+ const span = this.tracer.startSpan(name);
169
+ const contextProperties = getPropertiesFromContext(this.context);
170
+ setAssociationProperties(span, contextProperties);
171
+ span.setAttribute("traceloop.span.kind", "tool");
172
+ setAssociationProperties(span, properties);
173
+ if (inputParameters !== void 0) {
174
+ const inputStr = typeof inputParameters === "string" ? inputParameters : JSON.stringify(inputParameters);
175
+ span.setAttribute("traceloop.entity.input", inputStr);
176
+ }
177
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
178
+ console.log(`[raindrop] startToolSpan: started tool span "${name}"`);
179
+ }
180
+ return new LiveToolSpan(span);
181
+ }
135
182
  setProperties(properties) {
136
183
  var _a;
137
184
  this.context.properties = { ...this.context.properties, ...properties };
@@ -196,12 +243,54 @@ var LiveInteraction = class {
196
243
  isPending: false
197
244
  });
198
245
  }
246
+ trackTool(params) {
247
+ var _a;
248
+ const { name, input, output, durationMs, startTime, error, properties = {} } = params;
249
+ const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
250
+ const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
251
+ const span = this.tracer.startSpan(name, {
252
+ startTime: startTimeMs
253
+ });
254
+ const contextProperties = getPropertiesFromContext(this.context);
255
+ setAssociationProperties(span, contextProperties);
256
+ span.setAttribute("traceloop.span.kind", "tool");
257
+ setAssociationProperties(span, properties);
258
+ if (input !== void 0) {
259
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
260
+ span.setAttribute("traceloop.entity.input", inputStr);
261
+ }
262
+ if (output !== void 0) {
263
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
264
+ span.setAttribute("traceloop.entity.output", outputStr);
265
+ }
266
+ if (durationMs !== void 0) {
267
+ span.setAttribute("traceloop.entity.duration_ms", durationMs);
268
+ }
269
+ if (error) {
270
+ const errorMessage = error instanceof Error ? error.message : String(error);
271
+ span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: errorMessage });
272
+ span.recordException(error instanceof Error ? error : new Error(errorMessage));
273
+ } else {
274
+ span.setStatus({ code: import_api.SpanStatusCode.OK });
275
+ }
276
+ span.end(endTimeMs);
277
+ if ((_a = this.analytics) == null ? void 0 : _a.debugLogs) {
278
+ console.log(`[raindrop] trackTool: logged tool span "${name}"`, {
279
+ input,
280
+ output,
281
+ durationMs,
282
+ error: error ? String(error) : void 0
283
+ });
284
+ }
285
+ }
199
286
  };
200
287
 
201
288
  // src/tracing/liveTracer.ts
289
+ var import_api2 = require("@opentelemetry/api");
202
290
  var traceloop2 = __toESM(require("@traceloop/node-server-sdk"));
203
291
  var LiveTracer = class {
204
292
  constructor(globalProperties) {
293
+ this.tracer = import_api2.trace.getTracer("traceloop.tracer");
205
294
  this.globalProperties = globalProperties || {};
206
295
  }
207
296
  async withSpan(params, fn, thisArg, ...args) {
@@ -226,6 +315,40 @@ var LiveTracer = class {
226
315
  ...args
227
316
  );
228
317
  }
318
+ trackTool(params) {
319
+ const { name, input, output, durationMs, startTime, error, properties = {} } = params;
320
+ const startTimeMs = startTime instanceof Date ? startTime.getTime() : typeof startTime === "number" ? startTime : Date.now() - (durationMs != null ? durationMs : 0);
321
+ const endTimeMs = startTimeMs + (durationMs != null ? durationMs : 0);
322
+ const span = this.tracer.startSpan(name, {
323
+ startTime: startTimeMs
324
+ });
325
+ Object.entries(this.globalProperties).forEach(([key, value]) => {
326
+ span.setAttribute("traceloop.association.properties." + key, String(value));
327
+ });
328
+ Object.entries(properties).forEach(([key, value]) => {
329
+ span.setAttribute("traceloop.association.properties." + key, String(value));
330
+ });
331
+ span.setAttribute("traceloop.span.kind", "tool");
332
+ if (input !== void 0) {
333
+ const inputStr = typeof input === "string" ? input : JSON.stringify(input);
334
+ span.setAttribute("traceloop.entity.input", inputStr);
335
+ }
336
+ if (output !== void 0) {
337
+ const outputStr = typeof output === "string" ? output : JSON.stringify(output);
338
+ span.setAttribute("traceloop.entity.output", outputStr);
339
+ }
340
+ if (durationMs !== void 0) {
341
+ span.setAttribute("traceloop.entity.duration_ms", durationMs);
342
+ }
343
+ if (error) {
344
+ const errorMessage = error instanceof Error ? error.message : String(error);
345
+ span.setStatus({ code: import_api2.SpanStatusCode.ERROR, message: errorMessage });
346
+ span.recordException(error instanceof Error ? error : new Error(errorMessage));
347
+ } else {
348
+ span.setStatus({ code: import_api2.SpanStatusCode.OK });
349
+ }
350
+ span.end(endTimeMs);
351
+ }
229
352
  };
230
353
 
231
354
  // src/tracing/tracer-core.ts
@@ -301,7 +424,7 @@ var activeInteractions = new import_weakref.WeakValueMap();
301
424
  var activeInteractionsByEventId = new import_weakref.WeakValueMap();
302
425
  function getCurrentTraceId() {
303
426
  var _a;
304
- return (_a = import_api2.trace.getSpan(import_api2.context.active())) == null ? void 0 : _a.spanContext().traceId;
427
+ return (_a = import_api3.trace.getSpan(import_api3.context.active())) == null ? void 0 : _a.spanContext().traceId;
305
428
  }
306
429
  var tracing = (analytics, apiUrl, writeKey, options, isDebug = false) => {
307
430
  const { logLevel, useExternalOtel, tracingEnabled, disableBatching, ...otherOptions } = options;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tracing
3
- } from "../chunk-7PZNI6M6.mjs";
3
+ } from "../chunk-B5UZWYFP.mjs";
4
4
 
5
5
  // src/tracing/index.ts
6
6
  function initTracing() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",