@bitfab/sdk 0.75.0 → 0.76.1

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.
Files changed (58) hide show
  1. package/dist/{autoTrace-kHOBg49M.js → autoTrace-BgN0zCQf.js} +565 -69
  2. package/dist/autoTrace-BgN0zCQf.js.map +1 -0
  3. package/dist/{autoTrace-DPWV1Xzr.cjs → autoTrace-pZKu5Nk2.cjs} +612 -68
  4. package/dist/autoTrace-pZKu5Nk2.cjs.map +1 -0
  5. package/dist/autoTrace.cjs +2 -1
  6. package/dist/autoTrace.d.cts +20 -24
  7. package/dist/autoTrace.d.ts +20 -24
  8. package/dist/autoTrace.js +1 -1
  9. package/dist/{babelPlugin-C0Im6AZ2.cjs → babelPlugin-BpEeVvk4.cjs} +73 -25
  10. package/dist/babelPlugin-BpEeVvk4.cjs.map +1 -0
  11. package/dist/{babelPlugin-hS2Hb2vt.js → babelPlugin-PgjdBuQe.js} +73 -25
  12. package/dist/babelPlugin-PgjdBuQe.js.map +1 -0
  13. package/dist/{http-Cotx6kLL.js → http-DS1QjBvx.js} +3 -3
  14. package/dist/{http-Cotx6kLL.js.map → http-DS1QjBvx.js.map} +1 -1
  15. package/dist/{http-BkL24D7v.cjs → http-ykHGNcju.cjs} +3 -3
  16. package/dist/{http-BkL24D7v.cjs.map → http-ykHGNcju.cjs.map} +1 -1
  17. package/dist/{index-V6ECPulQ.d.cts → index-BYv4DSsY.d.cts} +286 -17
  18. package/dist/{index-V6ECPulQ.d.ts → index-BYv4DSsY.d.ts} +286 -17
  19. package/dist/index.cjs +2 -2
  20. package/dist/index.d.cts +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +2 -2
  23. package/dist/node.cjs +3 -3
  24. package/dist/node.d.cts +2 -2
  25. package/dist/node.d.ts +2 -2
  26. package/dist/node.js +3 -3
  27. package/dist/{registryCommand-DdE8cNOX.js → registryCommand-D1VgfJjC.js} +341 -46
  28. package/dist/registryCommand-D1VgfJjC.js.map +1 -0
  29. package/dist/replayCli.js +1 -1
  30. package/dist/seedCli.js +1 -1
  31. package/dist/{src-CrV0INwT.js → src-BJjbR3Nq.js} +72 -34
  32. package/dist/src-BJjbR3Nq.js.map +1 -0
  33. package/dist/{src-BJ5a-chk.cjs → src-CLkegn-P.cjs} +78 -40
  34. package/dist/src-CLkegn-P.cjs.map +1 -0
  35. package/dist/transform/babel.cjs +1 -1
  36. package/dist/transform/babel.d.cts +2 -9
  37. package/dist/transform/babel.d.ts +2 -9
  38. package/dist/transform/babel.js +1 -1
  39. package/dist/transform/loaderRuntime.cjs +2 -2
  40. package/dist/transform/loaderRuntime.js +2 -2
  41. package/dist/transform/nodeLoader.js +72 -24
  42. package/dist/transform/nodeLoader.js.map +1 -1
  43. package/dist/transform/swc.cjs +1 -1
  44. package/dist/transform/swc.js +1 -1
  45. package/dist/transform/unplugin.cjs +2 -2
  46. package/dist/transform/unplugin.js +2 -2
  47. package/dist/{transform-BL1fJW-C.js → transform-BhazCKOg.js} +2 -2
  48. package/dist/{transform-BL1fJW-C.js.map → transform-BhazCKOg.js.map} +1 -1
  49. package/dist/{transform-C4H7TKW-.cjs → transform-Cdg7CSbP.cjs} +2 -2
  50. package/dist/{transform-C4H7TKW-.cjs.map → transform-Cdg7CSbP.cjs.map} +1 -1
  51. package/package.json +1 -1
  52. package/dist/autoTrace-DPWV1Xzr.cjs.map +0 -1
  53. package/dist/autoTrace-kHOBg49M.js.map +0 -1
  54. package/dist/babelPlugin-C0Im6AZ2.cjs.map +0 -1
  55. package/dist/babelPlugin-hS2Hb2vt.js.map +0 -1
  56. package/dist/registryCommand-DdE8cNOX.js.map +0 -1
  57. package/dist/src-BJ5a-chk.cjs.map +0 -1
  58. package/dist/src-CrV0INwT.js.map +0 -1
@@ -4123,6 +4123,22 @@ interface WrapOpenAIResponsesOptions<TResponse> {
4123
4123
  /** Called after each call with the OpenAI response, for the caller's own usage or cost reporting. */
4124
4124
  onResponse?: (response: TResponse) => void;
4125
4125
  }
