@boundaryml/baml-bridge-web 0.0.0

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.
Files changed (87) hide show
  1. package/dist/index.d.ts +30 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +57 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/native.d.ts +79 -0
  6. package/dist/native.d.ts.map +1 -0
  7. package/dist/native.js +148 -0
  8. package/dist/native.js.map +1 -0
  9. package/dist/shared/define_function.d.ts +31 -0
  10. package/dist/shared/define_function.d.ts.map +1 -0
  11. package/dist/shared/define_function.js +274 -0
  12. package/dist/shared/define_function.js.map +1 -0
  13. package/dist/shared/errors.d.ts +51 -0
  14. package/dist/shared/errors.d.ts.map +1 -0
  15. package/dist/shared/errors.js +60 -0
  16. package/dist/shared/errors.js.map +1 -0
  17. package/dist/shared/host_value_registry.d.ts +50 -0
  18. package/dist/shared/host_value_registry.d.ts.map +1 -0
  19. package/dist/shared/host_value_registry.js +134 -0
  20. package/dist/shared/host_value_registry.js.map +1 -0
  21. package/dist/shared/proto/baml_cffi.d.ts +6282 -0
  22. package/dist/shared/proto/baml_cffi.js +12482 -0
  23. package/dist/shared/proto.d.ts +55 -0
  24. package/dist/shared/proto.d.ts.map +1 -0
  25. package/dist/shared/proto.js +956 -0
  26. package/dist/shared/proto.js.map +1 -0
  27. package/dist/shared/stream.d.ts +16 -0
  28. package/dist/shared/stream.d.ts.map +1 -0
  29. package/dist/shared/stream.js +61 -0
  30. package/dist/shared/stream.js.map +1 -0
  31. package/dist/shared/typemap.d.ts +30 -0
  32. package/dist/shared/typemap.d.ts.map +1 -0
  33. package/dist/shared/typemap.js +103 -0
  34. package/dist/shared/typemap.js.map +1 -0
  35. package/dist/shared/wire_ty.d.ts +51 -0
  36. package/dist/shared/wire_ty.d.ts.map +1 -0
  37. package/dist/shared/wire_ty.js +140 -0
  38. package/dist/shared/wire_ty.js.map +1 -0
  39. package/dist/wasm/bridge_web_core.d.ts +174 -0
  40. package/dist/wasm/bridge_web_core.js +1277 -0
  41. package/dist/wasm/bridge_web_core_bg.wasm +0 -0
  42. package/dist/wasm/bridge_web_core_bg.wasm.d.ts +41 -0
  43. package/dist/wasm/package.json +19 -0
  44. package/dist/workerd/index.d.ts +30 -0
  45. package/dist/workerd/index.d.ts.map +1 -0
  46. package/dist/workerd/index.js +57 -0
  47. package/dist/workerd/index.js.map +1 -0
  48. package/dist/workerd/native.d.ts +79 -0
  49. package/dist/workerd/native.d.ts.map +1 -0
  50. package/dist/workerd/native.js +147 -0
  51. package/dist/workerd/shared/define_function.d.ts +31 -0
  52. package/dist/workerd/shared/define_function.d.ts.map +1 -0
  53. package/dist/workerd/shared/define_function.js +274 -0
  54. package/dist/workerd/shared/define_function.js.map +1 -0
  55. package/dist/workerd/shared/errors.d.ts +51 -0
  56. package/dist/workerd/shared/errors.d.ts.map +1 -0
  57. package/dist/workerd/shared/errors.js +60 -0
  58. package/dist/workerd/shared/errors.js.map +1 -0
  59. package/dist/workerd/shared/host_value_registry.d.ts +50 -0
  60. package/dist/workerd/shared/host_value_registry.d.ts.map +1 -0
  61. package/dist/workerd/shared/host_value_registry.js +134 -0
  62. package/dist/workerd/shared/host_value_registry.js.map +1 -0
  63. package/dist/workerd/shared/proto/baml_cffi.d.ts +6282 -0
  64. package/dist/workerd/shared/proto/baml_cffi.js +12482 -0
  65. package/dist/workerd/shared/proto.d.ts +55 -0
  66. package/dist/workerd/shared/proto.d.ts.map +1 -0
  67. package/dist/workerd/shared/proto.js +956 -0
  68. package/dist/workerd/shared/proto.js.map +1 -0
  69. package/dist/workerd/shared/stream.d.ts +16 -0
  70. package/dist/workerd/shared/stream.d.ts.map +1 -0
  71. package/dist/workerd/shared/stream.js +61 -0
  72. package/dist/workerd/shared/stream.js.map +1 -0
  73. package/dist/workerd/shared/typemap.d.ts +30 -0
  74. package/dist/workerd/shared/typemap.d.ts.map +1 -0
  75. package/dist/workerd/shared/typemap.js +103 -0
  76. package/dist/workerd/shared/typemap.js.map +1 -0
  77. package/dist/workerd/shared/wire_ty.d.ts +51 -0
  78. package/dist/workerd/shared/wire_ty.d.ts.map +1 -0
  79. package/dist/workerd/shared/wire_ty.js +140 -0
  80. package/dist/workerd/shared/wire_ty.js.map +1 -0
  81. package/dist/workerd-wasm/bridge_web_core.d.ts +108 -0
  82. package/dist/workerd-wasm/bridge_web_core.js +14 -0
  83. package/dist/workerd-wasm/bridge_web_core_bg.js +1178 -0
  84. package/dist/workerd-wasm/bridge_web_core_bg.wasm +0 -0
  85. package/dist/workerd-wasm/bridge_web_core_bg.wasm.d.ts +41 -0
  86. package/dist/workerd-wasm/package.json +21 -0
  87. package/package.json +31 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define_function.js","sourceRoot":"","sources":["../../typescript_src/shared/define_function.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,mEAAmE;AACnE,EAAE;AACF,+CAA+C;AAC/C,gFAAgF;AAChF,gGAAgG;AAChG,mDAAmD;AACnD,uFAAuF;AACvF,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,yDAAyD;AAEzD,OAAO,EAEH,UAAU,EACV,eAAe,IAAI,qBAAqB,GAC3C,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAiB,MAAM,cAAc,CAAC;AAIhE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,KAAK,GAAkB,MAAM,CAAC,YAAY,CAAC,CAAC;AAwBzD;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,QAAiB,EAAE,UAA6B;IACxE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,IAAI,SAAS,CACf,6EAA6E;gBAC7E,uBAAuB,CAC1B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G,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;oBACxE,CAAC;4BAAS,CAAC;wBACP,cAAc,CAAC,MAAM,EAAE,CAAC;oBAC5B,CAAC;oBACD,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAC;gBACzC,CAAC,CAAC;YACN,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Structured detail carried by a thrown `BamlError` / `BamlPanic`, mirroring
