@bitfab/sdk 0.65.6 → 0.65.8

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/baml.cjs ADDED
@@ -0,0 +1,12 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_bamlPeer = require("./bamlPeer-BUoZgNxZ.cjs");
6
+ let _boundaryml_baml = require("@boundaryml/baml");
7
+ _boundaryml_baml = require_bamlPeer.__toESM(_boundaryml_baml, 1);
8
+ //#region src/bamlEntry.ts
9
+ require_bamlPeer.registerBamlModule(_boundaryml_baml);
10
+ //#endregion
11
+
12
+ //# sourceMappingURL=baml.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baml.cjs","names":["registerBamlModule","baml"],"sources":["../src/bamlEntry.ts"],"sourcesContent":["import * as baml from \"@boundaryml/baml\"\nimport { registerBamlModule } from \"./bamlPeer.js\"\n\nregisterBamlModule(baml)\n"],"mappings":";;;;;;;;AAGAA,iBAAAA,mBAAmBC,gBAAI"}
@@ -0,0 +1 @@
1
+ export {}
package/dist/baml.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/dist/baml.js ADDED
@@ -0,0 +1,8 @@
1
+ import { n as registerBamlModule } from "./bamlPeer-CIVwS68E.js";
2
+ import * as baml from "@boundaryml/baml";
3
+ //#region src/bamlEntry.ts
4
+ registerBamlModule(baml);
5
+ //#endregion
6
+ export {};
7
+
8
+ //# sourceMappingURL=baml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baml.js","names":[],"sources":["../src/bamlEntry.ts"],"sourcesContent":["import * as baml from \"@boundaryml/baml\"\nimport { registerBamlModule } from \"./bamlPeer.js\"\n\nregisterBamlModule(baml)\n"],"mappings":";;;AAGA,mBAAmB,IAAI"}
@@ -0,0 +1,88 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ return target;
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
+ key = keys[i];
20
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
+ get: ((k) => from[k]).bind(null, key),
22
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
+ });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ //#endregion
32
+ //#region src/optionalPeer.ts
33
+ function importOptionalPeer(specifierParts) {
34
+ return import(
35
+ /* webpackIgnore: true */
36
+ /* @vite-ignore */
37
+ specifierParts.join("/")
38
+ );
39
+ }
40
+ //#endregion
41
+ //#region src/bamlPeer.ts
42
+ const BAML_MODULE_STORAGE_SYMBOL = Symbol.for("bitfab.bamlModule");
43
+ let importedBamlModule;
44
+ function registeredBamlModule() {
45
+ return globalThis[BAML_MODULE_STORAGE_SYMBOL];
46
+ }
47
+ function registerBamlModule(bamlModule) {
48
+ globalThis[BAML_MODULE_STORAGE_SYMBOL] = bamlModule;
49
+ }
50
+ async function loadBamlModule() {
51
+ const registered = registeredBamlModule();
52
+ if (registered) return registered;
53
+ importedBamlModule ?? (importedBamlModule = importOptionalPeer(["@boundaryml", "baml"]).catch(() => null));
54
+ return await importedBamlModule ?? registeredBamlModule() ?? null;
55
+ }
56
+ //#endregion
57
+ Object.defineProperty(exports, "__exportAll", {
58
+ enumerable: true,
59
+ get: function() {
60
+ return __exportAll;
61
+ }
62
+ });
63
+ Object.defineProperty(exports, "__toESM", {
64
+ enumerable: true,
65
+ get: function() {
66
+ return __toESM;
67
+ }
68
+ });
69
+ Object.defineProperty(exports, "importOptionalPeer", {
70
+ enumerable: true,
71
+ get: function() {
72
+ return importOptionalPeer;
73
+ }
74
+ });
75
+ Object.defineProperty(exports, "loadBamlModule", {
76
+ enumerable: true,
77
+ get: function() {
78
+ return loadBamlModule;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, "registerBamlModule", {
82
+ enumerable: true,
83
+ get: function() {
84
+ return registerBamlModule;
85
+ }
86
+ });
87
+
88
+ //# sourceMappingURL=bamlPeer-BUoZgNxZ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bamlPeer-BUoZgNxZ.cjs","names":[],"sources":["../src/optionalPeer.ts","../src/bamlPeer.ts"],"sourcesContent":["/**\n * Import an OPTIONAL peer dependency without breaking a consumer's bundler.\n *\n * Optional peers (declared in this package's `peerDependenciesMeta` with\n * `optional: true` - e.g. `@openai/agents`, `@boundaryml/baml`) are absent by\n * design for most consumers: someone who only uses the Vercel AI integration\n * never installs `@openai/agents`, and someone who never calls `Bitfab.call()`\n * never installs `@boundaryml/baml`.\n *\n * A plain `import(\"@openai/agents\")` leaves a static, literal specifier in the\n * built SDK. A consumer's bundler (webpack, Turbopack, Vite, Rollup, esbuild)\n * statically analyses that specifier and tries to resolve it at *build* time,\n * failing the whole build with \"Module not found: Can't resolve\n * '@openai/agents'\" even though that code path never runs for that consumer.\n * Wrapping the import in try/catch is not enough: only webpack >= 5.90.2 treats\n * that as optional, and Turbopack/Vite/older webpack do not.\n *\n * The robust, bundler-agnostic fix is to keep the specifier out of static\n * analysis entirely. The caller passes the specifier as parts that are joined\n * at runtime, so no bundler can see a literal module name to resolve. The\n * `webpackIgnore` / `@vite-ignore` magic comments are belt-and-suspenders for\n * bundlers that still inspect the (now non-literal) request. This mirrors the\n * technique already used for `node:async_hooks` in `asyncStorage.ts`.\n *\n * The import stays a native runtime `import()`: it resolves from `node_modules`\n * when the peer IS installed, and throws an ordinary module-not-found error\n * only when the feature is actually used without its peer installed - which is\n * the correct behaviour (the caller opted into an integration whose peer they\n * chose not to install).\n *\n * @param specifierParts - The package specifier split so it is reconstructed at\n * runtime, never appearing as a literal (e.g. `[\"@openai\", \"agents\"]` ->\n * `\"@openai/agents\"`).\n */\nexport function importOptionalPeer<T = unknown>(\n specifierParts: readonly string[],\n): Promise<T> {\n // Reconstructed at runtime so no bundler sees a literal specifier to resolve.\n const specifier = specifierParts.join(\"/\")\n return import(\n /* webpackIgnore: true */ /* @vite-ignore */ specifier\n ) as Promise<T>\n}\n","import { importOptionalPeer } from \"./optionalPeer.js\"\n\nexport type BamlModule = typeof import(\"@boundaryml/baml\")\n\nconst BAML_MODULE_STORAGE_SYMBOL = Symbol.for(\"bitfab.bamlModule\")\n\nlet importedBamlModule: Promise<BamlModule | null> | undefined\n\nfunction registeredBamlModule(): BamlModule | undefined {\n return (globalThis as Record<symbol, BamlModule | undefined>)[\n BAML_MODULE_STORAGE_SYMBOL\n ]\n}\n\nexport function registerBamlModule(bamlModule: BamlModule): void {\n ;(globalThis as Record<symbol, BamlModule | undefined>)[\n BAML_MODULE_STORAGE_SYMBOL\n ] = bamlModule\n}\n\nexport async function loadBamlModule(): Promise<BamlModule | null> {\n const registered = registeredBamlModule()\n if (registered) {\n return registered\n }\n importedBamlModule ??= importOptionalPeer<BamlModule>([\n \"@boundaryml\",\n \"baml\",\n ]).catch(() => null)\n return (await importedBamlModule) ?? registeredBamlModule() ?? null\n}\n\nexport function _resetBamlModule(): void {\n importedBamlModule = undefined\n delete (globalThis as Record<symbol, BamlModule | undefined>)[\n BAML_MODULE_STORAGE_SYMBOL\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,mBACd,gBACY;CAGZ,OAAO;;;EADW,eAAe,KAAK,GAEiB;;AAEzD;;;ACtCA,MAAM,6BAA6B,OAAO,IAAI,mBAAmB;AAEjE,IAAI;AAEJ,SAAS,uBAA+C;CACtD,OAAQ,WACN;AAEJ;AAEA,SAAgB,mBAAmB,YAA8B;CAC9D,WACC,8BACE;AACN;AAEA,eAAsB,iBAA6C;CACjE,MAAM,aAAa,qBAAqB;CACxC,IAAI,YACF,OAAO;CAET,uBAAA,qBAAuB,mBAA+B,CACpD,eACA,MACF,CAAC,CAAC,CAAC,YAAY,IAAI;CACnB,OAAQ,MAAM,sBAAuB,qBAAqB,KAAK;AACjE"}
@@ -0,0 +1,28 @@
1
+ //#region src/optionalPeer.ts
2
+ function importOptionalPeer(specifierParts) {
3
+ return import(
4
+ /* webpackIgnore: true */
5
+ /* @vite-ignore */
6
+ specifierParts.join("/")
7
+ );
8
+ }
9
+ //#endregion
10
+ //#region src/bamlPeer.ts
11
+ const BAML_MODULE_STORAGE_SYMBOL = Symbol.for("bitfab.bamlModule");
12
+ let importedBamlModule;
13
+ function registeredBamlModule() {
14
+ return globalThis[BAML_MODULE_STORAGE_SYMBOL];
15
+ }
16
+ function registerBamlModule(bamlModule) {
17
+ globalThis[BAML_MODULE_STORAGE_SYMBOL] = bamlModule;
18
+ }
19
+ async function loadBamlModule() {
20
+ const registered = registeredBamlModule();
21
+ if (registered) return registered;
22
+ importedBamlModule ?? (importedBamlModule = importOptionalPeer(["@boundaryml", "baml"]).catch(() => null));
23
+ return await importedBamlModule ?? registeredBamlModule() ?? null;
24
+ }
25
+ //#endregion
26
+ export { registerBamlModule as n, importOptionalPeer as r, loadBamlModule as t };
27
+
28
+ //# sourceMappingURL=bamlPeer-CIVwS68E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bamlPeer-CIVwS68E.js","names":[],"sources":["../src/optionalPeer.ts","../src/bamlPeer.ts"],"sourcesContent":["/**\n * Import an OPTIONAL peer dependency without breaking a consumer's bundler.\n *\n * Optional peers (declared in this package's `peerDependenciesMeta` with\n * `optional: true` - e.g. `@openai/agents`, `@boundaryml/baml`) are absent by\n * design for most consumers: someone who only uses the Vercel AI integration\n * never installs `@openai/agents`, and someone who never calls `Bitfab.call()`\n * never installs `@boundaryml/baml`.\n *\n * A plain `import(\"@openai/agents\")` leaves a static, literal specifier in the\n * built SDK. A consumer's bundler (webpack, Turbopack, Vite, Rollup, esbuild)\n * statically analyses that specifier and tries to resolve it at *build* time,\n * failing the whole build with \"Module not found: Can't resolve\n * '@openai/agents'\" even though that code path never runs for that consumer.\n * Wrapping the import in try/catch is not enough: only webpack >= 5.90.2 treats\n * that as optional, and Turbopack/Vite/older webpack do not.\n *\n * The robust, bundler-agnostic fix is to keep the specifier out of static\n * analysis entirely. The caller passes the specifier as parts that are joined\n * at runtime, so no bundler can see a literal module name to resolve. The\n * `webpackIgnore` / `@vite-ignore` magic comments are belt-and-suspenders for\n * bundlers that still inspect the (now non-literal) request. This mirrors the\n * technique already used for `node:async_hooks` in `asyncStorage.ts`.\n *\n * The import stays a native runtime `import()`: it resolves from `node_modules`\n * when the peer IS installed, and throws an ordinary module-not-found error\n * only when the feature is actually used without its peer installed - which is\n * the correct behaviour (the caller opted into an integration whose peer they\n * chose not to install).\n *\n * @param specifierParts - The package specifier split so it is reconstructed at\n * runtime, never appearing as a literal (e.g. `[\"@openai\", \"agents\"]` ->\n * `\"@openai/agents\"`).\n */\nexport function importOptionalPeer<T = unknown>(\n specifierParts: readonly string[],\n): Promise<T> {\n // Reconstructed at runtime so no bundler sees a literal specifier to resolve.\n const specifier = specifierParts.join(\"/\")\n return import(\n /* webpackIgnore: true */ /* @vite-ignore */ specifier\n ) as Promise<T>\n}\n","import { importOptionalPeer } from \"./optionalPeer.js\"\n\nexport type BamlModule = typeof import(\"@boundaryml/baml\")\n\nconst BAML_MODULE_STORAGE_SYMBOL = Symbol.for(\"bitfab.bamlModule\")\n\nlet importedBamlModule: Promise<BamlModule | null> | undefined\n\nfunction registeredBamlModule(): BamlModule | undefined {\n return (globalThis as Record<symbol, BamlModule | undefined>)[\n BAML_MODULE_STORAGE_SYMBOL\n ]\n}\n\nexport function registerBamlModule(bamlModule: BamlModule): void {\n ;(globalThis as Record<symbol, BamlModule | undefined>)[\n BAML_MODULE_STORAGE_SYMBOL\n ] = bamlModule\n}\n\nexport async function loadBamlModule(): Promise<BamlModule | null> {\n const registered = registeredBamlModule()\n if (registered) {\n return registered\n }\n importedBamlModule ??= importOptionalPeer<BamlModule>([\n \"@boundaryml\",\n \"baml\",\n ]).catch(() => null)\n return (await importedBamlModule) ?? registeredBamlModule() ?? null\n}\n\nexport function _resetBamlModule(): void {\n importedBamlModule = undefined\n delete (globalThis as Record<symbol, BamlModule | undefined>)[\n BAML_MODULE_STORAGE_SYMBOL\n ]\n}\n"],"mappings":";AAkCA,SAAgB,mBACd,gBACY;CAGZ,OAAO;;;EADW,eAAe,KAAK,GAEiB;;AAEzD;;;ACtCA,MAAM,6BAA6B,OAAO,IAAI,mBAAmB;AAEjE,IAAI;AAEJ,SAAS,uBAA+C;CACtD,OAAQ,WACN;AAEJ;AAEA,SAAgB,mBAAmB,YAA8B;CAC9D,WACC,8BACE;AACN;AAEA,eAAsB,iBAA6C;CACjE,MAAM,aAAa,qBAAqB;CACxC,IAAI,YACF,OAAO;CAET,uBAAA,qBAAuB,mBAA+B,CACpD,eACA,MACF,CAAC,CAAC,CAAC,YAAY,IAAI;CACnB,OAAQ,MAAM,sBAAuB,qBAAqB,KAAK;AACjE"}
@@ -5,7 +5,7 @@ import { ExportResultCode } from "@opentelemetry/core";
5
5
  import { resourceFromAttributes } from "@opentelemetry/resources";
6
6
  import { AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
7
7
  //#region src/version.generated.ts
8
- const __version__ = "0.65.6";
8
+ const __version__ = "0.65.8";
9
9
  const __packageName__ = "@bitfab/sdk";
10
10
  //#endregion
11
11
  //#region src/traceCompletion.ts
@@ -776,6 +776,7 @@ var SimulationPlan = class {
776
776
  this.rootWaitOver = false;
777
777
  this.held = [];
778
778
  this.stopped = false;
779
+ this.readStarted = false;
779
780
  this.loaded = new Promise((resolve) => {
780
781
  this.resolveLoaded = resolve;
781
782
  });
@@ -786,8 +787,16 @@ var SimulationPlan = class {
786
787
  disabled() {
787
788
  return !this.enabled || simulationPlanEnvDisabled();
788
789
  }
790
+ idle() {
791
+ return !this.readStarted && this.source.canRead?.() === false;
792
+ }
789
793
  refresh() {
794
+ if (this.idle()) return;
795
+ this.read();
796
+ }
797
+ read() {
790
798
  if (this.stopped || this.disabled()) return;
799
+ this.readStarted = true;
791
800
  this.policyRefresh.run(() => this.source.getSimulationPlan(), (body) => {
792
801
  const parsed = parseSimulationPlan(body);
793
802
  if (parsed === null) this.scheduleRetry("sim-plan-unreadable", "the sim plan response was not understood");
@@ -832,7 +841,7 @@ var SimulationPlan = class {
832
841
  }
833
842
  waitForFirstRead() {
834
843
  this.refresh();
835
- if (this.rootWaitOver || this.disabled() || !this.holdingForFirstRead()) return;
844
+ if (this.rootWaitOver || this.disabled() || this.idle() || !this.holdingForFirstRead()) return;
836
845
  if (this.rootWait === void 0) {
837
846
  this.rootWait = new Promise((resolve) => {
838
847
  this.resolveRootWait = resolve;
@@ -848,11 +857,11 @@ var SimulationPlan = class {
848
857
  return !this.disabled() && this.contentOffByKey === void 0 && this.firstReadOver;
849
858
  }
850
859
  firstLoad() {
851
- if (this.contentOffByKey !== void 0 || this.stopped || this.disabled()) return;
860
+ if (this.contentOffByKey !== void 0 || this.stopped || this.disabled() || this.idle()) return;
852
861
  return this.loaded;
853
862
  }
854
863
  send(payload, traceFunctionKey, submit, drop) {
855
- this.refresh();
864
+ this.read();
856
865
  if (this.disabled() || traceFunctionKey === void 0 || spanNameOf(payload) === void 0 || recordedByFramework(payload)) {
857
866
  submit(payload);
858
867
  return;
@@ -870,7 +879,7 @@ var SimulationPlan = class {
870
879
  this.submitEntry(entry);
871
880
  }
872
881
  sendTrace(payload, submit) {
873
- this.refresh();
882
+ this.read();
874
883
  if (this.disabled() || !this.holdingForFirstRead() || !this.holdsSpanOfTrace(traceIdOf(payload))) {
875
884
  submit(payload);
876
885
  return;
@@ -2151,4 +2160,4 @@ function experimentIdWireFields(experimentId) {
2151
2160
  //#endregion
2152
2161
  export { readEnv as C, MixedTracingError as S, getReplayContext as _, http_exports as a, gitRunner as b, recordCallerTraceMetadata as c, DECLARED_NODE_FIELD as d, ROOT_TRACE_FUNCTION_KEY_FIELD as f, MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES as g, makeSpanOrigin as h, flushTraces as i, retireTraceMetadata as l, isFrameworkInstrumentation as m, SPAN_TYPES as n, unrefTimer as o, SimulationPlan as p, experimentIdWireFields as r, callerTraceMetadata as s, HttpClient as t, CONTENT_OFF_KEY as u, replayContextReady as v, __version__ as w, BitfabError as x, runWithReplayContext as y };
2153
2162
 
2154
- //# sourceMappingURL=http-lnqCEnB1.js.map
2163
+ //# sourceMappingURL=http-C9d2uNjI.js.map