@boundaryml/baml-bridge 0.0.0 → 0.13.1-nightly.20260707.f

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 (46) hide show
  1. package/dist/ctx_manager.d.ts +22 -0
  2. package/dist/ctx_manager.d.ts.map +1 -0
  3. package/dist/ctx_manager.js +91 -0
  4. package/dist/ctx_manager.js.map +1 -0
  5. package/dist/define_function.d.ts +38 -0
  6. package/dist/define_function.d.ts.map +1 -0
  7. package/dist/define_function.js +281 -0
  8. package/dist/define_function.js.map +1 -0
  9. package/dist/errors.d.ts +51 -0
  10. package/dist/errors.d.ts.map +1 -0
  11. package/dist/errors.js +67 -0
  12. package/dist/errors.js.map +1 -0
  13. package/dist/exit_hook.d.ts +9 -0
  14. package/dist/exit_hook.d.ts.map +1 -0
  15. package/dist/exit_hook.js +27 -0
  16. package/dist/exit_hook.js.map +1 -0
  17. package/dist/host_value_registry.d.ts +57 -0
  18. package/dist/host_value_registry.d.ts.map +1 -0
  19. package/dist/host_value_registry.js +141 -0
  20. package/dist/host_value_registry.js.map +1 -0
  21. package/dist/index.d.ts +67 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +162 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/native.d.ts +312 -0
  26. package/dist/native.js +625 -0
  27. package/dist/proto/baml_cffi.d.ts +6385 -0
  28. package/dist/proto/baml_cffi.js +17738 -0
  29. package/dist/proto.d.ts +62 -0
  30. package/dist/proto.d.ts.map +1 -0
  31. package/dist/proto.js +963 -0
  32. package/dist/proto.js.map +1 -0
  33. package/dist/stream.d.ts +23 -0
  34. package/dist/stream.d.ts.map +1 -0
  35. package/dist/stream.js +68 -0
  36. package/dist/stream.js.map +1 -0
  37. package/dist/typemap.d.ts +37 -0
  38. package/dist/typemap.d.ts.map +1 -0
  39. package/dist/typemap.js +110 -0
  40. package/dist/typemap.js.map +1 -0
  41. package/dist/wire_ty.d.ts +58 -0
  42. package/dist/wire_ty.d.ts.map +1 -0
  43. package/dist/wire_ty.js +147 -0
  44. package/dist/wire_ty.js.map +1 -0
  45. package/package.json +64 -5
  46. package/README.md +0 -3
@@ -0,0 +1,62 @@
1
+ /**
2
+ * THIS FILE IS AUTO-GENERATED — DO NOT EDIT BY HAND.
3
+ *
4
+ * Source: baml_language/crates/bridge_nodejs/typescript_src/
5
+ * Proto: baml_language/crates/bridge_ctypes/types/baml_bridge/cffi/v1/*.proto
6
+ * Build: cd baml_language/crates/bridge_nodejs && pnpm build:debug
7
+ */
8
+ import { baml_bridge } from './proto/baml_cffi.js';
9
+ /**
10
+ * Error thrown when a host callable (a JS `function`) is passed to the
11
+ * *synchronous* call path. See {@link encodeCallArgs} for why this can't work.
12
+ */
13
+ export declare class HostCallableSyncError extends Error {
14
+ constructor(message: string);
15
+ }
16
+ export interface EncodeCallArgsOptions {
17
+ callId: bigint;
18
+ syncMode?: boolean;
19
+ /**
20
+ * Call-level TypeVar bindings for a generic function/method, as
21
+ * `[typeVarName, wireTy]` pairs in De Bruijn order (enclosing class params
22
+ * first, then the callee's own `<...>` params). Encoded into
23
+ * `CallFunctionArgs.type_args`. Mirrors Python's `encode_call_args`
24
+ * `type_args` argument. Omitted/empty for non-generic calls.
25
+ */
26
+ typeArgs?: Array<[string, baml_bridge.cffi.v1.IBamlTy]>;
27
+ }
28
+ /**
29
+ * Encode kwargs into `CallFunctionArgs` bytes.
30
+ *
31
+ * `syncMode` (default false) selects the sync guard: a host callable in the
32
+ * kwargs of a *synchronous* call rejects with {@link HostCallableSyncError}
33
+ * before any work, rather than registering a tsfn and then hanging.
34
+ *
35
+ * Release tradeoff: a callable that encodes successfully is registered in the
36
+ * host-value table and is normally released only when the engine GCs the
37
+ * `HostClosure` it allocated and fires the C release callback (a GC-timed
38
+ * release, drained by the engine after collection).
39
+ * Because the Node tsfn is built with `weak::<false>` it keeps a strong libuv
40
+ * ref, so a *leaked* registry entry can also keep the Node process from
41
+ * exiting — which is exactly why the encode-error rollback below matters: if a
42
+ * later kwarg fails, the engine never sees (and so never releases) the keys we
43
+ * already registered, so we release them here.
44
+ */
45
+ export declare function encodeCallArgs(kwargs: Record<string, unknown>, options: EncodeCallArgsOptions): Buffer;
46
+ /**
47
+ * Decode a bare `BamlOutboundValue` to a JS value. Used for the host-callable
48
+ * args path, where the engine sends a list-shaped `BamlOutboundValue` rather
49
+ * than the call-result `BamlOutboundResult` envelope.
50
+ */
51
+ export declare function decodeOutboundValue(data: Buffer | Uint8Array): unknown;
52
+ /**
53
+ * Decode a `BamlOutboundResult` envelope (the engine's call-result wire shape
54
+ * after 31c/31e). The `ok` arm returns the decoded value; the `error`/`panic`
55
+ * arms **throw** a `BamlError`/`BamlPanic` carrying the fully decoded thrown
56
+ * value (`.value`), the BAML trace (`.bamlTrace`), and the class FQN
57
+ * (`.className`), with a readable formatted `.message`. An `is_exit_panic`
58
+ * (clean `baml.sys.exit`) terminates the process via `process.exit(code)`
59
+ * rather than throwing.
60
+ */
61
+ export declare function decodeCallResult(data: Buffer | Uint8Array): unknown;
62
+ //# sourceMappingURL=proto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proto.d.ts","sourceRoot":"","sources":["../typescript_src/proto.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAiCnD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI9B;AAmBD,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3D;AA+LD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAuCtG;AAgOD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAGtE;AA4GD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAuDnE"}