raindrop-ai 0.2.1 → 0.2.2-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.
package/dist/index.d.mts CHANGED
@@ -774,6 +774,14 @@ type Tracer = {
774
774
  emitLiveEvent(event: LocalDebuggerLiveEventInput): void;
775
775
  };
776
776
 
777
+ declare global {
778
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
779
+ getStore(): T | undefined;
780
+ run<R>(store: T, callback: () => R): R;
781
+ enterWith?(store: T): void;
782
+ }) | undefined;
783
+ }
784
+
777
785
  interface AnalyticsConfig {
778
786
  wizardSession?: string;
779
787
  /**
@@ -955,6 +963,7 @@ declare class Raindrop {
955
963
  private inFlightByEvent;
956
964
  private maxTextFieldChars;
957
965
  private projectId;
966
+ private authHint;
958
967
  /**
959
968
  * Epoch ms deadline while `close()` is draining; undefined otherwise.
960
969
  * Checked before every POST issued during the final flush so a dead or
@@ -975,6 +984,14 @@ declare class Raindrop {
975
984
  /**
976
985
  * Begins a new interaction.
977
986
  *
987
+ * The interaction's routing binding lives until `finish()` (which unbinds it
988
+ * by identity, so it is removed even if `finish()` runs inside a nested
989
+ * `withSpan`/`withTool`/`asCurrent` scope or a detached task). One exception:
990
+ * calling `begin()` INSIDE an `asCurrent(fn)` scope pushes the binding within
991
+ * that scope, so it dies when the scope exits (matching the Python SDK's
992
+ * token-reset semantics) — start such interactions outside `asCurrent`, or
993
+ * keep their work inside the same scope.
994
+ *
978
995
  * @param traceContext - The trace context for the interaction.
979
996
  * @returns The interaction object.
980
997
  */
@@ -991,6 +1008,20 @@ declare class Raindrop {
991
1008
  * @returns The tracer object.
992
1009
  */
993
1010
  tracer(globalProperties?: Record<string, string>): Tracer;
1011
+ /**
1012
+ * Scope all spans created inside `fn` (and its awaited continuations) to this
1013
+ * client's project/key, without an interaction. Use it around auto-
1014
+ * instrumented calls (an LLM SDK call, a framework invocation) that aren't
1015
+ * wrapped by `begin()`/`finish()` so their spans route to this client's
1016
+ * project in a multi-client process. The binding lasts exactly the duration
1017
+ * of `fn` — it is removed when `fn` returns or throws.
1018
+ *
1019
+ * @example
1020
+ * ```ts
1021
+ * const answer = await raindrop.asCurrent(() => llm.chat({ ... }));
1022
+ * ```
1023
+ */
1024
+ asCurrent<T>(fn: () => T): T;
994
1025
  createSpanProcessor(processorOptions?: SpanProcessorOptions): RaindropSpanProcessor;
995
1026
  /**
996
1027
  * Returns configured instrumentation instances based on instrumentModules.
package/dist/index.d.ts CHANGED
@@ -774,6 +774,14 @@ type Tracer = {
774
774
  emitLiveEvent(event: LocalDebuggerLiveEventInput): void;
775
775
  };
776
776
 
777
+ declare global {
778
+ var RAINDROP_ASYNC_LOCAL_STORAGE: (new <T>() => {
779
+ getStore(): T | undefined;
780
+ run<R>(store: T, callback: () => R): R;
781
+ enterWith?(store: T): void;
782
+ }) | undefined;
783
+ }
784
+
777
785
  interface AnalyticsConfig {
778
786
  wizardSession?: string;
779
787
  /**
@@ -955,6 +963,7 @@ declare class Raindrop {
955
963
  private inFlightByEvent;
956
964
  private maxTextFieldChars;
957
965
  private projectId;
966
+ private authHint;
958
967
  /**
959
968
  * Epoch ms deadline while `close()` is draining; undefined otherwise.
960
969
  * Checked before every POST issued during the final flush so a dead or
@@ -975,6 +984,14 @@ declare class Raindrop {
975
984
  /**
976
985
  * Begins a new interaction.
977
986
  *
987
+ * The interaction's routing binding lives until `finish()` (which unbinds it
988
+ * by identity, so it is removed even if `finish()` runs inside a nested
989
+ * `withSpan`/`withTool`/`asCurrent` scope or a detached task). One exception:
990
+ * calling `begin()` INSIDE an `asCurrent(fn)` scope pushes the binding within
991
+ * that scope, so it dies when the scope exits (matching the Python SDK's
992
+ * token-reset semantics) — start such interactions outside `asCurrent`, or
993
+ * keep their work inside the same scope.
994
+ *
978
995
  * @param traceContext - The trace context for the interaction.
979
996
  * @returns The interaction object.
980
997
  */
@@ -991,6 +1008,20 @@ declare class Raindrop {
991
1008
  * @returns The tracer object.
992
1009
  */
993
1010
  tracer(globalProperties?: Record<string, string>): Tracer;
1011
+ /**
1012
+ * Scope all spans created inside `fn` (and its awaited continuations) to this
1013
+ * client's project/key, without an interaction. Use it around auto-
1014
+ * instrumented calls (an LLM SDK call, a framework invocation) that aren't
1015
+ * wrapped by `begin()`/`finish()` so their spans route to this client's
1016
+ * project in a multi-client process. The binding lasts exactly the duration
1017
+ * of `fn` — it is removed when `fn` returns or throws.
1018
+ *
1019
+ * @example
1020
+ * ```ts
1021
+ * const answer = await raindrop.asCurrent(() => llm.chat({ ... }));
1022
+ * ```
1023
+ */
1024
+ asCurrent<T>(fn: () => T): T;
994
1025
  createSpanProcessor(processorOptions?: SpanProcessorOptions): RaindropSpanProcessor;
995
1026
  /**
996
1027
  * Returns configured instrumentation instances based on instrumentModules.