diff --git a/baml_language/crates/bex_engine/tests/host_value_callable.rs b/baml_language/crates/bex_engine/tests/host_value_callable.rs index a21929d48a..29ad929c1c 100644 --- a/baml_language/crates/bex_engine/tests/host_value_callable.rs +++ b/baml_language/crates/bex_engine/tests/host_value_callable.rs @@ -290,12 +290,12 @@ fn complete_with_test_error(call_id: u32, class_name: &str, message: &str) { ); fields.insert("traceback".to_string(), BexExternalValue::Null); // The class's `_handle $rust_type` slot is required by the engine's - // structural check. Use a synthetic `HostValue(kind=Error)` handle + // structural check. Use a synthetic `HostValue(kind=Opaque)` handle // so the BAML→host decoder has *something* to round-trip — the // test doesn't rehydrate, so the key value is arbitrary. fields.insert( "_handle".to_string(), - BexExternalValue::HostValue(HostValueArc::new(next_host_key(), HostValueKind::Error)), + BexExternalValue::HostValue(HostValueArc::new(next_host_key(), HostValueKind::Opaque)), ); sys_native::host_dispatch::complete_with_throw( call_id, diff --git a/baml_language/crates/bex_resource_types/src/host_value.rs b/baml_language/crates/bex_resource_types/src/host_value.rs index b8fe1c5941..2c0e472f8c 100644 --- a/baml_language/crates/bex_resource_types/src/host_value.rs +++ b/baml_language/crates/bex_resource_types/src/host_value.rs @@ -22,11 +22,12 @@ use once_cell::sync::Lazy; pub enum HostValueKind { /// A host-language callable (function/closure/method). Callable, - /// An opaque host-language error value (a native exception that has no - /// BAML representation). Holds a reference back to the host error object - /// so the originating host can recover the exact native exception on - /// round-trip. Surfaced in BAML as `baml.errors.HostCallable`. - Error, + /// An arbitrary host-language value with no BAML representation, referenced + /// by key and round-tripped by identity. Surfaces in BAML as an opaque + /// `$rust_type` value (`Ty::RustType`). A native host exception is one + /// consumer: the bridge registers it as an opaque value and wraps the + /// handle in `baml.errors.HostCallable`. + Opaque, } /// Drop-on-last-clone notification fired to the host language. @@ -562,18 +563,19 @@ mod tests { ); } - /// `HostValueKind::Error` (added for opaque host-callable error round-trip) - /// must follow the same intern/refcount/release contract as `Callable`. + /// `HostValueKind::Opaque` (used for opaque host-value round-trip, e.g. the + /// host-callable error wrapper) must follow the same intern/refcount/release + /// contract as `Callable`. #[test] - fn error_kind_release_fires_on_last_drop() { + fn opaque_kind_release_fires_on_last_drop() { let _guard = lock_and_reset(); let key = 200; - let arc = HostValueArc::new(key, HostValueKind::Error); + let arc = HostValueArc::new(key, HostValueKind::Opaque); drop(arc); assert_eq!( FIRED.lock().unwrap().as_slice(), &[key], - "Error-kind release must fire just like Callable" + "Opaque-kind release must fire just like Callable" ); } @@ -584,11 +586,11 @@ mod tests { /// the assert to a runtime check) is an intentional change. #[cfg(not(debug_assertions))] #[test] - fn intern_collision_callable_vs_error_release_build_keeps_existing() { + fn intern_collision_callable_vs_opaque_release_build_keeps_existing() { let _guard = lock_and_reset(); let key = 201; let callable = HostValueArc::intern(key, HostValueKind::Callable); - let coerced = HostValueArc::intern(key, HostValueKind::Error); + let coerced = HostValueArc::intern(key, HostValueKind::Opaque); assert!( Arc::ptr_eq(&callable, &coerced), "release-build intern collision must alias to the existing Arc" diff --git a/baml_language/crates/bridge_ctypes/src/value_decode.rs b/baml_language/crates/bridge_ctypes/src/value_decode.rs index 3d706fa528..82f397dae5 100644 --- a/baml_language/crates/bridge_ctypes/src/value_decode.rs +++ b/baml_language/crates/bridge_ctypes/src/value_decode.rs @@ -61,8 +61,8 @@ pub fn inbound_to_external( let host_value_kind = if handle.handle_type == BamlHandleType::HostValueCallable as i32 { Some(bex_project::HostValueKind::Callable) - } else if handle.handle_type == BamlHandleType::HostValueError as i32 { - Some(bex_project::HostValueKind::Error) + } else if handle.handle_type == BamlHandleType::HostValueOpaque as i32 { + Some(bex_project::HostValueKind::Opaque) } else { None }; @@ -226,11 +226,11 @@ mod tests { } #[test] - fn decode_inbound_host_value_error() { + fn decode_inbound_host_value_opaque() { let table = CffiHandleTable::new(); let handle = BamlHandle { key: 777, - handle_type: BamlHandleType::HostValueError as i32, + handle_type: BamlHandleType::HostValueOpaque as i32, }; let inbound = InboundValue { value: Some(InboundValueVariant::Handle(handle)), @@ -239,14 +239,14 @@ mod tests { match result { BexExternalValue::HostValue(arc) => { assert_eq!(arc.key, 777); - assert_eq!(arc.kind, bex_project::HostValueKind::Error); + assert_eq!(arc.kind, bex_project::HostValueKind::Opaque); } other => panic!("unexpected variant: {other:?}"), } - // Like callables, opaque error handles bypass the HANDLE_TABLE. + // Like callables, opaque handles bypass the HANDLE_TABLE. assert!( table.resolve(777).is_none(), - "HOST_VALUE_ERROR must not touch HANDLE_TABLE" + "HOST_VALUE_OPAQUE must not touch HANDLE_TABLE" ); } diff --git a/baml_language/crates/bridge_ctypes/src/value_encode.rs b/baml_language/crates/bridge_ctypes/src/value_encode.rs index d49399f2e0..ee72798d76 100644 --- a/baml_language/crates/bridge_ctypes/src/value_encode.rs +++ b/baml_language/crates/bridge_ctypes/src/value_encode.rs @@ -146,7 +146,7 @@ pub fn external_to_outbound( use crate::baml_core::cffi::BamlHandleType; let ht = match arc.kind { bex_project::HostValueKind::Callable => BamlHandleType::HostValueCallable as i32, - bex_project::HostValueKind::Error => BamlHandleType::HostValueError as i32, + bex_project::HostValueKind::Opaque => BamlHandleType::HostValueOpaque as i32, }; Some(BamlValueVariant::HandleValue(BamlOutboundHandle { key: arc.key, @@ -499,8 +499,8 @@ mod tests { } #[test] - fn encode_outbound_host_value_error() { - let arc = HostValueArc::new(42, HostValueKind::Error); + fn encode_outbound_host_value_opaque() { + let arc = HostValueArc::new(42, HostValueKind::Opaque); let value = BexExternalValue::HostValue(arc); let options = CffiHandleTableOptions::for_in_process(); let encoded = external_to_outbound(&value, &options).expect("encode succeeds"); @@ -509,11 +509,11 @@ mod tests { other => panic!("unexpected: {other:?}"), }; assert_eq!(handle.key, 42); - assert_eq!(handle.handle_type, BamlHandleType::HostValueError as i32); - // Like callables, opaque error handles bypass the HANDLE_TABLE. + assert_eq!(handle.handle_type, BamlHandleType::HostValueOpaque as i32); + // Like callables, opaque handles bypass the HANDLE_TABLE. assert!( options.table.resolve(42).is_none(), - "HOST_VALUE_ERROR must not be inserted into HANDLE_TABLE" + "HOST_VALUE_OPAQUE must not be inserted into HANDLE_TABLE" ); } } diff --git a/baml_language/crates/bridge_ctypes/types/baml_core/cffi/v1/baml_inbound.proto b/baml_language/crates/bridge_ctypes/types/baml_core/cffi/v1/baml_inbound.proto index e56d2194a9..2e763a5b72 100644 --- a/baml_language/crates/bridge_ctypes/types/baml_core/cffi/v1/baml_inbound.proto +++ b/baml_language/crates/bridge_ctypes/types/baml_core/cffi/v1/baml_inbound.proto @@ -47,11 +47,14 @@ enum BamlHandleType { // Lifetime: Rust drop notifies host via HostReleaseFn (not via // HANDLE_TABLE). See bex_external_types::host_value. HOST_VALUE_CALLABLE = 15; - // Host-owned opaque error value (a native exception with no BAML - // representation), referenced via the same per-bridge registry and - // HostReleaseFn lifetime as HOST_VALUE_CALLABLE. Surfaced in BAML as - // baml.errors.HostCallable. See bex_external_types::host_value. - HOST_VALUE_ERROR = 16; + // Host-owned opaque value: an arbitrary host object with no BAML + // representation, referenced via the per-bridge HostValueRegistry and + // released via HostReleaseFn (not via HANDLE_TABLE), same as + // HOST_VALUE_CALLABLE. A host-thrown native exception is one consumer: + // the bridge registers it as an opaque value and wraps the handle in a + // baml.errors.HostCallable instance for throw semantics. See + // bex_external_types::host_value. + HOST_VALUE_OPAQUE = 16; } message BamlHandle { diff --git a/baml_language/crates/bridge_wasm/src/handle.rs b/baml_language/crates/bridge_wasm/src/handle.rs index 6e52e0013e..35f4db58f9 100644 --- a/baml_language/crates/bridge_wasm/src/handle.rs +++ b/baml_language/crates/bridge_wasm/src/handle.rs @@ -22,8 +22,8 @@ fn type_name(ht: BamlHandleType) -> &'static str { // Host-owned callables are tracked per-bridge, not in HANDLE_TABLE. // The key here is the bridge-side identity passed in from the host. BamlHandleType::HostValueCallable => "host_value_callable", - // Host-owned opaque error values: same per-bridge tracking as callables. - BamlHandleType::HostValueError => "host_value_error", + // Host-owned opaque values: same per-bridge tracking as callables. + BamlHandleType::HostValueOpaque => "host_value_opaque", } } @@ -109,7 +109,7 @@ impl BamlHandle { impl Drop for BamlHandle { fn drop(&mut self) { - // Host-owned handles (`HostValueCallable`, `HostValueError`) are + // Host-owned handles (`HostValueCallable`, `HostValueOpaque`) are // *not* tracked in HANDLE_TABLE — their lifetime is managed // per-bridge via the `HostReleaseFn` dispatch. Releasing them here // would call into the global HANDLE_TABLE with a key that may @@ -118,7 +118,7 @@ impl Drop for BamlHandle { // it. Skip the table release for those variants; their owners drop // them through their own release path. match self.handle_type { - BamlHandleType::HostValueCallable | BamlHandleType::HostValueError => {} + BamlHandleType::HostValueCallable | BamlHandleType::HostValueOpaque => {} _ => { let _ = HANDLE_TABLE.release(self.key); } diff --git a/baml_language/crates/bridge_wasm/tests/host_callable.rs b/baml_language/crates/bridge_wasm/tests/host_callable.rs index a9b102c2c2..299f74e683 100644 --- a/baml_language/crates/bridge_wasm/tests/host_callable.rs +++ b/baml_language/crates/bridge_wasm/tests/host_callable.rs @@ -372,7 +372,7 @@ fn make_dispatch_error() -> js_sys::Function { value: Some(InboundValue { value: Some(InboundVariant::Handle(BamlHandle { key: UNRESOLVED_HOST_ERROR_KEY, - handle_type: BamlHandleType::HostValueError as i32, + handle_type: BamlHandleType::HostValueOpaque as i32, })), }), }; diff --git a/baml_language/crates/sys_native/src/host_impls.rs b/baml_language/crates/sys_native/src/host_impls.rs index 11c8976cfc..f96a26fd92 100644 --- a/baml_language/crates/sys_native/src/host_impls.rs +++ b/baml_language/crates/sys_native/src/host_impls.rs @@ -67,8 +67,9 @@ impl io::IoNamespaceHost for NativeSysOps { // Extract the HostValueArc from the incoming handle and confirm // it's a callable. Only `HostValueKind::Callable` is dispatchable — // the bridge's dispatcher invokes a host *function* through this - // path. An `HostValueKind::Error` arc represents an opaque - // host-thrown exception and has no callable identity; dispatching + // path. An `HostValueKind::Opaque` arc represents an opaque + // host value (e.g. a host-thrown exception) and has no callable + // identity; dispatching // it would either find no entry in the bridge's callable registry // (returning a confusing "no callable for key" error) or, worse, // collide with a callable that happens to share its key. Reject @@ -358,7 +359,7 @@ mod tests { language: Some("python".to_string()), handle: bex_resource_types::HostValueArc::new( 42, - bex_resource_types::HostValueKind::Error, + bex_resource_types::HostValueKind::Opaque, ), }, ), diff --git a/baml_language/crates/sys_types/src/lib.rs b/baml_language/crates/sys_types/src/lib.rs index 1863e97bf9..ae319907bf 100644 --- a/baml_language/crates/sys_types/src/lib.rs +++ b/baml_language/crates/sys_types/src/lib.rs @@ -1173,7 +1173,7 @@ mod tests { language: None, handle: bex_external_types::HostValueArc::new( 1, - bex_external_types::HostValueKind::Error, + bex_external_types::HostValueKind::Opaque, ), }, ]; diff --git a/baml_language/sdks/go/bridge_go/cffi/proto/baml_core/cffi/v1/baml_inbound.pb.go b/baml_language/sdks/go/bridge_go/cffi/proto/baml_core/cffi/v1/baml_inbound.pb.go index 362c211994..e6c6917698 100644 --- a/baml_language/sdks/go/bridge_go/cffi/proto/baml_core/cffi/v1/baml_inbound.pb.go +++ b/baml_language/sdks/go/bridge_go/cffi/proto/baml_core/cffi/v1/baml_inbound.pb.go @@ -62,11 +62,14 @@ const ( // Lifetime: Rust drop notifies host via HostReleaseFn (not via // HANDLE_TABLE). See bex_external_types::host_value. BamlHandleType_HOST_VALUE_CALLABLE BamlHandleType = 15 - // Host-owned opaque error value (a native exception with no BAML - // representation), referenced via the same per-bridge registry and - // HostReleaseFn lifetime as HOST_VALUE_CALLABLE. Surfaced in BAML as - // baml.errors.HostCallable. See bex_external_types::host_value. - BamlHandleType_HOST_VALUE_ERROR BamlHandleType = 16 + // Host-owned opaque value: an arbitrary host object with no BAML + // representation, referenced via the per-bridge HostValueRegistry and + // released via HostReleaseFn (not via HANDLE_TABLE), same as + // HOST_VALUE_CALLABLE. A host-thrown native exception is one consumer: + // the bridge registers it as an opaque value and wraps the handle in a + // baml.errors.HostCallable instance for throw semantics. See + // bex_external_types::host_value. + BamlHandleType_HOST_VALUE_OPAQUE BamlHandleType = 16 ) // Enum value maps for BamlHandleType. @@ -86,7 +89,7 @@ var ( 13: "ADT_TYPE", 14: "ADT_TAGGED_HEAP_HANDLE", 15: "HOST_VALUE_CALLABLE", - 16: "HOST_VALUE_ERROR", + 16: "HOST_VALUE_OPAQUE", } BamlHandleType_value = map[string]int32{ "HANDLE_UNSPECIFIED": 0, @@ -103,7 +106,7 @@ var ( "ADT_TYPE": 13, "ADT_TAGGED_HEAP_HANDLE": 14, "HOST_VALUE_CALLABLE": 15, - "HOST_VALUE_ERROR": 16, + "HOST_VALUE_OPAQUE": 16, } ) @@ -938,7 +941,7 @@ var file_baml_core_cffi_v1_baml_inbound_proto_rawDesc = []byte{ 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0xde, + 0x6f, 0x72, 0x42, 0x0a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0xdf, 0x02, 0x0a, 0x0e, 0x42, 0x61, 0x6d, 0x6c, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x55, 0x4e, 0x54, @@ -958,11 +961,11 @@ var file_baml_core_cffi_v1_baml_inbound_proto_rawDesc = []byte{ 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x0d, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x44, 0x54, 0x5f, 0x54, 0x41, 0x47, 0x47, 0x45, 0x44, 0x5f, 0x48, 0x45, 0x41, 0x50, 0x5f, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x10, 0x0e, 0x12, 0x17, 0x0a, 0x13, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x56, 0x41, 0x4c, - 0x55, 0x45, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x0f, 0x12, 0x14, 0x0a, - 0x10, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x45, 0x52, 0x52, 0x4f, - 0x52, 0x10, 0x10, 0x22, 0x04, 0x08, 0x03, 0x10, 0x03, 0x22, 0x04, 0x08, 0x04, 0x10, 0x04, 0x42, - 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x63, 0x66, 0x66, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x55, 0x45, 0x5f, 0x43, 0x41, 0x4c, 0x4c, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x0f, 0x12, 0x15, 0x0a, + 0x11, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x5f, 0x4f, 0x50, 0x41, 0x51, + 0x55, 0x45, 0x10, 0x10, 0x22, 0x04, 0x08, 0x03, 0x10, 0x03, 0x22, 0x04, 0x08, 0x04, 0x10, 0x04, + 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x63, 0x66, 0x66, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.d.ts.map b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.d.ts.map deleted file mode 100644 index 44d757d752..0000000000 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"host_error_registry.d.ts","sourceRoot":"","sources":["../typescript_src/host_error_registry.ts"],"names":[],"mappings":"AAmCA,OAAO,EAA8D,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AA4BzG;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAIzD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAI/D"} \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.js.map b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.js.map deleted file mode 100644 index 74c261bd50..0000000000 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"host_error_registry.js","sourceRoot":"","sources":["../typescript_src/host_error_registry.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8BAA8B;AAC9B,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,+EAA+E;AAC/E,yBAAyB;AACzB,EAAE;AACF,yEAAyE;AACzE,2DAA2D;AAC3D,2DAA2D;AAC3D,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAC1E,gFAAgF;AAChF,0EAA0E;AAC1E,wDAAwD;AACxD,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AACzE,6EAA6E;AAC7E,8BAA8B;AAC9B,yEAAyE;AACzE,uEAAuE;AACvE,gFAAgF;AAChF,qCAAqC;AACrC,EAAE;AACF,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Ae,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,GAAc;IACrC,QAAQ,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,0EAA0E;AAC1E,uEAAuE;AACvE,sCAAsC;AACtC,4BAA4B,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.d.ts b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts similarity index 68% rename from baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.d.ts rename to baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts index a6b86d13b1..edaf856b0d 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.d.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts @@ -7,12 +7,12 @@ */ import { type HandleKey } from './native.js'; /** - * Register a JS error object and return its native `HandleKey` for the - * `_handle: Handle(HOST_VALUE_ERROR, key)` slot of a - * `baml.errors.HostCallable` Instance. Mints a fresh key via the Rust - * side's shared counter (guaranteed non-zero — Rust `next_key` skips - * `0`); stores the error keyed by the same key (recomposed as a - * `bigint` for `Map`-key equality). + * Register an arbitrary host JS value and return its native `HandleKey` for + * the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a + * `baml.errors.HostCallable` Instance (or any future opaque-value carrier). + * Mints a fresh key via the Rust side's shared counter (guaranteed non-zero — + * Rust `next_key` skips `0`); stores the value keyed by the same key + * (recomposed as a `bigint` for `Map`-key equality). * * Returns the native `HandleKey` directly so it can flow into the * protobufjs encoder without an intermediate `bigint→Long` conversion @@ -20,12 +20,12 @@ import { type HandleKey } from './native.js'; * the native `HandleKey` already provides; a bare `bigint` does not * encode correctly through the `IInboundValue.handle.key` field). */ -export declare function registerHostError(err: unknown): HandleKey; +export declare function registerHostOpaque(value: unknown): HandleKey; /** - * Look up a host-registered JS error by key. Returns `undefined` when: - * - the key is the reserved sentinel `0n` (no real error was registered); + * Look up a host-registered JS value by key. Returns `undefined` when: + * - the key is the reserved sentinel `0n` (no real value was registered); * - the engine has already released the entry (last `HostValueArc` clone - * dropped → Rust `host_release_callback` fired → `_releaseHostError` + * dropped → Rust `host_release_callback` fired → `_releaseHostValue` * removed the entry); * - the key was minted by a different Node process (cross-runtime handle). * @@ -37,15 +37,15 @@ export declare function registerHostError(err: unknown): HandleKey; * emitting an outbound proto referencing its key — the outbound encode * holds a strong handle through proto serialization, and the release tsfn * isn't fired until that strong handle drops. By the time the TS decoder - * runs `tryRehydrateFromHandle`, the only way the map entry is gone is if + * runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if * a *prior* outbound completed and the engine has since dropped its last * Arc; in that case the user has already observed the original throw at * least once, so a second lookup-miss → metadata-fallback is acceptable. */ -export declare function lookupHostError(key: bigint): unknown; +export declare function lookupHostValue(key: bigint): unknown; /** * Convenience for the outbound decoder: if `handle` is a `BamlHandle` - * tagged `HOST_VALUE_ERROR`, look up the originating JS error object in + * tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in * the registry and return it. Returns `undefined` for any other handle * type, a non-`BamlHandle` argument, or a key that doesn't resolve. * @@ -53,5 +53,5 @@ export declare function lookupHostError(key: bigint): unknown; * exception when a BAML-thrown `baml.errors.HostCallable` propagates back * to the same Node process that originated it. */ -export declare function tryRehydrateFromHandle(handle: unknown): unknown; -//# sourceMappingURL=host_error_registry.d.ts.map \ No newline at end of file +export declare function tryRehydrateHostValueByKey(handle: unknown): unknown; +//# sourceMappingURL=host_value_registry.d.ts.map \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts.map b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts.map new file mode 100644 index 0000000000..14063d7710 --- /dev/null +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.d.ts.map @@ -0,0 +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"} \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.js b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js similarity index 63% rename from baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.js rename to baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js index 0a33724498..f8ad753f1a 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_error_registry.js +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js @@ -5,44 +5,46 @@ * Proto: baml_language/crates/bridge_ctypes/types/baml_core/cffi/v1/*.proto * Build: cd baml_language/crates/bridge_nodejs && pnpm build:debug */ -// host_error_registry.ts — mirrors bridge_python's `register_host_error` +// host_value_registry.ts — mirrors bridge_python's `register_host_opaque` // + `lookup_host_value` pair. // -// A native JS exception raised inside a user callable round-trips back to -// the *same* Node process as the *same* `Error` object (`raised === caught` -// identity), not flattened into a metadata-only `BamlError(HostCallable(...))` -// wrapper. The plumbing: +// An arbitrary host JS value round-trips back to the *same* Node process as +// the *same* object (identity preserved), not flattened into a metadata-only +// wrapper. A native JS exception raised inside a user callable is the primary +// consumer: it round-trips as the *same* `Error` object (`raised === caught` +// identity), not a metadata-only `BamlError(HostCallable(...))` wrapper. The +// plumbing: // // 1. The TS bridge catches the JS error inside `sendHostCallableError` -// (proto.ts) and calls `registerHostError(err)` here. -// 2. `registerHostError` mints a globally-unique key via -// `native.mintHostErrorKey` (drawing from the shared callable+error +// (proto.ts) and calls `registerHostOpaque(err)` here. +// 2. `registerHostOpaque` mints a globally-unique key via +// `native.mintHostValueKey` (drawing from the shared callable+opaque // counter on the Rust side so the engine sees one keyspace), stores -// the JS error in the local `Map`, returns the key. +// the JS value in the local `Map`, returns the key. // 3. The bridge emits an `InboundValue.Class(name="baml.errors.HostCallable", -// fields=[..., _handle: Handle(HOST_VALUE_ERROR, key)])`. The engine +// fields=[..., _handle: Handle(HOST_VALUE_OPAQUE, key)])`. The engine // interns an `Arc` per the same key. // 4. When BAML propagates the throw back out to the host, the outbound -// encoder re-emits the `_handle: Handle(HOST_VALUE_ERROR, key)`. The +// encoder re-emits the `_handle: Handle(HOST_VALUE_OPAQUE, key)`. The // TS decoder (proto.ts) inspects a decoded `HostCallable` instance, -// reads `_handle.key`, calls `lookupHostError(key)` here, and re-throws +// reads `_handle.key`, calls `lookupHostValue(key)` here, and re-throws // the original JS error. // 5. When the engine drops its last `Arc(key)`, the Rust // `host_release_callback` fires the TS-installed release callback -// (`native.registerErrorReleaseCallback`), which calls `_releaseHostError` +// (`native.registerHostValueReleaseCallback`), which calls `_releaseHostValue` // here to remove the map entry. // // Foreign runtimes (a different Node process, the Python bridge, etc.) see // a `_handle` whose key doesn't resolve in their local registry; the // decoder falls back to the metadata-bearing `BamlError(HostCallable(...))` // wrapper. The reserved `0` is used as a sentinel by code paths that -// cannot register a real JS error (engine-internal synthetic faults like -// "no JS callable for this key"); `_releaseHostError(0n)` is a benign -// no-op since `mintHostErrorKey` never returns `0`. -import { mintHostErrorKey, registerErrorReleaseCallback, BamlHandle } from './native.js'; +// cannot register a real JS value (engine-internal synthetic faults like +// "no JS callable for this key"); `_releaseHostValue(0n)` is a benign +// no-op since `mintHostValueKey` never returns `0`. +import { mintHostValueKey, registerHostValueReleaseCallback, BamlHandle } from './native.js'; import { baml_core } from './proto/baml_cffi.js'; const BamlHandleType = baml_core.cffi.v1.BamlHandleType; -const errorMap = new Map(); +const hostValueMap = new Map(); /** * Convert a `HandleKey` (`{ low, high }`) to a `bigint` for use as a `Map` key. * Native `HandleKey` instances split a `u64` across two `i32` low/high halves @@ -64,12 +66,12 @@ function handleKeyToBigint(key) { return (high << 32n) | low; } /** - * Register a JS error object and return its native `HandleKey` for the - * `_handle: Handle(HOST_VALUE_ERROR, key)` slot of a - * `baml.errors.HostCallable` Instance. Mints a fresh key via the Rust - * side's shared counter (guaranteed non-zero — Rust `next_key` skips - * `0`); stores the error keyed by the same key (recomposed as a - * `bigint` for `Map`-key equality). + * Register an arbitrary host JS value and return its native `HandleKey` for + * the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a + * `baml.errors.HostCallable` Instance (or any future opaque-value carrier). + * Mints a fresh key via the Rust side's shared counter (guaranteed non-zero — + * Rust `next_key` skips `0`); stores the value keyed by the same key + * (recomposed as a `bigint` for `Map`-key equality). * * Returns the native `HandleKey` directly so it can flow into the * protobufjs encoder without an intermediate `bigint→Long` conversion @@ -77,16 +79,16 @@ function handleKeyToBigint(key) { * the native `HandleKey` already provides; a bare `bigint` does not * encode correctly through the `IInboundValue.handle.key` field). */ -export function registerHostError(err) { - const key = mintHostErrorKey(); - errorMap.set(handleKeyToBigint(key), err); +export function registerHostOpaque(value) { + const key = mintHostValueKey(); + hostValueMap.set(handleKeyToBigint(key), value); return key; } /** - * Look up a host-registered JS error by key. Returns `undefined` when: - * - the key is the reserved sentinel `0n` (no real error was registered); + * Look up a host-registered JS value by key. Returns `undefined` when: + * - the key is the reserved sentinel `0n` (no real value was registered); * - the engine has already released the entry (last `HostValueArc` clone - * dropped → Rust `host_release_callback` fired → `_releaseHostError` + * dropped → Rust `host_release_callback` fired → `_releaseHostValue` * removed the entry); * - the key was minted by a different Node process (cross-runtime handle). * @@ -98,17 +100,17 @@ export function registerHostError(err) { * emitting an outbound proto referencing its key — the outbound encode * holds a strong handle through proto serialization, and the release tsfn * isn't fired until that strong handle drops. By the time the TS decoder - * runs `tryRehydrateFromHandle`, the only way the map entry is gone is if + * runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if * a *prior* outbound completed and the engine has since dropped its last * Arc; in that case the user has already observed the original throw at * least once, so a second lookup-miss → metadata-fallback is acceptable. */ -export function lookupHostError(key) { - return errorMap.get(key); +export function lookupHostValue(key) { + return hostValueMap.get(key); } /** * Convenience for the outbound decoder: if `handle` is a `BamlHandle` - * tagged `HOST_VALUE_ERROR`, look up the originating JS error object in + * tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in * the registry and return it. Returns `undefined` for any other handle * type, a non-`BamlHandle` argument, or a key that doesn't resolve. * @@ -116,24 +118,24 @@ export function lookupHostError(key) { * exception when a BAML-thrown `baml.errors.HostCallable` propagates back * to the same Node process that originated it. */ -export function tryRehydrateFromHandle(handle) { +export function tryRehydrateHostValueByKey(handle) { if (!(handle instanceof BamlHandle)) return undefined; - if (handle.handleType !== BamlHandleType.HOST_VALUE_ERROR) + if (handle.handleType !== BamlHandleType.HOST_VALUE_OPAQUE) return undefined; - return lookupHostError(handleKeyToBigint(handle.key)); + return lookupHostValue(handleKeyToBigint(handle.key)); } /** * Internal: remove the map entry for `key`. Wired at module init as the * Rust-side release callback. Idempotent and absent-key-safe so the same * callback can be invoked for *every* `HostValueArc` release (including - * callable keys, which never have a TS-side error entry). + * callable keys, which never have a TS-side host-value entry). */ -function _releaseHostError(key) { - errorMap.delete(handleKeyToBigint(key)); +function _releaseHostValue(key) { + hostValueMap.delete(handleKeyToBigint(key)); } // Install the Rust-side release callback exactly once at module load. The // napi function is itself first-call-wins on the Rust side, so reloads // (e.g. test harnesses) are harmless. -registerErrorReleaseCallback(_releaseHostError); -//# sourceMappingURL=host_error_registry.js.map \ No newline at end of file +registerHostValueReleaseCallback(_releaseHostValue); +//# sourceMappingURL=host_value_registry.js.map \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js.map b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js.map new file mode 100644 index 0000000000..b380a61329 --- /dev/null +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/host_value_registry.js.map @@ -0,0 +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,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC;AAExD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,SAAS,iBAAiB,CAAC,GAAc;IACrC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC7C,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACvC,OAAO,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAe;IACtD,IAAI,CAAC,CAAC,MAAM,YAAY,UAAU,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,IAAI,MAAM,CAAC,UAAU,KAAK,cAAc,CAAC,iBAAiB;QAAE,OAAO,SAAS,CAAC;IAC7E,OAAO,eAAe,CAAC,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,GAAc;IACrC,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,0EAA0E;AAC1E,uEAAuE;AACvE,sCAAsC;AACtC,gCAAgC,CAAC,iBAAiB,CAAC,CAAC"} \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/native.d.ts b/baml_language/sdks/nodejs/bridge_nodejs/dist/native.d.ts index 29ea350532..0c0d0f1596 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/native.d.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/native.d.ts @@ -242,19 +242,33 @@ export interface HandleKey { } /** - * Mint a fresh host-value key, drawing from the shared callable+error + * Mint a fresh host-value key, drawing from the shared callable+opaque * counter so the engine sees one globally-unique keyspace. Returned to - * TS by `registerHostError` (the TS-side function in - * `host_error_registry.ts`). + * TS by `registerHostOpaque` (the TS-side function in + * `host_value_registry.ts`). * - * Exposed to JS as `mintHostErrorKey() -> HandleKey`. The TS-side error - * registry calls this once per `registerHostError(err)` before inserting - * the error into its `Map`. + * Exposed to JS as `mintHostValueKey() -> HandleKey`. The TS-side host-value + * registry calls this once per `registerHostOpaque(value)` before inserting + * the value into its `Map`. */ -export declare function mintHostErrorKey(): HandleKey +export declare function mintHostValueKey(): HandleKey export declare function newFunctionCall(): string +/** + * Register a JS dispatch wrapper in the host-value table and return its key. + * + * Exposed to JS as `registerHostCallable(fn) -> HandleKey`. Called from + * the inbound encoder in `typescript_src/proto.ts` whenever a JS callable + * appears as a kwarg — the encoder constructs the dispatch wrapper around + * the user's function before calling this. + * + * The `Function` is converted into a `ThreadsafeFunction` so it can outlive + * the napi call scope and be invoked from any thread (the engine's tokio + * runtime calls into this entry point from a worker thread). + */ +export declare function registerHostCallable(callable: (callId: number, argsBytes: Buffer) => void): HandleKey + /** * Install the TS-side release callback. First-call-wins; subsequent * calls are a no-op (matching the bridge_cffi dispatch-registration @@ -278,24 +292,10 @@ export declare function newFunctionCall(): string * host callback awaiting completion *must* keep the loop alive so the * JS callback can actually run. * - * Exposed to JS as `registerErrorReleaseCallback(cb)`. Must be called + * Exposed to JS as `registerHostValueReleaseCallback(cb)`. Must be called * exactly once at SDK module init, before any host call is dispatched. */ -export declare function registerErrorReleaseCallback(callback: (key: HandleKey) => void): void - -/** - * Register a JS dispatch wrapper in the host-value table and return its key. - * - * Exposed to JS as `registerHostCallable(fn) -> HandleKey`. Called from - * the inbound encoder in `typescript_src/proto.ts` whenever a JS callable - * appears as a kwarg — the encoder constructs the dispatch wrapper around - * the user's function before calling this. - * - * The `Function` is converted into a `ThreadsafeFunction` so it can outlive - * the napi call scope and be invoked from any thread (the engine's tokio - * runtime calls into this entry point from a worker thread). - */ -export declare function registerHostCallable(callable: (callId: number, argsBytes: Buffer) => void): HandleKey +export declare function registerHostValueReleaseCallback(callback: (key: HandleKey) => void): void /** * Release a host callable the inbound encoder registered but never handed to diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/native.js b/baml_language/sdks/nodejs/bridge_nodejs/dist/native.js index e02df7d723..0d72f23313 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/native.js +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/native.js @@ -88,8 +88,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-android-arm64') const bindingPackageVersion = require('@boundaryml/baml-core-node-android-arm64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -104,8 +104,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-android-arm-eabi') const bindingPackageVersion = require('@boundaryml/baml-core-node-android-arm-eabi/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -125,8 +125,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-win32-x64-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-win32-x64-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -141,8 +141,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-win32-x64-msvc') const bindingPackageVersion = require('@boundaryml/baml-core-node-win32-x64-msvc/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -158,8 +158,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-win32-ia32-msvc') const bindingPackageVersion = require('@boundaryml/baml-core-node-win32-ia32-msvc/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -174,8 +174,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-win32-arm64-msvc') const bindingPackageVersion = require('@boundaryml/baml-core-node-win32-arm64-msvc/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -193,8 +193,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-darwin-universal') const bindingPackageVersion = require('@boundaryml/baml-core-node-darwin-universal/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -209,8 +209,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-darwin-x64') const bindingPackageVersion = require('@boundaryml/baml-core-node-darwin-x64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -225,8 +225,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-darwin-arm64') const bindingPackageVersion = require('@boundaryml/baml-core-node-darwin-arm64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -245,8 +245,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-freebsd-x64') const bindingPackageVersion = require('@boundaryml/baml-core-node-freebsd-x64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -261,8 +261,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-freebsd-arm64') const bindingPackageVersion = require('@boundaryml/baml-core-node-freebsd-arm64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -282,8 +282,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-x64-musl') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-x64-musl/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -298,8 +298,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-x64-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-x64-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -316,8 +316,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-arm64-musl') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-arm64-musl/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -332,8 +332,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-arm64-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-arm64-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -350,8 +350,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-arm-musleabihf') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-arm-musleabihf/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -366,8 +366,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-arm-gnueabihf') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-arm-gnueabihf/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -384,8 +384,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-loong64-musl') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-loong64-musl/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -400,8 +400,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-loong64-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-loong64-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -418,8 +418,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-riscv64-musl') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-riscv64-musl/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -434,8 +434,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-riscv64-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-riscv64-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -451,8 +451,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-ppc64-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-ppc64-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -467,8 +467,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-linux-s390x-gnu') const bindingPackageVersion = require('@boundaryml/baml-core-node-linux-s390x-gnu/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -487,8 +487,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-openharmony-arm64') const bindingPackageVersion = require('@boundaryml/baml-core-node-openharmony-arm64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -503,8 +503,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-openharmony-x64') const bindingPackageVersion = require('@boundaryml/baml-core-node-openharmony-x64/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -519,8 +519,8 @@ function requireNative() { try { const binding = require('@boundaryml/baml-core-node-openharmony-arm') const bindingPackageVersion = require('@boundaryml/baml-core-node-openharmony-arm/package.json').version - if (bindingPackageVersion !== '0.12.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.12.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.12.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.12.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -596,7 +596,7 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { BamlAudio, BamlCallContext, BamlHandle, BamlImage, BamlPdf, BamlRuntime, BamlVideo, Collector, FunctionLog, HostSpanManager, LlmCall, LLMCall, Timing, Usage, _seedFunctionRefHandle, _seedGenericMediaHandle, cancelFunctionCall, completeHostCall, flushEvents, getRuntime, getVersion, mintHostErrorKey, newFunctionCall, registerErrorReleaseCallback, registerHostCallable, releaseHostCallable } = nativeBinding +const { BamlAudio, BamlCallContext, BamlHandle, BamlImage, BamlPdf, BamlRuntime, BamlVideo, Collector, FunctionLog, HostSpanManager, LlmCall, LLMCall, Timing, Usage, _seedFunctionRefHandle, _seedGenericMediaHandle, cancelFunctionCall, completeHostCall, flushEvents, getRuntime, getVersion, mintHostValueKey, newFunctionCall, registerHostCallable, registerHostValueReleaseCallback, releaseHostCallable } = nativeBinding export { BamlAudio } export { BamlCallContext } export { BamlHandle } @@ -618,8 +618,8 @@ export { completeHostCall } export { flushEvents } export { getRuntime } export { getVersion } -export { mintHostErrorKey } +export { mintHostValueKey } export { newFunctionCall } -export { registerErrorReleaseCallback } export { registerHostCallable } +export { registerHostValueReleaseCallback } export { releaseHostCallable } diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js index 2331fd01c0..b611b78750 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js @@ -14,7 +14,7 @@ import { baml_core } from './proto/baml_cffi.js'; import { BamlHandle, BamlImage, BamlAudio, BamlVideo, BamlPdf, registerHostCallable, releaseHostCallable, completeHostCall, } from './native.js'; import { BamlStream } from './stream.js'; import { BamlAbortError, BamlCancelledError, BamlError, BamlPanic } from './errors.js'; -import { registerHostError, tryRehydrateFromHandle, } from './host_error_registry.js'; +import { registerHostOpaque, tryRehydrateHostValueByKey, } from './host_value_registry.js'; import { getTypeMap } from './typemap.js'; const CallFunctionArgs = baml_core.cffi.v1.CallFunctionArgs; const BamlOutboundValue = baml_core.cffi.v1.BamlOutboundValue; @@ -479,7 +479,7 @@ export function decodeCallResult(data) { const { value, className, message } = decodeThrown(result.error?.value); const trace = result.error?.trace ?? []; // Same-host rehydration: a `baml.errors.HostCallable` carrying a - // `_handle` that still resolves in this process's host-error + // `_handle` that still resolves in this process's host-value // registry re-throws the *original* JS error object the bridge // registered on the inbound throw — preserving `raised === caught` // identity. Foreign runtimes (a different Node process, the @@ -487,7 +487,7 @@ export function decodeCallResult(data) { // metadata-bearing `BamlError(HostCallable)` wrapper below. if (className === 'baml.errors.HostCallable' && value !== null && typeof value === 'object') { const handle = value._handle; - const original = tryRehydrateFromHandle(handle); + const original = tryRehydrateHostValueByKey(handle); if (original !== undefined) { throw original; } @@ -641,7 +641,7 @@ function buildHostCallableInbound(className, message, traceback, handleKey) { value: InboundValue.create({ handle: { key: handleKey, - handleType: BamlHandleType.HOST_VALUE_ERROR, + handleType: BamlHandleType.HOST_VALUE_OPAQUE, }, }), }); @@ -663,7 +663,7 @@ function buildHostCallableInbound(className, message, traceback, handleKey) { } // Sentinel `_handle` key used by paths that have *no* JS error object to // register (the `completeHostCallLastResort` fallback below). Real host -// throws register the JS error via `registerHostError` and emit its +// throws register the JS error via `registerHostOpaque` and emit its // minted key; engine-internal synthetic faults use this sentinel. The // engine's structural check accepts either; same-host decoders that look // up `{low:0,high:0}` find nothing and fall through to the @@ -742,14 +742,14 @@ function sendHostCallableError(callId, err) { // throw when given a hostile input (e.g. a Proxy whose `constructor`, // `name`, or `message` getters throw — see the // `host-callable always completes on abnormal paths` jest suite). - // In that case `registerHostError` is never reached, control jumps + // In that case `registerHostOpaque` is never reached, control jumps // to the outer `catch (innerErr)` → `completeHostCallLastResort`, // and the user sees a metadata-only `HostCallable` instead of the // original Proxy. Identity loss here is the right trade — the // alternative is hanging the call. // // Registration-leak edge case (rare, bounded): if encoding succeeds - // through `registerHostError` but `buildHostCallableInbound` or + // through `registerHostOpaque` but `buildHostCallableInbound` or // `InboundValue.encode` fails after, the TS map entry stays alive // with no corresponding engine-side `HostValueArc` to release it, // so it lives until process exit. Both downstream calls are deeply @@ -757,7 +757,7 @@ function sendHostCallableError(callId, err) { // and don't depend on `err`'s shape, so this is effectively // unreachable outside protobufjs / native-binding corruption. const { className, message, stack } = describeError(err); - const handleKey = registerHostError(err); + const handleKey = registerHostOpaque(err); const inbound = buildHostCallableInbound(className, message, stack, handleKey); const bytes = Buffer.from(InboundValue.encode(inbound).finish()); completeHostCall(callId, 1, bytes); diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js.map b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js.map index 3f2d17c383..cc5cdb8441 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js.map +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto.js.map @@ -1 +1 @@ -{"version":3,"file":"proto.js","sourceRoot":"","sources":["../typescript_src/proto.ts"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QACtE,MAAM,SAAS,GAAG,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;QAC7E,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC1E,CAAC"} \ No newline at end of file diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.d.ts b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.d.ts index 771478719c..c37f5ce1b8 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.d.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.d.ts @@ -32,7 +32,7 @@ export namespace baml_core { ADT_TYPE = 13, ADT_TAGGED_HEAP_HANDLE = 14, HOST_VALUE_CALLABLE = 15, - HOST_VALUE_ERROR = 16 + HOST_VALUE_OPAQUE = 16 } /** Properties of a BamlHandle. */ diff --git a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.js b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.js index 9f320f518d..251fe7a02e 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.js +++ b/baml_language/sdks/nodejs/bridge_nodejs/dist/proto/baml_cffi.js @@ -59,7 +59,7 @@ export const baml_core = $root.baml_core = (() => { * @property {number} ADT_TYPE=13 ADT_TYPE value * @property {number} ADT_TAGGED_HEAP_HANDLE=14 ADT_TAGGED_HEAP_HANDLE value * @property {number} HOST_VALUE_CALLABLE=15 HOST_VALUE_CALLABLE value - * @property {number} HOST_VALUE_ERROR=16 HOST_VALUE_ERROR value + * @property {number} HOST_VALUE_OPAQUE=16 HOST_VALUE_OPAQUE value */ v1.BamlHandleType = (function() { const valuesById = {}, values = Object.create(valuesById); @@ -77,7 +77,7 @@ export const baml_core = $root.baml_core = (() => { values[valuesById[13] = "ADT_TYPE"] = 13; values[valuesById[14] = "ADT_TAGGED_HEAP_HANDLE"] = 14; values[valuesById[15] = "HOST_VALUE_CALLABLE"] = 15; - values[valuesById[16] = "HOST_VALUE_ERROR"] = 16; + values[valuesById[16] = "HOST_VALUE_OPAQUE"] = 16; return values; })(); @@ -358,7 +358,7 @@ export const baml_core = $root.baml_core = (() => { case 15: message.handleType = 15; break; - case "HOST_VALUE_ERROR": + case "HOST_VALUE_OPAQUE": case 16: message.handleType = 16; break; @@ -4923,7 +4923,7 @@ export const baml_core = $root.baml_core = (() => { case 15: message.handleType = 15; break; - case "HOST_VALUE_ERROR": + case "HOST_VALUE_OPAQUE": case 16: message.handleType = 16; break; diff --git a/baml_language/sdks/nodejs/bridge_nodejs/src/host_value.rs b/baml_language/sdks/nodejs/bridge_nodejs/src/host_value.rs index 8db7fd7891..002b932b04 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/src/host_value.rs +++ b/baml_language/sdks/nodejs/bridge_nodejs/src/host_value.rs @@ -187,18 +187,18 @@ fn drop_registry_entry(host_value_key: u64) { drop(popped); } -/// Drop the JS dispatch wrapper / error-map entry associated with +/// Drop the JS dispatch wrapper / host-value-map entry associated with /// `host_value_key`. /// /// Fires when the last Rust clone of the corresponding `HostValueArc` is /// dropped — see `bex_external_types::host_value::host_release_dispatch`. -/// We don't track *which* kind (callable vs error) the key referred to: +/// We don't track *which* kind (callable vs opaque) the key referred to: /// every release attempts both the Rust-side callable drop and the -/// TS-side error-map delete. Whichever one of the two registries actually +/// TS-side host-value-map delete. Whichever one of the two registries actually /// held the entry cleans it up; the other is a benign no-op. pub extern "C" fn host_release_callback(host_value_key: u64) { drop_registry_entry(host_value_key); - if let Some(tsfn) = ERROR_RELEASE_CALLBACK.get() { + if let Some(tsfn) = HOST_VALUE_RELEASE_CALLBACK.get() { // Fire-and-forget: the TS callback removes the map entry on the // libuv loop. `QueueFull` would mean an enormous backlog of // releases — log it (so it's visible in stress tests) and move @@ -210,7 +210,7 @@ pub extern "C" fn host_release_callback(host_value_key: u64) { ); if status != Status::Ok { log::warn!( - "host_release_callback: error-release tsfn returned {status:?} \ + "host_release_callback: host-value-release tsfn returned {status:?} \ for key {host_value_key}; TS-side map entry will leak until next GC", ); } @@ -218,52 +218,59 @@ pub extern "C" fn host_release_callback(host_value_key: u64) { } // ============================================================================ -// Host-error registry — JS-side storage with Rust-driven release +// Host-value registry — JS-side storage with Rust-driven release // ============================================================================ // -// A native JS exception raised inside a user callback round-trips back to -// the same Node process as the *same* `Error` object (mirrors the Python -// bridge's `register_host_error` / `lookup_host_value` pair). The TS bridge -// owns the storage (a `Map` of JS error values) because -// napi-rs has no zero-overhead persistent reference type for arbitrary JS -// values; Rust owns the key minting (so callable + error keys share a -// single globally-unique counter and never collide) and the release +// An arbitrary host JS value (e.g. a native exception raised inside a user +// callback) round-trips back to the same Node process as the *same* object +// (mirrors the Python bridge's `register_host_opaque` / `lookup_host_value` +// pair). The TS bridge owns the storage (a `Map` of JS +// values) because napi-rs has no zero-overhead persistent reference type for +// arbitrary JS values; Rust owns the key minting (so callable + opaque keys +// share a single globally-unique counter and never collide) and the release // signal (the engine's `host_release_dispatch::fire(key)` fires Rust's // `host_release_callback`, which notifies TS to remove its map entry). // // Release is a fire-and-forget tsfn call on the libuv loop — TS removes the // entry once napi schedules the callback. A lookup that races a release // returns the (about-to-be-released) reference, which only delays GC of -// that exception by one tick; no correctness issue. The TS map never -// silently leaks: every key minted via `mint_host_error_key` corresponds +// that value by one tick; no correctness issue. The TS map never +// silently leaks: every key minted via `mint_host_value_key` corresponds // to an `Arc` on the engine side whose `Drop` is guaranteed // to fire the release callback. /// Threadsafe handle to the TS-installed release callback. Set once at -/// module load via [`register_error_release_callback`]. -type ErrorReleaseTsfn = - ThreadsafeFunction; +/// module load via [`register_host_value_release_callback`]. +type HostValueReleaseTsfn = ThreadsafeFunction< + HandleKey, + (), + HandleKey, + Status, + false, + true, + HOST_VALUE_RELEASE_QUEUE_SIZE, +>; -/// Upper bound on queued, not-yet-delivered error-release notifications. +/// Upper bound on queued, not-yet-delivered host-value-release notifications. /// Generous because each notification is tiny (one `HandleKey`) and bursts /// can happen during engine GC sweeps. `Status::QueueFull` from /// `tsfn.call` is logged but not otherwise surfaced — the TS map entry /// stays until the process exits, but the engine's `HostValueArc` has /// already dropped so there's no further engine state to clean up. -const ERROR_RELEASE_QUEUE_SIZE: usize = 4096; +const HOST_VALUE_RELEASE_QUEUE_SIZE: usize = 4096; -static ERROR_RELEASE_CALLBACK: OnceLock> = OnceLock::new(); +static HOST_VALUE_RELEASE_CALLBACK: OnceLock> = OnceLock::new(); -/// Mint a fresh host-value key, drawing from the shared callable+error +/// Mint a fresh host-value key, drawing from the shared callable+opaque /// counter so the engine sees one globally-unique keyspace. Returned to -/// TS by `registerHostError` (the TS-side function in -/// `host_error_registry.ts`). +/// TS by `registerHostOpaque` (the TS-side function in +/// `host_value_registry.ts`). /// -/// Exposed to JS as `mintHostErrorKey() -> HandleKey`. The TS-side error -/// registry calls this once per `registerHostError(err)` before inserting -/// the error into its `Map`. -#[napi(js_name = "mintHostErrorKey")] -pub fn mint_host_error_key() -> HandleKey { +/// Exposed to JS as `mintHostValueKey() -> HandleKey`. The TS-side host-value +/// registry calls this once per `registerHostOpaque(value)` before inserting +/// the value into its `Map`. +#[napi(js_name = "mintHostValueKey")] +pub fn mint_host_value_key() -> HandleKey { HandleKey::from_u64(next_key()) } @@ -289,19 +296,21 @@ pub fn mint_host_error_key() -> HandleKey { /// host callback awaiting completion *must* keep the loop alive so the /// JS callback can actually run. /// -/// Exposed to JS as `registerErrorReleaseCallback(cb)`. Must be called +/// Exposed to JS as `registerHostValueReleaseCallback(cb)`. Must be called /// exactly once at SDK module init, before any host call is dispatched. #[napi(ts_args_type = "callback: (key: HandleKey) => void")] -pub fn register_error_release_callback(callback: Function<'_, HandleKey, ()>) -> napi::Result<()> { - let tsfn: ErrorReleaseTsfn = callback +pub fn register_host_value_release_callback( + callback: Function<'_, HandleKey, ()>, +) -> napi::Result<()> { + let tsfn: HostValueReleaseTsfn = callback .build_threadsafe_function() .callee_handled::() .weak::() - .max_queue_size::() + .max_queue_size::() .build()?; // First-call-wins; ignore the `Err(_)` from `set` on later calls // (caller is responsible for not re-registering). - let _ = ERROR_RELEASE_CALLBACK.set(Arc::new(tsfn)); + let _ = HOST_VALUE_RELEASE_CALLBACK.set(Arc::new(tsfn)); Ok(()) } diff --git a/baml_language/sdks/nodejs/bridge_nodejs/tests/host_callable.test.ts b/baml_language/sdks/nodejs/bridge_nodejs/tests/host_callable.test.ts index 9eedc57429..8f9ee2e489 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/tests/host_callable.test.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/tests/host_callable.test.ts @@ -30,7 +30,7 @@ import { vi } from 'vitest'; import { BamlRuntime } from '../dist/native.js'; import { callFunction, callFunctionSync } from '../dist/index.js'; import { encodeCallArgs } from '../dist/proto.js'; -import * as hostErrorRegistry from '../dist/host_error_registry.js'; +import * as hostValueRegistry from '../dist/host_value_registry.js'; const CALLBACK_BAML = ` function CallCb(callback: (int) -> string, x: int) -> string { @@ -119,12 +119,12 @@ describe('host-callable error surfacing', () => { // Instance with the handle in `_handle`; the outbound decoder looks // the handle up and re-throws the original. // - // The spy on `tryRehydrateFromHandle` is defense-in-depth: identity + // The spy on `tryRehydrateHostValueByKey` is defense-in-depth: identity // (`===`) alone could in principle be satisfied by a future fast-path // that bypasses the registry (e.g. a closure-captured shortcut). // The spy pins the actual flow — proto.ts's outbound decoder MUST - // consult the host-error registry on every host-callable throw. - const spy = vi.spyOn(hostErrorRegistry, 'tryRehydrateFromHandle'); + // consult the host-value registry on every host-callable throw. + const spy = vi.spyOn(hostValueRegistry, 'tryRehydrateHostValueByKey'); try { const rt = makeRuntime(); const raised = new Error('identity-check'); diff --git a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/host_error_registry.ts b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/host_value_registry.ts similarity index 61% rename from baml_language/sdks/nodejs/bridge_nodejs/typescript_src/host_error_registry.ts rename to baml_language/sdks/nodejs/bridge_nodejs/typescript_src/host_value_registry.ts index 1957a327f3..6cdb43a80e 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/host_error_registry.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/host_value_registry.ts @@ -1,44 +1,46 @@ -// host_error_registry.ts — mirrors bridge_python's `register_host_error` +// host_value_registry.ts — mirrors bridge_python's `register_host_opaque` // + `lookup_host_value` pair. // -// A native JS exception raised inside a user callable round-trips back to -// the *same* Node process as the *same* `Error` object (`raised === caught` -// identity), not flattened into a metadata-only `BamlError(HostCallable(...))` -// wrapper. The plumbing: +// An arbitrary host JS value round-trips back to the *same* Node process as +// the *same* object (identity preserved), not flattened into a metadata-only +// wrapper. A native JS exception raised inside a user callable is the primary +// consumer: it round-trips as the *same* `Error` object (`raised === caught` +// identity), not a metadata-only `BamlError(HostCallable(...))` wrapper. The +// plumbing: // // 1. The TS bridge catches the JS error inside `sendHostCallableError` -// (proto.ts) and calls `registerHostError(err)` here. -// 2. `registerHostError` mints a globally-unique key via -// `native.mintHostErrorKey` (drawing from the shared callable+error +// (proto.ts) and calls `registerHostOpaque(err)` here. +// 2. `registerHostOpaque` mints a globally-unique key via +// `native.mintHostValueKey` (drawing from the shared callable+opaque // counter on the Rust side so the engine sees one keyspace), stores -// the JS error in the local `Map`, returns the key. +// the JS value in the local `Map`, returns the key. // 3. The bridge emits an `InboundValue.Class(name="baml.errors.HostCallable", -// fields=[..., _handle: Handle(HOST_VALUE_ERROR, key)])`. The engine +// fields=[..., _handle: Handle(HOST_VALUE_OPAQUE, key)])`. The engine // interns an `Arc` per the same key. // 4. When BAML propagates the throw back out to the host, the outbound -// encoder re-emits the `_handle: Handle(HOST_VALUE_ERROR, key)`. The +// encoder re-emits the `_handle: Handle(HOST_VALUE_OPAQUE, key)`. The // TS decoder (proto.ts) inspects a decoded `HostCallable` instance, -// reads `_handle.key`, calls `lookupHostError(key)` here, and re-throws +// reads `_handle.key`, calls `lookupHostValue(key)` here, and re-throws // the original JS error. // 5. When the engine drops its last `Arc(key)`, the Rust // `host_release_callback` fires the TS-installed release callback -// (`native.registerErrorReleaseCallback`), which calls `_releaseHostError` +// (`native.registerHostValueReleaseCallback`), which calls `_releaseHostValue` // here to remove the map entry. // // Foreign runtimes (a different Node process, the Python bridge, etc.) see // a `_handle` whose key doesn't resolve in their local registry; the // decoder falls back to the metadata-bearing `BamlError(HostCallable(...))` // wrapper. The reserved `0` is used as a sentinel by code paths that -// cannot register a real JS error (engine-internal synthetic faults like -// "no JS callable for this key"); `_releaseHostError(0n)` is a benign -// no-op since `mintHostErrorKey` never returns `0`. +// cannot register a real JS value (engine-internal synthetic faults like +// "no JS callable for this key"); `_releaseHostValue(0n)` is a benign +// no-op since `mintHostValueKey` never returns `0`. -import { mintHostErrorKey, registerErrorReleaseCallback, BamlHandle, type HandleKey } from './native.js'; +import { mintHostValueKey, registerHostValueReleaseCallback, BamlHandle, type HandleKey } from './native.js'; import { baml_core } from './proto/baml_cffi.js'; const BamlHandleType = baml_core.cffi.v1.BamlHandleType; -const errorMap = new Map(); +const hostValueMap = new Map(); /** * Convert a `HandleKey` (`{ low, high }`) to a `bigint` for use as a `Map` key. @@ -62,12 +64,12 @@ function handleKeyToBigint(key: HandleKey): bigint { } /** - * Register a JS error object and return its native `HandleKey` for the - * `_handle: Handle(HOST_VALUE_ERROR, key)` slot of a - * `baml.errors.HostCallable` Instance. Mints a fresh key via the Rust - * side's shared counter (guaranteed non-zero — Rust `next_key` skips - * `0`); stores the error keyed by the same key (recomposed as a - * `bigint` for `Map`-key equality). + * Register an arbitrary host JS value and return its native `HandleKey` for + * the `_handle: Handle(HOST_VALUE_OPAQUE, key)` slot of a + * `baml.errors.HostCallable` Instance (or any future opaque-value carrier). + * Mints a fresh key via the Rust side's shared counter (guaranteed non-zero — + * Rust `next_key` skips `0`); stores the value keyed by the same key + * (recomposed as a `bigint` for `Map`-key equality). * * Returns the native `HandleKey` directly so it can flow into the * protobufjs encoder without an intermediate `bigint→Long` conversion @@ -75,17 +77,17 @@ function handleKeyToBigint(key: HandleKey): bigint { * the native `HandleKey` already provides; a bare `bigint` does not * encode correctly through the `IInboundValue.handle.key` field). */ -export function registerHostError(err: unknown): HandleKey { - const key = mintHostErrorKey(); - errorMap.set(handleKeyToBigint(key), err); +export function registerHostOpaque(value: unknown): HandleKey { + const key = mintHostValueKey(); + hostValueMap.set(handleKeyToBigint(key), value); return key; } /** - * Look up a host-registered JS error by key. Returns `undefined` when: - * - the key is the reserved sentinel `0n` (no real error was registered); + * Look up a host-registered JS value by key. Returns `undefined` when: + * - the key is the reserved sentinel `0n` (no real value was registered); * - the engine has already released the entry (last `HostValueArc` clone - * dropped → Rust `host_release_callback` fired → `_releaseHostError` + * dropped → Rust `host_release_callback` fired → `_releaseHostValue` * removed the entry); * - the key was minted by a different Node process (cross-runtime handle). * @@ -97,18 +99,18 @@ export function registerHostError(err: unknown): HandleKey { * emitting an outbound proto referencing its key — the outbound encode * holds a strong handle through proto serialization, and the release tsfn * isn't fired until that strong handle drops. By the time the TS decoder - * runs `tryRehydrateFromHandle`, the only way the map entry is gone is if + * runs `tryRehydrateHostValueByKey`, the only way the map entry is gone is if * a *prior* outbound completed and the engine has since dropped its last * Arc; in that case the user has already observed the original throw at * least once, so a second lookup-miss → metadata-fallback is acceptable. */ -export function lookupHostError(key: bigint): unknown { - return errorMap.get(key); +export function lookupHostValue(key: bigint): unknown { + return hostValueMap.get(key); } /** * Convenience for the outbound decoder: if `handle` is a `BamlHandle` - * tagged `HOST_VALUE_ERROR`, look up the originating JS error object in + * tagged `HOST_VALUE_OPAQUE`, look up the originating JS value in * the registry and return it. Returns `undefined` for any other handle * type, a non-`BamlHandle` argument, or a key that doesn't resolve. * @@ -116,23 +118,23 @@ export function lookupHostError(key: bigint): unknown { * exception when a BAML-thrown `baml.errors.HostCallable` propagates back * to the same Node process that originated it. */ -export function tryRehydrateFromHandle(handle: unknown): unknown { +export function tryRehydrateHostValueByKey(handle: unknown): unknown { if (!(handle instanceof BamlHandle)) return undefined; - if (handle.handleType !== BamlHandleType.HOST_VALUE_ERROR) return undefined; - return lookupHostError(handleKeyToBigint(handle.key)); + if (handle.handleType !== BamlHandleType.HOST_VALUE_OPAQUE) return undefined; + return lookupHostValue(handleKeyToBigint(handle.key)); } /** * Internal: remove the map entry for `key`. Wired at module init as the * Rust-side release callback. Idempotent and absent-key-safe so the same * callback can be invoked for *every* `HostValueArc` release (including - * callable keys, which never have a TS-side error entry). + * callable keys, which never have a TS-side host-value entry). */ -function _releaseHostError(key: HandleKey): void { - errorMap.delete(handleKeyToBigint(key)); +function _releaseHostValue(key: HandleKey): void { + hostValueMap.delete(handleKeyToBigint(key)); } // Install the Rust-side release callback exactly once at module load. The // napi function is itself first-call-wins on the Rust side, so reloads // (e.g. test harnesses) are harmless. -registerErrorReleaseCallback(_releaseHostError); +registerHostValueReleaseCallback(_releaseHostValue); diff --git a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/native.d.ts b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/native.d.ts index 35fb4ce422..2fea8f16c7 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/native.d.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/native.d.ts @@ -235,19 +235,33 @@ export interface HandleKey { } /** - * Mint a fresh host-value key, drawing from the shared callable+error + * Mint a fresh host-value key, drawing from the shared callable+opaque * counter so the engine sees one globally-unique keyspace. Returned to - * TS by `registerHostError` (the TS-side function in - * `host_error_registry.ts`). + * TS by `registerHostOpaque` (the TS-side function in + * `host_value_registry.ts`). * - * Exposed to JS as `mintHostErrorKey() -> HandleKey`. The TS-side error - * registry calls this once per `registerHostError(err)` before inserting - * the error into its `Map`. + * Exposed to JS as `mintHostValueKey() -> HandleKey`. The TS-side host-value + * registry calls this once per `registerHostOpaque(value)` before inserting + * the value into its `Map`. */ -export declare function mintHostErrorKey(): HandleKey +export declare function mintHostValueKey(): HandleKey export declare function newFunctionCall(): string +/** + * Register a JS dispatch wrapper in the host-value table and return its key. + * + * Exposed to JS as `registerHostCallable(fn) -> HandleKey`. Called from + * the inbound encoder in `typescript_src/proto.ts` whenever a JS callable + * appears as a kwarg — the encoder constructs the dispatch wrapper around + * the user's function before calling this. + * + * The `Function` is converted into a `ThreadsafeFunction` so it can outlive + * the napi call scope and be invoked from any thread (the engine's tokio + * runtime calls into this entry point from a worker thread). + */ +export declare function registerHostCallable(callable: (callId: number, argsBytes: Buffer) => void): HandleKey + /** * Install the TS-side release callback. First-call-wins; subsequent * calls are a no-op (matching the bridge_cffi dispatch-registration @@ -271,24 +285,10 @@ export declare function newFunctionCall(): string * host callback awaiting completion *must* keep the loop alive so the * JS callback can actually run. * - * Exposed to JS as `registerErrorReleaseCallback(cb)`. Must be called + * Exposed to JS as `registerHostValueReleaseCallback(cb)`. Must be called * exactly once at SDK module init, before any host call is dispatched. */ -export declare function registerErrorReleaseCallback(callback: (key: HandleKey) => void): void - -/** - * Register a JS dispatch wrapper in the host-value table and return its key. - * - * Exposed to JS as `registerHostCallable(fn) -> HandleKey`. Called from - * the inbound encoder in `typescript_src/proto.ts` whenever a JS callable - * appears as a kwarg — the encoder constructs the dispatch wrapper around - * the user's function before calling this. - * - * The `Function` is converted into a `ThreadsafeFunction` so it can outlive - * the napi call scope and be invoked from any thread (the engine's tokio - * runtime calls into this entry point from a worker thread). - */ -export declare function registerHostCallable(callable: (callId: number, argsBytes: Buffer) => void): HandleKey +export declare function registerHostValueReleaseCallback(callback: (key: HandleKey) => void): void /** * Release a host callable the inbound encoder registered but never handed to diff --git a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts index cd605aa37d..3a2b14da03 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto.ts @@ -19,9 +19,9 @@ import { import { BamlStream } from './stream.js'; import { BamlAbortError, BamlCancelledError, BamlError, BamlPanic } from './errors.js'; import { - registerHostError, - tryRehydrateFromHandle, -} from './host_error_registry.js'; + registerHostOpaque, + tryRehydrateHostValueByKey, +} from './host_value_registry.js'; import { BamlTypeMap, getTypeMap } from './typemap.js'; const CallFunctionArgs = baml_core.cffi.v1.CallFunctionArgs; @@ -516,7 +516,7 @@ export function decodeCallResult(data: Buffer | Uint8Array): unknown { const { value, className, message } = decodeThrown(result.error?.value); const trace = result.error?.trace ?? []; // Same-host rehydration: a `baml.errors.HostCallable` carrying a - // `_handle` that still resolves in this process's host-error + // `_handle` that still resolves in this process's host-value // registry re-throws the *original* JS error object the bridge // registered on the inbound throw — preserving `raised === caught` // identity. Foreign runtimes (a different Node process, the @@ -524,7 +524,7 @@ export function decodeCallResult(data: Buffer | Uint8Array): unknown { // metadata-bearing `BamlError(HostCallable)` wrapper below. if (className === 'baml.errors.HostCallable' && value !== null && typeof value === 'object') { const handle = (value as Record)._handle; - const original = tryRehydrateFromHandle(handle); + const original = tryRehydrateHostValueByKey(handle); if (original !== undefined) { throw original; } @@ -696,7 +696,7 @@ function buildHostCallableInbound( value: InboundValue.create({ handle: { key: handleKey, - handleType: BamlHandleType.HOST_VALUE_ERROR, + handleType: BamlHandleType.HOST_VALUE_OPAQUE, }, }), }); @@ -719,7 +719,7 @@ function buildHostCallableInbound( // Sentinel `_handle` key used by paths that have *no* JS error object to // register (the `completeHostCallLastResort` fallback below). Real host -// throws register the JS error via `registerHostError` and emit its +// throws register the JS error via `registerHostOpaque` and emit its // minted key; engine-internal synthetic faults use this sentinel. The // engine's structural check accepts either; same-host decoders that look // up `{low:0,high:0}` find nothing and fall through to the @@ -798,14 +798,14 @@ function sendHostCallableError(callId: number, err: unknown): void { // throw when given a hostile input (e.g. a Proxy whose `constructor`, // `name`, or `message` getters throw — see the // `host-callable always completes on abnormal paths` jest suite). - // In that case `registerHostError` is never reached, control jumps + // In that case `registerHostOpaque` is never reached, control jumps // to the outer `catch (innerErr)` → `completeHostCallLastResort`, // and the user sees a metadata-only `HostCallable` instead of the // original Proxy. Identity loss here is the right trade — the // alternative is hanging the call. // // Registration-leak edge case (rare, bounded): if encoding succeeds - // through `registerHostError` but `buildHostCallableInbound` or + // through `registerHostOpaque` but `buildHostCallableInbound` or // `InboundValue.encode` fails after, the TS map entry stays alive // with no corresponding engine-side `HostValueArc` to release it, // so it lives until process exit. Both downstream calls are deeply @@ -813,7 +813,7 @@ function sendHostCallableError(callId: number, err: unknown): void { // and don't depend on `err`'s shape, so this is effectively // unreachable outside protobufjs / native-binding corruption. const { className, message, stack } = describeError(err); - const handleKey = registerHostError(err); + const handleKey = registerHostOpaque(err); const inbound = buildHostCallableInbound(className, message, stack, handleKey); const bytes = Buffer.from(InboundValue.encode(inbound).finish()); completeHostCall(callId, 1, bytes); diff --git a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.d.ts b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.d.ts index 771478719c..c37f5ce1b8 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.d.ts +++ b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.d.ts @@ -32,7 +32,7 @@ export namespace baml_core { ADT_TYPE = 13, ADT_TAGGED_HEAP_HANDLE = 14, HOST_VALUE_CALLABLE = 15, - HOST_VALUE_ERROR = 16 + HOST_VALUE_OPAQUE = 16 } /** Properties of a BamlHandle. */ diff --git a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.js b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.js index 9f320f518d..251fe7a02e 100644 --- a/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.js +++ b/baml_language/sdks/nodejs/bridge_nodejs/typescript_src/proto/baml_cffi.js @@ -59,7 +59,7 @@ export const baml_core = $root.baml_core = (() => { * @property {number} ADT_TYPE=13 ADT_TYPE value * @property {number} ADT_TAGGED_HEAP_HANDLE=14 ADT_TAGGED_HEAP_HANDLE value * @property {number} HOST_VALUE_CALLABLE=15 HOST_VALUE_CALLABLE value - * @property {number} HOST_VALUE_ERROR=16 HOST_VALUE_ERROR value + * @property {number} HOST_VALUE_OPAQUE=16 HOST_VALUE_OPAQUE value */ v1.BamlHandleType = (function() { const valuesById = {}, values = Object.create(valuesById); @@ -77,7 +77,7 @@ export const baml_core = $root.baml_core = (() => { values[valuesById[13] = "ADT_TYPE"] = 13; values[valuesById[14] = "ADT_TAGGED_HEAP_HANDLE"] = 14; values[valuesById[15] = "HOST_VALUE_CALLABLE"] = 15; - values[valuesById[16] = "HOST_VALUE_ERROR"] = 16; + values[valuesById[16] = "HOST_VALUE_OPAQUE"] = 16; return values; })(); @@ -358,7 +358,7 @@ export const baml_core = $root.baml_core = (() => { case 15: message.handleType = 15; break; - case "HOST_VALUE_ERROR": + case "HOST_VALUE_OPAQUE": case 16: message.handleType = 16; break; @@ -4923,7 +4923,7 @@ export const baml_core = $root.baml_core = (() => { case 15: message.handleType = 15; break; - case "HOST_VALUE_ERROR": + case "HOST_VALUE_OPAQUE": case 16: message.handleType = 16; break; diff --git a/baml_language/sdks/python/rust/bridge_python/src/host_value.rs b/baml_language/sdks/python/rust/bridge_python/src/host_value.rs index 49857e3607..ef4244df4d 100644 --- a/baml_language/sdks/python/rust/bridge_python/src/host_value.rs +++ b/baml_language/sdks/python/rust/bridge_python/src/host_value.rs @@ -99,17 +99,17 @@ pub fn register_host_callable(callable: Py) -> u64 { key } -/// Insert a Python exception object into the registry and return its key. +/// Insert an arbitrary host Python object into the registry and return its key. /// -/// Used by the host-throw path to register the originating native +/// The host-throw path uses this to register the originating native /// exception so the BAML→host decoder on the same runtime can resolve /// the `_handle` slot of a `baml.errors.HostCallable` back to the /// original Python object on round-trip. The table is shared with /// callable entries (keys are globally unique), and the same /// `host_release_callback` releases either kind on last-Arc-drop. -fn register_host_error(exc: Py) -> u64 { +fn register_host_opaque(value: Py) -> u64 { let key = next_key(); - REGISTRY.table.lock().unwrap().insert(key, exc); + REGISTRY.table.lock().unwrap().insert(key, value); key } @@ -153,7 +153,7 @@ pub extern "C" fn host_release_callback(host_value_key: u64) { /// Look up the host-registered Python object referenced by a /// `BamlPyHandle` whose `handle_type` is `HOST_VALUE_CALLABLE` / -/// `HOST_VALUE_ERROR`, returning a fresh strong reference if the entry +/// `HOST_VALUE_OPAQUE`, returning a fresh strong reference if the entry /// is still live. Used by the outbound error decoder in /// `baml_core.proto` to rehydrate a `baml.errors.HostCallable` thrown /// by BAML back to the original Python exception object on same-host @@ -172,7 +172,7 @@ pub fn lookup_host_value( use bridge_ctypes::baml_core::cffi::BamlHandleType; let ht_i32 = i32::try_from(handle.handle_type).ok()?; if ht_i32 != BamlHandleType::HostValueCallable as i32 - && ht_i32 != BamlHandleType::HostValueError as i32 + && ht_i32 != BamlHandleType::HostValueOpaque as i32 { return None; } @@ -462,9 +462,9 @@ fn send_dispatch_success(call_id: u32, bytes: &[u8]) { /// Build an `InboundValue` carrying a `baml.errors.HostCallable` Instance. /// `handle_key` references the originating native exception in the -/// process-global registry (set by [`register_host_error`]); the BAML +/// process-global registry (set by [`register_host_opaque`]); the BAML /// class's `_handle` field carries it as a `BamlHandle` of type -/// `HOST_VALUE_ERROR` so a same-host decoder can rehydrate the exact +/// `HOST_VALUE_OPAQUE` so a same-host decoder can rehydrate the exact /// Python exception object on round-trip. The remaining /// `class_name` / `message` / `language` / `traceback` fields are /// metadata for debugging/printing/user convenience and do not @@ -488,7 +488,7 @@ fn build_host_callable_inbound( value: Some(InboundValue { value: Some(InboundValueVariant::Handle(BamlHandle { key: handle_key, - handle_type: BamlHandleType::HostValueError as i32, + handle_type: BamlHandleType::HostValueOpaque as i32, })), }), }; @@ -627,7 +627,7 @@ fn send_dispatch_error_from_pyerr(call_id: u32, py: Python<'_>, py_err: &pyo3::P // host-value table so the BAML→host decoder on this runtime can // resolve `_handle` back to the original `ValueError`/`KeyError`/... // object on round-trip. - let handle_key = register_host_error(py_err.value(py).clone().unbind().into_any()); + let handle_key = register_host_opaque(py_err.value(py).clone().unbind().into_any()); let bytes = build_host_callable_inbound(&class_name, &message, traceback.as_deref(), handle_key) diff --git a/baml_language/sdks/python/rust/bridge_python/src/py_handle.rs b/baml_language/sdks/python/rust/bridge_python/src/py_handle.rs index aeb9da7ac7..4b3c3dbe9d 100644 --- a/baml_language/sdks/python/rust/bridge_python/src/py_handle.rs +++ b/baml_language/sdks/python/rust/bridge_python/src/py_handle.rs @@ -97,7 +97,7 @@ impl BamlPyHandle { impl Drop for BamlPyHandle { fn drop(&mut self) { - // Host-owned handles (`HostValueCallable`, `HostValueError`) are + // Host-owned handles (`HostValueCallable`, `HostValueOpaque`) are // *not* tracked in `HANDLE_TABLE` — their lifetime is managed // per-bridge via the host-value registry (see // [`crate::host_value::lookup_host_value`]). Releasing them here @@ -111,7 +111,7 @@ impl Drop for BamlPyHandle { use bridge_ctypes::baml_core::cffi::BamlHandleType; let ht_i32 = i32::try_from(self.handle_type).unwrap_or(-1); let is_host_value = ht_i32 == BamlHandleType::HostValueCallable as i32 - || ht_i32 == BamlHandleType::HostValueError as i32; + || ht_i32 == BamlHandleType::HostValueOpaque as i32; if !is_host_value { let _ = unsafe { baml_handle_release(self.handle_key) }; } diff --git a/baml_language/sdks/python/src/baml_core/baml_py.pyi b/baml_language/sdks/python/src/baml_core/baml_py.pyi index a4c07717a7..0437ca13ce 100644 --- a/baml_language/sdks/python/src/baml_core/baml_py.pyi +++ b/baml_language/sdks/python/src/baml_core/baml_py.pyi @@ -451,7 +451,7 @@ def lookup_host_value(handle: BamlPyHandle) -> typing.Optional[typing.Any]: r""" Look up the host-registered Python object referenced by a `BamlPyHandle` whose `handle_type` is `HOST_VALUE_CALLABLE` / - `HOST_VALUE_ERROR`, returning a fresh strong reference if the entry + `HOST_VALUE_OPAQUE`, returning a fresh strong reference if the entry is still live. Used by the outbound error decoder in `baml_core.proto` to rehydrate a `baml.errors.HostCallable` thrown by BAML back to the original Python exception object on same-host diff --git a/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.py b/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.py index ef653a40db..135be0f7dc 100644 --- a/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.py +++ b/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.py @@ -24,7 +24,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$baml_core/cffi/v1/baml_inbound.proto\x12\x11\x62\x61ml_core.cffi.v1\"Q\n\nBamlHandle\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\x36\n\x0bhandle_type\x18\x02 \x01(\x0e\x32!.baml_core.cffi.v1.BamlHandleType\"\xc8\x03\n\x0cInboundValue\x12\x16\n\x0cstring_value\x18\x02 \x01(\tH\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x01H\x00\x12\x14\n\nbool_value\x18\x05 \x01(\x08H\x00\x12\x39\n\nlist_value\x18\x06 \x01(\x0b\x32#.baml_core.cffi.v1.InboundListValueH\x00\x12\x37\n\tmap_value\x18\x07 \x01(\x0b\x32\".baml_core.cffi.v1.InboundMapValueH\x00\x12;\n\x0b\x63lass_value\x18\x08 \x01(\x0b\x32$.baml_core.cffi.v1.InboundClassValueH\x00\x12\x39\n\nenum_value\x18\t \x01(\x0b\x32#.baml_core.cffi.v1.InboundEnumValueH\x00\x12/\n\x06handle\x18\n \x01(\x0b\x32\x1d.baml_core.cffi.v1.BamlHandleH\x00\x12\x1a\n\x10uint8array_value\x18\x0b \x01(\x0cH\x00\x12\x16\n\x0c\x62igint_value\x18\x0c \x01(\tH\x00\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02\"C\n\x10InboundListValue\x12/\n\x06values\x18\x01 \x03(\x0b\x32\x1f.baml_core.cffi.v1.InboundValue\"F\n\x0fInboundMapValue\x12\x33\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\".baml_core.cffi.v1.InboundMapEntry\"\xbe\x01\n\x0fInboundMapEntry\x12\x14\n\nstring_key\x18\x01 \x01(\tH\x00\x12\x11\n\x07int_key\x18\x02 \x01(\x03H\x00\x12\x12\n\x08\x62ool_key\x18\x03 \x01(\x08H\x00\x12\x37\n\x08\x65num_key\x18\x05 \x01(\x0b\x32#.baml_core.cffi.v1.InboundEnumValueH\x00\x12.\n\x05value\x18\x06 \x01(\x0b\x32\x1f.baml_core.cffi.v1.InboundValueB\x05\n\x03key\"U\n\x11InboundClassValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x32\n\x06\x66ields\x18\x02 \x03(\x0b\x32\".baml_core.cffi.v1.InboundMapEntry\"/\n\x10InboundEnumValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"W\n\x10\x43\x61llFunctionArgs\x12\x32\n\x06kwargs\x18\x01 \x03(\x0b\x32\".baml_core.cffi.v1.InboundMapEntry\x12\x0f\n\x07\x63\x61ll_id\x18\x02 \x01(\x04\"&\n\x07\x43\x61llAck\x12\x0f\n\x05\x65rror\x18\x01 \x01(\tH\x00\x42\n\n\x08response*\xde\x02\n\x0e\x42\x61mlHandleType\x12\x16\n\x12HANDLE_UNSPECIFIED\x10\x00\x12\x16\n\x12UNTAGGED_RUST_DATA\x10\x01\x12\x15\n\x11UNTAGGED_BEX_HEAP\x10\x02\x12\x10\n\x0c\x46UNCTION_REF\x10\x05\x12\x13\n\x0f\x41\x44T_MEDIA_IMAGE\x10\x06\x12\x13\n\x0f\x41\x44T_MEDIA_AUDIO\x10\x07\x12\x13\n\x0f\x41\x44T_MEDIA_VIDEO\x10\x08\x12\x11\n\rADT_MEDIA_PDF\x10\t\x12\x15\n\x11\x41\x44T_MEDIA_GENERIC\x10\n\x12\x12\n\x0e\x41\x44T_PROMPT_AST\x10\x0b\x12\x11\n\rADT_COLLECTOR\x10\x0c\x12\x0c\n\x08\x41\x44T_TYPE\x10\r\x12\x1a\n\x16\x41\x44T_TAGGED_HEAP_HANDLE\x10\x0e\x12\x17\n\x13HOST_VALUE_CALLABLE\x10\x0f\x12\x14\n\x10HOST_VALUE_ERROR\x10\x10\"\x04\x08\x03\x10\x03\"\x04\x08\x04\x10\x04\x42\x08Z\x06./cffib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$baml_core/cffi/v1/baml_inbound.proto\x12\x11\x62\x61ml_core.cffi.v1\"Q\n\nBamlHandle\x12\x0b\n\x03key\x18\x01 \x01(\x04\x12\x36\n\x0bhandle_type\x18\x02 \x01(\x0e\x32!.baml_core.cffi.v1.BamlHandleType\"\xc8\x03\n\x0cInboundValue\x12\x16\n\x0cstring_value\x18\x02 \x01(\tH\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x04 \x01(\x01H\x00\x12\x14\n\nbool_value\x18\x05 \x01(\x08H\x00\x12\x39\n\nlist_value\x18\x06 \x01(\x0b\x32#.baml_core.cffi.v1.InboundListValueH\x00\x12\x37\n\tmap_value\x18\x07 \x01(\x0b\x32\".baml_core.cffi.v1.InboundMapValueH\x00\x12;\n\x0b\x63lass_value\x18\x08 \x01(\x0b\x32$.baml_core.cffi.v1.InboundClassValueH\x00\x12\x39\n\nenum_value\x18\t \x01(\x0b\x32#.baml_core.cffi.v1.InboundEnumValueH\x00\x12/\n\x06handle\x18\n \x01(\x0b\x32\x1d.baml_core.cffi.v1.BamlHandleH\x00\x12\x1a\n\x10uint8array_value\x18\x0b \x01(\x0cH\x00\x12\x16\n\x0c\x62igint_value\x18\x0c \x01(\tH\x00\x42\x07\n\x05valueJ\x04\x08\x01\x10\x02\"C\n\x10InboundListValue\x12/\n\x06values\x18\x01 \x03(\x0b\x32\x1f.baml_core.cffi.v1.InboundValue\"F\n\x0fInboundMapValue\x12\x33\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\".baml_core.cffi.v1.InboundMapEntry\"\xbe\x01\n\x0fInboundMapEntry\x12\x14\n\nstring_key\x18\x01 \x01(\tH\x00\x12\x11\n\x07int_key\x18\x02 \x01(\x03H\x00\x12\x12\n\x08\x62ool_key\x18\x03 \x01(\x08H\x00\x12\x37\n\x08\x65num_key\x18\x05 \x01(\x0b\x32#.baml_core.cffi.v1.InboundEnumValueH\x00\x12.\n\x05value\x18\x06 \x01(\x0b\x32\x1f.baml_core.cffi.v1.InboundValueB\x05\n\x03key\"U\n\x11InboundClassValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x32\n\x06\x66ields\x18\x02 \x03(\x0b\x32\".baml_core.cffi.v1.InboundMapEntry\"/\n\x10InboundEnumValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"W\n\x10\x43\x61llFunctionArgs\x12\x32\n\x06kwargs\x18\x01 \x03(\x0b\x32\".baml_core.cffi.v1.InboundMapEntry\x12\x0f\n\x07\x63\x61ll_id\x18\x02 \x01(\x04\"&\n\x07\x43\x61llAck\x12\x0f\n\x05\x65rror\x18\x01 \x01(\tH\x00\x42\n\n\x08response*\xdf\x02\n\x0e\x42\x61mlHandleType\x12\x16\n\x12HANDLE_UNSPECIFIED\x10\x00\x12\x16\n\x12UNTAGGED_RUST_DATA\x10\x01\x12\x15\n\x11UNTAGGED_BEX_HEAP\x10\x02\x12\x10\n\x0c\x46UNCTION_REF\x10\x05\x12\x13\n\x0f\x41\x44T_MEDIA_IMAGE\x10\x06\x12\x13\n\x0f\x41\x44T_MEDIA_AUDIO\x10\x07\x12\x13\n\x0f\x41\x44T_MEDIA_VIDEO\x10\x08\x12\x11\n\rADT_MEDIA_PDF\x10\t\x12\x15\n\x11\x41\x44T_MEDIA_GENERIC\x10\n\x12\x12\n\x0e\x41\x44T_PROMPT_AST\x10\x0b\x12\x11\n\rADT_COLLECTOR\x10\x0c\x12\x0c\n\x08\x41\x44T_TYPE\x10\r\x12\x1a\n\x16\x41\x44T_TAGGED_HEAP_HANDLE\x10\x0e\x12\x17\n\x13HOST_VALUE_CALLABLE\x10\x0f\x12\x15\n\x11HOST_VALUE_OPAQUE\x10\x10\"\x04\x08\x03\x10\x03\"\x04\x08\x04\x10\x04\x42\x08Z\x06./cffib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -33,7 +33,7 @@ _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z\006./cffi' _globals['_BAMLHANDLETYPE']._serialized_start=1201 - _globals['_BAMLHANDLETYPE']._serialized_end=1551 + _globals['_BAMLHANDLETYPE']._serialized_end=1552 _globals['_BAMLHANDLE']._serialized_start=59 _globals['_BAMLHANDLE']._serialized_end=140 _globals['_INBOUNDVALUE']._serialized_start=143 diff --git a/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.pyi b/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.pyi index 11314929d1..f6b6bab6a5 100644 --- a/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.pyi +++ b/baml_language/sdks/python/src/baml_core/cffi/v1/baml_inbound_pb2.pyi @@ -23,7 +23,7 @@ class BamlHandleType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): ADT_TYPE: _ClassVar[BamlHandleType] ADT_TAGGED_HEAP_HANDLE: _ClassVar[BamlHandleType] HOST_VALUE_CALLABLE: _ClassVar[BamlHandleType] - HOST_VALUE_ERROR: _ClassVar[BamlHandleType] + HOST_VALUE_OPAQUE: _ClassVar[BamlHandleType] HANDLE_UNSPECIFIED: BamlHandleType UNTAGGED_RUST_DATA: BamlHandleType UNTAGGED_BEX_HEAP: BamlHandleType @@ -38,7 +38,7 @@ ADT_COLLECTOR: BamlHandleType ADT_TYPE: BamlHandleType ADT_TAGGED_HEAP_HANDLE: BamlHandleType HOST_VALUE_CALLABLE: BamlHandleType -HOST_VALUE_ERROR: BamlHandleType +HOST_VALUE_OPAQUE: BamlHandleType class BamlHandle(_message.Message): __slots__ = ("key", "handle_type") diff --git a/baml_language/sdks/python/src/baml_core/proto.py b/baml_language/sdks/python/src/baml_core/proto.py index e587ab8590..2cecb9ae94 100644 --- a/baml_language/sdks/python/src/baml_core/proto.py +++ b/baml_language/sdks/python/src/baml_core/proto.py @@ -690,7 +690,7 @@ def decode_value(holder, type_map: BamlTypeMap) -> Any: return None -def _try_rehydrate_host_callable(decoded: Any) -> Optional[BaseException]: +def _try_rehydrate_host_value(decoded: Any) -> Optional[BaseException]: """If `decoded` is a `baml.errors.HostCallable` pydantic instance whose `_handle` points at a still-live entry in this runtime's host-value registry, return the *original* Python exception object. @@ -749,7 +749,7 @@ def decode_call_result(data: bytes) -> Any: # released keys (last `HostValueArc` clone already dropped) fall # through to the metadata-bearing `BamlError` wrapper below. if _outbound_class_fqn(msg.value) == "baml.errors.HostCallable": - rehydrated = _try_rehydrate_host_callable(decoded) + rehydrated = _try_rehydrate_host_value(decoded) if rehydrated is not None: raise attach_baml_traceback(rehydrated) raise attach_baml_traceback(