swarm-ui: make agent creation a five-step dialog with a fixed header and footer
The create dialog was one tall form that scrolled as a whole, so its header and button moved out of view. It is now steps you go through in order: identity, instructions (AGENTS.md in a box of its own), permissions, resources and inference, then a summary of what will be sent and what the agent creation queues, where create is. The header, step tabs and footer stay put and only the step's own fields scroll. A refused AGENTS.md text sends the dialog back to its step. The request is unchanged.
This commit is contained in:
parent
f0a80c9812
commit
339da0aebe
7 changed files with 662 additions and 246 deletions
|
|
@ -527,18 +527,41 @@ restarts the agent after its current turn. The panel reads
|
|||
the reason and a **retry** button. `swarmctl agent permissions set` sets the
|
||||
same grant from a shell.
|
||||
|
||||
### Creating an agent
|
||||
|
||||
The **+ agent** button opens a dialog of five steps, which you go through in
|
||||
order with **next** and can step back through with **back** or the step tabs:
|
||||
|
||||
1. **identity**: the name, the hive, and optionally an
|
||||
[archetype](archetypes.md) that fills in the settings of the steps after it.
|
||||
**next** waits for a valid name (1-63 lowercase letters, digits and hyphens)
|
||||
and a hive.
|
||||
2. **instructions**: the text the agent's `AGENTS.md` starts with, in a box
|
||||
of its own.
|
||||
3. **permissions**: one checkbox per permission, starting from the default set
|
||||
or the archetype's.
|
||||
4. **resources and inference**: the optional resource caps and inference
|
||||
settings.
|
||||
5. **summary**: every setting the request will carry, and what stays at its
|
||||
default, then **what this creates**. **create** is on this step only.
|
||||
|
||||
The header, the step tabs and the buttons stay in place and only the step's own
|
||||
fields scroll, so a long step never pushes **next** out of view. After
|
||||
**create**, the dialog says it queued the job and links to **jobs**, and offers
|
||||
**create another** and **close**. If the controller refuses the `AGENTS.md` text,
|
||||
the dialog goes back to step 2 and shows the reason there.
|
||||
|
||||
### Settings at creation
|
||||
|
||||
The **+ agent** dialog has two collapsed sections, **resource caps** and
|
||||
**inference**, with the same fields as the detail panel's editors. Leave the
|
||||
fields empty and the request is the plain name and hive; collapsing a section doesn't
|
||||
withdraw what you typed in it. Fill them and `POST /api/agents` carries them
|
||||
Step 4 of the **+ agent** dialog has **resource caps** and **inference**, with
|
||||
the same fields as the detail panel's editors. Leave the
|
||||
fields empty and the request is the plain name and hive. Fill them and `POST /api/agents` carries them
|
||||
as optional `limits` and `inference` objects, the same shapes the two `PUT`
|
||||
routes take. The controller checks them with the `PUT` rules before it queues
|
||||
anything, so a bad value gets a refusal with its reason and creates no agent.
|
||||
|
||||
The dialog loads the hive list and the permission list when it opens. If either
|
||||
load fails, the dialog shows the reason in an error panel above the fields, and
|
||||
load fails, the dialog shows the reason in an error panel above the step's fields, and
|
||||
the hive picker or the permissions area reads `could not load hives` or
|
||||
`could not load permissions` in place of `loading…`.
|
||||
|
||||
|
|
@ -550,14 +573,14 @@ stored settings when you leave the fields empty.
|
|||
|
||||
### Initial AGENTS.md at creation
|
||||
|
||||
A third collapsed section, **instructions**, holds a plain text box for the
|
||||
Step 2, **instructions**, holds a plain text box for the
|
||||
text the new agent's `AGENTS.md` starts with. Left empty, or holding only
|
||||
whitespace, it sends nothing and the agent starts without the file. Otherwise
|
||||
the text goes as typed in the optional `agents_md` field of `POST /api/agents`.
|
||||
The agent writes it on its first start, and only when it has no `AGENTS.md`
|
||||
yet, so creating an agent again under a name that has one never replaces it.
|
||||
The controller refuses a text over 64 KiB. Its reason shows under the
|
||||
section, open or not, and the swarm creates no agent. After a successful
|
||||
box, and the swarm creates no agent. After a successful
|
||||
create the box empties. The
|
||||
[instructions editor](#editing-an-agents-instructions) changes the file later.
|
||||
The [swarm README](README.md#an-agents-agentsmd) has the wire details.
|
||||
|
|
|
|||
Loading…
Reference in a new issue