archetype flows behave like the built-ins: switch off per archetype or per agent, board cards, duplicate
The document's disabled list takes archetype:<archetype>/<flow> (off for every member) and the same with @<agent> (off for one member); a key naming nothing is ignored. GET /api/notify/flows lists the archetype flows with their members, the board draws a card for each with a switch, a checkbox per agent and duplicate, and the dry run counts their hits. The flows keep following the archetype.
This commit is contained in:
parent
1efbb72fdd
commit
68c24643f6
4 changed files with 908 additions and 102 deletions
|
|
@ -143,6 +143,28 @@ hyperhiveArchetypes.triage.meta.flows = [
|
|||
nothing.
|
||||
- Custom agents have no archetype and get no archetype flows.
|
||||
|
||||
### On the board
|
||||
|
||||
The notification router card on `/swarm` lists each archetype flow under
|
||||
**archetype flows**, tagged with its archetype and with the agents it applies to
|
||||
now, drawn as a graph with hit counts like the other flows. The flow follows
|
||||
the archetype: an edit to the archetype reaches the card and every agent
|
||||
within about 10 seconds, and the card has no `edit` button.
|
||||
|
||||
- **Switch off for the archetype.** The `on` switch on the card turns the flow
|
||||
off for every agent of the archetype, as for a built-in. It adds the key
|
||||
`archetype:<archetype>/<flow id>` to the router's list of switched-off flows.
|
||||
- **Switch off for one agent.** Each agent on the card has its own checkbox.
|
||||
Clearing it adds `archetype:<archetype>/<flow id>@<agent>` to the same list;
|
||||
the other agents keep the flow.
|
||||
- **Edit a copy.** `duplicate` opens the new-flow editor on a copy of the flow
|
||||
as a custom flow. The copy sends to the agent the archetype has when it has
|
||||
just one, and to nobody until you name an agent when it has more. A custom
|
||||
flow can also request a review, which an archetype's flow can't. Switch the
|
||||
archetype's flow off to replace it with your copy.
|
||||
- A key for a flow or agent that no longer exists stays in the list and does nothing, so
|
||||
editing an archetype never breaks the stored flows.
|
||||
|
||||
## How the list stays current
|
||||
|
||||
The swarm controller asks the builder for the list when the queue connects and
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@ domain, covers host-level detail for one hive.
|
|||
The swarm UI is a set of pages. Each one is a card list or a table you open in
|
||||
place, and every one reads from [`swarm-controller`](../../../swarm-controller/README.md):
|
||||
|
||||
| route | what |
|
||||
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `/` | the start page: the swarm's name over a digital-rain backdrop with the slug (`hyperhive / we are the wired`, its shaded gradients pulsing in a wave unless reduced motion is on) at the foot, plus a paperclip offering to set up an agent while no `ruth` exists, or her hive declares her destroyed (it opens the create form with `ruth` filled in and the `ruth` archetype picked); the swarm name in the header links here |
|
||||
| `/agents` | every agent as a card that opens in place (status, terminal, subagents, and settings with permissions, internet, allowed domains and accounts); create agents (with their permissions, optionally from an [archetype](archetypes.md)), link forge, matrix and GitHub accounts |
|
||||
| `/swarm` | what belongs to the whole swarm: a folded **hives** card with the hive directory and each hive's last reported status, a folded **egress** card with the swarm-wide allowed and denied domains, and a folded, **beta** **notification router** card (with a warning banner) holding the router's flows: a switch for each built-in, every flow drawn as a graph, and an editor for custom flows. `/notifications` redirects here |
|
||||
| `/agents/<name>/terminal` | one agent's live terminal |
|
||||
| `/agents/<name>/subagents/<subagent>/terminal` | one of that agent's subagents' live terminal |
|
||||
| `/reports` | three folded cards, each read only once opened: the **alerts** the swarm's Grafana holds now, the firing ones, with a button for the pending, no-data and error ones and a link to Grafana's own alert list; read through the controller with a Viewer service-account token, and a cross-repo **issues** list, and a cross-repo **pull requests** list |
|
||||
| `/jobs` | the controller's job graph, where agent creation and credential mints show progress, and under it the swarm builder's recent builds (agent config PRs, and agents built from `internal/meta` before a deploy), with what nix printed when one failed, and the review classifier's recent runs, a try-out on a real PR, and its settings and keys |
|
||||
| `/messages` | the swarm-wide message feed: every message between agents, and to them from the operator, reminders and compaction, with a history window and a filter on sender or recipient; a folded **broadcast** card above the feed sends one message to more than one agent at once, and a folded **schedules** card holds the scheduled prompts: add, edit, pause, resume and remove |
|
||||
| route | what |
|
||||
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `/` | the start page: the swarm's name over a digital-rain backdrop with the slug (`hyperhive / we are the wired`, its shaded gradients pulsing in a wave unless reduced motion is on) at the foot, plus a paperclip offering to set up an agent while no `ruth` exists, or her hive declares her destroyed (it opens the create form with `ruth` filled in and the `ruth` archetype picked); the swarm name in the header links here |
|
||||
| `/agents` | every agent as a card that opens in place (status, terminal, subagents, and settings with permissions, internet, allowed domains and accounts); create agents (with their permissions, optionally from an [archetype](archetypes.md)), link forge, matrix and GitHub accounts |
|
||||
| `/swarm` | what belongs to the whole swarm: a folded **hives** card with the hive directory and each hive's last reported status, a folded **egress** card with the swarm-wide allowed and denied domains, and a folded, **beta** **notification router** card (with a warning banner) holding the router's flows: a switch for each built-in, a card for each flow an archetype carries, every flow drawn as a graph, and an editor for custom flows. `/notifications` redirects here |
|
||||
| `/agents/<name>/terminal` | one agent's live terminal |
|
||||
| `/agents/<name>/subagents/<subagent>/terminal` | one of that agent's subagents' live terminal |
|
||||
| `/reports` | three folded cards, each read only once opened: the **alerts** the swarm's Grafana holds now, the firing ones, with a button for the pending, no-data and error ones and a link to Grafana's own alert list; read through the controller with a Viewer service-account token, and a cross-repo **issues** list, and a cross-repo **pull requests** list |
|
||||
| `/jobs` | the controller's job graph, where agent creation and credential mints show progress, and under it the swarm builder's recent builds (agent config PRs, and agents built from `internal/meta` before a deploy), with what nix printed when one failed, and the review classifier's recent runs, a try-out on a real PR, and its settings and keys |
|
||||
| `/messages` | the swarm-wide message feed: every message between agents, and to them from the operator, reminders and compaction, with a history window and a filter on sender or recipient; a folded **broadcast** card above the feed sends one message to more than one agent at once, and a folded **schedules** card holds the scheduled prompts: add, edit, pause, resume and remove |
|
||||
|
||||
An agent created here or with `swarmctl agent create` starts `paused`; set it
|
||||
`up` from its card. A card shows **login needed** when the agent's claude has no
|
||||
|
|
|
|||
|
|
@ -285,10 +285,34 @@ no archetype. The router reads the `agent-archetypes` record and the
|
|||
`agent-archetype` key of each agent in its roster at most every 10 seconds, when an event arrives, and runs
|
||||
each archetype's valid, enabled flows after the built-ins and the document's flows, for the
|
||||
archetype's agents. The router logs a flow it can't use and leaves it out. A read that fails keeps the archetype flows it had.
|
||||
Each runs under the id `<archetype>:<id>`, so its todos' source is
|
||||
`router:<archetype>:<id>`. A recipient not in the roster gets nothing, the same as a named agent that doesn't exist.
|
||||
Each runs under its key, `archetype:<archetype>/<id>`, which is its flow id in the log, the hit counts and a todo's source (`router:archetype:<archetype>/<id>`). A recipient not in the roster gets nothing, the same as a named agent that doesn't exist.
|
||||
A todo key is the dedupe key as for any flow: the same key from the operator's document replaces the archetype's todo.
|
||||
|
||||
**Switching an archetype flow off.** The document's `disabled_builtins` takes
|
||||
two more kinds of entry besides built-in ids: an archetype flow's key
|
||||
(`archetype:<archetype>/<id>`) switches it off for every member, and the key
|
||||
followed by `@<agent>` for that member only. The check accepts any key of that
|
||||
shape and doesn't ask whether the flow or agent exists, so an edit to an
|
||||
archetype can't make the stored document fail it; the router ignores a key that
|
||||
names nothing. The router applies the list to the archetype flows it has read
|
||||
(`archetype_flows::enabled`) before it runs them, and a flow with no member left
|
||||
isn't run. A controller that predates this refuses these keys with a 400, as
|
||||
it refuses any id that's no built-in.
|
||||
|
||||
**On the board.** `GET /api/notify/flows` also returns `archetype_flows`:
|
||||
`[{archetype, key, flow, members}]`, one per enabled archetype flow that passes
|
||||
the archetype check and has an agent, with the flow as the archetype declares it
|
||||
(a `todo` to `"members"`). The controller reads the archetype records and the
|
||||
`agent-archetype` keys itself; a read that fails leaves the list empty and the
|
||||
document still comes back. The page draws a card for each, with the `on` switch (the
|
||||
key), a checkbox per member (the key with `@<agent>`) and `duplicate`, which
|
||||
opens the editor on `?from=<key>`. The copy replaces `"members"` with the one
|
||||
member's name, or with an empty agent name when there are two or more, since the
|
||||
operator's document refuses `members`. Hit counts come from the dry run, which
|
||||
replays the archetype flows (as the router reads them now, less the document's
|
||||
switches) next to the document's, under their keys. A router that predates this answers a dry run
|
||||
with no entry for them, and the page shows zero hits.
|
||||
|
||||
**Deploying in any order.** The controller, the router and the UI can be on
|
||||
different hosts. A router that predates `request_reviewer` reads a document
|
||||
holding such a node (a custom flow with one) as one it can't read and keeps the
|
||||
|
|
|
|||
|
|
@ -381,6 +381,17 @@ it starts from on the left, the conditions after them, and the todo or review
|
|||
request each branch ends in. A box cuts a long line of text with an ellipsis;
|
||||
hover over the box to read all of it.
|
||||
|
||||
Between the built-ins and the custom flows, **archetype flows** lists the flows
|
||||
archetypes carry ([how an archetype gets them](../../2-handbook/swarm/archetypes.md#notification-flows)),
|
||||
one card each, from `archetype_flows` in `GET /api/notify/flows`. The card shows
|
||||
the archetype's name, an on/off switch, a checkbox for each agent the flow
|
||||
applies to, and **duplicate**; it has no **edit**, since the flow follows its
|
||||
archetype. The switch writes the key `archetype:<archetype>/<flow id>` into the
|
||||
document's `disabled_builtins`, and a checkbox the same key followed by `@<agent>`.
|
||||
**duplicate** opens the editor on a draft copy, sent to the archetype's one
|
||||
agent, or to no agent yet when it has more. A controller that predates
|
||||
`archetype_flows` leaves the group out.
|
||||
|
||||
A built-in flow has a **duplicate to edit** button and a custom flow has **edit**
|
||||
and **duplicate** buttons. **create flow**, at the top of the page beside the
|
||||
refresh interval, starts a custom flow with just a source. Creating and
|
||||
|
|
|
|||
Loading…
Reference in a new issue