bitfab 0.28.4 → 0.28.6

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
@@ -735,7 +735,7 @@ declare const BITFAB_PROGRESS_PREFIX = "@@bitfab:progress ";
735
735
  * It writes one `@@bitfab:progress` line per trace to stderr, which the Bitfab
736
736
  * plugin polls to report live progress while the replay runs in the background,
737
737
  * so scripts never hand-format the wire protocol.
738
- * stdout is left untouched for the ReplayResult JSON. Outside Node (no
738
+ * stdout is left untouched for direct-run ReplayResult JSON. Outside Node (no
739
739
  * `process.stderr`, e.g. a browser) it is a no-op, and a write failure is
740
740
  * swallowed so progress can never crash a run.
741
741
  */
@@ -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.4";
1606
+ declare const __version__ = "0.28.6";
1607
1607
 
1608
1608
  /**
1609
1609
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -735,7 +735,7 @@ declare const BITFAB_PROGRESS_PREFIX = "@@bitfab:progress ";
735
735
  * It writes one `@@bitfab:progress` line per trace to stderr, which the Bitfab
736
736
  * plugin polls to report live progress while the replay runs in the background,
737
737
  * so scripts never hand-format the wire protocol.
738
- * stdout is left untouched for the ReplayResult JSON. Outside Node (no
738
+ * stdout is left untouched for direct-run ReplayResult JSON. Outside Node (no
739
739
  * `process.stderr`, e.g. a browser) it is a no-op, and a write failure is
740
740
  * swallowed so progress can never crash a run.
741
741
  */
@@ -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.4";
1606
+ declare const __version__ = "0.28.6";
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-3F46BMPM.js";
26
+ } from "./chunk-P4YXY7J4.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
29
29
  BitfabError,
30
30
  reportReplayProgress
31
- } from "./chunk-SAGZ674W.js";
31
+ } from "./chunk-5E4BUIYA.js";
32
32
  export {
33
33
  BITFAB_PROGRESS_PREFIX,
34
34
  Bitfab,
package/dist/node.cjs CHANGED
@@ -631,11 +631,35 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
631
631
  }
632
632
  }
633
633
  }
634
- return {
634
+ const replayResult = {
635
635
  items: resultItems,
636
636
  testRunId,
637
637
  testRunUrl: `${serviceUrl}${testRunUrl}`
638
638
  };
639
+ await writeReplayResultFile(replayResult);
640
+ return replayResult;
641
+ }
642
+ async function writeReplayResultFile(result) {
643
+ const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
644
+ if (!resultPath) {
645
+ return;
646
+ }
647
+ try {
648
+ const [{ dirname }, { mkdir, writeFile }] = await Promise.all([
649
+ import("path"),
650
+ import("fs/promises")
651
+ ]);
652
+ await mkdir(dirname(resultPath), { recursive: true });
653
+ await writeFile(resultPath, `${JSON.stringify(result, null, 2)}
654
+ `);
655
+ } catch (err) {
656
+ try {
657
+ console.warn(
658
+ `Bitfab: failed to write replay result to BITFAB_REPLAY_RESULT_PATH (${resultPath}): ${err instanceof Error ? err.message : String(err)}`
659
+ );
660
+ } catch {
661
+ }
662
+ }
639
663
  }
640
664
  var BITFAB_PROGRESS_PREFIX;
641
665
  var init_replay = __esm({
@@ -682,7 +706,7 @@ registerAsyncLocalStorageClass(
682
706
  );
683
707
 
684
708
  // src/version.generated.ts
685
- var __version__ = "0.28.4";
709
+ var __version__ = "0.28.6";
686
710
 
687
711
  // src/constants.ts
688
712
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -1777,17 +1801,24 @@ function generateClientDefinitions(providers) {
1777
1801
  for (const providerDef of providers) {
1778
1802
  for (const model of providerDef.models) {
1779
1803
  const clientName = getClientName(providerDef.provider, model.model);
1804
+ const temperatureOption = supportsTemperatureZero(
1805
+ providerDef.provider,
1806
+ model.model
1807
+ ) ? "\n temperature 0" : "";
1780
1808
  definitions.push(`client<llm> ${clientName} {
1781
1809
  provider ${providerDef.provider}
1782
1810
  options {
1783
1811
  model "${model.model}"
1784
- api_key env.${providerDef.apiKeyEnv}
1812
+ api_key env.${providerDef.apiKeyEnv}${temperatureOption}
1785
1813
  }
1786
1814
  }`);
1787
1815
  }
1788
1816
  }
1789
1817
  return definitions.join("\n\n");
1790
1818
  }
1819
+ function supportsTemperatureZero(provider, model) {
1820
+ return provider === "openai" && (model.startsWith("gpt-4.1") || model.startsWith("gpt-4o"));
1821
+ }
1791
1822
  function withDefaultClients(bamlSource, providers) {
1792
1823
  const hasDefaultClient = bamlSource.includes("client<llm> OpenAI_");
1793
1824
  if (hasDefaultClient) {