@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
package/dist/replayCli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, o as checkReplayCliArgs, r as resolveRegistry, s as runReplayCli, t as importRegistry } from "./registryCommand-DdE8cNOX.js";
2
+ import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, o as checkReplayCliArgs, r as resolveRegistry, s as runReplayCli, t as importRegistry } from "./registryCommand-D1VgfJjC.js";
3
3
  //#region src/cloudReplayCli.ts
4
4
  const CLOUD_REPLAY_HINT = "Add --cloud to run the same replay on GitHub Actions; bitfab-replay --cloud --help explains it.";
5
5
  function isCloudReplayCommand(argv) {
package/dist/seedCli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, r as resolveRegistry, t as importRegistry } from "./registryCommand-DdE8cNOX.js";
2
+ import { a as runRegistryMain, c as runSeedCli, i as runIfEntrypoint, n as parseRegistryCommandArgs, r as resolveRegistry, t as importRegistry } from "./registryCommand-D1VgfJjC.js";
3
3
  //#region src/seedCli.ts
4
4
  const USAGE = "Usage: bitfab-seed --registry <path> <pipeline> --from-trace <id>[,<id>...]\n bitfab-seed --registry <path> <pipeline> --cases <cases.jsonl> [--run]\nRun bitfab-seed --registry <path> <pipeline> --help for details.";
