feat(plugins): a model settings field — any model or agent preset — plus machine pickers, units, groups and a readable Status #64

Closed
gabrielvidal wants to merge 0 commits from model-field into main
pull from: model-field
Owner

Summary

A plugin that uses a model now gets one generic settings field for it: "type": "model" takes any model or agent preset as one value (preset:<id> or a Settings → Models key), drawn with the composer's picker. Before, plugins asked for a free-text model (sonnet) and Agent presets kept a separate per-plugin preset that never applied: auto-ship, auto-translate and approvals always send a harness, so their source default was dead. The same PR improves the declarative settings page for every plugin: machines picked by name, number units, section headings, and a readable Status card instead of raw JSON. It also lets an app.modal opt into the command palette (auto-ship's Ship now).

Ship it in the same batch as #62 (conversation-titles, which merges cleanly on its own; this branch contains it, so merging this one lands #62 too — either order works) — built on it (complete.run presets, run_router.sources()). It pairs with ai-agent-plugins #62, which needs this core first (its manifests use the new field types).

Key changes

  • backend/plugins/manifest.py: field types model (uses: runs|complete, effortKey), worker, workers; unit, group, placeholder extras (written only when set); ui.settingsHtmlFirst; app.modal slots' palette. check_config() validates the typed values on save (PUT /api/plugins/{id} → 400 naming the field).
  • backend/models/presets.py: route_key(value): a model key or listed id → {key, harness, model, effort}, as the composer's pick runs it (an exact pair id such as evox2/qwen… wins).
  • backend/plugins/hubruns.py: with_model_route(): a runs.start body with a model and no harness gets the key's harness and preset effort. Presets, unlisted models and bodies naming a harness are unchanged.
  • backend/plugins/hubcomplete.py: model_value(): model: "preset:<id>" is that preset; a bare key gets its harness.
  • backend/plugins/run_router.py: model_fields(); sources() carries each plugin's model fields with their current value. A complete.run plugin with a model field is a source.
  • Frontend: PluginModelField (Presets / Models tabs, a Default reset, effort chips for a plain model), PluginWorkersField (machine chips by name; an unknown id stays visible, struck through), PluginStatusCard, and PluginSettingsPage drawing groups, units and the custom view first when asked. business/keyboard/commands.ts lists palette: true modals.
  • docs/plugins.md: new Settings fields section. backend/core/i18n_keys/ui.json regenerated.

