athanor 1.6.0 → 1.8.0
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/AGENTS.md +8 -7
- package/README.md +49 -21
- package/dist/adapters/health.d.ts.map +1 -1
- package/dist/adapters/health.js +2 -7
- package/dist/adapters/health.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +2 -15
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/llama.d.ts.map +1 -1
- package/dist/adapters/llama.js +2 -2
- package/dist/adapters/llama.js.map +1 -1
- package/dist/adapters/mlx.d.ts.map +1 -1
- package/dist/adapters/mlx.js +22 -5
- package/dist/adapters/mlx.js.map +1 -1
- package/dist/adapters/model-id.d.ts +3 -0
- package/dist/adapters/model-id.d.ts.map +1 -0
- package/dist/adapters/model-id.js +15 -0
- package/dist/adapters/model-id.js.map +1 -0
- package/dist/app/models.d.ts +2 -1
- package/dist/app/models.d.ts.map +1 -1
- package/dist/app/models.js +11 -11
- package/dist/app/models.js.map +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/model-commands.d.ts +1 -1
- package/dist/cli/model-commands.d.ts.map +1 -1
- package/dist/cli/model-commands.js +11 -2
- package/dist/cli/model-commands.js.map +1 -1
- package/dist/cli/system-commands.d.ts +1 -0
- package/dist/cli/system-commands.d.ts.map +1 -1
- package/dist/cli/system-commands.js +1 -1
- package/dist/cli/system-commands.js.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +90 -34
- package/dist/config/index.js.map +1 -1
- package/dist/discovery/scanner.d.ts +6 -0
- package/dist/discovery/scanner.d.ts.map +1 -1
- package/dist/discovery/scanner.js +32 -10
- package/dist/discovery/scanner.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/presets/edit.d.ts.map +1 -1
- package/dist/presets/edit.js +25 -4
- package/dist/presets/edit.js.map +1 -1
- package/dist/presets/recipes.js +10 -10
- package/dist/presets/recipes.js.map +1 -1
- package/dist/pull/api.d.ts.map +1 -1
- package/dist/pull/api.js +3 -2
- package/dist/pull/api.js.map +1 -1
- package/dist/pull/download.d.ts +2 -2
- package/dist/pull/download.d.ts.map +1 -1
- package/dist/pull/download.js +17 -8
- package/dist/pull/download.js.map +1 -1
- package/dist/pull/hf-token.d.ts +4 -0
- package/dist/pull/hf-token.d.ts.map +1 -0
- package/dist/pull/hf-token.js +48 -0
- package/dist/pull/hf-token.js.map +1 -0
- package/dist/pull/hf.d.ts.map +1 -1
- package/dist/pull/hf.js +8 -4
- package/dist/pull/hf.js.map +1 -1
- package/dist/registry/display.d.ts +11 -0
- package/dist/registry/display.d.ts.map +1 -0
- package/dist/registry/display.js +24 -0
- package/dist/registry/display.js.map +1 -0
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +153 -11
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/materialize.d.ts.map +1 -1
- package/dist/registry/materialize.js +22 -3
- package/dist/registry/materialize.js.map +1 -1
- package/dist/router/lifecycle.d.ts +2 -2
- package/dist/router/lifecycle.d.ts.map +1 -1
- package/dist/router/lifecycle.js +41 -11
- package/dist/router/lifecycle.js.map +1 -1
- package/dist/router/server.d.ts +1 -0
- package/dist/router/server.d.ts.map +1 -1
- package/dist/router/server.js +90 -8
- package/dist/router/server.js.map +1 -1
- package/dist/search/hf.d.ts.map +1 -1
- package/dist/search/hf.js +11 -10
- package/dist/search/hf.js.map +1 -1
- package/dist/supervisor/index.d.ts +11 -2
- package/dist/supervisor/index.d.ts.map +1 -1
- package/dist/supervisor/index.js +85 -17
- package/dist/supervisor/index.js.map +1 -1
- package/dist/supervisor/metrics.d.ts.map +1 -1
- package/dist/supervisor/metrics.js +3 -2
- package/dist/supervisor/metrics.js.map +1 -1
- package/dist/supervisor/state.d.ts.map +1 -1
- package/dist/supervisor/state.js +2 -0
- package/dist/supervisor/state.js.map +1 -1
- package/dist/sync/pi.d.ts.map +1 -1
- package/dist/sync/pi.js +107 -80
- package/dist/sync/pi.js.map +1 -1
- package/dist/types/index.d.ts +6 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +29 -16
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/ModelList.d.ts.map +1 -1
- package/dist/ui/ModelList.js +12 -7
- package/dist/ui/ModelList.js.map +1 -1
- package/dist/ui/SearchBrowser.d.ts +2 -0
- package/dist/ui/SearchBrowser.d.ts.map +1 -1
- package/dist/ui/SearchBrowser.js +15 -2
- package/dist/ui/SearchBrowser.js.map +1 -1
- package/package.json +6 -2
package/AGENTS.md
CHANGED
|
@@ -4,7 +4,7 @@ Orientation for contributors and AI agents working on athanor. Read this before
|
|
|
4
4
|
|
|
5
5
|
## What athanor is
|
|
6
6
|
|
|
7
|
-
Athanor — personal LLM alchemy on Apple Silicon. It scans the Hugging Face cache, registers MLX and `llama.cpp` (GGUF) models in `~/.athanor/models.json`, assigns each one a **stable port**, supervises detached child processes, and exposes models to [pi-agent](https://github.com/badlogic/pi-mono)
|
|
7
|
+
Athanor — personal LLM alchemy on Apple Silicon. It scans the Hugging Face cache, registers MLX and `llama.cpp` (GGUF) models in `~/.athanor/models.json`, assigns each one a **stable port**, supervises detached child processes, and exposes models to [pi-agent](https://github.com/badlogic/pi-mono). By default pi sees ingress-backed `athanor-mlx` / `athanor-llama` aggregators; direct per-model providers are available when `router.enabled` is false. Surfaces are an Ink TUI (`athanor`) and a hand-rolled CLI (`athanor <cmd>`).
|
|
8
8
|
|
|
9
9
|
Not a library. Not a daemon. No network listeners except the runtime children themselves (and an optional local control API, off by default).
|
|
10
10
|
|
|
@@ -15,8 +15,8 @@ These are load-bearing. If a change seems to need to break one, stop and ask.
|
|
|
15
15
|
1. **Stable port per model.** Ports are allocated on first discovery from `config.portRange` and persisted on the registry entry forever. A model's port never changes behind the user's back; pi-agent provider URLs must be stable across restarts.
|
|
16
16
|
2. **Atomic registry writes.** `~/.athanor/models.json` is always written via temp-file + rename in `src/registry/index.ts`. Never partial-write it, never keep it open across awaits.
|
|
17
17
|
3. **Preserve non-athanor pi entries.** `src/sync/pi.ts` rewrites only providers whose name starts with `athanor-`. Everything else in `~/.pi/agent/models.json` (OpenAI, Anthropic, Ollama, OpenRouter, user customs) must round-trip untouched. Same for `~/.pi/agent/settings.json` — only `defaultProvider` / `defaultModel` are touched, and only when a model is started as the active default.
|
|
18
|
-
4. **Pi sync shape follows `config.router.enabled`.** Default (router
|
|
19
|
-
5. **Runtime model id matches launch argument literally.** `mlx_lm.server` compares the request's `model` field to whatever was passed as `--model` and falls back to a HuggingFace network lookup on mismatch. The pi model `id` we emit must equal the adapter's `--model` (or `--alias`
|
|
18
|
+
4. **Pi sync shape follows `config.router.enabled`.** Default (`router.enabled: true`): up to two aggregator providers — `athanor-mlx` and `athanor-llama` — both pointing at the ingress `baseUrl`, each listing only models of its runtime and carrying runtime-specific compat flags (MLX sets `supportsDeveloperRole: false`; llama-server doesn't). Providers with zero exposed members are suppressed. When `router.enabled` is false: each exposed model becomes its own pi provider `athanor-<runtime>-<slug>` with one `baseUrl` per model. Never emit both shapes. The CLI verbs are `expose` / `hide`; the underlying registry field is `publish: boolean` (storage name, kept stable for backward-compat of on-disk `models.json`).
|
|
19
|
+
5. **Runtime model id matches launch argument literally.** `mlx_lm.server` compares the request's `model` field to whatever was passed as `--model` and falls back to a HuggingFace network lookup on mismatch. The pi model `id` we emit must equal the adapter's `--model` (MLX) or `--alias` (llama-server). Hub GGUF defaults to registry `id` (`author/repo:file.gguf`) unless the user set a custom `piAlias` different from `slug`. See `src/adapters/model-id.ts`, `src/sync/pi.ts`, and `src/adapters/*.ts`. pi's `/model` picker lists by `id`, not `name`.
|
|
20
20
|
6. **Pi context metadata reflects effective served context.** `src/sync/pi.ts` must advertise the model's effective runtime context window from merged runtime config (`mergedConfigFor(entry)`), not only explicit per-model preset fields and not the model's theoretical maximum. pi should see what athanor will actually serve.
|
|
21
21
|
7. **MLX capability detection and flavor routing are separate axes.** Two fields live on an MLX entry:
|
|
22
22
|
- `mlxCapabilities: ("vlm")[]` — a detected *fact* about the model (does config.json advertise a vision tower?). Refreshed by `ingestDiscovered` and `pull` via `detectMlxCapabilities()` in `src/discovery/scanner.ts`. Safe to overwrite on re-scan.
|
|
@@ -31,14 +31,14 @@ These are load-bearing. If a change seems to need to break one, stop and ask.
|
|
|
31
31
|
|
|
32
32
|
```
|
|
33
33
|
src/
|
|
34
|
-
adapters/ # mlx_lm + mlx_vlm + llama-server command builders, health probes
|
|
34
|
+
adapters/ # mlx_lm + mlx_vlm + llama-server command builders, health probes, runtime model ids (model-id.ts)
|
|
35
35
|
cli/ # dispatcher (index.ts), commands.ts, doctor, formatting
|
|
36
36
|
config/ # config load + defaults
|
|
37
37
|
control/ # optional HTTP control API (opt-in)
|
|
38
38
|
discovery/ # HF cache scanner + ingest + fs.watch watcher; detectMlxCapabilities lives here
|
|
39
39
|
presets/ # preset merge, tunable-key metadata, recipes
|
|
40
40
|
pull/ # HF repo inspection + `hf` download wrapper
|
|
41
|
-
registry/ # atomic models.json CRUD, slug + port allocation
|
|
41
|
+
registry/ # atomic models.json CRUD, slug + port allocation, dedup on load, display labels
|
|
42
42
|
router/ # optional OpenAI-compatible proxy (opt-in, single port)
|
|
43
43
|
search/ # HF Hub search + trending
|
|
44
44
|
supervisor/ # detached process lifecycle, policy, reattach, logs
|
|
@@ -52,10 +52,11 @@ Entry points: `bin/athanor` → `dist/index.js` (built) or `npm start` (tsx) →
|
|
|
52
52
|
|
|
53
53
|
## Context files
|
|
54
54
|
|
|
55
|
-
Keep reusable architecture context under `context/`.
|
|
55
|
+
Keep reusable architecture context under `context/`. See `context/README.md` for the index.
|
|
56
56
|
|
|
57
57
|
- `context/ARCH_MAP.md` — compressed architecture map for routine work
|
|
58
|
-
- `context/ARCH_REVIEW.md` —
|
|
58
|
+
- `context/ARCH_REVIEW.md` — completed refactor summary and remaining backlog
|
|
59
|
+
- `context/plans/` — active task plans (completed plans in `context/plans/done/`)
|
|
59
60
|
|
|
60
61
|
Context discipline:
|
|
61
62
|
- consult `context/ARCH_MAP.md` first for normal coding tasks
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- **Downloads** new models from HuggingFace via the `hf` CLI.
|
|
9
9
|
- **Runs** them via `mlx_lm.server` or `llama-server`, one or more at a time, each on a stable port.
|
|
10
10
|
- **Supervises** the processes as detached children with per-process log files and automatic reattach.
|
|
11
|
-
- **Publishes**
|
|
11
|
+
- **Publishes** exposed models to pi-agent (`~/.pi/agent/models.json`) — by default via ingress-backed `athanor-mlx` / `athanor-llama` aggregators — leaving your other (cloud, Ollama, etc.) providers alone.
|
|
12
12
|
- **Exposes** an optional local control API so other tools can ask athanor to activate a model on demand.
|
|
13
13
|
|
|
14
14
|
## Prerequisites
|
|
@@ -243,7 +243,7 @@ athanor ls # now usable directly
|
|
|
243
243
|
| `preset` | per-model overrides that merge on top of global runtime config |
|
|
244
244
|
| `mlxFlavor` | `"lm"` or `"vlm"` — picks which MLX binary to use (MLX only) |
|
|
245
245
|
| `publish` | whether pi-agent sees this model |
|
|
246
|
-
| `piAlias` |
|
|
246
|
+
| `piAlias` | optional llama launch alias; when set to something other than `slug`, overrides the default runtime model id |
|
|
247
247
|
| `tags` | free-form labels (`chat`, `coder`, …) |
|
|
248
248
|
|
|
249
249
|
### Stable per-model ports
|
|
@@ -252,6 +252,8 @@ Each model is bound to a port at first ingest and keeps it forever. This means p
|
|
|
252
252
|
|
|
253
253
|
Port range is configurable (`portRange` in `~/.athanor/config.json`, default 8081–8099).
|
|
254
254
|
|
|
255
|
+
On load, athanor collapses duplicate registry rows that share the same normalized on-disk path (keeping the HF-sourced entry when present) and upgrades local GGUF paths under `org--repo/` directories to HF source metadata when possible.
|
|
256
|
+
|
|
255
257
|
### MLX capabilities and flavor routing
|
|
256
258
|
|
|
257
259
|
MLX entries track two independent axes:
|
|
@@ -261,7 +263,7 @@ MLX entries track two independent axes:
|
|
|
261
263
|
|
|
262
264
|
The split is deliberate: many VLM-tagged repos (e.g. Qwen2.5-VL, Qwen3-VL-MLX) run fine as text-only under `mlx_lm.server`, which is lighter, faster to load, and doesn't need a PyTorch install. Auto-routing every VLM-capable repo to `mlx_vlm.server` would silently break text-only workflows whenever torch isn't available. So athanor defaults everything to `lm` and leaves the upgrade to you.
|
|
263
265
|
|
|
264
|
-
In `athanor ls` and `athanor show`, entries with `mlxFlavor: "vlm"` display `mlx-vlm` in the runtime column; `athanor show` also prints a `caps` row and, for vision-capable entries still on `lm`, a hint pointing at `athanor flavor <slug> vlm`. In pi-agent, VLM-flavored entries render as `[mlx-vlm] <
|
|
266
|
+
In `athanor ls` and `athanor show`, entries with `mlxFlavor: "vlm"` display `mlx-vlm` in the runtime column; `athanor show` also prints a `caps` row and, for vision-capable entries still on `lm`, a hint pointing at `athanor flavor <slug> vlm`. In the TUI model list, hub-backed entries show the HF repo as the primary label with the slug dimmed after it; local entries show the slug only. In pi-agent, VLM-flavored entries render as `[mlx-vlm] <repo> (athanor)`; the provider id stays `athanor-mlx-<slug>` regardless of flavor, so pi URLs don't churn if a model's flavor is toggled later.
|
|
265
267
|
|
|
266
268
|
### Supervisor and policies
|
|
267
269
|
|
|
@@ -288,18 +290,36 @@ Caveats worth knowing:
|
|
|
288
290
|
|
|
289
291
|
### Pi-agent sync
|
|
290
292
|
|
|
291
|
-
Athanor publishes into pi-agent's [custom providers](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/models.md) system. On every state change it rewrites `~/.pi/agent/models.json
|
|
293
|
+
Athanor publishes into pi-agent's [custom providers](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/models.md) system. On every state change it rewrites `~/.pi/agent/models.json`.
|
|
294
|
+
|
|
295
|
+
**Default shape (ingress on):** pi sees up to two aggregator providers — `athanor-mlx` and `athanor-llama` — both pointing at the ingress port (`127.0.0.1:8080/v1` by default). Each lists only exposed models of that runtime. See [Ingress](#ingress) for lifecycle and request routing.
|
|
296
|
+
|
|
297
|
+
**Direct shape (`router.enabled: false`):** each exposed model becomes **its own pi provider** named `athanor-<runtime>-<slug>` (e.g. `athanor-mlx-qwen3-32b`), with `baseUrl` pointing at that model's stable port. One provider per model is required because a pi provider has exactly one `baseUrl` and each athanor model runs on its own port.
|
|
298
|
+
|
|
299
|
+
Common rules for both shapes:
|
|
292
300
|
|
|
293
|
-
- Each exposed athanor model becomes **its own pi provider** named `athanor-<runtime>-<slug>` (e.g. `athanor-mlx-qwen3-32b`, `athanor-llama-llama3-8b`), with `baseUrl` pointing at that model's stable port. One provider per model is required because a pi provider has exactly one `baseUrl` and each athanor model runs on its own port. The runtime segment keeps the backing engine visible in pi's `/model` picker. MLX VLM entries keep the `athanor-mlx-<slug>` provider id (so URLs don't churn if flavor is corrected) but render as `[mlx-vlm] <slug> (athanor)` in pi's model list.
|
|
294
301
|
- Providers whose name does **not** start with `athanor-` are preserved untouched — your OpenAI, Anthropic, Ollama, OpenRouter, etc. entries are safe.
|
|
295
|
-
- Each athanor provider uses `api: "openai-completions"
|
|
296
|
-
-
|
|
297
|
-
- **MLX HF-sourced models**
|
|
298
|
-
- **MLX local models**
|
|
299
|
-
- **llama.cpp
|
|
300
|
-
-
|
|
302
|
+
- Each athanor provider uses `api: "openai-completions"`, a placeholder `apiKey: "athanor"`, and runtime-appropriate `compat` flags.
|
|
303
|
+
- pi's `/model` picker lists models by **`id`**, not `name`. The `name` field is advisory detail text. Athanor sets both so they stay aligned with what each runtime was launched with:
|
|
304
|
+
- **MLX HF-sourced models** — launched with `--model <repo>`; pi `id` is that repo string.
|
|
305
|
+
- **MLX local models** — launched with `--model <path>`; pi `id` is that path.
|
|
306
|
+
- **llama.cpp HF GGUF** — launched with `--alias <registry-id>` where the id is `author/repo:file.gguf`; pi `id` matches. This keeps hub source visible in pi the same way MLX repos are. Slug and canonical id remain valid request aliases via the ingress resolver.
|
|
307
|
+
- **llama.cpp local / custom alias** — launched with `--alias <piAlias|slug>` when you've set an explicit `piAlias` different from `slug`; pi `id` is that alias.
|
|
308
|
+
- Hub-backed entries use `[runtime] <repo> (athanor)` for the pi `name` field regardless of runtime.
|
|
309
|
+
- `~/.pi/agent/settings.json` is only touched when an athanor model is started as the active default.
|
|
310
|
+
|
|
311
|
+
Example aggregator model entry (llama GGUF, HF-sourced):
|
|
312
|
+
|
|
313
|
+
```json
|
|
314
|
+
{
|
|
315
|
+
"id": "unsloth/Qwen3.6-27B-GGUF:Qwen3.6-27B-Q4_K_M.gguf",
|
|
316
|
+
"name": "[llama.cpp] unsloth/Qwen3.6-27B-GGUF (athanor)",
|
|
317
|
+
"input": ["text"],
|
|
318
|
+
"contextWindow": 32768
|
|
319
|
+
}
|
|
320
|
+
```
|
|
301
321
|
|
|
302
|
-
Example
|
|
322
|
+
Example direct provider (MLX, HF-sourced):
|
|
303
323
|
|
|
304
324
|
```json
|
|
305
325
|
{
|
|
@@ -315,9 +335,9 @@ Example exposed provider (MLX, HF-sourced):
|
|
|
315
335
|
"models": [
|
|
316
336
|
{
|
|
317
337
|
"id": "mlx-community/Qwen3-32B-4bit",
|
|
318
|
-
"name": "[mlx]
|
|
338
|
+
"name": "[mlx] mlx-community/Qwen3-32B-4bit (athanor)",
|
|
319
339
|
"input": ["text"],
|
|
320
|
-
"contextWindow":
|
|
340
|
+
"contextWindow": 32768
|
|
321
341
|
}
|
|
322
342
|
]
|
|
323
343
|
}
|
|
@@ -325,7 +345,7 @@ Example exposed provider (MLX, HF-sourced):
|
|
|
325
345
|
}
|
|
326
346
|
```
|
|
327
347
|
|
|
328
|
-
|
|
348
|
+
After upgrading athanor or changing runtime ids, run `athanor sync` and **restart** affected llama models so `--alias` matches what pi expects. pi reloads `models.json` when you open `/model`.
|
|
329
349
|
|
|
330
350
|
Disable athanor's sync entirely with `"enablePiSync": false` in `~/.athanor/config.json`.
|
|
331
351
|
|
|
@@ -356,6 +376,8 @@ athanor expose <id|slug> include in pi-agent catalog
|
|
|
356
376
|
athanor hide <id|slug> remove from pi-agent catalog
|
|
357
377
|
athanor rm <id|slug> remove from registry (must be stopped)
|
|
358
378
|
athanor sync manually rewrite pi catalog
|
|
379
|
+
athanor router [--host H] [--port P] [--verbose]
|
|
380
|
+
run the ingress server in the foreground
|
|
359
381
|
athanor config print resolved config and its path
|
|
360
382
|
athanor doctor check that required binaries are on PATH and show installed versions
|
|
361
383
|
athanor doctor --check-updates also compare installed versions with latest available and print upgrade hints
|
|
@@ -443,7 +465,8 @@ Models downloaded out-of-band (`hf download` in another terminal, or pulled whil
|
|
|
443
465
|
"enabled": true,
|
|
444
466
|
"port": 8080,
|
|
445
467
|
"host": "127.0.0.1",
|
|
446
|
-
"drainTimeoutMs": 30000
|
|
468
|
+
"drainTimeoutMs": 30000,
|
|
469
|
+
"verbose": false
|
|
447
470
|
}
|
|
448
471
|
}
|
|
449
472
|
```
|
|
@@ -583,10 +606,10 @@ POST /v1/embeddings { "model": ... } same
|
|
|
583
606
|
The ingress config lives under `router` in `~/.athanor/config.json` for backward compatibility:
|
|
584
607
|
|
|
585
608
|
```json
|
|
586
|
-
{ "router": { "enabled": true, "port": 8080, "host": "127.0.0.1", "drainTimeoutMs": 30000 } }
|
|
609
|
+
{ "router": { "enabled": true, "port": 8080, "host": "127.0.0.1", "drainTimeoutMs": 30000, "verbose": false } }
|
|
587
610
|
```
|
|
588
611
|
|
|
589
|
-
By default, pi sync emits the ingress-backed aggregator providers (not per-model providers). If you've exposed only MLX models you'll see `athanor-mlx` alone; only GGUF, just `athanor-llama`. The `model` field in requests may be the runtime
|
|
612
|
+
By default, pi sync emits the ingress-backed aggregator providers (not per-model providers). If you've exposed only MLX models you'll see `athanor-mlx` alone; only GGUF, just `athanor-llama`. The `model` field in requests may be the runtime model id (HF repo for MLX; registry `author/repo:file.gguf` for hub GGUF; custom `piAlias` or slug for local llama), the athanor slug, or the canonical registry id; all resolve. Unknown models return `404`.
|
|
590
613
|
|
|
591
614
|
For users who don't want to keep the TUI open, `athanor router` runs the ingress server in the foreground and blocks on `Ctrl-C`:
|
|
592
615
|
|
|
@@ -594,10 +617,15 @@ For users who don't want to keep the TUI open, `athanor router` runs the ingress
|
|
|
594
617
|
athanor router # uses config.router.host / .port
|
|
595
618
|
athanor router --port 9000 # override
|
|
596
619
|
athanor router --host 0.0.0.0 --port 8080
|
|
620
|
+
athanor router --verbose # log every request to ~/.athanor/logs/router.log
|
|
597
621
|
```
|
|
598
622
|
|
|
599
623
|
The subcommand ignores `router.enabled` — invoking it is itself the opt-in — but it still respects `127.0.0.1` as the default host.
|
|
600
624
|
|
|
625
|
+
### Verbose request logging
|
|
626
|
+
|
|
627
|
+
When `router.verbose` is `true` in config (or `--verbose` is passed on the command line), the ingress logs every inbound request — method, path, model field (for POST), response status, and latency in milliseconds — to `~/.athanor/logs/router.log`. This is useful for diagnosing routing, cold-start latency, and model resolution issues without needing to intercept traffic externally. Off by default to avoid noise.
|
|
628
|
+
|
|
601
629
|
Caveats:
|
|
602
630
|
|
|
603
631
|
- **Cold start.** First request on an idle model blocks until the runtime is healthy (often 10–60s for large MLX). No keepalive is injected into the stream — make sure your client's timeout is generous.
|
|
@@ -608,7 +636,7 @@ Caveats:
|
|
|
608
636
|
|
|
609
637
|
- **`athanor start` hangs or times out.** Check `~/.athanor/logs/<slug>-<pid>.log`. Most startup failures are the runtime itself complaining (missing weights, wrong quant, out of memory). Raise `supervisor.startupTimeoutMs` for very large models.
|
|
610
638
|
- **`port already in use`.** Another process is on the model's stable port. Either stop it, or edit the entry's `port` in `~/.athanor/models.json` and restart.
|
|
611
|
-
- **Pi-agent can't see a new model.** Make sure it's exposed (CLI: `athanor expose <slug>`) and run `athanor sync`. Confirm `~/.pi/agent/models.json` contains the expected athanor provider shape (per-model when router is
|
|
639
|
+
- **Pi-agent can't see a new model.** Make sure it's exposed (CLI: `athanor expose <slug>`) and run `athanor sync`. Confirm `~/.pi/agent/models.json` contains the expected athanor provider shape (per-model when `router.enabled` is false, `athanor-mlx` / `athanor-llama` aggregators when true — the default), then open `/model` in pi (the file reloads on open). If you upgraded athanor and llama model ids changed, restart the model after syncing.
|
|
612
640
|
- **Models from other tools disappeared from pi.** They shouldn't — athanor only rewrites providers whose name starts with `athanor-`. If this happens, open an issue with the before/after of `~/.pi/agent/models.json`.
|
|
613
641
|
- **Stale PID / router state.** If a child or detached router crashed without athanor noticing, reopening athanor or running `athanor sync` / `athanor status` will reconcile persisted state and clear dead router metadata opportunistically. If a model port is still held, run `athanor stop <slug>` (a no-op when nothing is live) then `athanor start <slug>`.
|
|
614
642
|
- **`doctor` reports a missing binary.** Install `mlx_lm`, `mlx_vlm`, `llama.cpp`, or `huggingface_hub`, or adjust your shell's `PATH`. `mlx_vlm.server` is only needed if you plan to run VLM models; `athanor start` on a VLM entry will fail with a clear error if it's missing.
|
|
@@ -630,14 +658,14 @@ Tests redirect `ATHANOR_HOME` and `PI_HOME` to per-run temporary directories via
|
|
|
630
658
|
|
|
631
659
|
```
|
|
632
660
|
src/
|
|
633
|
-
adapters/ # mlx (lm + vlm) + llama.cpp command builders
|
|
661
|
+
adapters/ # mlx (lm + vlm) + llama.cpp command builders, health probes, runtime model ids
|
|
634
662
|
cli/ # hand-rolled CLI dispatcher, doctor, output formatting
|
|
635
663
|
config/ # config file load + defaults
|
|
636
664
|
control/ # optional HTTP control API (off by default)
|
|
637
665
|
discovery/ # HF cache scanner + registry ingest (MLX capability detection lives here)
|
|
638
666
|
presets/ # preset merge, tunable-key metadata, recipes
|
|
639
667
|
pull/ # HuggingFace repo inspection and download
|
|
640
|
-
registry/ # models.json CRUD, slug + port allocation
|
|
668
|
+
registry/ # models.json CRUD, slug + port allocation, dedup, display labels
|
|
641
669
|
search/ # HuggingFace Hub search + trending
|
|
642
670
|
supervisor/ # detached process lifecycle, policy, reattach
|
|
643
671
|
sync/ # namespaced pi-agent catalog merge
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/adapters/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/adapters/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGhE,wBAAgB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpE;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,SAAS,SAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAA;CAAE,GACnE,OAAO,CAAC,IAAI,CAAC,CAUf;AAgBD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/F"}
|
package/dist/adapters/health.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
if (entry.runtime === "mlx") {
|
|
3
|
-
return entry.source.type === "hf" ? entry.source.repo : entry.path;
|
|
4
|
-
}
|
|
5
|
-
return entry.piAlias ?? entry.slug;
|
|
6
|
-
}
|
|
1
|
+
import { runtimeModelId } from "./model-id.js";
|
|
7
2
|
export function healthUrl(runtime, port) {
|
|
8
3
|
switch (runtime) {
|
|
9
4
|
case "llama.cpp":
|
|
@@ -67,7 +62,7 @@ export async function probeRuntimeModelId(entry, timeoutMs = 1500) {
|
|
|
67
62
|
const body = await fetchJson(`http://127.0.0.1:${entry.port}/v1/models`, timeoutMs);
|
|
68
63
|
if (!body || !Array.isArray(body.data))
|
|
69
64
|
return false;
|
|
70
|
-
const expected =
|
|
65
|
+
const expected = runtimeModelId(entry);
|
|
71
66
|
return body.data.some(model => typeof model?.id === "string" && model.id === expected);
|
|
72
67
|
}
|
|
73
68
|
//# sourceMappingURL=health.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/adapters/health.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/adapters/health.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,UAAU,SAAS,CAAC,OAAoB,EAAE,IAAY;IAC1D,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,WAAW;YACd,OAAO,oBAAoB,IAAI,SAAS,CAAA;QAC1C,KAAK,KAAK;YACR,OAAO,oBAAoB,IAAI,YAAY,CAAA;IAC/C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,IAAY,EACZ,SAAS,GAAG,IAAI;IAEhB,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IACpC,MAAM,IAAI,GAAG,IAAI,eAAe,EAAE,CAAA;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAA;IACvD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QACrD,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,KAAK,CAAA;QACzB,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;YAC5B,MAA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AE,EAAE,SAAS,CAAC,CAAA;IACvD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QACrD,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,IAAI,CAAA;QACxB,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,KAAK,CAAC,CAAA;IACrB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAAiB,EAAE,SAAS,GAAG,IAAI;IAC3E,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,oBAAoB,KAAK,CAAC,IAAI,YAAY,EAAE,SAAS,CAE1E,CAAA;IACR,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IACpD,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,EAAE,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAA;AACxF,CAAC"}
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LlamaConfig, MlxConfig, ModelEntry, RuntimeAdapter, RuntimeType } from "../types/index.js";
|
|
2
|
+
export { runtimeModelId } from "./model-id.js";
|
|
2
3
|
export declare const runtimes: Record<RuntimeType, RuntimeAdapter>;
|
|
3
4
|
export declare function getAdapter(runtime: RuntimeType): RuntimeAdapter;
|
|
4
5
|
export declare function inferRuntime(modelPath: string): RuntimeType | undefined;
|
|
@@ -8,6 +9,5 @@ export declare function buildCommandFor(entry: ModelEntry): {
|
|
|
8
9
|
args: string[];
|
|
9
10
|
env?: Record<string, string>;
|
|
10
11
|
};
|
|
11
|
-
export declare function runtimeModelId(entry: ModelEntry): string;
|
|
12
12
|
export declare function resolveByRuntimeModelId(entries: ModelEntry[], modelField: string): ModelEntry | undefined;
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAM1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,cAAc,CAGxD,CAAA;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAE/D;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAIvE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAU1E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,GAChB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAI/D;AAMD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EAAE,EACrB,UAAU,EAAE,MAAM,GACjB,UAAU,GAAG,SAAS,CAQxB"}
|
package/dist/adapters/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MlxAdapter } from "./mlx.js";
|
|
2
2
|
import { LlamaAdapter } from "./llama.js";
|
|
3
3
|
import { loadConfig } from "../config/index.js";
|
|
4
|
+
import { runtimeModelId } from "./model-id.js";
|
|
5
|
+
export { runtimeModelId } from "./model-id.js";
|
|
4
6
|
export const runtimes = {
|
|
5
7
|
"mlx": new MlxAdapter(),
|
|
6
8
|
"llama.cpp": new LlamaAdapter()
|
|
@@ -29,21 +31,6 @@ export function buildCommandFor(entry) {
|
|
|
29
31
|
const merged = mergedConfigFor(entry);
|
|
30
32
|
return adapter.buildCommand(entry, merged);
|
|
31
33
|
}
|
|
32
|
-
// Identifier the runtime accepts in OpenAI-compatible requests. Must
|
|
33
|
-
// match exactly what each runtime was launched with, otherwise:
|
|
34
|
-
// - mlx_lm.server treats a mismatched "model" field as an HF repo
|
|
35
|
-
// to download (see ml-explore/mlx-lm#1133),
|
|
36
|
-
// - llama-server echoes whatever alias is configured via --alias in
|
|
37
|
-
// its /v1/models response.
|
|
38
|
-
// pi's models.json uses this string as the model `id`.
|
|
39
|
-
export function runtimeModelId(entry) {
|
|
40
|
-
if (entry.runtime === "mlx") {
|
|
41
|
-
if (entry.source.type === "hf")
|
|
42
|
-
return entry.source.repo;
|
|
43
|
-
return entry.path;
|
|
44
|
-
}
|
|
45
|
-
return entry.piAlias ?? entry.slug;
|
|
46
|
-
}
|
|
47
34
|
// Reverse lookup used by the router: given whatever pi-agent puts in a
|
|
48
35
|
// request body's `model` field, find the matching registry entry.
|
|
49
36
|
// Accepts runtimeModelId (primary), slug, and id as fallbacks so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UA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ACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"llama.d.ts","sourceRoot":"","sources":["../../src/adapters/llama.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAI1B,qBAAa,YAAa,YAAW,cAAc;IACjD,IAAI,EAAE,WAAW,CAAc;IAE/B,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE;IAoBrF,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGhC"}
|
package/dist/adapters/llama.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { healthUrl } from "./health.js";
|
|
2
|
+
import { runtimeModelId } from "./model-id.js";
|
|
2
3
|
export class LlamaAdapter {
|
|
3
4
|
type = "llama.cpp";
|
|
4
5
|
buildCommand(entry, merged) {
|
|
5
|
-
const alias = entry
|
|
6
|
+
const alias = runtimeModelId(entry);
|
|
6
7
|
return {
|
|
7
8
|
cmd: "llama-server",
|
|
8
9
|
args: [
|
|
@@ -13,7 +14,6 @@ export class LlamaAdapter {
|
|
|
13
14
|
"--port", String(entry.port),
|
|
14
15
|
"--host", "127.0.0.1",
|
|
15
16
|
"--n-gpu-layers", String(merged.nGpuLayers),
|
|
16
|
-
"--threads", String(merged.threads),
|
|
17
17
|
"--ctx-size", String(merged.ctxSize),
|
|
18
18
|
"--batch-size", String(merged.batchSize),
|
|
19
19
|
"--ubatch-size", String(merged.ubatchSize),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llama.js","sourceRoot":"","sources":["../../src/adapters/llama.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"llama.js","sourceRoot":"","sources":["../../src/adapters/llama.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,OAAO,YAAY;IACvB,IAAI,GAAgB,WAAW,CAAA;IAE/B,YAAY,CAAC,KAAiB,EAAE,MAAmB;QACjD,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QACnC,OAAO;YACL,GAAG,EAAE,cAAc;YACnB,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,8DAA8D;gBAC9D,wDAAwD;gBACxD,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;gBAC5B,QAAQ,EAAE,WAAW;gBACrB,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC3C,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;gBACpC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;gBACxC,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC1C,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;aACtC;SACF,CAAA;IACH,CAAC;IAED,SAAS,CAAC,IAAY;QACpB,OAAO,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IACrC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mlx.d.ts","sourceRoot":"","sources":["../../src/adapters/mlx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAgC1B,qBAAa,UAAW,YAAW,cAAc;IAC/C,IAAI,EAAE,WAAW,CAAQ;IAEzB,YAAY,CACV,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,SAAS,GAChB;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;
|
|
1
|
+
{"version":3,"file":"mlx.d.ts","sourceRoot":"","sources":["../../src/adapters/mlx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,mBAAmB,CAAA;AAgC1B,qBAAa,UAAW,YAAW,cAAc;IAC/C,IAAI,EAAE,WAAW,CAAQ;IAEzB,YAAY,CACV,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,SAAS,GAChB;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE;IA6C/D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGhC"}
|
package/dist/adapters/mlx.js
CHANGED
|
@@ -37,20 +37,37 @@ export class MlxAdapter {
|
|
|
37
37
|
// mlx_vlm.server does not accept lm-only tuning flags.
|
|
38
38
|
return { cmd: "mlx_vlm.server", args: common, env: MLX_OFFLINE_ENV };
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
// contextWindow is advertised to pi-agent (invariant #6) but
|
|
41
|
+
// mlx_lm.server has no context-window flag — the model's KV cache
|
|
42
|
+
// ceiling is baked into its weights. Do not pass contextWindow here.
|
|
43
|
+
// Only emit sampling flags when non-default to keep the command
|
|
44
|
+
// clean. Defaults here must match mlx-lm's CLI defaults:
|
|
45
|
+
// temp=0, topP=1, topK=0, minP=0, promptConcurrency=8
|
|
46
|
+
// If any of these drift, the flag will be emitted unnecessarily
|
|
47
|
+
// (harmless) but the suppression pattern breaks.
|
|
48
|
+
const extra = [];
|
|
49
|
+
if (merged.temp !== 0)
|
|
50
|
+
extra.push("--temp", String(merged.temp));
|
|
51
|
+
if (merged.topP !== 1)
|
|
52
|
+
extra.push("--top-p", String(merged.topP));
|
|
53
|
+
if (merged.topK !== 0)
|
|
54
|
+
extra.push("--top-k", String(merged.topK));
|
|
55
|
+
if (merged.minP !== 0)
|
|
56
|
+
extra.push("--min-p", String(merged.minP));
|
|
57
|
+
if (merged.promptConcurrency !== 8)
|
|
58
|
+
extra.push("--prompt-concurrency", String(merged.promptConcurrency));
|
|
43
59
|
return {
|
|
44
60
|
cmd: mlxBinary(entry),
|
|
45
61
|
args: [
|
|
46
62
|
...common,
|
|
47
|
-
"--max-tokens", String(merged.
|
|
63
|
+
"--max-tokens", String(merged.maxTokens),
|
|
48
64
|
"--prefill-step-size", String(merged.prefillStepSize),
|
|
49
65
|
"--prompt-cache-size", String(merged.promptCacheSize),
|
|
50
66
|
"--decode-concurrency", String(merged.decodeConcurrency),
|
|
51
67
|
...(merged.promptCacheBytes > 0
|
|
52
68
|
? ["--prompt-cache-bytes", String(merged.promptCacheBytes)]
|
|
53
|
-
: [])
|
|
69
|
+
: []),
|
|
70
|
+
...extra
|
|
54
71
|
],
|
|
55
72
|
env: MLX_OFFLINE_ENV
|
|
56
73
|
};
|
package/dist/adapters/mlx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mlx.js","sourceRoot":"","sources":["../../src/adapters/mlx.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,sDAAsD;AACtD,4DAA4D;AAC5D,6DAA6D;AAC7D,+DAA+D;AAC/D,+DAA+D;AAC/D,qDAAqD;AACrD,SAAS,WAAW,CAAC,KAAiB;IACpC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAA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,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAInD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Identifier the runtime accepts in OpenAI-compatible requests. Must
|
|
2
|
+
// match exactly what each runtime was launched with.
|
|
3
|
+
export function runtimeModelId(entry) {
|
|
4
|
+
if (entry.runtime === "mlx") {
|
|
5
|
+
if (entry.source.type === "hf")
|
|
6
|
+
return entry.source.repo;
|
|
7
|
+
return entry.path;
|
|
8
|
+
}
|
|
9
|
+
if (entry.piAlias && entry.piAlias !== entry.slug)
|
|
10
|
+
return entry.piAlias;
|
|
11
|
+
if (entry.source.type === "hf")
|
|
12
|
+
return entry.id;
|
|
13
|
+
return entry.piAlias ?? entry.slug;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=model-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-id.js","sourceRoot":"","sources":["../../src/adapters/model-id.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,qDAAqD;AACrD,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC5B,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAA;QACxD,OAAO,KAAK,CAAC,IAAI,CAAA;IACnB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC,OAAO,CAAA;IACvE,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,EAAE,CAAA;IAC/C,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,CAAA;AACpC,CAAC"}
|
package/dist/app/models.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface StartModelResult {
|
|
|
11
11
|
export interface StopModelResult {
|
|
12
12
|
stoppedAll: boolean;
|
|
13
13
|
entry?: ModelEntry;
|
|
14
|
+
stopped: boolean;
|
|
14
15
|
}
|
|
15
16
|
export declare function scanModelsAndReport(): IngestReport;
|
|
16
17
|
export declare function pullModel(opts: PullOptions): Promise<PullResult>;
|
|
@@ -26,5 +27,5 @@ export declare function setFlavor(idOrSlug: string, mlxFlavor: ModelEntry["mlxFl
|
|
|
26
27
|
export declare function setPreset(idOrSlug: string, preset: ModelEntry["preset"]): ModelEntry;
|
|
27
28
|
export declare function deleteModelFromDisk(idOrSlug: string): ModelEntry;
|
|
28
29
|
export declare function removeModelEntry(idOrSlug: string): void;
|
|
29
|
-
export declare function syncPiNow(activeDefault?: ActiveInstance): void
|
|
30
|
+
export declare function syncPiNow(activeDefault?: ActiveInstance): Promise<void>;
|
|
30
31
|
//# sourceMappingURL=models.d.ts.map
|
package/dist/app/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/app/models.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAQ,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAcvE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,UAAU,CAAA;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,CAA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,OAAO,GAAG,UAAU,CAK3E;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,UAAU,CAK1F;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAKpF;AA8CD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAehE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGvD;AAKD,wBAAsB,SAAS,CAAC,aAAa,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAG7E"}
|
package/dist/app/models.js
CHANGED
|
@@ -31,7 +31,7 @@ export async function startModel(idOrSlug, opts) {
|
|
|
31
31
|
return { entry, preflight, warned: true };
|
|
32
32
|
}
|
|
33
33
|
const instance = await supervisor.start(entry);
|
|
34
|
-
ensureIngress();
|
|
34
|
+
await ensureIngress();
|
|
35
35
|
syncPi({ activeDefault: instance, instances: supervisor.list() });
|
|
36
36
|
return { entry, instance, preflight };
|
|
37
37
|
}
|
|
@@ -40,18 +40,18 @@ export async function stopModel(idOrSlug) {
|
|
|
40
40
|
// Stopping all instances does not change publish state. Re-sync pi
|
|
41
41
|
// with an empty running set, but leave provider emission driven by
|
|
42
42
|
// the registry's persistent `publish` flags.
|
|
43
|
-
await supervisor.stopAll();
|
|
43
|
+
const stopped = await supervisor.stopAll();
|
|
44
44
|
await stopIngressIfIdle(stopRouter);
|
|
45
45
|
syncPi({ instances: [] });
|
|
46
|
-
return { stoppedAll: true };
|
|
46
|
+
return { stoppedAll: true, stopped };
|
|
47
47
|
}
|
|
48
48
|
const entry = getModel(idOrSlug);
|
|
49
49
|
if (!entry)
|
|
50
50
|
throw new Error(`unknown model: ${idOrSlug}`);
|
|
51
|
-
await supervisor.stop(entry.id);
|
|
51
|
+
const stopped = await supervisor.stop(entry.id);
|
|
52
52
|
await stopIngressIfIdle(stopRouter);
|
|
53
53
|
syncPi({ instances: supervisor.list() });
|
|
54
|
-
return { stoppedAll: false, entry };
|
|
54
|
+
return { stoppedAll: false, entry, stopped };
|
|
55
55
|
}
|
|
56
56
|
export async function restartModel(idOrSlug, opts) {
|
|
57
57
|
const entry = getModel(idOrSlug);
|
|
@@ -62,7 +62,7 @@ export async function restartModel(idOrSlug, opts) {
|
|
|
62
62
|
return { entry, preflight, warned: true };
|
|
63
63
|
}
|
|
64
64
|
const instance = await supervisor.restart(entry);
|
|
65
|
-
ensureIngress();
|
|
65
|
+
await ensureIngress();
|
|
66
66
|
syncPi({ activeDefault: instance, instances: supervisor.list() });
|
|
67
67
|
return { entry, instance, preflight };
|
|
68
68
|
}
|
|
@@ -137,12 +137,12 @@ export function deleteModelFromDisk(idOrSlug) {
|
|
|
137
137
|
const removedPath = entry.source.type === "local"
|
|
138
138
|
? removeLocalModelPath(entry)
|
|
139
139
|
: removeHfSnapshotFromEntry(entry);
|
|
140
|
+
if (!removedPath) {
|
|
141
|
+
throw new Error(`could not remove files from disk for ${entry.slug}; registry entry left intact`);
|
|
142
|
+
}
|
|
140
143
|
if (!removeModel(entry.id))
|
|
141
144
|
throw new Error(`unknown model: ${entry.id}`);
|
|
142
145
|
syncPi({ instances: supervisor.list() });
|
|
143
|
-
if (!removedPath) {
|
|
144
|
-
throw new Error(`removed registry entry for ${entry.slug}, but could not remove files from disk`);
|
|
145
|
-
}
|
|
146
146
|
return entry;
|
|
147
147
|
}
|
|
148
148
|
export function removeModelEntry(idOrSlug) {
|
|
@@ -153,8 +153,8 @@ export function removeModelEntry(idOrSlug) {
|
|
|
153
153
|
// Escape hatch for callers that need a direct re-emit without another
|
|
154
154
|
// state mutation (for example after config changes that affect pi sync
|
|
155
155
|
// shape). Prefer the higher-level operations above for normal flows.
|
|
156
|
-
export function syncPiNow(activeDefault) {
|
|
157
|
-
reconcileIngressForCurrentState();
|
|
156
|
+
export async function syncPiNow(activeDefault) {
|
|
157
|
+
await reconcileIngressForCurrentState();
|
|
158
158
|
syncPi({ activeDefault, instances: supervisor.list() });
|
|
159
159
|
}
|
|
160
160
|
//# sourceMappingURL=models.js.map
|
package/dist/app/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/app/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAExB,OAAO,EAAE,gBAAgB,EAAqB,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAqC,MAAM,eAAe,CAAA;AACvE,OAAO,EACL,QAAQ,EACR,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAuB,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/app/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAExB,OAAO,EAAE,gBAAgB,EAAqB,MAAM,wBAAwB,CAAA;AAC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