5
5
  async function runSeedCommand(argv, io = {}, importer = importRegistry) {
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { C as BitfabError, E as __version__, S as gitRunner, T as readEnv$1, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-Cotx6kLL.js";
3
- import { A as unmapOpenAiAgentsTrace, B as asyncStorageReady, C as recordAutoTracedClientCall, D as mapOpenAiAgentsTrace, E as endOpenAiAgentsSpan, F as warnOnce, H as isAsyncStorageInitDone, I as writeOnce, L as isCaptureSuppressed, M as installLangChainRunScopes, N as markLangChainRunRecorded, O as openAiAgentsParentSpanId, R as runWithCaptureSuppressed, S as frameworkRecordsClientCall, T as watchClientCall, V as createAsyncLocalStorage, _ as runWithAutoTraceRootContext, b as OPENROUTER, f as invokeThroughAutoTraceEntries, g as runWithAutoTraceNodeConfiguration, h as runWithAutoTraceFramesAt, j as forgetLangChainRun, k as openAiAgentsSpanChain, l as clearAutoTraceNodeConfiguration, m as runWithAutoTraceEntry, o as __bitfabAutoTraceActive, p as runAsAutoTraceRootFunction, u as currentAutoTraceEntries, v as ANTHROPIC, w as recordWatchedClientCall, x as clientCallProvider, y as OPENAI_RESPONSES } from "./autoTrace-kHOBg49M.js";
2
+ import { C as BitfabError, E as __version__, S as gitRunner, T as readEnv$1, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-DS1QjBvx.js";
3
+ import { A as recordWatchedClientCall, B as installLangChainRunScopes, C as OPENAI_RESPONSES, D as clientCallStreams, E as clientCallProvider, F as mapOpenAiAgentsTrace, G as isCaptureSuppressed, I as openAiAgentsParentSpanId, J as asyncStorageReady, K as runWithCaptureSuppressed, L as openAiAgentsSpanChain, M as watchClientCall, N as StreamFinalizationError, O as frameworkRecordsClientCall, P as endOpenAiAgentsSpan, R as unmapOpenAiAgentsTrace, S as OPENAI_EMBEDDINGS, T as OPENROUTER, U as warnOnce, V as markLangChainRunRecorded, W as writeOnce, X as isAsyncStorageInitDone, Y as createAsyncLocalStorage, _ as runWithAutoTraceNodeConfiguration, b as GEMINI, d as currentAutoTraceEntries, g as runWithAutoTraceFramesAt, h as runWithAutoTraceEntry, j as sharedClientCallStreamRecording, k as recordAutoTracedClientCall, m as runAsAutoTraceRootFunction, p as invokeThroughAutoTraceEntries, s as __bitfabAutoTraceActive, u as clearAutoTraceNodeConfiguration, v as runWithAutoTraceRootContext, w as OPENAI_TRANSCRIPTIONS, x as OPENAI_CHAT, y as ANTHROPIC, z as forgetLangChainRun } from "./autoTrace-BgN0zCQf.js";
4
4
  import { t as importOptionalPeer } from "./optionalPeer-CczrzrXx.js";
5
5
  import { t as loadBamlModule } from "./bamlPeer-Dyeb3e5o.js";
6
6
  import superjson from "superjson";
@@ -2670,15 +2670,6 @@ function normalizeMockOverrides(mockOverride) {
2670
2670
  } : override);
2671
2671
  }
2672
2672
  //#endregion
2673
- //#region src/streamFinalizationError.ts
2674
- var StreamFinalizationError = class extends Error {
2675
- constructor(message, output) {
2676
- super(message);
2677
- this.output = output;
2678
- this.name = "StreamFinalizationError";
2679
- }
2680
- };
2681
- //#endregion
2682
2673
  //#region src/openaiAgentSdk.ts
2683
2674
  var BitfabOpenAIAgentHandler = class {
2684
2675
  constructor(config) {
@@ -5654,6 +5645,9 @@ function runWithSpanStack(stack, fn) {
5654
5645
  throw error;
5655
5646
  }
5656
5647
  }
5648
+ function finalizedLater(finalize, result) {
5649
+ return Promise.resolve().then(() => finalize(result));
5650
+ }
5657
5651
  function isAsyncIterable(value) {
5658
5652
  return value !== null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
5659
5653
  }
@@ -5799,6 +5793,15 @@ function extractContextFromCollector(collector) {
5799
5793
  }
5800
5794
  }
5801
5795
  const BOUND_FUNCTION_NAME_PREFIX = /^bound /;
5796
+ function unboundName(method) {
5797
+ const name = method.name.replace(BOUND_FUNCTION_NAME_PREFIX, "");
5798
+ return name === "" ? void 0 : name;
5799
+ }
5800
+ function requiredMethodName(method, error) {
5801
+ const name = unboundName(method);
5802
+ if (name === void 0) throw new BitfabError(error);
5803
+ return name;
5804
+ }
5802
5805
  function discoveredSpanType(definition, nodeConfiguration) {
5803
5806
  const recordsModelCall = definition.baml === true || definition.jev === true || definition.clientCall !== void 0;
5804
5807
  const ownType = recordsModelCall ? "llm" : "function";
@@ -5860,10 +5863,12 @@ function isSpanType(value) {
5860
5863
  const noOpSpan = {
5861
5864
  id: "",
5862
5865
  traceId: "",
5866
+ traceFunctionKeys: [],
5863
5867
  addContext() {},
5864
5868
  setPrompt() {}
5865
5869
  };
5866
5870
  const noOpTrace = {
5871
+ traceFunctionKey: "",
5867
5872
  setSessionId() {},
5868
5873
  setName() {},
5869
5874
  setMetadata() {},
@@ -5878,6 +5883,9 @@ function currentTraceRootSpan() {
5878
5883
  if (context?.isRoot && context.traceId === traceId) return context;
5879
5884
  }
5880
5885
  }
5886
+ function activeTraceFunctionKeys(stack) {
5887
+ return [.../* @__PURE__ */ new Set([...currentAutoTraceEntries().map((entry) => entry.context.traceFunctionKey), ...stack.map((context) => context.traceFunctionKey)])];
5888
+ }
5881
5889
  function getCurrentSpan() {
5882
5890
  const stack = getSpanStack();
5883
5891
  const current = stack[stack.length - 1];
@@ -5885,6 +5893,7 @@ function getCurrentSpan() {
5885
5893
  return {
5886
5894
  id: current.spanId,
5887
5895
  traceId: current.traceId,
5896
+ traceFunctionKeys: activeTraceFunctionKeys(stack),
5888
5897
  addContext(context) {
5889
5898
  try {
5890
5899
  if (typeof context !== "object" || context === null) return;
@@ -5924,6 +5933,7 @@ function getCurrentTrace() {
5924
5933
  return traceState;
5925
5934
  };
5926
5935
  return {
5936
+ traceFunctionKey: current.rootTraceFunctionKey,
5927
5937
  setSessionId(sessionId) {
5928
5938
  try {
5929
5939
  const traceState = getOrCreateTraceState();
@@ -6169,9 +6179,9 @@ var Bitfab = class {
6169
6179
  const innermost = stack[stack.length - 1];
6170
6180
  return innermost === void 0 ? traceFunctionKey : rootTraceFunctionKeyOfTrace(innermost.traceId, traceFunctionKey);
6171
6181
  };
6172
- const recordsSpan = (entry, spanName, declared) => {
6182
+ const recordsSpan = (entry, spanName, declared, llmCall = false) => {
6173
6183
  const contentOff = !declared && self.simulationPlan.contentOffNow(rootTraceFunctionKeyOfEntry(entry), spanName);
6174
- const countsTowardCapturedSubtree = !declared && !contentOff;
6184
+ const countsTowardCapturedSubtree = !declared && !contentOff && !llmCall;
6175
6185
  const refusedBy = entry.depth >= maxDepth ? "max_depth" : countsTowardCapturedSubtree && capturedSubtreeCount >= maxCapturedSubtreeSpans ? "max_captured_subtree_spans" : void 0;
6176
6186
  if (refusedBy !== void 0) {
6177
6187
  truncate(refusedBy);
@@ -6190,7 +6200,10 @@ var Bitfab = class {
6190
6200
  if (nodeConfiguration?.capture === false) return clearAutoTraceNodeConfiguration(invokeFn);
6191
6201
  const spanName = nodeConfiguration?.name ?? definition.name;
6192
6202
  const declaredNode = nodeConfiguration !== void 0;
6193
- if (!recordsSpan(entry, spanName, declaredNode)) return invokeWithoutNode();
6203
+ const clientCall = clientCallProvider(definition.clientCall);
6204
+ const llmCall = definition.baml === true || definition.jev === true || clientCall !== void 0;
6205
+ if (!recordsSpan(entry, spanName, declaredNode, llmCall)) return invokeWithoutNode();
6206
+ const streamRecording = clientCall !== void 0 && clientCallStreams(clientCall, definition.clientCallMethod ?? simpleName ?? "", inputs[0]) ? sharedClientCallStreamRecording(spanDetails, clientCall, inputs[0]) : void 0;
6194
6207
  const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
6195
6208
  const nodeExperimentId = nodeConfiguration === void 0 ? void 0 : resolveSpanExperimentId(nodeConfiguration);
6196
6209
  const childOptions = {
@@ -6207,11 +6220,14 @@ var Bitfab = class {
6207
6220
  ...nodeExperimentId !== void 0 && { experimentId: nodeExperimentId },
6208
6221
  ...mockOnReplay !== void 0 && { mockOnReplay },
6209
6222
  ...nodeConfiguration?.replayReusable !== void 0 && { replayReusable: nodeConfiguration.replayReusable },
6210
- ...nodeConfiguration?.finalize !== void 0 && { finalize: nodeConfiguration.finalize }
6223
+ ...nodeConfiguration?.finalize !== void 0 && { finalize: nodeConfiguration.finalize },
6224
+ ...streamRecording !== void 0 && {
6225
+ finalize: () => streamRecording.done,
6226
+ alwaysRunsOnReplay: true
6227
+ }
6211
6228
  };
6212
6229
  const isAsync = definition.async === true;
6213
- const clientCall = clientCallProvider(definition.clientCall);
6214
- return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : definition.jev === true ? () => recordAutoTracedJev(invokeFn, getCurrentSpan()) : clientCall !== void 0 ? () => recordAutoTracedClientCall(clientCall, invokeFn, inputs[0], getCurrentSpan()) : invokeFn);
6230
+ return openChild(entry, childOptions, inputs, isAsync, definition.baml === true ? () => invokeAutoTracedBaml(invokeFn, isAsync) : definition.jev === true ? () => recordAutoTracedJev(invokeFn, getCurrentSpan()) : streamRecording !== void 0 ? () => streamRecording.start(getCurrentSpan(), invokeFn) : clientCall !== void 0 ? () => recordAutoTracedClientCall(clientCall, invokeFn, inputs[0], getCurrentSpan()) : invokeFn);
6215
6231
  },
6216
6232
  invokeNestedRoot(nestedName, nestedFunctionName, inputs, invokeFn, entry, link, spanDetails) {
6217
6233
  if (excluded.has(nestedName) || excluded.has(nestedFunctionName) || !recordsSpan(entry, nestedName, true)) return invokeFn();
@@ -6521,8 +6537,7 @@ var Bitfab = class {
6521
6537
  return wrappedFn;
6522
6538
  }
6523
6539
  wrapJev(method, options) {
6524
- const methodName = method.name.replace(BOUND_FUNCTION_NAME_PREFIX, "");
6525
- if (!methodName) throw new BitfabError("wrapJev requires a named function (e.g., jev.systemOne.bind(jev)).");
6540
+ const name = requiredMethodName(method, "wrapJev requires a named function (e.g., jev.systemOne.bind(jev)).");
6526
6541
  const wrappedFn = async (...args) => {
6527
6542
  const span = getCurrentSpan();
6528
6543
  const startedAt = Date.now();
@@ -6536,22 +6551,32 @@ var Bitfab = class {
6536
6551
  };
6537
6552
  Object.defineProperty(wrappedFn, "name", {
6538
6553
  configurable: true,
6539
- value: methodName
6554
+ value: name
6540
6555
  });
6541
6556
  return wrappedFn;
6542
6557
  }
6543
6558
  wrapOpenRouter(method, options) {
6544
- return this.wrapClientCall(OPENROUTER, "wrapOpenRouter requires a named function (e.g., openai.chat.completions.create.bind(openai.chat.completions)).", method, options);
6559
+ return this.wrapClientCall(OPENROUTER, method, options, requiredMethodName(method, "wrapOpenRouter requires a named function (e.g., openai.chat.completions.create.bind(openai.chat.completions))."));
6545
6560
  }
6546
6561
  wrapAnthropic(method, options) {
6547
- return this.wrapClientCall(ANTHROPIC, "wrapAnthropic requires a named function (e.g., anthropic.messages.create.bind(anthropic.messages)).", method, options);
6562
+ return this.wrapClientCall(ANTHROPIC, method, options, requiredMethodName(method, "wrapAnthropic requires a named function (e.g., anthropic.messages.create.bind(anthropic.messages))."));
6548
6563
  }
6549
6564
  wrapOpenAIResponses(method, options) {
6550
- return this.wrapClientCall(OPENAI_RESPONSES, "wrapOpenAIResponses requires a named function (e.g., openai.responses.create.bind(openai.responses)).", method, options);
6565
+ return this.wrapClientCall(OPENAI_RESPONSES, method, options, requiredMethodName(method, "wrapOpenAIResponses requires a named function (e.g., openai.responses.create.bind(openai.responses))."));
6566
+ }
6567
+ wrapOpenAIChat(method, options) {
6568
+ return this.wrapClientCall(OPENAI_CHAT, method, options, requiredMethodName(method, "wrapOpenAIChat requires a named function (e.g., openai.chat.completions.create.bind(openai.chat.completions))."));
6569
+ }
6570
+ wrapOpenAIEmbeddings(method, options) {
6571
+ return this.wrapClientCall(OPENAI_EMBEDDINGS, method, options, requiredMethodName(method, "wrapOpenAIEmbeddings requires a named function (e.g., openai.embeddings.create.bind(openai.embeddings))."));
6551
6572
  }
6552
- wrapClientCall(provider, anonymousError, method, options) {
6553
- const methodName = method.name.replace(BOUND_FUNCTION_NAME_PREFIX, "");
6554
- if (!methodName) throw new BitfabError(anonymousError);
6573
+ wrapOpenAITranscriptions(method, options) {
6574
+ return this.wrapClientCall(OPENAI_TRANSCRIPTIONS, method, options, requiredMethodName(method, "wrapOpenAITranscriptions requires a named function (e.g., openai.audio.transcriptions.create.bind(openai.audio.transcriptions))."));
6575
+ }
6576
+ wrapGemini(method, options) {
6577
+ return this.wrapClientCall(GEMINI, method, options, unboundName(method) ?? "generateContent");
6578
+ }
6579
+ wrapClientCall(provider, method, options, name) {
6555
6580
  const wrappedFn = async (...args) => {
6556
6581
  const span = getCurrentSpan();
6557
6582
  const startedAt = Date.now();
@@ -6572,7 +6597,7 @@ var Bitfab = class {
6572
6597
  };
6573
6598
  Object.defineProperty(wrappedFn, "name", {
6574
6599
  configurable: true,
6575
- value: methodName
6600
+ value: name
6576
6601
  });
6577
6602
  return wrappedFn;
6578
6603
  }
@@ -6645,6 +6670,7 @@ var Bitfab = class {
6645
6670
  spanId,
6646
6671
  details: options.spanDetails ?? { contexts: [] },
6647
6672
  spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
6673
+ traceFunctionKey,
6648
6674
  rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(traceId, traceFunctionKey),
6649
6675
  instrumentation: options.instrumentation ?? "span",
6650
6676
  declaredNode: options.declaredNode === true,
@@ -6749,7 +6775,7 @@ var Bitfab = class {
6749
6775
  }
6750
6776
  };
6751
6777
  const recordSpan = (result) => {
6752
- if (options.finalize) self.httpClient.trackDeferred(Promise.resolve().then(() => options.finalize(result)).then((output) => sendSpan({ result: output })).catch((error) => sendSpan({
6778
+ if (options.finalize) self.httpClient.trackDeferred(finalizedLater(options.finalize, result).then((output) => sendSpan({ result: output })).catch((error) => sendSpan({
6753
6779
  result: error instanceof StreamFinalizationError ? error.output : void 0,
6754
6780
  error: error instanceof StreamFinalizationError ? error.message : error instanceof Error ? `finalize failed: ${error.message}` : `finalize failed: ${String(error)}`
6755
6781
  })));
@@ -6800,7 +6826,7 @@ var Bitfab = class {
6800
6826
  reuseAllowed: options.replayReusable === true,
6801
6827
  canReuseOutput: options.finalize === void 0 && options.replayOutput === void 0 && !fn.constructor.name.includes("Generator")
6802
6828
  });
6803
- if (decision.mock) {
6829
+ if (decision.mock && options.alwaysRunsOnReplay !== true) {
6804
6830
  sendSpan({
6805
6831
  result: decision.output,
6806
6832
  mocked: true,
@@ -6851,8 +6877,8 @@ var Bitfab = class {
6851
6877
  return output;
6852
6878
  };
6853
6879
  const resolveBaseOutput = () => options.replayOutput !== void 0 ? options.replayOutput() : resolveRecordedOutput();
6854
- const shouldMockWithBaseStrategy = replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true;
6855
- if (replayCtxForMock.mockOverrides?.length) {
6880
+ const shouldMockWithBaseStrategy = options.alwaysRunsOnReplay !== true && (replayCtxForMock.mockStrategy === "all" || replayCtxForMock.mockStrategy === "marked" && options.mockOnReplay === true);
6881
+ if (replayCtxForMock.mockOverrides?.length && options.alwaysRunsOnReplay !== true) {
6856
6882
  const nodeMeta = {
6857
6883
  traceFunctionKey,
6858
6884
  spanName: baseSpanParams.spanName,
@@ -7214,7 +7240,7 @@ var Bitfab = class {
7214
7240
  await runWithSeedContext({ traceId }, async () => target(...args));
7215
7241
  } finally {
7216
7242
  try {
7217
- const { flushTraces } = await import("./http-Cotx6kLL.js").then((n) => n.a);
7243
+ const { flushTraces } = await import("./http-DS1QjBvx.js").then((n) => n.a);
7218
7244
  await flushTraces(3e4);
7219
7245
  } finally {
7220
7246
  unrecorded = activeTraceStates.delete(traceId);
@@ -7318,6 +7344,18 @@ var BitfabFunction = class {
7318
7344
  wrapOpenAIResponses(method, options) {
7319
7345
  return this.client.wrapOpenAIResponses(method, options);
7320
7346
  }
7347
+ wrapOpenAIChat(method, options) {
7348
+ return this.client.wrapOpenAIChat(method, options);
7349
+ }
7350
+ wrapOpenAIEmbeddings(method, options) {
7351
+ return this.client.wrapOpenAIEmbeddings(method, options);
7352
+ }
7353
+ wrapOpenAITranscriptions(method, options) {
7354
+ return this.client.wrapOpenAITranscriptions(method, options);
7355
+ }
7356
+ wrapGemini(method, options) {
7357
+ return this.client.wrapGemini(method, options);
7358
+ }
7321
7359
  };
7322
7360
  //#endregion
7323
7361
  //#region src/finalizers.ts
@@ -7420,7 +7458,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
7420
7458
  metadata: seedCase.metadata,
7421
7459
  sessionId: seedCase.sessionId
7422
7460
  }));
7423
- const { flushTraces } = await import("./http-Cotx6kLL.js").then((n) => n.a);
7461
+ const { flushTraces } = await import("./http-DS1QjBvx.js").then((n) => n.a);
7424
7462
  await flushTraces(3e4);
7425
7463
  return {
7426
7464
  pipeline,
@@ -7437,4 +7475,4 @@ function resolveTraceFunctionKey(registration) {
7437
7475
  //#endregion
7438
7476
  export { VerdictsClient as A, OrganizationMembersClient as C, BitfabLangGraphCallbackHandler as D, BitfabLangGraphIntegration as E, GraderRerunTimeoutError as F, BitfabClaudeAgentHandler as I, DEFAULT_SERVICE_URL as L, SUPPORTED_PROVIDERS as M, DatasetsClient as N, GradersClient as O, GraderRerunError as P, AssertionCategoriesClient as R, BitfabPiIntegration as S, NO_MOCK_OVERRIDE as T, BITFAB_PROGRESS_PREFIX as _, Bitfab as a, reportReplayProgress as b, getCurrentSpan as c, BitfabOpenAITracingProcessor as d, AssertionGenerationError as f, BitfabRivetIntegration as g, SpansClient as h, finalizers as i, ExperimentsClient as j, LabelsClient as k, getCurrentTrace as l, TracesClient as m, reseedFromRegistry as n, BitfabFunction as o, AssertionGenerationTimeoutError as p, seedFromRegistry as r, getCurrentReplayBranch as s, defineReplayRegistry as t, BitfabVercelAiHandler as u, DbBranchReplayError as v, BitfabOpenAIAgentHandler as w, serializeReplayResult as x, ReplayError as y, CategoriesClient as z };
7439
7477
 
7440
- //# sourceMappingURL=src-CrV0INwT.js.map
7478
+ //# sourceMappingURL=src-BJjbR3Nq.js.map