Key decisions

  • The value is one string, handed to the hub as is. Plugins don't resolve models themselves: core does it at runs.start / complete.run, so every plugin gets the same "the model decides its harness" behaviour as the composer.
  • The choice lives in the plugin's own settings (Gabriel's pick). Agent presets lists it read-only with Change ›; the plugins-repo PR does that side.
  • Inferring the harness for a model with none changes nothing for Claude keys unless Settings → Models moved them (the composer follows that too). Before, a non-Claude model sent without a harness ran Claude Code and failed.
  • Status card: every number and every dict of numbers becomes a chip, and the rest goes behind Details. That's generic, so Conversation Labels no longer dumps its model list on the page.
  • Out of scope: per-item pickers (cron jobs, mail-agents, Send later, Conversation Labels' custom page) need a sandbox bridge for this picker. That's phase 2.

Changelog

  • Added: plugin settings can ask for "any model or agent preset" with the composer's picker (Presets and Models tabs, effort for a plain model)
  • Added: plugin settings pick machines by name, show units (min, h) and group their fields under headings
  • Added: plugins can put a modal in the command palette
  • Changed: a plugin's Status is shown as a summary with counts; the raw answer is under Details
  • Changed: a plugin run or one-shot answer on a model without a harness now runs on the harness Settings → Models gives that model

Test notes

  • Backend: new test_plugin_model_field.py (20 tests: manifest types and refusals, check_config, route_key, with_model_route, model_value, sources). The touched modules' suites pass (test_hubcomplete, test_run_router, test_i18n, every test_plugin* / test_hub*), run per module under bwrap with a throwaway /data. test_typed_plugins fails with the same git-clone error on main.
  • Frontend: tsc clean. Full vitest: 190 files, 1244 tests pass after UPDATE_I18N_KEYS=1. The new PluginModelField.test.tsx covers value labels, the Status card and palette modals.
  • Live: a sandboxed local hub on the EVOX2 built from this branch with the plugins branch installed. Real picker, saves (a preset saved, a bad model and a bad machine list refused with both fields named), Ship now (asks once, then "already asked"), the Waiting card, the palette entry and the conversation menu. Screenshots below come from that hub with seeded PRs and a stand-in EVOX2 worker.
  • Not deployed: deploy from the Homelab after review (ai-agent-deploy), then reload the plugins from the paired PR.

🤖 Generated with Claude Code

Screenshots

picker-models.png
picker-preset-picked.png
new-auto-ship-desk.png
new-labels-status.png
now-conversation-labels-desk.png
palette-search.png

## Summary A plugin that uses a model now gets one generic settings field for it: `"type": "model"` takes **any model or agent preset** as one value (`preset:<id>` or a Settings → Models key), drawn with the composer's picker. Before, plugins asked for a free-text model (`sonnet`) and Agent presets kept a separate per-plugin preset that never applied: auto-ship, auto-translate and approvals always send a harness, so their source default was dead. The same PR improves the declarative settings page for every plugin: machines picked by name, number units, section headings, and a readable Status card instead of raw JSON. It also lets an `app.modal` opt into the command palette (auto-ship's *Ship now*). **Ship it in the same batch as #62** (conversation-titles, which merges cleanly on its own; this branch contains it, so merging this one lands #62 too — either order works) — built on it (`complete.run` presets, `run_router.sources()`). It pairs with **ai-agent-plugins #62**, which needs this core first (its manifests use the new field types). ## Key changes - `backend/plugins/manifest.py`: field types `model` (`uses: runs|complete`, `effortKey`), `worker`, `workers`; `unit`, `group`, `placeholder` extras (written only when set); `ui.settingsHtmlFirst`; `app.modal` slots' `palette`. `check_config()` validates the typed values on save (`PUT /api/plugins/{id}` → 400 naming the field). - `backend/models/presets.py`: `route_key(value)`: a model key or listed id → `{key, harness, model, effort}`, as the composer's pick runs it (an exact pair id such as `evox2/qwen…` wins). - `backend/plugins/hubruns.py`: `with_model_route()`: a `runs.start` body with a model and no harness gets the key's harness and preset effort. Presets, unlisted models and bodies naming a harness are unchanged. - `backend/plugins/hubcomplete.py`: `model_value()`: `model: "preset:<id>"` is that preset; a bare key gets its harness. - `backend/plugins/run_router.py`: `model_fields()`; `sources()` carries each plugin's model fields with their current value. A `complete.run` plugin with a model field is a source. - Frontend: `PluginModelField` (Presets / Models tabs, a *Default* reset, effort chips for a plain model), `PluginWorkersField` (machine chips by name; an unknown id stays visible, struck through), `PluginStatusCard`, and `PluginSettingsPage` drawing groups, units and the custom view first when asked. `business/keyboard/commands.ts` lists `palette: true` modals. - `docs/plugins.md`: new *Settings fields* section. `backend/core/i18n_keys/ui.json` regenerated. ## Key decisions - **The value is one string, handed to the hub as is.** Plugins don't resolve models themselves: core does it at `runs.start` / `complete.run`, so every plugin gets the same "the model decides its harness" behaviour as the composer. - **The choice lives in the plugin's own settings** (Gabriel's pick). Agent presets lists it read-only with *Change ›*; the plugins-repo PR does that side. - **Inferring the harness for a model with none** changes nothing for Claude keys unless Settings → Models moved them (the composer follows that too). Before, a non-Claude model sent without a harness ran Claude Code and failed. - **Status card:** every number and every dict of numbers becomes a chip, and the rest goes behind *Details*. That's generic, so Conversation Labels no longer dumps its model list on the page. - **Out of scope:** per-item pickers (cron jobs, mail-agents, Send later, Conversation Labels' custom page) need a sandbox bridge for this picker. That's phase 2. ## Changelog - Added: plugin settings can ask for "any model or agent preset" with the composer's picker (Presets and Models tabs, effort for a plain model) - Added: plugin settings pick machines by name, show units (min, h) and group their fields under headings - Added: plugins can put a modal in the command palette - Changed: a plugin's Status is shown as a summary with counts; the raw answer is under Details - Changed: a plugin run or one-shot answer on a model without a harness now runs on the harness Settings → Models gives that model ## Test notes - Backend: new `test_plugin_model_field.py` (20 tests: manifest types and refusals, `check_config`, `route_key`, `with_model_route`, `model_value`, sources). The touched modules' suites pass (`test_hubcomplete`, `test_run_router`, `test_i18n`, every `test_plugin*` / `test_hub*`), run per module under bwrap with a throwaway `/data`. `test_typed_plugins` fails with the same git-clone error on `main`. - Frontend: `tsc` clean. Full vitest: 190 files, 1244 tests pass after `UPDATE_I18N_KEYS=1`. The new `PluginModelField.test.tsx` covers value labels, the Status card and palette modals. - Live: a sandboxed local hub on the EVOX2 built from this branch with the plugins branch installed. Real picker, saves (a preset saved, a bad model and a bad machine list refused with both fields named), *Ship now* (asks once, then "already asked"), the Waiting card, the palette entry and the conversation menu. Screenshots below come from that hub with seeded PRs and a stand-in EVOX2 worker. - Not deployed: deploy from the Homelab after review (`ai-agent-deploy`), then reload the plugins from the paired PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Screenshots ![picker-models.png](https://git.gabvdl.xyz/attachments/fbed7948-8c47-4165-ae8d-32f9a3208a91) ![picker-preset-picked.png](https://git.gabvdl.xyz/attachments/e06516c6-3279-47ba-b702-1901ff3987ea) ![new-auto-ship-desk.png](https://git.gabvdl.xyz/attachments/ffef2840-110c-4892-b304-eb6f5798e9b1) ![new-labels-status.png](https://git.gabvdl.xyz/attachments/41c50402-36e3-45d3-81bb-e73ab73af348) ![now-conversation-labels-desk.png](https://git.gabvdl.xyz/attachments/7a9eac5b-85f2-4771-8252-4cddb6c6c6d5) ![palette-search.png](https://git.gabvdl.xyz/attachments/8bbb4791-ef84-4150-9b3e-8f39b8dfab01)
gabrielvidal self-assigned this 2026-12-02 23:07:27 +01:00
gabrielvidal added 3 commits 2026-12-02 23:07:27 +01:00
agy and pi name nothing themselves (Claude Code writes ai-title, opencode's
mirror its session title), so their cards read the first prompt. Core side
of the conversation-titles plugin:

- meta.autoTitle: cards._conv_title reads it like Claude's own title — the
  owner's rename, the agent's conv title and a resource title win, it beats
  the first prompt.
- conversations.label bridges: GET hub/labels/untitled?harness=agy,pi
  (conversations/title_pending.py — sid answers from the meta's harness
  before the transcript is indexed) and POST hub/labels/title (an empty
  answer is stored as null — never asked again — but never replaces a title).
- complete.run on an agent preset: preset "default" (the source's preset in
  Settings → Agent presets) or "<id>", resolved by the runs.route provider on
  the call's profile; the plugin's own model becomes the fallback and answers
  alone with no preset set. GET hub/complete/route: that route, no call.
- run_router.sources(): complete.run holders naming the routing provider in
  requires / optionalRequires are listed as sources (uses: complete).
- conversation.started carries the run's harness.
- docs/plugins.md + CLAUDE.md; tests in test_hubcomplete, test_run_router,
  test_plugin_deps_agents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- settings.fields[].type model (uses runs|complete, effortKey), worker,
  workers; unit on numbers, group headings, placeholder; a save checks the
  typed values (manifest.check_config, PUT /api/plugins/{id} → 400)
- runs.start: a model key without harness runs where Settings → Models puts
  it (hubruns.with_model_route → models.presets.route_key); complete.run takes
  model: "preset:<id>" and a bare key the same way (hubcomplete.model_value)
- run_router.sources(): each plugin's model fields with their value, for
  Agent presets' Plugins that use a model
- settings page: PluginModelField (Presets / Models tabs, effort chips),
  PluginWorkersField, PluginStatusCard (message + count chips, JSON behind
  Details), ui.settingsHtmlFirst
- an app.modal slot with palette: true is listed by the command palette
- docs/plugins.md: Settings fields section; tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gabrielvidal added 1 commit 2026-12-02 23:45:23 +01:00
Author
Owner
Merged into `main` as 82ed859b by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/01a2390d-9150-7154-a571-1e75ba9e953f.
gabrielvidal closed this pull request 2026-12-03 00:34:50 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gabrielvidal/ai-agent#64