@boundaryml/baml-bridge 0.0.0 → 0.13.1-nightly.20260707.e
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/ctx_manager.d.ts +22 -0
- package/dist/ctx_manager.d.ts.map +1 -0
- package/dist/ctx_manager.js +91 -0
- package/dist/ctx_manager.js.map +1 -0
- package/dist/define_function.d.ts +38 -0
- package/dist/define_function.d.ts.map +1 -0
- package/dist/define_function.js +281 -0
- package/dist/define_function.js.map +1 -0
- package/dist/errors.d.ts +51 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +67 -0
- package/dist/errors.js.map +1 -0
- package/dist/exit_hook.d.ts +9 -0
- package/dist/exit_hook.d.ts.map +1 -0
- package/dist/exit_hook.js +27 -0
- package/dist/exit_hook.js.map +1 -0
- package/dist/host_value_registry.d.ts +57 -0
- package/dist/host_value_registry.d.ts.map +1 -0
- package/dist/host_value_registry.js +141 -0
- package/dist/host_value_registry.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +162 -0
- package/dist/index.js.map +1 -0
- package/dist/native.d.ts +312 -0
- package/dist/native.js +625 -0
- package/dist/proto/baml_cffi.d.ts +6385 -0
- package/dist/proto/baml_cffi.js +17738 -0
- package/dist/proto.d.ts +62 -0
- package/dist/proto.d.ts.map +1 -0
- package/dist/proto.js +963 -0
- package/dist/proto.js.map +1 -0
- package/dist/stream.d.ts +23 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +68 -0
- package/dist/stream.js.map +1 -0
- package/dist/typemap.d.ts +37 -0
- package/dist/typemap.d.ts.map +1 -0
- package/dist/typemap.js +110 -0
- package/dist/typemap.js.map +1 -0
- package/dist/wire_ty.d.ts +58 -0
- package/dist/wire_ty.d.ts.map +1 -0
- package/dist/wire_ty.js +147 -0
- package/dist/wire_ty.js.map +1 -0
- package/package.json +64 -5
- package/README.md +0 -3
|
@@ -0,0 +1,57 @@
|
|
|
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 { type HandleKey } from './native.js';
|
|
9
|
+
/**
|
|
10
|
+
* Register an arbitrary host JS value and return its native `HandleKey` for
|
|
11
|
+
* the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a
|
|
12
|
+
* `baml.errors.HostCallable` Instance (or any future opaque-value carrier).
|
|
13
|
+
* Mints a fresh key via the Rust side's shared counter (guaranteed non-zero —
|
|
14
|
+
* Rust `next_key` skips `0`); stores the value keyed by the same key
|
|
15
|
+
* (recomposed as a `bigint` for `Map`-key equality).
|
|
16
|
+
*
|
|
17
|
+
* Returns the native `HandleKey` directly so it can flow into the
|
|
18
|
+
* protobufjs encoder without an intermediate `bigint→Long` conversion
|
|
19
|
+
* (protobufjs reads `uint64` fields from a `{low, high}` shape, which
|
|
20
|
+
* the native `HandleKey` already provides; a bare `bigint` does not
|
|
21
|
+
* encode correctly through the `IInboundValue.handle.key` field).
|
|
22
|
+
*/
|
|
23
|
+
export declare function registerHostOpaque(value: unknown): HandleKey;
|
|
24
|
+
/**
|
|
25
|
+
* Look up a host-registered JS value by key. Returns `undefined` when:
|
|
26
|
+
* - the key is the reserved sentinel `0n` (no real value was registered);
|
|
27
|
+
* - the engine has already released the entry (last `HostValueArc` clone
|
|
28
|
+
* dropped → Rust `host_release_callback` fired → `_releaseHostValue`
|
|
29
|
+
* removed the entry);
|
|
30
|
+
* - the key was minted by a different Node process (cross-runtime handle).
|
|
31
|
+
*
|
|
32
|
+
* Callers should fall back to a metadata-built exception in those cases.
|
|
33
|
+
*
|
|
34
|
+
* GC/decode race: a release notification and a rehydrating decode can be
|
|
35
|
+
* scheduled on the libuv loop concurrently in principle, but in practice
|
|
36
|
+
* the same `HostValueArc` cannot drop *while* the engine is actively
|
|
37
|
+
* emitting an outbound proto referencing its key — the outbound encode
|
|
38
|
+
* holds a strong handle through proto serialization, and the release tsfn
|
|
39
|
+
* isn't fired until that strong handle drops. By the time the TS decoder
|
|
40
|
+
* runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if
|
|
41
|
+
* a *prior* outbound completed and the engine has since dropped its last
|
|
42
|
+
* Arc; in that case the user has already observed the original throw at
|
|
43
|
+
* least once, so a second lookup-miss → metadata-fallback is acceptable.
|
|
44
|
+
*/
|
|
45
|
+
export declare function lookupHostValue(key: bigint): unknown;
|
|
46
|
+
/**
|
|
47
|
+
* Convenience for the outbound decoder: if `handle` is a `BamlHandle`
|
|
48
|
+
* tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in
|
|
49
|
+
* the registry and return it. Returns `undefined` for any other handle
|
|
50
|
+
* type, a non-`BamlHandle` argument, or a key that doesn't resolve.
|
|
51
|
+
*
|
|
52
|
+
* Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
|
|
53
|
+
* exception when a BAML-thrown `baml.errors.HostCallable` propagates back
|
|
54
|
+
* to the same Node process that originated it.
|
|
55
|
+
*/
|
|
56
|
+
export declare function tryRehydrateHostValueByKey(handle: unknown): unknown;
|
|
57
|
+
//# sourceMappingURL=host_value_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host_value_registry.d.ts","sourceRoot":"","sources":["../typescript_src/host_value_registry.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAkE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AA4B7G;;;;;;;;;;;;;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,141 @@
|
|
|
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
|
+
// host_value_registry.ts — mirrors bridge_python's `register_host_opaque`
|
|
9
|
+
// + `lookup_host_value` pair.
|
|
10
|
+
//
|
|
11
|
+
// An arbitrary host JS value round-trips back to the *same* Node process as
|
|
12
|
+
// the *same* object (identity preserved), not flattened into a metadata-only
|
|
13
|
+
// wrapper. A native JS exception raised inside a user callable is the primary
|
|
14
|
+
// consumer: it round-trips as the *same* `Error` object (`raised === caught`
|
|
15
|
+
// identity), not a metadata-only `BamlError(HostCallable(...))` wrapper. The
|
|
16
|
+
// plumbing:
|
|
17
|
+
//
|
|
18
|
+
// 1. The TS bridge catches the JS error inside `sendHostCallableError`
|
|
19
|
+
// (proto.ts) and calls `registerHostOpaque(err)` here.
|
|
20
|
+
// 2. `registerHostOpaque` mints a globally-unique key via
|
|
21
|
+
// `native.mintHostValueKey` (drawing from the shared callable+opaque
|
|
22
|
+
// counter on the Rust side so the engine sees one keyspace), stores
|
|
23
|
+
// the JS value in the local `Map<bigint, unknown>`, returns the key.
|
|
24
|
+
// 3. The bridge emits an `InboundValue.Class(name="baml.errors.HostCallable",
|
|
25
|
+
// fields=[..., _handle: Handle(HOST_VALUE_OPAQUE, key)])`. The engine
|
|
26
|
+
// interns an `Arc<HostValueArc>` per the same key.
|
|
27
|
+
// 4. When BAML propagates the throw back out to the host, the outbound
|
|
28
|
+
// encoder re-emits the `_handle: Handle(HOST_VALUE_OPAQUE, key)`. The
|
|
29
|
+
// TS decoder (proto.ts) inspects a decoded `HostCallable` instance,
|
|
30
|
+
// reads `_handle.key`, calls `lookupHostValue(key)` here, and re-throws
|
|
31
|
+
// the original JS error.
|
|
32
|
+
// 5. When the engine drops its last `Arc<HostValueArc>(key)`, the Rust
|
|
33
|
+
// `host_release_callback` fires the TS-installed release callback
|
|
34
|
+
// (`native.registerHostValueReleaseCallback`), which calls `_releaseHostValue`
|
|
35
|
+
// here to remove the map entry.
|
|
36
|
+
//
|
|
37
|
+
// Foreign runtimes (a different Node process, the Python bridge, etc.) see
|
|
38
|
+
// a `_handle` whose key doesn't resolve in their local registry; the
|
|
39
|
+
// decoder falls back to the metadata-bearing `BamlError(HostCallable(...))`
|
|
40
|
+
// wrapper. The reserved `0` is used as a sentinel by code paths that
|
|
41
|
+
// cannot register a real JS value (engine-internal synthetic faults like
|
|
42
|
+
// "no JS callable for this key"); `_releaseHostValue(0n)` is a benign
|
|
43
|
+
// no-op since `mintHostValueKey` never returns `0`.
|
|
44
|
+
import { mintHostValueKey, registerHostValueReleaseCallback, BamlHandle } from './native.js';
|
|
45
|
+
import { baml_bridge } from './proto/baml_cffi.js';
|
|
46
|
+
const BamlHandleType = baml_bridge.cffi.v1.BamlHandleType;
|
|
47
|
+
const hostValueMap = new Map();
|
|
48
|
+
/**
|
|
49
|
+
* Convert a `HandleKey` (`{ low, high }`) to a `bigint` for use as a `Map` key.
|
|
50
|
+
* Native `HandleKey` instances split a `u64` across two `i32` low/high halves
|
|
51
|
+
* (signed, two's-complement). Recompose by treating each half as a 32-bit
|
|
52
|
+
* unsigned value via `>>> 0`, then shift+or as `bigint`.
|
|
53
|
+
*
|
|
54
|
+
* The `>>> 0` coercion matters whenever either half's MSB is set: without it,
|
|
55
|
+
* a negative `i32` would widen to a negative `bigint` and corrupt the
|
|
56
|
+
* recomposed `u64`. Examples:
|
|
57
|
+
*
|
|
58
|
+
* - `{ low: 1, high: 0 }` → `0x1n` (small key, no MSB set)
|
|
59
|
+
* - `{ low: -1, high: -1 }` → `0xFFFFFFFFFFFFFFFFn` (u64::MAX; both halves'
|
|
60
|
+
* MSB set — `>>> 0` reinterprets `-1` as `0xFFFFFFFF` before widening)
|
|
61
|
+
* - `{ low: 0, high: 1 }` → `0x1_00000000n` (2^32)
|
|
62
|
+
*/
|
|
63
|
+
function handleKeyToBigint(key) {
|
|
64
|
+
const low = BigInt(key.low >>> 0);
|
|
65
|
+
const high = BigInt(key.high >>> 0);
|
|
66
|
+
return (high << 32n) | low;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Register an arbitrary host JS value and return its native `HandleKey` for
|
|
70
|
+
* the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a
|
|
71
|
+
* `baml.errors.HostCallable` Instance (or any future opaque-value carrier).
|
|
72
|
+
* Mints a fresh key via the Rust side's shared counter (guaranteed non-zero —
|
|
73
|
+
* Rust `next_key` skips `0`); stores the value keyed by the same key
|
|
74
|
+
* (recomposed as a `bigint` for `Map`-key equality).
|
|
75
|
+
*
|
|
76
|
+
* Returns the native `HandleKey` directly so it can flow into the
|
|
77
|
+
* protobufjs encoder without an intermediate `bigint→Long` conversion
|
|
78
|
+
* (protobufjs reads `uint64` fields from a `{low, high}` shape, which
|
|
79
|
+
* the native `HandleKey` already provides; a bare `bigint` does not
|
|
80
|
+
* encode correctly through the `IInboundValue.handle.key` field).
|
|
81
|
+
*/
|
|
82
|
+
export function registerHostOpaque(value) {
|
|
83
|
+
const key = mintHostValueKey();
|
|
84
|
+
hostValueMap.set(handleKeyToBigint(key), value);
|
|
85
|
+
return key;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Look up a host-registered JS value by key. Returns `undefined` when:
|
|
89
|
+
* - the key is the reserved sentinel `0n` (no real value was registered);
|
|
90
|
+
* - the engine has already released the entry (last `HostValueArc` clone
|
|
91
|
+
* dropped → Rust `host_release_callback` fired → `_releaseHostValue`
|
|
92
|
+
* removed the entry);
|
|
93
|
+
* - the key was minted by a different Node process (cross-runtime handle).
|
|
94
|
+
*
|
|
95
|
+
* Callers should fall back to a metadata-built exception in those cases.
|
|
96
|
+
*
|
|
97
|
+
* GC/decode race: a release notification and a rehydrating decode can be
|
|
98
|
+
* scheduled on the libuv loop concurrently in principle, but in practice
|
|
99
|
+
* the same `HostValueArc` cannot drop *while* the engine is actively
|
|
100
|
+
* emitting an outbound proto referencing its key — the outbound encode
|
|
101
|
+
* holds a strong handle through proto serialization, and the release tsfn
|
|
102
|
+
* isn't fired until that strong handle drops. By the time the TS decoder
|
|
103
|
+
* runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if
|
|
104
|
+
* a *prior* outbound completed and the engine has since dropped its last
|
|
105
|
+
* Arc; in that case the user has already observed the original throw at
|
|
106
|
+
* least once, so a second lookup-miss → metadata-fallback is acceptable.
|
|
107
|
+
*/
|
|
108
|
+
export function lookupHostValue(key) {
|
|
109
|
+
return hostValueMap.get(key);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Convenience for the outbound decoder: if `handle` is a `BamlHandle`
|
|
113
|
+
* tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in
|
|
114
|
+
* the registry and return it. Returns `undefined` for any other handle
|
|
115
|
+
* type, a non-`BamlHandle` argument, or a key that doesn't resolve.
|
|
116
|
+
*
|
|
117
|
+
* Used by `decodeCallResult`'s `error` arm to rehydrate the original JS
|
|
118
|
+
* exception when a BAML-thrown `baml.errors.HostCallable` propagates back
|
|
119
|
+
* to the same Node process that originated it.
|
|
120
|
+
*/
|
|
121
|
+
export function tryRehydrateHostValueByKey(handle) {
|
|
122
|
+
if (!(handle instanceof BamlHandle))
|
|
123
|
+
return undefined;
|
|
124
|
+
if (handle.handleType !== BamlHandleType.HOST_VALUE_OPAQUE)
|
|
125
|
+
return undefined;
|
|
126
|
+
return lookupHostValue(handleKeyToBigint(handle.key));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Internal: remove the map entry for `key`. Wired at module init as the
|
|
130
|
+
* Rust-side release callback. Idempotent and absent-key-safe so the same
|
|
131
|
+
* callback can be invoked for *every* `HostValueArc` release (including
|
|
132
|
+
* callable keys, which never have a TS-side host-value entry).
|
|
133
|
+
*/
|
|
134
|
+
function _releaseHostValue(key) {
|
|
135
|
+
hostValueMap.delete(handleKeyToBigint(key));
|
|
136
|
+
}
|
|
137
|
+
// Install the Rust-side release callback exactly once at module load. The
|
|
138
|
+
// napi function is itself first-call-wins on the Rust side, so reloads
|
|
139
|
+
// (e.g. test harnesses) are harmless.
|
|
140
|
+
registerHostValueReleaseCallback(_releaseHostValue);
|
|
141
|
+
//# sourceMappingURL=host_value_registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host_value_registry.js","sourceRoot":"","sources":["../typescript_src/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,aAAa,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAA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EAAuE;AACvE,sCAAsC;AACtC,gCAAgC,CAAC,iBAAiB,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
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 { BamlRuntime, BamlCallContext, HostSpanManager, Collector as NativeCollector, FunctionLog as NativeFunctionLog, Timing, Usage, LLMCall } from './native.js';
|
|
9
|
+
export { BamlRuntime, BamlCallContext, BamlHandle, HostSpanManager, getRuntime, getVersion, flushEvents, } from './native.js';
|
|
10
|
+
export { Timing, Usage, LLMCall } from './native.js';
|
|
11
|
+
export { _seedFunctionRefHandle, _seedGenericMediaHandle } from './native.js';
|
|
12
|
+
export { BamlImage, BamlAudio, BamlVideo, BamlPdf } from './native.js';
|
|
13
|
+
export { BamlStream } from './stream.js';
|
|
14
|
+
export { encodeCallArgs, decodeCallResult } from './proto.js';
|
|
15
|
+
export { CtxManager } from './ctx_manager.js';
|
|
16
|
+
export { BamlTypeMap, setTypeMap, getTypeMap } from './typemap.js';
|
|
17
|
+
export { defineFunction, defineInstanceFunction, UNSET } from './define_function.js';
|
|
18
|
+
export type { GenericParams } from './define_function.js';
|
|
19
|
+
export { Never, lowerTypeToWireTy } from './wire_ty.js';
|
|
20
|
+
export type { BamlType, BamlPrimitiveToken, BamlClassCtor } from './wire_ty.js';
|
|
21
|
+
/**
|
|
22
|
+
* Free-function runtime initializer used by generated `baml_sdk/index.ts`:
|
|
23
|
+
* `initializeRuntime("baml_src", _inlinedbaml.FILES)`. Thin wrapper over the
|
|
24
|
+
* `BamlRuntime.initializeRuntime` factory (which sets the process-global
|
|
25
|
+
* singleton reachable via `getRuntime()`).
|
|
26
|
+
*/
|
|
27
|
+
export declare function initializeRuntime(srcDir: string, files: Record<string, string>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Free-function runtime initializer used by generated `baml_sdk/index.ts` when
|
|
30
|
+
* codegen embeds precompiled BAML bytecode.
|
|
31
|
+
*/
|
|
32
|
+
export declare function initializeRuntimeFromBytecode(bytecode: Buffer | Uint8Array): void;
|
|
33
|
+
export { BamlError, BamlInvalidArgumentError, BamlClientError, BamlCancelledError, BamlPanic, wrapNativeError, } from './errors.js';
|
|
34
|
+
export declare function newFunctionCall(): bigint;
|
|
35
|
+
export declare function cancelFunctionCall(callId: bigint): boolean;
|
|
36
|
+
export declare class FunctionResult {
|
|
37
|
+
private _value;
|
|
38
|
+
constructor(value: unknown);
|
|
39
|
+
result(): unknown;
|
|
40
|
+
toString(): string;
|
|
41
|
+
}
|
|
42
|
+
export declare class FunctionLog {
|
|
43
|
+
private _inner;
|
|
44
|
+
constructor(inner: NativeFunctionLog);
|
|
45
|
+
get id(): string;
|
|
46
|
+
get functionName(): string;
|
|
47
|
+
get timing(): Timing;
|
|
48
|
+
get usage(): Usage;
|
|
49
|
+
get calls(): LLMCall[];
|
|
50
|
+
get tags(): Record<string, string>;
|
|
51
|
+
get result(): unknown;
|
|
52
|
+
}
|
|
53
|
+
export declare class Collector {
|
|
54
|
+
private _inner;
|
|
55
|
+
constructor(name?: string);
|
|
56
|
+
get name(): string;
|
|
57
|
+
get logs(): FunctionLog[];
|
|
58
|
+
get last(): FunctionLog | null;
|
|
59
|
+
get usage(): Usage;
|
|
60
|
+
clear(): number;
|
|
61
|
+
id(functionLogId: string): FunctionLog | null;
|
|
62
|
+
/** Internal: get native collector for passing to Rust */
|
|
63
|
+
_native(): NativeCollector;
|
|
64
|
+
}
|
|
65
|
+
export declare function callFunctionSync(rt: BamlRuntime, functionName: string, kwargs: Record<string, unknown>, ctx?: HostSpanManager, collectors?: Collector[], callCtx?: BamlCallContext): FunctionResult;
|
|
66
|
+
export declare function callFunction(rt: BamlRuntime, functionName: string, kwargs: Record<string, unknown>, ctx?: HostSpanManager, collectors?: Collector[], callCtx?: BamlCallContext): Promise<FunctionResult>;
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../typescript_src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,WAAW,EAEX,eAAe,EACf,eAAe,EACf,SAAS,IAAI,eAAe,EAC5B,WAAW,IAAI,iBAAiB,EAChC,MAAM,EACN,KAAK,EACL,OAAO,EAGV,MAAM,aAAa,CAAC;AAKrB,OAAO,EACH,WAAW,EACX,eAAe,EACf,UAAU,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,WAAW,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG9E,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACrF,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,QAAQ,EAAE,kBAAkB,E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AA8B;IAChD,KAAK,IAAI,MAAM;IACf,EAAE,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAI7C,yDAAyD;IACzD,OAAO,IAAI,eAAe;CAC7B;AAED,wBAAgB,gBAAgB,CAC5B,EAAE,EAAE,WAAW,EACf,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,CAAC,EAAE,eAAe,EACrB,UAAU,CAAC,EAAE,SAAS,EAAE,EACxB,OAAO,CAAC,EAAE,eAAe,GAC1B,cAAc,CAuBhB;AAED,wBAAsB,YAAY,CAC9B,EAAE,EAAE,WAAW,EACf,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,CAAC,EAAE,eAAe,EACrB,UAAU,CAAC,EAAE,SAAS,EAAE,EACxB,OAAO,CAAC,EAAE,eAAe,GAC1B,OAAO,CAAC,cAAc,CAAC,CAmBzB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
// index.ts — mirrors bridge_python/python_src/baml_py/__init__.py
|
|
9
|
+
import { BamlRuntime, Collector as NativeCollector, cancelFunctionCall as nativeCancelFunctionCall, newFunctionCall as nativeNewFunctionCall, } from './native.js';
|
|
10
|
+
import { encodeCallArgs, decodeCallResult } from './proto.js';
|
|
11
|
+
import { installFlushOnExit } from './exit_hook.js';
|
|
12
|
+
import { wrapNativeError } from './errors.js';
|
|
13
|
+
export { BamlRuntime, BamlCallContext, BamlHandle, HostSpanManager, getRuntime, getVersion, flushEvents, } from './native.js';
|
|
14
|
+
export { Timing, Usage } from './native.js';
|
|
15
|
+
export { _seedFunctionRefHandle, _seedGenericMediaHandle } from './native.js';
|
|
16
|
+
// Runtime-owned stdlib value classes. Exported under their `Baml*` names only;
|
|
17
|
+
// codegen aliases them as Image/Audio/Video/Pdf on re-export.
|
|
18
|
+
export { BamlImage, BamlAudio, BamlVideo, BamlPdf } from './native.js';
|
|
19
|
+
// Stream wrapper. Exported as `BamlStream`; codegen aliases it as `Stream`.
|
|
20
|
+
export { BamlStream } from './stream.js';
|
|
21
|
+
export { encodeCallArgs, decodeCallResult } from './proto.js';
|
|
22
|
+
export { CtxManager } from './ctx_manager.js';
|
|
23
|
+
// Codegen support: typemap + placeholder sentinel + free runtime initializer.
|
|
24
|
+
export { BamlTypeMap, setTypeMap, getTypeMap } from './typemap.js';
|
|
25
|
+
// Callable factories the generated SDK emits for every BAML function/method.
|
|
26
|
+
export { defineFunction, defineInstanceFunction, UNSET } from './define_function.js';
|
|
27
|
+
// Generic-type spelling for `$types` bindings on generic classes / calls.
|
|
28
|
+
export { Never, lowerTypeToWireTy } from './wire_ty.js';
|
|
29
|
+
/**
|
|
30
|
+
* Free-function runtime initializer used by generated `baml_sdk/index.ts`:
|
|
31
|
+
* `initializeRuntime("baml_src", _inlinedbaml.FILES)`. Thin wrapper over the
|
|
32
|
+
* `BamlRuntime.initializeRuntime` factory (which sets the process-global
|
|
33
|
+
* singleton reachable via `getRuntime()`).
|
|
34
|
+
*/
|
|
35
|
+
export function initializeRuntime(srcDir, files) {
|
|
36
|
+
BamlRuntime.initializeRuntime(srcDir, files);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Free-function runtime initializer used by generated `baml_sdk/index.ts` when
|
|
40
|
+
* codegen embeds precompiled BAML bytecode.
|
|
41
|
+
*/
|
|
42
|
+
export function initializeRuntimeFromBytecode(bytecode) {
|
|
43
|
+
BamlRuntime.initializeRuntimeFromBytecode(Buffer.from(bytecode));
|
|
44
|
+
}
|
|
45
|
+
export { BamlError, BamlInvalidArgumentError, BamlClientError, BamlCancelledError, BamlPanic, wrapNativeError, } from './errors.js';
|
|
46
|
+
export function newFunctionCall() {
|
|
47
|
+
return BigInt(nativeNewFunctionCall());
|
|
48
|
+
}
|
|
49
|
+
export function cancelFunctionCall(callId) {
|
|
50
|
+
return nativeCancelFunctionCall(callId.toString());
|
|
51
|
+
}
|
|
52
|
+
function attachCallContext(ctx, callId) {
|
|
53
|
+
ctx?._attachCallId(callId.toString());
|
|
54
|
+
return {
|
|
55
|
+
detach() {
|
|
56
|
+
ctx?._detachCallId(callId.toString());
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export class FunctionResult {
|
|
61
|
+
_value;
|
|
62
|
+
constructor(value) {
|
|
63
|
+
this._value = value;
|
|
64
|
+
}
|
|
65
|
+
result() {
|
|
66
|
+
return this._value;
|
|
67
|
+
}
|
|
68
|
+
toString() {
|
|
69
|
+
return `FunctionResult(${JSON.stringify(this._value)})`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class FunctionLog {
|
|
73
|
+
_inner;
|
|
74
|
+
constructor(inner) { this._inner = inner; }
|
|
75
|
+
get id() { return this._inner.id; }
|
|
76
|
+
get functionName() { return this._inner.functionName; }
|
|
77
|
+
get timing() { return this._inner.timing; }
|
|
78
|
+
get usage() { return this._inner.usage; }
|
|
79
|
+
get calls() { return this._inner.calls; }
|
|
80
|
+
get tags() { return this._inner.tags; }
|
|
81
|
+
// FIXME: Returns null for both "no serialized result" (bytes == null) and a legitimate
|
|
82
|
+
// BAML null result (decodeCallResult returns null). Legacy engine/ had no result getter
|
|
83
|
+
// on FunctionLog at all. bridge_python has the same ambiguity (None for both cases).
|
|
84
|
+
// Leaving as-is for parity with bridge_python; narrow edge case in practice.
|
|
85
|
+
get result() {
|
|
86
|
+
const bytes = this._inner.result;
|
|
87
|
+
if (bytes == null)
|
|
88
|
+
return null;
|
|
89
|
+
return decodeCallResult(bytes);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export class Collector {
|
|
93
|
+
_inner;
|
|
94
|
+
constructor(name) { this._inner = new NativeCollector(name ?? null); }
|
|
95
|
+
get name() { return this._inner.name; }
|
|
96
|
+
get logs() {
|
|
97
|
+
return this._inner.logs.map((l) => new FunctionLog(l));
|
|
98
|
+
}
|
|
99
|
+
get last() {
|
|
100
|
+
const l = this._inner.last;
|
|
101
|
+
return l ? new FunctionLog(l) : null;
|
|
102
|
+
}
|
|
103
|
+
get usage() { return this._inner.usage; }
|
|
104
|
+
clear() { return this._inner.clear(); }
|
|
105
|
+
id(functionLogId) {
|
|
106
|
+
const l = this._inner.id(functionLogId);
|
|
107
|
+
return l ? new FunctionLog(l) : null;
|
|
108
|
+
}
|
|
109
|
+
/** Internal: get native collector for passing to Rust */
|
|
110
|
+
_native() { return this._inner; }
|
|
111
|
+
}
|
|
112
|
+
export function callFunctionSync(rt, functionName, kwargs, ctx, collectors, callCtx) {
|
|
113
|
+
// Encode in sync mode so a host callable in the kwargs fast-fails
|
|
114
|
+
// with a clear error instead of registering a tsfn and then hanging —
|
|
115
|
+
// the sync path blocks the Node main thread on a tokio `block_on`,
|
|
116
|
+
// starving libuv so the dispatch could never run.
|
|
117
|
+
const callId = newFunctionCall();
|
|
118
|
+
const argsProto = encodeCallArgs(kwargs, { syncMode: true, callId });
|
|
119
|
+
const callCtxBinding = attachCallContext(callCtx, callId);
|
|
120
|
+
const nativeCollectors = collectors?.map(c => c._native()) ?? null;
|
|
121
|
+
// Only the napi call gets `wrapNativeError`'d — its `napi::Error`
|
|
122
|
+
// messages need parsing into typed `Baml*Error` subclasses. The
|
|
123
|
+
// decoder's throws (`BamlError`/`BamlPanic`, *or* a re-raised
|
|
124
|
+
// original JS exception from the host-callable rehydration path)
|
|
125
|
+
// already carry the right type and must propagate by identity.
|
|
126
|
+
let resultBytes;
|
|
127
|
+
try {
|
|
128
|
+
resultBytes = rt.callFunctionSync(functionName, argsProto, ctx ?? null, nativeCollectors);
|
|
129
|
+
}
|
|
130
|
+
catch (err) {
|
|
131
|
+
throw wrapNativeError(err);
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
callCtxBinding.detach();
|
|
135
|
+
}
|
|
136
|
+
return new FunctionResult(decodeCallResult(resultBytes));
|
|
137
|
+
}
|
|
138
|
+
export async function callFunction(rt, functionName, kwargs, ctx, collectors, callCtx) {
|
|
139
|
+
const callId = newFunctionCall();
|
|
140
|
+
const argsProto = encodeCallArgs(kwargs, { callId });
|
|
141
|
+
const callCtxBinding = attachCallContext(callCtx, callId);
|
|
142
|
+
const nativeCollectors = collectors?.map(c => c._native()) ?? null;
|
|
143
|
+
// Only the napi call gets `wrapNativeError`'d — its `napi::Error`
|
|
144
|
+
// messages need parsing into typed `Baml*Error` subclasses. The
|
|
145
|
+
// decoder's throws (`BamlError`/`BamlPanic`, *or* a re-raised
|
|
146
|
+
// original JS exception from the host-callable rehydration path)
|
|
147
|
+
// already carry the right type and must propagate by identity.
|
|
148
|
+
let resultBytes;
|
|
149
|
+
try {
|
|
150
|
+
resultBytes = await rt.callFunction(functionName, argsProto, ctx ?? null, nativeCollectors);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
throw wrapNativeError(err);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
callCtxBinding.detach();
|
|
157
|
+
}
|
|
158
|
+
return new FunctionResult(decodeCallResult(resultBytes));
|
|
159
|
+
}
|
|
160
|
+
// Register flush on process exit (single registration; see exit_hook.ts).
|
|
161
|
+
installFlushOnExit();
|
|
162
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../typescript_src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EACH,WAAW,EAIX,SAAS,IAAI,eAAe,EAK5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