Skip to content

Add a Fleet dialog to manage machines, subscriptions and agents #36

Closed

Description

@HemSoft

Description

pmd stores the fleet as three tables, machines, subscriptions and agents, and exposes GET for each plus PUT with a write:fleet token (project-manager#49, Fleet config). The live API already returns four machines (air, home, laptop, mini) with maxSessions, capabilities, source and version. The dashboard shows none of it and cannot change it. Today max_sessions changes by editing pmd's config.toml on mini.

Rules the dialog must respect:

  • PUT replaces a row and needs every field. A machine has os, tailnetIp (string or null), maxSessions (0–64) and capabilities. A subscription has provider, plan ("" for none) and metered. An agent has model, subscription, roles and enabled, and its id is machine/provider/alias.
  • Create sends If-None-Match: *, replace sends If-Match: <version>. An unknown machine or subscription on an agent returns 400 unknown_machine or 400 unknown_subscription.
  • A PUT that changes a row turns its source from config to api, after which the file no longer touches it. There is no delete. Disable an agent with enabled: false and stop a machine with maxSessions: 0.

This issue adds a Fleet dialog under the Manage menu from #33.

Why

Franz wants to tune how many sessions each machine runs, retire a model, and add a new subscription without ssh-ing to mini. max_sessions is the setting he changes most, and it directly limits the Chief's parallel work.

Goal

One dialog with a tab each for Machines, Subscriptions and Agents lets a user view and edit every fleet row, including max_sessions, with the same conflict handling as the other dialogs.

Acceptance Criteria

  • Manage > Fleet… opens a dialog with Machines, Subscriptions and Agents tabs, each loaded from its GET list. Every row shows its source (config or api) so a user knows whether the file or the API owns it.
  • Machines: edit maxSessions (a number field, 0–64, with a short note that 0 starts none there), tailnetIp, os and capabilities. A machine can be added. The machine name is lower case a-z, 0-9 and -.
  • Subscriptions: add and edit provider, plan and metered. The id follows the same name rule.
  • Agents: add and edit model, subscription (a picker over existing subscriptions), roles and enabled. The id is built from a machine picker, a provider and an alias, and is read-only after creation. A quick Enable and Disable toggle sits in the row.
  • Capabilities and roles are free lower-case words with _, since pmd has no fixed list. The editor suggests the values in use now (linux, windows, apple, browser, computer_use; implement, review, research) and accepts new ones.
  • No delete action appears anywhere. The UI offers Disable for agents and maxSessions 0 for machines.
  • Save sends the full row with If-Match (edit) or If-None-Match: * (create). Unchanged saves are blocked in the UI, and pmd's no-op PUT result is handled without error.
  • 409 stale_version re-reads the row and shows "Changed elsewhere" with the user's edits next to the new values, with Reapply and Discard. 409 already_exists shows on the id field.
  • 400 unknown_machine, 400 unknown_subscription and other 400 codes show on the named field. Client-side checks catch the same cases first.
  • A create that times out is verified with GET before the dialog offers another attempt.
  • A short note on a row whose source is config says that saving makes it API-owned and the config file stops updating it.
  • Keyboard: tabs switch with Left and Right, rows with Up and Down, Enter edits, Ctrl+Enter saves, Esc closes with the unsaved-edit confirm. Tab order follows the visual order.
  • Without write:fleet, the dialog is read-only and names the missing scope.

Definition of Done

  • Fleet types, validation and the full-row PUT builder live in dashboard-core with unit tests, including a stub server for every status in the pmd table above.
  • UI tests cover each tab, maxSessions edit, agent enable and disable, create, the conflict flow and the read-only state.
  • README "Usage" documents the dialog.
  • cargo fmt --all --check, cargo clippy --workspace --all-targets --locked -- -D warnings and cargo test --workspace --locked pass.
  • The PR is reviewed and links this issue with Closes #n.

Validation

  • Run cargo test --workspace --locked and expect all new tests to pass.
  • Against a local pmd serve --config testdata/config.toml with a read,write:fleet token, change a machine's maxSessions from 3 to 2, confirm GET /v1/machines/{name} shows 2 and source: api, and confirm a pmd restart keeps 2.
  • Disable an agent in the dialog and confirm enabled: false from the API.
  • Change a row with curl -X PUT after opening the dialog, then save in the dialog and confirm the conflict state.
  • The PR embeds current-head screenshots in its ## Validation section, rendered with the headless capture test and uploaded as GitHub attachments. The states are: Machines tab, maxSessions edit, Subscriptions tab, Agents tab with an agent toggle, an Add agent form with an unknown-subscription error, the stale-version conflict, the config-source note, and the read-only state. Capture at the default window size and at 150% zoom. Add an inline recording of a maxSessions change, or state why it is omitted.
  • Keyboard-only editing is shown by the recording or UI tests. No manual screen-reader pass is required.

Activity

  1. HemSoft commented on Oct 27, 2026

    @HemSoft
    ContributorAuthor

    Released in v0.6.0 (Release run 40508104841: windows and publish passed; tag on e7612ae). The Chief installs it on home.

    • project-dashboard-0.6.0-windows-x64.zip: SHA-256 c4c438a8abdf1ea0dcd8864d5d0c1bdddf80ceb1c70e93a08fbc57c42f92674a, matching the published .sha256.
    • project-dashboard-0.6.0-windows-x64.zip.sha256
    • project-dashboard.exe inside the zip: SHA-256 896ea7f912cd5519e1f517837bac2676cf39ebb2ea9d09934802bd7945e2f3ad.

    The live pmd serve validation steps weren't run, since I didn't write to the production pmd. The write contract is covered by stub-server tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions