Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
91eb27e
initial commit of rust v2 sdk
samuel100 Jun 22, 2026
3dcb833
bug fixes
samuel100 Jun 22, 2026
b76c4bd
WebGpu error fix
samuel100 Jun 24, 2026
d92a1e5
Make FoundryLocalManager a shared (Arc) resettable singleton
samuel100 Jun 24, 2026
8ef0679
Tie native handle lifetimes to the manager; serialize native create/r…
samuel100 Jun 24, 2026
3891878
Merge remote-tracking branch 'origin/main' into samuel100/sdkv2-rust
samuel100 Jun 24, 2026
ee7082c
Realign Rust FFI item vtable with new speech result types in C ABI
samuel100 Jun 24, 2026
c631717
Read speech result items in live audio transcription
samuel100 Jun 24, 2026
f129168
Address PR #836 review comments (sdk_v2/rust)
samuel100 Jun 29, 2026
f754f7d
Merge remote-tracking branch 'origin/main' into samuel100/sdkv2-rust
samuel100 Jul 27, 2026
bb939b1
Add idiomatic Session/Item/Request/Response inference API to Rust SDK
samuel100 Jul 27, 2026
c1c7793
Fix OpenAI direct chat request JSON and deprecate OpenAI direct clien…
samuel100 Jul 27, 2026
e06ff9e
samples(rust): migrate SDK examples to the Session API
samuel100 Jul 27, 2026
9de7fe0
fix(rust): resolve Copilot PR review comments
samuel100 Jul 30, 2026
2d8203b
Fix manager singleton lifetime when derived handles outlive the outer…
samuel100 Jul 30, 2026
fc497a9
Align Rust SDK to unified single runtime package (drop WinML flavor)
samuel100 Jul 30, 2026
a9df530
Add sdk_v2 Rust SDK CI/CD pipeline (build/test/pack parity)
samuel100 Jul 30, 2026
1dc1670
Fix Rust toolchain setup in v2 pipeline
samuel100 Aug 5, 2026
008a51a
Merge main into Rust SDK branch
samuel100 Aug 5, 2026
51fcd6c
Update Rust SDK for current ORT packages
samuel100 Aug 5, 2026
0eee006
Stabilize Rust SDK integration tests
samuel100 Aug 5, 2026
65ed610
Release Rust test manager before process teardown
samuel100 Aug 5, 2026
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
62 changes: 51 additions & 11 deletions .pipelines/v2/sdk_v2-pipeline-plan.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# sdk_v2 pipeline reference

Reference for the CI/CD pipeline that builds, tests, and packs the
`sdk_v2/` C++ runtime, C# SDK, and Python SDK. Documents the as-built
shape of the pipeline, the architectural decisions behind it, and the
`sdk_v2/` C++ runtime, C# SDK, Python SDK, and Rust SDK. Documents the
as-built shape of the pipeline, the architectural decisions behind it, and the
operational details (artifact names, version contracts, pinned dependency
versions) needed to maintain it.

## Scope

