Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build2-nodejs-sdk.reusable.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: BAML SDK Release - Build Node.js

# Per-platform NAPI prebuild matrix for the Node.js SDK runtime package
# `@boundaryml/baml-core-node`. Mirrors `build2-python-sdk.reusable.yaml` (same
# `@boundaryml/baml-bridge`. Mirrors `build2-python-sdk.reusable.yaml` (same
# 8-target set), with `napi-rs` standing in for `maturin`. Each job builds one
# `*.node` native addon, assembles it into its publishable per-platform sub-package
# (`@boundaryml/baml-core-node-<platform>`), and uploads that as `nodejs-sdk-<target>`.
# (`@boundaryml/baml-bridge-<platform>`), and uploads that as `nodejs-sdk-<target>`.
# The publish-npm job downloads them all, wires the umbrella package's
# optionalDependencies, and publishes the umbrella + sub-packages.
# Release builds must pass the frozen BAML language release plan so package.json
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cargo-tests.reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ jobs:
echo "CARGO_BUILD_JOBS=16" >> "$GITHUB_ENV"
working-directory: baml_language

# Windows Python only: setup.ps1 builds one baml_core wheel and strips
# Windows Python only: setup.ps1 builds one baml_bridge wheel and strips
# the editable source block from each fixture so `uv sync` installs that
# prebuilt wheel instead of rebuilding baml_core per fixture. The later
# prebuilt wheel instead of rebuilding baml_bridge per fixture. The later
# test-time `uv run` processes also need this wheelhouse.
- name: "Configure Python wheelhouse"
if: matrix.os-label == 'windows' && matrix.sdk-label == 'python-pydantic2'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -631,12 +631,12 @@ jobs:
working-directory: baml_language

# Rust (prost) + Python (protoc) — both driven by bridge_ctypes/build.rs.
# Writes Python pb2/pyi into baml_language/sdks/python/src/baml_core/cffi/v1/.
# Writes Python pb2/pyi into baml_language/sdks/python/src/baml_bridge/cffi/v1/.
- name: "Generate Rust + Python proto bindings (bridge_ctypes)"
run: cargo build -p bridge_ctypes
working-directory: baml_language

# Go (protoc-gen-go) — writes into sdks/go/bridge_go/cffi/proto/baml_core/cffi/v1/.
# Go (protoc-gen-go) — writes into sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/.
- name: "Generate Go proto bindings (sdks/go/bridge_go)"
run: ./build.sh
working-directory: baml_language/sdks/go/bridge_go
Expand Down Expand Up @@ -667,7 +667,7 @@ jobs:
baml_language/sdks/nodejs/bridge_nodejs
baml_language/crates/bridge_ctypes
baml_language/sdks/go/bridge_go
baml_language/sdks/python/src/baml_core/cffi
baml_language/sdks/python/src/baml_bridge/cffi
typescript2/pkg-proto
)
README="baml_language/crates/bridge_ctypes/README.md"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish2-nodejs-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
echo "--- npmrc (auth lines, token redacted) ---"
npm config ls -l 2>/dev/null | grep -iE "registry|_authtoken|provenance|userconfig" | sed -E 's/(_authToken=).*/\1<redacted>/I' || true
echo "==============================="
echo "Publishing @boundaryml/baml-core-node packages with dist-tag '$tag'"
echo "Publishing @boundaryml/baml-bridge packages with dist-tag '$tag'"
# `npm publish --loglevel verbose` makes the OIDC keyless exchange visible
# in the log (a request to the id-token endpoint vs. just sending a token).
#
Expand Down
4 changes: 2 additions & 2 deletions baml_language/.config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ filter = 'package(=sdk_test_typescript_node)'
platform = { host = 'cfg(windows)' }
setup = 'typescript_node_pnpm_win'

# python tests need each fixture's venv synced with freshly-built baml_core.
# python tests need each fixture's venv synced with freshly-built baml_bridge.
# fire only when a python sdk-test is selected. Unix uses `uv sync` per
# fixture plus one incremental `maturin develop`; Windows builds one wheel
# first, then fixture `uv sync` installs that wheel to avoid duplicate
# editable baml_core builds.
# editable baml_bridge builds.
[scripts.setup.python_pydantic2_uv_unix]
command = './sdk_tests/crates/python_pydantic2/setup.sh'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ baml_sdk:
python:
summary: "Use BAML from Python via a generated Pydantic v2 SDK."
syntax: |
pip install baml_core # the runtime (Python 3.10+)
pip install baml_bridge # the runtime (Python 3.10+)

