@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,174 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * The `ReadableStreamType` enum.
5
+ *
6
+ * *This API requires the following crate features to be activated: `ReadableStreamType`*
7
+ */
8
+
9
+ export type ReadableStreamType = "bytes";
10
+
11
+ export class IntoUnderlyingByteSource {
12
+ private constructor();
13
+ free(): void;
14
+ [Symbol.dispose](): void;
15
+ cancel(): void;
16
+ pull(controller: ReadableByteStreamController): Promise<any>;
17
+ start(controller: ReadableByteStreamController): void;
18
+ readonly autoAllocateChunkSize: number;
19
+ readonly type: ReadableStreamType;
20
+ }
21
+
22
+ export class IntoUnderlyingSink {
23
+ private constructor();
24
+ free(): void;
25
+ [Symbol.dispose](): void;
26
+ abort(reason: any): Promise<any>;
27
+ close(): Promise<any>;
28
+ write(chunk: any): Promise<any>;
29
+ }
30
+
31
+ export class IntoUnderlyingSource {
32
+ private constructor();
33
+ free(): void;
34
+ [Symbol.dispose](): void;
35
+ cancel(): void;
36
+ pull(controller: ReadableStreamDefaultController): Promise<any>;
37
+ }
38
+
39
+ export function callFunction(function_name: string, encoded_args: Uint8Array): Promise<Uint8Array>;
40
+
41
+ export function callFunctionSync(function_name: string, encoded_args: Uint8Array): Uint8Array;
42
+
43
+ export function cancelFunctionCall(call_id: bigint): boolean;
44
+
45
+ /**
46
+ * Complete an in-flight host call from JS.
47
+ *
48
+ * Exposed to JS as `completeHostCall(callId, isError, content)`.
49
+ *
50
+ * On success (`is_error == 0`), `content` is a protobuf-encoded `InboundValue`
51
+ * (host→engine direction, no type metadata — engine re-validates against the
52
+ * declared return type).
53
+ *
54
+ * On error (`is_error != 0`), `content` is a protobuf-encoded `InboundValue`
55
+ * representing the thrown value. The host bridge SDK wraps native exceptions
56
+ * in a synthetic `Instance` of class `baml.errors.HostCallable` carrying
57
+ * `message` / `class_name` / `language` / `traceback` fields; codegenned
58
+ * BAML errors flow through as their own `Instance` shape. The engine's
59
+ * `materialize_host_throw` runs the declared-throws contract check on the
60
+ * decoded value and either re-injects it as a catchable throw or escalates
61
+ * to a `HostContractViolation` panic.
62
+ *
63
+ * `call_id` is globally unique, so it resolves the originating runtime's
64
+ * pending call unambiguously. If `call_id` is unknown the call is silently
65
+ * dropped (likely a stale completion racing with a cancellation).
66
+ */
67
+ export function completeHostCall(call_id: number, is_error: number, content: Uint8Array): void;
68
+
69
+ export function completeWebHostCall(call_id: number, is_error: number, content: Uint8Array): void;
70
+
71
+ /**
72
+ * Mint a key for a JS-owned opaque value from the same keyspace used by
73
+ * callable host values. Both kinds share one engine handle table.
74
+ */
75
+ export function mintHostValueKey(): bigint;
76
+
77
+ export function mintWebHostValueKey(): bigint;
78
+
79
+ export function newFunctionCall(): bigint;
80
+
81
+ /**
82
+ * Register a JS callable in the WASM host-value table and return its key.
83
+ *
84
+ * Exposed to JS as `registerHostCallable(fn) -> bigint`. The key is then
85
+ * embedded in `InboundValue::Handle { key, handleType: HOST_VALUE_CALLABLE }`
86
+ * by the JS encoder. The returned value is a `BigInt` because `u64` does not
87
+ * fit into JS's safe-integer range.
88
+ */
89
+ export function registerHostCallable(callable: Function): bigint;
90
+
91
+ /**
92
+ * Register the JS callback that releases opaque values from the SDK's local
93
+ * registry when the engine drops its last corresponding `HostValueArc`.
94
+ */
95
+ export function registerHostValueReleaseCallback(callback: Function): void;
96
+
97
+ export function registerWebHostCallable(callable: Function): bigint;
98
+
99
+ export function registerWebHostValueReleaseCallback(callback: Function): void;
100
+
101
+ /**
102
+ * Remove a callable that was registered but never transferred to the engine.
103
+ */
104
+ export function releaseHostCallable(key: bigint): void;
105
+
106
+ export function releaseWebHostCallable(key: bigint): void;
107
+
108
+ export function stageRuntimeBytecode(bytecode: Uint8Array, callbacks: any): void;
109
+
110
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
111
+
112
+ export interface InitOutput {
113
+ readonly memory: WebAssembly.Memory;
114
+ readonly callFunction: (a: number, b: number, c: number, d: number) => number;
115
+ readonly callFunctionSync: (a: number, b: number, c: number, d: number, e: number) => void;
116
+ readonly cancelFunctionCall: (a: bigint) => number;
117
+ readonly completeWebHostCall: (a: number, b: number, c: number, d: number) => void;
118
+ readonly mintWebHostValueKey: () => bigint;
119
+ readonly newFunctionCall: () => bigint;
120
+ readonly registerWebHostCallable: (a: number) => bigint;
121
+ readonly registerWebHostValueReleaseCallback: (a: number) => void;
122
+ readonly releaseWebHostCallable: (a: bigint) => void;
123
+ readonly stageRuntimeBytecode: (a: number, b: number, c: number, d: number) => void;
124
+ readonly completeHostCall: (a: number, b: number, c: number, d: number) => void;
125
+ readonly registerHostCallable: (a: number) => bigint;
126
+ readonly registerHostValueReleaseCallback: (a: number) => void;
127
+ readonly releaseHostCallable: (a: bigint) => void;
128
+ readonly mintHostValueKey: () => bigint;
129
+ readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
130
+ readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
131
+ readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
132
+ readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
133
+ readonly intounderlyingbytesource_cancel: (a: number) => void;
134
+ readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
135
+ readonly intounderlyingbytesource_start: (a: number, b: number) => void;
136
+ readonly intounderlyingbytesource_type: (a: number) => number;
137
+ readonly intounderlyingsink_abort: (a: number, b: number) => number;
138
+ readonly intounderlyingsink_close: (a: number) => number;
139
+ readonly intounderlyingsink_write: (a: number, b: number) => number;
140
+ readonly intounderlyingsource_cancel: (a: number) => void;
141
+ readonly intounderlyingsource_pull: (a: number, b: number) => number;
142
+ readonly __wasm_bindgen_func_elem_37361: (a: number, b: number, c: number, d: number) => void;
143
+ readonly __wasm_bindgen_func_elem_37369: (a: number, b: number, c: number, d: number) => void;
144
+ readonly __wasm_bindgen_func_elem_1351: (a: number, b: number, c: number) => void;
145
+ readonly __wasm_bindgen_func_elem_1130: (a: number, b: number) => void;
146
+ readonly __wbindgen_export: (a: number) => void;
147
+ readonly __wbindgen_export2: (a: number, b: number) => number;
148
+ readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
149
+ readonly __wbindgen_export4: (a: number, b: number) => void;
150
+ readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
151
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
152
+ }
153
+
154
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
155
+
156
+ /**
157
+ * Instantiates the given `module`, which can either be bytes or
158
+ * a precompiled `WebAssembly.Module`.
159
+ *
160
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
161
+ *
162
+ * @returns {InitOutput}
163
+ */
164
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
165
+
166
+ /**
167
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
168
+ * for everything else, calls `WebAssembly.instantiate` directly.
169
+ *
170
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
171
+ *
172
+ * @returns {Promise<InitOutput>}
173
+ */
174
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;