In scope: `sdk_v2/cpp` (native runtime), `sdk_v2/cs/src` (C# SDK),
`sdk_v2/python` (Python SDK). The C++ SDK is the native runtime dependency
for both C# (via NuGet) and Python (bundled in the wheel), replacing the
legacy `foundry-local-core` from neutron-server.
`sdk_v2/python` (Python SDK), `sdk_v2/rust` (Rust SDK). The C++ SDK is the
native runtime dependency for C# (via NuGet), Python (bundled in the wheel),
and Rust (assembled by the crate build script), replacing the legacy
`foundry-local-core` from neutron-server.

JS is documented separately in `sdk_v2-js-pipeline-plan.md`. Rust and a standalone
`foundry-local-runtime` Python wheel remain out of scope.
JS is documented separately in `sdk_v2-js-pipeline-plan.md`. A standalone
`foundry-local-runtime` Python wheel remains out of scope.

## Top-level pipelines

Expand Down Expand Up @@ -128,11 +129,12 @@ are gated separately via `.pipelines/v1/templates/stages-sdk-v1.yml`.
```
.pipelines/v2/
└── templates/
├── stages-sdk-v2.yml # Coordinator: native + C# + Python + JS
├── stages-sdk-v2.yml # Coordinator: native + C# + Python + JS + Rust
├── stages-build-native.yml # 5 native build stages + C++/NuGet pack stages
├── stages-cs.yml # C# build + test
├── stages-python.yml # Python build + test
├── stages-js.yml # JS build + test + combined npm pack
├── stages-rust.yml # Rust build+test (5 platforms) + crate pack
├── steps-prefetch-nuget.yml # ORT/GenAI/WinML NuGet pre-fetch (pwsh + bash)
├── steps-build-windows.yml # arch: x64 | arm64 (always bundles WinML)
├── steps-build-linux.yml
Expand All @@ -141,6 +143,7 @@ are gated separately via `.pipelines/v1/templates/stages-sdk-v1.yml`.
├── steps-test-cs.yml # restore + build + run tests
├── steps-build-python.yml # pass-through copy + python -m build --wheel
├── steps-test-python.yml # install wheel + pytest
├── steps-build-rust.yml # toolchain + native assembly + fmt/clippy/build/test
└── steps-pack-nuget.yml # Runs sdk_v2/cpp/nuget/pack.py
```

Expand All @@ -166,6 +169,12 @@ compute_version
|-- python_build_linux_x64 ----> python_test_linux_x64
|-- python_build_linux_arm64 --> python_test_linux_arm64
+-- python_build_osx_arm64 ----> python_test_osx_arm64
|
|-- rust_build_win_x64 ---------+ (build + unit + integration)
|-- rust_build_win_arm64 -------| (cross build-only)
|-- rust_build_linux_x64 -------+--> rust_pack_crate
|-- rust_build_linux_arm64 -----|
+-- rust_build_osx_arm64 -------+
```

* All build stages are independent (`dependsOn: [compute_version]`) and run
Expand All @@ -192,6 +201,36 @@ Published via 1ES `templateContext.outputs` (no manual `PublishPipelineArtifact`
| `cpp_build_linux_arm64` | `cpp-native-linux-arm64` | `libfoundry_local.so` (CPU-only) |
| `cpp_build_osx_arm64` | `cpp-native-osx-arm64` | `libfoundry_local.dylib` |
| `cpp_pack_nuget` | `cpp-nuget` | `Microsoft.AI.Foundry.Local.Runtime.<version>.nupkg` (bundles WinML on Windows) |
| `rust_pack_crate` | `rust-sdk-v2` | `foundry-local-sdk-<version>.crate` (platform-independent source crate) |

## Rust SDK

The Rust SDK (`foundry-local` crate) is a **source package**, unlike the
per-platform wheel / npm tarball / NuGet. There is no per-platform binary to
hand off, so:

* Each platform stage (`rust_build_<rid>`) rebuilds from source, running
`cargo fmt --check`, `cargo clippy -D warnings`, `cargo build`, then the unit
(`cargo test --lib`) and integration (`cargo test --tests`) suites. A single,
platform-independent `.crate` is produced once by `rust_pack_crate`.
* **Native for tests.** The `cpp-native-<rid>` artifact carries only
`foundry_local` (plus the WinML DLL on Windows). ORT/GenAI are *not*
vcpkg-static (only azure/spdlog/fmt/openssl/curl/zlib/brotli are absorbed into
`foundry_local`), so `steps-build-rust.yml` extracts `onnxruntime` +
`onnxruntime-genai` from the pinned `Microsoft.ML.OnnxRuntime.Foundry` /
`Microsoft.ML.OnnxRuntimeGenAI.Foundry` NuGet packages (`runtimes/<rid>/native/`)
into one directory alongside `foundry_local`, handed to `build.rs` via
`FOUNDRY_LOCAL_NATIVE_BIN_DIR`. build.rs copies every platform library into
`OUT_DIR` and bakes that path, so unit and integration tests resolve the native
by the baked path. The pinned versions match the C++ native build inputs
(`cppOrtVersion` / `cppGenaiVersion`).
* **win-arm64** is cross-compiled (`cargo clippy --target aarch64-pc-windows-msvc`,
check-only), matching the build-only treatment it gets in the C# / Python
matrices.
* Integration tests run with `--test-threads=1`: the native core enforces a
single `FoundryLocalManager` per process, so tests that each create one must
not run concurrently. They consume the same `test-data-shared` models as the
C# / Python suites (`FOUNDRY_TEST_DATA_DIR`).

## Versioning

Expand All @@ -201,8 +240,9 @@ The `compute_version` stage emits three flavors of the same base version:
* `pyVersion` — PEP 440 for Python (e.g. `0.1.0.dev202605111234`)
* `flcVersion` — Core/native-style (e.g. `0.1.0-dev-202605111234-abc12345`)

The C++ pack stage consumes `sdkVersion.txt`; the Python build stage
consumes `pyVersion.txt`; `flcVersion.txt` exists for Core publishing.
The C++ pack stage and the Rust build/pack stages consume `sdkVersion.txt`;
the Python build stage consumes `pyVersion.txt`; `flcVersion.txt` exists for
Core publishing.

`sdkVersion` is baked into the native binary via the cmake cache variable
`FOUNDRY_LOCAL_VERSION_STRING`, so `FoundryLocalGetVersionString()` returns
Expand Down Expand Up @@ -314,7 +354,6 @@ Build output directories follow `build.py`'s convention:
## Things explicitly out of scope

- No `foundry-local-runtime` standalone wheel.
- No Rust sdk_v2 stages.
- No multi-repo `Foundry-Local`/`test-data-shared` path-juggling logic in
the sdk_v2 templates — sdk_v2 paths are repo-relative.
- No private Azure DevOps feed dependency for the Python wheel install
Expand All @@ -341,6 +380,7 @@ Build output directories follow `build.py`'s convention:
* Native build/pack: [templates/stages-build-native.yml](templates/stages-build-native.yml)
* C# stages: [templates/stages-cs.yml](templates/stages-cs.yml)
* Python stages: [templates/stages-python.yml](templates/stages-python.yml)
* Rust stages: [templates/stages-rust.yml](templates/stages-rust.yml), [templates/steps-build-rust.yml](templates/steps-build-rust.yml)
* Pre-fetch: [templates/steps-prefetch-nuget.yml](templates/steps-prefetch-nuget.yml)
* Pack tool: [sdk_v2/cpp/nuget/pack.py](../../sdk_v2/cpp/nuget/pack.py)
* Top-level pipeline: [foundry-local-packaging.yml](../foundry-local-packaging.yml)
Loading
Loading