# baml.toml — declare a generator:
[generator.app]
Expand All @@ -756,7 +756,7 @@ python:

baml generate # emits the `baml_sdk` package into output_dir
details: |
You install `baml_core` (the runtime); you import `baml_sdk` (the generated
You install `baml_bridge` (the runtime); you import `baml_sdk` (the generated
code). Functions become top-level Python functions; classes/enums become
Pydantic models:

Expand All @@ -769,7 +769,7 @@ python:
typescript:
summary: "Use BAML from TypeScript / Node.js via a generated SDK."
syntax: |
npm install @boundaryml/baml-core-node # the runtime
npm install @boundaryml/baml-bridge # the runtime

# baml.toml — declare a generator:
[generator.app]
Expand Down
14 changes: 7 additions & 7 deletions baml_language/crates/baml_cli/src/init_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ name = "{name}"
# Uncomment this to generate the Python SDK.
#
# Note: you also need to install the BAML runtime bridge for Python:
# uv add baml_core
# pip install baml_core
# conda install -c conda-forge baml_core
# uv add baml_bridge
# pip install baml_bridge
# conda install -c conda-forge baml_bridge
#
# [generator.python_client]
# output_type = "python/pydantic"
Expand All @@ -185,10 +185,10 @@ name = "{name}"
# Uncomment this to generate the Node SDK.
#
# Note: you also need to install the BAML runtime bridge for Node.js:
# npm install @boundaryml/baml-core-node
# pnpm add @boundaryml/baml-core-node
# yarn add @boundaryml/baml-core-node
# bun add @boundaryml/baml-core-node
# npm install @boundaryml/baml-bridge
# pnpm add @boundaryml/baml-bridge
# yarn add @boundaryml/baml-bridge
# bun add @boundaryml/baml-bridge
#
# [generator.node_client]
# output_type = "typescript/node"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ expression: output
python — Use BAML from Python via a generated Pydantic v2 SDK.

Syntax:
pip install baml_core # the runtime (Python 3.10+)
pip install baml_bridge # the runtime (Python 3.10+)

# baml.toml — declare a generator:
[generator.app]
Expand All @@ -15,7 +15,7 @@ Syntax:

baml generate # emits the `baml_sdk` package into output_dir

You install `baml_core` (the runtime); you import `baml_sdk` (the generated
You install `baml_bridge` (the runtime); you import `baml_sdk` (the generated
code). Functions become top-level Python functions; classes/enums become
Pydantic models:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ expression: output
typescript — Use BAML from TypeScript / Node.js via a generated SDK.

Syntax:
npm install @boundaryml/baml-core-node # the runtime
npm install @boundaryml/baml-bridge # the runtime

# baml.toml — declare a generator:
[generator.app]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum OutputType {
/// Python with Pydantic v1 models.
#[strum(serialize = "python/pydantic/v1")]
PythonPydanticV1,
/// TypeScript + Node.js SDK (`@boundaryml/baml-core-node` runtime).
/// TypeScript + Node.js SDK (`@boundaryml/baml-bridge` runtime).
#[strum(serialize = "typescript/node")]
TypescriptNode,
}
Expand Down
2 changes: 1 addition & 1 deletion baml_language/crates/baml_codegen_types/src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub enum Ty {
/// Opaque Rust-managed state — `$rust_type` fields in stdlib stubs
/// (e.g. `Response._body`, `SseStream._handle`). Generators render
/// this as the host-language opaque-handle type (Python:
/// `baml.baml_core.BamlPyHandle`).
/// `baml.baml_bridge.BamlPyHandle`).
RustType,
}

Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/baml_release/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct VsixArtifact {
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BamlCorePypi {
pub struct BamlBridgePypi {
pub version: String,
}

Expand All @@ -38,7 +38,7 @@ pub struct ToolchainManifest {
#[serde(skip_serializing_if = "Option::is_none")]
pub vsix: Option<VsixArtifact>,
#[serde(skip_serializing_if = "Option::is_none")]
pub baml_core_pypi: Option<BamlCorePypi>,
pub baml_bridge_pypi: Option<BamlBridgePypi>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/bex_engine/src/trace_value_encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ fn bigint_to_hex(value: &str) -> String {

#[cfg(test)]
mod tests {
use bridge_ctypes::baml_core::cffi::{
use bridge_ctypes::baml_bridge::cffi::{
BamlOutboundValue, BamlTyPrimitiveKind, baml_outbound_value::Value as BamlValueVariant,
baml_ty,
};
Expand Down Expand Up @@ -807,7 +807,7 @@ mod tests {
assert_eq!(media.mime_type.as_deref(), Some("image/png"));
assert!(matches!(
media.value,
Some(bridge_ctypes::baml_core::cffi::baml_value_media::Value::Base64(_))
Some(bridge_ctypes::baml_bridge::cffi::baml_value_media::Value::Base64(_))
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use bex_engine::{
BexEngine, BexExternalValue, CancellationToken, EngineError, FunctionCallContextBuilder,
};
use bex_resource_types::{HostValueArc, HostValueKind};
use bridge_ctypes::baml_core::cffi::{BamlOutboundValue, BamlToHostCall, baml_outbound_value};
use bridge_ctypes::baml_bridge::cffi::{BamlOutboundValue, BamlToHostCall, baml_outbound_value};
use common::compile_for_engine;
use indexmap::IndexMap;
use prost::Message;
Expand Down
2 changes: 1 addition & 1 deletion baml_language/crates/bex_engine/tests/prof_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use bex_events::{
},
};
use bex_vm_types::{CaptureCategory, CaptureOption, FunctionCaptureProps, Object};
use bridge_ctypes::baml_core::cffi::{
use bridge_ctypes::baml_bridge::cffi::{
BamlOutboundValue, baml_outbound_value::Value as OutboundValue,
};
use common::compile_for_engine;
Expand Down
2 changes: 1 addition & 1 deletion baml_language/crates/bridge_cffi/src/baml_to_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::{panic::AssertUnwindSafe, sync::Arc};
use bex_project::{Bex, BexArgs, BexExternalValue, EngineError, FunctionCallContext, RuntimeError};
use bridge_ctypes::{
CffiHandleTableOptions,
baml_core::cffi::{
baml_bridge::cffi::{
BamlOutboundError, BamlOutboundPanic, BamlOutboundResult, baml_outbound_result,
},
external_to_outbound,
Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/bridge_cffi/src/ffi/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{ffi::CStr, ptr};
use bex_project::{BexExternalAdt, MediaKind, MediaValue};
use bridge_ctypes::{
CffiHandleTableEntry, HANDLE_TABLE,
baml_core::cffi::{BamlHandleType, MediaTypeEnum},
baml_bridge::cffi::{BamlHandleType, MediaTypeEnum},
};

use crate::Buffer;
Expand Down Expand Up @@ -357,7 +357,7 @@ pub unsafe extern "C" fn baml_media_mime_type(
mod tests {
use std::{ffi::CString, ptr};

use bridge_ctypes::baml_core::cffi::MediaTypeEnum;
use bridge_ctypes::baml_bridge::cffi::MediaTypeEnum;

use super::*;

Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/bridge_cffi/src/ffi/host_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! and bridge_cffi → sys_native is the one-way dependency direction.

use bex_project::{BexExternalValue, HostReleaseFn, host_release_dispatch};
use bridge_ctypes::{HANDLE_TABLE, baml_core::cffi::InboundValue, inbound_to_external};
use bridge_ctypes::{HANDLE_TABLE, baml_bridge::cffi::InboundValue, inbound_to_external};
use prost::Message;
use sys_native::host_dispatch;
/// Signature for invocation requests from BAML to the host.
Expand Down Expand Up @@ -305,7 +305,7 @@ mod tests {
/// pin the wire-side decode + delivery.
#[tokio::test]
async fn complete_host_call_throw_payload_delivers_external_value() {
use bridge_ctypes::baml_core::cffi::{
use bridge_ctypes::baml_bridge::cffi::{
BamlTyClass, InboundClassValue, InboundMapEntry, InboundValue,
inbound_map_entry::Key as InboundMapKey, inbound_value::Value as InboundValueVariant,
};
Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/bridge_cffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub mod host_spans;
mod panic;

pub use baml_to_host::{call_and_encode, error_to_outbound, result_to_outbound};
pub use bridge_ctypes::baml_core;
pub use bridge_ctypes::baml_bridge;
pub use buffer::Buffer;
pub use error::BridgeError;
pub use ffi::{
Expand Down Expand Up @@ -163,7 +163,7 @@ fn call_function_inner(
length: usize,
id: u32,
) -> Result<(), BridgeError> {
use bridge_ctypes::baml_core::cffi::CallFunctionArgs;
use bridge_ctypes::baml_bridge::cffi::CallFunctionArgs;

let runtime = get_runtime()?;

Expand Down
8 changes: 4 additions & 4 deletions baml_language/crates/bridge_ctypes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
```sh
# Rust (prost) + Python (protoc) — both driven by bridge_ctypes/build.rs
cargo build -p bridge_ctypes
# -> target/.../build/bridge_ctypes-*/out/baml_core.cffi.v1.rs
# -> sdks/python/src/baml_core/cffi/v1/*_pb2.py(i)
# -> target/.../build/bridge_ctypes-*/out/baml_bridge.cffi.v1.rs
# -> sdks/python/src/baml_bridge/cffi/v1/*_pb2.py(i)

# Node / TypeScript (protobufjs + napi loader)
cd sdks/nodejs/bridge_nodejs && pnpm build:debug
Expand All @@ -18,11 +18,11 @@ cd sdks/nodejs/bridge_nodejs && pnpm build:debug

# TypeScript (ts-proto / buf) — typescript2/pkg-proto consumer
cd typescript2/pkg-proto && pnpm generate
# -> typescript2/pkg-proto/src/generated/baml_core/cffi/v1/*.ts
# -> typescript2/pkg-proto/src/generated/baml_bridge/cffi/v1/*.ts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update pkg-proto imports for the renamed generated path

With this regenerated path now under src/generated/baml_bridge/..., the TypeScript consumer no longer matches its generated output: I checked typescript2/pkg-proto/src/{types,decode,encode,index}.ts and the tests, and they still import ./generated/baml_core/.... After cd typescript2/pkg-proto && pnpm generate, pnpm run typecheck fails with missing generated/baml_core modules, so webview/playground builds that regenerate pkg-proto will break unless those imports are renamed alongside the proto package.

Useful? React with 👍 / 👎.


# Go (protoc-gen-go)
cd sdks/go/bridge_go && ./build.sh
# -> sdks/go/bridge_go/cffi/proto/baml_core/cffi/v1/*.pb.go
# -> sdks/go/bridge_go/cffi/proto/baml_bridge/cffi/v1/*.pb.go
```

Other consumers (`bridge_cffi`, `bridge_wasm`, `sdks/python/rust/bridge_python`) use the Rust prost types via `bridge_ctypes` — nothing extra to regenerate.
Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/bridge_ctypes/src/handle_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{

use bex_project::{BexExternalAdt, BexExternalValue, Handle, MediaKind};

use crate::baml_core::cffi::BamlHandleType;
use crate::baml_bridge::cffi::BamlHandleType;

/// Newtype wrapper around opaque `$rust_type` objects
/// (`Arc<dyn Any + Send + Sync>`) stored as a handle.
Expand Down Expand Up @@ -215,7 +215,7 @@ mod tests {
use bex_project::{BexExternalValue, HostValueArc, HostValueKind};

use super::*;
use crate::{baml_core::cffi::baml_outbound_value::Value as BamlValueVariant, value_encode};
use crate::{baml_bridge::cffi::baml_outbound_value::Value as BamlValueVariant, value_encode};

fn make_function_ref() -> CffiHandleTableEntry {
CffiHandleTableEntry::FunctionRef { global_index: 42 }
Expand Down
4 changes: 2 additions & 2 deletions baml_language/crates/bridge_ctypes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ mod value_decode;
mod value_encode;

/// Generated protobuf module (CFFI / host value types).
pub mod baml_core {
pub mod baml_bridge {
pub mod cffi {
#![allow(clippy::doc_markdown, clippy::empty_structs_with_brackets)]
include!(concat!(env!("OUT_DIR"), "/baml_core.cffi.v1.rs"));
include!(concat!(env!("OUT_DIR"), "/baml_bridge.cffi.v1.rs"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion baml_language/crates/bridge_ctypes/src/traceback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/// Render a traceback as one string per frame, most-recent-call-last, for
/// carrying structured onto the wire (`repeated string trace` in
/// [`BamlOutboundPanic`](crate::baml_core::cffi::BamlOutboundPanic)). Each line
/// [`BamlOutboundPanic`](crate::baml_bridge::cffi::BamlOutboundPanic)). Each line
/// uses the per-frame format `File "<file>", line N, in <function_name>` —
/// without a `Traceback (most recent call last):` header and without
/// `\n`-joining, so the host can map each frame 1:1 onto a synthesized Python
Expand Down
2 changes: 1 addition & 1 deletion baml_language/crates/bridge_ctypes/src/ty_decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use bex_project::{BexExternalAdt, BexExternalValue};
use indexmap::IndexMap;

use crate::{
baml_core::cffi::{
baml_bridge::cffi::{
BamlTy, BamlTyArg, BamlTyFunctionParam, BamlTyFunctionParamMode, BamlTyMediaKind,
BamlTyPrimitiveKind, baml_ty::Ty as TyVariant,
baml_ty_literal::Literal as TyLiteralVariant,
Expand Down
Loading
Loading