agents: remove the hive-level /model control; the swarm editor sets the model
The per-agent web UI no longer sets the model: the `/model` slash command, the model picker, `POST /api/model`, `Bus::set_model` and the `hyperhive-model` writer are gone. The model chip is display-only and shows where the model comes from (`model_source` in `/api/state`). The model is set on the swarm (swarm UI agents page, `swarmctl agent inference set`). The read side is unchanged: with no swarm value an agent runs its agent.nix model, else an existing `hyperhive-model` file, else haiku. Existing files are not touched. With the picker gone, its model list goes too: `available_models` in `/api/state`, the ACP model-list filter, and the harness's global `HIVE_AVAILABLE_MODELS`. The subagent daemon keeps its own `HIVE_AVAILABLE_MODELS` from mcp.nix, and the `availableModels` assertion stays. `/effort` (command, picker, route, file) is unchanged. Refs #5034
This commit is contained in:
parent
46e9966e17
commit
594693f4c7
26 changed files with 244 additions and 425 deletions
|
|
@ -211,12 +211,12 @@ log row never blocks a rebuild.
|
|||
|
||||
### `/harness/hyperhive-model` (per agent)
|
||||
|
||||
Single-line text file holding the claude model name currently
|
||||
selected for this agent (default `haiku` when absent). Written by
|
||||
`Bus::set_model` whenever the operator flips it via `/model
|
||||
<name>` in the web terminal. Read once at harness boot in
|
||||
`Bus::new`. Path overridable via `HYPERHIVE_MODEL_FILE`.
|
||||
Survives destroy/recreate, gone on `--purge`.
|
||||
Single-line text file holding a claude model name. The harness only
|
||||
reads it, at boot in `Bus::new` and again when the swarm clears the
|
||||
model it set. It holds the model the agent runs when neither the swarm nor
|
||||
`HIVE_DEFAULT_MODEL` (agent.nix) names one. Nothing in the harness
|
||||
writes it. Path overridable via `HYPERHIVE_MODEL_FILE`. Survives
|
||||
destroy/recreate, gone on `--purge`.
|
||||
|
||||
### `/harness/paused` (per agent)
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ Under `/var/lib/hyperhive/agents/<name>/`:
|
|||
tables above.
|
||||
- `hyperhive-events.sqlite` — turn-loop event log.
|
||||
- `hyperhive-turn-stats.sqlite` — per-turn timing stats.
|
||||
- `hyperhive-model` — single-line model name override file.
|
||||
- `hyperhive-model` — single-line model name file, read-only fallback.
|
||||
- `work/` — the agent's working space for git worktrees, build dirs
|
||||
and other large working data. Bind-mounted RW to
|
||||
`/agents/<name>/work` inside the container and owned by the agent
|
||||
|
|
|
|||
|
|
@ -20,14 +20,15 @@ swarmctl agent inference clear iris
|
|||
agent's `availableModels` as the models its subagent `start` and
|
||||
`continue` calls may name, read on each call
|
||||
([`subagent.md`](../tools/subagent.md#which-models-a-subagent-may-run-on)).
|
||||
The web UI's model picker doesn't use it.
|
||||
- `get` shows each field, naming the unset ones (or says the swarm sets
|
||||
nothing for the agent), and then the model and effort the agent reports
|
||||
running on, each with where it comes from.
|
||||
- `clear` removes every field; the agent goes back to its own values.
|
||||
|
||||
The full flag reference is [`swarmctl-cli.md`](../tools/swarmctl-cli.md). The
|
||||
swarm UI's agents page edits the same settings; see [UI](ui.md).
|
||||
swarm UI's agents page edits the same settings; see [UI](ui.md). The
|
||||
swarm is the only place to change an agent's model at runtime: its web UI
|
||||
shows the model but has no picker and no `/model` command.
|
||||
|
||||
## What an agent runs on
|
||||
|
||||
|
|
@ -47,11 +48,14 @@ Each running value names where it comes from:
|
|||
| ------------ | -------------------------------------------------------------------------- |
|
||||
| `swarm` | the value set here |
|
||||
| `agent_nix` | `services.hyperhive.agent.model` or `effortLevel` in the agent's agent.nix |
|
||||
| `local_file` | a `/model` or `/effort` pick in the agent's web UI |
|
||||
| `local_file` | an `/effort` pick in the agent's web UI, or a `hyperhive-model` file |
|
||||
| `default` | the harness's built-in default (`haiku`, `medium`) |
|
||||
|
||||
When the agent starts without a swarm value, its agent.nix model wins over
|
||||
its `/model` pick, and its `/effort` pick wins over its agent.nix effort.
|
||||
a `hyperhive-model` file, and its `/effort` pick wins over its agent.nix
|
||||
effort. A `hyperhive-model` file comes from a runtime model pick the
|
||||
agent's web UI no longer offers; the agent still reads it but never writes
|
||||
it.
|
||||
|
||||
The agent reports these whenever they change, and again once a minute.
|
||||
swarm-controller keeps only what it has received since it started, so for up
|
||||
|
|
@ -63,13 +67,13 @@ Each agent reads its settings every 10 seconds and switches on the next
|
|||
read: its next turn runs on the new model or effort, and its web UI badge
|
||||
shows it. A turn already running keeps what it started with.
|
||||
|
||||
- **Its own value is the one it runs without the swarm**, from a `/model`
|
||||
or `/effort` pick in its web UI or from its agent.nix. Setting a swarm
|
||||
- **Its own value is the one it runs without the swarm**: its agent.nix, an
|
||||
`/effort` pick in its web UI, or a `hyperhive-model` file. Setting a swarm
|
||||
value doesn't overwrite it.
|
||||
- **Clearing a field** (or the whole key) puts the agent back on its own
|
||||
value on the next read.
|
||||
- **A `/model` or `/effort` pick while the swarm sets that field** changes
|
||||
the agent's own value, but the swarm value comes back on the next read.
|
||||
- **An `/effort` pick while the swarm sets effort** changes the agent's own
|
||||
value, but the swarm value comes back on the next read.
|
||||
- **After a restart**, the agent runs its own values until its first read
|
||||
of its settings succeeds.
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ Queues and returns, the same way `agent create` does — watch the swarm UI's jo
|
|||
|
||||
Show or change the model, effort and subagent models the swarm sets for an agent.
|
||||
|
||||
A field the swarm sets wins over the agent's own value (from its `/model` or `/effort` pick or its agent.nix) from its next turn on; the agent reads its settings every ten seconds. A field the swarm doesn't set, or clears, leaves the agent on its own value.
|
||||
A field the swarm sets wins over the agent's own value (its agent.nix, its `/effort` pick, or a `hyperhive-model` file) from its next turn on; the agent reads its settings every ten seconds. A field the swarm doesn't set, or clears, leaves the agent on its own value.
|
||||
|
||||
**Usage:** `swarmctl agent inference <COMMAND>`
|
||||
|
||||
|
|
|
|||
|
|
@ -50,13 +50,12 @@ live, which managed scope would otherwise lock.
|
|||
The harness reads `<name>` from `Bus::model()` on each turn.
|
||||
`services.hyperhive.agent.model` in the agent's `agent.nix` sets the initial
|
||||
default (NixOS option; propagates via `HIVE_DEFAULT_MODEL` env var; falls
|
||||
back to `"haiku"` if unset). The operator can flip it at runtime
|
||||
with `/model <name>` in the web terminal — the next turn picks it
|
||||
up. The harness persists the choice to `/harness/hyperhive-model` so it
|
||||
survives restart; override path: `HYPERHIVE_MODEL_FILE` env var
|
||||
for tests. A model or effort the swarm sets for the agent replaces the
|
||||
`Bus` value, and the harness doesn't persist it; clearing it goes back to
|
||||
the persisted or nix value → [`swarm/inference.md`](../swarm/inference.md).
|
||||
back to an existing `/harness/hyperhive-model` file, then `"haiku"`, if
|
||||
unset). The swarm changes the model at runtime, not the web
|
||||
terminal: a model or effort the swarm sets for the agent replaces the
|
||||
`Bus` value from the next turn, and the harness doesn't persist it;
|
||||
clearing it goes back to the local value →
|
||||
[`swarm/inference.md`](../swarm/inference.md).
|
||||
|
||||
`harness_state::context_window_tokens(model)` looks up
|
||||
context-window size per-model. Resolution order (first
|
||||
|
|
|
|||
|
|
@ -47,15 +47,18 @@ at a given viewport width. Two columns:
|
|||
`◌ needs login` / `◌ logging in` / `○ offline` / `… connecting`.
|
||||
- **State badge**: `💤 idle` / `🧠 thinking` / `📦 compacting` /
|
||||
`○ offline` / `… booting` + age suffix.
|
||||
- **Model badge** (`model · <name> ▾`): a real picker — selecting it opens
|
||||
a `Dropdown` of `state.available_models`, selecting one POSTs
|
||||
`/api/model` immediately (same endpoint the `/model <name>` slash
|
||||
command uses). A header badge: the control and its display sit
|
||||
together.
|
||||
- **Effort badge** (`effort · <level> ▾`): same shape, `/api/effort`,
|
||||
shown when `state.available_efforts` is non-empty.
|
||||
- On an ACP agent both pickers list what its session offers (its
|
||||
`model` and `thought_level` config options), and are empty until the
|
||||
- **Model badge** (`model · <name>`): display only. Its tooltip says where
|
||||
the model comes from (`state.model_source`: set on the swarm, agent.nix,
|
||||
an existing `hyperhive-model` file, or the built-in default) and what the
|
||||
last turn resolved it to. The model is set on the swarm: the swarm UI's
|
||||
agents page, or `swarmctl agent inference set`
|
||||
([`inference.md`](../swarm/inference.md)).
|
||||
- **Effort badge** (`effort · <level> ▾`): a real picker — selecting it
|
||||
opens a `Dropdown` of `state.available_efforts` and POSTs `/api/effort`
|
||||
immediately. Shown when `state.available_efforts` is non-empty.
|
||||
- On an ACP agent the model badge shows the session's own model when it
|
||||
doesn't offer the requested one, and the effort picker lists the levels
|
||||
its session offers (its `thought_level` config option), empty until the
|
||||
first turn has attached a session. The effort picker is hidden when the
|
||||
model offers no effort levels, and while a newly picked model waits for
|
||||
the next turn, since the levels come with the model.
|
||||
|
|
@ -82,8 +85,8 @@ at a given viewport width. Two columns:
|
|||
(`GET /api/state`'s `links` field) also feeds
|
||||
`DashboardState.links` for the dashboard card's icon strip —
|
||||
`agent_links()` in hive-agent is the single source of truth for
|
||||
both. The dashboard link lives in this 🔗 popover; the model/effort
|
||||
pickers are real badges above; and `/new-session` / `/logout` are
|
||||
both. The dashboard link lives in this 🔗 popover; the effort picker
|
||||
is a real badge above; and `/new-session` / `/logout` are
|
||||
typed slash commands with their own type-twice confirm (see
|
||||
below).
|
||||
- `/cancel` (slash command, below) is the only cancel-turn path; the
|
||||
|
|
@ -234,10 +237,6 @@ Slash commands today:
|
|||
runs the `/compact` at the next turn boundary (end of the in-flight
|
||||
turn, or `turn::run_pending_compact` when idle); output streams into
|
||||
the live panel. Works mid-turn, not only when idle.
|
||||
- `/model <name>` — `POST /api/model` flipping `Bus::set_model`.
|
||||
Takes effect on the next turn; persisted to
|
||||
`/state/hyperhive-model` so the override survives harness
|
||||
restart / rebuild.
|
||||
- `/effort <level>` — `POST /api/effort` setting the claude effort
|
||||
level (`low` / `medium` / `high` / `xhigh` / `max`). Takes effect on the next
|
||||
turn. `StatusChips`' effort badge calls the same endpoint; both stay
|
||||
|
|
@ -276,17 +275,15 @@ shaped).
|
|||
turn — only the stdin payload differs). Flips state to
|
||||
`Compacting` via `Bus::set_state`, which emits
|
||||
`TurnStateChanged`.
|
||||
- `POST /api/model` (`model=<name>`) — switch the model for
|
||||
future turns. `Bus::set_model` emits `ModelChanged`.
|
||||
- `POST /api/effort` (`effort=<level>`) — switch the claude
|
||||
effort level for future sessions. Validated server-side against
|
||||
`EFFORT_LEVELS` (`low`/`medium`/`high`/`xhigh`/`max`) — unknown values are
|
||||
rejected rather than forwarded to `claude --effort`. Persists via
|
||||
`Bus::set_effort`, which emits `EffortChanged`. Applies on the next
|
||||
session start (no mid-session swap).
|
||||
- On an ACP agent, `/api/model` and `/api/effort` accept only values the
|
||||
session offers, and the runtime sets them with `session/set_config_option`
|
||||
before the next prompt.
|
||||
- On an ACP agent, `/api/effort` accepts only values the session offers,
|
||||
and the runtime sets the level with `session/set_config_option` before
|
||||
the next prompt.
|
||||
- `POST /api/new-session` — arm a one-shot for the next turn to
|
||||
drop `--continue`. Emits a `LiveEvent::Note`.
|
||||
- `POST /api/logout` — three-step teardown that re-uses the
|
||||
|
|
@ -320,7 +317,7 @@ shaped).
|
|||
the frontend (`useAgentState.ts`) on page load and, on a poll, while
|
||||
`status === 'needs_login_in_progress'`. Includes `turn_state`,
|
||||
`context_window_tokens`, `qualified_label`,
|
||||
`available_models`, `effort`, `available_efforts`, `links`, and
|
||||
`model`, `model_source`, `effort`, `available_efforts`, `links`, and
|
||||
other fields described inline throughout this document. All
|
||||
subsequent state updates arrive via SSE.
|
||||
- `GET /api/dashboard-state` — lean snapshot of agent-owned fields
|
||||
|
|
@ -392,7 +389,8 @@ Bus events (new vocabulary on `/events/stream`):
|
|||
`needs_login_idle` / `needs_login_in_progress`. Drives the
|
||||
alive-badge. The harness sets `rate_limited` when it detects a
|
||||
429 response and clears it when the retry sleep expires.
|
||||
- `model_changed { model }` — drives the model chip.
|
||||
- `model_changed { model }` — drives the model chip. The harness emits it
|
||||
when it applies or clears a swarm value.
|
||||
- `effort_changed { effort }` — drives the effort picker chip.
|
||||
Emitted from `Bus::set_effort` on `POST /api/effort`; applies on
|
||||
the next session start.
|
||||
|
|
|
|||
Loading…
Reference in a new issue