Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/chief.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,12 @@ not type) with a `request_key`, it is no longer just refused. muster puts an
or "a turn you did not type" when muster cannot tell;
- its notification only opens the card: it has no answer buttons, because a
lock screen cannot show the brief. Answers from the phone's notification
actions are refused. Tap the card itself, in muster or in the phone app;
actions are refused. Tap the card itself, in muster or in the phone app.
**The one exception is a task a built-in officer filed**: its approval card's
notification on the paired phone carries **Approve and start** and **Don't
start**, each confirmed with the phone's step-up key, and its expanded body
names the task, where it runs, the repository and the brief's first line
([officers](officers-builtin.md#handing-a-task-to-the-chief-officer_task_handoff));
- its buttons are **Approve and start**, **Change repo** (when the repository
is the chief's to choose, not one its task names: it opens the repository
picker below, and the agent starts in the one you pick) and **Don't start**; when the chief left
Expand Down
61 changes: 60 additions & 1 deletion docs/officers-builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ to use it for such work; its charter says what to do with a `task.done` item.
When a task the officer filed needs an agent with a shell or a host, the
officer may hand it to its owner's **chief**:

- `officer_task_handoff{task_id, why}` (why: one line) takes only a task
- `officer_task_handoff{task_id, why}` (why: one line; `target` and `repo`
are [below](#naming-the-target-a-card-with-no-chief-turn)) takes only a task
**this officer filed** that is live and not complete — any other task
answers "no such task". A task is handed off **at most once**, and an
officer hands off **at most 3 a day**. Each hand-off is audited
Expand Down Expand Up @@ -886,6 +887,64 @@ officer may hand it to its owner's **chief**:
`dispatch_approve`, whose prompt merely points at an officer's task, is a
task-less start and is not refused.

##### Naming the target: a card with no chief turn

When the officer knows where the work must run, it adds `target` (and
`repo`):

- `officer_task_handoff{task_id, why, target, repo?}` takes the targets
`agent_dispatch` takes, named whole and needing no model:
`pod/claude-code`, or `host/<host>/claude` with `repo` (`owner/name`, a
repository the owner connected). The target is checked against what the
owner has **now** — an unknown host, a host that cannot start that runtime
now, a blank (`host/?/claude`), a runtime that needs a model
(`host/<host>/opencode`, `pod/gateway`) and a pod kind this server does not
enable are each refused in plain words naming the owner's targets, and
**nothing else is picked in its place**. A refused target records nothing:
the task's one hand-off and the day's 3 are not spent. `repo` without
`target` is refused too.
- With a target, muster does not put the hand-off to the chief. It files the
held dispatch and the owner's approval card **directly**, as the chief's
`agent_dispatch` on the task would (the same guards: the owner's opt-in,
the caps, at most 6 approval cards an hour), with **muster's own brief**:
which officer filed the task and why it needs an agent. The task's title
and text reach the agent after the brief, as on every start on a task. The
card says the officer handed it off and shows the task's title, its text
(the first 1,500 characters; the whole task is on the board) and the brief
whole. The hand-off is stamped delivered at once, so the sweep never puts
it to the chief; a card muster cannot file (the hourly cap, a repository
that is not connected) undoes the hand-off and the officer reads why.
- **The owner's answer is completed by muster**, with no chief turn and
whether or not the chief is running: **Approve and start** — in muster or
from the phone — runs `agent_dispatch` again as the chief, with the same
arguments rebuilt from the card's hold and the task, so the start is
bound to exactly what the card showed (single use, the same `request_key`,
every guard of a start). **Change repo** and a clone to choose open their
card as for the chief's own request, and their answer is completed the
same way. **Don't start** starts nothing and leaves the task on the board.
A start muster cannot make (a cap reached since, the opt-in withdrawn)
is shown on the card's answer with why; the officer is not told. ⚠ When the
card lapses unanswered (24 hours), the lapse note goes to the chief's chat
as for any dispatch card.
- **A changed task is never approved.** The card binds the task's title and
text as they were when it was filed. If either changed since, **Approve and
start** is refused on every door before it is recorded, the card stays
open, and the owner can choose **Don't start**; a change that lands after
the answer but before muster completes it is refused there too.
- Without a target everything above (the chief's turn) is unchanged.

##### Approving an officer's task from the phone

The approval card of **any** task a built-in officer
filed — the chief's own or a hand-off's — is pushed to the owner's paired
phone with two buttons, **Approve and start** and **Don't start**, each the
card's own signed answer, confirmed with the phone's step-up key
([push.md](push.md#paired-phones-payload-v2)). The phone's answer is taken exactly as a
tap in muster: the chief's card is completed by the chief's next call, a
hand-off's by muster. Every other approval card — a task nobody's officer
filed, a team's card, a repository or clone card — still refuses an answer
from the phone and opens the card, as before.

### People and outreach

A plugin bound to the officer can report **engagement** with its owner's
Expand Down
2 changes: 1 addition & 1 deletion docs/officers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ listing and again at dispatch):
| `officer_my_state` `{section?}`, `officer_confirm_card` `{draft_id \| batch_id}`, `officer_refusal_refile` `{item_id, when, at?}`, `officer_refusal_drop` `{item_id}` | **builtin pod officers only**: no HQ call. Its own state, and — in a chat with its owner on its page only — a confirm card for its owner to decide (a draft, a batch, or its page's Re-file or Drop of a refusal: the tools only propose) — see [Chat with it](officers-builtin.md#chat-with-it) |
| `officer_page_publish` `{title, blocks}` | **every officer** (HQ or builtin, pod or host, either pool): no HQ call. Publishes the officer's ONE page — made on the first call, a new version on every later one, whichever of its instances calls — shown on its screen in muster. Rolling and quiet: no notification. See [Its page](#its-page-officer_page_publish) |
| `officer_task_create` `{item_id, title, body}` | **every builtin officer** (pod or host, either pool; never an HQ officer): no HQ call. Files a task on the officer's owner's board, marked as the officer's and linking the item it came from; at most 5 a day and 10 open per officer, an identical open one answered instead. The officer then reads and comments on its OWN tasks with `tasks_list`, `task_get` and `task_comment`, and is queued a `task.done` item each time one is completed or dismissed — see [When it needs a person or a shell](officers-builtin.md#when-it-needs-a-person-or-a-shell-officer_task_create) |
| `officer_task_handoff` `{task_id, why}` | **every builtin officer**, beside `officer_task_create`: no HQ call. Hands a task the officer filed (live, not complete) to its owner's chief, at most once per task and 3 a day; muster puts it to the chief once, as a turn, and the chief's `agent_dispatch` raises the owner's approval card — nothing starts without the owner's tap. See [Handing a task to the chief](officers-builtin.md#handing-a-task-to-the-chief-officer_task_handoff) |
| `officer_task_handoff` `{task_id, why, target?, repo?}` | **every builtin officer**, beside `officer_task_create`: no HQ call. Hands a task the officer filed (live, not complete) on, at most once per task and 3 a day. Without `target` muster puts it to the chief once, as a turn, and the chief's `agent_dispatch` raises the owner's approval card; with `target` (`pod/claude-code`, or `host/<host>/claude` with `repo`, checked against the owner's targets now) muster files that card itself, with no chief turn. Nothing starts without the owner's answer to the card, in muster or from the phone. See [Handing a task to the chief](officers-builtin.md#handing-a-task-to-the-chief-officer_task_handoff) |
| `officer_ci_logs` `{pr}` | **shipping officers with a `ci_logs` block only**: no HQ call. GitHub and Kubernetes reads by muster-server; the failed CI tasks of the officer's OWN pull request, with log excerpts — see [`officer_ci_logs {pr}`](#officer_ci_logs-pr) |

### Its page (`officer_page_publish`)
Expand Down
20 changes: 20 additions & 0 deletions docs/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ until it is classified.
| filed an outbound draft its plugin passed | yes (`plugin`) | the draft's card (`/attention?tab=drafts#draft-<id>`) |
| filed a day's follows and likes | yes (`plugin`), one per batch | the batch's card (`/attention?tab=drafts#outreach-<…>`) |
| asked for a connector | yes (`connector`) | the request's card (`/connectors#connector-request-<id>`, or the team's page) |
| handed a task off with a target, or a task it filed reached an approval card | yes (`attention`), with **Approve and start** and **Don't start** on a paired phone ([below](#paired-phones-payload-v2)) | the approval card (`/attention/open/ask-<id>`) |
| its plugin refused a draft | no: the draft went back to the officer; its "awaits your approval" notification is withdrawn | — |
| its daily budget was reached (it is held for the day) | yes (`attention`), once per day | the officer's page (`/officers/<id>?owner=<owner>`), where the hold is lifted or the day's cap raised |
| its judgement pool is held by a refused cap escalation | yes (`attention`), once per hold; withdrawn when the hold ends | the officer's page, as above |
Expand Down Expand Up @@ -444,6 +445,25 @@ as **payload v2**:
([what a card shows](mirroring.md#what-a-card-shows)). A
browser's notification of it has no buttons that decide anything: a tap
opens muster.
- An **officer's task's approval card** (the approval card of an agent start
on a task a built-in officer filed: the chief's own, or one muster filed for
an officer's hand-off that named its target,
[officers-builtin.md](officers-builtin.md#naming-the-target-a-card-with-no-chief-turn))
is such an ask with exactly **two** buttons: its `ask.options` are **Approve
and start** and **Don't start**, and its `actions` are one `ask_answer` per
option and nothing else — no suggestion, no inline Answer, no Dismiss, even
after a fit. Its title is *Start an agent? · <officer>*; its body is four
lines — `Task #<id>: <title>`, `On: <where it runs>`, `Repo: <owner/name or
none>`, and the brief's first line (or, for a hand-off, the officer's why) —
with no options line. The challenge's `confirms` is that title and body, so
the step-up prompt shows what the tap decides. The signed answer is the
card's own answer, taken exactly as a tap in muster; the start stays bound
to the request the card shows whole (a hand-off card whose task changed
since refuses **Approve and start** on every door, and the card stays open). A tap
on the body still opens the whole card. **Every other approval card** — the
chief's on a task no officer filed, a team's, a repository or clone card —
carries no buttons and its answer from the phone is refused, as before. An
app that predates option buttons draws the notification as any ask's.
- A **connector request** (`connector`, an agent asking for a connector) carries
`actions` too: `connector_approve` (**Approve**) and `connector_deny`
(**Deny**), each with its `label` and the request's id as `target`. A tap
Expand Down
2 changes: 1 addition & 1 deletion docs/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ buys only a word.
| `0205` | [An officer's daily limit](officers-builtin.md#an-officers-page): `officer_defs.daily_limit_usd` (nullable, 0 to 1000 by `officer_defs_daily_limit_usd_check`), the daily spending limit its owner — or a manager of its team — set on the officer's page. NULL is none, so the declared `daily_budget_usd` (`MUSTER_OFFICERS`) applies, as before; a value takes precedence over it, and 0 is no limit. Every reader of a budget (the wake loop, the claim, a raise, the pages) applies it with today's raise (`0157`) through one rule (`officers.Officer.DailyBudget`). A change is audited (`officer.daily_limit`). No row-level security change: one column on `0118`'s owned def, under its policies and `0127`'s share class; `db.RLSOn` re-applies `0118`'s body, which never drops it. Rollback: an older image never reads the column (each officer goes back to its declared budget); the statements are in the migration's header. |
| `0206` | [An ask's reference cards and an escalation's question](attention.md#reference-cards): `attention_asks.refs` (a JSON array of at most 5 `{"kind", "id"}` or `{"kind": "post", "url"}` pointers, `attention_asks_refs_shape`; drawn live under the viewer's own principal) and `officer_items.escalation` (a builtin officer's escalating complete's question, why, options and refs, `officer_items_escalation_shape`), both NULL before it. No row-level security change: two columns on owned tables, under `0025`/`0127`'s and `0118`/`0130`'s policies. Rollback: an older image never reads either column (asks show the question alone, an escalation is raised from its summary); the statements are in the migration's header. |
| `0207` | [The chief on a host](design/three-components.md#the-chief-on-a-host): `chief_preferences.host` (the machine the owner chose for their chief, `''` for none) and the chief's spawn record, `spawn_id` (drawn from `host_dispatches`' sequence, like `0125`'s officer spawns), `spawn_window`, `spawn_session`, `spawn_refusal` and `spawned_at` (what the host's reply named). A mirrored call reaches the chief's tools only from that host, window and session. Written only with `MUSTER_CHIEF_RUNTIME=host`. `chief_preferences_host_shape` bounds them, and a record always names a host. No row-level security change: columns on `0060`'s owned table, under its policy. Rollback: an older image never reads the columns; the statements are in the migration's header. |
| `0208` | `officer_task_handoffs`: one row per task a builtin officer handed to its owner's chief with [`officer_task_handoff`](officers-builtin.md#handing-a-task-to-the-chief-officer_task_handoff) — `owner_id` (the officer's owner, the task's owner), `officer`, `task_id` (FK to `notes`, `ON DELETE CASCADE`), the `instance` that handed it off, its one-line `why` (1 to 500 characters), `created_at`, and `chief_turn_at`, stamped once by the conditional UPDATE that puts it to the chief as a turn (NULL while it waits for the sweep). `UNIQUE (owner_id, task_id)`: a task is handed off at most once. Owned, under forced row-level security (personal), re-applied by `db.RLSOn`. Rollback: an older image never reads it; the statements are in the migration's header. |
| `0208` | `officer_task_handoffs`: one row per task a builtin officer handed to its owner's chief with [`officer_task_handoff`](officers-builtin.md#handing-a-task-to-the-chief-officer_task_handoff) — `owner_id` (the officer's owner, the task's owner), `officer`, `task_id` (FK to `notes`, `ON DELETE CASCADE`), the `instance` that handed it off, its one-line `why` (1 to 500 characters), `created_at`, and `chief_turn_at`, stamped once by the conditional UPDATE that puts it to the chief as a turn (NULL while it waits for the sweep); a hand-off that [named its target](officers-builtin.md#naming-the-target-a-card-with-no-chief-turn) is stamped before muster files the owner's card instead, so the sweep never puts it to the chief, and its row is deleted when that card cannot be filed. `UNIQUE (owner_id, task_id)`: a task is handed off at most once. Owned, under forced row-level security (personal), re-applied by `db.RLSOn`. Rollback: an older image never reads it; the statements are in the migration's header. |
| `0209` | [The chief on a host](design/three-components.md#as-built-pr-5b): `plugin_messages.status` may be `refused`, a message whose turn the chief's window can never take (the paste refuses its text). Nothing was typed, so it is not `unconfirmed`, and it is never queued again. Written only with `MUSTER_CHIEF_RUNTIME=host`. Only `plugin_messages_status_check` changes; no row-level security change. Rollback: the statements are in the migration's header. |

To change the schema, add a new numbered file.
Expand Down
36 changes: 34 additions & 2 deletions internal/api/attention.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ type attentionItem struct {
// noActions: its notification offers no chips and no signed answer
// actions (a chief proposal's card, proposalCardFiled). Not serialised.
noActions bool
// optionsOnly: its notification's only buttons are its options, each a
// signed answer — no inline Answer, no Dismiss, no suggestion (an
// officer's task's dispatch card: officerCardItem). Its title is
// pushTitle and its body pushText, whole lines, no options line. Not
// serialised.
optionsOnly bool
// pushTitle, when set, is the notification's title (optionsOnly's card).
pushTitle string
// showSession is an officer's ask's "Show session" button on its
// officer's page (officer_origin.go), "" everywhere else. Not serialised.
showSession string
Expand Down Expand Up @@ -1227,6 +1235,8 @@ func attentionNotification(it attentionItem, update bool) RouterNotification {
// The signed ask actions are routed wherever the asks are
// (device_actions.go): this item is one, so they are offered.
n.AskActions = true
// An officer's task's dispatch card: its two buttons only.
n.AskOptionsOnly = it.optionsOnly
}
return n
}
Expand All @@ -1253,6 +1263,10 @@ const sessionPushTitle = "A session is waiting on you"
// title, plained once at the sink, goNotify); a waiting session's fixed
// sessionPushTitle.
func attentionPushTitle(it attentionItem) string {
if it.pushTitle != "" && it.Kind == attentionKindAsk {
// An officer's task's dispatch card names what it asks to do.
return it.pushTitle
}
if it.stepUp != nil && it.Kind == attentionKindAsk {
// A step-up card names what it asks to do ("Post to X?").
return stepUpTitleText(it.stepUp)
Expand Down Expand Up @@ -1304,7 +1318,7 @@ const (
// before notifyName's decorated one. "" (the title as it is) for no window, or
// for an ask, question or notice with no human name.
func attentionCodenameTitle(it attentionItem) (title, keep string) {
if it.stepUp != nil && it.Kind == attentionKindAsk {
if (it.stepUp != nil || it.pushTitle != "") && it.Kind == attentionKindAsk {
// A step-up card is muster's own: no window to name.
return "", ""
}
Expand Down Expand Up @@ -1393,6 +1407,18 @@ func attentionPushBody(it attentionItem) string {
// line (Confirm and Refuse are the notification's own buttons).
return push.CutClusters(pushLine(it.pushText), attentionPushBodyMax)
}
if it.optionsOnly && it.pushText != "" && it.Kind == attentionKindAsk {
// An officer's task's dispatch card: its lines (task, where, repository,
// brief), each one line, no options line (Approve and start and Don't
// start are the notification's own buttons).
var parts []string
for _, l := range strings.Split(it.pushText, "\n") {
if l = pushLine(l); l != "" {
parts = append(parts, l)
}
}
return push.CutClusters(strings.Join(parts, "\n"), attentionPushBodyMax)
}
opts := ""
listed := it.Options
if it.Kind == attentionKindQuestion {
Expand Down Expand Up @@ -2571,7 +2597,13 @@ func (s *Server) answerAskFrom(ctx context.Context, id int64, answer string, src
// A chief's dispatch APPROVAL card (dispatch_approval.go): never answered
// from the phone's notification action, which cannot show the brief —
// refused before anything is recorded or done; the card stays open.
if err := s.approvalSurfaceRefusal(ctx, id); err != nil {
if err := s.approvalSurfaceRefusal(ctx, id, answer); err != nil {
return a, err
}
// An officer's hand-off card whose task changed since it was filed
// (officer_card.go): its approval is refused on every door, the
// card left open, because the brief it shows is no longer what would start.
if err := s.handoffCardRefusal(ctx, id, answer); err != nil {
return a, err
}
// A Release option of a routed task's ask (answer_release.go): checked
Expand Down
Loading
Loading