4126
+ interface WrapOpenAIChatOptions<TResponse> {
4127
+ /** Called after each call with the chat completion, for the caller's own usage or cost reporting. */
4128
+ onResponse?: (response: TResponse) => void;
4129
+ }
4130
+ interface WrapOpenAIEmbeddingsOptions<TResponse> {
4131
+ /** Called after each call with the embedding list, for the caller's own usage or cost reporting. */
4132
+ onResponse?: (response: TResponse) => void;
4133
+ }
4134
+ interface WrapOpenAITranscriptionsOptions<TResponse> {
4135
+ /** Called after each call with the transcription, for the caller's own usage or cost reporting. */
4136
+ onResponse?: (response: TResponse) => void;
4137
+ }
4138
+ interface WrapGeminiOptions<TResponse> {
4139
+ /** Called after each call with the Gemini response, for the caller's own usage or cost reporting. */
4140
+ onResponse?: (response: TResponse) => void;
4141
+ }
4126
4142
  interface WrapBAMLOptions {
4127
4143
  /** Called after each BAML invocation with the Collector instance. */
4128
4144
  onCollector?: (collector: unknown) => void;
@@ -4143,6 +4159,13 @@ interface CurrentSpan {
4143
4159
  readonly id: string;
4144
4160
  /** The trace ID for the current span. */
4145
4161
  readonly traceId: string;
4162
+ /**
4163
+ * The keys of every trace function running at this point, outermost first,
4164
+ * each listed once. A trace function called inside another one comes after
4165
+ * it, including a `withTrace` root that started its own trace, so a cost
4166
+ * recorded here can be counted toward each of them. Empty outside a trace.
4167
+ */
4168
+ readonly traceFunctionKeys: readonly string[];
4146
4169
  /**
4147
4170
  * Add a context entry to this span. Each call appends to the contexts array.
4148
4171
  * Context entries are stored in span_data.contexts as [{key, value}, ...].
@@ -4194,6 +4217,14 @@ interface DetachedTrace {
4194
4217
  * A handle to the current active trace, allowing trace-level context to be set.
4195
4218
  */
4196
4219
  interface CurrentTrace {
4220
+ /**
4221
+ * The key of the trace function the current trace is stored under: the one
4222
+ * that started it. A `withSpan` or `getFunction` call inside another trace
4223
+ * function joins that trace, so it reports the outer key. A `withTrace` root
4224
+ * inside another root starts its own trace, so it reports its own key. Empty
4225
+ * string outside a trace.
4226
+ */
4227
+ readonly traceFunctionKey: string;
4197
4228
  /**
4198
4229
  * Set the session ID for this trace. Stored in the database session_id column.
4199
4230
  */
@@ -4221,6 +4252,14 @@ interface CurrentTrace {
4221
4252
  */
4222
4253
  drop(): void;
4223
4254
  }
4255
+ /**
4256
+ * Get a handle to the current active span.
4257
+ *
4258
+ * Call this from inside a traced function (wrapped with `withSpan`) to get
4259
+ * a span handle that allows adding context at runtime.
4260
+ *
4261
+ * Returns a no-op object if called outside of a span context (methods do nothing).
4262
+ */
4224
4263
  declare function getCurrentSpan(): CurrentSpan;
4225
4264
  /**
4226
4265
  * Get the database branch the current replay item is running against.
@@ -4386,6 +4425,9 @@ interface SpanOptions {
4386
4425
  * For an async-generator result, `finalize` receives the array of yielded
4387
4426
  * values once iteration completes, and its return is recorded instead of
4388
4427
  * the default `{ yielded, return }`.
4428
+ *
4429
+ * On a node placed directly on a streamed LLM client call, `finalize` is not
4430
+ * used: the span records the assembled stream and its usage instead.
4389
4431
  */
4390
4432
  finalize?: (result: any) => unknown | Promise<unknown>;
4391
4433
  }
@@ -4433,6 +4475,13 @@ interface TraceOptions {
4433
4475
  mockOnReplayDefault?: boolean;
4434
4476
  /** Maximum number of recorded descendant levels. Defaults to 30. */
4435
4477
  maxDepth?: number;
4478
+ /**
4479
+ * Maximum number of automatically captured descendant spans. Defaults to
4480
+ * 500. Declared nodes and LLM calls (BAML, Jev, and the provider client
4481
+ * calls the build transform records) do not count toward it and are still
4482
+ * recorded past it, so the trace's token usage and cost stay complete;
4483
+ * `maxDepth` still applies to them.
4484
+ */
4436
4485
  maxCapturedSubtreeSpans?: number;
4437
4486
  /** Qualified or simple function names to leave out of the subtree. */
4438
4487
  exclude?: readonly string[] | ReadonlySet<string>;
@@ -4862,11 +4911,14 @@ declare class Bitfab {
4862
4911
  * `cachedInputTokens`, `reasoningTokens`, `costUsd` (OpenRouter's
4863
4912
  * `usage.cost`), and `durationMs`; fields the response omits are left out.
4864
4913
  *
4865
- * Beneath a `withTrace()` root, each `.chat.completions.create(...)` call in
4866
- * code compiled by the build transform, on a client whose base URL is
4867
- * `openrouter.ai`, is recorded without this wrapper as its own `llm` span,
4868
- * and a `wrapOpenRouter` around such a call records nothing more. Streaming
4869
- * calls (`stream: true`) are not recorded.
4914
+ * Beneath a `withTrace()` root, each `.chat.completions.create(...)` and
4915
+ * `.chat.completions.parse(...)` call in code compiled by the build
4916
+ * transform, on a client whose base URL is `openrouter.ai`, is recorded
4917
+ * without this wrapper as its own `llm` span, and a `wrapOpenRouter` around
4918
+ * such a call records nothing more. Beneath a root, streamed calls
4919
+ * (`stream: true` or `.chat.completions.stream(...)`) are recorded too, when
4920
+ * the stream finishes; the wrapper itself never records a stream. For a
4921
+ * client on any other base URL, use `wrapOpenAIChat`.
4870
4922
  *
4871
4923
  * ```typescript
4872
4924
  * const openai = new OpenAI({ baseURL: "https://openrouter.ai/api/v1", apiKey })
@@ -4899,11 +4951,13 @@ declare class Bitfab {
4899
4951
  * `outputTokens`, `cachedInputTokens` (cache reads), and `durationMs`;
4900
4952
  * fields the response omits are left out.
4901
4953
  *
4902
- * Beneath a `withTrace()` root, each `.messages.create(...)` call on an
4903
- * `@anthropic-ai/sdk` client in code compiled by the build transform is
4904
- * recorded without this wrapper as its own `llm` span, and a
4905
- * `wrapAnthropic` around such a call records nothing more. Streaming calls
4906
- * (`stream: true`) are not recorded.
4954
+ * Beneath a `withTrace()` root, each `.messages.create(...)` and
4955
+ * `.messages.parse(...)` call on an `@anthropic-ai/sdk` client in code
4956
+ * compiled by the build transform is recorded without this wrapper as its
4957
+ * own `llm` span, and a `wrapAnthropic` around such a call records nothing
4958
+ * more. Beneath a root, streamed calls (`stream: true` or
4959
+ * `.messages.stream(...)`) are recorded too, when the stream finishes; the
4960
+ * wrapper itself never records a stream.
4907
4961
  *
4908
4962
  * ```typescript
4909
4963
  * const anthropic = new Anthropic()
@@ -4937,11 +4991,13 @@ declare class Bitfab {
4937
4991
  * when the response reports `usage.cost`), and `durationMs`; fields the
4938
4992
  * response omits are left out.
4939
4993
  *
4940
- * Beneath a `withTrace()` root, each `.responses.create(...)` call on an
4941
- * `openai` client in code compiled by the build transform is recorded
4942
- * without this wrapper as its own `llm` span, and a `wrapOpenAIResponses`
4943
- * around such a call records nothing more. Streaming calls (`stream: true`)
4944
- * are not recorded.
4994
+ * Beneath a `withTrace()` root, each `.responses.create(...)` and
4995
+ * `.responses.parse(...)` call on an `openai` client in code compiled by the
4996
+ * build transform is recorded without this wrapper as its own `llm` span,
4997
+ * and a `wrapOpenAIResponses` around such a call records nothing more.
4998
+ * Beneath a root, streamed calls (`stream: true` or
4999
+ * `.responses.stream(...)`) are recorded too, when the stream finishes; the
5000
+ * wrapper itself never records a stream.
4945
5001
  *
4946
5002
  * ```typescript
4947
5003
  * const openai = new OpenAI()
@@ -4956,6 +5012,167 @@ declare class Bitfab {
4956
5012
  * @returns An async function with the same signature that records each call
4957
5013
  */
4958
5014
  wrapOpenAIResponses<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAIResponsesOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5015
+ /**
5016
+ * Wrap a function that sends a chat completion to the OpenAI API, or to any
5017
+ * OpenAI-compatible base URL other than OpenRouter, to record the call's
5018
+ * prompt, model, token usage, and duration. Bitfab works out the cost from
5019
+ * the model and token counts.
5020
+ *
5021
+ * Like `wrapOpenRouter`, it opens no span of its own. It writes into the
5022
+ * span that is current when the call starts, so call it inside a traced
5023
+ * function. The wrapped function must return the chat completion, as
5024
+ * `openai.chat.completions.create` and `openai.chat.completions.parse` do.
5025
+ * When its first argument is the request, the request's messages become the
5026
+ * span's prompt. One context entry holds `provider` (`"openai"`), `model`,
5027
+ * `upstreamProvider`, `inputTokens`, `outputTokens`, `cachedInputTokens`,
5028
+ * `reasoningTokens`,
5029
+ * `costUsd` (only when the response reports `usage.cost`), and
5030
+ * `durationMs`; fields the response omits are left out.
5031
+ *
5032
+ * Beneath a `withTrace()` root, each `.chat.completions.create(...)` and
5033
+ * `.chat.completions.parse(...)` call on an `openai` client in code
5034
+ * compiled by the build transform is recorded without this wrapper as its
5035
+ * own `llm` span, and a `wrapOpenAIChat` around such a call records nothing
5036
+ * more. Beneath a root, streamed calls (`stream: true` or
5037
+ * `.chat.completions.stream(...)`) are recorded too, when the stream
5038
+ * finishes, and carry usage only when the request sets
5039
+ * `stream_options: { include_usage: true }`; the wrapper itself never
5040
+ * records a stream.
5041
+ *
5042
+ * ```typescript
5043
+ * const openai = new OpenAI()
5044
+ * const complete = client.wrapOpenAIChat(
5045
+ * openai.chat.completions.create.bind(openai.chat.completions),
5046
+ * )
5047
+ * const response = await complete({
5048
+ * model: "gpt-5-mini",
5049
+ * messages: [{ role: "user", content: text }],
5050
+ * })
5051
+ * ```
5052
+ *
5053
+ * @param method - A named function that sends the request and returns the chat completion
5054
+ * @param options - `onResponse` is called with each chat completion after it is recorded
5055
+ * @returns An async function with the same signature that records each call
5056
+ */
5057
+ wrapOpenAIChat<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAIChatOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5058
+ /**
5059
+ * Wrap a function that sends a request to the OpenAI Embeddings API to
5060
+ * record the call's input, model, token usage, and duration. Bitfab works
5061
+ * out the cost from the model and token counts.
5062
+ *
5063
+ * Like `wrapOpenRouter`, it opens no span of its own. It writes into the
5064
+ * span that is current when the call starts, so call it inside a traced
5065
+ * function. The wrapped function must return the embedding list, as
5066
+ * `openai.embeddings.create` does. When its first argument is the request,
5067
+ * the request's `input` becomes the span's prompt. One context entry holds
5068
+ * `provider` (`"openai"`), `model`, `upstreamProvider`, `inputTokens`,
5069
+ * `outputTokens` (always 0), `costUsd` (only when the response reports
5070
+ * `usage.cost`), and `durationMs`; fields the response omits are left out.
5071
+ * The wrapper cannot see the client's base URL, so `provider` is
5072
+ * `"openai"` even for an OpenRouter client.
5073
+ *
5074
+ * Beneath a `withTrace()` root, each `.embeddings.create(...)` call on an
5075
+ * `openai` client in code compiled by the build transform is recorded
5076
+ * without this wrapper as its own `llm` span (with `provider`
5077
+ * `"openrouter"` when the client's base URL is `openrouter.ai`), and a
5078
+ * `wrapOpenAIEmbeddings` around such a call records nothing more.
5079
+ *
5080
+ * ```typescript
5081
+ * const openai = new OpenAI()
5082
+ * const embed = client.wrapOpenAIEmbeddings(
5083
+ * openai.embeddings.create.bind(openai.embeddings),
5084
+ * )
5085
+ * const embeddings = await embed({
5086
+ * model: "text-embedding-3-small",
5087
+ * input: text,
5088
+ * })
5089
+ * ```
5090
+ *
5091
+ * @param method - A named function that sends the request and returns the embedding list
5092
+ * @param options - `onResponse` is called with each embedding list after it is recorded
5093
+ * @returns An async function with the same signature that records each call
5094
+ */
5095
+ wrapOpenAIEmbeddings<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAIEmbeddingsOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5096
+ /**
5097
+ * Wrap a function that sends a request to the OpenAI audio transcription
5098
+ * API to record the call's model, usage, and duration. Bitfab works out the
5099
+ * cost from the model and token counts, so models billed by duration, such
5100
+ * as `whisper-1`, record no cost.
5101
+ *
5102
+ * Like `wrapOpenRouter`, it opens no span of its own. It writes into the
5103
+ * span that is current when the call starts, so call it inside a traced
5104
+ * function. The wrapped function must return the transcription, as
5105
+ * `openai.audio.transcriptions.create` does. When its first argument is the
5106
+ * request, the request's `prompt` becomes the span's prompt. One context
5107
+ * entry holds `provider` (`"openai"`), `model`, `inputTokens` and
5108
+ * `outputTokens` (for models billed by token, such as `gpt-4o-transcribe`),
5109
+ * `audioSeconds` (for models billed by duration, such as `whisper-1`), and
5110
+ * `durationMs`; fields the response omits are left out.
5111
+ *
5112
+ * Beneath a `withTrace()` root, each `.audio.transcriptions.create(...)`
5113
+ * call on an `openai` client in code compiled by the build transform is
5114
+ * recorded without this wrapper as its own `llm` span, and a
5115
+ * `wrapOpenAITranscriptions` around such a call records nothing more.
5116
+ * Beneath a root, streamed calls (`stream: true`) are recorded too, when
5117
+ * the stream finishes; the wrapper itself never records a stream.
5118
+ *
5119
+ * ```typescript
5120
+ * const openai = new OpenAI()
5121
+ * const transcribe = client.wrapOpenAITranscriptions(
5122
+ * openai.audio.transcriptions.create.bind(openai.audio.transcriptions),
5123
+ * )
5124
+ * const transcription = await transcribe({
5125
+ * model: "gpt-4o-transcribe",
5126
+ * file: fs.createReadStream("call.mp3"),
5127
+ * })
5128
+ * ```
5129
+ *
5130
+ * @param method - A named function that sends the request and returns the transcription
5131
+ * @param options - `onResponse` is called with each transcription after it is recorded
5132
+ * @returns An async function with the same signature that records each call
5133
+ */
5134
+ wrapOpenAITranscriptions<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAITranscriptionsOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5135
+ /**
5136
+ * Wrap a function that sends a request to the Gemini API through
5137
+ * `@google/genai` to record the call's prompt, model, token usage, and
5138
+ * duration. Bitfab works out the cost from the model and token counts.
5139
+ *
5140
+ * Like `wrapOpenRouter`, it opens no span of its own. It writes into the
5141
+ * span that is current when the call starts, so call it inside a traced
5142
+ * function. The wrapped function must return the response, as
5143
+ * `ai.models.generateContent` does. When its first argument is the request,
5144
+ * the request's `config.systemInstruction` and `contents` become the span's
5145
+ * prompt. One context entry holds `provider` (`"gemini"`), `model` (the
5146
+ * response's `modelVersion`, else the requested model), `inputTokens`
5147
+ * (prompt and tool-use prompt tokens), `outputTokens` (candidate and
5148
+ * thinking tokens), `cachedInputTokens`, `reasoningTokens` (thinking
5149
+ * tokens), and `durationMs`; fields the response omits are left out.
5150
+ *
5151
+ * Beneath a `withTrace()` root, each `.models.generateContent(...)` call on
5152
+ * an `@google/genai` client in code compiled by the build transform is
5153
+ * recorded without this wrapper as its own `llm` span, and a `wrapGemini`
5154
+ * around such a call records nothing more. Beneath a root,
5155
+ * `.models.generateContentStream(...)` calls are recorded too, when the
5156
+ * stream finishes; the wrapper itself never records a stream.
5157
+ *
5158
+ * `ai.models.generateContent` has no function name of its own, so a wrapper
5159
+ * around an unnamed function is named `generateContent`, which is the name
5160
+ * `withNode` targets.
5161
+ *
5162
+ * ```typescript
5163
+ * const ai = new GoogleGenAI({ apiKey })
5164
+ * const generate = client.wrapGemini(ai.models.generateContent)
5165
+ * const response = await generate({
5166
+ * model: "gemini-2.5-flash",
5167
+ * contents: text,
5168
+ * })
5169
+ * ```
5170
+ *
5171
+ * @param method - A named function that sends the request and returns the response
5172
+ * @param options - `onResponse` is called with each response after it is recorded
5173
+ * @returns An async function with the same signature that records each call
5174
+ */
5175
+ wrapGemini<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapGeminiOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
4959
5176
  private wrapClientCall;
4960
5177
  /**
4961
5178
  * Wrap a function to automatically create a span for its inputs and outputs.
@@ -5405,6 +5622,58 @@ declare class BitfabFunction {
5405
5622
  * @returns An async function with the same signature that records each call
5406
5623
  */
5407
5624
  wrapOpenAIResponses<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAIResponsesOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5625
+ /**
5626
+ * Wrap a function that sends a chat completion to the OpenAI API to record
5627
+ * the call's prompt, model, token usage, and duration. Delegates to the
5628
+ * parent client's wrapOpenAIChat method.
5629
+ *
5630
+ * Like `wrapJev`, it does not use the bound key and opens no span of its
5631
+ * own: it writes into the span that is current when the call starts.
5632
+ *
5633
+ * @param method - A named function that sends the request and returns the chat completion
5634
+ * @param options - `onResponse` is called with each chat completion after it is recorded
5635
+ * @returns An async function with the same signature that records each call
5636
+ */
5637
+ wrapOpenAIChat<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAIChatOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5638
+ /**
5639
+ * Wrap a function that sends a request to the OpenAI Embeddings API to
5640
+ * record the call's input, model, token usage, and duration. Delegates to
5641
+ * the parent client's wrapOpenAIEmbeddings method.
5642
+ *
5643
+ * Like `wrapJev`, it does not use the bound key and opens no span of its
5644
+ * own: it writes into the span that is current when the call starts.
5645
+ *
5646
+ * @param method - A named function that sends the request and returns the embedding list
5647
+ * @param options - `onResponse` is called with each embedding list after it is recorded
5648
+ * @returns An async function with the same signature that records each call
5649
+ */
5650
+ wrapOpenAIEmbeddings<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAIEmbeddingsOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5651
+ /**
5652
+ * Wrap a function that sends a request to the OpenAI audio transcription
5653
+ * API to record the call's model, usage, and duration. Delegates to the
5654
+ * parent client's wrapOpenAITranscriptions method.
5655
+ *
5656
+ * Like `wrapJev`, it does not use the bound key and opens no span of its
5657
+ * own: it writes into the span that is current when the call starts.
5658
+ *
5659
+ * @param method - A named function that sends the request and returns the transcription
5660
+ * @param options - `onResponse` is called with each transcription after it is recorded
5661
+ * @returns An async function with the same signature that records each call
5662
+ */
5663
+ wrapOpenAITranscriptions<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapOpenAITranscriptionsOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5664
+ /**
5665
+ * Wrap a function that sends a request to the Gemini API to record the
5666
+ * call's prompt, model, token usage, and duration. Delegates to the parent
5667
+ * client's wrapGemini method.
5668
+ *
5669
+ * Like `wrapJev`, it does not use the bound key and opens no span of its
5670
+ * own: it writes into the span that is current when the call starts.
5671
+ *
5672
+ * @param method - A named function that sends the request and returns the response
5673
+ * @param options - `onResponse` is called with each response after it is recorded
5674
+ * @returns An async function with the same signature that records each call
5675
+ */
5676
+ wrapGemini<TArgs extends unknown[], TResponse>(method: (...args: TArgs) => TResponse | Promise<TResponse>, options?: WrapGeminiOptions<TResponse>): (...args: TArgs) => Promise<TResponse>;
5408
5677
  }
5409
5678
  //#endregion
5410
5679
  //#region src/commitRef.d.ts
@@ -5425,7 +5694,7 @@ interface CommitRef {
5425
5694
  /**
5426
5695
  * SDK version from package.json (injected at build time)
5427
5696
  */
5428
- declare const __version__ = "0.75.0";
5697
+ declare const __version__ = "0.76.1";
5429
5698
  //#endregion
5430
5699
  //#region src/constants.d.ts
5431
5700
  /**
@@ -5567,4 +5836,4 @@ declare function seedFromRegistry(registry: ReplayRegistry, pipeline: string, ca
5567
5836
  run?: boolean;
5568
5837
  }): Promise<SeedResult>;
5569
5838
  //#endregion
5570
- export { RivetEffectType as $, ScenarioSource as $n, VercelStreamResult as $r, LabelSource as $t, SpanMethodDecoratorContext as A, DbSnapshotRef as Ai, AssertionVerdictEvidence as An, AddDatasetTracesResult as Ar, LangGraphIntegrationOptions as At, getCurrentTrace as B, ApprovalState as Bi, SavedTraceAssertion as Bn, GraderRerunTimeoutError as Br, GraderVerdictSource as Bt, NodeMethodDecorator as C, NO_MOCK_OVERRIDE as Ci, AssertionGenerationError as Cn, ExperimentSummaryFacts as Cr, PiIntegrationOptions as Ct, SeedCaseOptions as D, MixedTracingError as Di, AssertionLabelEvidence as Dn, ExperimentsClient as Dr, BitfabAgentMiddleware as Dt, ReseedResult as E, BitfabError as Ei, AssertionKind as En, ExperimentTotals as Er, BitfabOpenAIAgentHandler as Et, WrapOpenAIResponsesOptions as F, SelectiveReplayReport as Fi, SaveAssertionsParams as Fn, GraderRerun as Fr, GraderLabelOutcome as Ft, TracingProcessor as G, ScenarioData as Gn, RerunGradersResult as Gr, AssertionVerdict as Gt, ActiveSpanContext as H, Assignee as Hi, ScenarioAction as Hn, RemoveDatasetGradersResult as Hr, GradersClient as Ht, WrapOpenRouterOptions as I, AllowedEnvVars as Ii, SaveScenarioActualOutcome as In, GraderRerunError as Ir, GraderLabelSource as It, SpanListParams as J, ScenarioDataSources as Jn, UpdateDatasetParams as Jr, HumanVerdictOutcome as Jt, ListedSpan as K, ScenarioDataAppend as Kn, SaveDatasetParams as Kr, HumanLabelOutcome as Kt, WrappedBamlFn as L, BamlExecutionResult as Li, SaveScenarioData as Ln, GraderRerunProgress as Lr, GraderLabelUpdate as Lt, WrapAnthropicOptions as M, ReplayNodeIdentity as Mi, GenerateScenarioOptions as Mn, DatasetGraderRef as Mr, GetGraderLabelsParams as Mt, WrapBAMLOptions as N, SelectiveReplayDecision as Ni, SaveAssertion as Nn, DatasetTraceIds as Nr, GetGraderVerdictsParams as Nt, SeedRunOptions as O, DbSnapshotConfig as Oi, AssertionRewrite as On, ListExperimentsParams as Or, BitfabLangGraphAgent as Ot, WrapJevOptions as P, SelectiveReplayOptions as Pi, SaveAssertionsAllParams as Pn, DatasetsClient as Pr, GraderLabel as Pt, RivetContextLike as Q, ScenarioRecordInput as Qn, VercelGenerateResult as Qr, LabelOutcome as Qt, getCurrentReplayBranch as R, ProviderDefinition as Ri, SaveScenarioHistoryEntry as Rn, GraderRerunResult as Rr, GraderVerdict as Rt, DetachedTrace as S, MockValue as Si, AssertionGeneration as Sn, ExperimentSummaryExampleTrace as Sr, BitfabPiIntegration as St, ReseedOptions as T, SpanNodeMeta as Ti, AssertionGenerationTimeoutError as Tn, ExperimentTally as Tr, OrganizationMembersClient as Tt, BitfabOpenAITracingProcessor as U, Justification as Ui, ScenarioActualOutcome as Un, RemoveDatasetTracesResult as Ur, ArchiveLabelTarget as Ut, CaptureSurface as V, Approver as Vi, Scenario as Vn, ListDatasetsParams as Vr, GraderVerdictUpdate as Vt, TraceResponse as W, JustificationSpan as Wi, ScenarioCreationStatus as Wn, RerunGradersOptions as Wr, ArchiveVerdictTarget as Wt, SpansClient as X, ScenarioHistoryEntry as Xn, BitfabVercelAiHandler as Xr, LabelAction as Xt, SpanListResult as Y, ScenarioGeneration as Yn, BitfabLanguageModelMiddleware as Yr, HumanVerdictUpdate as Yt, BitfabRivetIntegration as Z, ScenarioRecord as Zn, VercelCallParams as Zr, LabelConfidence as Zt, BitfabConfig as _, DbBranchTimings as _i, VerdictsClient as _n, ExperimentRollupResult as _r, TraceIngestionType as _t, ReplayRegistryOptions as a, Category as ai, TraceLabels as an, TraceSearchFilters as ar, DbBranchOptions as at, CurrentSpan as b, MockOverrideInput as bi, AssertionCodeDraft as bn, ExperimentSummary as br, ReplayInterrupt as bt, SeedResult as c, SaveCategoryParams as ci, VerdictAction as cn, TraceTarget as cr, ReplayError as ct, seedFromRegistry as d, HttpClient as di, VerdictEvidenceItem as dn, Experiment as dr, ReplayItemFinishProgress as dt, BitfabClaudeAgentHandler as ei, LabelStatus as en, ScenarioTrigger as er, RivetIntegrationOptions as et, finalizers as f, SpanLookup as fi, VerdictOutcome as fn, ExperimentCategoryTally as fr, ReplayItemStartProgress as ft, Bitfab as g, flushTraces as gi, VerdictUpdate as gn, ExperimentRollup as gr, ReplayResult as gt, CommitRef as h, TokenUsage as hi, VerdictTarget as hn, ExperimentPage as hr, ReplayProgressItem as ht, ReplayRegistryContext as i, CategoriesClient as ii, PassFailVerdict as in, TraceAssertionsUpdate as ir, BITFAB_PROGRESS_PREFIX as it, SpanOptions as j, SUPPORTED_PROVIDERS as ji, GenerateAssertionsOptions as jn, Dataset as jr, BitfabLangGraphCallbackHandler as jt, SpanMethodDecorator as k, DbSnapshotProvider as ki, AssertionRewriteStatus as kn, AddDatasetGradersResult as kr, BitfabLangGraphIntegration as kt, defineReplayRegistry as l, CapturedSpan as li, VerdictConfidence as ln, TraceTargetOccurrence as lr, ReplayExperiment as lt, __version__ as m, SpanType as mi, VerdictStatus as mn, ExperimentJitter as mr, ReplayProgress as mt, ReplayRegistration as n, AssertionCategory as ni, LabelUpdate as nn, TraceAssertionSource as nr, AdaptContext as nt, ReseedRegistryResult as o, CategorySummary as oi, TraceVerdicts as on, TraceSearchParams as or, DbBranchReplayError as ot, DEFAULT_SERVICE_URL as p, SpanOccurrence as pi, VerdictSource as pn, ExperimentCodeChangeTotals as pr, ReplayOptions as pt, SpanListField as q, ScenarioDataOrigin as qn, SaveDatasetResult as qr, HumanLabelUpdate as qt, ReplayRegistry as r, AssertionCategorySummary as ri, LabelsClient as rn, TraceAssertionsResult as rr, AdaptInputsFn as rt, SeedCase as s, SaveAssertionCategoryParams as si, Verdict as sn, TraceSearchResult as sr, MockStrategy as st, ReplayOptionsFactory as t, AssertionCategoriesClient as ti, LabelTarget as tn, TraceAssertion as tr, ReplayBranch as tt, reseedFromRegistry as u, CodeChangeFile as ui, VerdictEvidence as un, TracesClient as ur, ReplayItem as ut, BitfabFunction as v, MockOverride as vi, ArchiveAssertionsParams as vn, ExperimentRunBy as vr, reportReplayProgress as vt, NodeOptions as w, NodeMatcher as wi, AssertionGenerationStatus as wn, ExperimentSummaryResult as wr, OrganizationMember as wt, CurrentTrace as x, MockOverrideResolver as xi, AssertionEvidenceParameter as xn, ExperimentSummaryBeforeAfter as xr, ReplayInterruptSignal as xt, CaptureWhen as y, MockOverrideCtx as yi, AssertionCode as yn, ExperimentStatus as yr, serializeReplayResult as yt, getCurrentSpan as z, ApprovalFields as zi, SaveScenarioParams as zn, GraderRerunStatus as zr, GraderVerdictOutcome as zt };
5839
+ export { SpanListResult as $, ScenarioGeneration as $n, BitfabLanguageModelMiddleware as $r, HumanVerdictUpdate as $t, SpanMethodDecoratorContext as A, BitfabError as Ai, AssertionKind as An, ExperimentTotals as Ar, BitfabOpenAIAgentHandler as At, WrapOpenRouterOptions as B, AllowedEnvVars as Bi, SaveScenarioActualOutcome as Bn, GraderRerunError as Br, GraderLabelSource as Bt, NodeMethodDecorator as C, MockOverrideCtx as Ci, AssertionCode as Cn, ExperimentStatus as Cr, serializeReplayResult as Ct, SeedCaseOptions as D, NO_MOCK_OVERRIDE as Di, AssertionGenerationError as Dn, ExperimentSummaryFacts as Dr, PiIntegrationOptions as Dt, ReseedResult as E, MockValue as Ei, AssertionGeneration as En, ExperimentSummaryExampleTrace as Er, BitfabPiIntegration as Et, WrapJevOptions as F, SUPPORTED_PROVIDERS as Fi, GenerateAssertionsOptions as Fn, Dataset as Fr, BitfabLangGraphCallbackHandler as Ft, CaptureSurface as G, Approver as Gi, Scenario as Gn, ListDatasetsParams as Gr, GraderVerdictUpdate as Gt, getCurrentReplayBranch as H, ProviderDefinition as Hi, SaveScenarioHistoryEntry as Hn, GraderRerunResult as Hr, GraderVerdict as Ht, WrapOpenAIChatOptions as I, ReplayNodeIdentity as Ii, GenerateScenarioOptions as In, DatasetGraderRef as Ir, GetGraderLabelsParams as It, TraceResponse as J, JustificationSpan as Ji, ScenarioCreationStatus as Jn, RerunGradersOptions as Jr, ArchiveVerdictTarget as Jt, ActiveSpanContext as K, Assignee as Ki, ScenarioAction as Kn, RemoveDatasetGradersResult as Kr, GradersClient as Kt, WrapOpenAIEmbeddingsOptions as L, SelectiveReplayDecision as Li, SaveAssertion as Ln, DatasetTraceIds as Lr, GetGraderVerdictsParams as Lt, WrapAnthropicOptions as M, DbSnapshotConfig as Mi, AssertionRewrite as Mn, ListExperimentsParams as Mr, BitfabLangGraphAgent as Mt, WrapBAMLOptions as N, DbSnapshotProvider as Ni, AssertionRewriteStatus as Nn, AddDatasetGradersResult as Nr, BitfabLangGraphIntegration as Nt, SeedRunOptions as O, NodeMatcher as Oi, AssertionGenerationStatus as On, ExperimentSummaryResult as Or, OrganizationMember as Ot, WrapGeminiOptions as P, DbSnapshotRef as Pi, AssertionVerdictEvidence as Pn, AddDatasetTracesResult as Pr, LangGraphIntegrationOptions as Pt, SpanListParams as Q, ScenarioDataSources as Qn, UpdateDatasetParams as Qr, HumanVerdictOutcome as Qt, WrapOpenAIResponsesOptions as R, SelectiveReplayOptions as Ri, SaveAssertionsAllParams as Rn, DatasetsClient as Rr, GraderLabel as Rt, DetachedTrace as S, MockOverride as Si, ArchiveAssertionsParams as Sn, ExperimentRunBy as Sr, reportReplayProgress as St, ReseedOptions as T, MockOverrideResolver as Ti, AssertionEvidenceParameter as Tn, ExperimentSummaryBeforeAfter as Tr, ReplayInterruptSignal as Tt, getCurrentSpan as U, ApprovalFields as Ui, SaveScenarioParams as Un, GraderRerunStatus as Ur, GraderVerdictOutcome as Ut, WrappedBamlFn as V, BamlExecutionResult as Vi, SaveScenarioData as Vn, GraderRerunProgress as Vr, GraderLabelUpdate as Vt, getCurrentTrace as W, ApprovalState as Wi, SavedTraceAssertion as Wn, GraderRerunTimeoutError as Wr, GraderVerdictSource as Wt, ListedSpan as X, ScenarioDataAppend as Xn, SaveDatasetParams as Xr, HumanLabelOutcome as Xt, TracingProcessor as Y, ScenarioData as Yn, RerunGradersResult as Yr, AssertionVerdict as Yt, SpanListField as Z, ScenarioDataOrigin as Zn, SaveDatasetResult as Zr, HumanLabelUpdate as Zt, BitfabConfig as _, SpanOccurrence as _i, VerdictSource as _n, ExperimentCodeChangeTotals as _r, ReplayOptions as _t, ReplayRegistryOptions as a, AssertionCategoriesClient as ai, LabelTarget as an, TraceAssertion as ar, ReplayBranch as at, CurrentSpan as b, flushTraces as bi, VerdictUpdate as bn, ExperimentRollup as br, ReplayResult as bt, SeedResult as c, CategoriesClient as ci, PassFailVerdict as cn, TraceAssertionsUpdate as cr, BITFAB_PROGRESS_PREFIX as ct, seedFromRegistry as d, SaveAssertionCategoryParams as di, Verdict as dn, TraceSearchResult as dr, MockStrategy as dt, BitfabVercelAiHandler as ei, LabelAction as en, ScenarioHistoryEntry as er, SpansClient as et, finalizers as f, SaveCategoryParams as fi, VerdictAction as fn, TraceTarget as fr, ReplayError as ft, Bitfab as g, SpanLookup as gi, VerdictOutcome as gn, ExperimentCategoryTally as gr, ReplayItemStartProgress as gt, CommitRef as h, HttpClient as hi, VerdictEvidenceItem as hn, Experiment as hr, ReplayItemFinishProgress as ht, ReplayRegistryContext as i, BitfabClaudeAgentHandler as ii, LabelStatus as in, ScenarioTrigger as ir, RivetIntegrationOptions as it, SpanOptions as j, MixedTracingError as ji, AssertionLabelEvidence as jn, ExperimentsClient as jr, BitfabAgentMiddleware as jt, SpanMethodDecorator as k, SpanNodeMeta as ki, AssertionGenerationTimeoutError as kn, ExperimentTally as kr, OrganizationMembersClient as kt, defineReplayRegistry as l, Category as li, TraceLabels as ln, TraceSearchFilters as lr, DbBranchOptions as lt, __version__ as m, CodeChangeFile as mi, VerdictEvidence as mn, TracesClient as mr, ReplayItem as mt, ReplayRegistration as n, VercelGenerateResult as ni, LabelOutcome as nn, ScenarioRecordInput as nr, RivetContextLike as nt, ReseedRegistryResult as o, AssertionCategory as oi, LabelUpdate as on, TraceAssertionSource as or, AdaptContext as ot, DEFAULT_SERVICE_URL as p, CapturedSpan as pi, VerdictConfidence as pn, TraceTargetOccurrence as pr, ReplayExperiment as pt, BitfabOpenAITracingProcessor as q, Justification as qi, ScenarioActualOutcome as qn, RemoveDatasetTracesResult as qr, ArchiveLabelTarget as qt, ReplayRegistry as r, VercelStreamResult as ri, LabelSource as rn, ScenarioSource as rr, RivetEffectType as rt, SeedCase as s, AssertionCategorySummary as si, LabelsClient as sn, TraceAssertionsResult as sr, AdaptInputsFn as st, ReplayOptionsFactory as t, VercelCallParams as ti, LabelConfidence as tn, ScenarioRecord as tr, BitfabRivetIntegration as tt, reseedFromRegistry as u, CategorySummary as ui, TraceVerdicts as un, TraceSearchParams as ur, DbBranchReplayError as ut, BitfabFunction as v, SpanType as vi, VerdictStatus as vn, ExperimentJitter as vr, ReplayProgress as vt, NodeOptions as w, MockOverrideInput as wi, AssertionCodeDraft as wn, ExperimentSummary as wr, ReplayInterrupt as wt, CurrentTrace as x, DbBranchTimings as xi, VerdictsClient as xn, ExperimentRollupResult as xr, TraceIngestionType as xt, CaptureWhen as y, TokenUsage as yi, VerdictTarget as yn, ExperimentPage as yr, ReplayProgressItem as yt, WrapOpenAITranscriptionsOptions as z, SelectiveReplayReport as zi, SaveAssertionsParams as zn, GraderRerun as zr, GraderLabelOutcome as zt };