diff --git a/.gitignore b/.gitignore
index c70665a72..de3bb4a9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -78,6 +78,8 @@ llama-cpp-versions/
ollama-versions/
onnx-runtime-versions/
torch-versions/
+basalt-versions/
+.active-version-basalt
#misc
diff --git a/README.md b/README.md
index b4a5ca048..1761029b0 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,10 @@ On Windows, use `launcher.ps1` with the same flags. For a release build, use `--
Your library root contains `launcher-data/` and `shared-resources/`; models live in `shared-resources/models/`. Set `PUMAS_LAUNCHER_ROOT` to choose a root. Read [the upgrade guide](docs/library-upgrade.md) before opening an older library.
+## Serve a Basalt model
+
+For Linux x64 with an NVIDIA Blackwell GPU, see [Managed Basalt setup](docs/runtimes/basalt.md) for installing the runtime, importing Inkling 2 Mini, and setting per-model generation defaults.
+
## Run just the backend
Use Rust 1.92.0, CMake and your platform's C/C++ build tools. No Node, frontend assets or Electron are needed:
diff --git a/docs/contracts/model-operations-v1.md b/docs/contracts/model-operations-v1.md
index ce77e8196..4aba5a134 100644
--- a/docs/contracts/model-operations-v1.md
+++ b/docs/contracts/model-operations-v1.md
@@ -138,8 +138,10 @@ the same serving identity again before handing work to a provider.
The implemented capabilities are `chat_generation`, `text_generation`,
`text_embedding`, `image_generation`, `image_to_text`, `multimodal_embedding`,
`decision` and `rerank`. Vision-language models (`image-text-to-text`) offer chat,
-text generation and image-to-text. Non-text input needs a llama.cpp session
-(dedicated or router) with the model's projector loaded. A model with no
+text generation and image-to-text where the provider supports each operation.
+Non-text input for llama.cpp needs an active session (dedicated or router)
+with the model's projector loaded. Basalt provides chat and reports whether
+the loaded pack supports image input. A model with no
recorded task is described by its runtime: when llama.cpp publishes the
model's architecture and it declares text output, the model offers chat and
text generation, and image-to-text if it declares image input.
@@ -287,6 +289,10 @@ checks a single text choice, embedding count/index/dimension coherence, and
rejects incoherent provider results. Provider envelopes and internal errors are
not exposed.
+For Basalt, a normal stop or token-limit finish without visible answer text
+returns an empty `text` string with the reported finish reason. The typed
+response omits reasoning.
+
Errors follow [Errors](#errors). A request ID is never forwarded as a provider
idempotency key, and generation is never replayed.
@@ -532,3 +538,7 @@ ready. Every Torch runtime resolves the audio packages with the other general
modalities (current releases, Transformers 5.4 or newer where its Torch allows)
and loads the model from local files only, without repository code. Its
install probe reports Cohere ASR unavailable, with the reason, when it cannot.
+
+## Basalt generation defaults
+
+A loaded Basalt profile advertises chat generation and the modalities its owned session reports. Set per-model defaults through the model inference settings JSON-RPC methods. For a single operation, `options.kind` is `text_generation`. Alongside `temperature`, `top_p`, and `max_tokens`, the optional `sampling` object accepts `reasoning_effort`, `top_k`, `min_p`, `repetition_penalty`, `presence_penalty`, `frequency_penalty`, and `seed`. Pumas rejects sampling objects for providers that have not enabled these settings. Explicit values override saved settings. See [Managed Basalt](../runtimes/basalt.md).
diff --git a/docs/plans/basalt-runtime/execution-ledger.md b/docs/plans/basalt-runtime/execution-ledger.md
new file mode 100644
index 000000000..0d3d540c6
--- /dev/null
+++ b/docs/plans/basalt-runtime/execution-ledger.md
@@ -0,0 +1,10 @@
+# Basalt runtime execution ledger
+
+- 2026-11-23. Created `feat/basalt-runtime` from `origin/main` at `b5f31c5ce`. GitHub v0.5.6 assets and publisher digests are reachable. Basalt source documents the v2 pack and owned readiness fields. The RTX 5090 Laptop reports CUDA compute capability 12.0 and driver 595.84. Started acquiring the DQ8 pack for real verification.
+- 2026-11-23. Pumas installed v0.5.6 in an isolated library and verified the server's Python environment. The engine's GPU planner selected the RTX 5090 Laptop. With CUDA devices hidden, the engine refused the launch plan. Pumas began the pinned-revision Hugging Face download of the DQ8 pack in that library.
+- 2026-11-23. The Electron app imported an authored v2 pack through its backend. The Ctrl+click dialog saved Thinking Level and Maximum Output Tokens through the desktop bridge. The model's metadata contained the selected values.
+- 2026-11-23. The RPC suite passed 489 tests. The library suite passed 2,202 tests and the app manager passed 363 tests. The frontend suite passed 1,044 tests with one skip. Frontend type checking, frontend and Electron builds, desktop contract generation, Clippy, and the release gate tests passed.
+- 2026-11-23. Pumas listed the DQ8 and MX8 downloads independently. A managed profile pinned v0.5.6. With CUDA devices hidden, the Pumas serving endpoint returned `device_unavailable` and published no loaded model. Builds without Basalt and without inference plugins passed compilation.
+- 2026-11-23. Pumas published the DQ8 pack from revision `3d27b47c40f290ecfbf3ae70265bddb65c2635c1` and reported a valid Basalt artifact. Its 19,734,300,551 bytes matched publisher SHA-256 `f7b4e5f8e17681c4735a7dfc51ffd8e805c44184fad4e1778b13187d79dc3787`.
+- 2026-11-23. Basalt v0.5.6 loaded the real pack on an RTX 5090 Laptop GPU with an 8,192-token context. A saved one-token limit capped chat generation at one token. An explicit override returned a complete 53-token generation from the same prompt. The typed operation returned a correlated `length` result under the saved limit and a `stop` result under the override. It also identified a red test image and published completed answer-text SSE events.
+- 2026-11-23. Reconstruction Workbench's existing client discovered the served Basalt profile, retained the Pumas owner, and returned `READY` through its usual typed request. Pumas unloaded the profile, removed its serving entry, and ended the engine process. The model loaded again under the desktop backend.
diff --git a/docs/plans/basalt-runtime/issues.md b/docs/plans/basalt-runtime/issues.md
new file mode 100644
index 000000000..6ab39df4a
--- /dev/null
+++ b/docs/plans/basalt-runtime/issues.md
@@ -0,0 +1,5 @@
+# Basalt runtime issues
+
+- **Live GPU availability**. The compatible GPU was occupied during implementation. The separate workload had stopped by the time verification began. Live verification used the available GPU and confirmed that unloading Basalt released its memory.
+- **Model acquisition**. Pumas downloaded the 19.7 GB DQ8 pack and published it after validation. The file matched the publisher digest.
+- **Reasoning-only output**. Basalt can use the entire output limit before emitting answer text, and it sends reasoning events separately in streams. The finite typed operation preserves the truncation result, and the stream publishes answer text and completion without forwarding reasoning chunks. Both paths passed with the real pack.
diff --git a/docs/plans/basalt-runtime/plan.md b/docs/plans/basalt-runtime/plan.md
new file mode 100644
index 000000000..bdb66a7fd
--- /dev/null
+++ b/docs/plans/basalt-runtime/plan.md
@@ -0,0 +1,41 @@
+# Managed Basalt runtime and inference defaults
+
+- **Status** Accepted
+- **Acceptance** Satisfied
+- **Delivery** Pull request to `main`
+
+## Objective
+
+Install Basalt through Pumas's GitHub runtime installer, serve an Inkling 2 Mini pack through a managed runtime profile, and set compatible generation defaults through the Ctrl+click model dialog and the Pumas endpoint. Deliver the verified branch as a pull request to main.
+
+## Decisions
+
+- The existing acquisition and importer owners verify and publish pack bytes. The library identifies the Basalt v2 container from bounded content evidence. The upstream engine owns architecture and tensor compatibility.
+- The shared GitHub installer owns release selection, trusted extraction, provenance and publication. Pumas owns the spawned runtime and its process lifecycle. Basalt declares its own build feature and starts only on a supported Linux x64 host with usable CUDA 13 and an NVIDIA GPU of compute capability 12.0.
+- The runtime profile selects a dedicated managed Basalt process. Pumas publishes readiness only after the owned process reports that the selected model is loaded. A service's TCP address or model list alone is insufficient.
+- The existing model metadata settings schema owns per-model values. The Ctrl+click editor and JSON-RPC reuse it. Basalt requests use explicit request options first, stored model overrides second, and the pack defaults for omitted values. Both the Pumas chat gateway and typed chat operation honor this ordering.
+- The isolated `feat/basalt-runtime` worktree is based on current upstream main and owned by the Codex task through PR handoff.
+
+## Composed design review
+
+Applicable. Pack recognition has a filesystem and immutable-artifact lifecycle. Release acquisition has a vendor and version lifecycle. Launch and readiness are Pumas process-owner concerns. Sampling defaults are model metadata and request concerns. The shared identity is the selected artifact and managed profile; their release, launch, and request lifetimes remain independent. Callers supply a model/profile pair or request overrides and receive current availability or typed failures. They do not need the archive layout, GPU query details or provider JSON.
+
+A new Basalt release changes installation qualification and its fixture; an engine readiness response change affects the Basalt readiness adapter; an inference option change reaches the model schema, provider conversion and generated UI contract only where the option is supported. Installed-version receipts, a selected file and bounded model options are the stable seams. Model metadata remains usable without the build or hardware capability. Removing the Basalt adapters drops that provider's install/launch/serve behavior without removing common acquisition, model editing, or other providers. Provider-specific launch and request mapping contain the required complexity. There is no separate downloader, process supervisor, settings database or settings dialog.
+
+## Milestones and acceptance
+
+| Slice | Lifecycle | Write set and evidence |
+| --- | --- | --- |
+| Pack admission | Accepted | Structurally valid and malformed container tests, local import, and the pinned Hugging Face pack verified against its publisher digest. |
+| Runtime install and profile | Accepted | GitHub acquisition of v0.5.6, unsupported-device refusal, and managed load and unload on the RTX 5090 Laptop. |
+| Inference defaults | Accepted | Electron and JSON-RPC persistence, explicit request precedence in both inference endpoints, typed vision and streaming, and a Workbench Pumas client response. |
+
+| Claim | Kind | Environment | Mode | Status |
+| --- | --- | --- | --- | --- |
+| Pack acquired or imported and identified as a native Basalt artifact | Integration | Required real | Automated | Passed |
+| Pumas installs Basalt, launches the selected profile, serves Inkling and releases the owned process on unload | System | Required real Blackwell | Automated | Passed |
+| Ctrl+click editor persists supported values | User workflow | Electron and RPC | Automated | Passed |
+| Real inference honors saved defaults and explicit overrides | System | Required real Blackwell | Automated | Passed |
+| Feature/platform and unsupported-device outcomes agree with discovery and launch admission | Contract | Representative | Automated | Passed |
+
+[Acceptance evidence](execution-ledger.md) · [Issues](issues.md)
diff --git a/docs/release-attribution/0.8.2-s3/inventory.json b/docs/release-attribution/0.8.2-s3/inventory.json
index b18219cfb..24726ba11 100644
--- a/docs/release-attribution/0.8.2-s3/inventory.json
+++ b/docs/release-attribution/0.8.2-s3/inventory.json
@@ -9432,8 +9432,8 @@
"rust/Cargo.toml": "71e9e537a4f80757e8a772f1dc0e066ce588ff7781a4151ccd8f77c166b1faac",
"rust/crates/pumas-app-manager/Cargo.toml": "5289d58c2a9d1aa8df3ddef372d640af8263ee45bc524edccc9685ca58f4cc2b",
"rust/crates/pumas-app-manager/src/version_manager/managed_python.rs": "6653fe6402c497573201c5a76567a839fe4229bc749c8c0489b61ba62411c8f9",
- "rust/crates/pumas-core/Cargo.toml": "7c572e50bc6052a3d2987998b66c558f8570e1aed12dfea30e9f3a81a5091e95",
- "rust/crates/pumas-rpc/Cargo.toml": "6b14fbac9a22049146b59aec4a415c333283a3ddb9616e5adc8ec3bdd4d5ec92",
+ "rust/crates/pumas-core/Cargo.toml": "544472f0201f901ea021e8c09599f8338e61a9e8206fd7b4503857f96a12df28",
+ "rust/crates/pumas-rpc/Cargo.toml": "b95e19e7c47bfd49d695caf3476d28bfc67a5cc73a9ec4e5311e04c7d8f46f04",
"scripts/release/artifact-plan.json": "1304dcd4856b64b4c37ddf052a05e33157ca6a28f00d549f977c00dceb4ff2e3",
"scripts/release/licenses/managed-python-sources.json": "eabda4e2a25a92cfa8610865e79d11a50836930f53098efe89dd90778c4212ca",
"scripts/release/licenses/managed-python-supplemental/zlib-ng-2.2.4-LICENSE.md": "6c9f0d975b41afaa34d22f55bb8986ce69e5cb7ad327cb2b28820cd425edf5ee",
diff --git a/docs/release-attribution/0.8.2/inventory.json b/docs/release-attribution/0.8.2/inventory.json
index 5b3f01f22..8738b455b 100644
--- a/docs/release-attribution/0.8.2/inventory.json
+++ b/docs/release-attribution/0.8.2/inventory.json
@@ -9430,8 +9430,8 @@
"rust/Cargo.toml": "71e9e537a4f80757e8a772f1dc0e066ce588ff7781a4151ccd8f77c166b1faac",
"rust/crates/pumas-app-manager/Cargo.toml": "5289d58c2a9d1aa8df3ddef372d640af8263ee45bc524edccc9685ca58f4cc2b",
"rust/crates/pumas-app-manager/src/version_manager/managed_python.rs": "6653fe6402c497573201c5a76567a839fe4229bc749c8c0489b61ba62411c8f9",
- "rust/crates/pumas-core/Cargo.toml": "7c572e50bc6052a3d2987998b66c558f8570e1aed12dfea30e9f3a81a5091e95",
- "rust/crates/pumas-rpc/Cargo.toml": "6b14fbac9a22049146b59aec4a415c333283a3ddb9616e5adc8ec3bdd4d5ec92",
+ "rust/crates/pumas-core/Cargo.toml": "544472f0201f901ea021e8c09599f8338e61a9e8206fd7b4503857f96a12df28",
+ "rust/crates/pumas-rpc/Cargo.toml": "b95e19e7c47bfd49d695caf3476d28bfc67a5cc73a9ec4e5311e04c7d8f46f04",
"scripts/release/artifact-plan.json": "1304dcd4856b64b4c37ddf052a05e33157ca6a28f00d549f977c00dceb4ff2e3",
"scripts/release/licenses/managed-python-sources.json": "eabda4e2a25a92cfa8610865e79d11a50836930f53098efe89dd90778c4212ca",
"scripts/release/licenses/managed-python-supplemental/zlib-ng-2.2.4-LICENSE.md": "6c9f0d975b41afaa34d22f55bb8986ce69e5cb7ad327cb2b28820cd425edf5ee",
diff --git a/docs/runtimes/basalt.md b/docs/runtimes/basalt.md
new file mode 100644
index 000000000..e65b2a2e8
--- /dev/null
+++ b/docs/runtimes/basalt.md
@@ -0,0 +1,34 @@
+# Managed Basalt
+
+Pumas can download a publisher-verified [Basalt 0.5 release](https://github.com/jesdga95/basalt/releases/tag/v0.5.6), install its Python environment alongside the engine, and serve a single `.basalt` v2 pack per managed runtime profile. The Basalt build feature is enabled by default in `pumas-rpc`. Use `--no-default-features --features inference-plugins` for the other inference plugins without Basalt.
+
+## Host requirements
+
+- Linux x64 with Python 3.10 or newer and its venv module. Installation downloads the upstream release archive from GitHub and the release's pinned Python wheels.
+- An NVIDIA Blackwell GPU of compute capability 12.0, a compatible NVIDIA driver and CUDA 13 user-space libraries. See the [Basalt platform requirements](https://github.com/jesdga95/basalt/blob/v0.5.6/docs/platforms.md).
+- Enough memory to load the chosen pack. The managed launcher runs Basalt's GPU planner under the profile's CUDA device visibility before starting the server.
+
+Pumas uses the system CUDA library search path by default. If the libraries are installed in a separate directory, start Pumas with `PUMAS_BASALT_CUDA_LIB_DIR` pointing to the absolute directory containing `libcudart.so.13`, `libcublas.so.13` and `libcublasLt.so.13`.
+
+## Install and serve
+
+1. Open **Basalt** in the sidebar and install the runtime. Activate it, or pin the installed version in the profile.
+2. Download or import the `Inkling-2-Mini-NVFP4-DQ8.basalt` pack. Hugging Face also lists an MX8 pack supported by Basalt 0.5.6. Choose a single pack for one model record.
+3. In **Runtime Profiles**, add an enabled managed Basalt profile. Select **Auto** or a specific compatible GPU. The managed process listens on loopback.
+4. Serve the model with that profile. Pumas records it as loaded once the exact owned Basalt process reports this model ready. Unload stops that profile's serving process.
+
+Basalt provides chat generation through the Pumas gateway. Available image input is declared by the loaded runtime. Use the alias and profile returned by `GET /v1/served-models`.
+
+## Set model defaults
+
+Ctrl+click the model name, open **Inference**, then choose a **Thinking Level** and any sampling overrides. Use **Model default** or clear a numeric field to use the pack's defaults. Save settings to apply them to subsequent requests without reloading the model.
+
+Inkling can emit reasoning tokens even at Thinking Level `none`. Allow enough output tokens for the model's answer. See the [Inkling chat and thinking behavior](https://github.com/jesdga95/basalt/blob/v0.5.6/docs/models/inkling2.md#chat-thinking-and-tools).
+
+API clients can read the descriptors with the `get_inference_settings` JSON-RPC method and submit the edited descriptors with `update_inference_settings`. Both take `model_id`. For an update, pass the edited descriptors as `settings`; the `default` field carries the selected per-model value. An empty settings list clears the overrides. Pumas validates values against the provider schema.
+
+Settings include thinking level, maximum output tokens, temperature, top P, top K, min P, repetition, presence and frequency penalties, and seed. On `POST /v1/chat/completions` send explicit values in the request body. On `POST /v1/model-operations` use text-generation options, with additional values such as `reasoning_effort` under `options.sampling`. Explicit request values take precedence. See the [Pumas model operations contract](../contracts/model-operations-v1.md).
+
+## Diagnose a launch
+
+A missing CUDA library, unsupported GPU, or unavailable device returns a serving error before model readiness is published. If a compatible GPU is already busy, use the runtime log for model-load errors and verify memory availability. The profile status exposes the log path. To release memory, unload the model through Pumas.
diff --git a/frontend/public/basalt-icon.svg b/frontend/public/basalt-icon.svg
new file mode 100644
index 000000000..32898b7f1
--- /dev/null
+++ b/frontend/public/basalt-icon.svg
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/components/ModelInferenceSettingsEditor.tsx b/frontend/src/components/ModelInferenceSettingsEditor.tsx
index f3c01ee17..b7d8ddc55 100644
--- a/frontend/src/components/ModelInferenceSettingsEditor.tsx
+++ b/frontend/src/components/ModelInferenceSettingsEditor.tsx
@@ -1,3 +1,4 @@
+import { useId } from 'react';
import { Plus, Trash2 } from 'lucide-react';
import type { InferenceParamSchema } from '../types/api';
import {
@@ -18,6 +19,7 @@ interface ModelInferenceSettingsEditorProps {
saveError: string | null;
saveSuccess: boolean;
saving: boolean;
+ schemaEditable: boolean;
onAddParam: () => void;
onNewParamChange: (
updater: (
@@ -45,6 +47,7 @@ export function ModelInferenceSettingsEditor({
saveError,
saveSuccess,
saving,
+ schemaEditable,
onAddParam,
onNewParamChange,
onParamDefaultChange,
@@ -52,6 +55,7 @@ export function ModelInferenceSettingsEditor({
onSave,
onSetAddingParam,
}: ModelInferenceSettingsEditorProps) {
+ const idPrefix = useId();
return (
{inferenceSettings.length === 0 ? (
@@ -65,10 +69,12 @@ export function ModelInferenceSettingsEditor({
.map(normalizeAllowedOption)
.filter((option): option is SelectAllowedOption => option !== null);
+ const controlId = `${idPrefix}-${param.key}`;
return (
@@ -82,6 +88,7 @@ export function ModelInferenceSettingsEditor({
) : param.param_type === 'Boolean' ? (
onParamDefaultChange(index, event.target.value)}
className="w-full px-2 py-1 text-sm bg-[hsl(var(--surface-high))] border border-[hsl(var(--border-default))] rounded text-[hsl(var(--text-primary))]"
@@ -91,10 +98,12 @@ export function ModelInferenceSettingsEditor({
) : param.param_type === 'String' && allowedOptions.length > 0 ? (
onParamDefaultChange(index, event.target.value)}
className="w-full px-2 py-1 text-sm bg-[hsl(var(--surface-high))] border border-[hsl(var(--border-default))] rounded text-[hsl(var(--text-primary))]"
>
+ {param.key === 'reasoning_effort' && Model default }
{allowedOptions.map((option) => (
) : (
onParamDefaultChange(index, event.target.value)}
@@ -117,20 +127,22 @@ export function ModelInferenceSettingsEditor({
/>
)}
-
onRemoveParam(index)}
- className="p-1 mt-4 text-[hsl(var(--text-muted))] hover:text-[hsl(var(--accent-error))] hover:bg-[hsl(var(--accent-error)/0.1)] rounded"
- title="Remove parameter"
- >
-
-
+ {schemaEditable && (
+
onRemoveParam(index)}
+ className="p-1 mt-4 text-[hsl(var(--text-muted))] hover:text-[hsl(var(--accent-error))] hover:bg-[hsl(var(--accent-error)/0.1)] rounded"
+ title="Remove parameter"
+ >
+
+
+ )}
);
})}
)}
- {addingParam ? (
+ {schemaEditable && (addingParam ? (
Add Parameter
- )}
+ ))}
({
getInferenceSettingsMock: vi.fn(),
getLibraryModelMetadataMock: vi.fn(),
resolveModelPackageFactsMock: vi.fn(),
+ updateInferenceSettingsMock: vi.fn(),
}));
vi.mock('../api/models', () => ({
@@ -18,7 +20,7 @@ vi.mock('../api/models', () => ({
getLibraryModelMetadata: getLibraryModelMetadataMock,
refetchMetadataFromHF: vi.fn(),
resolveModelPackageFacts: resolveModelPackageFactsMock,
- updateInferenceSettings: vi.fn(),
+ updateInferenceSettings: updateInferenceSettingsMock,
updateModelNotes: vi.fn(),
},
}));
@@ -54,6 +56,40 @@ describe('ModelMetadataModal', () => {
expect(onClose).toHaveBeenCalledTimes(2);
});
+ it('saves a model thinking level and clears a sampling override back to the model default', async () => {
+ const modelId = 'llm/inkling/mini';
+ getLibraryModelMetadataMock.mockResolvedValue(metadata(modelId));
+ getInferenceSettingsMock.mockResolvedValue({
+ success: true,
+ model_id: modelId,
+ inference_settings: [
+ {
+ key: 'reasoning_effort',
+ label: 'Thinking Level',
+ param_type: 'String',
+ default: null,
+ constraints: { allowed_values: ['none', 'low', 'high'] },
+ },
+ { key: 'temperature', label: 'Temperature', param_type: 'Number', default: 0.7 },
+ ],
+ });
+ updateInferenceSettingsMock.mockResolvedValue(undefined);
+ render( );
+
+ fireEvent.click(await screen.findByRole('button', { name: 'Inference' }));
+ const thinking = await screen.findByRole('combobox', { name: /Thinking Level/ });
+ expect(thinking).toHaveDisplayValue('Model default');
+ fireEvent.change(thinking, { target: { value: 'high' } });
+ fireEvent.change(screen.getByRole('spinbutton', { name: /Temperature/ }), { target: { value: '' } });
+ fireEvent.click(screen.getByRole('button', { name: 'Save Settings' }));
+
+ await screen.findByText('Saved');
+ expect(updateInferenceSettingsMock).toHaveBeenCalledWith(modelId, [
+ expect.objectContaining({ key: 'reasoning_effort', default: 'high' }),
+ expect.objectContaining({ key: 'temperature', default: null }),
+ ]);
+ });
+
it('lazy loads read-only execution facts when the execution tab is selected', async () => {
getLibraryModelMetadataMock.mockResolvedValue({
success: true,
diff --git a/frontend/src/components/ModelMetadataModal.tsx b/frontend/src/components/ModelMetadataModal.tsx
index 05f2f36ea..b3ac66c73 100644
--- a/frontend/src/components/ModelMetadataModal.tsx
+++ b/frontend/src/components/ModelMetadataModal.tsx
@@ -181,7 +181,9 @@ const ModelMetadataModalSession: React.FC = ({
return prev;
}
const updated = { ...param };
- if (param.param_type === 'Integer') {
+ if (value === '' && (param.param_type !== 'String' || param.key === 'reasoning_effort')) {
+ updated.default = null;
+ } else if (param.param_type === 'Integer') {
const parsed = parseInt(value, 10);
updated.default = isNaN(parsed) ? value : parsed;
} else if (param.param_type === 'Number') {
diff --git a/frontend/src/components/ModelMetadataModalContent.tsx b/frontend/src/components/ModelMetadataModalContent.tsx
index e608db760..a0fe6e400 100644
--- a/frontend/src/components/ModelMetadataModalContent.tsx
+++ b/frontend/src/components/ModelMetadataModalContent.tsx
@@ -193,6 +193,7 @@ export function ModelMetadataModalContent({
saveError={saveError}
saveSuccess={saveSuccess}
saving={saving}
+ schemaEditable={!primaryFile?.toLowerCase().endsWith('.basalt')}
onAddParam={onAddParam}
onNewParamChange={onNewParamChange}
onParamDefaultChange={onParamDefaultChange}
diff --git a/frontend/src/components/app-panels/sections/RuntimeProfileSettingsActions.tsx b/frontend/src/components/app-panels/sections/RuntimeProfileSettingsActions.tsx
index db8cde592..63916b0e5 100644
--- a/frontend/src/components/app-panels/sections/RuntimeProfileSettingsActions.tsx
+++ b/frontend/src/components/app-panels/sections/RuntimeProfileSettingsActions.tsx
@@ -27,20 +27,21 @@ export function RuntimeProfileSettingsActions({
}: RuntimeProfileSettingsActionsProps) {
const isExistingProfile = selectedProfileId !== null;
const isRunning = selectedStatus?.state === 'running' || selectedStatus?.state === 'starting';
+ const startsFromModel =
+ draft.provider_mode === 'llama_cpp_dedicated' || draft.provider_mode === 'basalt_serve';
const canStartFromProfile =
isExistingProfile &&
isManagedProfile &&
- draft.provider_mode !== 'llama_cpp_dedicated' &&
+ !startsFromModel &&
!isRunning;
const canStopProfile = isExistingProfile && isManagedProfile && isRunning;
- const showsRuntimeAction =
- selectedProfileId && isManagedProfile && draft.provider_mode !== 'llama_cpp_dedicated';
+ const showsRuntimeAction = isExistingProfile && isManagedProfile && !startsFromModel;
return (
{`State: ${runtimeStatusLabel(selectedStatus)}`}
- {draft.provider_mode === 'llama_cpp_dedicated' && isManagedProfile && (
+ {startsFromModel && isManagedProfile && (
Dedicated profiles start from a model's Serving page.
)}
diff --git a/frontend/src/components/model-import/metadataUtils.ts b/frontend/src/components/model-import/metadataUtils.ts
index 841ef195e..d840625bf 100644
--- a/frontend/src/components/model-import/metadataUtils.ts
+++ b/frontend/src/components/model-import/metadataUtils.ts
@@ -15,7 +15,7 @@ export function getFilename(path: string): string {
export function getSecurityTier(filename: string): SecurityTier {
const lower = filename.toLowerCase();
- if (lower.endsWith('.safetensors') || lower.endsWith('.gguf') || lower.endsWith('.onnx')) {
+ if (lower.endsWith('.safetensors') || lower.endsWith('.gguf') || lower.endsWith('.onnx') || lower.endsWith('.basalt')) {
return 'safe';
}
if (lower.endsWith('.ckpt') || lower.endsWith('.pt') || lower.endsWith('.bin') || lower.endsWith('.pth')) {
diff --git a/frontend/src/hooks/useServingStatus.test.ts b/frontend/src/hooks/useServingStatus.test.ts
index 323c4a4a7..471c35e73 100644
--- a/frontend/src/hooks/useServingStatus.test.ts
+++ b/frontend/src/hooks/useServingStatus.test.ts
@@ -92,8 +92,9 @@ describe('useServingStatus', () => {
setIntervalSpy.mockRestore();
});
- it('admits Torch and trellis.cpp alongside llama.cpp without withdrawing serving controls', async () => {
+ it('admits Basalt, Torch and trellis.cpp alongside llama.cpp without withdrawing serving controls', async () => {
const rows = [
+ { model_id: 'llm/inkling', profile_id: 'inkling', provider: 'basalt', load_state: 'loaded' },
{ model_id: 'images/z-image', profile_id: 'image', provider: 'torch', load_state: 'loaded' },
{ model_id: 'vlm/qwen', profile_id: 'vision', provider: 'llama_cpp', load_state: 'loaded' },
{ model_id: 'mesh/trellis2', profile_id: 'mesh', provider: 'trellis_cpp', load_state: 'loaded' },
diff --git a/frontend/src/hooks/useServingStatus.ts b/frontend/src/hooks/useServingStatus.ts
index f98891551..1b55596e5 100644
--- a/frontend/src/hooks/useServingStatus.ts
+++ b/frontend/src/hooks/useServingStatus.ts
@@ -32,6 +32,7 @@ const PROVIDER_IDS: Record
= {
onnx_runtime: true,
torch: true,
trellis_cpp: true,
+ basalt: true,
};
const PROVIDERS = new Set(Object.keys(PROVIDER_IDS));
const LOAD_STATES = new Set(['requested', 'loading', 'loaded', 'unloading', 'unloaded', 'failed']);
diff --git a/frontend/src/types/api-import.ts b/frontend/src/types/api-import.ts
index 56c32ddd1..60e19c061 100644
--- a/frontend/src/types/api-import.ts
+++ b/frontend/src/types/api-import.ts
@@ -262,7 +262,7 @@ export interface DetectShardedSetsResponse extends BaseResponse {
*/
export interface FileTypeValidationResponse extends BaseResponse {
valid: boolean;
- detected_type: 'safetensors' | 'gguf' | 'ggml' | 'pickle' | 'onnx' | 'unknown' | 'error';
+ detected_type: 'safetensors' | 'gguf' | 'ggml' | 'pickle' | 'onnx' | 'basalt' | 'unknown' | 'error';
error?: string;
}
diff --git a/frontend/src/utils/runtimeProviderDescriptors.test.ts b/frontend/src/utils/runtimeProviderDescriptors.test.ts
index 201e7c4fc..5f0197cd5 100644
--- a/frontend/src/utils/runtimeProviderDescriptors.test.ts
+++ b/frontend/src/utils/runtimeProviderDescriptors.test.ts
@@ -8,9 +8,11 @@ describe('runtime provider labels', () => {
expect(providerLabel('llama_cpp')).toBe('llama.cpp');
expect(providerLabel('onnx_runtime')).toBe('ONNX Runtime');
expect(providerLabel('trellis_cpp')).toBe('trellis.cpp');
- expect(providerLabel('basalt' as never)).toBe('basalt');
+ expect(providerLabel('basalt')).toBe('Basalt');
+ expect(providerLabel('future_engine' as never)).toBe('future_engine');
expect(modeLabel('llama_cpp_dedicated')).toBe('Dedicated');
expect(modeLabel('onnx_serve')).toBe('Serve');
+ expect(modeLabel('basalt_serve')).toBe('Serve');
expect(deviceModeLabel('specific_device')).toBe('Specific device');
});
diff --git a/frontend/src/utils/runtimeProviderDescriptors.ts b/frontend/src/utils/runtimeProviderDescriptors.ts
index 3a54a7667..7b0ee2c6b 100644
--- a/frontend/src/utils/runtimeProviderDescriptors.ts
+++ b/frontend/src/utils/runtimeProviderDescriptors.ts
@@ -17,6 +17,7 @@ const providerLabels: Partial> = {
torch: 'Torch',
onnx_runtime: 'ONNX Runtime',
trellis_cpp: 'trellis.cpp',
+ basalt: 'Basalt',
};
const modeLabels: Partial> = {
@@ -26,6 +27,7 @@ const modeLabels: Partial> = {
onnx_serve: 'Serve',
torch_serve: 'Serve',
trellis_serve: 'Serve',
+ basalt_serve: 'Serve',
};
const deviceModeLabels: Record = {
diff --git a/launcher-data/plugins/basalt.json b/launcher-data/plugins/basalt.json
new file mode 100644
index 000000000..ef30e3d79
--- /dev/null
+++ b/launcher-data/plugins/basalt.json
@@ -0,0 +1,26 @@
+{
+ "id": "basalt",
+ "displayName": "Basalt",
+ "description": "Local text and vision inference on NVIDIA Blackwell GPUs",
+ "icon": "circuit-board",
+ "githubRepo": "jesdga95/basalt",
+ "installationType": "binary",
+ "capabilities": {
+ "hasVersionManagement": true,
+ "supportsShortcuts": false,
+ "hasDependencies": false,
+ "hasConnectionUrl": false,
+ "hasModelLibrary": true,
+ "hasStats": false
+ },
+ "modelCompatibility": {
+ "supportedFormats": ["basalt"]
+ },
+ "panelLayout": [
+ {"type": "version_manager"},
+ {"type": "runtime_profiles", "config": {"provider": "basalt"}},
+ {"type": "model_library", "config": {"filter": "basalt"}}
+ ],
+ "sidebarPriority": 23,
+ "enabledByDefault": true
+}
diff --git a/packages/desktop-contract/generated/desktop-contract.d.ts b/packages/desktop-contract/generated/desktop-contract.d.ts
index c6313e934..ca78e885e 100644
--- a/packages/desktop-contract/generated/desktop-contract.d.ts
+++ b/packages/desktop-contract/generated/desktop-contract.d.ts
@@ -1,4 +1,4 @@
-// Generated from the pumas-rpc contract export and electron/contracts; SHA256 8a28edee717b40f1aa334d587e6ca2b0e47c1baf973f2788530a7e364e18c7cf. DO NOT EDIT.
+// Generated from the pumas-rpc contract export and electron/contracts; SHA256 6d976869ac7810ed599372087c55382718d651838f03edbfe3e0764fe6b82597. DO NOT EDIT.
export type AppResources = { "ollama"?: (AppResourceUsage) | (null) };
export type AppResourceUsage = { "gpu_memory"?: number | null; "ram_memory"?: number | null };
export type AvailableVersionsOutcome = (AvailableVersionsSuccess) | (AvailableVersionsRateLimited);
@@ -53,7 +53,7 @@ export type DownloadStatusFoundOutcome = { "downloadId": string; "downloadedByte
export type DownloadStatusMissingOutcome = { "error": string; "success": false };
export type DownloadStatusOutcome = (DownloadStatusFoundOutcome) | (DownloadStatusMissingOutcome);
export type EmbeddedMetadataResponse = { "file_type": string; "metadata": { readonly [key: string]: DesktopJsonValue } };
-export type ExecutableArtifactFormat = "safetensors" | "gguf" | "onnx";
+export type ExecutableArtifactFormat = "safetensors" | "gguf" | "onnx" | "basalt";
export type FileGroup = { "filenames": ReadonlyArray; "label": string; "shardCount": number };
export type FindTorchAlternativesParams = { "build": string; "python": string; "tag": string };
export type FinishedRetainedImport = "acknowledged" | "already_ready";
@@ -166,8 +166,8 @@ export type RuntimeProfilesSnapshotResponse = { "error"?: string | null; "snapsh
export type RuntimeProfileStatus = { "endpoint_url"?: string | null; "last_error"?: string | null; "log_path"?: string | null; "pid"?: number | null; "profile_id": string; "runtime_version"?: string | null; "state": RuntimeLifecycleState };
export type RuntimeProfileUpdateFeed = { "cursor": string; "events": ReadonlyArray; "snapshot_required": boolean; "stale_cursor": boolean };
export type RuntimeProviderDescriptor = { "app_id": string; "artifact_formats": ReadonlyArray; "device_modes": ReadonlyArray; "launch_on_serve_modes": ReadonlyArray; "provider": RuntimeProviderId; "provider_modes": ReadonlyArray; "request_controls": ReadonlyArray; "serving_tasks": ReadonlyArray; "supports_external_profiles": boolean; "supports_managed_profiles": boolean; "version_managed": boolean };
-export type RuntimeProviderId = "torch" | "ollama" | "llama_cpp" | "onnx_runtime" | "trellis_cpp";
-export type RuntimeProviderMode = "torch_serve" | "ollama_serve" | "llama_cpp_router" | "llama_cpp_dedicated" | "onnx_serve" | "trellis_serve";
+export type RuntimeProviderId = "torch" | "ollama" | "llama_cpp" | "onnx_runtime" | "basalt" | "trellis_cpp";
+export type RuntimeProviderMode = "torch_serve" | "ollama_serve" | "llama_cpp_router" | "llama_cpp_dedicated" | "onnx_serve" | "basalt_serve" | "trellis_serve";
export type RuntimeProvidersOutcome = { "providers": ReadonlyArray; "success": true };
export type RuntimeRunningOutcome = boolean;
export type RuntimeSchedulerSettings = { "auto_load": boolean; "keep_alive_seconds"?: number | null; "max_concurrent_models"?: number | null };
diff --git a/packages/desktop-contract/generated/desktop-contract.js b/packages/desktop-contract/generated/desktop-contract.js
index 495e48465..7bdb33ba8 100644
--- a/packages/desktop-contract/generated/desktop-contract.js
+++ b/packages/desktop-contract/generated/desktop-contract.js
@@ -1,4 +1,4 @@
-// Generated from the pumas-rpc contract export and electron/contracts; SHA256 8a28edee717b40f1aa334d587e6ca2b0e47c1baf973f2788530a7e364e18c7cf. DO NOT EDIT.
+// Generated from the pumas-rpc contract export and electron/contracts; SHA256 6d976869ac7810ed599372087c55382718d651838f03edbfe3e0764fe6b82597. DO NOT EDIT.
import { validateAvailableVersionsOutcome, validateBackendStatusOutcome, validateCancelInstallationOutcome, validateCatalogSearchOutcome, validateCheckVersionDependenciesOutcome, validateCheckVersionDependenciesParams, validateConversionCancelledOutcome, validateConversionEnvironmentOutcome, validateConversionListOutcome, validateConversionProgressResponse, validateConversionSetupStartedOutcome, validateConversionSetupStatusOutcome, validateConversionStartedOutcome, validateDownloadIdParams, validateDownloadListOutcome, validateDownloadLocationReport, validateDownloadMutationOutcome, validateDownloadResolutionRequest, validateDownloadStartedOutcome, validateDownloadStatusOutcome, validateFindTorchAlternativesParams, validateFinishRetainedImportOutcome, validateGetBackendSetupParams, validateGetHfDownloadDetailsParams, validateGetReleaseDependenciesOutcome, validateGetReleaseDependenciesParams, validateGetTorchReleaseOptionsParams, validateGetTorchRuntimeProbeParams, validateGithubCacheStatusOutcome, validateHfDownloadDetailsOutcome, validateHfModelSearchOutcome, validateImportBatchParams, validateImportModelParams, validateInferenceSettingsOutcome, validateInstallVersionDependenciesOutcome, validateInstallVersionDependenciesParams, validateInstallVersionOutcome, validateInstallVersionParams, validateInstallationProgressOutcome, validateInstalledVersionsOutcome, validateLauncherRootSelectionResult, validateLauncherRootStartupState, validateLibraryModelMetadataOutcome, validateLibraryStatusResponse, validateLibraryUpgradeConfirmation, validateLibraryUpgradeResult, validateLinkHealthOutcome, validateModelCategoryOutcome, validateModelDownloadUpdateOutcome, validateModelIdParams, validateModelImportSelection, validateModelIndexRefreshOutcome, validateModelLibraryUpdateNotification, validateModelLookupOutcome, validateModelLookupParams, validateModelRunOptionsOutcome, validateModelsOutcome, validateNetworkStatusResponse, validatePartialDownloadOutcome, validatePreviewTorchRuntimeParams, validatePublicError, validateRecoverDownloadParams, validateRemoveVersionOutcome, validateRouterProfileSyncStatus, validateRuntimeLaunchOutcome, validateRuntimeLaunchParams, validateRuntimeProfileUpdateFeed, validateRuntimeProfilesSnapshotResponse, validateRuntimeProvidersOutcome, validateRuntimeRunningOutcome, validateRuntimeStopOutcome, validateS3AuthenticatedBundleImportParams, validateS3AuthenticatedDiscoveryParams, validateS3AuthenticatedImportParams, validateS3BundleImportObservation, validateS3BundleImportParams, validateS3ConditionalFileParams, validateS3CredentialParams, validateS3DiscoveryOutcome, validateS3DiscoveryParams, validateS3ImportCancelOutcome, validateS3ImportCancelParams, validateS3ImportOutcome, validateS3ImportParams, validateS3ImportStatusParams, validateS3PersistedImportsWire, validateS3PinnedFileParams, validateS3ReadMode, validateS3SelectedFileParams, validateS3TransferRetryParams, validateS3TransferRetryState, validateSearchCatalogParams, validateSelectedVersionOutcome, validateServingStatusResponse, validateServingStatusUpdateFeed, validateSetDefaultVersionOutcome, validateSetDefaultVersionParams, validateSetHfTokenParams, validateStaleInstanceReleaseConfirmation, validateStaleInstanceReleaseResult, validateStartBackendSetupParams, validateStartConversionSetupParams, validateStartupFailureFrame, validateStatusTelemetrySnapshot, validateStatusTelemetryUpdateNotification, validateStopRuntimeProfileGenerationOutcome, validateStopRuntimeProfileGenerationParams, validateSuccessOutcome, validateSupportedQuantTypesOutcome, validateSwitchVersionOutcome, validateSwitchVersionParams, validateTorchAdapterRequirement, validateTorchAlternativeMatch, validateTorchAlternativesOutcome, validateTorchAlternativesStatus, validateTorchCapabilityProbe, validateTorchDriverAvailability, validateTorchGpuVendor, validateTorchInstalledRuntime, validateTorchProbeAdapterStatus, validateTorchProbeCoreStatus, validateTorchProbeStatus, validateTorchPythonChoice, validateTorchReleaseCombination, validateTorchReleaseDriverStatus, validateTorchReleaseOptionsOutcome, validateTorchReleaseOptionsStatus, validateTorchReleaseRecommendation, validateTorchRuntimeAutomaticBuilds, validateTorchRuntimeHostDriver, validateTorchRuntimeHostDriverState, validateTorchRuntimeOptionsOutcome, validateTorchRuntimePreview, validateTorchRuntimePreviewArtifact, validateTorchRuntimePreviewOutcome, validateTorchRuntimePreviewQualification, validateTorchRuntimePreviewRejectionReason, validateTorchRuntimeProbeOutcome, validateTorchTrialCleanup, validateTorchTrialHealthStatus, validateTorchTrialStartupStatus, validateTorchVerifiedPackage, validateTorchVerifiedRuntime, validateTrialTorchRuntimeOutcome, validateTrialTorchRuntimeParams, validateUpdateInferenceSettingsOutcome, validateUpdateInferenceSettingsParams, validateUpdateModelNotesOutcome, validateUpdateModelNotesParams, validateUpdateStreamError, validateValidateInstallationsOutcome, validateVersionInfoOutcome, validateVersionStatusOutcome } from "./desktop-contract.validators.js";
class InvalidJsonRepresentation extends Error {
}
diff --git a/packages/desktop-contract/generated/desktop-contract.validators.js b/packages/desktop-contract/generated/desktop-contract.validators.js
index 04044c284..2fbe47aae 100644
--- a/packages/desktop-contract/generated/desktop-contract.validators.js
+++ b/packages/desktop-contract/generated/desktop-contract.validators.js
@@ -1,4 +1,4 @@
-// Generated from the pumas-rpc contract export and electron/contracts; SHA256 8a28edee717b40f1aa334d587e6ca2b0e47c1baf973f2788530a7e364e18c7cf. DO NOT EDIT.
+// Generated from the pumas-rpc contract export and electron/contracts; SHA256 6d976869ac7810ed599372087c55382718d651838f03edbfe3e0764fe6b82597. DO NOT EDIT.
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
try {
@@ -17695,7 +17695,7 @@ function validate130(data, { instancePath = "", parentData, parentDataProperty,
validate130.errors = vErrors;
return errors === 0;
}
-var schema159 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" };
+var schema159 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" };
var schema156 = { "additionalProperties": false, "properties": { "device_mode": { "$ref": "#/definitions/RuntimeDeviceMode" }, "fit": { "$ref": "#/definitions/PlacementFit" }, "ram_bytes": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] }, "vram_bytes": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] } }, "required": ["device_mode", "vram_bytes", "ram_bytes", "fit"], "type": "object" };
var schema157 = { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" };
var schema158 = { "oneOf": [{ "enum": ["fits"], "type": "string" }, { "const": "exceeds_gpu_memory", "description": "The GPU share exceeds the free GPU memory.", "type": "string" }, { "const": "exceeds_system_memory", "description": "The system share exceeds the free system memory.", "type": "string" }, { "const": "no_gpu", "description": "The placement needs a GPU and the sample reported none.", "type": "string" }, { "const": "unknown", "description": "The estimate or the memory sample is unavailable.", "type": "string" }] };
@@ -18055,7 +18055,7 @@ function validate135(data, { instancePath = "", parentData, parentDataProperty,
}
errors++;
}
- if (!(data4 === "torch" || data4 === "ollama" || data4 === "llama_cpp" || data4 === "onnx_runtime" || data4 === "trellis_cpp")) {
+ if (!(data4 === "torch" || data4 === "ollama" || data4 === "llama_cpp" || data4 === "onnx_runtime" || data4 === "basalt" || data4 === "trellis_cpp")) {
const err1 = { instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema159.enum }, message: "must be equal to one of the allowed values" };
if (vErrors === null) {
vErrors = [err1];
@@ -18189,7 +18189,7 @@ function validate132(data, { instancePath = "", parentData, parentDataProperty,
validate132.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data2 === "torch" || data2 === "ollama" || data2 === "llama_cpp" || data2 === "onnx_runtime" || data2 === "trellis_cpp")) {
+ if (!(data2 === "torch" || data2 === "ollama" || data2 === "llama_cpp" || data2 === "onnx_runtime" || data2 === "basalt" || data2 === "trellis_cpp")) {
validate132.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema159.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -21464,12 +21464,12 @@ function validate154(data, { instancePath = "", parentData, parentDataProperty,
return errors === 0;
}
var validateRuntimeProfilesSnapshotResponse = validate155;
-var schema186 = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "ModelRuntimeRoute": { "additionalProperties": false, "properties": { "auto_load": { "default": false, "type": "boolean" }, "model_id": { "type": "string" }, "profile_id": { "type": ["string", "null"] }, "provider": { "$ref": "#/definitions/RuntimeProviderId" } }, "required": ["provider", "model_id", "auto_load"], "type": "object" }, "RuntimeDeviceMode": { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" }, "RuntimeDeviceSettings": { "additionalProperties": false, "properties": { "device_id": { "type": ["string", "null"] }, "gpu_layers": { "maximum": 2147483647, "minimum": -2147483648, "type": ["integer", "null"] }, "mode": { "$ref": "#/definitions/RuntimeDeviceMode" }, "tensor_split": { "items": { "maximum": 34028234663852886e22, "minimum": -34028234663852886e22, "type": "number" }, "type": ["array", "null"] } }, "required": ["mode"], "type": "object" }, "RuntimeLifecycleState": { "enum": ["unknown", "stopped", "starting", "running", "stopping", "failed", "external"], "type": "string" }, "RuntimeManagementMode": { "enum": ["managed", "external"], "type": "string" }, "RuntimeProfileConfig": { "additionalProperties": false, "properties": { "device": { "allOf": [{ "$ref": "#/definitions/RuntimeDeviceSettings" }], "default": { "mode": "auto" } }, "enabled": { "default": true, "type": "boolean" }, "endpoint_url": { "type": ["string", "null"] }, "management_mode": { "$ref": "#/definitions/RuntimeManagementMode" }, "name": { "type": "string" }, "port": { "maximum": 65535, "minimum": 0, "type": ["integer", "null"] }, "profile_id": { "type": "string" }, "provider": { "$ref": "#/definitions/RuntimeProviderId" }, "provider_mode": { "$ref": "#/definitions/RuntimeProviderMode" }, "runtime_version": { "description": "Installed runtime version this managed profile launches, such as\n`b9082+cuda-12` for llama.cpp. `None` follows the runtime's active\nversion at each launch. Profiles that name different versions run as\nseparate processes at the same time; a running instance keeps the\nversion it started with.", "type": ["string", "null"] }, "scheduler": { "allOf": [{ "$ref": "#/definitions/RuntimeSchedulerSettings" }], "default": { "auto_load": true } } }, "required": ["profile_id", "provider", "provider_mode", "management_mode", "name", "enabled", "device", "scheduler"], "type": "object" }, "RuntimeProfileStatus": { "additionalProperties": false, "properties": { "endpoint_url": { "type": ["string", "null"] }, "last_error": { "type": ["string", "null"] }, "log_path": { "type": ["string", "null"] }, "pid": { "maximum": 4294967295, "minimum": 0, "type": ["integer", "null"] }, "profile_id": { "type": "string" }, "runtime_version": { "description": "Installed runtime version the running instance was launched from.", "type": ["string", "null"] }, "state": { "$ref": "#/definitions/RuntimeLifecycleState" } }, "required": ["profile_id", "state"], "type": "object" }, "RuntimeProfilesSnapshot": { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "default_profile_id": { "type": ["string", "null"] }, "profiles": { "items": { "$ref": "#/definitions/RuntimeProfileConfig" }, "type": "array" }, "routes": { "items": { "$ref": "#/definitions/ModelRuntimeRoute" }, "type": "array" }, "schema_version": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "statuses": { "items": { "$ref": "#/definitions/RuntimeProfileStatus" }, "type": "array" } }, "required": ["schema_version", "cursor", "profiles", "routes", "statuses"], "type": "object" }, "RuntimeProviderId": { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" }, "RuntimeProviderMode": { "enum": ["torch_serve", "ollama_serve", "llama_cpp_router", "llama_cpp_dedicated", "onnx_serve", "trellis_serve"], "type": "string" }, "RuntimeSchedulerSettings": { "additionalProperties": false, "properties": { "auto_load": { "default": false, "type": "boolean" }, "keep_alive_seconds": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] }, "max_concurrent_models": { "maximum": 65535, "minimum": 0, "type": ["integer", "null"] } }, "required": ["auto_load"], "type": "object" } }, "properties": { "error": { "type": ["string", "null"] }, "snapshot": { "$ref": "#/definitions/RuntimeProfilesSnapshot" }, "success": { "type": "boolean" } }, "required": ["success", "snapshot"], "title": "RuntimeProfilesSnapshotResponse", "type": "object" };
+var schema186 = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "ModelRuntimeRoute": { "additionalProperties": false, "properties": { "auto_load": { "default": false, "type": "boolean" }, "model_id": { "type": "string" }, "profile_id": { "type": ["string", "null"] }, "provider": { "$ref": "#/definitions/RuntimeProviderId" } }, "required": ["provider", "model_id", "auto_load"], "type": "object" }, "RuntimeDeviceMode": { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" }, "RuntimeDeviceSettings": { "additionalProperties": false, "properties": { "device_id": { "type": ["string", "null"] }, "gpu_layers": { "maximum": 2147483647, "minimum": -2147483648, "type": ["integer", "null"] }, "mode": { "$ref": "#/definitions/RuntimeDeviceMode" }, "tensor_split": { "items": { "maximum": 34028234663852886e22, "minimum": -34028234663852886e22, "type": "number" }, "type": ["array", "null"] } }, "required": ["mode"], "type": "object" }, "RuntimeLifecycleState": { "enum": ["unknown", "stopped", "starting", "running", "stopping", "failed", "external"], "type": "string" }, "RuntimeManagementMode": { "enum": ["managed", "external"], "type": "string" }, "RuntimeProfileConfig": { "additionalProperties": false, "properties": { "device": { "allOf": [{ "$ref": "#/definitions/RuntimeDeviceSettings" }], "default": { "mode": "auto" } }, "enabled": { "default": true, "type": "boolean" }, "endpoint_url": { "type": ["string", "null"] }, "management_mode": { "$ref": "#/definitions/RuntimeManagementMode" }, "name": { "type": "string" }, "port": { "maximum": 65535, "minimum": 0, "type": ["integer", "null"] }, "profile_id": { "type": "string" }, "provider": { "$ref": "#/definitions/RuntimeProviderId" }, "provider_mode": { "$ref": "#/definitions/RuntimeProviderMode" }, "runtime_version": { "description": "Installed runtime version this managed profile launches, such as\n`b9082+cuda-12` for llama.cpp. `None` follows the runtime's active\nversion at each launch. Profiles that name different versions run as\nseparate processes at the same time; a running instance keeps the\nversion it started with.", "type": ["string", "null"] }, "scheduler": { "allOf": [{ "$ref": "#/definitions/RuntimeSchedulerSettings" }], "default": { "auto_load": true } } }, "required": ["profile_id", "provider", "provider_mode", "management_mode", "name", "enabled", "device", "scheduler"], "type": "object" }, "RuntimeProfileStatus": { "additionalProperties": false, "properties": { "endpoint_url": { "type": ["string", "null"] }, "last_error": { "type": ["string", "null"] }, "log_path": { "type": ["string", "null"] }, "pid": { "maximum": 4294967295, "minimum": 0, "type": ["integer", "null"] }, "profile_id": { "type": "string" }, "runtime_version": { "description": "Installed runtime version the running instance was launched from.", "type": ["string", "null"] }, "state": { "$ref": "#/definitions/RuntimeLifecycleState" } }, "required": ["profile_id", "state"], "type": "object" }, "RuntimeProfilesSnapshot": { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "default_profile_id": { "type": ["string", "null"] }, "profiles": { "items": { "$ref": "#/definitions/RuntimeProfileConfig" }, "type": "array" }, "routes": { "items": { "$ref": "#/definitions/ModelRuntimeRoute" }, "type": "array" }, "schema_version": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "statuses": { "items": { "$ref": "#/definitions/RuntimeProfileStatus" }, "type": "array" } }, "required": ["schema_version", "cursor", "profiles", "routes", "statuses"], "type": "object" }, "RuntimeProviderId": { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" }, "RuntimeProviderMode": { "enum": ["torch_serve", "ollama_serve", "llama_cpp_router", "llama_cpp_dedicated", "onnx_serve", "basalt_serve", "trellis_serve"], "type": "string" }, "RuntimeSchedulerSettings": { "additionalProperties": false, "properties": { "auto_load": { "default": false, "type": "boolean" }, "keep_alive_seconds": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] }, "max_concurrent_models": { "maximum": 65535, "minimum": 0, "type": ["integer", "null"] } }, "required": ["auto_load"], "type": "object" } }, "properties": { "error": { "type": ["string", "null"] }, "snapshot": { "$ref": "#/definitions/RuntimeProfilesSnapshot" }, "success": { "type": "boolean" } }, "required": ["success", "snapshot"], "title": "RuntimeProfilesSnapshotResponse", "type": "object" };
var schema187 = { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "default_profile_id": { "type": ["string", "null"] }, "profiles": { "items": { "$ref": "#/definitions/RuntimeProfileConfig" }, "type": "array" }, "routes": { "items": { "$ref": "#/definitions/ModelRuntimeRoute" }, "type": "array" }, "schema_version": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "statuses": { "items": { "$ref": "#/definitions/RuntimeProfileStatus" }, "type": "array" } }, "required": ["schema_version", "cursor", "profiles", "routes", "statuses"], "type": "object" };
var schema188 = { "additionalProperties": false, "properties": { "device": { "allOf": [{ "$ref": "#/definitions/RuntimeDeviceSettings" }], "default": { "mode": "auto" } }, "enabled": { "default": true, "type": "boolean" }, "endpoint_url": { "type": ["string", "null"] }, "management_mode": { "$ref": "#/definitions/RuntimeManagementMode" }, "name": { "type": "string" }, "port": { "maximum": 65535, "minimum": 0, "type": ["integer", "null"] }, "profile_id": { "type": "string" }, "provider": { "$ref": "#/definitions/RuntimeProviderId" }, "provider_mode": { "$ref": "#/definitions/RuntimeProviderMode" }, "runtime_version": { "description": "Installed runtime version this managed profile launches, such as\n`b9082+cuda-12` for llama.cpp. `None` follows the runtime's active\nversion at each launch. Profiles that name different versions run as\nseparate processes at the same time; a running instance keeps the\nversion it started with.", "type": ["string", "null"] }, "scheduler": { "allOf": [{ "$ref": "#/definitions/RuntimeSchedulerSettings" }], "default": { "auto_load": true } } }, "required": ["profile_id", "provider", "provider_mode", "management_mode", "name", "enabled", "device", "scheduler"], "type": "object" };
var schema191 = { "enum": ["managed", "external"], "type": "string" };
-var schema192 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" };
-var schema193 = { "enum": ["torch_serve", "ollama_serve", "llama_cpp_router", "llama_cpp_dedicated", "onnx_serve", "trellis_serve"], "type": "string" };
+var schema192 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" };
+var schema193 = { "enum": ["torch_serve", "ollama_serve", "llama_cpp_router", "llama_cpp_dedicated", "onnx_serve", "basalt_serve", "trellis_serve"], "type": "string" };
var schema194 = { "additionalProperties": false, "properties": { "auto_load": { "default": false, "type": "boolean" }, "keep_alive_seconds": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] }, "max_concurrent_models": { "maximum": 65535, "minimum": 0, "type": ["integer", "null"] } }, "required": ["auto_load"], "type": "object" };
var schema189 = { "additionalProperties": false, "properties": { "device_id": { "type": ["string", "null"] }, "gpu_layers": { "maximum": 2147483647, "minimum": -2147483648, "type": ["integer", "null"] }, "mode": { "$ref": "#/definitions/RuntimeDeviceMode" }, "tensor_split": { "items": { "maximum": 34028234663852886e22, "minimum": -34028234663852886e22, "type": "number" }, "type": ["array", "null"] } }, "required": ["mode"], "type": "object" };
var schema190 = { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" };
@@ -21722,7 +21722,7 @@ function validate157(data, { instancePath = "", parentData, parentDataProperty,
validate157.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data7 === "torch" || data7 === "ollama" || data7 === "llama_cpp" || data7 === "onnx_runtime" || data7 === "trellis_cpp")) {
+ if (!(data7 === "torch" || data7 === "ollama" || data7 === "llama_cpp" || data7 === "onnx_runtime" || data7 === "basalt" || data7 === "trellis_cpp")) {
validate157.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema192.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -21738,7 +21738,7 @@ function validate157(data, { instancePath = "", parentData, parentDataProperty,
validate157.errors = [{ instancePath: instancePath + "/provider_mode", schemaPath: "#/definitions/RuntimeProviderMode/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data8 === "torch_serve" || data8 === "ollama_serve" || data8 === "llama_cpp_router" || data8 === "llama_cpp_dedicated" || data8 === "onnx_serve" || data8 === "trellis_serve")) {
+ if (!(data8 === "torch_serve" || data8 === "ollama_serve" || data8 === "llama_cpp_router" || data8 === "llama_cpp_dedicated" || data8 === "onnx_serve" || data8 === "basalt_serve" || data8 === "trellis_serve")) {
validate157.errors = [{ instancePath: instancePath + "/provider_mode", schemaPath: "#/definitions/RuntimeProviderMode/enum", keyword: "enum", params: { allowedValues: schema193.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -21933,7 +21933,7 @@ function validate161(data, { instancePath = "", parentData, parentDataProperty,
validate161.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data3 === "torch" || data3 === "ollama" || data3 === "llama_cpp" || data3 === "onnx_runtime" || data3 === "trellis_cpp")) {
+ if (!(data3 === "torch" || data3 === "ollama" || data3 === "llama_cpp" || data3 === "onnx_runtime" || data3 === "basalt" || data3 === "trellis_cpp")) {
validate161.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema192.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -22322,7 +22322,7 @@ function validate155(data, { instancePath = "", parentData, parentDataProperty,
var validateRuntimeProfileUpdateFeed = validate166;
var schema200 = { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "event_kind": { "$ref": "#/definitions/RuntimeProfileEventKind" }, "model_id": { "type": ["string", "null"] }, "producer_revision": { "type": ["string", "null"] }, "profile_id": { "type": ["string", "null"] }, "provider": { "anyOf": [{ "$ref": "#/definitions/RuntimeProviderId" }, { "type": "null" }] } }, "required": ["cursor", "event_kind"], "type": "object" };
var schema201 = { "enum": ["profile_created", "profile_updated", "profile_deleted", "route_updated", "route_deleted", "status_changed", "snapshot_required"], "type": "string" };
-var schema202 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" };
+var schema202 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" };
function validate167(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
let vErrors = null;
let errors = 0;
@@ -22420,7 +22420,7 @@ function validate167(data, { instancePath = "", parentData, parentDataProperty,
}
errors++;
}
- if (!(data5 === "torch" || data5 === "ollama" || data5 === "llama_cpp" || data5 === "onnx_runtime" || data5 === "trellis_cpp")) {
+ if (!(data5 === "torch" || data5 === "ollama" || data5 === "llama_cpp" || data5 === "onnx_runtime" || data5 === "basalt" || data5 === "trellis_cpp")) {
const err1 = { instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema202.enum }, message: "must be equal to one of the allowed values" };
if (vErrors === null) {
vErrors = [err1];
@@ -22578,10 +22578,10 @@ function validate166(data, { instancePath = "", parentData, parentDataProperty,
}
var validateRuntimeProvidersOutcome = validate169;
var schema204 = { "additionalProperties": false, "description": "One registered runtime provider, as the desktop may present it.", "properties": { "app_id": { "description": "Version-manager app id whose installed versions a managed profile of\nthis provider launches.", "type": "string" }, "artifact_formats": { "description": "Primary artifact formats this provider executes.", "items": { "$ref": "#/definitions/ExecutableArtifactFormat" }, "type": "array" }, "device_modes": { "description": "Device modes a profile of this provider may request.", "items": { "$ref": "#/definitions/RuntimeDeviceMode" }, "type": "array" }, "launch_on_serve_modes": { "description": "Provider modes whose managed profiles start themselves on the first\nserve request.", "items": { "$ref": "#/definitions/RuntimeProviderMode" }, "type": "array" }, "provider": { "$ref": "#/definitions/RuntimeProviderId" }, "provider_modes": { "items": { "$ref": "#/definitions/RuntimeProviderMode" }, "type": "array" }, "request_controls": { "description": "For each provider mode, the serve-request fields that may differ from\nthe selected profile. Every other placement field must be left unset.", "items": { "$ref": "#/definitions/ProviderModeRequestControls" }, "type": "array" }, "serving_tasks": { "description": "Tasks this provider serves.", "items": { "$ref": "#/definitions/ServingTask" }, "type": "array" }, "supports_external_profiles": { "type": "boolean" }, "supports_managed_profiles": { "type": "boolean" }, "version_managed": { "description": "Whether this server holds a version manager for `app_id`. False when\nthe build has none or it failed to initialize.", "type": "boolean" } }, "required": ["provider", "app_id", "version_managed", "provider_modes", "device_modes", "supports_managed_profiles", "supports_external_profiles", "artifact_formats", "serving_tasks", "launch_on_serve_modes", "request_controls"], "type": "object" };
-var schema205 = { "enum": ["safetensors", "gguf", "onnx"], "type": "string" };
+var schema205 = { "enum": ["safetensors", "gguf", "onnx", "basalt"], "type": "string" };
var schema206 = { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" };
-var schema207 = { "enum": ["torch_serve", "ollama_serve", "llama_cpp_router", "llama_cpp_dedicated", "onnx_serve", "trellis_serve"], "type": "string" };
-var schema208 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" };
+var schema207 = { "enum": ["torch_serve", "ollama_serve", "llama_cpp_router", "llama_cpp_dedicated", "onnx_serve", "basalt_serve", "trellis_serve"], "type": "string" };
+var schema208 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" };
var schema213 = { "oneOf": [{ "enum": ["image_generation", "image_to_text", "chat", "completion", "embedding", "reranking"], "type": "string" }, { "const": "decision", "description": "Native decision models (llama.cpp `/v1/systemone`).", "type": "string" }, { "const": "mesh_generation", "description": "Image-to-3D generation into the artifact store (ADR 0010).", "type": "string" }] };
var schema211 = { "description": "A field of a serve request that may differ from the selected runtime\nprofile. Fields not listed for a mode must be left unset (or Auto for the\ndevice mode); serving validation refuses them with `unsupported_placement`.", "enum": ["device_mode", "device_id", "gpu_layers", "tensor_split", "context_size"], "type": "string" };
function validate171(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -22643,7 +22643,7 @@ function validate171(data, { instancePath = "", parentData, parentDataProperty,
validate171.errors = [{ instancePath: instancePath + "/provider_mode", schemaPath: "#/definitions/RuntimeProviderMode/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data2 === "torch_serve" || data2 === "ollama_serve" || data2 === "llama_cpp_router" || data2 === "llama_cpp_dedicated" || data2 === "onnx_serve" || data2 === "trellis_serve")) {
+ if (!(data2 === "torch_serve" || data2 === "ollama_serve" || data2 === "llama_cpp_router" || data2 === "llama_cpp_dedicated" || data2 === "onnx_serve" || data2 === "basalt_serve" || data2 === "trellis_serve")) {
validate171.errors = [{ instancePath: instancePath + "/provider_mode", schemaPath: "#/definitions/RuntimeProviderMode/enum", keyword: "enum", params: { allowedValues: schema207.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -22706,7 +22706,7 @@ function validate170(data, { instancePath = "", parentData, parentDataProperty,
validate170.errors = [{ instancePath: instancePath + "/artifact_formats/" + i0, schemaPath: "#/definitions/ExecutableArtifactFormat/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data2 === "safetensors" || data2 === "gguf" || data2 === "onnx")) {
+ if (!(data2 === "safetensors" || data2 === "gguf" || data2 === "onnx" || data2 === "basalt")) {
validate170.errors = [{ instancePath: instancePath + "/artifact_formats/" + i0, schemaPath: "#/definitions/ExecutableArtifactFormat/enum", keyword: "enum", params: { allowedValues: schema205.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -22772,7 +22772,7 @@ function validate170(data, { instancePath = "", parentData, parentDataProperty,
validate170.errors = [{ instancePath: instancePath + "/launch_on_serve_modes/" + i2, schemaPath: "#/definitions/RuntimeProviderMode/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data6 === "torch_serve" || data6 === "ollama_serve" || data6 === "llama_cpp_router" || data6 === "llama_cpp_dedicated" || data6 === "onnx_serve" || data6 === "trellis_serve")) {
+ if (!(data6 === "torch_serve" || data6 === "ollama_serve" || data6 === "llama_cpp_router" || data6 === "llama_cpp_dedicated" || data6 === "onnx_serve" || data6 === "basalt_serve" || data6 === "trellis_serve")) {
validate170.errors = [{ instancePath: instancePath + "/launch_on_serve_modes/" + i2, schemaPath: "#/definitions/RuntimeProviderMode/enum", keyword: "enum", params: { allowedValues: schema207.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -22798,7 +22798,7 @@ function validate170(data, { instancePath = "", parentData, parentDataProperty,
validate170.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data7 === "torch" || data7 === "ollama" || data7 === "llama_cpp" || data7 === "onnx_runtime" || data7 === "trellis_cpp")) {
+ if (!(data7 === "torch" || data7 === "ollama" || data7 === "llama_cpp" || data7 === "onnx_runtime" || data7 === "basalt" || data7 === "trellis_cpp")) {
validate170.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema208.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -22821,7 +22821,7 @@ function validate170(data, { instancePath = "", parentData, parentDataProperty,
validate170.errors = [{ instancePath: instancePath + "/provider_modes/" + i3, schemaPath: "#/definitions/RuntimeProviderMode/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data9 === "torch_serve" || data9 === "ollama_serve" || data9 === "llama_cpp_router" || data9 === "llama_cpp_dedicated" || data9 === "onnx_serve" || data9 === "trellis_serve")) {
+ if (!(data9 === "torch_serve" || data9 === "ollama_serve" || data9 === "llama_cpp_router" || data9 === "llama_cpp_dedicated" || data9 === "onnx_serve" || data9 === "basalt_serve" || data9 === "trellis_serve")) {
validate170.errors = [{ instancePath: instancePath + "/provider_modes/" + i3, schemaPath: "#/definitions/RuntimeProviderMode/enum", keyword: "enum", params: { allowedValues: schema207.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -36025,7 +36025,7 @@ function validate234(data, { instancePath = "", parentData, parentDataProperty,
return errors === 0;
}
var validateServingStatusResponse = validate235;
-var schema288 = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "ModelServeError": { "additionalProperties": false, "properties": { "code": { "$ref": "#/definitions/ModelServeErrorCode" }, "message": { "type": "string" }, "model_id": { "type": ["string", "null"] }, "profile_id": { "type": ["string", "null"] }, "provider": { "anyOf": [{ "$ref": "#/definitions/RuntimeProviderId" }, { "type": "null" }] }, "severity": { "$ref": "#/definitions/ModelServeErrorSeverity" } }, "required": ["code", "severity", "message"], "type": "object" }, "ModelServeErrorCode": { "enum": ["invalid_request", "model_not_found", "model_not_executable", "profile_not_found", "profile_stopped", "unsupported_provider", "unsupported_placement", "device_unavailable", "insufficient_memory", "provider_load_failed", "missing_runtime", "invalid_format", "endpoint_unavailable", "duplicate_model_alias", "ambiguous_model_routing", "unknown"], "type": "string" }, "ModelServeErrorSeverity": { "enum": ["non_critical", "critical"], "type": "string" }, "RouterCatalogState": { "enum": ["current", "pending", "uncertain"], "type": "string" }, "RouterObservationState": { "enum": ["connecting", "current", "unavailable"], "type": "string" }, "RouterProfileSyncStatus": { "oneOf": [{ "additionalProperties": false, "properties": { "catalog_state": { "enum": ["current", "pending"], "type": "string" }, "generation": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "last_error": { "type": ["string", "null"] }, "observation_state": { "$ref": "#/definitions/RouterObservationState" }, "pending_model_ids": { "items": { "type": "string" }, "type": "array" }, "profile_id": { "type": "string" } }, "required": ["profile_id", "generation", "observation_state", "catalog_state", "pending_model_ids", "last_error"], "type": "object" }, { "additionalProperties": false, "properties": { "catalog_state": { "enum": ["uncertain"], "type": "string" }, "generation": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "last_error": { "type": ["string", "null"] }, "observation_state": { "enum": ["unavailable"], "type": "string" }, "pending_model_ids": { "items": { "type": "string" }, "type": "array" }, "profile_id": { "type": "string" } }, "required": ["profile_id", "generation", "observation_state", "catalog_state", "pending_model_ids", "last_error"], "type": "object" }] }, "RuntimeDeviceMode": { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" }, "RuntimeProviderId": { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" }, "ServedModelLoadState": { "enum": ["requested", "loading", "loaded", "unloading", "unloaded", "failed"], "type": "string" }, "ServedModelStatus": { "additionalProperties": false, "properties": { "context_size": { "maximum": 4294967295, "minimum": 0, "type": ["integer", "null"] }, "device_id": { "type": ["string", "null"] }, "device_mode": { "$ref": "#/definitions/RuntimeDeviceMode" }, "endpoint_url": { "type": ["string", "null"] }, "gpu_layers": { "maximum": 2147483647, "minimum": -2147483648, "type": ["integer", "null"] }, "keep_loaded": { "default": false, "type": "boolean" }, "last_error": { "anyOf": [{ "$ref": "#/definitions/ModelServeError" }, { "type": "null" }] }, "load_state": { "$ref": "#/definitions/ServedModelLoadState" }, "loaded_at": { "type": ["string", "null"] }, "memory_bytes": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] }, "model_alias": { "type": ["string", "null"] }, "model_id": { "type": "string" }, "profile_id": { "type": "string" }, "provider": { "$ref": "#/definitions/RuntimeProviderId" }, "tensor_split": { "items": { "maximum": 34028234663852886e22, "minimum": -34028234663852886e22, "type": "number" }, "type": ["array", "null"] } }, "required": ["model_id", "provider", "profile_id", "load_state", "device_mode", "keep_loaded"], "type": "object" }, "ServingEndpointMode": { "enum": ["not_configured", "provider_endpoint", "pumas_gateway"], "type": "string" }, "ServingEndpointStatus": { "additionalProperties": false, "properties": { "endpoint_mode": { "$ref": "#/definitions/ServingEndpointMode" }, "endpoint_url": { "type": ["string", "null"] }, "message": { "type": ["string", "null"] }, "model_count": { "default": 0, "maximum": 4294967295, "minimum": 0, "type": "integer" } }, "required": ["endpoint_mode", "model_count"], "type": "object" }, "ServingStatusSnapshot": { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "endpoint": { "$ref": "#/definitions/ServingEndpointStatus" }, "last_errors": { "items": { "$ref": "#/definitions/ModelServeError" }, "type": "array" }, "router_profiles": { "default": [], "items": { "$ref": "#/definitions/RouterProfileSyncStatus" }, "type": "array" }, "schema_version": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "served_models": { "items": { "$ref": "#/definitions/ServedModelStatus" }, "type": "array" } }, "required": ["schema_version", "cursor", "endpoint", "served_models", "router_profiles", "last_errors"], "type": "object" } }, "properties": { "error": { "type": ["string", "null"] }, "snapshot": { "$ref": "#/definitions/ServingStatusSnapshot" }, "success": { "type": "boolean" } }, "required": ["success", "snapshot"], "title": "ServingStatusResponse", "type": "object" };
+var schema288 = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { "ModelServeError": { "additionalProperties": false, "properties": { "code": { "$ref": "#/definitions/ModelServeErrorCode" }, "message": { "type": "string" }, "model_id": { "type": ["string", "null"] }, "profile_id": { "type": ["string", "null"] }, "provider": { "anyOf": [{ "$ref": "#/definitions/RuntimeProviderId" }, { "type": "null" }] }, "severity": { "$ref": "#/definitions/ModelServeErrorSeverity" } }, "required": ["code", "severity", "message"], "type": "object" }, "ModelServeErrorCode": { "enum": ["invalid_request", "model_not_found", "model_not_executable", "profile_not_found", "profile_stopped", "unsupported_provider", "unsupported_placement", "device_unavailable", "insufficient_memory", "provider_load_failed", "missing_runtime", "invalid_format", "endpoint_unavailable", "duplicate_model_alias", "ambiguous_model_routing", "unknown"], "type": "string" }, "ModelServeErrorSeverity": { "enum": ["non_critical", "critical"], "type": "string" }, "RouterCatalogState": { "enum": ["current", "pending", "uncertain"], "type": "string" }, "RouterObservationState": { "enum": ["connecting", "current", "unavailable"], "type": "string" }, "RouterProfileSyncStatus": { "oneOf": [{ "additionalProperties": false, "properties": { "catalog_state": { "enum": ["current", "pending"], "type": "string" }, "generation": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "last_error": { "type": ["string", "null"] }, "observation_state": { "$ref": "#/definitions/RouterObservationState" }, "pending_model_ids": { "items": { "type": "string" }, "type": "array" }, "profile_id": { "type": "string" } }, "required": ["profile_id", "generation", "observation_state", "catalog_state", "pending_model_ids", "last_error"], "type": "object" }, { "additionalProperties": false, "properties": { "catalog_state": { "enum": ["uncertain"], "type": "string" }, "generation": { "maximum": 9007199254740991, "minimum": 0, "type": "integer" }, "last_error": { "type": ["string", "null"] }, "observation_state": { "enum": ["unavailable"], "type": "string" }, "pending_model_ids": { "items": { "type": "string" }, "type": "array" }, "profile_id": { "type": "string" } }, "required": ["profile_id", "generation", "observation_state", "catalog_state", "pending_model_ids", "last_error"], "type": "object" }] }, "RuntimeDeviceMode": { "enum": ["auto", "cpu", "gpu", "hybrid", "specific_device"], "type": "string" }, "RuntimeProviderId": { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" }, "ServedModelLoadState": { "enum": ["requested", "loading", "loaded", "unloading", "unloaded", "failed"], "type": "string" }, "ServedModelStatus": { "additionalProperties": false, "properties": { "context_size": { "maximum": 4294967295, "minimum": 0, "type": ["integer", "null"] }, "device_id": { "type": ["string", "null"] }, "device_mode": { "$ref": "#/definitions/RuntimeDeviceMode" }, "endpoint_url": { "type": ["string", "null"] }, "gpu_layers": { "maximum": 2147483647, "minimum": -2147483648, "type": ["integer", "null"] }, "keep_loaded": { "default": false, "type": "boolean" }, "last_error": { "anyOf": [{ "$ref": "#/definitions/ModelServeError" }, { "type": "null" }] }, "load_state": { "$ref": "#/definitions/ServedModelLoadState" }, "loaded_at": { "type": ["string", "null"] }, "memory_bytes": { "maximum": 9007199254740991, "minimum": 0, "type": ["integer", "null"] }, "model_alias": { "type": ["string", "null"] }, "model_id": { "type": "string" }, "profile_id": { "type": "string" }, "provider": { "$ref": "#/definitions/RuntimeProviderId" }, "tensor_split": { "items": { "maximum": 34028234663852886e22, "minimum": -34028234663852886e22, "type": "number" }, "type": ["array", "null"] } }, "required": ["model_id", "provider", "profile_id", "load_state", "device_mode", "keep_loaded"], "type": "object" }, "ServingEndpointMode": { "enum": ["not_configured", "provider_endpoint", "pumas_gateway"], "type": "string" }, "ServingEndpointStatus": { "additionalProperties": false, "properties": { "endpoint_mode": { "$ref": "#/definitions/ServingEndpointMode" }, "endpoint_url": { "type": ["string", "null"] }, "message": { "type": ["string", "null"] }, "model_count": { "default": 0, "maximum": 4294967295, "minimum": 0, "type": "integer" } }, "required": ["endpoint_mode", "model_count"], "type": "object" }, "ServingStatusSnapshot": { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "endpoint": { "$ref": "#/definitions/ServingEndpointStatus" }, "last_errors": { "items": { "$ref": "#/definitions/ModelServeError" }, "type": "array" }, "router_profiles": { "default": [], "items": { "$ref": "#/definitions/RouterProfileSyncStatus" }, "type": "array" }, "schema_version": { "maximum": 4294967295, "minimum": 0, "type": "integer" }, "served_models": { "items": { "$ref": "#/definitions/ServedModelStatus" }, "type": "array" } }, "required": ["schema_version", "cursor", "endpoint", "served_models", "router_profiles", "last_errors"], "type": "object" } }, "properties": { "error": { "type": ["string", "null"] }, "snapshot": { "$ref": "#/definitions/ServingStatusSnapshot" }, "success": { "type": "boolean" } }, "required": ["success", "snapshot"], "title": "ServingStatusResponse", "type": "object" };
var schema290 = { "additionalProperties": false, "properties": { "endpoint_mode": { "$ref": "#/definitions/ServingEndpointMode" }, "endpoint_url": { "type": ["string", "null"] }, "message": { "type": ["string", "null"] }, "model_count": { "default": 0, "maximum": 4294967295, "minimum": 0, "type": "integer" } }, "required": ["endpoint_mode", "model_count"], "type": "object" };
var schema291 = { "enum": ["not_configured", "provider_endpoint", "pumas_gateway"], "type": "string" };
function validate237(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -36126,7 +36126,7 @@ function validate237(data, { instancePath = "", parentData, parentDataProperty,
}
var schema292 = { "additionalProperties": false, "properties": { "code": { "$ref": "#/definitions/ModelServeErrorCode" }, "message": { "type": "string" }, "model_id": { "type": ["string", "null"] }, "profile_id": { "type": ["string", "null"] }, "provider": { "anyOf": [{ "$ref": "#/definitions/RuntimeProviderId" }, { "type": "null" }] }, "severity": { "$ref": "#/definitions/ModelServeErrorSeverity" } }, "required": ["code", "severity", "message"], "type": "object" };
var schema293 = { "enum": ["invalid_request", "model_not_found", "model_not_executable", "profile_not_found", "profile_stopped", "unsupported_provider", "unsupported_placement", "device_unavailable", "insufficient_memory", "provider_load_failed", "missing_runtime", "invalid_format", "endpoint_unavailable", "duplicate_model_alias", "ambiguous_model_routing", "unknown"], "type": "string" };
-var schema294 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" };
+var schema294 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" };
var schema295 = { "enum": ["non_critical", "critical"], "type": "string" };
function validate239(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
let vErrors = null;
@@ -36213,7 +36213,7 @@ function validate239(data, { instancePath = "", parentData, parentDataProperty,
}
errors++;
}
- if (!(data4 === "torch" || data4 === "ollama" || data4 === "llama_cpp" || data4 === "onnx_runtime" || data4 === "trellis_cpp")) {
+ if (!(data4 === "torch" || data4 === "ollama" || data4 === "llama_cpp" || data4 === "onnx_runtime" || data4 === "basalt" || data4 === "trellis_cpp")) {
const err1 = { instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema294.enum }, message: "must be equal to one of the allowed values" };
if (vErrors === null) {
vErrors = [err1];
@@ -37019,7 +37019,7 @@ function validate243(data, { instancePath = "", parentData, parentDataProperty,
validate243.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
return false;
}
- if (!(data13 === "torch" || data13 === "ollama" || data13 === "llama_cpp" || data13 === "onnx_runtime" || data13 === "trellis_cpp")) {
+ if (!(data13 === "torch" || data13 === "ollama" || data13 === "llama_cpp" || data13 === "onnx_runtime" || data13 === "basalt" || data13 === "trellis_cpp")) {
validate243.errors = [{ instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema294.enum }, message: "must be equal to one of the allowed values" }];
return false;
}
@@ -37324,7 +37324,7 @@ function validate235(data, { instancePath = "", parentData, parentDataProperty,
var validateServingStatusUpdateFeed = validate247;
var schema303 = { "additionalProperties": false, "properties": { "cursor": { "type": "string" }, "event_kind": { "$ref": "#/definitions/ServingStatusEventKind" }, "model_id": { "type": ["string", "null"] }, "profile_id": { "type": ["string", "null"] }, "provider": { "anyOf": [{ "$ref": "#/definitions/RuntimeProviderId" }, { "type": "null" }] } }, "required": ["cursor", "event_kind"], "type": "object" };
var schema304 = { "enum": ["model_loaded", "model_unloaded", "load_failed", "snapshot_required"], "type": "string" };
-var schema305 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "trellis_cpp"], "type": "string" };
+var schema305 = { "enum": ["torch", "ollama", "llama_cpp", "onnx_runtime", "basalt", "trellis_cpp"], "type": "string" };
function validate248(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
let vErrors = null;
let errors = 0;
@@ -37410,7 +37410,7 @@ function validate248(data, { instancePath = "", parentData, parentDataProperty,
}
errors++;
}
- if (!(data4 === "torch" || data4 === "ollama" || data4 === "llama_cpp" || data4 === "onnx_runtime" || data4 === "trellis_cpp")) {
+ if (!(data4 === "torch" || data4 === "ollama" || data4 === "llama_cpp" || data4 === "onnx_runtime" || data4 === "basalt" || data4 === "trellis_cpp")) {
const err1 = { instancePath: instancePath + "/provider", schemaPath: "#/definitions/RuntimeProviderId/enum", keyword: "enum", params: { allowedValues: schema305.enum }, message: "must be equal to one of the allowed values" };
if (vErrors === null) {
vErrors = [err1];
diff --git a/rust/crates/pumas-app-manager/src/version_manager/installer.rs b/rust/crates/pumas-app-manager/src/version_manager/installer.rs
index 94a274b72..3d8365007 100644
--- a/rust/crates/pumas-app-manager/src/version_manager/installer.rs
+++ b/rust/crates/pumas-app-manager/src/version_manager/installer.rs
@@ -592,13 +592,14 @@ fn hash_native_tree(root: &Path) -> Result {
/// The runtimes installed from publisher-verified native release archives.
///
-/// Both share acquisition, custody, receipts and recovery. They differ in the
+/// They share acquisition, custody, receipts and recovery. They differ in the
/// archive they select, how its contents are arranged, and the one regular file
/// a receipt names as the runtime's entry point.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum NativeRuntime {
LlamaCpp,
OnnxRuntime,
+ Basalt,
TrellisCpp,
}
@@ -607,6 +608,7 @@ impl NativeRuntime {
match app_id {
AppId::LlamaCpp => Ok(Self::LlamaCpp),
AppId::OnnxRuntime => Ok(Self::OnnxRuntime),
+ AppId::Basalt if pumas_library::basalt_distribution::available() => Ok(Self::Basalt),
AppId::TrellisCpp => Ok(Self::TrellisCpp),
other => Err(PumasError::Config {
message: format!("{other} is not installed from a native release archive"),
@@ -618,6 +620,7 @@ impl NativeRuntime {
match self {
Self::LlamaCpp => "llama.cpp",
Self::OnnxRuntime => "ONNX Runtime",
+ Self::Basalt => "Basalt",
Self::TrellisCpp => "trellis.cpp",
}
}
@@ -628,6 +631,7 @@ impl NativeRuntime {
match self {
Self::LlamaCpp => "runtime.llama.cpp",
Self::OnnxRuntime => "runtime.onnx-runtime",
+ Self::Basalt => "runtime.basalt",
Self::TrellisCpp => "runtime.trellis-cpp",
}
}
@@ -636,6 +640,7 @@ impl NativeRuntime {
match self {
Self::LlamaCpp => "llama-cpp",
Self::OnnxRuntime => "onnx-runtime",
+ Self::Basalt => "basalt",
Self::TrellisCpp => "trellis-cpp",
}
}
@@ -648,6 +653,7 @@ impl NativeRuntime {
Self::LlamaCpp if cfg!(windows) => "bin/llama-server.exe",
Self::LlamaCpp => "bin/llama-server",
Self::OnnxRuntime => pumas_library::onnx_runtime_distribution::library_relative_path(),
+ Self::Basalt => pumas_library::basalt_distribution::ENTRY,
Self::TrellisCpp => pumas_library::trellis_cpp_distribution::entry_relative_path(),
}
}
@@ -2154,7 +2160,7 @@ impl VersionInstaller {
) -> Result<()> {
match self.app_id {
AppId::Ollama => self.install_ollama_binary(tag, release, progress_tx).await,
- AppId::LlamaCpp | AppId::OnnxRuntime | AppId::TrellisCpp => {
+ AppId::LlamaCpp | AppId::OnnxRuntime | AppId::Basalt | AppId::TrellisCpp => {
self.install_native_archive(tag, release, progress_tx).await
}
AppId::Torch => {
@@ -2318,6 +2324,15 @@ impl VersionInstaller {
match runtime {
NativeRuntime::LlamaCpp => self.select_llama_cpp_asset(assets),
NativeRuntime::OnnxRuntime => Self::select_onnx_runtime_asset(tag, assets),
+ NativeRuntime::Basalt => {
+ pumas_library::basalt_distribution::select_archive(tag, assets).ok_or_else(|| {
+ PumasError::InstallationFailed {
+ message: format!(
+ "Basalt {tag} does not publish a supported archive for this build"
+ ),
+ }
+ })
+ }
NativeRuntime::TrellisCpp => Self::select_trellis_cpp_asset(tag, assets),
}
}
@@ -2750,6 +2765,21 @@ impl VersionInstaller {
NativeRuntime::OnnxRuntime => {
Self::extract_onnx_runtime_from(archive, stage, asset_name)
}
+ NativeRuntime::Basalt => {
+ Self::extract_tarball_from(archive, stage)?;
+ Self::validate_native_output(stage)?;
+ Self::hoist_single_archive_root(stage)?;
+ let launcher = stage.join(runtime.entry_relative_path());
+ let metadata = std::fs::symlink_metadata(&launcher)
+ .map_err(|error| PumasError::io_with_path(error, &launcher))?;
+ if !metadata.is_file() || metadata.len() == 0 {
+ return Err(PumasError::InstallationFailed {
+ message: "Basalt archive contains no regular engine executable".into(),
+ });
+ }
+ Self::make_binary_executable(&launcher)?;
+ Self::validate_native_output(stage)
+ }
NativeRuntime::TrellisCpp => Self::extract_trellis_cpp_from(archive, stage, asset_name),
}
}
@@ -3127,6 +3157,10 @@ impl VersionInstaller {
retry,
};
let cuda_for_prepare = cuda.clone();
+ let cleanup_for_prepare = self.torch_cleanup.clone();
+ let progress_for_prepare = self.progress_tracker.clone();
+ let log_for_prepare = log_path.clone();
+ let shutdown_for_prepare = self.shutdown_flag.clone();
let runtime_wheel_for_prepare = runtime_wheel.clone();
consumer
.acquire_http(
@@ -3144,6 +3178,14 @@ impl VersionInstaller {
let stage_for_extract = stage.clone();
let custody_for_extract = custody_for_prepare.clone();
let asset_name = asset_for_prepare.clone();
+ let cancel_for_extract = cancel_for_prepare.clone();
+ if runtime == NativeRuntime::Basalt {
+ progress_for_prepare.write().await.update_stage(
+ InstallationStage::Setup,
+ 0.0,
+ Some("Preparing the Basalt server environment"),
+ );
+ }
let extracted = use_set
.run_blocking("extract publisher-verified native archive", move || {
custody_for_extract.grant.validate()?;
@@ -3190,6 +3232,15 @@ impl VersionInstaller {
platform,
)?;
}
+ if runtime == NativeRuntime::Basalt {
+ Self::prepare_basalt_python(
+ &stage_for_extract,
+ &cleanup_for_prepare,
+ &log_for_prepare,
+ &cancel_for_extract,
+ &shutdown_for_prepare,
+ )?;
+ }
sync_native_tree(&stage_for_extract)?;
sync_native_directory(stage_for_extract.parent().ok_or_else(|| PumasError::Other("Native output parent absent".into()))?)?;
let output_tree_sha256 = hash_native_tree(&stage_for_extract)?;
@@ -4014,6 +4065,119 @@ impl VersionInstaller {
Ok(())
}
+ /// Create an archive-private environment before the native receipt is issued.
+ fn prepare_basalt_python(
+ stage: &Path,
+ cleanup: &Arc,
+ log_path: &Path,
+ cancel: &AtomicBool,
+ shutdown: &AtomicBool,
+ ) -> Result<()> {
+ use pumas_library::platform::managed_child::ManagedChild;
+ use std::{
+ process::{Command, Stdio},
+ time::{Duration, Instant},
+ };
+
+ let failure = |message: String| PumasError::InstallationFailed { message };
+ let run = |mut command: Command, label: &str, budget: Duration| -> Result<()> {
+ if cancel.load(Ordering::SeqCst) || shutdown.load(Ordering::SeqCst) {
+ return Err(Self::cancellation_error());
+ }
+ pumas_library::platform::child_environment::apply_owned_child_environment(&mut command);
+ if let Some(parent) = log_path.parent() {
+ std::fs::create_dir_all(parent)
+ .map_err(|error| PumasError::io_with_path(error, parent))?;
+ }
+ let log = std::fs::OpenOptions::new()
+ .append(true)
+ .create(true)
+ .open(log_path)
+ .map_err(|error| PumasError::io_with_path(error, log_path))?;
+ command
+ .current_dir(stage)
+ .stdin(Stdio::null())
+ .stdout(
+ log.try_clone()
+ .map_err(|error| PumasError::io_with_path(error, log_path))?,
+ )
+ .stderr(log)
+ .env("PYTHONNOUSERSITE", "1")
+ .env("PYTHONDONTWRITEBYTECODE", "1");
+ let custody = cleanup.new_child_slot()?;
+ let mut child = ManagedChild::spawn_bound_to_thread(&mut command, custody.clone())
+ .map_err(|error| failure(format!("{label}: {error}")))?;
+ let deadline = Instant::now() + budget;
+ let status = loop {
+ if cancel.load(Ordering::SeqCst)
+ || shutdown.load(Ordering::SeqCst)
+ || Instant::now() >= deadline
+ {
+ break None;
+ }
+ if let Some(status) = child
+ .observe_exit()
+ .map_err(|error| failure(format!("{label}: {error}")))?
+ {
+ break Some(status);
+ }
+ std::thread::sleep(Duration::from_millis(100));
+ };
+ child
+ .terminate_and_drain(Duration::from_secs(5))
+ .map_err(|error| {
+ failure(format!("{label}: child cleanup did not finish: {error}"))
+ })?;
+ match status {
+ Some(status) if status.success() => Ok(()),
+ Some(status) => Err(failure(format!("{label} failed ({status})"))),
+ None if cancel.load(Ordering::SeqCst) || shutdown.load(Ordering::SeqCst) => {
+ Err(Self::cancellation_error())
+ }
+ None => Err(failure(format!("{label} timed out"))),
+ }
+ };
+ let environment = stage.join(".venv");
+ let mut create = Command::new("python3");
+ create
+ .args(["-I", "-m", "venv", "--copies"])
+ .arg(&environment);
+ run(
+ create,
+ "Creating the Basalt environment (requires Python 3 with venv)",
+ Duration::from_secs(60),
+ )?;
+ // CPython creates lib64 -> lib on 64-bit Linux. Its directory alias
+ // cannot be part of a native receipt. Give pip a regular directory
+ // for either interpreter layout before installing packages.
+ let lib64 = environment.join("lib64");
+ if std::fs::read_link(&lib64).is_ok_and(|target| target == Path::new("lib")) {
+ std::fs::remove_file(&lib64)
+ .map_err(|error| PumasError::io_with_path(error, &lib64))?;
+ std::fs::create_dir(&lib64).map_err(|error| PumasError::io_with_path(error, &lib64))?;
+ }
+ let mut install = Command::new(environment.join("bin/python"));
+ install
+ .args([
+ "-I",
+ "-m",
+ "pip",
+ "--isolated",
+ "install",
+ "--disable-pip-version-check",
+ "--no-compile",
+ "--no-cache-dir",
+ "--only-binary=:all:",
+ "-r",
+ ])
+ .arg(stage.join("requirements.txt"));
+ run(
+ install,
+ "Installing Basalt server dependencies",
+ Duration::from_secs(600),
+ )
+ }
+
/// Move the contents of an archive's single top-level directory into `stage`.
fn hoist_single_archive_root(stage: &Path) -> Result<()> {
let entries = std::fs::read_dir(stage)
@@ -4030,7 +4194,7 @@ impl VersionInstaller {
return Ok(());
}
// A child may share the wrapper's name; move the wrapper aside first.
- let wrapper = stage.join(".onnx-runtime-archive-root");
+ let wrapper = stage.join(".native-archive-root");
std::fs::rename(only.path(), &wrapper)
.map_err(|error| PumasError::io_with_path(error, &wrapper))?;
for child in std::fs::read_dir(&wrapper)
diff --git a/rust/crates/pumas-app-manager/src/version_manager/mod.rs b/rust/crates/pumas-app-manager/src/version_manager/mod.rs
index 7b5eded68..d403220e2 100644
--- a/rust/crates/pumas-app-manager/src/version_manager/mod.rs
+++ b/rust/crates/pumas-app-manager/src/version_manager/mod.rs
@@ -298,6 +298,7 @@ fn active_version_path(root: &Path, app_id: AppId) -> PathBuf {
root.join(match app_id {
AppId::Torch => ".active-version-torch",
AppId::OnnxRuntime => ".active-version-onnx-runtime",
+ AppId::Basalt => ".active-version-basalt",
AppId::TrellisCpp => ".active-version-trellis-cpp",
AppId::Ollama | AppId::LlamaCpp => ".active-version",
})
diff --git a/rust/crates/pumas-app-manager/src/version_manager/state.rs b/rust/crates/pumas-app-manager/src/version_manager/state.rs
index 02da91757..38812734a 100644
--- a/rust/crates/pumas-app-manager/src/version_manager/state.rs
+++ b/rust/crates/pumas-app-manager/src/version_manager/state.rs
@@ -1055,6 +1055,10 @@ impl VersionState {
}
AppId::OnnxRuntime => vec![version_path
.join(pumas_library::onnx_runtime_distribution::library_relative_path())],
+ AppId::Basalt => pumas_library::basalt_distribution::REQUIRED_FILES
+ .iter()
+ .map(|file| version_path.join(file))
+ .collect(),
AppId::TrellisCpp => {
let entry = pumas_library::trellis_cpp_distribution::entry_relative_path();
vec![version_path.join(entry)]
@@ -1642,6 +1646,46 @@ mod tests {
assert!(state.is_installed("v1.0.0"));
}
+ #[tokio::test]
+ async fn basalt_version_without_its_server_python_is_incomplete() {
+ let (mut state, temp) = create_test_state_for_app(AppId::Basalt).await;
+ let version_dir = temp
+ .path()
+ .join(AppId::Basalt.versions_dir_name())
+ .join("v0.5.6");
+ std::fs::create_dir_all(version_dir.join("bin")).unwrap();
+ std::fs::write(
+ version_dir.join(pumas_library::basalt_distribution::ENTRY),
+ "#!/bin/sh",
+ )
+ .unwrap();
+ for tag in ["v0.5.6", "v0.5.7"] {
+ let metadata = InstalledVersionMetadata {
+ path: tag.to_string(),
+ installed_date: "2026-12-01T00:00:00Z".to_string(),
+ release_tag: tag.to_string(),
+ ..Default::default()
+ };
+ state.add_installed_version(tag, metadata).unwrap();
+ }
+ // v0.5.7 has both the engine and the server interpreter.
+ let complete_dir = temp
+ .path()
+ .join(AppId::Basalt.versions_dir_name())
+ .join("v0.5.7");
+ for file in pumas_library::basalt_distribution::REQUIRED_FILES {
+ let path = complete_dir.join(file);
+ std::fs::create_dir_all(path.parent().unwrap()).unwrap();
+ std::fs::write(path, "#!/bin/sh").unwrap();
+ }
+
+ let result = state.validate_installations().await.unwrap();
+
+ assert_eq!(result.removed_tags, vec!["v0.5.6".to_string()]);
+ assert!(!state.is_installed("v0.5.6"));
+ assert!(state.is_installed("v0.5.7"));
+ }
+
#[tokio::test]
async fn test_llama_cpp_legacy_sycl_tag_migrates_to_precision_variant() {
assert_legacy_sycl_migration(false).await;
diff --git a/rust/crates/pumas-core/Cargo.toml b/rust/crates/pumas-core/Cargo.toml
index 3b40919b7..45b2395d3 100644
--- a/rust/crates/pumas-core/Cargo.toml
+++ b/rust/crates/pumas-core/Cargo.toml
@@ -161,6 +161,7 @@ native-tls = "=0.2.18"
tokio = { workspace = true, features = ["test-util", "macros", "rt-multi-thread"] }
[features]
+basalt = ["process-manager"]
contract-schema = ["dep:schemars"]
default = ["full"]
full = ["hf-client", "process-manager", "gpu-monitor", "onnx-runtime"]
diff --git a/rust/crates/pumas-core/src/api/models.rs b/rust/crates/pumas-core/src/api/models.rs
index e11608445..29b294a99 100644
--- a/rust/crates/pumas-core/src/api/models.rs
+++ b/rust/crates/pumas-core/src/api/models.rs
@@ -141,7 +141,7 @@ async fn load_model_count(library: Arc) -> Result,
model_id: String,
) -> Result> {
@@ -156,6 +156,9 @@ async fn load_inference_settings_for_model(
let (metadata, file_format) = load_inference_snapshot(library, model_dir, model_id).await?;
+ if file_format == "basalt" {
+ return models::validate_basalt_settings(metadata.inference_settings.unwrap_or_default());
+ }
if let Some(settings) = metadata.inference_settings {
return Ok(settings);
}
@@ -163,6 +166,30 @@ async fn load_inference_settings_for_model(
Ok(models::resolve_inference_settings(&metadata, &file_format).unwrap_or_default())
}
+pub(super) async fn store_inference_settings_for_model(
+ library: Arc,
+ model_id: String,
+ settings: Vec,
+) -> Result<()> {
+ let model_dir = library.library_root().join(&model_id);
+ let (_, file_format) =
+ load_inference_snapshot(library.clone(), model_dir.clone(), model_id).await?;
+ let settings = if settings.is_empty() {
+ None
+ } else if file_format == "basalt" {
+ Some(models::validate_basalt_settings(settings)?)
+ } else {
+ Some(settings)
+ };
+ library
+ .update_metadata(&model_dir, move |metadata| {
+ metadata.inference_settings = settings;
+ metadata.updated_date = Some(chrono::Utc::now().to_rfc3339());
+ })
+ .await?;
+ library.index_model_dir(&model_dir).await
+}
+
impl PumasApi {
// ========================================
// Model Library Methods
@@ -448,30 +475,12 @@ impl PumasApi {
settings: Vec,
) -> Result<()> {
self.try_primary()?;
- let library = self.primary().model_library.clone();
- let model_dir = library.library_root().join(model_id);
-
- if !path_exists(&model_dir).await? {
- return Err(crate::error::PumasError::Other(format!(
- "Model not found: {}",
- model_id
- )));
- }
-
- let mut metadata =
- load_model_metadata_or_default(library.clone(), model_dir.clone()).await?;
-
- metadata.inference_settings = if settings.is_empty() {
- None
- } else {
- Some(settings)
- };
- metadata.updated_date = Some(chrono::Utc::now().to_rfc3339());
-
- library.save_metadata(&model_dir, &metadata).await?;
- library.index_model_dir(&model_dir).await?;
-
- Ok(())
+ store_inference_settings_for_model(
+ self.primary().model_library.clone(),
+ model_id.to_owned(),
+ settings,
+ )
+ .await
}
/// Update user-authored markdown notes for a model.
diff --git a/rust/crates/pumas-core/src/api/reconciliation.rs b/rust/crates/pumas-core/src/api/reconciliation.rs
index 2ed6c04f3..68da27b02 100644
--- a/rust/crates/pumas-core/src/api/reconciliation.rs
+++ b/rust/crates/pumas-core/src/api/reconciliation.rs
@@ -1024,9 +1024,6 @@ fn infer_in_place_spec(model_dir: PathBuf, model_id: &str) -> InPlaceImportSpec
}
}
-const IMPORTABLE_MODEL_EXTENSIONS: &[&str] =
- &["gguf", "safetensors", "pt", "pth", "ckpt", "bin", "onnx"];
-
fn has_pending_download_artifacts(model_dir: &Path) -> bool {
WalkDir::new(model_dir)
.min_depth(1)
@@ -1686,7 +1683,7 @@ fn has_importable_model_files(model_dir: &Path) -> bool {
.and_then(|e| e.to_str())
.unwrap_or("")
.to_lowercase();
- IMPORTABLE_MODEL_EXTENSIONS.contains(&ext.as_str())
+ crate::model_library::MODEL_FILE_EXTENSIONS.contains(&ext.as_str())
})
}
diff --git a/rust/crates/pumas-core/src/api/runtime_profiles.rs b/rust/crates/pumas-core/src/api/runtime_profiles.rs
index 11cc34326..1e6d8ee12 100644
--- a/rust/crates/pumas-core/src/api/runtime_profiles.rs
+++ b/rust/crates/pumas-core/src/api/runtime_profiles.rs
@@ -367,6 +367,29 @@ impl PumasApi {
.await
}
+ /// Stop a dedicated-model profile only while its owned process is the one
+ /// launched for `model_id`. The process owner compares the launch model
+ /// file with the model's primary file and requests the stop under one
+ /// lock, so a successor launched for another model is left running.
+ /// Returns `false` when no owned process serves the model.
+ pub async fn stop_runtime_profile_serving_model(
+ &self,
+ profile_id: RuntimeProfileId,
+ model_id: &str,
+ ) -> Result {
+ self.try_primary()?;
+ let primary = self.primary();
+ let Some(model_file) = primary.model_library.get_primary_model_file(model_id) else {
+ return Ok(false);
+ };
+ super::state_runtime_profiles::stop_runtime_profile_if_model(
+ primary,
+ profile_id,
+ &model_file,
+ )
+ .await
+ }
+
pub async fn stop_all_managed_runtime_profiles(&self) -> Result {
self.try_primary()?;
super::state_runtime_profiles::stop_all_managed_runtime_profiles(self.primary()).await
diff --git a/rust/crates/pumas-core/src/api/state.rs b/rust/crates/pumas-core/src/api/state.rs
index 138660397..f92b04d92 100644
--- a/rust/crates/pumas-core/src/api/state.rs
+++ b/rust/crates/pumas-core/src/api/state.rs
@@ -168,32 +168,6 @@ async fn load_model_metadata_or_default(
})?
}
-async fn load_inference_snapshot(
- library: Arc,
- model_dir: PathBuf,
- model_id: String,
-) -> std::result::Result<(models::ModelMetadata, String), PumasError> {
- tokio::task::spawn_blocking(move || {
- let metadata = library.load_metadata(&model_dir)?.unwrap_or_default();
- let file_format = library
- .get_primary_model_file(&model_id)
- .and_then(|path| {
- path.extension()
- .and_then(|ext| ext.to_str())
- .map(|ext| ext.to_lowercase())
- })
- .unwrap_or_default();
- Ok((metadata, file_format))
- })
- .await
- .map_err(|err| {
- PumasError::Other(format!(
- "Failed to join inference metadata snapshot task: {}",
- err
- ))
- })?
-}
-
async fn load_effective_model_metadata(
library: Arc,
model_id: String,
@@ -1723,24 +1697,11 @@ async fn load_inference_settings(
primary: &PrimaryState,
model_id: &str,
) -> std::result::Result, PumasError> {
- let library = &primary.model_library;
- let model_dir = library.library_root().join(model_id);
-
- if !path_exists(&model_dir).await? {
- return Err(PumasError::Other(format!("Model not found: {}", model_id)));
- }
-
- let (metadata, file_format) = load_inference_snapshot(
+ super::models::load_inference_settings_for_model(
primary.model_library.clone(),
- model_dir,
- model_id.to_string(),
+ model_id.to_owned(),
)
- .await?;
- if let Some(settings) = metadata.inference_settings {
- return Ok(settings);
- }
-
- Ok(models::resolve_inference_settings(&metadata, &file_format).unwrap_or_default())
+ .await
}
async fn store_inference_settings(
@@ -1748,25 +1709,12 @@ async fn store_inference_settings(
model_id: &str,
settings: Vec,
) -> std::result::Result<(), PumasError> {
- let library = &primary.model_library;
- let model_dir = library.library_root().join(model_id);
-
- if !path_exists(&model_dir).await? {
- return Err(PumasError::Other(format!("Model not found: {}", model_id)));
- }
-
- let mut metadata =
- load_model_metadata_or_default(primary.model_library.clone(), model_dir.clone()).await?;
- metadata.inference_settings = if settings.is_empty() {
- None
- } else {
- Some(settings)
- };
- metadata.updated_date = Some(chrono::Utc::now().to_rfc3339());
-
- library.save_metadata(&model_dir, &metadata).await?;
- library.index_model_dir(&model_dir).await?;
- Ok(())
+ super::models::store_inference_settings_for_model(
+ primary.model_library.clone(),
+ model_id.to_owned(),
+ settings,
+ )
+ .await
}
async fn store_model_notes(
diff --git a/rust/crates/pumas-core/src/api/state_runtime_profiles.rs b/rust/crates/pumas-core/src/api/state_runtime_profiles.rs
index d6a2629ad..a8a10ebc2 100644
--- a/rust/crates/pumas-core/src/api/state_runtime_profiles.rs
+++ b/rust/crates/pumas-core/src/api/state_runtime_profiles.rs
@@ -79,7 +79,13 @@ pub(super) async fn launch_runtime_profile_with_receipt(
// A runtime whose packages cannot run it is refused with the reasons.
crate::runtime_profiles::prepare_torch_sidecar(launcher_root, version_dir).await?;
}
- let config = runtime_profile_binary_launch_config(tag, version_dir, launcher_root, &spec)?;
+ let mut config = runtime_profile_binary_launch_config(tag, version_dir, launcher_root, &spec)?;
+ if matches!(
+ spec.launch_strategy,
+ RuntimeProfileLaunchStrategy::BinaryProcess(RuntimeProfileBinaryLaunchKind::BasaltServe)
+ ) {
+ crate::basalt_distribution::prepare_launch(&mut config).await?;
+ }
primary
.runtime_profile_service
.process_owner
@@ -193,6 +199,9 @@ fn runtime_profile_binary_launch_config(
RuntimeProfileLaunchStrategy::BinaryProcess(RuntimeProfileBinaryLaunchKind::OnnxHost) => {
onnx_host_launch_config(tag, version_dir)?
}
+ RuntimeProfileLaunchStrategy::BinaryProcess(
+ RuntimeProfileBinaryLaunchKind::BasaltServe,
+ ) => BinaryLaunchConfig::basalt(tag, version_dir),
RuntimeProfileLaunchStrategy::BinaryProcess(
RuntimeProfileBinaryLaunchKind::TrellisServe,
) => BinaryLaunchConfig::trellis_server(tag, version_dir),
@@ -351,6 +360,51 @@ async fn prepare_runtime_profile_launch_spec(
}
selected_model_path = Some(models_dir);
}
+ RuntimeProfileLaunchStrategy::BinaryProcess(
+ RuntimeProfileBinaryLaunchKind::BasaltServe,
+ ) => {
+ let model_id = model_id.ok_or_else(|| PumasError::InvalidParams {
+ message: "model_id is required to launch a Basalt profile".into(),
+ })?;
+ let model_path = primary
+ .model_library
+ .get_primary_model_file(model_id)
+ .ok_or_else(|| PumasError::ModelNotFound {
+ model_id: model_id.to_owned(),
+ })?;
+ if ExecutableArtifactFormat::from_path(&model_path)
+ != Some(ExecutableArtifactFormat::Basalt)
+ {
+ return Err(PumasError::InvalidParams {
+ message: "Basalt profiles require a .basalt model pack".into(),
+ });
+ }
+ let path = model_path
+ .to_str()
+ .ok_or_else(|| PumasError::InvalidParams {
+ message: "Basalt model pack path must be Unicode".into(),
+ })?;
+ launch_spec.extra_args.extend([
+ "--model".into(),
+ path.into(),
+ "--alias".into(),
+ model_id.into(),
+ ]);
+ if let Some(context) = overrides.and_then(|overrides| overrides.context_size) {
+ launch_spec
+ .extra_args
+ .extend(["--max-context".into(), context.to_string()]);
+ }
+ if let Some(device_id) = overrides
+ .and_then(|overrides| overrides.device.as_ref())
+ .and_then(|device| device.device_id.as_ref())
+ {
+ launch_spec
+ .env_vars
+ .insert("CUDA_VISIBLE_DEVICES".into(), device_id.clone());
+ }
+ selected_model_path = Some(model_path);
+ }
RuntimeProfileLaunchStrategy::BinaryProcess(
RuntimeProfileBinaryLaunchKind::OllamaServe | RuntimeProfileBinaryLaunchKind::OnnxHost,
)
@@ -592,6 +646,34 @@ pub(super) async fn stop_runtime_profile_if_generation(
result
}
+/// Stop the owned process of a dedicated-model profile only if it was
+/// launched for `model_path`; any other owned process is left running.
+pub(super) async fn stop_runtime_profile_if_model(
+ primary: &PrimaryState,
+ profile_id: RuntimeProfileId,
+ model_path: &std::path::Path,
+) -> std::result::Result {
+ let Some((receipt, result)) = primary
+ .runtime_profile_service
+ .process_owner
+ .stop_if_model_with_receipt(&profile_id, model_path)
+ .await?
+ else {
+ return Ok(false);
+ };
+ if result.is_ok() {
+ primary
+ .serving_service
+ .record_profile_unavailable_for_owned_generation(
+ &profile_id,
+ receipt.generation,
+ &primary.runtime_profile_service.process_owner,
+ )
+ .await?;
+ }
+ result
+}
+
pub(super) async fn stop_all_managed_runtime_profiles(
primary: &PrimaryState,
) -> std::result::Result {
diff --git a/rust/crates/pumas-core/src/basalt_distribution.rs b/rust/crates/pumas-core/src/basalt_distribution.rs
new file mode 100644
index 000000000..80677b7ee
--- /dev/null
+++ b/rust/crates/pumas-core/src/basalt_distribution.rs
@@ -0,0 +1,140 @@
+//! Basalt release selection for Pumas-managed Linux x64 installations.
+
+use crate::network::GitHubAsset;
+
+pub const ENTRY: &str = "bin/basalt";
+
+/// Interpreter of the server environment shipped in the Basalt release
+/// archive; launches run `serve.server` with it.
+pub const SERVER_PYTHON: &str = ".venv/bin/python";
+
+/// Files an installed Basalt version needs before it can serve: the engine
+/// and the interpreter that runs its server. A version missing either is
+/// reported as incomplete instead of failing at launch.
+pub const REQUIRED_FILES: [&str; 2] = [ENTRY, SERVER_PYTHON];
+
+pub const fn available() -> bool {
+ cfg!(all(
+ feature = "basalt",
+ target_os = "linux",
+ target_arch = "x86_64"
+ ))
+}
+
+pub fn select_archive<'a>(tag: &str, assets: &'a [GitHubAsset]) -> Option<&'a GitHubAsset> {
+ if !available() {
+ return None;
+ }
+ let version = semver::Version::parse(tag.strip_prefix('v')?).ok()?;
+ // This provider uses the 0.5 health and launch interfaces as qualified on 0.5.6.
+ if version.major != 0 || version.minor != 5 || version.patch < 6 || !version.pre.is_empty() {
+ return None;
+ }
+ let name = format!("basalt-{tag}-linux-x64.tar.gz");
+ assets.iter().find(|asset| asset.name == name)
+}
+
+pub(crate) async fn prepare_launch(
+ config: &mut crate::process::BinaryLaunchConfig,
+) -> crate::Result<()> {
+ use std::{path::PathBuf, process::Stdio, time::Duration};
+
+ fn unavailable(message: impl Into) -> crate::PumasError {
+ crate::PumasError::InvalidParams {
+ message: message.into(),
+ }
+ }
+
+ if !available() {
+ return Err(unavailable("This Pumas build cannot run Basalt"));
+ }
+ let engine = config.version_dir.join(ENTRY);
+ let engine_arg = engine
+ .to_str()
+ .ok_or_else(|| unavailable("Basalt executable path must be Unicode"))?;
+
+ if let Some(path) = std::env::var_os("PUMAS_BASALT_CUDA_LIB_DIR") {
+ let directory = PathBuf::from(path);
+ if !directory.is_absolute() {
+ return Err(unavailable(
+ "PUMAS_BASALT_CUDA_LIB_DIR must be an absolute directory",
+ ));
+ }
+ let directory = tokio::fs::canonicalize(directory)
+ .await
+ .map_err(|_| unavailable("PUMAS_BASALT_CUDA_LIB_DIR cannot be resolved"))?;
+ for library in ["libcudart.so.13", "libcublas.so.13", "libcublasLt.so.13"] {
+ if !tokio::fs::metadata(directory.join(library))
+ .await
+ .is_ok_and(|metadata| metadata.is_file())
+ {
+ return Err(unavailable(format!(
+ "Basalt CUDA library {library} is missing from PUMAS_BASALT_CUDA_LIB_DIR"
+ )));
+ }
+ }
+ let directory = directory
+ .to_str()
+ .filter(|path| !path.contains(':'))
+ .ok_or_else(|| {
+ unavailable("Basalt CUDA library directory cannot be used as a single loader path")
+ })?;
+ config
+ .env_vars
+ .insert("LD_LIBRARY_PATH".into(), directory.into());
+ }
+ if !tokio::fs::metadata(&config.binary_path)
+ .await
+ .is_ok_and(|metadata| metadata.is_file())
+ {
+ return Err(unavailable(
+ "Basalt server Python is missing from the installed runtime",
+ ));
+ }
+
+ // Use the engine's authoritative GPU selection under exactly the same
+ // device visibility and loader environment as the subsequent server.
+ let mut command = std::process::Command::new(&engine);
+ crate::platform::child_environment::apply_owned_child_environment(&mut command);
+ command
+ .envs(&config.env_vars)
+ .current_dir(&config.version_dir)
+ .args(["--gpu-plan", "--gpu", "auto"])
+ .stdin(Stdio::null())
+ .stderr(Stdio::null());
+ let mut command = tokio::process::Command::from(command);
+ command.kill_on_drop(true);
+ #[derive(serde::Deserialize)]
+ struct GpuPlan {
+ devices: String,
+ error: String,
+ }
+ let output = tokio::time::timeout(Duration::from_secs(10), command.output())
+ .await
+ .map_err(|_| device_unavailable("Basalt CUDA compatibility check timed out"))?
+ .map_err(|_| {
+ device_unavailable("Could not run the installed Basalt GPU compatibility check")
+ })?;
+ let plan: GpuPlan = serde_json::from_slice(&output.stdout)
+ .map_err(|_| device_unavailable("Basalt requires a working CUDA 13 loader and a visible NVIDIA GPU with compute capability 12.0"))?;
+ if !output.status.success() || !plan.error.is_empty() || plan.devices.is_empty() {
+ return Err(device_unavailable("Basalt requires a visible NVIDIA GPU with compute capability 12.0 and a compatible driver"));
+ }
+
+ config
+ .extra_args
+ .extend(["--engine-bin".into(), engine_arg.into()]);
+ config
+ .env_vars
+ .insert("PYTHONNOUSERSITE".into(), "1".into());
+ config
+ .env_vars
+ .insert("PYTHONDONTWRITEBYTECODE".into(), "1".into());
+ Ok(())
+}
+
+fn device_unavailable(device: &str) -> crate::PumasError {
+ crate::PumasError::DeviceNotAvailable {
+ device: device.into(),
+ }
+}
diff --git a/rust/crates/pumas-core/src/config.rs b/rust/crates/pumas-core/src/config.rs
index efcb760a2..f5c648bee 100644
--- a/rust/crates/pumas-core/src/config.rs
+++ b/rust/crates/pumas-core/src/config.rs
@@ -199,6 +199,7 @@ pub enum AppId {
LlamaCpp,
Torch,
OnnxRuntime,
+ Basalt,
/// trellis.cpp (`trellis-server`), the managed native runtime that serves
/// image-to-3D generation (ADR 0010).
TrellisCpp,
@@ -212,6 +213,7 @@ impl AppId {
AppId::LlamaCpp => "llama-cpp",
AppId::Torch => "torch",
AppId::OnnxRuntime => "onnx-runtime",
+ AppId::Basalt => "basalt",
AppId::TrellisCpp => "trellis-cpp",
}
}
@@ -221,7 +223,7 @@ impl AppId {
/// Every supported runtime is an external, downloaded runtime. ONNX Runtime
/// executes in-process, but its native library is a downloaded version.
pub fn has_version_manager(&self) -> bool {
- true
+ *self != AppId::Basalt || crate::basalt_distribution::available()
}
/// Return whether installed versions are publisher-verified native release
@@ -229,7 +231,7 @@ impl AppId {
pub fn uses_native_archive_installer(&self) -> bool {
matches!(
self,
- AppId::LlamaCpp | AppId::OnnxRuntime | AppId::TrellisCpp
+ AppId::LlamaCpp | AppId::OnnxRuntime | AppId::Basalt | AppId::TrellisCpp
)
}
@@ -240,6 +242,7 @@ impl AppId {
AppId::LlamaCpp => "ggml-org/llama.cpp",
AppId::Torch => "pytorch/pytorch",
AppId::OnnxRuntime => "microsoft/onnxruntime",
+ AppId::Basalt => "jesdga95/basalt",
AppId::TrellisCpp => "pwilkin/trellis.cpp",
}
}
@@ -251,6 +254,7 @@ impl AppId {
AppId::LlamaCpp => "llama-cpp-versions",
AppId::Torch => "torch-versions",
AppId::OnnxRuntime => "onnx-runtime-versions",
+ AppId::Basalt => "basalt-versions",
AppId::TrellisCpp => "trellis-cpp-versions",
}
}
@@ -263,6 +267,7 @@ impl AppId {
AppId::Torch => 8400,
// Managed profiles allocate their ports; no fixed server port.
AppId::OnnxRuntime | AppId::TrellisCpp => 0,
+ AppId::Basalt => 18091,
}
}
@@ -273,6 +278,7 @@ impl AppId {
AppId::LlamaCpp => "http://127.0.0.1:18080",
AppId::Torch => "http://127.0.0.1:8400",
AppId::OnnxRuntime | AppId::TrellisCpp => "",
+ AppId::Basalt => "http://127.0.0.1:18091",
}
}
@@ -284,6 +290,7 @@ impl AppId {
"llama-cpp" | "llamacpp" | "llama.cpp" => Some(AppId::LlamaCpp),
"torch" => Some(AppId::Torch),
"onnx-runtime" | "onnxruntime" | "onnx_runtime" => Some(AppId::OnnxRuntime),
+ "basalt" => Some(AppId::Basalt),
"trellis-cpp" | "trelliscpp" | "trellis.cpp" | "trellis_cpp" => Some(AppId::TrellisCpp),
_ => None,
}
diff --git a/rust/crates/pumas-core/src/lib.rs b/rust/crates/pumas-core/src/lib.rs
index 6ae3556f2..0a09c9b6a 100644
--- a/rust/crates/pumas-core/src/lib.rs
+++ b/rust/crates/pumas-core/src/lib.rs
@@ -31,6 +31,7 @@
uniffi::setup_scaffolding!();
pub mod acquisition;
+pub mod basalt_distribution;
pub mod build_info;
pub mod cache;
pub mod cancel;
diff --git a/rust/crates/pumas-core/src/model_library/artifact_load_target.rs b/rust/crates/pumas-core/src/model_library/artifact_load_target.rs
index 595e826ec..60057173a 100644
--- a/rust/crates/pumas-core/src/model_library/artifact_load_target.rs
+++ b/rust/crates/pumas-core/src/model_library/artifact_load_target.rs
@@ -676,6 +676,7 @@ fn load_path_kind(artifact_kind: PackageArtifactKind) -> PumasArtifactLoadPathKi
PackageArtifactKind::Gguf
| PackageArtifactKind::Safetensors
| PackageArtifactKind::Onnx
+ | PackageArtifactKind::Basalt
| PackageArtifactKind::Adapter
| PackageArtifactKind::Shard
| PackageArtifactKind::Unknown => PumasArtifactLoadPathKind::File,
diff --git a/rust/crates/pumas-core/src/model_library/basalt_pack.rs b/rust/crates/pumas-core/src/model_library/basalt_pack.rs
new file mode 100644
index 000000000..804fd4a88
--- /dev/null
+++ b/rust/crates/pumas-core/src/model_library/basalt_pack.rs
@@ -0,0 +1,161 @@
+//! Basalt v2 container identification. The runtime owns the tensor and
+//! architecture compatibility checks.
+
+use std::{
+ collections::BTreeSet,
+ io::{Read, Seek, SeekFrom},
+ path::Path,
+};
+
+use super::{
+ identifier::ModelTypeInfo,
+ types::{FileFormat, ModelType},
+};
+use crate::{PumasError, Result};
+
+// Layout from basalt/include/basalt/core/model_format.hpp.
+pub(super) const MAGIC: &[u8; 8] = b"BASALTMF";
+const VERSION: u32 = 2;
+const HEADER_BYTES: u64 = 64 * 1024;
+const SECTION_ALIGNMENT: u64 = 2 * 1024 * 1024;
+const MAX_SECTIONS: u32 = (64 * 1024 - 64) / 128;
+
+pub(super) fn identify(file: &mut R, path: &Path) -> Result {
+ let size = file
+ .seek(SeekFrom::End(0))
+ .map_err(|error| PumasError::io_with_path(error, path))?;
+ if size < HEADER_BYTES {
+ return Err(invalid("Basalt pack header is truncated"));
+ }
+ file.seek(SeekFrom::Start(0))
+ .map_err(|error| PumasError::io_with_path(error, path))?;
+ let mut header = [0; 64];
+ file.read_exact(&mut header)
+ .map_err(|error| PumasError::io_with_path(error, path))?;
+ if !header.starts_with(MAGIC) {
+ return Err(invalid("Basalt pack signature is invalid"));
+ }
+ let version = read_u32(&header[8..12])?;
+ if version != VERSION {
+ return Err(invalid(format!(
+ "Unsupported Basalt pack version {version}; expected {VERSION}"
+ )));
+ }
+ let entries = read_u32(&header[12..16])?;
+ let declared_size = read_u64(&header[16..24])?;
+ if !(1..=MAX_SECTIONS).contains(&entries) || declared_size != size {
+ return Err(invalid(
+ "Basalt pack section count or file length is invalid",
+ ));
+ }
+
+ let mut sections = BTreeSet::new();
+ let mut ranges = Vec::new();
+ for _ in 0..entries {
+ let mut entry = [0; 128];
+ file.read_exact(&mut entry)
+ .map_err(|error| PumasError::io_with_path(error, path))?;
+ let name = std::str::from_utf8(&entry[..64])
+ .map_err(|_| invalid("Basalt section name is not text"))?
+ .trim_end_matches('\0');
+ let offset = read_u64(&entry[64..72])?;
+ let length = read_u64(&entry[72..80])?;
+ let end = offset
+ .checked_add(length)
+ .ok_or_else(|| invalid("Basalt section range overflows"))?;
+ if name.is_empty()
+ || name.contains('\0')
+ || offset < HEADER_BYTES
+ || offset % SECTION_ALIGNMENT != 0
+ || end > size
+ || !sections.insert(name.to_owned())
+ {
+ return Err(invalid("Basalt pack contains an invalid section"));
+ }
+ if length > 0 {
+ ranges.push((offset, end));
+ } else if name == "meta" {
+ return Err(invalid("Basalt pack metadata section is empty"));
+ }
+ }
+ ranges.sort_unstable();
+ if !sections.contains("meta") || ranges.windows(2).any(|pair| pair[0].1 > pair[1].0) {
+ return Err(invalid(
+ "Basalt pack metadata is missing or sections overlap",
+ ));
+ }
+
+ Ok(ModelTypeInfo {
+ format: FileFormat::Basalt,
+ model_type: ModelType::Llm,
+ ..ModelTypeInfo::default()
+ })
+}
+
+fn read_u32(bytes: &[u8]) -> Result {
+ bytes
+ .try_into()
+ .map(u32::from_le_bytes)
+ .map_err(|_| invalid("Basalt pack header is truncated"))
+}
+
+fn read_u64(bytes: &[u8]) -> Result {
+ bytes
+ .try_into()
+ .map(u64::from_le_bytes)
+ .map_err(|_| invalid("Basalt section table is truncated"))
+}
+
+fn invalid(message: impl Into) -> PumasError {
+ PumasError::Validation {
+ field: "basalt_pack".into(),
+ message: message.into(),
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::model_library::identifier::identify_model_reader;
+ use std::io::Cursor;
+
+ fn pack() -> Cursor> {
+ let offset = usize::try_from(SECTION_ALIGNMENT).unwrap();
+ let mut bytes = vec![0; offset + 2];
+ let size = u64::try_from(bytes.len()).unwrap();
+ bytes[..8].copy_from_slice(MAGIC);
+ bytes[8..12].copy_from_slice(&VERSION.to_le_bytes());
+ bytes[12..16].copy_from_slice(&1_u32.to_le_bytes());
+ bytes[16..24].copy_from_slice(&size.to_le_bytes());
+ bytes[64..68].copy_from_slice(b"meta");
+ bytes[128..136].copy_from_slice(&SECTION_ALIGNMENT.to_le_bytes());
+ bytes[136..144].copy_from_slice(&2_u64.to_le_bytes());
+ bytes[offset..].copy_from_slice(b"{}");
+ Cursor::new(bytes)
+ }
+
+ #[test]
+ fn identifies_basalt_by_content_and_accepts_the_named_pack() {
+ for path in ["model.basalt", "model.unknown"] {
+ let result = identify_model_reader(&mut pack(), Path::new(path)).unwrap();
+ assert_eq!(result.format, FileFormat::Basalt);
+ assert_eq!(result.model_type, ModelType::Llm);
+ }
+ }
+
+ #[test]
+ fn rejects_wrong_signature_unknown_version_and_overflowing_section() {
+ let path = Path::new("model.basalt");
+ let mut wrong_magic = pack();
+ wrong_magic.get_mut()[0] = b'X';
+ assert!(identify_model_reader(&mut wrong_magic, path).is_err());
+
+ let mut wrong_version = pack();
+ wrong_version.get_mut()[8..12].copy_from_slice(&1_u32.to_le_bytes());
+ assert!(identify_model_reader(&mut wrong_version, path).is_err());
+
+ let mut wrong_range = pack();
+ wrong_range.get_mut()[136..144].copy_from_slice(&u64::MAX.to_le_bytes());
+ assert!(identify_model_reader(&mut wrong_range, path).is_err());
+ }
+}
diff --git a/rust/crates/pumas-core/src/model_library/hf/search.rs b/rust/crates/pumas-core/src/model_library/hf/search.rs
index 9a6c10313..7cd45c545 100644
--- a/rust/crates/pumas-core/src/model_library/hf/search.rs
+++ b/rust/crates/pumas-core/src/model_library/hf/search.rs
@@ -603,7 +603,7 @@ impl HuggingFaceClient {
let formats: Vec = result
.tags
.iter()
- .filter(|t| ["gguf", "safetensors", "pytorch", "onnx"].contains(&t.as_str()))
+ .filter(|t| ["gguf", "safetensors", "pytorch", "onnx", "basalt"].contains(&t.as_str()))
.cloned()
.collect();
diff --git a/rust/crates/pumas-core/src/model_library/identifier.rs b/rust/crates/pumas-core/src/model_library/identifier.rs
index a871e1a47..b79438c0b 100644
--- a/rust/crates/pumas-core/src/model_library/identifier.rs
+++ b/rust/crates/pumas-core/src/model_library/identifier.rs
@@ -115,10 +115,6 @@ fn identify_model_reader_with_context(
.read(&mut header)
.map_err(|e| PumasError::io_with_path(e, path))?;
- if bytes_read < 4 {
- return Ok(ModelTypeInfo::default());
- }
-
// Check file extension as hint
let extension = path
.extension()
@@ -126,6 +122,14 @@ fn identify_model_reader_with_context(
.map(|s| s.to_lowercase())
.unwrap_or_default();
+ if extension == "basalt" || header[..bytes_read].starts_with(super::basalt_pack::MAGIC) {
+ return super::basalt_pack::identify(file, path);
+ }
+
+ if bytes_read < 4 {
+ return Ok(ModelTypeInfo::default());
+ }
+
// Detect format from magic bytes
let format = detect_format(&header[..bytes_read], &extension);
diff --git a/rust/crates/pumas-core/src/model_library/importer.rs b/rust/crates/pumas-core/src/model_library/importer.rs
index 1f9c188bb..84a1c1251 100644
--- a/rust/crates/pumas-core/src/model_library/importer.rs
+++ b/rust/crates/pumas-core/src/model_library/importer.rs
@@ -942,7 +942,7 @@ impl ModelImporter {
.unwrap_or("");
// Only consider model files
- if !["gguf", "safetensors", "pt", "pth", "ckpt", "bin", "onnx"].contains(&ext) {
+ if !crate::model_library::MODEL_FILE_EXTENSIONS.contains(&ext) {
continue;
}
@@ -986,8 +986,7 @@ impl ModelImporter {
.to_lowercase();
// Only model file extensions
- if !["gguf", "safetensors", "pt", "pth", "ckpt", "bin", "onnx"].contains(&ext.as_str())
- {
+ if !crate::model_library::MODEL_FILE_EXTENSIONS.contains(&ext.as_str()) {
continue;
}
diff --git a/rust/crates/pumas-core/src/model_library/importer/recovery.rs b/rust/crates/pumas-core/src/model_library/importer/recovery.rs
index e3191c662..9dd37725a 100644
--- a/rust/crates/pumas-core/src/model_library/importer/recovery.rs
+++ b/rust/crates/pumas-core/src/model_library/importer/recovery.rs
@@ -293,8 +293,6 @@ impl ModelImporter {
/// Find directories with model files but no metadata.json.
fn find_orphan_dirs(&self, library_root: &Path, stop_after_first: bool) -> Vec {
let mut orphans = Vec::new();
- let model_extensions: &[&str] =
- &["gguf", "safetensors", "pt", "pth", "ckpt", "bin", "onnx"];
for entry in WalkDir::new(library_root)
.min_depth(1)
@@ -344,7 +342,10 @@ impl ModelImporter {
.path()
.extension()
.and_then(|ext| ext.to_str())
- .map(|ext| model_extensions.contains(&ext.to_lowercase().as_str()))
+ .map(|ext| {
+ crate::model_library::MODEL_FILE_EXTENSIONS
+ .contains(&ext.to_lowercase().as_str())
+ })
.unwrap_or(false)
});
diff --git a/rust/crates/pumas-core/src/model_library/importer/staging.rs b/rust/crates/pumas-core/src/model_library/importer/staging.rs
index 3ca7d4c83..26982d13d 100644
--- a/rust/crates/pumas-core/src/model_library/importer/staging.rs
+++ b/rust/crates/pumas-core/src/model_library/importer/staging.rs
@@ -655,8 +655,7 @@ fn is_model_file(name: &str) -> bool {
.extension()
.and_then(|value| value.to_str())
.is_some_and(|ext| {
- ["gguf", "safetensors", "pt", "pth", "ckpt", "bin", "onnx"]
- .contains(&ext.to_ascii_lowercase().as_str())
+ crate::model_library::MODEL_FILE_EXTENSIONS.contains(&ext.to_ascii_lowercase().as_str())
})
}
diff --git a/rust/crates/pumas-core/src/model_library/library.rs b/rust/crates/pumas-core/src/model_library/library.rs
index 2c8555621..8a6bb40d3 100644
--- a/rust/crates/pumas-core/src/model_library/library.rs
+++ b/rust/crates/pumas-core/src/model_library/library.rs
@@ -142,8 +142,7 @@ fn parse_model_card_json(model_card_json: Option<&str>) -> Option Vec {
for tag in metadata.tags.iter().flatten() {
match tag.trim().to_lowercase().as_str() {
- "gguf" | "ggml" | "safetensors" | "pytorch" | "onnx" | "tensorrt" | "bin" => {
+ "gguf" | "ggml" | "safetensors" | "pytorch" | "onnx" | "basalt" | "tensorrt"
+ | "bin" => {
formats.insert(tag.trim().to_lowercase());
}
_ => {}
@@ -8401,6 +8401,9 @@ fn collect_format_hints(metadata: &ModelMetadata) -> Vec {
Some("onnx") => {
formats.insert("onnx".to_string());
}
+ Some("basalt") => {
+ formats.insert("basalt".to_string());
+ }
Some("bin") | Some("pt") | Some("pth") => {
formats.insert("pytorch".to_string());
}
diff --git a/rust/crates/pumas-core/src/model_library/library/projection.rs b/rust/crates/pumas-core/src/model_library/library/projection.rs
index ae4bfd221..3bf1360ad 100644
--- a/rust/crates/pumas-core/src/model_library/library/projection.rs
+++ b/rust/crates/pumas-core/src/model_library/library/projection.rs
@@ -591,6 +591,7 @@ fn canonical_weight_format(value: &str) -> Option<&'static str> {
"ggml" => Some("ggml"),
"safetensors" => Some("safetensors"),
"onnx" => Some("onnx"),
+ "basalt" => Some("basalt"),
"pt" | "pth" | "ckpt" | "bin" | "pickle" | "pkl" => Some("pickle"),
_ => None,
}
@@ -640,6 +641,28 @@ fn normalize_quant_token(value: &str) -> String {
mod tests {
use super::*;
+ #[test]
+ fn basalt_pack_projects_format_for_imported_and_preexisting_catalog_rows() {
+ let dir = tempfile::tempdir().unwrap();
+ let id = "llm/inkling2/inkling-mini";
+ let metadata = ModelMetadata {
+ files: Some(vec![crate::models::ModelFileInfo {
+ name: "inkling-nvfp4.basalt".into(),
+ original_name: None,
+ size: Some(19_734_300_551),
+ sha256: None,
+ blake3: None,
+ }]),
+ ..Default::default()
+ };
+ let mut record = metadata_to_record(id, dir.path(), &metadata);
+ assert_eq!(record.metadata[PRIMARY_FORMAT_METADATA_KEY], "basalt");
+
+ record.metadata[PRIMARY_FORMAT_METADATA_KEY] = Value::Null;
+ project_display_fields_for_record(&mut record);
+ assert_eq!(record.metadata[PRIMARY_FORMAT_METADATA_KEY], "basalt");
+ }
+
#[test]
fn payload_freshness_excludes_only_the_root_publication_receipt() {
use std::fs::{File, FileTimes};
diff --git a/rust/crates/pumas-core/src/model_library/mapper.rs b/rust/crates/pumas-core/src/model_library/mapper.rs
index 6af36cb3d..f4d0ee432 100644
--- a/rust/crates/pumas-core/src/model_library/mapper.rs
+++ b/rust/crates/pumas-core/src/model_library/mapper.rs
@@ -588,7 +588,7 @@ impl ModelMapper {
.unwrap_or("")
.to_lowercase();
- if ["gguf", "safetensors", "pt", "pth", "ckpt", "bin", "onnx"].contains(&ext.as_str()) {
+ if crate::model_library::MODEL_FILE_EXTENSIONS.contains(&ext.as_str()) {
files.push(entry.path().to_path_buf());
}
}
diff --git a/rust/crates/pumas-core/src/model_library/mod.rs b/rust/crates/pumas-core/src/model_library/mod.rs
index 75d72b87f..b6b7d037a 100644
--- a/rust/crates/pumas-core/src/model_library/mod.rs
+++ b/rust/crates/pumas-core/src/model_library/mod.rs
@@ -43,6 +43,7 @@ mod external_assets;
mod hashing;
mod hf;
pub(crate) use hf::DownloadInvocationContext;
+mod basalt_pack;
pub(crate) use hf::FileToDownload as SelectedDownloadFile;
pub(crate) use package_selection::is_weight_index;
mod hf_cache;
@@ -149,3 +150,15 @@ pub use task_signature::{
};
pub use types::*;
pub use watcher::{ChangeCallback, ModelLibraryWatcher};
+
+/// Model-file extensions recognized by library discovery, import and recovery.
+pub(crate) const MODEL_FILE_EXTENSIONS: &[&str] = &[
+ "gguf",
+ "safetensors",
+ "pt",
+ "pth",
+ "ckpt",
+ "bin",
+ "onnx",
+ "basalt",
+];
diff --git a/rust/crates/pumas-core/src/model_library/package_facts/artifact.rs b/rust/crates/pumas-core/src/model_library/package_facts/artifact.rs
index ca20f91a4..9f1c50d02 100644
--- a/rust/crates/pumas-core/src/model_library/package_facts/artifact.rs
+++ b/rust/crates/pumas-core/src/model_library/package_facts/artifact.rs
@@ -32,6 +32,12 @@ pub(crate) async fn package_artifact_kind(
{
return Ok(PackageArtifactKind::Onnx);
}
+ if selected_files
+ .iter()
+ .any(|file| file.to_ascii_lowercase().ends_with(".basalt"))
+ {
+ return Ok(PackageArtifactKind::Basalt);
+ }
if selected_files
.iter()
.any(|file| file.to_lowercase().ends_with(".safetensors"))
@@ -379,7 +385,7 @@ fn is_transformers_shard_file(relative_path: &str) -> bool {
}
fn is_weight_file(relative_path: &str) -> bool {
- ["safetensors", "bin", "pt", "pth", "ckpt", "gguf", "onnx"]
+ crate::model_library::MODEL_FILE_EXTENSIONS
.iter()
.any(|extension| relative_path.ends_with(&format!(".{extension}")))
}
diff --git a/rust/crates/pumas-core/src/model_library/package_facts/manifest.rs b/rust/crates/pumas-core/src/model_library/package_facts/manifest.rs
index 0375cc037..21c9be5ef 100644
--- a/rust/crates/pumas-core/src/model_library/package_facts/manifest.rs
+++ b/rust/crates/pumas-core/src/model_library/package_facts/manifest.rs
@@ -702,7 +702,7 @@ fn is_transformers_weight_index_file(relative_path: &str) -> bool {
fn is_package_weight_file(file_name: &str) -> bool {
let file_name = file_name.to_lowercase();
- ["safetensors", "bin", "pt", "pth", "ckpt", "gguf", "onnx"]
+ crate::model_library::MODEL_FILE_EXTENSIONS
.iter()
.any(|extension| file_name.ends_with(&format!(".{extension}")))
}
diff --git a/rust/crates/pumas-core/src/model_library/package_facts/size.rs b/rust/crates/pumas-core/src/model_library/package_facts/size.rs
index a7bdebd8a..c27b1add9 100644
--- a/rust/crates/pumas-core/src/model_library/package_facts/size.rs
+++ b/rust/crates/pumas-core/src/model_library/package_facts/size.rs
@@ -341,6 +341,7 @@ fn direct_selected_artifact_path(
PackageArtifactKind::Gguf => lower.ends_with(".gguf"),
PackageArtifactKind::Safetensors => lower.ends_with(".safetensors"),
PackageArtifactKind::Onnx => lower.ends_with(".onnx"),
+ PackageArtifactKind::Basalt => lower.ends_with(".basalt"),
PackageArtifactKind::Adapter => {
lower.ends_with("adapter_model.safetensors") || lower.ends_with("adapter_model.bin")
}
@@ -360,6 +361,7 @@ fn is_single_file_artifact_kind(artifact_kind: PackageArtifactKind) -> bool {
PackageArtifactKind::Gguf
| PackageArtifactKind::Safetensors
| PackageArtifactKind::Onnx
+ | PackageArtifactKind::Basalt
| PackageArtifactKind::Adapter
| PackageArtifactKind::Shard
| PackageArtifactKind::Unknown
@@ -431,7 +433,7 @@ fn is_transformers_shard_file(relative_path: &str) -> bool {
}
fn is_weight_file(relative_path: &str) -> bool {
- ["safetensors", "bin", "pt", "pth", "ckpt", "gguf", "onnx"]
+ crate::model_library::MODEL_FILE_EXTENSIONS
.iter()
.any(|extension| relative_path.ends_with(&format!(".{extension}")))
}
diff --git a/rust/crates/pumas-core/src/model_library/sharding.rs b/rust/crates/pumas-core/src/model_library/sharding.rs
index d90fbd52e..742d62bef 100644
--- a/rust/crates/pumas-core/src/model_library/sharding.rs
+++ b/rust/crates/pumas-core/src/model_library/sharding.rs
@@ -371,6 +371,7 @@ const WEIGHT_EXTENSIONS: &[&str] = &[
".pt",
".pth",
".onnx",
+ ".basalt",
".ckpt",
".msgpack",
];
diff --git a/rust/crates/pumas-core/src/model_library/types.rs b/rust/crates/pumas-core/src/model_library/types.rs
index e173aa32b..87479a01c 100644
--- a/rust/crates/pumas-core/src/model_library/types.rs
+++ b/rust/crates/pumas-core/src/model_library/types.rs
@@ -370,6 +370,8 @@ pub enum FileFormat {
Ggml,
/// ONNX format (safe)
Onnx,
+ /// Basalt model-pack format
+ Basalt,
/// PyTorch pickle format (potentially unsafe)
Pickle,
/// Unknown format
@@ -380,9 +382,11 @@ impl FileFormat {
/// Get the security tier for this format.
pub fn security_tier(&self) -> SecurityTier {
match self {
- FileFormat::Safetensors | FileFormat::Gguf | FileFormat::Ggml | FileFormat::Onnx => {
- SecurityTier::Safe
- }
+ FileFormat::Safetensors
+ | FileFormat::Gguf
+ | FileFormat::Ggml
+ | FileFormat::Onnx
+ | FileFormat::Basalt => SecurityTier::Safe,
FileFormat::Pickle => SecurityTier::Pickle,
FileFormat::Unknown => SecurityTier::Unknown,
}
@@ -395,6 +399,7 @@ impl FileFormat {
FileFormat::Gguf => "gguf",
FileFormat::Ggml => "ggml",
FileFormat::Onnx => "onnx",
+ FileFormat::Basalt => "basalt",
FileFormat::Pickle => "pickle",
FileFormat::Unknown => "unknown",
}
@@ -408,6 +413,7 @@ impl From for DetectedFileType {
FileFormat::Gguf => DetectedFileType::Gguf,
FileFormat::Ggml => DetectedFileType::Ggml,
FileFormat::Onnx => DetectedFileType::Onnx,
+ FileFormat::Basalt => DetectedFileType::Basalt,
FileFormat::Pickle => DetectedFileType::Pickle,
FileFormat::Unknown => DetectedFileType::Unknown,
}
diff --git a/rust/crates/pumas-core/src/model_library/watcher.rs b/rust/crates/pumas-core/src/model_library/watcher.rs
index 128db4528..27cb02604 100644
--- a/rust/crates/pumas-core/src/model_library/watcher.rs
+++ b/rust/crates/pumas-core/src/model_library/watcher.rs
@@ -11,18 +11,6 @@ use std::time::Duration;
use tokio::sync::mpsc;
use tracing::{debug, info, warn};
-/// Model file extensions that should trigger a rebuild.
-const MODEL_EXTENSIONS: &[&str] = &[
- "gguf",
- "safetensors",
- "pt",
- "pth",
- "ckpt",
- "bin",
- "onnx",
- "json", // metadata.json changes
-];
-
/// Callback type for when model library changes are detected.
pub type ChangeCallback = Box) + Send + Sync + 'static>;
@@ -165,7 +153,7 @@ fn is_relevant_change(path: &Path) -> bool {
// Check file extension
if let Some(ext) = path.extension() {
let ext_str = ext.to_string_lossy().to_lowercase();
- if MODEL_EXTENSIONS.contains(&ext_str.as_str()) {
+ if ext_str == "json" || super::MODEL_FILE_EXTENSIONS.contains(&ext_str.as_str()) {
return true;
}
}
diff --git a/rust/crates/pumas-core/src/models/inference_defaults.rs b/rust/crates/pumas-core/src/models/inference_defaults.rs
index 72012bc81..c07985460 100644
--- a/rust/crates/pumas-core/src/models/inference_defaults.rs
+++ b/rust/crates/pumas-core/src/models/inference_defaults.rs
@@ -22,6 +22,9 @@ pub fn default_inference_settings(
file_format: &str,
subtype: Option<&str>,
) -> Option> {
+ if file_format == "basalt" {
+ return Some(basalt_inference_settings());
+ }
match model_type {
"llm" => {
let is_dllm = subtype == Some("dllm");
@@ -226,6 +229,161 @@ fn is_qwen_image_text_to_image(metadata: &ModelMetadata) -> bool {
})
}
+/// Basalt model defaults. A null value delegates to the model pack or server.
+pub fn basalt_inference_settings() -> Vec {
+ use ParamType::{Integer, Number};
+ let mut params: Vec<_> = [
+ ("temperature", "Temperature", Number, 0.0, Some(2.0)),
+ ("top_p", "Top P", Number, 0.0, Some(1.0)),
+ ("top_k", "Top K", Integer, -1.0, Some(f64::from(i32::MAX))),
+ ("min_p", "Min P", Number, 0.0, Some(1.0)),
+ (
+ "repetition_penalty",
+ "Repetition Penalty",
+ Number,
+ 0.0,
+ None,
+ ),
+ (
+ "presence_penalty",
+ "Presence Penalty",
+ Number,
+ -2.0,
+ Some(2.0),
+ ),
+ (
+ "frequency_penalty",
+ "Frequency Penalty",
+ Number,
+ -2.0,
+ Some(2.0),
+ ),
+ (
+ "seed",
+ "Seed",
+ Integer,
+ -9_007_199_254_740_991.0,
+ Some(9_007_199_254_740_991.0),
+ ),
+ (
+ "max_tokens",
+ "Maximum Output Tokens",
+ Integer,
+ 1.0,
+ Some(1_048_576.0),
+ ),
+ ]
+ .into_iter()
+ .map(|(key, label, param_type, min, max)| InferenceParamSchema {
+ key: key.into(),
+ label: label.into(),
+ param_type,
+ default: serde_json::Value::Null,
+ description: Some(if matches!(key, "top_p" | "repetition_penalty") {
+ "Enter a positive value, or leave blank to use the model default".into()
+ } else {
+ "Leave blank to use the model default".into()
+ }),
+ constraints: Some(ParamConstraints {
+ min: Some(min),
+ max,
+ allowed_values: None,
+ }),
+ })
+ .collect();
+ params.insert(
+ 0,
+ InferenceParamSchema {
+ key: "reasoning_effort".into(),
+ label: "Thinking Level".into(),
+ param_type: ParamType::String,
+ default: serde_json::Value::Null,
+ description: Some("Use the model's default thinking level or choose a level".into()),
+ constraints: Some(ParamConstraints {
+ min: None,
+ max: None,
+ allowed_values: Some(
+ ["none", "minimal", "low", "medium", "high", "max"]
+ .map(|level| json!(level))
+ .into(),
+ ),
+ }),
+ },
+ );
+ params
+}
+
+pub(crate) fn validate_basalt_settings(
+ settings: Vec,
+) -> crate::Result> {
+ let mut canonical = basalt_inference_settings();
+ let mut seen = std::collections::BTreeSet::new();
+ for setting in settings {
+ if !seen.insert(setting.key.clone()) {
+ return Err(basalt_setting_error(&setting.key));
+ }
+ let entry = canonical
+ .iter_mut()
+ .find(|entry| entry.key == setting.key)
+ .ok_or_else(|| basalt_setting_error(&setting.key))?;
+ if !setting.default.is_null() {
+ validate_basalt_setting(entry, &setting.default)?;
+ entry.default =
+ if entry.key == "reasoning_effort" && setting.default.as_str() == Some("xhigh") {
+ json!("max")
+ } else {
+ setting.default
+ };
+ }
+ }
+ Ok(canonical)
+}
+
+/// Validate the supported sampling fields in a typed model operation.
+pub fn validate_basalt_sampling_options(
+ request: &serde_json::Map,
+) -> crate::Result<()> {
+ for entry in basalt_inference_settings() {
+ if let Some(value) = request.get(&entry.key) {
+ validate_basalt_setting(&entry, value)?;
+ }
+ }
+ Ok(())
+}
+
+fn validate_basalt_setting(
+ entry: &InferenceParamSchema,
+ value: &serde_json::Value,
+) -> crate::Result<()> {
+ let valid = entry.constraints.as_ref().is_some_and(|constraints| {
+ if let Some(choices) = &constraints.allowed_values {
+ // Basalt also accepts xhigh as a dialect alias for max.
+ return choices.contains(value)
+ || (entry.key == "reasoning_effort" && value.as_str() == Some("xhigh"));
+ }
+ if matches!(entry.param_type, ParamType::Integer) && !value.is_i64() {
+ return false;
+ }
+ value.as_f64().is_some_and(|number| {
+ number.is_finite()
+ && constraints.min.is_none_or(|min| number >= min)
+ && constraints.max.is_none_or(|max| number <= max)
+ && (!matches!(entry.key.as_str(), "top_p" | "repetition_penalty") || number > 0.0)
+ })
+ });
+ if valid {
+ Ok(())
+ } else {
+ Err(basalt_setting_error(&entry.key))
+ }
+}
+
+fn basalt_setting_error(key: &str) -> crate::PumasError {
+ crate::PumasError::InvalidParams {
+ message: format!("Invalid Basalt value or unsupported inference setting: {key}"),
+ }
+}
+
/// Common LLM sampling parameters shared across all LLM formats.
fn common_llm_params() -> Vec {
vec![
diff --git a/rust/crates/pumas-core/src/models/model.rs b/rust/crates/pumas-core/src/models/model.rs
index 5cb547cac..aa47ae46a 100644
--- a/rust/crates/pumas-core/src/models/model.rs
+++ b/rust/crates/pumas-core/src/models/model.rs
@@ -699,6 +699,7 @@ fn default_kind() -> String {
/// - GGUF: Ollama, llama.cpp
/// - SafeTensors: Candle, Diffusers, transformers, vLLM, MLX
/// - ONNX: ONNX Runtime
+/// - Basalt: Basalt
/// - PyTorch (.bin, .pt, .pth): transformers, Diffusers, vLLM, MLX
pub fn detect_compatible_engines(formats: &[String]) -> Vec {
use std::collections::HashSet;
@@ -730,6 +731,9 @@ pub fn detect_compatible_engines(formats: &[String]) -> Vec {
"onnx" => {
engines.insert("onnx-runtime");
}
+ "basalt" => {
+ engines.insert("basalt");
+ }
"tensorrt" => {
engines.insert("tensorrt");
}
@@ -905,6 +909,7 @@ pub enum DetectedFileType {
Ggml,
Pickle,
Onnx,
+ Basalt,
Unknown,
Error,
}
diff --git a/rust/crates/pumas-core/src/models/package_facts.rs b/rust/crates/pumas-core/src/models/package_facts.rs
index 579e0818a..99a501b22 100644
--- a/rust/crates/pumas-core/src/models/package_facts.rs
+++ b/rust/crates/pumas-core/src/models/package_facts.rs
@@ -67,6 +67,7 @@ pub enum PackageArtifactKind {
Safetensors,
DiffusersBundle,
Onnx,
+ Basalt,
Adapter,
Shard,
Unknown,
diff --git a/rust/crates/pumas-core/src/models/runtime_profile.rs b/rust/crates/pumas-core/src/models/runtime_profile.rs
index 59ba26125..e8df38b7b 100644
--- a/rust/crates/pumas-core/src/models/runtime_profile.rs
+++ b/rust/crates/pumas-core/src/models/runtime_profile.rs
@@ -114,6 +114,7 @@ pub enum RuntimeProviderId {
Ollama,
LlamaCpp,
OnnxRuntime,
+ Basalt,
// trellis.cpp's `trellis-server`, one process per image-to-3D model. A
// plain comment keeps the contract schema a single enum.
TrellisCpp,
@@ -128,6 +129,7 @@ pub enum RuntimeProviderMode {
LlamaCppRouter,
LlamaCppDedicated,
OnnxServe,
+ BasaltServe,
// One managed `trellis-server` process serving one model's weights.
TrellisServe,
}
diff --git a/rust/crates/pumas-core/src/network/github.rs b/rust/crates/pumas-core/src/network/github.rs
index bb9ce6454..dca313d6a 100644
--- a/rust/crates/pumas-core/src/network/github.rs
+++ b/rust/crates/pumas-core/src/network/github.rs
@@ -820,6 +820,20 @@ impl GitHubClient {
std::env::consts::ARCH,
);
}
+ if app_id == AppId::Basalt {
+ return releases
+ .into_iter()
+ .filter_map(|mut release| {
+ let asset = crate::basalt_distribution::select_archive(
+ &release.tag_name,
+ &release.assets,
+ )?;
+ release.archive_size = Some(asset.size);
+ release.total_size = Some(asset.size);
+ Some(release)
+ })
+ .collect();
+ }
// Populate archive_size from platform-matched assets
Self::populate_archive_sizes(&mut releases, app_id);
releases
diff --git a/rust/crates/pumas-core/src/process/launcher.rs b/rust/crates/pumas-core/src/process/launcher.rs
index 2f02c15b1..2982ec84c 100644
--- a/rust/crates/pumas-core/src/process/launcher.rs
+++ b/rust/crates/pumas-core/src/process/launcher.rs
@@ -169,6 +169,21 @@ impl BinaryLaunchConfig {
}
}
+ pub(crate) fn basalt(tag: &str, version_dir: &Path) -> Self {
+ Self {
+ tag: tag.to_owned(),
+ version_dir: version_dir.to_path_buf(),
+ binary_path: version_dir.join(crate::basalt_distribution::SERVER_PYTHON),
+ command: None,
+ extra_args: Vec::new(),
+ env_vars: HashMap::new(),
+ pid_file: version_dir.join("basalt.pid"),
+ log_file: None,
+ ready_timeout: Duration::from_secs(120),
+ health_check_url: None,
+ }
+ }
+
/// Create a launch config for the ONNX host of an ONNX Runtime profile:
/// `host_executable --onnx-host`, loading the installed version at
/// `version_dir`. The listener and device-mode arguments come from the
diff --git a/rust/crates/pumas-core/src/providers/mod.rs b/rust/crates/pumas-core/src/providers/mod.rs
index e86f15f3e..7700340c8 100644
--- a/rust/crates/pumas-core/src/providers/mod.rs
+++ b/rust/crates/pumas-core/src/providers/mod.rs
@@ -15,6 +15,7 @@ pub enum ExecutableArtifactFormat {
Safetensors,
Gguf,
Onnx,
+ Basalt,
}
impl ExecutableArtifactFormat {
@@ -23,6 +24,7 @@ impl ExecutableArtifactFormat {
"safetensors" => Some(Self::Safetensors),
"gguf" => Some(Self::Gguf),
"onnx" => Some(Self::Onnx),
+ "basalt" => Some(Self::Basalt),
_ => None,
}
}
@@ -81,6 +83,7 @@ pub enum ProviderBinaryLaunchTarget {
LlamaCppDedicated,
/// The ONNX host process (`pumas-rpc --onnx-host`) of an ONNX Runtime profile.
OnnxHost,
+ BasaltServe,
/// trellis.cpp's `trellis-server` for one model's weights.
TrellisServe,
}
@@ -126,6 +129,7 @@ pub enum ProviderServingAdapterKind {
OllamaProviderApi,
LlamaCppRuntime,
OnnxRuntime,
+ BasaltRuntime,
TrellisCppRuntime,
}
@@ -134,6 +138,7 @@ pub enum ProviderServingAdapterKind {
pub enum ProviderServingPlacementPolicy {
ProfileOnly,
LlamaCppRuntime,
+ BasaltDedicated,
}
/// A field of a serve request that may differ from the selected runtime
@@ -166,6 +171,9 @@ impl ProviderServingPlacementPolicy {
ServingRequestControl::ContextSize,
],
(Self::LlamaCppRuntime, _) => vec![ServingRequestControl::ContextSize],
+ // Basalt serves one model per process; only the context size may
+ // differ from the profile (serving::placement checks its range).
+ (Self::BasaltDedicated, _) => vec![ServingRequestControl::ContextSize],
(Self::ProfileOnly, _) => Vec::new(),
}
}
@@ -376,6 +384,49 @@ impl ProviderBehavior {
}
}
+ pub fn basalt() -> Self {
+ let app = crate::config::AppId::Basalt;
+ Self {
+ provider: RuntimeProviderId::Basalt,
+ provider_modes: vec![RuntimeProviderMode::BasaltServe],
+ device_modes: vec![
+ RuntimeDeviceMode::Auto,
+ RuntimeDeviceMode::Gpu,
+ RuntimeDeviceMode::SpecificDevice,
+ ],
+ local_artifact_formats: vec![ExecutableArtifactFormat::Basalt],
+ serving_tasks: vec![ServingTask::Chat, ServingTask::ImageToText],
+ openai_endpoints: vec![
+ OpenAiGatewayEndpoint::Models,
+ OpenAiGatewayEndpoint::ChatCompletions,
+ ],
+ launch_kinds: vec![ProviderLaunchKind::BinaryProcess],
+ managed_launch_strategies: vec![ProviderManagedLaunchStrategy {
+ provider_mode: RuntimeProviderMode::BasaltServe,
+ target: ProviderManagedLaunchTarget::BinaryProcess(
+ ProviderBinaryLaunchTarget::BasaltServe,
+ ),
+ }],
+ managed_runtime_app_id: app.as_str().into(),
+ managed_runtime_uninitialized_message: "Basalt version manager is unavailable".into(),
+ managed_runtime_no_active_version_message:
+ "Install and activate a Basalt version first".into(),
+ managed_runtime_path_segment: app.as_str().into(),
+ managed_runtime_base_port: app.default_port(),
+ provider_model_id_policy: ProviderModelIdPolicy::LibraryModelId,
+ gateway_alias_policy: ProviderGatewayAliasPolicy::LibraryModelId,
+ serving_adapter_kind: ProviderServingAdapterKind::BasaltRuntime,
+ serving_placement_policy: ProviderServingPlacementPolicy::BasaltDedicated,
+ unload_behavior: ProviderUnloadBehavior::DedicatedProcess,
+ supports_managed_profiles: true,
+ supports_external_profiles: false,
+ supports_model_catalog: true,
+ supports_dedicated_model_processes: true,
+ supports_launch_on_serve: true,
+ supports_default_profile_fallback: false,
+ }
+ }
+
pub fn torch() -> Self {
Self {
provider: RuntimeProviderId::Torch,
@@ -528,13 +579,17 @@ pub struct ProviderRegistry {
impl ProviderRegistry {
pub fn builtin() -> Self {
- Self::from_behaviors([
+ let mut behaviors = vec![
ProviderBehavior::ollama(),
ProviderBehavior::llama_cpp(),
ProviderBehavior::onnx_runtime(),
ProviderBehavior::torch(),
ProviderBehavior::trellis_cpp(),
- ])
+ ];
+ if crate::basalt_distribution::available() {
+ behaviors.push(ProviderBehavior::basalt());
+ }
+ Self::from_behaviors(behaviors)
}
pub fn from_behaviors(behaviors: impl IntoIterator- ) -> Self {
@@ -561,6 +616,7 @@ impl ProviderRegistry {
RuntimeProviderId::OnnxRuntime,
RuntimeProviderId::Torch,
RuntimeProviderId::TrellisCpp,
+ RuntimeProviderId::Basalt,
] {
if let Some(behavior) = self.providers.get(&provider) {
providers.push(behavior);
@@ -589,7 +645,14 @@ mod tests {
assert!(registry.contains(RuntimeProviderId::OnnxRuntime));
assert!(registry.contains(RuntimeProviderId::Torch));
assert!(registry.contains(RuntimeProviderId::TrellisCpp));
- assert_eq!(registry.providers().len(), 5);
+ assert_eq!(
+ registry.contains(RuntimeProviderId::Basalt),
+ crate::basalt_distribution::available()
+ );
+ assert_eq!(
+ registry.providers().len(),
+ 5 + usize::from(crate::basalt_distribution::available())
+ );
}
#[test]
diff --git a/rust/crates/pumas-core/src/runtime_profiles.rs b/rust/crates/pumas-core/src/runtime_profiles.rs
index 3c88f3a83..149f89bba 100644
--- a/rust/crates/pumas-core/src/runtime_profiles.rs
+++ b/rust/crates/pumas-core/src/runtime_profiles.rs
@@ -114,13 +114,17 @@ pub struct RuntimeProviderAdapters {
impl RuntimeProviderAdapters {
pub fn builtin() -> Self {
- Self::from_adapters(vec![
- Arc::new(OllamaRuntimeProviderAdapter) as Arc
,
- Arc::new(LlamaCppRuntimeProviderAdapter) as Arc,
- Arc::new(OnnxRuntimeProviderAdapter) as Arc,
- Arc::new(TorchRuntimeProviderAdapter) as Arc,
- Arc::new(TrellisCppRuntimeProviderAdapter) as Arc,
- ])
+ let mut adapters: Vec> = vec![
+ Arc::new(OllamaRuntimeProviderAdapter),
+ Arc::new(LlamaCppRuntimeProviderAdapter),
+ Arc::new(OnnxRuntimeProviderAdapter),
+ Arc::new(TorchRuntimeProviderAdapter),
+ Arc::new(TrellisCppRuntimeProviderAdapter),
+ ];
+ if crate::basalt_distribution::available() {
+ adapters.push(Arc::new(BasaltRuntimeProviderAdapter));
+ }
+ Self::from_adapters(adapters)
}
pub fn from_adapters(
@@ -520,6 +524,42 @@ impl RuntimeProviderAdapter for OnnxRuntimeProviderAdapter {
}
}
+#[derive(Debug)]
+struct BasaltRuntimeProviderAdapter;
+
+#[async_trait]
+impl RuntimeProviderAdapter for BasaltRuntimeProviderAdapter {
+ fn provider(&self) -> RuntimeProviderId {
+ RuntimeProviderId::Basalt
+ }
+
+ fn capabilities(&self) -> RuntimeProviderCapabilities {
+ RuntimeProviderCapabilities::from_behavior(&ProviderBehavior::basalt())
+ }
+
+ async fn validate_profile(&self, profile: &RuntimeProfileConfig) -> Result<()> {
+ if let Some(endpoint) = &profile.endpoint_url {
+ let url =
+ url::Url::parse(endpoint.as_str()).map_err(|_| PumasError::InvalidParams {
+ message: "Basalt requires a loopback HTTP runtime endpoint".into(),
+ })?;
+ if url.scheme() != "http"
+ || url.host_str() != Some("127.0.0.1")
+ || url.path() != "/"
+ || !url.username().is_empty()
+ || url.password().is_some()
+ || url.query().is_some()
+ || url.fragment().is_some()
+ {
+ return Err(PumasError::InvalidParams {
+ message: "Basalt requires a loopback HTTP runtime endpoint on 127.0.0.1".into(),
+ });
+ }
+ }
+ Ok(())
+ }
+}
+
#[derive(Debug, Clone)]
pub struct RuntimeProfileService {
store_lifetime: crate::platform::store_lifetime::StoreLifetime,
diff --git a/rust/crates/pumas-core/src/runtime_profiles/launch_specs.rs b/rust/crates/pumas-core/src/runtime_profiles/launch_specs.rs
index 92a539987..47ebde90a 100644
--- a/rust/crates/pumas-core/src/runtime_profiles/launch_specs.rs
+++ b/rust/crates/pumas-core/src/runtime_profiles/launch_specs.rs
@@ -76,12 +76,16 @@ pub(super) fn derive_managed_profile_launch_specs(
let mut specs = Vec::with_capacity(profiles.len());
for profile in profiles {
- let behavior =
- provider_registry
- .get(profile.provider)
- .ok_or_else(|| PumasError::InvalidParams {
+ let behavior = match provider_registry.get(profile.provider) {
+ Some(behavior) => behavior,
+ // Basalt profiles can persist when a build disables this provider.
+ None if profile.provider == crate::models::RuntimeProviderId::Basalt => continue,
+ None => {
+ return Err(PumasError::InvalidParams {
message: "runtime profile provider is not registered".to_string(),
- })?;
+ })
+ }
+ };
let port = match profile.port {
Some(port) => {
if let Some(existing_profile_id) = used_ports.get(&port.value()) {
@@ -146,6 +150,7 @@ pub(super) fn derive_managed_profile_launch_specs(
health_check_url: if matches!(
profile.provider,
crate::models::RuntimeProviderId::Torch
+ | crate::models::RuntimeProviderId::Basalt
| crate::models::RuntimeProviderId::TrellisCpp
) {
RuntimeEndpointUrl::parse(format!(
@@ -259,6 +264,7 @@ fn profile_runtime_env_vars(
RuntimeProfileLaunchStrategy::BinaryProcess(
RuntimeProfileBinaryLaunchKind::LlamaCppRouter
| RuntimeProfileBinaryLaunchKind::LlamaCppDedicated
+ | RuntimeProfileBinaryLaunchKind::BasaltServe
| RuntimeProfileBinaryLaunchKind::TrellisServe,
)
| RuntimeProfileLaunchStrategy::InProcessRuntime(_)
@@ -319,6 +325,19 @@ fn profile_runtime_extra_args(
]);
Ok(args)
}
+ RuntimeProfileLaunchStrategy::BinaryProcess(
+ RuntimeProfileBinaryLaunchKind::BasaltServe,
+ ) => {
+ let mut args = vec!["-B".into(), "-m".into(), "serve.server".into()];
+ args.extend(runtime_listener_args(endpoint_url, port)?);
+ args.extend([
+ "--gpu".into(),
+ "auto".into(),
+ "--vision".into(),
+ "dynamic".into(),
+ ]);
+ Ok(args)
+ }
RuntimeProfileLaunchStrategy::BinaryProcess(
RuntimeProfileBinaryLaunchKind::TrellisServe,
) => {
@@ -542,6 +561,30 @@ fn apply_device_visibility_env(
}
}
+#[cfg(test)]
+mod gated_provider_tests {
+ use super::*;
+ use crate::models::{RuntimeProviderId, RuntimeProviderMode};
+
+ #[test]
+ fn an_unregistered_basalt_profile_does_not_block_other_profiles() {
+ let mut config = RuntimeProfilesConfigFile::default_seed();
+ let mut basalt = config.profiles[0].clone();
+ basalt.profile_id = RuntimeProfileId::parse("basalt-disabled").unwrap();
+ basalt.provider = RuntimeProviderId::Basalt;
+ basalt.provider_mode = RuntimeProviderMode::BasaltServe;
+ config.profiles.push(basalt);
+ let registry = ProviderRegistry::from_behaviors([ProviderBehavior::ollama()]);
+
+ let specs =
+ derive_managed_profile_launch_specs(Path::new("/fixture"), &config, ®istry).unwrap();
+
+ assert_eq!(specs.len(), 1);
+ assert_eq!(specs[0].provider, RuntimeProviderId::Ollama);
+ assert_eq!(config.profiles.len(), 2);
+ }
+}
+
#[cfg(test)]
mod torch_tests {
use super::*;
diff --git a/rust/crates/pumas-core/src/runtime_profiles/launch_strategy.rs b/rust/crates/pumas-core/src/runtime_profiles/launch_strategy.rs
index 644f6e4eb..e25bff32a 100644
--- a/rust/crates/pumas-core/src/runtime_profiles/launch_strategy.rs
+++ b/rust/crates/pumas-core/src/runtime_profiles/launch_strategy.rs
@@ -17,6 +17,7 @@ pub enum RuntimeProfileBinaryLaunchKind {
LlamaCppRouter,
LlamaCppDedicated,
OnnxHost,
+ BasaltServe,
TrellisServe,
}
@@ -80,6 +81,7 @@ impl From for RuntimeProfileBinaryLaunchKind {
ProviderBinaryLaunchTarget::LlamaCppRouter => Self::LlamaCppRouter,
ProviderBinaryLaunchTarget::LlamaCppDedicated => Self::LlamaCppDedicated,
ProviderBinaryLaunchTarget::OnnxHost => Self::OnnxHost,
+ ProviderBinaryLaunchTarget::BasaltServe => Self::BasaltServe,
ProviderBinaryLaunchTarget::TrellisServe => Self::TrellisServe,
}
}
diff --git a/rust/crates/pumas-core/src/runtime_profiles/process_owner.rs b/rust/crates/pumas-core/src/runtime_profiles/process_owner.rs
index d46090145..8cdf3496e 100644
--- a/rust/crates/pumas-core/src/runtime_profiles/process_owner.rs
+++ b/rust/crates/pumas-core/src/runtime_profiles/process_owner.rs
@@ -20,7 +20,7 @@ use crate::process::BinaryLaunchConfig;
use crate::{PumasError, Result};
use futures::future::{BoxFuture, FutureExt, Shared};
use std::collections::HashMap;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;
@@ -582,7 +582,7 @@ impl RuntimeProfileProcessOwner {
&self,
id: &RuntimeProfileId,
) -> Result)>> {
- self.stop_matching_generation_with_receipt(id, None).await
+ self.stop_matching_with_receipt(id, None, None).await
}
/// Stop only the session admitted by a particular launch generation.
@@ -592,14 +592,27 @@ impl RuntimeProfileProcessOwner {
id: &RuntimeProfileId,
generation: u64,
) -> Result )>> {
- self.stop_matching_generation_with_receipt(id, Some(generation))
+ self.stop_matching_with_receipt(id, Some(generation), None)
.await
}
- async fn stop_matching_generation_with_receipt(
+ /// Stop the owned session only if it was launched for `model_path`. The
+ /// match and the stop request happen under one registry lock, so a
+ /// successor launched for another model is never stopped.
+ pub(crate) async fn stop_if_model_with_receipt(
+ &self,
+ id: &RuntimeProfileId,
+ model_path: &Path,
+ ) -> Result )>> {
+ self.stop_matching_with_receipt(id, None, Some(model_path))
+ .await
+ }
+
+ async fn stop_matching_with_receipt(
&self,
id: &RuntimeProfileId,
expected_generation: Option,
+ expected_model_path: Option<&Path>,
) -> Result)>> {
let session = self
.registry
@@ -609,6 +622,8 @@ impl RuntimeProfileProcessOwner {
.get(id)
.filter(|session| {
expected_generation.is_none_or(|expected| session.generation == expected)
+ && expected_model_path
+ .is_none_or(|expected| session.model_path.as_deref() == Some(expected))
})
.cloned();
let Some(session) = session else {
@@ -1476,6 +1491,40 @@ mod tests {
.is_some());
}
+ #[tokio::test]
+ async fn model_bound_stop_leaves_a_process_launched_for_another_model() {
+ let fixture = Fixture::new();
+ let (config, spec, guard) = fixture.launch("sleep 30 & wait");
+ let id = spec.profile_id.clone();
+ let successor = PathBuf::from("/fixture/model-b.basalt");
+ let receipt = fixture
+ .owner
+ .launch(config, spec, Some(successor.clone()), None, guard)
+ .await
+ .unwrap()
+ .observation
+ .unwrap();
+ // An unload of the earlier model must not stop model B's process.
+ assert!(fixture
+ .owner
+ .stop_if_model_with_receipt(&id, Path::new("/fixture/model-a.basalt"))
+ .await
+ .unwrap()
+ .is_none());
+ let current = fixture.owner.snapshot(&id).unwrap().unwrap();
+ assert_eq!(current.generation, receipt.generation);
+ assert_ne!(current.state, RuntimeLifecycleState::Stopping);
+ assert_ne!(current.state, RuntimeLifecycleState::Stopped);
+ let (stopped, result) = fixture
+ .owner
+ .stop_if_model_with_receipt(&id, &successor)
+ .await
+ .unwrap()
+ .unwrap();
+ assert_eq!(stopped.generation, receipt.generation);
+ assert!(result.unwrap());
+ }
+
#[tokio::test]
async fn unowned_pid_file_is_preserved_without_signalling() {
let fixture = Fixture::new();
diff --git a/rust/crates/pumas-core/src/serving/placement.rs b/rust/crates/pumas-core/src/serving/placement.rs
index 53f34e0e4..2d3a8defc 100644
--- a/rust/crates/pumas-core/src/serving/placement.rs
+++ b/rust/crates/pumas-core/src/serving/placement.rs
@@ -16,7 +16,22 @@ pub(super) fn validate_provider_placement(
) -> Vec {
match behavior.serving_placement_policy {
ProviderServingPlacementPolicy::ProfileOnly => {
- validate_profile_only_placement(model_id, request, profile)
+ validate_profile_only_placement(model_id, request, profile, false)
+ }
+ ProviderServingPlacementPolicy::BasaltDedicated => {
+ let mut errors = validate_profile_only_placement(model_id, request, profile, true);
+ if request
+ .config
+ .context_size
+ .is_some_and(|size| !(1024..=1_048_576).contains(&size))
+ {
+ errors.push(unsupported_placement(
+ model_id,
+ request,
+ "Basalt context size must be between 1024 and 1048576 tokens",
+ ));
+ }
+ errors
}
ProviderServingPlacementPolicy::LlamaCppRuntime => {
validate_llama_cpp_placement(model_id, request, profile, context)
@@ -102,6 +117,7 @@ fn validate_profile_only_placement(
model_id: &str,
request: &ServeModelRequest,
profile: &ServingValidationProfile,
+ supports_context_override: bool,
) -> Vec {
let mut errors = Vec::new();
@@ -141,7 +157,7 @@ fn validate_profile_only_placement(
));
}
- if request.config.context_size.is_some() {
+ if !supports_context_override && request.config.context_size.is_some() {
errors.push(unsupported_placement(
model_id,
request,
diff --git a/rust/crates/pumas-rpc/Cargo.toml b/rust/crates/pumas-rpc/Cargo.toml
index 313c889e0..43f2f729c 100644
--- a/rust/crates/pumas-rpc/Cargo.toml
+++ b/rust/crates/pumas-rpc/Cargo.toml
@@ -71,7 +71,8 @@ s3 = ["pumas-library/s3", "dep:cap-std", "dep:same-file"]
test-support = ["pumas-app-manager?/test-support"]
export-contract = ["dep:schemars", "dep:tempfile", "pumas-library/contract-schema"]
# S3 import ships in every desktop release; see docs/contracts/artifact-acquisition.md.
-default = ["inference-plugins", "s3"]
+default = ["inference-plugins", "basalt", "s3"]
+basalt = ["inference-plugins", "pumas-library/basalt"]
inference-plugins = [
"dep:pumas-app-manager",
"pumas-library/onnx-runtime",
diff --git a/rust/crates/pumas-rpc/src/contract/runtime_providers.rs b/rust/crates/pumas-rpc/src/contract/runtime_providers.rs
index 298bc38b4..058158983 100644
--- a/rust/crates/pumas-rpc/src/contract/runtime_providers.rs
+++ b/rust/crates/pumas-rpc/src/contract/runtime_providers.rs
@@ -184,16 +184,17 @@ mod tests {
.iter()
.map(|provider| provider["provider"].as_str().unwrap())
.collect();
- assert_eq!(
- ids,
- [
- "ollama",
- "llama_cpp",
- "onnx_runtime",
- "torch",
- "trellis_cpp"
- ]
- );
+ let mut expected = vec![
+ "ollama",
+ "llama_cpp",
+ "onnx_runtime",
+ "torch",
+ "trellis_cpp",
+ ];
+ if pumas_library::basalt_distribution::available() {
+ expected.push("basalt");
+ }
+ assert_eq!(ids, expected);
let onnx = &providers[2];
assert_eq!(
diff --git a/rust/crates/pumas-rpc/src/discovery.rs b/rust/crates/pumas-rpc/src/discovery.rs
index ae716f9b6..34faf29f7 100644
--- a/rust/crates/pumas-rpc/src/discovery.rs
+++ b/rust/crates/pumas-rpc/src/discovery.rs
@@ -47,6 +47,7 @@ pub(crate) fn build_info() -> PumasBuildInfo {
info.package_version = env!("CARGO_PKG_VERSION").into();
for (name, enabled) in [
("inference-plugins", cfg!(feature = "inference-plugins")),
+ ("basalt", pumas_library::basalt_distribution::available()),
("s3", cfg!(feature = "s3")),
("export-contract", cfg!(feature = "export-contract")),
("test-support", cfg!(feature = "test-support")),
diff --git a/rust/crates/pumas-rpc/src/handlers/mod.rs b/rust/crates/pumas-rpc/src/handlers/mod.rs
index 55bb24ba0..c2221b10b 100644
--- a/rust/crates/pumas-rpc/src/handlers/mod.rs
+++ b/rust/crates/pumas-rpc/src/handlers/mod.rs
@@ -26,6 +26,8 @@ mod runtime_profiles;
#[cfg(feature = "inference-plugins")]
mod serving;
#[cfg(feature = "inference-plugins")]
+mod serving_basalt;
+#[cfg(feature = "inference-plugins")]
mod serving_llama_cpp;
#[cfg(feature = "inference-plugins")]
mod serving_llama_cpp_router;
@@ -2761,7 +2763,10 @@ mod tests {
{
assert_eq!(wire["result"]["success"], true);
let providers = wire["result"]["providers"].as_array().unwrap();
- assert_eq!(providers.len(), 5);
+ assert_eq!(
+ providers.len(),
+ 5 + usize::from(pumas_library::basalt_distribution::available()),
+ );
assert_eq!(providers[2]["provider"], "onnx_runtime");
assert_eq!(providers[2]["app_id"], "onnx-runtime");
let rejected = call(json!({"app_id":"ollama"})).await;
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations.rs b/rust/crates/pumas-rpc/src/handlers/model_operations.rs
index da41f3e39..880ee7864 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations.rs
@@ -363,10 +363,31 @@ pub async fn handle_model_operations(
Ok(described) => described,
Err(code) => return reject(id, code),
};
+ let explicit_output_limit = matches!(
+ request.options,
+ Some(OperationOptions::TextGeneration {
+ max_tokens: Some(_),
+ ..
+ })
+ );
let request = match request.resolve_with(&declarations, &modalities.unavailable) {
Ok(request) => request,
Err(rejection) => return reject(id, rejection),
};
+ if served.provider != RuntimeProviderId::Basalt
+ && matches!(
+ request.options,
+ OperationOptions::TextGeneration {
+ sampling: Some(_),
+ ..
+ }
+ )
+ {
+ return reject(
+ id,
+ Rejection::invalid("options.sampling is unavailable for this provider"),
+ );
+ }
// Artifact generation has its own adapter projection (ADR 0010).
if request.capability == Capability::VideoGeneration {
return generation::dispatch_video(state, disconnect, request, &served).await;
@@ -374,7 +395,7 @@ pub async fn handle_model_operations(
if request.capability == Capability::MeshGeneration {
return mesh::dispatch_mesh(state, disconnect, request, &served).await;
}
- let body = match image_body {
+ let mut body = match image_body {
Some(body)
if matches!(
request.capability,
@@ -395,6 +416,16 @@ pub async fn handle_model_operations(
Err(rejection) => return reject(id, rejection),
},
};
+ if served.provider == RuntimeProviderId::Basalt
+ && request.capability == Capability::ImageToText
+ && !explicit_output_limit
+ {
+ // The generic vision projection adds a limit for other providers.
+ // Leave this field absent so Basalt can use the saved model default.
+ if let Some(body) = body.as_object_mut() {
+ body.remove("max_tokens");
+ }
+ }
if request.capability == Capability::AudioTranscription {
return dispatch_audio(state, disconnect, &request, &served, body).await;
}
@@ -466,6 +497,7 @@ pub async fn handle_model_operations(
response,
&request,
served.profile_id.as_str(),
+ served.provider,
cancellation
.into_inner()
.expect("request-local cancellation mutex"),
@@ -491,7 +523,7 @@ pub async fn handle_model_operations(
{
return Err(ErrorCode::InvalidProviderResult);
}
- projection::result(&request, value)
+ projection::result(&request, value, served.provider)
});
match result {
Ok(result) => {
@@ -801,12 +833,14 @@ async fn describe(
} else {
runtime_modalities::observe(state, served, hints).await
};
+ let runtime_ready =
+ runtime_ready && (served.provider != RuntimeProviderId::Basalt || observation.observed);
// Without a recorded task, the runtime's own declaration of a generation
// model decides what it can do (ADR 0005); it only ever adds a match.
let task_known = task.is_some_and(|task| !matches!(task, "unknown" | ""));
let declared_text_out = observation.declared.output.contains(&Modality::Text);
let semantics_of = |capability: Capability| {
- let by_runtime = !task_known
+ let by_runtime = (!task_known || served.provider == RuntimeProviderId::Basalt)
&& observation.runtime_declared
&& !observation.decisions
&& declared_text_out
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/modality.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/modality.rs
index 57421e917..2b4ce398b 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/modality.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/modality.rs
@@ -456,6 +456,7 @@ impl ModalityRequest {
max_tokens: Some(512),
temperature: None,
top_p: None,
+ sampling: None,
});
let operation = self.operation(Capability::ImageToText, input, OutputFormat::Text, options);
projection::validate_image_to_text_request(&operation)?;
@@ -497,6 +498,7 @@ impl ModalityRequest {
max_tokens: None,
temperature: None,
top_p: None,
+ sampling: None,
});
let operation = self.operation(
Capability::ChatGeneration,
@@ -770,12 +772,14 @@ impl ModalityRequest {
max_tokens: None,
temperature: None,
top_p: None,
+ sampling: None,
}
}
Capability::ImageToText => OperationOptions::TextGeneration {
max_tokens: Some(512),
temperature: None,
top_p: None,
+ sampling: None,
},
Capability::TextEmbedding | Capability::MultimodalEmbedding => {
OperationOptions::Embeddings { dimensions: None }
@@ -1312,6 +1316,7 @@ mod image_to_text_resolver_tests {
max_tokens: Some(0),
temperature: None,
top_p: None,
+ sampling: None,
},
] {
let mut r = request(image());
@@ -1429,11 +1434,13 @@ mod image_to_text_resolver_tests {
max_tokens: Some(0),
temperature: None,
top_p: None,
+ sampling: None,
},
OperationOptions::TextGeneration {
max_tokens: None,
temperature: Some(f64::NAN),
top_p: None,
+ sampling: None,
},
] {
let mut r = request(image());
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/projection.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/projection.rs
index 780f5f360..6a8267a7c 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/projection.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/projection.rs
@@ -1,4 +1,5 @@
use super::types::*;
+use pumas_library::models::RuntimeProviderId;
use serde_json::{json, Value};
/// Closed typed admission precedes every provider-facing effect.
@@ -246,6 +247,7 @@ pub fn provider_request(request: &OperationRequest) -> Result
max_tokens,
temperature,
top_p,
+ ref sampling,
} => {
if max_tokens == Some(0) {
return Err(Rejection::invalid("options.max_tokens must be at least 1"));
@@ -270,6 +272,18 @@ pub fn provider_request(request: &OperationRequest) -> Result
if let Some(v) = top_p {
body["top_p"] = json!(v);
}
+ if let Some(sampling) = sampling {
+ let values = serde_json::to_value(sampling)
+ .map_err(|_| Rejection::invalid("options.sampling is not valid JSON"))?;
+ let values = values
+ .as_object()
+ .ok_or_else(|| Rejection::invalid("options.sampling must be an object"))?;
+ pumas_library::models::validate_basalt_sampling_options(values)
+ .map_err(|error| Rejection::invalid(error.to_string()))?;
+ for (key, value) in values {
+ body[key] = value.clone();
+ }
+ }
body["n"] = json!(1);
}
OperationOptions::Embeddings { dimensions } => {
@@ -306,6 +320,7 @@ pub fn validate_image_to_text_request(request: &OperationRequest) -> Result<(),
max_tokens,
temperature,
top_p,
+ ..
} if max_tokens.is_none_or(|v| v >= 1)
&& temperature.is_none_or(|v| v.is_finite() && (0.0..=2.0).contains(&v))
&& top_p.is_none_or(|v| v.is_finite() && (0.0..=1.0).contains(&v)) =>
@@ -603,7 +618,11 @@ fn truncate_embedding(mut vector: Vec, dimensions: usize) -> Option Result {
+pub fn result(
+ request: &OperationRequest,
+ value: Value,
+ provider: RuntimeProviderId,
+) -> Result {
let invalid = ErrorCode::InvalidProviderResult;
if value.get("error").is_some() {
return Err(ErrorCode::ProviderFailure);
@@ -618,6 +637,9 @@ pub fn result(request: &OperationRequest, value: Value) -> Result Result text.as_str(),
+ // Basalt uses null when generation ends without answer text.
+ Some(Value::Null)
+ if provider == RuntimeProviderId::Basalt
+ && matches!(
+ finish_reason,
+ FinishReason::Stop | FinishReason::Length
+ ) =>
+ {
+ ""
+ }
+ _ => return Err(invalid),
+ }
} else {
choice.get("text").and_then(Value::as_str).ok_or(invalid)?
};
- let finish_reason: FinishReason =
- serde_json::from_value(choice.get("finish_reason").cloned().ok_or(invalid)?)
- .map_err(|_| invalid)?;
Ok(OperationResult::Text {
text: text.to_owned(),
finish_reason,
@@ -737,6 +766,7 @@ mod image_to_text_projection_tests {
max_tokens: None,
temperature: None,
top_p: None,
+ sampling: None,
},
stream: false,
}
@@ -751,6 +781,7 @@ mod image_to_text_projection_tests {
max_tokens: Some(0),
temperature: None,
top_p: None,
+ sampling: None,
};
assert_eq!(
provider_request(&r).map_err(|rejection| rejection.code),
@@ -760,6 +791,7 @@ mod image_to_text_projection_tests {
max_tokens: Some(u32::MAX),
temperature: None,
top_p: None,
+ sampling: None,
};
validate_image_to_text_request(&r).unwrap();
r = request();
@@ -782,6 +814,7 @@ mod image_to_text_projection_tests {
max_tokens: Some(2049),
temperature: None,
top_p: None,
+ sampling: None,
};
assert_eq!(provider_request(&r).unwrap()["max_tokens"], 2049);
}
@@ -790,7 +823,7 @@ mod image_to_text_projection_tests {
fn vision_result_projects_finite_assistant_text_and_discards_private_fields() {
let payload = json!({"choices":[{"index":0,"message":{"role":"assistant","content":"a small red square","private":"hidden"},"finish_reason":"stop"}],"model":"private-provider-id","usage":{"private":true}});
assert_eq!(
- result(&request(), payload).unwrap(),
+ result(&request(), payload, RuntimeProviderId::LlamaCpp).unwrap(),
OperationResult::Text {
text: "a small red square".into(),
finish_reason: FinishReason::Stop
@@ -798,6 +831,43 @@ mod image_to_text_projection_tests {
);
}
+ #[test]
+ fn basalt_reasoning_only_at_the_token_limit_projects_an_empty_truncation() {
+ let payload = json!({"choices":[{"index":0,"message":{"role":"assistant","content":null,"reasoning_content":"thinking"},"finish_reason":"length"}]});
+ assert_eq!(
+ result(&request(), payload.clone(), RuntimeProviderId::Basalt).unwrap(),
+ OperationResult::Text {
+ text: String::new(),
+ finish_reason: FinishReason::Length,
+ }
+ );
+ assert_eq!(
+ result(&request(), payload, RuntimeProviderId::LlamaCpp),
+ Err(ErrorCode::InvalidProviderResult)
+ );
+ }
+
+ #[test]
+ fn basalt_reasoning_only_at_a_normal_stop_projects_an_empty_answer() {
+ let mut request = request();
+ request.capability = Capability::ChatGeneration;
+ request.input = OperationInput::Text {
+ text: "Think silently".into(),
+ };
+ let payload = json!({"choices":[{"index":0,"message":{"role":"assistant","content":null,"reasoning_content":"thinking"},"finish_reason":"stop"}]});
+ assert_eq!(
+ result(&request, payload.clone(), RuntimeProviderId::Basalt),
+ Ok(OperationResult::Text {
+ text: String::new(),
+ finish_reason: FinishReason::Stop,
+ })
+ );
+ assert_eq!(
+ result(&request, payload, RuntimeProviderId::LlamaCpp),
+ Err(ErrorCode::InvalidProviderResult)
+ );
+ }
+
#[test]
fn vision_result_rejects_tools_refusal_wrong_roles_and_open_finish_reasons() {
for message in [
@@ -810,7 +880,8 @@ mod image_to_text_projection_tests {
assert_eq!(
result(
&request(),
- json!({"choices":[{"index":0,"message":message,"finish_reason":"stop"}]})
+ json!({"choices":[{"index":0,"message":message,"finish_reason":"stop"}]}),
+ RuntimeProviderId::LlamaCpp
),
Err(ErrorCode::InvalidProviderResult)
);
@@ -818,12 +889,17 @@ mod image_to_text_projection_tests {
assert_eq!(
result(
&request(),
- json!({"choices":[{"index":0,"message":{"role":"assistant","content":"caption"},"finish_reason":"tool_calls"}]})
+ json!({"choices":[{"index":0,"message":{"role":"assistant","content":"caption"},"finish_reason":"tool_calls"}]}),
+ RuntimeProviderId::LlamaCpp
),
Err(ErrorCode::InvalidProviderResult)
);
assert_eq!(
- result(&request(), json!({"error":{},"choices":[]})),
+ result(
+ &request(),
+ json!({"error":{},"choices":[]}),
+ RuntimeProviderId::LlamaCpp
+ ),
Err(ErrorCode::ProviderFailure)
);
}
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/runtime_modalities.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/runtime_modalities.rs
index 5d56bf2e0..f2712e4f0 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/runtime_modalities.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/runtime_modalities.rs
@@ -77,6 +77,19 @@ pub(super) async fn observe(
let model_type = hints.model_type;
match served.provider {
RuntimeProviderId::LlamaCpp => llama_cpp(state, served, hints).await,
+ RuntimeProviderId::Basalt => {
+ let Some(health) = super::super::serving_basalt::model_health(state, served).await
+ else {
+ return Observation::default();
+ };
+ let mut result = fixed([Modality::Text], [Modality::Text]);
+ result.runtime_declared = true;
+ if health.images {
+ result.declared.input.push(Modality::Image);
+ result.live.insert(Modality::Image);
+ }
+ result
+ }
RuntimeProviderId::OnnxRuntime => fixed(
[Modality::Text],
[pooled_output(model_type, Modality::Vector)],
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/stream.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/stream.rs
index 1e7dcc608..c51d9d655 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/stream.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/stream.rs
@@ -8,6 +8,7 @@ use axum::{
response::{IntoResponse, Response},
};
use futures::{Stream, StreamExt};
+use pumas_library::models::RuntimeProviderId;
use serde_json::Value;
use std::{convert::Infallible, pin::Pin};
@@ -131,6 +132,7 @@ struct Projection {
output_bytes: usize,
request_id: String,
capability: Capability,
+ provider: RuntimeProviderId,
first: Option,
finish: Option,
done: bool,
@@ -171,12 +173,15 @@ impl Projection {
.get("delta")
.and_then(Value::as_object)
.ok_or(ErrorCode::InvalidProviderResult)?;
- if delta
- .keys()
- .any(|key| !matches!(key.as_str(), "role" | "content"))
- || delta
- .get("role")
- .is_some_and(|v| !v.is_null() && v.as_str() != Some("assistant"))
+ if delta.iter().any(|(key, value)| match key.as_str() {
+ "role" | "content" => false,
+ "reasoning_content" if self.provider == RuntimeProviderId::Basalt => {
+ !(value.is_string() || value.is_null())
+ }
+ _ => true,
+ }) || delta
+ .get("role")
+ .is_some_and(|v| !v.is_null() && v.as_str() != Some("assistant"))
{
return Err(ErrorCode::InvalidProviderResult);
}
@@ -261,6 +266,7 @@ pub fn response(
response: Response,
request: &OperationRequest,
profile: &str,
+ provider: RuntimeProviderId,
cancellation: Option,
) -> Response {
let projection = Projection {
@@ -271,6 +277,7 @@ pub fn response(
output_bytes: 0,
request_id: request.request_id.clone(),
capability: request.capability,
+ provider,
first: Some(StreamEvent::Started {
contract_version: CONTRACT_VERSION,
request_id: request.request_id.clone(),
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/tests.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/tests.rs
index 3a4a1c736..6f2a22974 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/tests.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/tests.rs
@@ -38,7 +38,13 @@ async fn typed_stream(bytes: Vec) -> String {
.into_iter()
.map(|b| Ok::<_, io::Error>(Bytes::from(vec![b]))),
));
- let response = stream::response(body.into_response(), &request, "llama-cpu", None);
+ let response = stream::response(
+ body.into_response(),
+ &request,
+ "llama-cpu",
+ RuntimeProviderId::LlamaCpp,
+ None,
+ );
String::from_utf8(
to_bytes(response.into_body(), MAX_BYTES)
.await
@@ -165,7 +171,7 @@ fn request_ids_are_correlation_and_embedding_bounds_belong_to_the_provider() {
#[test]
fn finite_projection_accepts_typed_text_and_rejects_raw_or_incoherent_results() {
let r = request();
- assert_eq!(projection::result(&r,json!({"choices":[{"index":0,"message":{"role":"assistant","content":"héllo"},"finish_reason":"stop"}],"secret_provider_field":"discard"})).unwrap(),OperationResult::Text{text:"héllo".into(),finish_reason:FinishReason::Stop});
+ assert_eq!(projection::result(&r,json!({"choices":[{"index":0,"message":{"role":"assistant","content":"héllo"},"finish_reason":"stop"}],"secret_provider_field":"discard"}), RuntimeProviderId::LlamaCpp).unwrap(),OperationResult::Text{text:"héllo".into(),finish_reason:FinishReason::Stop});
for value in [
json!("raw text"),
json!({"choices":[]}),
@@ -174,7 +180,7 @@ fn finite_projection_accepts_typed_text_and_rejects_raw_or_incoherent_results()
json!({"choices":[{"index":0,"message":{"role":"assistant","content":"x"},"finish_reason":null}]}),
] {
assert_eq!(
- projection::result(&r, value),
+ projection::result(&r, value, RuntimeProviderId::LlamaCpp),
Err(ErrorCode::InvalidProviderResult)
);
}
@@ -192,7 +198,8 @@ fn embeddings_enforce_count_indices_dimensions_and_finite_float32() {
assert_eq!(
projection::result(
&r,
- json!({"data":[{"index":0,"embedding":[0.2,0.4]},{"index":1,"embedding":[0.3,0.5]}]})
+ json!({"data":[{"index":0,"embedding":[0.2,0.4]},{"index":1,"embedding":[0.3,0.5]}]}),
+ RuntimeProviderId::LlamaCpp,
)
.unwrap(),
OperationResult::Embeddings {
@@ -206,7 +213,7 @@ fn embeddings_enforce_count_indices_dimensions_and_finite_float32() {
json!({"data":[{"index":0,"embedding":[1e100,0.4]},{"index":1,"embedding":[0.3,0.5]}]}),
] {
assert_eq!(
- projection::result(&r, value),
+ projection::result(&r, value, RuntimeProviderId::LlamaCpp),
Err(ErrorCode::InvalidProviderResult)
);
}
@@ -231,6 +238,27 @@ async fn stream_preserves_utf8_fragmentation_multiline_data_and_correlation() {
);
}
}
+#[tokio::test]
+async fn basalt_stream_publishes_answer_text_without_private_reasoning() {
+ let mut request = request();
+ request.stream = true;
+ let reasoning = "data: {\"choices\":[{\"index\":0,\"delta\":{\"reasoning_content\":\"private thought\"},\"finish_reason\":null}]}\n\n";
+ let source = Body::from(format!("{reasoning}{}{}", delta("ready"), finished()));
+ let response = stream::response(
+ source.into_response(),
+ &request,
+ "inkling",
+ RuntimeProviderId::Basalt,
+ None,
+ );
+ let bytes = to_bytes(response.into_body(), MAX_BYTES).await.unwrap();
+ let output = std::str::from_utf8(&bytes).unwrap();
+ assert!(output.contains("ready"));
+ assert!(output.contains("event: completed"));
+ assert!(!output.contains("private thought"));
+ assert!(!output.contains("event: failed"));
+}
+
#[tokio::test]
async fn incomplete_and_incoherent_streams_never_complete_successfully() {
let sources=vec![delta("x"),"data: [DONE]\n\n".into(),format!("{}data: [DONE]\n\n",delta("x")),format!("{}data: {{}}\n\n",finished()),"data: not-json\n\n".into(),"data: {\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[]},\"finish_reason\":null}]}\n\n".into(),"data: {\"choices\":[{\"index\":1,\"delta\":{},\"finish_reason\":\"stop\"}]}\n\n".into(),"data: {\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"tool_calls\"}]}\n\n".into(),"data: {\"error\":{\"secret\":\"backend path\"}}\n\n".into(),format!("{}data: [DONE]",finished().split("data: [DONE]").next().unwrap())];
@@ -258,7 +286,14 @@ async fn stream_event_limit_and_truncated_transport_are_failures() {
]));
let output = String::from_utf8(
to_bytes(
- stream::response(body.into_response(), &r, "cpu", None).into_body(),
+ stream::response(
+ body.into_response(),
+ &r,
+ "cpu",
+ RuntimeProviderId::LlamaCpp,
+ None,
+ )
+ .into_body(),
MAX_BYTES,
)
.await
@@ -289,9 +324,15 @@ async fn stream_progresses_without_eof_and_holds_original_body_until_completion_
});
let mut r = request();
r.stream = true;
- let mut output = stream::response(Body::from_stream(source).into_response(), &r, "cpu", None)
- .into_body()
- .into_data_stream();
+ let mut output = stream::response(
+ Body::from_stream(source).into_response(),
+ &r,
+ "cpu",
+ RuntimeProviderId::LlamaCpp,
+ None,
+ )
+ .into_body()
+ .into_data_stream();
assert!(std::str::from_utf8(&output.next().await.unwrap().unwrap())
.unwrap()
.contains("event: started"));
@@ -332,10 +373,15 @@ async fn projection_fault_immediately_drops_provider_and_body_disposal_closes_si
});
let mut r = request();
r.stream = true;
- let mut output =
- stream::response(Body::from_stream(source).into_response(), &r, "cpu", None)
- .into_body()
- .into_data_stream();
+ let mut output = stream::response(
+ Body::from_stream(source).into_response(),
+ &r,
+ "cpu",
+ RuntimeProviderId::LlamaCpp,
+ None,
+ )
+ .into_body()
+ .into_data_stream();
output.next().await.unwrap().unwrap();
if invalid {
sender
@@ -1292,7 +1338,14 @@ async fn typed_event_bound_includes_added_correlation_and_framing() {
Bytes::from(provider_frame),
)]));
let output = to_bytes(
- stream::response(source.into_response(), &r, "cpu", None).into_body(),
+ stream::response(
+ source.into_response(),
+ &r,
+ "cpu",
+ RuntimeProviderId::LlamaCpp,
+ None,
+ )
+ .into_body(),
MAX_BYTES,
)
.await
@@ -1340,6 +1393,7 @@ async fn stop_and_shutdown_gate_buffered_typed_events_and_release_original_permi
Body::from_stream(source).into_response(),
&r,
"cpu",
+ RuntimeProviderId::LlamaCpp,
Some(cancellation),
)
.into_body()
@@ -1409,7 +1463,8 @@ fn mixed_error_and_result_envelopes_cannot_be_successful_typed_results() {
assert_eq!(
projection::result(
&r,
- json!({"error":{"message":"private failure"},"choices":[{"index":0,"message":{"role":"assistant","content":"misleading"},"finish_reason":"stop"}]})
+ json!({"error":{"message":"private failure"},"choices":[{"index":0,"message":{"role":"assistant","content":"misleading"},"finish_reason":"stop"}]}),
+ RuntimeProviderId::LlamaCpp,
),
Err(ErrorCode::ProviderFailure)
);
@@ -1422,7 +1477,8 @@ fn mixed_error_and_result_envelopes_cannot_be_successful_typed_results() {
assert_eq!(
projection::result(
&r,
- json!({"error":"private failure","data":[{"index":0,"embedding":[1.,0.]}]})
+ json!({"error":"private failure","data":[{"index":0,"embedding":[1.,0.]}]}),
+ RuntimeProviderId::LlamaCpp,
),
Err(ErrorCode::ProviderFailure)
);
@@ -2257,20 +2313,22 @@ fn requested_dimensions_truncate_and_renormalize_provider_vectors() {
dimensions: Some(2),
};
let provider = json!({"data":[{"index":0,"embedding":[0.6,0.0,0.8,0.0]}]});
- let OperationResult::Embeddings { vectors } = projection::result(&r, provider).unwrap() else {
+ let OperationResult::Embeddings { vectors } =
+ projection::result(&r, provider, RuntimeProviderId::LlamaCpp).unwrap()
+ else {
panic!("embedding result");
};
assert_eq!(vectors, vec![vec![1.0, 0.0]]);
// A provider that honored the dimension is passed through.
let exact = json!({"data":[{"index":0,"embedding":[0.6,0.8]}]});
- assert!(projection::result(&r, exact).is_ok());
+ assert!(projection::result(&r, exact, RuntimeProviderId::LlamaCpp).is_ok());
// More dimensions than the model produces cannot be invented.
r.options = OperationOptions::Embeddings {
dimensions: Some(8),
};
let short = json!({"data":[{"index":0,"embedding":[0.6,0.8]}]});
assert_eq!(
- projection::result(&r, short),
+ projection::result(&r, short, RuntimeProviderId::LlamaCpp),
Err(ErrorCode::InvalidProviderResult)
);
}
@@ -2290,7 +2348,9 @@ fn requested_dimensions_truncate_every_vector_of_a_batch() {
{"index":0,"embedding":[0.6,0.0,0.8,0.0]},
{"index":1,"embedding":[0.0,0.6,0.0,0.8]}
]});
- let OperationResult::Embeddings { vectors } = projection::result(&r, provider).unwrap() else {
+ let OperationResult::Embeddings { vectors } =
+ projection::result(&r, provider, RuntimeProviderId::LlamaCpp).unwrap()
+ else {
panic!("embedding result");
};
assert_eq!(vectors, vec![vec![1.0, 0.0], vec![0.0, 1.0]]);
@@ -2300,7 +2360,7 @@ fn requested_dimensions_truncate_every_vector_of_a_batch() {
{"index":1,"embedding":[0.6,0.8]}
]});
assert_eq!(
- projection::result(&r, ragged),
+ projection::result(&r, ragged, RuntimeProviderId::LlamaCpp),
Err(ErrorCode::InvalidProviderResult)
);
}
@@ -2349,6 +2409,7 @@ fn image_and_mixed_items_project_to_llama_cpp_multimodal_embeddings() {
let result = projection::result(
&prepared,
json!({"data":[{"index":0,"embedding":[1.0,0.0]},{"index":1,"embedding":[0.0,1.0]}]}),
+ RuntimeProviderId::LlamaCpp,
)
.unwrap();
assert!(matches!(result, OperationResult::Embeddings { ref vectors } if vectors.len() == 2));
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/types.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/types.rs
index d2b0434a0..1f390c5f2 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/types.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/types.rs
@@ -314,6 +314,9 @@ pub enum OperationOptions {
temperature: Option,
#[serde(default)]
top_p: Option,
+ /// Additional generation controls for providers that expose them.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ sampling: Option,
},
Embeddings {
#[serde(default)]
@@ -376,6 +379,38 @@ pub enum OperationOptions {
texture_format: Option,
},
}
+#[cfg_attr(feature = "export-contract", derive(schemars::JsonSchema))]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(deny_unknown_fields)]
+pub struct TextSamplingOptions {
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub reasoning_effort: Option,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub top_k: Option,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub min_p: Option,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub repetition_penalty: Option,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub presence_penalty: Option,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub frequency_penalty: Option,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub seed: Option,
+}
+
+#[cfg_attr(feature = "export-contract", derive(schemars::JsonSchema))]
+#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum ThinkingLevel {
+ None,
+ Minimal,
+ Low,
+ Medium,
+ High,
+ Max,
+}
+
/// Background removal before image-to-3D generation.
#[cfg_attr(feature = "export-contract", derive(schemars::JsonSchema))]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
diff --git a/rust/crates/pumas-rpc/src/handlers/model_operations/vision.rs b/rust/crates/pumas-rpc/src/handlers/model_operations/vision.rs
index 2574ffa7a..c34a0933d 100644
--- a/rust/crates/pumas-rpc/src/handlers/model_operations/vision.rs
+++ b/rust/crates/pumas-rpc/src/handlers/model_operations/vision.rs
@@ -1,5 +1,4 @@
-//! Read-only readiness of a llama.cpp session for non-text input (images,
-//! audio). This is backend declaration checking, not model-byte or semantic
+//! Read-only readiness of a provider session for non-text input (images, audio). This is backend declaration checking, not model-byte or semantic
//! attestation.
use super::super::openai_gateway;
use super::types::Modality;
@@ -20,7 +19,10 @@ async fn supported_mode(
state: &AppState,
served: &ServedModelStatus,
) -> Option {
- if served.provider != RuntimeProviderId::LlamaCpp {
+ if !matches!(
+ served.provider,
+ RuntimeProviderId::LlamaCpp | RuntimeProviderId::Basalt
+ ) {
return None;
}
let snapshot = state.api.get_runtime_profiles_snapshot().await.ok()?;
@@ -30,10 +32,14 @@ async fn supported_mode(
.iter()
.find(|profile| {
profile.profile_id == served.profile_id
- && profile.provider == RuntimeProviderId::LlamaCpp
+ && profile.provider == served.provider
&& matches!(
- profile.provider_mode,
- RuntimeProviderMode::LlamaCppDedicated | RuntimeProviderMode::LlamaCppRouter
+ (profile.provider, profile.provider_mode),
+ (
+ RuntimeProviderId::LlamaCpp,
+ RuntimeProviderMode::LlamaCppDedicated
+ | RuntimeProviderMode::LlamaCppRouter
+ ) | (RuntimeProviderId::Basalt, RuntimeProviderMode::BasaltServe)
)
&& profile.enabled
})
diff --git a/rust/crates/pumas-rpc/src/handlers/openai_gateway.rs b/rust/crates/pumas-rpc/src/handlers/openai_gateway.rs
index 4e13e4257..a35a7ec8b 100644
--- a/rust/crates/pumas-rpc/src/handlers/openai_gateway.rs
+++ b/rust/crates/pumas-rpc/src/handlers/openai_gateway.rs
@@ -512,6 +512,17 @@ pub(super) async fn dispatch_openai(
);
}
+ if served.provider == RuntimeProviderId::Basalt {
+ if let Err(error) =
+ super::serving_basalt::apply_inference_defaults(&state, &served, &mut body).await
+ {
+ return openai_public_error_response(
+ StatusCode::BAD_REQUEST,
+ PublicError::from(&error),
+ );
+ }
+ }
+
let target_url = format!("{}{}", endpoint.as_str().trim_end_matches('/'), path.path());
let mut lifetime = if policy.generation {
let permit = match gateway_stream::try_admit() {
@@ -584,11 +595,16 @@ pub(super) async fn dispatch_openai(
.filter_map(|m| serde_json::to_value(m).ok()?.as_str().map(str::to_owned))
.collect::>()
.join(" and ");
+ let requirement = if served.provider == RuntimeProviderId::Basalt {
+ "The selected Basalt model must report that image input is available"
+ } else {
+ "The selected llama.cpp profile must be enabled with the model's projector loaded"
+ };
return openai_public_error_response(
StatusCode::SERVICE_UNAVAILABLE,
PublicError {
message: std::borrow::Cow::Owned(format!(
- "{names} input for the selected model is not ready: it needs an enabled llama.cpp profile with the model's projector loaded."
+ "{names} input for the selected model is unavailable. {requirement}."
)),
..PublicError::unavailable()
},
diff --git a/rust/crates/pumas-rpc/src/handlers/runtime_profiles.rs b/rust/crates/pumas-rpc/src/handlers/runtime_profiles.rs
index 00ac59bf0..7842511c9 100644
--- a/rust/crates/pumas-rpc/src/handlers/runtime_profiles.rs
+++ b/rust/crates/pumas-rpc/src/handlers/runtime_profiles.rs
@@ -496,16 +496,17 @@ mod tests {
)
})
.collect();
- assert_eq!(
- pairs,
- [
- ("ollama", "ollama"),
- ("llama_cpp", "llama-cpp"),
- ("onnx_runtime", "onnx-runtime"),
- ("torch", "torch"),
- ("trellis_cpp", "trellis-cpp"),
- ]
- );
+ let mut expected = vec![
+ ("ollama", "ollama"),
+ ("llama_cpp", "llama-cpp"),
+ ("onnx_runtime", "onnx-runtime"),
+ ("torch", "torch"),
+ ("trellis_cpp", "trellis-cpp"),
+ ];
+ if pumas_library::basalt_distribution::available() {
+ expected.push(("basalt", "basalt"));
+ }
+ assert_eq!(pairs, expected);
assert!(providers
.iter()
.all(|provider| provider["version_managed"] == false));
diff --git a/rust/crates/pumas-rpc/src/handlers/serving.rs b/rust/crates/pumas-rpc/src/handlers/serving.rs
index 1e1dbc764..c860d9640 100644
--- a/rust/crates/pumas-rpc/src/handlers/serving.rs
+++ b/rust/crates/pumas-rpc/src/handlers/serving.rs
@@ -6,7 +6,7 @@ use super::serving_ollama::{serve_ollama_model, unserve_ollama_model};
use super::serving_onnx::{serve_onnx_model, unserve_onnx_model};
use crate::server::AppState;
use pumas_library::models::{
- ModelServeError, ModelServeErrorCode, ServeModelRequest, ServeModelResponse,
+ ModelServeError, ModelServeErrorCode, RuntimeProviderId, ServeModelRequest, ServeModelResponse,
ServingEndpointMode, ServingStatusResponse, ServingStatusSnapshot, UnserveModelRequest,
UnserveModelResponse,
};
@@ -113,6 +113,9 @@ pub(super) async fn serve_validated(
Some(ProviderServingAdapterKind::TorchRuntime) => {
super::serving_torch::serve_torch_model(state, request, operation).await
}
+ Some(ProviderServingAdapterKind::BasaltRuntime) => {
+ super::serving_basalt::serve_basalt_model(state, request, operation).await
+ }
Some(ProviderServingAdapterKind::OnnxRuntime) => {
serve_onnx_model(state, request, operation).await
}
@@ -245,10 +248,12 @@ pub async fn unserve_model(state: &AppState, params: &Value) -> pumas_library::R
)
.await
}
- Some(ProviderUnloadBehavior::SessionManager) => {
- unserve_onnx_model(state, command.request, profile_id, model_alias).await
- }
- Some(ProviderUnloadBehavior::DedicatedProcess) => {
+ // Basalt and trellis.cpp both run one dedicated process per model;
+ // trellis.cpp owns its restart bookkeeping, so it unloads through its
+ // own adapter.
+ Some(ProviderUnloadBehavior::DedicatedProcess)
+ if served_status.provider == RuntimeProviderId::TrellisCpp =>
+ {
super::serving_trellis::unserve_trellis_model(
state,
command.request,
@@ -257,6 +262,26 @@ pub async fn unserve_model(state: &AppState, params: &Value) -> pumas_library::R
)
.await
}
+ Some(ProviderUnloadBehavior::DedicatedProcess) => {
+ // Stop only the process launched for this model; a successor
+ // started for another model after the lookup keeps running.
+ let stopped = state
+ .api
+ .stop_runtime_profile_serving_model(profile_id, &served_status.model_id)
+ .await;
+ Ok(serde_json::to_value(UnserveModelResponse {
+ success: true,
+ error: stopped
+ .as_ref()
+ .err()
+ .map(|_| "The owned runtime profile could not be stopped".into()),
+ unloaded: stopped.unwrap_or(false),
+ snapshot: Some(current_serving_snapshot(state).await?),
+ })?)
+ }
+ Some(ProviderUnloadBehavior::SessionManager) => {
+ unserve_onnx_model(state, command.request, profile_id, model_alias).await
+ }
None => Ok(serde_json::to_value(UnserveModelResponse {
success: true,
error: Some("served model provider is not registered".to_string()),
diff --git a/rust/crates/pumas-rpc/src/handlers/serving_basalt.rs b/rust/crates/pumas-rpc/src/handlers/serving_basalt.rs
new file mode 100644
index 000000000..27f84c6f0
--- /dev/null
+++ b/rust/crates/pumas-rpc/src/handlers/serving_basalt.rs
@@ -0,0 +1,384 @@
+//! Managed Basalt serving and model readiness.
+
+use std::time::Duration;
+
+use pumas_library::{
+ models::{
+ ModelServeErrorCode, RuntimeDeviceSettings, RuntimeLifecycleState, RuntimeProviderId,
+ ServeModelRequest, ServeModelResponse, ServedModelLoadState, ServedModelStatus,
+ },
+ runtime_profiles::{OwnedRuntimeProfileObservation, RuntimeProfileLaunchOverrides},
+ serving::ServingLoadOperation,
+};
+use serde::Deserialize;
+use serde_json::Value;
+
+use super::serving::{
+ decorate_serving_snapshot, effective_gateway_alias_from_config, non_critical_failure_response,
+ serving_error,
+};
+use crate::{provider_clients::read_bounded, server::AppState};
+
+#[derive(Deserialize)]
+pub(super) struct BasaltHealth {
+ service: String,
+ status: String,
+ model: String,
+ loaded: bool,
+ pub(super) max_context: u32,
+ pub(super) images: bool,
+}
+
+impl BasaltHealth {
+ fn matches_model(&self, model: &str) -> bool {
+ self.service == "basalt" && self.status == "ok" && self.model == model
+ }
+}
+
+pub(super) async fn read_health(
+ state: &AppState,
+ owned: &OwnedRuntimeProfileObservation,
+) -> Option {
+ let url = format!(
+ "{}/health",
+ owned.endpoint_url.as_str().trim_end_matches('/')
+ );
+ let response = state
+ .gateway_http_client
+ .for_url(&url)
+ .get(&url)
+ .timeout(Duration::from_secs(2))
+ .send()
+ .await
+ .ok()?;
+ if response.status() != reqwest::StatusCode::OK
+ || !response
+ .headers()
+ .get(reqwest::header::CONTENT_TYPE)
+ .and_then(|mime| mime.to_str().ok())
+ .and_then(|mime| mime.split(';').next())
+ .is_some_and(|mime| mime.trim().eq_ignore_ascii_case("application/json"))
+ {
+ return None;
+ }
+ let bytes = read_bounded(response, 16 * 1024).await.ok()?;
+ serde_json::from_slice(&bytes).ok()
+}
+
+pub(super) async fn serve_basalt_model(
+ state: &AppState,
+ request: ServeModelRequest,
+ operation: &ServingLoadOperation,
+) -> pumas_library::Result {
+ let profile = &request.config.profile_id;
+ let refusal = |code, message: String| serving_error(code, message, &request);
+ let Some(manager) = super::get_version_manager(state, "basalt").await else {
+ return non_critical_failure_response(
+ state,
+ refusal(
+ ModelServeErrorCode::MissingRuntime,
+ "Basalt version manager is unavailable".into(),
+ ),
+ )
+ .await;
+ };
+ let lease = manager.lifecycle_lease().await;
+ let (tag, version_dir) =
+ match super::resolve_profile_runtime_version(state, &manager, profile, None).await? {
+ Ok(version) => version,
+ Err(reason) => {
+ let message = match reason {
+ super::ProfileRuntimeVersionRefusal::NoActiveVersion => {
+ "Install and activate a Basalt version first".into()
+ }
+ super::ProfileRuntimeVersionRefusal::NotInstalled(message) => message,
+ };
+ return non_critical_failure_response(
+ state,
+ refusal(ModelServeErrorCode::MissingRuntime, message),
+ )
+ .await;
+ }
+ };
+ let launch = state
+ .api
+ .launch_runtime_profile_for_model_with_receipt(
+ profile.clone(),
+ &tag,
+ &version_dir,
+ Some(&request.model_id),
+ Some(RuntimeProfileLaunchOverrides {
+ device: Some(RuntimeDeviceSettings {
+ mode: request.config.device_mode,
+ device_id: request.config.device_id.clone(),
+ gpu_layers: None,
+ tensor_split: None,
+ }),
+ context_size: request.config.context_size,
+ }),
+ )
+ .await;
+ drop(lease);
+
+ let owned = match launch {
+ Ok(receipt) if receipt.response.success => receipt.observation,
+ Ok(receipt) => {
+ let message = receipt
+ .response
+ .error
+ .unwrap_or_else(|| "Could not start the Basalt profile".into());
+ return non_critical_failure_response(
+ state,
+ refusal(ModelServeErrorCode::ProviderLoadFailed, message),
+ )
+ .await;
+ }
+ Err(pumas_library::PumasError::DeviceNotAvailable { device }) => {
+ return non_critical_failure_response(
+ state,
+ refusal(ModelServeErrorCode::DeviceUnavailable, device),
+ )
+ .await;
+ }
+ Err(pumas_library::PumasError::InvalidParams { message }) => {
+ return non_critical_failure_response(
+ state,
+ refusal(ModelServeErrorCode::ProviderLoadFailed, message),
+ )
+ .await;
+ }
+ Err(error) => return Err(error),
+ };
+ let Some(owned) = owned else {
+ return non_critical_failure_response(
+ state,
+ refusal(
+ ModelServeErrorCode::ProviderLoadFailed,
+ "Basalt launch did not establish process ownership".into(),
+ ),
+ )
+ .await;
+ };
+
+ let ready = tokio::time::timeout(Duration::from_secs(120), async {
+ loop {
+ let current = state.api.observe_owned_runtime_profile(profile)?;
+ if current.as_ref() != Some(&owned) || owned.state != RuntimeLifecycleState::Running {
+ return Ok::<_, pumas_library::PumasError>(None);
+ }
+ if state
+ .api
+ .owned_runtime_profile_has_listener(profile, &owned)?
+ {
+ let health = read_health(state, &owned).await.filter(|health| {
+ health.matches_model(&request.model_id)
+ && health.loaded
+ && health.max_context > 0
+ });
+ if health.is_some()
+ && state
+ .api
+ .owned_runtime_profile_has_listener(profile, &owned)?
+ {
+ return Ok(health);
+ }
+ }
+ tokio::time::sleep(Duration::from_millis(250)).await;
+ }
+ })
+ .await;
+
+ let health = match ready {
+ Ok(Ok(Some(health))) => health,
+ failure => {
+ let stopped = state
+ .api
+ .stop_runtime_profile_if_generation(profile.clone(), owned.generation)
+ .await;
+ if let Err(error) = stopped {
+ tracing::warn!(%error, "Could not finish cleanup after Basalt readiness failure");
+ }
+ if let Ok(Err(error)) = failure {
+ return Err(error);
+ }
+ return non_critical_failure_response(state, refusal(ModelServeErrorCode::ProviderLoadFailed, "The owned Basalt process did not load the selected model. Check its runtime log.".into())).await;
+ }
+ };
+ let status = ServedModelStatus {
+ model_id: request.model_id.clone(),
+ model_alias: Some(effective_gateway_alias_from_config(&request)),
+ provider: RuntimeProviderId::Basalt,
+ profile_id: profile.clone(),
+ load_state: ServedModelLoadState::Loaded,
+ device_mode: request.config.device_mode,
+ device_id: request.config.device_id.clone(),
+ gpu_layers: None,
+ tensor_split: None,
+ context_size: Some(health.max_context),
+ keep_loaded: request.config.keep_loaded,
+ endpoint_url: Some(owned.endpoint_url.clone()),
+ memory_bytes: None,
+ loaded_at: None,
+ last_error: None,
+ };
+ let mut snapshot = match state
+ .api
+ .record_served_model_for_operation_and_owned_profile(operation, status.clone(), &owned)
+ {
+ Ok(snapshot) => snapshot,
+ Err(error) => {
+ state
+ .api
+ .stop_runtime_profile_if_generation(profile.clone(), owned.generation)
+ .await?;
+ return Err(error);
+ }
+ };
+ decorate_serving_snapshot(state, &mut snapshot);
+ Ok(serde_json::to_value(ServeModelResponse {
+ success: true,
+ error: None,
+ loaded: true,
+ loaded_models_unchanged: false,
+ status: Some(status),
+ load_error: None,
+ snapshot: Some(snapshot),
+ })?)
+}
+
+pub(super) async fn model_health(
+ state: &AppState,
+ status: &ServedModelStatus,
+) -> Option {
+ let owned = state
+ .api
+ .observe_owned_runtime_profile(&status.profile_id)
+ .ok()??;
+ if status.endpoint_url.as_ref() != Some(&owned.endpoint_url)
+ || !state
+ .api
+ .owned_runtime_profile_has_listener(&status.profile_id, &owned)
+ .ok()?
+ {
+ return None;
+ }
+ let health = read_health(state, &owned).await?;
+ if !health.matches_model(&status.model_id)
+ || !health.loaded
+ || health.max_context == 0
+ || !state
+ .api
+ .owned_runtime_profile_has_listener(&status.profile_id, &owned)
+ .ok()?
+ {
+ return None;
+ }
+ Some(health)
+}
+
+pub(super) async fn apply_inference_defaults(
+ state: &AppState,
+ status: &ServedModelStatus,
+ body: &mut Value,
+) -> pumas_library::Result<()> {
+ let options = body
+ .as_object_mut()
+ .ok_or_else(|| pumas_library::PumasError::InvalidParams {
+ message: "Basalt chat options must be a JSON object".into(),
+ })?;
+ let settings = state.api.get_inference_settings(&status.model_id).await?;
+ merge_inference_defaults(options, settings);
+ Ok(())
+}
+
+fn merge_inference_defaults(
+ options: &mut serde_json::Map,
+ settings: Vec,
+) {
+ for entry in settings {
+ if !entry.default.is_null() && !has_explicit_option(options, &entry.key) {
+ options.insert(entry.key, entry.default);
+ }
+ }
+}
+
+fn has_explicit_option(options: &serde_json::Map, key: &str) -> bool {
+ let explicit = |key| options.get(key).is_some_and(|value| !value.is_null());
+ let explicit_nested = |parent, key| {
+ options
+ .get(parent)
+ .and_then(|value| value.get(key))
+ .is_some_and(|value| !value.is_null())
+ };
+ explicit(key)
+ || match key {
+ "max_tokens" => explicit("max_completion_tokens"),
+ "reasoning_effort" => {
+ [
+ "reasoning_budget",
+ "reasoning_budget_tokens",
+ "thinking_budget_tokens",
+ ]
+ .into_iter()
+ .any(explicit)
+ || explicit_nested("reasoning", "effort")
+ || explicit_nested("reasoning", "enabled")
+ || explicit_nested("thinking", "budget_tokens")
+ || explicit_nested("chat_template_kwargs", "reasoning_effort")
+ || explicit_nested("chat_template_kwargs", "enable_thinking")
+ }
+ _ => false,
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use serde_json::json;
+
+ #[test]
+ fn defaults_fill_only_omitted_options_and_respect_openai_aliases() {
+ let mut settings = pumas_library::models::basalt_inference_settings();
+ for entry in &mut settings {
+ entry.default = match entry.key.as_str() {
+ "reasoning_effort" => json!("high"),
+ "max_tokens" => json!(4096),
+ "temperature" => json!(0.7),
+ "top_p" => json!(0.8),
+ _ => Value::Null,
+ };
+ }
+ let mut request = json!({
+ "reasoning": {"enabled": false},
+ "max_completion_tokens": 5,
+ "temperature": 0,
+ "top_p": null
+ });
+ let options = request.as_object_mut().unwrap();
+ merge_inference_defaults(options, settings.clone());
+ assert_eq!(options["temperature"], 0);
+ assert_eq!(options["top_p"], 0.8);
+ assert!(!options.contains_key("reasoning_effort"));
+ assert!(!options.contains_key("max_tokens"));
+ assert!(!options.contains_key("seed"));
+
+ let mut omitted = serde_json::Map::new();
+ merge_inference_defaults(&mut omitted, settings);
+ assert_eq!(omitted["reasoning_effort"], "high");
+ assert_eq!(omitted["max_tokens"], 4096);
+ }
+
+ #[test]
+ fn preserves_basalt_chat_parameters_outside_the_saved_settings_schema() {
+ let mut options = json!({"reasoning_effort": 4096, "temperature": 2.5})
+ .as_object()
+ .unwrap()
+ .clone();
+ merge_inference_defaults(
+ &mut options,
+ pumas_library::models::basalt_inference_settings(),
+ );
+ assert_eq!(options["reasoning_effort"], 4096);
+ assert_eq!(options["temperature"], 2.5);
+ }
+}
diff --git a/rust/crates/pumas-rpc/src/main.rs b/rust/crates/pumas-rpc/src/main.rs
index 0c3391b53..34a07444f 100644
--- a/rust/crates/pumas-rpc/src/main.rs
+++ b/rust/crates/pumas-rpc/src/main.rs
@@ -48,6 +48,8 @@ const VERSION_MANAGED_APPS: &[AppId] = &[
AppId::LlamaCpp,
AppId::OnnxRuntime,
AppId::TrellisCpp,
+ #[cfg(all(feature = "basalt", target_os = "linux", target_arch = "x86_64"))]
+ AppId::Basalt,
];
async fn finish_signal_observer(task: &mut tokio::task::JoinHandle>) -> Result<()> {
@@ -558,7 +560,9 @@ mod tests {
AppId::Torch,
AppId::LlamaCpp,
AppId::OnnxRuntime,
- AppId::TrellisCpp
+ AppId::TrellisCpp,
+ #[cfg(all(feature = "basalt", target_os = "linux", target_arch = "x86_64"))]
+ AppId::Basalt,
]
);
assert!(VERSION_MANAGED_APPS.iter().all(AppId::has_version_manager));
diff --git a/scripts/release/check-ci-release-gating.test.mjs b/scripts/release/check-ci-release-gating.test.mjs
index 711993f80..46c3476ae 100644
--- a/scripts/release/check-ci-release-gating.test.mjs
+++ b/scripts/release/check-ci-release-gating.test.mjs
@@ -249,7 +249,7 @@ test('release build commands never enable test-support or all-features', () => {
assert.match(manager, /^default = \[\]$/m);
assert.match(rpc, /^test-support = \["pumas-app-manager\?\/test-support"\]$/m);
// S3 import ships in every release build; fixtures stay out of the defaults.
- assert.match(rpc, /^default = \["inference-plugins", "s3"\]$/m);
+ assert.match(rpc, /^default = \["inference-plugins", "basalt", "s3"\]$/m);
});