@bitfab/sdk 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
@@ -14,12 +14,12 @@ import {
14
14
  flushTraces,
15
15
  getCurrentSpan,
16
16
  getCurrentTrace
17
- } from "./chunk-3F46BMPM.js";
17
+ } from "./chunk-P4YXY7J4.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
20
20
  BitfabError,
21
21
  reportReplayProgress
22
- } from "./chunk-SAGZ674W.js";
22
+ } from "./chunk-5E4BUIYA.js";
23
23
  export {
24
24
  BITFAB_PROGRESS_PREFIX,
25
25
  Bitfab,
package/dist/node.cjs CHANGED
@@ -622,11 +622,35 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
622
622
  }
623
623
  }
624
624
  }
625
- return {
625
+ const replayResult = {
626
626
  items: resultItems,
627
627
  testRunId,
628
628
  testRunUrl: `${serviceUrl}${testRunUrl}`
629
629
  };
630
+ await writeReplayResultFile(replayResult);
631
+ return replayResult;
632
+ }
633
+ async function writeReplayResultFile(result) {
634
+ const resultPath = typeof process !== "undefined" ? process.env?.BITFAB_REPLAY_RESULT_PATH : void 0;
635
+ if (!resultPath) {
636
+ return;
637
+ }
638
+ try {
639
+ const [{ dirname }, { mkdir, writeFile }] = await Promise.all([
640
+ import("path"),
641
+ import("fs/promises")
642
+ ]);
643
+ await mkdir(dirname(resultPath), { recursive: true });
644
+ await writeFile(resultPath, `${JSON.stringify(result, null, 2)}
645
+ `);
646
+ } catch (err) {
647
+ try {
648
+ console.warn(
649
+ `Bitfab: failed to write replay result to BITFAB_REPLAY_RESULT_PATH (${resultPath}): ${err instanceof Error ? err.message : String(err)}`
650
+ );
651
+ } catch {
652
+ }
653
+ }
630
654
  }
631
655
  var BITFAB_PROGRESS_PREFIX;
632
656
  var init_replay = __esm({
@@ -673,7 +697,7 @@ registerAsyncLocalStorageClass(
673
697
  );
674
698
 
675
699
  // src/version.generated.ts
676
- var __version__ = "0.28.4";
700
+ var __version__ = "0.28.6";
677
701
 
678
702
  // src/constants.ts
679
703
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -1768,17 +1792,24 @@ function generateClientDefinitions(providers) {
1768
1792
  for (const providerDef of providers) {
1769
1793
  for (const model of providerDef.models) {
1770
1794
  const clientName = getClientName(providerDef.provider, model.model);
1795
+ const temperatureOption = supportsTemperatureZero(
1796
+ providerDef.provider,
1797
+ model.model
1798
+ ) ? "\n temperature 0" : "";
1771
1799
  definitions.push(`client<llm> ${clientName} {
1772
1800
  provider ${providerDef.provider}
1773
1801
  options {
1774
1802
  model "${model.model}"
1775
- api_key env.${providerDef.apiKeyEnv}
1803
+ api_key env.${providerDef.apiKeyEnv}${temperatureOption}
1776
1804
  }
1777
1805
  }`);
1778
1806
  }
1779
1807
  }
1780
1808
  return definitions.join("\n\n");
1781
1809
  }
1810
+ function supportsTemperatureZero(provider, model) {
1811
+ return provider === "openai" && (model.startsWith("gpt-4.1") || model.startsWith("gpt-4o"));
1812
+ }
1782
1813
  function withDefaultClients(bamlSource, providers) {
1783
1814
  const hasDefaultClient = bamlSource.includes("client<llm> OpenAI_");
1784
1815
  if (hasDefaultClient) {