pi-llama-switch 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <div align="center">
4
4
 
5
5
  <!-- Add a cover image: docs/cover.png -->
6
- Restart local LLM servers with different model configurations. For single-model setups where each model needs different flags -- context size, vision projector, sampling params, GPU offload. Works with [llama.cpp](https://github.com/ggml-org/llama.cpp) and [vLLM](https://github.com/vllm-project/vllm) (experimental).
6
+ Restart local LLM servers with different model configurations. For single-model setups where each model needs different flags: context size, vision projector, sampling params, GPU offload. Works with [llama.cpp](https://github.com/ggml-org/llama.cpp) and [vLLM](https://github.com/vllm-project/vllm) (experimental).
7
7
 
8
8
  [![npm version](https://img.shields.io/npm/v/pi-llama-switch.svg)](https://www.npmjs.com/package/pi-llama-switch)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -27,9 +27,9 @@ You have a single GPU and multiple local models, but each model needs different
27
27
 
28
28
  **Common setups:**
29
29
 
30
- - **Coding vs general-purpose:** Qwen3.6 for code (small context, fast) and Gemma 4 for general tasks (vision, larger context) -- each needs different `--ctx-size` and `--mmproj` flags.
31
- - **Fast vs powerful:** A small E4B model for quick tasks and a 35B model for complex reasoning -- the small model loads in seconds, the large one needs 60+ seconds and more VRAM.
32
- - **Text vs multimodal:** A text-only model for coding and a vision model for image analysis -- the vision model needs `--mmproj` which adds VRAM overhead.
30
+ - **Coding vs general-purpose:** Qwen3.6 for code (small context, fast) and Gemma 4 for general tasks (vision, larger context) -- each with different `--ctx-size` and `--mmproj` flags.
31
+ - **Fast vs powerful:** A smaller model for quick tasks and a large one for complex reasoning -- small model loads in seconds, large one needs more time and VRAM.
32
+ - **Text vs multimodal:** A text-only model for coding and a vision model for image analysis -- vision model needs `--mmproj`, which adds VRAM overhead.
33
33
 
34
34
  If you only run one model at a time and don't change server flags between models, you don't need this extension.
35
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-llama-switch",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Restart llama-server with different model configurations. For single-model setups where models need different flags (context size, vision projector, sampling params).",
5
5
  "keywords": [
6
6
  "pi",
package/src/health.ts CHANGED
@@ -16,9 +16,9 @@ async function fetchHealth(
16
16
  headers: { Accept: "application/json" },
17
17
  });
18
18
 
19
- // 503 means server is alive but unhealthy (vLLM engine dead)
19
+ // 503 means server is alive but still loading (llama-server) or unhealthy (vLLM)
20
20
  if (res.status === 503) {
21
- return { status: "error", error: "server returned 503" };
21
+ return { status: "loading", error: "server returned 503" };
22
22
  }
23
23
 
24
24
  if (!res.ok) {
package/src/switcher.ts CHANGED
@@ -207,6 +207,10 @@ export async function switchModel(
207
207
  progress?.onStatusUpdate?.(`Starting ${model.name}...`);
208
208
  const logPath = getLogPath();
209
209
  const logStream = createWriteStream(logPath, { flags: "w" });
210
+ await new Promise<void>((resolve, reject) => {
211
+ logStream.on("open", () => resolve());
212
+ logStream.on("error", reject);
213
+ });
210
214
  child = spawn(model.command[0], model.command.slice(1), {
211
215
  detached: true,
212
216
  stdio: ["ignore", "ignore", logStream],