3
+ * `bridge_python`'s `BamlError(value, baml_trace=..., class_name=...)`.
4
+ *
5
+ * - `value`: the fully decoded thrown BAML value (a generated class instance
6
+ * when the FQN is mapped, else a plain object / primitive).
7
+ * - `bamlTrace`: the pre-rendered `File "...", line N, in fn` frame strings
8
+ * from the BAML stack.
9
+ * - `className`: the thrown value's BAML FQN when known (e.g.
10
+ * `baml.json.JsonParseError`).
11
+ */
12
+ export interface BamlErrorDetail {
13
+ value?: unknown;
14
+ bamlTrace?: string[];
15
+ className?: string;
16
+ }
17
+ export declare class BamlError extends Error {
18
+ /** The decoded thrown BAML value, or `undefined` for SDK-internal errors. */
19
+ readonly value: unknown;
20
+ /** Pre-rendered BAML stack frames; empty for SDK-internal errors. */
21
+ readonly bamlTrace: string[];
22
+ /** The thrown value's BAML FQN, when known. */
23
+ readonly className: string | undefined;
24
+ constructor(message: string, detail?: BamlErrorDetail);
25
+ }
26
+ export declare class BamlInvalidArgumentError extends BamlError {
27
+ constructor(message: string);
28
+ }
29
+ export declare class BamlClientError extends BamlError {
30
+ constructor(message: string);
31
+ }
32
+ export declare class BamlCancelledError extends BamlError {
33
+ constructor(message: string);
34
+ }
35
+ export declare class BamlAbortError extends Error {
36
+ readonly reason: unknown;
37
+ constructor(message: string, options?: {
38
+ reason?: unknown;
39
+ });
40
+ }
41
+ /**
42
+ * Raised for SDK-setup failures and BAML-runtime panics — the Node analog of
43
+ * `bridge_python`'s `BamlPanic`. The in-call panic path (`decodeCallResult`'s
44
+ * `panic` arm) and the `getRuntime` not-initialized path both surface this,
45
+ * except clean process-exit panics, which exit after flushing telemetry.
46
+ */
47
+ export declare class BamlPanic extends BamlError {
48
+ constructor(message: string, detail?: BamlErrorDetail);
49
+ }
50
+ export declare function wrapNativeError(err: unknown): BamlError;
51
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,SAAU,SAAQ,KAAK;IAChC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe;CAOxD;AAED,qBAAa,wBAAyB,SAAQ,SAAS;gBACvC,OAAO,EAAE,MAAM;CAI9B;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAC9B,OAAO,EAAE,MAAM;CAI9B;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACjC,OAAO,EAAE,MAAM;CAI9B;AAED,qBAAa,cAAe,SAAQ,KAAK;IACrC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE;CAK9D;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,SAAS;gBACxB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe;CAIxD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAGvD"}
@@ -0,0 +1,60 @@
1
+ // errors.ts — mirrors bridge_python/python_src/baml_py/errors.py
2
+ export class BamlError extends Error {
3
+ /** The decoded thrown BAML value, or `undefined` for SDK-internal errors. */
4
+ value;
5
+ /** Pre-rendered BAML stack frames; empty for SDK-internal errors. */
6
+ bamlTrace;
7
+ /** The thrown value's BAML FQN, when known. */
8
+ className;
9
+ constructor(message, detail) {
10
+ super(message);
11
+ this.name = 'BamlError';
12
+ this.value = detail?.value;
13
+ this.bamlTrace = detail?.bamlTrace ? [...detail.bamlTrace] : [];
14
+ this.className = detail?.className;
15
+ }
16
+ }
17
+ export class BamlInvalidArgumentError extends BamlError {
18
+ constructor(message) {
19
+ super(message);
20
+ this.name = 'BamlInvalidArgumentError';
21
+ }
22
+ }
23
+ export class BamlClientError extends BamlError {
24
+ constructor(message) {
25
+ super(message);
26
+ this.name = 'BamlClientError';
27
+ }
28
+ }
29
+ export class BamlCancelledError extends BamlError {
30
+ constructor(message) {
31
+ super(message);
32
+ this.name = 'BamlCancelledError';
33
+ }
34
+ }
35
+ export class BamlAbortError extends Error {
36
+ reason;
37
+ constructor(message, options) {
38
+ super(message);
39
+ this.name = 'AbortError';
40
+ this.reason = options?.reason;
41
+ }
42
+ }
43
+ /**
44
+ * Raised for SDK-setup failures and BAML-runtime panics — the Node analog of
45
+ * `bridge_python`'s `BamlPanic`. The in-call panic path (`decodeCallResult`'s
46
+ * `panic` arm) and the `getRuntime` not-initialized path both surface this,
47
+ * except clean process-exit panics, which exit after flushing telemetry.
48
+ */
49
+ export class BamlPanic extends BamlError {
50
+ constructor(message, detail) {
51
+ super(message, detail);
52
+ this.name = 'BamlPanic';
53
+ }
54
+ }
55
+ export function wrapNativeError(err) {
56
+ if (!(err instanceof Error))
57
+ return new BamlError(String(err));
58
+ return new BamlError(err.message);
59
+ }
60
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../typescript_src/shared/errors.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAmBjE,MAAM,OAAO,SAAU,SAAQ,KAAK;IAChC,6EAA6E;IACpE,KAAK,CAAU;IACxB,qEAAqE;IAC5D,SAAS,CAAW;IAC7B,+CAA+C;IACtC,SAAS,CAAqB;IAEvC,YAAY,OAAe,EAAE,MAAwB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,MAAM,EAAE,KAAK,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC;IACvC,CAAC;CACJ;AAED,MAAM,OAAO,wBAAyB,SAAQ,SAAS;IACnD,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IAC3C,CAAC;CACJ;AAED,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC1C,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAClC,CAAC;CACJ;AAED,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC7C,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACrC,CAAC;CACJ;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC5B,MAAM,CAAU;IAEzB,YAAY,OAAe,EAAE,OAA8B;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAClC,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACpC,YAAY,OAAe,EAAE,MAAwB;QACjD,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC5B,CAAC;CACJ;AAED,MAAM,UAAU,eAAe,CAAC,GAAY;IACxC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC;QAAE,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,OAAO,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { type HandleKey } from '../native.js';
2
+ /**
3
+ * Register an arbitrary host JS value and return its native `HandleKey` for
4
+ * the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a
5
+ * `baml.errors.HostCallable` Instance (or any future opaque-value carrier).
6
+ * Mints a fresh key via the Rust side's shared counter (guaranteed non-zero —
7
+ * Rust `next_key` skips `0`); stores the value keyed by the same key
8
+ * (recomposed as a `bigint` for `Map`-key equality).
9
+ *
10
+ * Returns the native `HandleKey` directly so it can flow into the
11
+ * protobufjs encoder without an intermediate `bigint→Long` conversion
12
+ * (protobufjs reads `uint64` fields from a `{low, high}` shape, which
13
+ * the native `HandleKey` already provides; a bare `bigint` does not
14
+ * encode correctly through the `IInboundValue.handle.key` field).
15
+ */
16
+ export declare function registerHostOpaque(value: unknown): HandleKey;
17
+ /**
18
+ * Look up a host-registered JS value by key. Returns `undefined` when:
19
+ * - the key is the reserved sentinel `0n` (no real value was registered);
20
+ * - the engine has already released the entry (last `HostValueArc` clone
21
+ * dropped → Rust `host_release_callback` fired → `_releaseHostValue`
22
+ * removed the entry);
23
+ * - the key was minted by a different Node process (cross-runtime handle).
24
+ *
25
+ * Callers should fall back to a metadata-built exception in those cases.
26
+ *
27
+ * GC/decode race: a release notification and a rehydrating decode can be
28
+ * scheduled on the libuv loop concurrently in principle, but in practice
29
+ * the same `HostValueArc` cannot drop *while* the engine is actively
30
+ * emitting an outbound proto referencing its key — the outbound encode
31
+ * holds a strong handle through proto serialization, and the release tsfn
32
+ * isn't fired until that strong handle drops. By the time the TS decoder
33
+ * runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if
34
+ * a *prior* outbound completed and the engine has since dropped its last
35
+ * Arc; in that case the user has already observed the original throw at
36
+ * least once, so a second lookup-miss → metadata-fallback is acceptable.
37
+ */
38
+ export declare function lookupHostValue(key: bigint): unknown;
39
+ /**
40
+ * Convenience for the outbound decoder: if `handle` is a `BamlHandle`
41
+ * tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in
42
+ * the registry and return it. Returns `undefined` for any other handle
43
+ * type, a non-`BamlHandle` argument, or a key that doesn't resolve.
44
+ *
45
+ * Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
46
+ * exception when a BAML-thrown `baml.errors.HostCallable` propagates back
47
+ * to the same Node process that originated it.
48
+ */
49
+ export declare function tryRehydrateHostValueByKey(handle: unknown): unknown;
50
+ //# sourceMappingURL=host_value_registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host_value_registry.d.ts","sourceRoot":"","sources":["../../typescript_src/shared/host_value_registry.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAkE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AA4B9G;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAI5D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAInE"}
@@ -0,0 +1,134 @@
1
+ // host_value_registry.ts — mirrors bridge_python's `register_host_opaque`
2
+ // + `lookup_host_value` pair.
3
+ //
4
+ // An arbitrary host JS value round-trips back to the *same* Node process as
5
+ // the *same* object (identity preserved), not flattened into a metadata-only
6
+ // wrapper. A native JS exception raised inside a user callable is the primary
7
+ // consumer: it round-trips as the *same* `Error` object (`raised === caught`
8
+ // identity), not a metadata-only `BamlError(HostCallable(...))` wrapper. The
9
+ // plumbing:
10
+ //
11
+ // 1. The TS bridge catches the JS error inside `sendHostCallableError`
12
+ // (proto.ts) and calls `registerHostOpaque(err)` here.
13
+ // 2. `registerHostOpaque` mints a globally-unique key via
14
+ // `native.mintHostValueKey` (drawing from the shared callable+opaque
15
+ // counter on the Rust side so the engine sees one keyspace), stores
16
+ // the JS value in the local `Map<bigint, unknown>`, returns the key.
17
+ // 3. The bridge emits an `InboundValue.Class(name="baml.errors.HostCallable",
18
+ // fields=[..., _handle: Handle(HOST_VALUE_OPAQUE, key)])`. The engine
19
+ // interns an `Arc<HostValueArc>` per the same key.
20
+ // 4. When BAML propagates the throw back out to the host, the outbound
21
+ // encoder re-emits the `_handle: Handle(HOST_VALUE_OPAQUE, key)`. The
22
+ // TS decoder (proto.ts) inspects a decoded `HostCallable` instance,
23
+ // reads `_handle.key`, calls `lookupHostValue(key)` here, and re-throws
24
+ // the original JS error.
25
+ // 5. When the engine drops its last `Arc<HostValueArc>(key)`, the Rust
26
+ // `host_release_callback` fires the TS-installed release callback
27
+ // (`native.registerHostValueReleaseCallback`), which calls `_releaseHostValue`
28
+ // here to remove the map entry.
29
+ //
30
+ // Foreign runtimes (a different Node process, the Python bridge, etc.) see
31
+ // a `_handle` whose key doesn't resolve in their local registry; the
32
+ // decoder falls back to the metadata-bearing `BamlError(HostCallable(...))`
33
+ // wrapper. The reserved `0` is used as a sentinel by code paths that
34
+ // cannot register a real JS value (engine-internal synthetic faults like
35
+ // "no JS callable for this key"); `_releaseHostValue(0n)` is a benign
36
+ // no-op since `mintHostValueKey` never returns `0`.
37
+ import { mintHostValueKey, registerHostValueReleaseCallback, BamlHandle } from '../native.js';
38
+ import { baml_bridge } from './proto/baml_cffi.js';
39
+ const BamlHandleType = baml_bridge.cffi.v1.BamlHandleType;
40
+ const hostValueMap = new Map();
41
+ /**
42
+ * Convert a `HandleKey` (`{ low, high }`) to a `bigint` for use as a `Map` key.
43
+ * Native `HandleKey` instances split a `u64` across two `i32` low/high halves
44
+ * (signed, two's-complement). Recompose by treating each half as a 32-bit
45
+ * unsigned value via `>>> 0`, then shift+or as `bigint`.
46
+ *
47
+ * The `>>> 0` coercion matters whenever either half's MSB is set: without it,
48
+ * a negative `i32` would widen to a negative `bigint` and corrupt the
49
+ * recomposed `u64`. Examples:
50
+ *
51
+ * - `{ low: 1, high: 0 }` → `0x1n` (small key, no MSB set)
52
+ * - `{ low: -1, high: -1 }` → `0xFFFFFFFFFFFFFFFFn` (u64::MAX; both halves'
53
+ * MSB set — `>>> 0` reinterprets `-1` as `0xFFFFFFFF` before widening)
54
+ * - `{ low: 0, high: 1 }` → `0x1_00000000n` (2^32)
55
+ */
56
+ function handleKeyToBigint(key) {
57
+ const low = BigInt(key.low >>> 0);
58
+ const high = BigInt(key.high >>> 0);
59
+ return (high << 32n) | low;
60
+ }
61
+ /**
62
+ * Register an arbitrary host JS value and return its native `HandleKey` for
63
+ * the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a
64
+ * `baml.errors.HostCallable` Instance (or any future opaque-value carrier).
65
+ * Mints a fresh key via the Rust side's shared counter (guaranteed non-zero —
66
+ * Rust `next_key` skips `0`); stores the value keyed by the same key
67
+ * (recomposed as a `bigint` for `Map`-key equality).
68
+ *
69
+ * Returns the native `HandleKey` directly so it can flow into the
70
+ * protobufjs encoder without an intermediate `bigint→Long` conversion
71
+ * (protobufjs reads `uint64` fields from a `{low, high}` shape, which
72
+ * the native `HandleKey` already provides; a bare `bigint` does not
73
+ * encode correctly through the `IInboundValue.handle.key` field).
74
+ */
75
+ export function registerHostOpaque(value) {
76
+ const key = mintHostValueKey();
77
+ hostValueMap.set(handleKeyToBigint(key), value);
78
+ return key;
79
+ }
80
+ /**
81
+ * Look up a host-registered JS value by key. Returns `undefined` when:
82
+ * - the key is the reserved sentinel `0n` (no real value was registered);
83
+ * - the engine has already released the entry (last `HostValueArc` clone
84
+ * dropped → Rust `host_release_callback` fired → `_releaseHostValue`
85
+ * removed the entry);
86
+ * - the key was minted by a different Node process (cross-runtime handle).
87
+ *
88
+ * Callers should fall back to a metadata-built exception in those cases.
89
+ *
90
+ * GC/decode race: a release notification and a rehydrating decode can be
91
+ * scheduled on the libuv loop concurrently in principle, but in practice
92
+ * the same `HostValueArc` cannot drop *while* the engine is actively
93
+ * emitting an outbound proto referencing its key — the outbound encode
94
+ * holds a strong handle through proto serialization, and the release tsfn
95
+ * isn't fired until that strong handle drops. By the time the TS decoder
96
+ * runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if
97
+ * a *prior* outbound completed and the engine has since dropped its last
98
+ * Arc; in that case the user has already observed the original throw at
99
+ * least once, so a second lookup-miss → metadata-fallback is acceptable.
100
+ */
101
+ export function lookupHostValue(key) {
102
+ return hostValueMap.get(key);
103
+ }
104
+ /**
105
+ * Convenience for the outbound decoder: if `handle` is a `BamlHandle`
106
+ * tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in
107
+ * the registry and return it. Returns `undefined` for any other handle
108
+ * type, a non-`BamlHandle` argument, or a key that doesn't resolve.
109
+ *
110
+ * Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
111
+ * exception when a BAML-thrown `baml.errors.HostCallable` propagates back
112
+ * to the same Node process that originated it.
113
+ */
114
+ export function tryRehydrateHostValueByKey(handle) {
115
+ if (!(handle instanceof BamlHandle))
116
+ return undefined;
117
+ if (handle.handleType !== BamlHandleType.HOST_VALUE_OPAQUE)
118
+ return undefined;
119
+ return lookupHostValue(handleKeyToBigint(handle.key));
120
+ }
121
+ /**
122
+ * Internal: remove the map entry for `key`. Wired at module init as the
123
+ * Rust-side release callback. Idempotent and absent-key-safe so the same
124
+ * callback can be invoked for *every* `HostValueArc` release (including
125
+ * callable keys, which never have a TS-side host-value entry).
126
+ */
127
+ function _releaseHostValue(key) {
128
+ hostValueMap.delete(handleKeyToBigint(key));
129
+ }
130
+ // Install the Rust-side release callback exactly once at module load. The
131
+ // napi function is itself first-call-wins on the Rust side, so reloads
132
+ // (e.g. test harnesses) are harmless.
133
+ registerHostValueReleaseCallback(_releaseHostValue);
134
+ //# sourceMappingURL=host_value_registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host_value_registry.js","sourceRoot":"","sources":["../../typescript_src/shared/host_value_registry.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8BAA8B;AAC9B,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,YAAY;AACZ,EAAE;AACF,yEAAyE;AACzE,4DAA4D;AAC5D,4DAA4D;AAC5D,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,gFAAgF;AAChF,2EAA2E;AAC3E,wDAAwD;AACxD,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,6EAA6E;AAC7E,8BAA8B;AAC9B,yEAAyE;AACzE,uEAAuE;AACvE,oFAAoF;AACpF,qCAAqC;AACrC,EAAE;AACF,2EAA2E;AAC3E,qEAAqE;AACrE,4EAA4E;AAC5E,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,oDAAoD;AAEpD,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,c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