@bitfab/sdk 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
@@ -14,12 +14,12 @@ import {
14
14
  flushTraces,
15
15
  getCurrentSpan,
16
16
  getCurrentTrace
17
- } from "./chunk-KYDQQPIS.js";
17
+ } from "./chunk-7UU5L64L.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
20
20
  BitfabError,
21
21
  reportReplayProgress
22
- } from "./chunk-B262VQWF.js";
22
+ } from "./chunk-SAGZ674W.js";
23
23
  export {
24
24
  BITFAB_PROGRESS_PREFIX,
25
25
  Bitfab,
package/dist/node.cjs CHANGED
@@ -398,10 +398,25 @@ async function processItem(httpClient, serverItem, fn, testRunId, mockStrategy,
398
398
  }
399
399
  let mockTree;
400
400
  if (mockStrategy === "all" || mockStrategy === "marked") {
401
- const treeResponse = await httpClient.getSpanTree(
402
- serverItem.externalSpanId
403
- );
404
- mockTree = buildMockTree(treeResponse.root);
401
+ try {
402
+ const treeResponse = await httpClient.getSpanTree(
403
+ serverItem.externalSpanId
404
+ );
405
+ if (treeResponse.root) {
406
+ mockTree = buildMockTree(treeResponse.root);
407
+ } else if (mockStrategy === "all") {
408
+ throw new BitfabError(
409
+ `Replay mock strategy "all" requires a span tree root for source span ${serverItem.externalSpanId}.`
410
+ );
411
+ } else {
412
+ mockTree = void 0;
413
+ }
414
+ } catch (e) {
415
+ if (mockStrategy === "all") {
416
+ throw e;
417
+ }
418
+ mockTree = void 0;
419
+ }
405
420
  }
406
421
  const maybePromise = runWithReplayContext(
407
422
  {
@@ -507,7 +522,7 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options) {
507
522
  options?.experimentGroupId,
508
523
  options?.datasetId
509
524
  );
510
- const mockStrategy = options?.mock ?? "none";
525
+ const mockStrategy = options?.mock ?? "marked";
511
526
  const maxConcurrency = options?.maxConcurrency ?? 10;
512
527
  const tasks = serverItems.map(
513
528
  (serverItem) => () => processItem(
@@ -658,7 +673,7 @@ registerAsyncLocalStorageClass(
658
673
  );
659
674
 
660
675
  // src/version.generated.ts
661
- var __version__ = "0.28.3";
676
+ var __version__ = "0.28.5";
662
677
 
663
678
  // src/constants.ts
664
679
  var DEFAULT_SERVICE_URL = "https://bitfab.ai";
@@ -1753,17 +1768,24 @@ function generateClientDefinitions(providers) {
1753
1768
  for (const providerDef of providers) {
1754
1769
  for (const model of providerDef.models) {
1755
1770
  const clientName = getClientName(providerDef.provider, model.model);
1771
+ const temperatureOption = supportsTemperatureZero(
1772
+ providerDef.provider,
1773
+ model.model
1774
+ ) ? "\n temperature 0" : "";
1756
1775
  definitions.push(`client<llm> ${clientName} {
1757
1776
  provider ${providerDef.provider}
1758
1777
  options {
1759
1778
  model "${model.model}"
1760
- api_key env.${providerDef.apiKeyEnv}
1779
+ api_key env.${providerDef.apiKeyEnv}${temperatureOption}
1761
1780
  }
1762
1781
  }`);
1763
1782
  }
1764
1783
  }
1765
1784
  return definitions.join("\n\n");
1766
1785
  }
1786
+ function supportsTemperatureZero(provider, model) {
1787
+ return provider === "openai" && (model.startsWith("gpt-4.1") || model.startsWith("gpt-4o"));
1788
+ }
1767
1789
  function withDefaultClients(bamlSource, providers) {
1768
1790
  const hasDefaultClient = bamlSource.includes("client<llm> OpenAI_");
1769
1791
  if (hasDefaultClient) {