diff --git a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-OCR.mdx b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-OCR.mdx index f999fa73be..678bedcfbb 100644 --- a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-OCR.mdx +++ b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-OCR.mdx @@ -26,8 +26,6 @@ For more details, please refer to the [official DeepSeek-OCR repository](https:/ Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions. -For SGLang CPU installation, please refer to the [CPU version installation guide](../../../docs/hardware-platforms/cpu_server#installation). - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. diff --git a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-R1.mdx b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-R1.mdx index 3b6b3583e0..787ec3f552 100644 --- a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-R1.mdx +++ b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-R1.mdx @@ -37,8 +37,6 @@ For more details, please refer to the [official DeepSeek-R1 repository](https:// Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions. -For SGLang CPU installation, please refer to the [CPU version installation guide](../../../docs/hardware-platforms/cpu_server#installation). - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. diff --git a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3.mdx b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3.mdx index b0f22db90b..550d6e4ea3 100644 --- a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3.mdx +++ b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3.mdx @@ -22,8 +22,6 @@ SGLang offers multiple installation methods. You can choose the most suitable in Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions. -For SGLang CPU installation, please refer to the [CPU version installation guide](../../../docs/hardware-platforms/cpu_server#installation). - ## 3. Model Deployment This section provides a progressive guide from quick deployment to performance optimization, suitable for users at different levels. diff --git a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3_1.mdx b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3_1.mdx index 67e4bcdd94..c2a00167c8 100644 --- a/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3_1.mdx +++ b/docs/cookbook/autoregressive/DeepSeek/DeepSeek-V3_1.mdx @@ -18,8 +18,6 @@ SGLang offers multiple installation methods. You can choose the most suitable in Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions. -For SGLang CPU installation, please refer to the [CPU version installation guide](../../../docs/hardware-platforms/cpu_server#installation). - ## 3. Model Deployment This section provides a progressive guide from quick deployment to performance optimization, suitable for users at different levels. diff --git a/docs/cookbook/autoregressive/Ernie/Ernie4.5.mdx b/docs/cookbook/autoregressive/Ernie/Ernie4.5.mdx index 9f4d35afbf..88cb930b5f 100644 --- a/docs/cookbook/autoregressive/Ernie/Ernie4.5.mdx +++ b/docs/cookbook/autoregressive/Ernie/Ernie4.5.mdx @@ -15,7 +15,7 @@ ERNIE-4.5 delivers advanced features as below: - **Vision Encoder**: Dedicated adaptive-resolution ViT with 2D RoPE and image packing; for video, adaptive frame sampling and timestamp rendering, supporting both shared and modality-specific visual processing. - **Adapter**: Shared modality-bridging module with spatial and temporal compression to align vision to text embedding space, enabling cross-modal understanding without compromising text representations. - **Multimodal Position Embedding**: Unified 3D RoPE (temporal, height, width) for vision and 1D RoPE for text in a single embedding space, supporting parameter sharing while encoding modality-specific positions. -- **Hardware Optimization**: Specifically tuned for AMD MI300X, MI325X, and MI355X GPUs. +- **Hardware Optimization**: Specifically tuned for AMD MI300X, MI325X, MI355X GPUs and Intel Xeon CPUs. ## 2. SGLang Installation diff --git a/docs/cookbook/autoregressive/Google/Gemma4.mdx b/docs/cookbook/autoregressive/Google/Gemma4.mdx index b87670a56e..245e510b90 100644 --- a/docs/cookbook/autoregressive/Google/Gemma4.mdx +++ b/docs/cookbook/autoregressive/Google/Gemma4.mdx @@ -97,7 +97,7 @@ For other installation methods, please refer to the [official SGLang installatio ### 3.1 Basic Configuration -The Gemma 4 series offers models in various sizes and architectures, optimized for different hardware platforms including NVIDIA GPUs, AMD GPUs, and Intel Arc Pro B-Series GPUs(codename: BMG (Battlemage)). The recommended launch configurations vary by hardware and model size. +The Gemma 4 series offers models in various sizes and architectures, optimized for different hardware platforms including NVIDIA GPUs, AMD GPUs, and Intel Arc Pro B-Series GPUs(codename: BMG (Battlemage)), Xeon CPUs. The recommended launch configurations vary by hardware and model size. **Interactive Command Generator**: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform and model variant. diff --git a/docs/cookbook/autoregressive/OpenAI/GPT-OSS.mdx b/docs/cookbook/autoregressive/OpenAI/GPT-OSS.mdx index 6e94653d66..b077f983b3 100644 --- a/docs/cookbook/autoregressive/OpenAI/GPT-OSS.mdx +++ b/docs/cookbook/autoregressive/OpenAI/GPT-OSS.mdx @@ -25,8 +25,6 @@ SGLang offers multiple installation methods. You can choose the most suitable in Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions. -For SGLang CPU installation, please refer to the [CPU version installation guide](../../../docs/hardware-platforms/cpu_server#installation). - ## 3.Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. diff --git a/docs/cookbook/autoregressive/Qwen/Qwen3-Next.mdx b/docs/cookbook/autoregressive/Qwen/Qwen3-Next.mdx index 2dde9f8b8b..f9733a3dd0 100644 --- a/docs/cookbook/autoregressive/Qwen/Qwen3-Next.mdx +++ b/docs/cookbook/autoregressive/Qwen/Qwen3-Next.mdx @@ -32,8 +32,6 @@ SGLang offers multiple installation methods. You can choose the most suitable in Please refer to the [official SGLang installation guide](../../../docs/get-started/install) for installation instructions. -For SGLang CPU installation, please refer to the [CPU version installation guide](../../../docs/hardware-platforms/cpu_server#installation). - ## 3. Model Deployment This section provides deployment configurations optimized for different hardware platforms and use cases. diff --git a/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx b/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx index 2dd4a67b40..a6313d33c5 100644 --- a/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx +++ b/docs/cookbook/diffusion/Cosmos/Cosmos3.mdx @@ -69,6 +69,12 @@ The default `flow_shift` is `3.0` for T2I, `10.0` for non-Edge video and all act ## 3. Serve Cosmos3 +For Intel Xeon CPU deployment, use `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu` with the selected Cosmos3 checkpoint. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path nvidia/Cosmos3-Nano --port 30010 +``` + Serve `Cosmos3-Nano` directly from the Hugging Face model ID: ```bash Command diff --git a/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx b/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx index d5f1785a46..a9c987b798 100644 --- a/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx +++ b/docs/cookbook/diffusion/Ernie-Image/Ernie-Image.mdx @@ -57,6 +57,20 @@ sglang serve \ --port 30010 ``` +Intel Xeon CPU deployment is supported by prefixing the server command with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu` and omitting GPU-only flags. + +Serve ERNIE-Image: + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path baidu/ERNIE-Image --port 30010 +``` + +Serve ERNIE-Image-Turbo: + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path baidu/ERNIE-Image-Turbo --port 30010 +``` + ## 4. Generate an image Use the OpenAI-compatible image generation API after the server starts: diff --git a/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx b/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx index 32294dbf5e..13a393de23 100644 --- a/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx +++ b/docs/cookbook/diffusion/Ideogram/Ideogram4.mdx @@ -61,6 +61,12 @@ HF_TOKEN=$HF_TOKEN sglang serve \ --port 30010 ``` +Intel Xeon CPU deployment is supported for the fal checkpoints with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu`; omit GPU-only flags. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu HF_TOKEN=$HF_TOKEN sglang serve --model-path ideogram-ai/ideogram-4-nf4 --port 30010 +``` + FP8: ```bash Command @@ -71,6 +77,12 @@ HF_TOKEN=$HF_TOKEN sglang serve \ --port 30010 ``` +Intel Xeon CPU deployment is supported for the fal checkpoints with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu`; omit GPU-only flags. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu HF_TOKEN=$HF_TOKEN sglang serve --model-path ideogram-ai/ideogram-4-fp8 --port 30010 +``` + Comfy-Org NVFP4: ```bash Command @@ -93,6 +105,12 @@ HF_TOKEN=$HF_TOKEN sglang serve \ --port 30010 ``` +IntelXeon CPU deployment is supported for the fal checkpoints with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu`; omit GPU-only flags. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu HF_TOKEN=$HF_TOKEN sglang serve --model-path fal/ideogram-v4-fast --port 30010 +``` + fal Instant: ```bash Command @@ -103,6 +121,12 @@ HF_TOKEN=$HF_TOKEN sglang serve \ --port 30010 ``` +Intel Xeon CPU deployment is supported for the fal checkpoints with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu`; omit GPU-only flags. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu HF_TOKEN=$HF_TOKEN sglang serve --model-path fal/ideogram-v4-instant --port 30010 +``` + ### Tensor and sequence parallelism Both fal variants support native DiT tensor parallelism and Ulysses sequence parallelism. The following two-GPU layouts were validated at 1024×1024 on B200 GPUs for both `fal/ideogram-v4-fast` and `fal/ideogram-v4-instant`. diff --git a/docs/cookbook/diffusion/Krea/Krea-2.mdx b/docs/cookbook/diffusion/Krea/Krea-2.mdx index 3ef02f15e3..52d146b005 100644 --- a/docs/cookbook/diffusion/Krea/Krea-2.mdx +++ b/docs/cookbook/diffusion/Krea/Krea-2.mdx @@ -39,6 +39,12 @@ This section covers deploying Krea-2-Turbo for fast, high-quality image generati ### 3.1 Basic Configuration +Intel Xeon CPU deployment is supported with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu` and the selected Krea-2 checkpoint. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path krea/Krea-2-Turbo +``` + Krea-2-Turbo generates high-quality images in only 8 inference steps. Launch the server with: ```bash Command diff --git a/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx b/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx index 2796d7ca1d..41b1254acd 100644 --- a/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx +++ b/docs/cookbook/diffusion/LingBot-World/LingBot-World-2.0.mdx @@ -48,6 +48,12 @@ sglang serve \ --enable-torch-compile false ``` +Intel Xeon CPU deployment is supported with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu`; omit GPU-only parallel and offload flags. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path robbyant/lingbot-world-v2-14b-causal-fast-diffusers --pipeline-class-name LingBotWorldCausalDMDPipeline +``` + ### Optional KV-Cache Compression Long-running sessions can enable lossy int4 PRQ compression for completed diff --git a/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx b/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx index e4670ff571..a69bc2b00d 100644 --- a/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx +++ b/docs/cookbook/diffusion/LingBot-World/LingBot-World.mdx @@ -43,6 +43,14 @@ sglang serve \ --text-encoder-cpu-offload false ``` + +Intel Xeon CPU deployment is supported with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu`; omit GPU-only parallel and offload flags. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path robbyant/lingbot-world-fast-diffusers --pipeline-class-name LingBotWorldCausalDMDPipeline +``` + + ### Optional KV-Cache Compression Long-running sessions can enable lossy int4 PRQ compression for completed diff --git a/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx b/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx index 0d487172e7..a110cf9ab8 100644 --- a/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx +++ b/docs/cookbook/diffusion/LongLive/LongLive-2.0.mdx @@ -51,6 +51,12 @@ sglang serve \ `Rabinovich/LongLive-2.0-5B-Diffusers` is the Diffusers-format conversion of the official `Efficient-Large-Model/LongLive-2.0-5B` weights. +Intel Xeon CPU deployment is supported with `SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu` and the selected LongLive checkpoint. + +```bash Command +SGLANG_DIFFUSION_PLATFORM_OVERRIDE=cpu sglang serve --model-path Rabinovich/LongLive-2.0-5B-Diffusers +``` + ## 4. Generation ### 4.1 Single prompt diff --git a/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx b/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx index c26e8ca036..1f7fb31dae 100644 --- a/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx +++ b/docs/cookbook/diffusion/Qwen-Image/Qwen-Image.mdx @@ -34,7 +34,7 @@ This section provides deployment configurations optimized for different hardware ### 3.1 Basic Configuration -Qwen-Image is a text-to-image model. The recommended launch configurations vary by hardware. SGLang supports serving Qwen-Image on NVIDIA B200, B300, H200, H100, AMD MI300X, MI325X, MI355X GPUs and Ascend A2/A3 Series NPUs. +Qwen-Image is a text-to-image model. The recommended launch configurations vary by hardware. SGLang supports serving Qwen-Image on NVIDIA B200, B300, H200, H100, AMD MI300X, MI325X, MI355X GPUs, Intel Xeon CPUs, and Ascend A2/A3 Series NPUs. Use the [command builder](#1-quick-start) above. diff --git a/docs/cookbook/diffusion/Wan/Wan2.1.mdx b/docs/cookbook/diffusion/Wan/Wan2.1.mdx index 95fab54f8b..cbb983ecfa 100644 --- a/docs/cookbook/diffusion/Wan/Wan2.1.mdx +++ b/docs/cookbook/diffusion/Wan/Wan2.1.mdx @@ -34,7 +34,7 @@ This section provides deployment configurations optimized for different hardware ### 3.1 Basic Configuration -The Wan2.1 series offers models in multiple sizes and resolutions. SGLang supports Wan2.1 deployment on NVIDIA B200, B300, H200, H100, and AMD MI300X, MI325X, MI355X GPUs and Ascend A2/A3 Series NPUs. The recommended launch configurations vary by hardware, model size, and memory headroom. +The Wan2.1 series offers models in multiple sizes and resolutions. SGLang supports Wan2.1 deployment on NVIDIA B200, B300, H200, H100, AMD MI300X, MI325X, MI355X GPUs, Intel Xeon CPUs, and Ascend A2/A3 Series NPUs. The recommended launch configurations vary by hardware, model size, and memory headroom. Use the [command builder](#1-quick-start) above. diff --git a/docs/docs/hardware-platforms/cpu_server.mdx b/docs/docs/hardware-platforms/cpu_server.mdx index 6ac568698b..b8be8a69a3 100644 --- a/docs/docs/hardware-platforms/cpu_server.mdx +++ b/docs/docs/hardware-platforms/cpu_server.mdx @@ -123,7 +123,7 @@ cd python cp pyproject_cpu.toml pyproject.toml # Install SGLang dependent libs, and build SGLang main package uv pip install --upgrade pip setuptools -uv pip install . +uv pip install . # If installing sgl-diffusion, please use: uv pip install ".[diffusion]" # Build the CPU backend kernels cd sglang/kernels/aot @@ -148,7 +148,7 @@ Notes: - If you encounter code compilation issues during the `sgl-kernel` building process, please check your `gcc` and `g++` versions and upgrade them if they are outdated. - It is recommended to use `gcc-13` and `g++-13` as they have been verified + It is recommended to use `gcc-15` and `g++-15` as they have been verified in the official Docker container. - The system library path is typically located in one of the following directories: diff --git a/docs/scripts/tests/diffusion-builders.test.mjs b/docs/scripts/tests/diffusion-builders.test.mjs index 4c4967c53e..255fa284bd 100644 --- a/docs/scripts/tests/diffusion-builders.test.mjs +++ b/docs/scripts/tests/diffusion-builders.test.mjs @@ -130,10 +130,10 @@ test("legacy image hardware, precision and checkpoint choices remain available", const qwen = get("/Qwen-Image/Qwen-Image.mdx"); const edit = get("/Qwen-Image/Qwen-Image-Edit.mdx"); const zimage = get("/Z-Image/Z-Image-Turbo.mdx"); - assert.equal(flux.supportedHardware.length, 10); - assert.equal(qwen.supportedHardware.length, 9); - assert.equal(edit.supportedHardware.length, 7); - assert.equal(zimage.supportedHardware.length, 9); + assert.equal(flux.supportedHardware.length, 11); + assert.equal(qwen.supportedHardware.length, 10); + assert.equal(edit.supportedHardware.length, 8); + assert.equal(zimage.supportedHardware.length, 10); assert.ok(resolve(flux, { hw: "arc_b", version: "flux2-dev", gpus_per_node: 4 }).flags.includes("--tp-size 4")); assert.ok(resolve(flux, { hw: "a2", version: "flux2-dev", gpus_per_node: 2 }).flags.includes("--tp-size 2")); assert.ok( @@ -151,7 +151,7 @@ test("Wan preserves standard, multi-GPU, Ascend and LoRA recipes", () => { for (const version of ["1", "2"]) { const config = get(`/Wan/Wan2.${version}.mdx`); assert.equal(config.overlayDims.find((dim) => dim.id === "variant").options.length, 3); - for (const hw of config.supportedHardware.filter((id) => !["a2", "a3"].includes(id))) { + for (const hw of config.supportedHardware.filter((id) => !["a2", "a3", "xeon"].includes(id))) { const gpus = version === "2" && hw === "b300" ? 8 : 4; const result = resolve(config, { hw, gpus_per_node: gpus }); assert.deepEqual(result.builder.errors, []); diff --git a/docs/src/snippets/_deployment.jsx b/docs/src/snippets/_deployment.jsx index 77eea6061d..6c92d5479b 100644 --- a/docs/src/snippets/_deployment.jsx +++ b/docs/src/snippets/_deployment.jsx @@ -820,7 +820,8 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { const modelName = resolveModelName(sel); if (cell.pd && cell.commands) return interpolate(cell.commands[mode] || cell.commands.python, envValues, modelName); const nnodes = cellNnodes(cell, sel); - const multinode = nnodes > 1; + // Xeon's "nodes" selector sizes --tp-size, not a real multi-machine launch. + const multinode = nnodes > 1 && sel.hw !== "xeon"; const cellEnv = [...(cell.env || []), ...overlayEnv(sel)]; const flags = overlayCompose(cell.flags, sel); if (multinode) { @@ -1330,9 +1331,21 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { } } for (const [key, bounds] of Object.entries(commandBuilder.resource?.limits || {})) { + if (typeof bounds.disabledWhen === "function" && bounds.disabledWhen(out)) { + out[key] = bounds.disabledValue ?? 0; + continue; + } const fallback = Number(commandBuilder.defaultSelection?.[key] ?? bounds.min ?? 1); const value = Number.parseInt(out[key], 10); - out[key] = Math.min(bounds.max, Math.max(bounds.min, Number.isFinite(value) ? value : fallback)); + const values = typeof bounds.allowedValues === "function" + ? bounds.allowedValues(out) + : (bounds.allowedValues || []); + const bounded = Math.min(bounds.max, Math.max(bounds.min, Number.isFinite(value) ? value : fallback)); + out[key] = values.length + ? values.reduce((closest, candidate) => + Math.abs(candidate - bounded) < Math.abs(closest - bounded) ? candidate : closest, + values[0]) + : bounded; } for (const key of ["tp_size", "ulysses_degree", "ring_degree"]) { const value = Number.parseInt(out[key], 10); @@ -1662,9 +1675,15 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { nodes: resourcesFollowPlatformDefault ? (nextRecipe?.nodes ?? next.nodes) : next.nodes, - gpus_per_node: resourcesFollowPlatformDefault - ? (nextRecipe?.gpus_per_node ?? next.gpus_per_node) - : next.gpus_per_node, + gpus_per_node: (() => { + const bounds = commandBuilder.resource?.limits?.gpus_per_node; + if (typeof bounds?.disabledWhen === "function" && bounds.disabledWhen(next)) { + return bounds.disabledValue ?? 0; + } + return resourcesFollowPlatformDefault + ? (nextRecipe?.gpus_per_node ?? next.gpus_per_node) + : next.gpus_per_node; + })(), topology_mode: "auto", tp_size: resourcesFollowPlatformDefault ? (nextRecipe?.tp_size ?? 1) @@ -1711,11 +1730,12 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { commit(value); }; - const renderBuilderNumberInput = ({ identity, value, min, max, label, onCommit }) => ( + const renderBuilderNumberInput = ({ identity, value, min, max, label, disabled, onCommit }) => ( { if (!commandBuilder) return; const bounds = commandBuilder.resource?.limits?.[key] || { min: 1, max: 8 }; setSel((prev) => { - const value = Math.min(bounds.max, Math.max(bounds.min, Number(prev[key]) + delta)); + if (typeof bounds.disabledWhen === "function" && bounds.disabledWhen(prev)) return prev; + const values = typeof bounds.allowedValues === "function" + ? bounds.allowedValues(prev) + : (bounds.allowedValues || []); + const current = Number(prev[key]); + const value = values.length + ? values[Math.max(0, Math.min(values.length - 1, + values.findIndex((candidate) => candidate === current) + delta))] + : Math.min(bounds.max, Math.max(bounds.min, current + delta)); return normalizeBuilderSelection({ ...prev, [key]: value, topology_mode: "auto" }); }); }; @@ -1748,11 +1776,22 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { const value = Number.parseInt(rawValue, 10); if (!Number.isFinite(value)) return; const bounds = commandBuilder.resource?.limits?.[key] || { min: 1, max: 8 }; - setSel((prev) => normalizeBuilderSelection({ + setSel((prev) => { + if (typeof bounds.disabledWhen === "function" && bounds.disabledWhen(prev)) return prev; + const values = typeof bounds.allowedValues === "function" + ? bounds.allowedValues(prev) + : (bounds.allowedValues || []); + const bounded = Math.min(bounds.max, Math.max(bounds.min, value)); + return normalizeBuilderSelection({ ...prev, - [key]: Math.min(bounds.max, Math.max(bounds.min, value)), + [key]: values.length + ? values.reduce((closest, candidate) => + Math.abs(candidate - bounded) < Math.abs(closest - bounded) ? candidate : closest, + values[0]) + : bounded, topology_mode: "auto", - })); + }); + }); }; const editBuilderTopology = (key, value) => { @@ -1977,6 +2016,7 @@ export const Deployment = ({ config, benchmarks, agenticLink }) => { const renderStepper = (key, label, detail) => { const bounds = commandBuilder.resource?.limits?.[key] || { min: 1, max: 8 }; + const disabled = typeof bounds.disabledWhen === "function" && bounds.disabledWhen(sel); return (