bitfab 0.28.3 → 0.28.5

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.cts CHANGED
@@ -623,9 +623,9 @@ interface ReplayOptions {
623
623
  codeChangeFiles?: CodeChangeFile[];
624
624
  /**
625
625
  * Mock strategy for child spans during replay.
626
- * - "none": everything runs real code (default)
626
+ * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
627
+ * - "none": everything runs real code
627
628
  * - "all": every child withSpan returns historical output
628
- * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked
629
629
  */
630
630
  mock?: MockStrategy;
631
631
  /**
@@ -1603,7 +1603,7 @@ declare class BitfabFunction {
1603
1603
  /**
1604
1604
  * SDK version from package.json (injected at build time)
1605
1605
  */
1606
- declare const __version__ = "0.28.3";
1606
+ declare const __version__ = "0.28.5";
1607
1607
 
1608
1608
  /**
1609
1609
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -623,9 +623,9 @@ interface ReplayOptions {
623
623
  codeChangeFiles?: CodeChangeFile[];
624
624
  /**
625
625
  * Mock strategy for child spans during replay.
626
- * - "none": everything runs real code (default)
626
+ * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked (default)
627
+ * - "none": everything runs real code
627
628
  * - "all": every child withSpan returns historical output
628
- * - "marked": only spans tagged with { mockOnReplay: true } in SpanOptions are mocked
629
629
  */
630
630
  mock?: MockStrategy;
631
631
  /**
@@ -1603,7 +1603,7 @@ declare class BitfabFunction {
1603
1603
  /**
1604
1604
  * SDK version from package.json (injected at build time)
1605
1605
  */
1606
- declare const __version__ = "0.28.3";
1606
+ declare const __version__ = "0.28.5";
1607
1607
 
1608
1608
  /**
1609
1609
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -23,12 +23,12 @@ import {
23
23
  flushTraces,
24
24
  getCurrentSpan,
25
25
  getCurrentTrace
26
- } from "./chunk-KYDQQPIS.js";
26
+ } from "./chunk-7UU5L64L.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
29
29
  BitfabError,
30
30
  reportReplayProgress
31
- } from "./chunk-B262VQWF.js";
31
+ } from "./chunk-SAGZ674W.js";
32
32
  export {
33
33
  BITFAB_PROGRESS_PREFIX,
34
34
  Bitfab,
package/dist/node.cjs CHANGED
@@ -407,10 +407,25 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
407
407
  }
408
408
  let mockTree;
409
409
  if (mockStrategy === "all" || mockStrategy === "marked") {
410
- const treeResponse = await httpClient.getSpanTree(
411
- serverItem.externalSpanId
412
- );
413
- mockTree = buildMockTree(treeResponse.root);
410
+ try {
411
+ const treeResponse = await httpClient.getSpanTree(
412
+ serverItem.externalSpanId
413
+ );
414
+ if (treeResponse.root) {
415
+ mockTree = buildMockTree(treeResponse.root);
416
+ } else if (mockStrategy === "all") {
417
+ throw new BitfabError(
418
+ `Replay mock strategy "all" requires a span tree root for source span ${serverItem.externalSpanId}.`
419
+ );
420
+ } else {
421
+ mockTree = void 0;
422
+ }
423
+ } catch (e) {
424
+ if (mockStrategy === "all") {
425
+ throw e;
426
+ }
427
+ mockTree = void 0;
428
+ }
414
429
  }
415
430
  const maybePromise = runWithReplayContext(
416
431
  {
@@ -516,7 +531,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
516
531
  options?.experimentGroupId,
517
532
  options?.datasetId
518
533
  );
519
- const mockStrategy = options?.mock ?? "none";
534
+ const mockStrategy = options?.mock ?? "marked";
520
535
  const maxConcurrency = options?.maxConcurrency ?? 10;
521
536
  const tasks = serverItems.map(
522
537
  (serverItem) => () => processItem(
@@ -667,7 +682,7 @@ registerAsyncLocalStorageClass(
667
682
  );
668
683
 
669
684
  // src/version.generated.ts
670
- var __version__ = "0.28.3";
685
+ var __version__ = "0.28.5";
671
686
 
672
687
  // src/constants.ts
673
688
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -1762,17 +1777,24 @@ function generateClientDefinitions(providers) {
1762
1777
  for (const providerDef of providers) {
1763
1778
  for (const model of providerDef.models) {
1764
1779
  const clientName = getClientName(providerDef.provider, model.model);
1780
+ const temperatureOption = supportsTemperatureZero(
1781
+ providerDef.provider,
1782
+ model.model
1783
+ ) ? "\n temperature 0" : "";
1765
1784
  definitions.push(`client<llm> ${clientName} {
1766
1785
  provider ${providerDef.provider}
1767
1786
  options {
1768
1787
  model "${model.model}"
1769
- api_key env.${providerDef.apiKeyEnv}
1788
+ api_key env.${providerDef.apiKeyEnv}${temperatureOption}
1770
1789
  }
1771
1790
  }`);
1772
1791
  }
1773
1792
  }
1774
1793
  return definitions.join("\n\n");
1775
1794
  }
1795
+ function supportsTemperatureZero(provider, model) {
1796
+ return provider === "openai" && (model.startsWith("gpt-4.1") || model.startsWith("gpt-4o"));
1797
+ }
1776
1798
  function withDefaultClients(bamlSource, providers) {
1777
1799
  const hasDefaultClient = bamlSource.includes("client<llm> OpenAI_");
1778
1800
  if (hasDefaultClient) {