athanor 3.3.1 → 3.5.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 +18 -14
- package/README.md +112 -708
- package/dist/app/models.d.ts.map +1 -1
- package/dist/app/models.js +24 -2
- package/dist/app/models.js.map +1 -1
- package/dist/app/preflight.d.ts +3 -1
- package/dist/app/preflight.d.ts.map +1 -1
- package/dist/app/preflight.js +4 -2
- package/dist/app/preflight.js.map +1 -1
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +1 -46
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +24 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/model-commands.d.ts +6 -2
- package/dist/cli/model-commands.d.ts.map +1 -1
- package/dist/cli/model-commands.js +4 -4
- package/dist/cli/model-commands.js.map +1 -1
- package/dist/cli/pull-commands.d.ts +2 -0
- package/dist/cli/pull-commands.d.ts.map +1 -0
- package/dist/cli/pull-commands.js +47 -0
- package/dist/cli/pull-commands.js.map +1 -0
- package/dist/presets/edit.d.ts.map +1 -1
- package/dist/presets/edit.js +17 -7
- package/dist/presets/edit.js.map +1 -1
- package/dist/supervisor/index.d.ts +15 -1
- package/dist/supervisor/index.d.ts.map +1 -1
- package/dist/supervisor/index.js +36 -3
- package/dist/supervisor/index.js.map +1 -1
- package/dist/ui/useDownloads.d.ts.map +1 -1
- package/dist/ui/useDownloads.js +1 -0
- package/dist/ui/useDownloads.js.map +1 -1
- package/package.json +4 -1
package/AGENTS.md
CHANGED
|
@@ -10,9 +10,9 @@ Not a library. Not a daemon. No network listeners except the runtime children th
|
|
|
10
10
|
|
|
11
11
|
## Invariants
|
|
12
12
|
|
|
13
|
-
These are
|
|
13
|
+
These invariants are mandatory. Do not change them without an explicit user decision.
|
|
14
14
|
|
|
15
|
-
1. **Stable port per model.** Ports are allocated on first discovery from `config.portRange` and persisted on the registry entry
|
|
15
|
+
1. **Stable port per model.** Ports are allocated on first discovery from `config.portRange` and persisted on the registry entry. A model's port does not change after allocation; pi-agent provider URLs must remain 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
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`).
|
|
@@ -22,7 +22,7 @@ These are load-bearing. If a change seems to need to break one, stop and ask.
|
|
|
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.
|
|
23
23
|
- `mlxFlavor: "lm" | "vlm"` — user *intent* about which server binary to launch. `"vlm"` routes to `mlx_vlm.server`; `"lm"` (or absent) routes to `mlx_lm.server`. Only set by `athanor flavor <slug> lm|vlm` (`cmdFlavor` in `src/cli/commands.ts`). Discovery and ingest must never touch it.
|
|
24
24
|
|
|
25
|
-
Detection is advisory because many VLM-tagged repos run fine as text-only under `mlx_lm.server` with no torch/torchvision installed, and that's usually the preferred path. `cmdShow` surfaces the capability with a hint that points at `athanor flavor`. Do not add VLM detection anywhere other than `detectMlxCapabilities`; keep it
|
|
25
|
+
Detection is advisory because many VLM-tagged repos run fine as text-only under `mlx_lm.server` with no torch/torchvision installed, and that's usually the preferred path. `cmdShow` surfaces the capability with a hint that points at `athanor flavor`. Do not add VLM detection anywhere other than `detectMlxCapabilities`; keep it the sole detection function.
|
|
26
26
|
8. **Supervisor default policy is `single-active`.** Starting model B stops model A unless the user opts into `multi-active-lru` (or `manual`) in `config.json`. Policies live in `src/supervisor/policies.ts`.
|
|
27
27
|
9. **Formulas are additive, scans are non-destructive.** `athanor scan` refreshes `path`, `sizeBytes`, and `mlxCapabilities`. `formula`, `publish`, `piAlias`, `tags`, `port`, `slug`, and `mlxFlavor` must survive re-scans. Built-in formulas are explicit; `balanced` is not shorthand for clearing a formula, and `formula clear` is the separate remove action.
|
|
28
28
|
10. **All mutations go through helpers.** Use `setFormulaFields` / `unsetFormulaFields` from `src/presets/edit.ts`, `formulaToRuntime` from `src/presets/recipes.ts`, and `updateModel` / `setModelFormula` from `src/registry/index.ts`. Do not hand-edit registry objects in commands or UI components.
|
|
@@ -30,12 +30,15 @@ These are load-bearing. If a change seems to need to break one, stop and ask.
|
|
|
30
30
|
## Layout
|
|
31
31
|
|
|
32
32
|
```
|
|
33
|
+
docs/ # deep-dive user guides: setup, formulas, architecture, tui, troubleshooting
|
|
33
34
|
src/
|
|
34
35
|
adapters/ # mlx_lm + mlx_vlm + llama-server command builders, health probes, runtime model ids (model-id.ts)
|
|
36
|
+
app/ # application orchestration (model operations, preflight, sync side-effects)
|
|
35
37
|
cli/ # dispatcher (index.ts), commands.ts, doctor, formatting
|
|
36
38
|
config/ # config load + defaults
|
|
37
39
|
control/ # optional HTTP control API (opt-in)
|
|
38
40
|
discovery/ # HF cache scanner + ingest + fs.watch watcher; detectMlxCapabilities lives here
|
|
41
|
+
machine/ # Apple Silicon hardware profiling, bandwidth constants, memory estimation
|
|
39
42
|
presets/ # formula merge, tunable-key metadata, built-in + user formulas engine
|
|
40
43
|
pull/ # HF repo inspection + `hf` download wrapper
|
|
41
44
|
registry/ # atomic models.json CRUD, slug + port allocation, dedup on load, display labels
|
|
@@ -66,6 +69,8 @@ Context discipline:
|
|
|
66
69
|
|
|
67
70
|
## Development
|
|
68
71
|
|
|
72
|
+
Requires Node.js ≥ 22 on Apple Silicon (macOS 13.5+).
|
|
73
|
+
|
|
69
74
|
```bash
|
|
70
75
|
npm install
|
|
71
76
|
npx tsc --noEmit # typecheck — must be clean
|
|
@@ -89,7 +94,7 @@ When a user opens this repo with an agent and asks to "set up athanor", work in
|
|
|
89
94
|
|
|
90
95
|
### CLI install modes
|
|
91
96
|
|
|
92
|
-
`bin/athanor` resolves `../
|
|
97
|
+
`bin/athanor` resolves `../dist/index.js` (the compiled entry), so the binary only works after a build. Pick one:
|
|
93
98
|
|
|
94
99
|
| Mode | Setup | Invocation |
|
|
95
100
|
|---|---|---|
|
|
@@ -101,10 +106,10 @@ Linked mode does not auto-rebuild. Re-run `npm run build` after pulling changes
|
|
|
101
106
|
|
|
102
107
|
### External binaries
|
|
103
108
|
|
|
104
|
-
Run `athanor doctor` first — it prints presence, installed versions, and paths for each dependency
|
|
109
|
+
Run `athanor doctor` first — it prints presence, installed versions, and paths for each dependency. When you specifically need to check staleness, run `athanor doctor --check-updates` as well:
|
|
105
110
|
|
|
106
111
|
- `mlx_lm.server` — required for MLX text models. `uv tool install mlx-lm` (or `pipx install mlx-lm`).
|
|
107
|
-
- `mlx_vlm.server` — optional, for vision MLX models. `uv tool install mlx-vlm --with torch --with torchvision`. The torch/torchvision extras are
|
|
112
|
+
- `mlx_vlm.server` — optional, for vision MLX models. `uv tool install mlx-vlm --with torch --with torchvision`. The torch/torchvision extras are required: `mlx-vlm` itself doesn't depend on them, but the `transformers` VLM processors it imports do, so installing `mlx-vlm` alone passes `athanor doctor` and then fails at request time with `Qwen3VLVideoProcessor requires the PyTorch library but it was not found in your environment`. Equivalent forms: `pipx install mlx-vlm && pipx inject mlx-vlm torch torchvision`, or `pip install -U mlx-vlm torch torchvision` in an active venv.
|
|
108
113
|
- `llama-server` — optional, for GGUF models. `brew install llama.cpp` or build from source.
|
|
109
114
|
- `hf` — required for `athanor pull`. `uv tool install huggingface_hub --with hf_transfer` (or `pip install -U huggingface_hub[cli]`).
|
|
110
115
|
|
|
@@ -138,7 +143,7 @@ Quantization reading:
|
|
|
138
143
|
- **MLX:** prefer `mlx-community/*` — they carry the right conversion manifest. Suffix `-4bit` is the default; `-6bit` / `-8bit` cost ~1.5×/2× disk and memory for modest quality gains; `-bf16` is rarely worth it for serving on a Mac.
|
|
139
144
|
- **GGUF:** `Q4_K_M` is the balanced default, `Q5_K_M` / `Q6_K` trade size for quality, `Q8_0` is near-lossless but large. Avoid `Q2_*` and `Q3_*` except on tight memory.
|
|
140
145
|
|
|
141
|
-
After pull, `athanor show <slug>` shows detected capabilities, resolved launch command, and merged preset. For MLX entries where `caps` includes `vlm`, only flip `athanor flavor <slug> vlm` if the user actually needs image input — most VLM repos serve text fine under `mlx_lm.server` without the torch install (see invariant #
|
|
146
|
+
After pull, `athanor show <slug>` shows detected capabilities, resolved launch command, and merged preset. For MLX entries where `caps` includes `vlm`, only flip `athanor flavor <slug> vlm` if the user actually needs image input — most VLM repos serve text fine under `mlx_lm.server` without the torch install (see invariant #7).
|
|
142
147
|
|
|
143
148
|
### Running a model
|
|
144
149
|
|
|
@@ -173,8 +178,9 @@ To make a running model available to `pi-agent` downstream, `athanor expose <slu
|
|
|
173
178
|
| Path | Purpose |
|
|
174
179
|
|---|---|
|
|
175
180
|
| `~/.athanor/config.json` | user config: scan roots, port range, supervisor policy, control API |
|
|
176
|
-
| `~/.athanor/models.json` | registry —
|
|
181
|
+
| `~/.athanor/models.json` | registry — storage for slugs, ports, formulas, publish state |
|
|
177
182
|
| `~/.athanor/formulas.json` | optional user formulas; overrides built-ins of the same name (with auto-migration from legacy `recipes.json`) |
|
|
183
|
+
| `~/.athanor/telemetry.json` | persistent generation telemetry history (tok/s, prompt eval, latency) |
|
|
178
184
|
| `~/.athanor/logs/<slug>-<pid>.log` | per-run supervisor log |
|
|
179
185
|
| `~/.athanor/state.json` | running PIDs / ports for reattach (see `src/supervisor/state.ts`) |
|
|
180
186
|
| `~/.pi/agent/models.json` | pi-agent providers; athanor namespace only |
|
|
@@ -185,17 +191,15 @@ To make a running model available to `pi-agent` downstream, `athanor expose <slu
|
|
|
185
191
|
|
|
186
192
|
- TypeScript strict; no `any` unless unavoidable. Prefer `unknown` at boundaries and narrow.
|
|
187
193
|
- Functions named after what they do, not how. Side-effecting helpers end in verbs (`ingestDiscovered`, `updateModel`, `syncPi`).
|
|
188
|
-
-
|
|
194
|
+
- Keep comments concise. Do not annotate obvious code or explain the rationale for a change inside a comment — that belongs in the PR.
|
|
189
195
|
- No new files unless necessary. Prefer editing an existing module. Especially: do not create new top-level docs (`*.md`) without being asked.
|
|
190
|
-
-
|
|
196
|
+
- Format command output clearly. Tables go through `format.ts`. Errors exit non-zero with a one-line message plus, when useful, a hint on the next line.
|
|
191
197
|
|
|
192
198
|
## Roadmap
|
|
193
199
|
|
|
194
|
-
### Router —
|
|
195
|
-
|
|
196
|
-
The router in `src/router/server.ts` is live (see invariant #4 and the Router section in `README.md`). Headless mode (`athanor router` subcommand) and in-flight stream safety (`src/supervisor/inflight.ts` + `supervisor.stop()` drain before SIGTERM, bounded by `config.router.drainTimeoutMs`) are both done. One follow-up remains:
|
|
200
|
+
### Router — completed capabilities
|
|
197
201
|
|
|
198
|
-
|
|
202
|
+
The router in `src/router/server.ts` is live (see invariant #4, `README.md`, and `docs/architecture.md`). Headless mode (`athanor router` subcommand), in-flight stream safety (`src/supervisor/inflight.ts` + `supervisor.stop()` drain before SIGTERM, bounded by `config.router.drainTimeoutMs`), and live token accounting via passthrough Transform (`SSETokenCounter` feeding `src/supervisor/metrics.ts` `updateLiveRouterStats` and consumed by CLI/TUI) are all complete.
|
|
199
203
|
|
|
200
204
|
## License
|
|
201
205
|
|