@openmuster/muster 0.3.1-alpha.4 → 0.3.1-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +11 -7
  2. package/dist/{args-9ZZDcPxa.js → args-CaFBa2IP.js} +305 -23
  3. package/dist/cli.js +3 -3
  4. package/dist/index.d.ts +98 -19
  5. package/dist/index.js +107 -42
  6. package/dist/inspect/app.js +49 -26
  7. package/dist/{main-Doit2DDY.js → main-3kE64MlN.js} +195 -12
  8. package/dist/main-o4m_lGDG.js +6 -0
  9. package/dist/mcp-D6Xt2ixk.js +6 -0
  10. package/dist/{module-DjDMSEKu.js → module-BX2IjSiv.js} +2 -2
  11. package/dist/{module-D8qcE3e7.js → module-D9KdbEpS.js} +1 -1
  12. package/dist/skills/board/SKILL.md +5 -0
  13. package/dist/skills/loop-card/SKILL.md +22 -3
  14. package/dist/{steps-BUPRIOe3.js → steps-cnWo2Wvx.js} +299 -12
  15. package/docs/01-concepts/09-watchers.md +4 -32
  16. package/docs/01-concepts/10-schedules.md +1 -1
  17. package/docs/01-concepts/11-access.md +19 -3
  18. package/docs/01-concepts/13-budgets.md +66 -3
  19. package/docs/01-concepts/15-outgoing-webhooks.md +6 -19
  20. package/docs/01-concepts/16-workflows.md +42 -2
  21. package/docs/01-quickstart.md +74 -45
  22. package/docs/02-sync/01-overview.md +34 -2
  23. package/docs/02-sync/02-github.md +40 -19
  24. package/docs/02-sync/03-linear.md +103 -85
  25. package/docs/02-sync/04-slack.md +116 -111
  26. package/docs/02-sync/05-notion.md +46 -25
  27. package/docs/03-guides/01-coding-agents.md +51 -33
  28. package/docs/03-guides/02-swarm.md +30 -15
  29. package/docs/03-guides/03-factory.md +193 -80
  30. package/docs/03-guides/04-inspector.md +73 -42
  31. package/docs/03-guides/05-running-agents.md +62 -35
  32. package/docs/03-guides/06-sandboxed-agents.md +535 -305
  33. package/docs/03-guides/07-build-a-ui.md +86 -31
  34. package/docs/03-guides/08-ci.md +59 -36
  35. package/docs/03-guides/09-daemon.md +121 -53
  36. package/docs/03-guides/10-two-agents.md +31 -22
  37. package/docs/03-guides/11-person-in-the-loop.md +47 -34
  38. package/docs/03-guides/12-unattended.md +46 -27
  39. package/docs/03-guides/13-terminals.md +51 -39
  40. package/docs/03-guides/14-no-cloud.md +31 -19
  41. package/docs/03-guides/15-several-boards.md +61 -27
  42. package/docs/03-guides/16-non-code.md +29 -18
  43. package/docs/03-guides/17-mcp.md +37 -30
  44. package/docs/03-guides/18-a-board-on-a-server.md +66 -43
  45. package/docs/03-guides/19-a-card-queue.md +210 -121
  46. package/docs/03-guides/20-a-feedback-loop.md +412 -135
  47. package/docs/03-guides/21-running-the-loop.md +94 -64
  48. package/docs/03-guides/22-building-from-linear.md +100 -63
  49. package/docs/04-reference/01-cli.md +7 -0
  50. package/docs/04-reference/02-handle.md +11 -15
  51. package/docs/04-reference/03-http.md +1 -1
  52. package/docs/04-reference/04-events.md +2 -1
  53. package/docs/04-reference/05-errors.md +6 -0
  54. package/docs/04-reference/08-files.md +49 -0
  55. package/docs/index.md +1 -0
  56. package/package.json +1 -1
  57. package/dist/main-D5aX7Jaj.js +0 -6
  58. package/dist/mcp-Cm96TIb3.js +0 -6
@@ -1,12 +1,15 @@
1
1
  ---
2
2
  title: Build a UI
3
- description: For building your own page over a board in TypeScript. Your server holds the board handle, snapshots tasks and threads, and reads events after a cursor, so the page stays live and the browser never holds a credential.
3
+ description: For developers building their own page over a board in TypeScript. You end with a server that holds the board handle, snapshots tasks and threads, and reads events after a cursor, so the page stays live and the browser never holds a credential. Your app can also serve the board itself with team.fetch.
4
4
  ---
5
5
 
6
- ## A handle, on the server
6
+ ## Hold the board handle on your server
7
7
 
8
- The browser never holds the board's credential. Your server holds a handle and
9
- answers the page through it.
8
+ The browser never holds the board's credential. Your server holds a
9
+ [handle](../04-reference/02-handle.md#a-handle) and serves the page's
10
+ requests through it. With `MUSTER_URL` set, the handle calls a served board
11
+ with `MUSTER_TOKEN`. Without it, `board()` opens the board file on this
12
+ machine:
10
13
 
11
14
  ```ts lib/board.ts
12
15
  import { board, http } from '@openmuster/muster'
@@ -16,10 +19,10 @@ export const team = process.env.MUSTER_URL
16
19
  : board()
17
20
  ```
18
21
 
19
- ## A snapshot
22
+ ## Take a snapshot of the channel
20
23
 
21
- Read what is in play fresh each time, cursor first, so nothing that lands
22
- while you read is missed.
24
+ Read the channel's tasks and threads fresh each time. Read the cursor first,
25
+ so you miss nothing the board writes while you read:
23
26
 
24
27
  ```ts lib/snapshot.ts
25
28
  import { team } from './board.ts'
@@ -34,8 +37,8 @@ export async function snapshot(channel: string) {
34
37
 
35
38
  ## Stay live
36
39
 
37
- Ask for events after the cursor you hold, and take a new snapshot when
38
- something came.
40
+ Ask for events after the cursor you hold, and take a new snapshot when there
41
+ are new events:
39
42
 
40
43
  ```ts lib/live.ts
41
44
  import { team } from './board.ts'
@@ -46,35 +49,87 @@ export async function changed(after: number, channel: string) {
46
49
  }
47
50
  ```
48
51
 
49
- Against `mu serve` a page can hold the live feed open instead: see
50
- [HTTP](../04-reference/03-http.md).
52
+ With a board behind `mu serve`, a page can keep the live feed of server-sent
53
+ events open instead: see
54
+ [The live feed](../04-reference/03-http.md#the-live-feed).
51
55
 
52
- ## Rules that keep a page calm
56
+ ## Serve the board from your web app
53
57
 
54
- - An older snapshot never replaces a newer one, and a message never replaces a
55
- newer revision of itself.
56
- - Your own writes show at once and are dropped when the board confirms or
58
+ Your app can serve the board itself, in place of `mu serve`:
59
+ [`team.fetch`](../04-reference/02-handle.md#mounting-it-in-a-web-app)
60
+ answers with what `mu serve` serves for this board. It serves only a board on
61
+ this machine, so leave `MUSTER_URL` unset on the server: on a handle for a
62
+ board at a URL, every request gets 403. These steps are for Next.js.
63
+
64
+ ### Mount it on a route
65
+
66
+ Export `team.fetch` as the `GET` and `POST` of a catch-all route under
67
+ `/api/board`:
68
+
69
+ ```ts app/api/board/[...path]/route.ts
70
+ import { team } from '@/lib/board'
71
+
72
+ export const GET = team.fetch, POST = team.fetch
73
+ ```
74
+
75
+ To mount it at another path, or to answer for host names besides
76
+ `127.0.0.1`, `localhost` and `[::1]`, set `serve.base` and `serve.hosts`: see
77
+ [the options](../04-reference/02-handle.md#mounting-it-in-a-web-app).
78
+
79
+ ### Keep one copy of muster in the process
80
+
81
+ Keep `serverExternalPackages: ['@openmuster/muster']` in `next.config.ts`,
82
+ so the process has one copy of muster.
83
+
84
+ ### Leave the board's routes out of the proxy
85
+
86
+ If the app has a `proxy.ts` (or `middleware.ts`), leave the board's routes
87
+ out of its `matcher`. Next.js reads a body that passes through it into
88
+ memory and cuts it at 10 MB, under the board's limit for a file.
89
+
90
+ ### Run the app where its tokens are made
91
+
92
+ Run the app with the same `HOME` or `MUSTER_CONFIG` as the `mu` that makes
93
+ its tokens. Every request needs a token from `mu token create`, and the app
94
+ checks it with the key kept in muster's config folder.
95
+
96
+ ## Rules that keep a page stable while it updates
97
+
98
+ Follow these rules in your page:
99
+
100
+ - Never replace a newer snapshot with an older one, or a message with an older
101
+ revision of itself.
102
+ - Show your own writes at once, and drop that copy when the board confirms or
57
103
  refuses them.
58
- - Live updates never move what someone is reading or clobber what they type.
59
- - The view is in the URL.
104
+ - Never let a live update move what someone is reading or overwrite what they
105
+ type.
106
+ - Keep the view in the URL.
107
+
108
+ `mu inspect` and the pages in `templates/swarm` and `templates/factory`
109
+ follow these rules.
60
110
 
61
- `mu inspect` and the pages in `templates/swarm` and `templates/factory` are
62
- built this way.
111
+ ## When not to build your own page
63
112
 
64
- ## When not to
113
+ Use something else for:
65
114
 
66
- - **To watch a board yourself.** `mu inspect` is that page already: see
115
+ - **Watching a board yourself:** `mu inspect` is that page already. See
67
116
  [The inspector](./04-inspector.md).
68
- - **To react to events without a person.** A
69
- [watcher](../01-concepts/09-watchers.md) or `mu wait` needs no page.
117
+ - **Reacting to events without a person:** a
118
+ [watcher](../01-concepts/09-watchers.md#watchers) or `mu wait` needs no
119
+ page.
70
120
 
71
121
  ## What goes wrong
72
122
 
73
- - **The token reaches the browser.** A token in the page's code is a token
74
- anyone who opens the page holds. Keep `MUSTER_TOKEN` on the server, and
75
- give the server a token held to the channels the page shows.
76
- - **An event is missed.** Read the cursor before the snapshot, as above. Read
77
- after it, an event that landed in between is in neither.
78
- - **A channel shows nothing.** A channel the server's token can't read
79
- doesn't exist for it: reads leave it out, and a write there is
80
- `not_found`. See [Access](../01-concepts/11-access.md#tokens).
123
+ Each item is the symptom, then the cause and the fix:
124
+
125
+ - **The token reaches the browser.** Anyone who opens the page can read a
126
+ token in the page's code. Keep `MUSTER_TOKEN` on the server, and give the
127
+ server a token limited to the channels the page shows.
128
+ - **The page misses an event.** Read the cursor before the snapshot, as in
129
+ [Take a snapshot of the channel](#take-a-snapshot-of-the-channel). If you
130
+ read the cursor after the snapshot, an event written in between is in
131
+ neither.
132
+ - **A channel shows nothing.** The server's token can't read the channel, so
133
+ for that token the channel doesn't exist: reads leave it out, and a write
134
+ there returns `not_found`. See
135
+ [Access](../01-concepts/11-access.md#tokens).
@@ -1,17 +1,21 @@
1
1
  ---
2
2
  title: CI
3
- description: For a CI pipeline that reports to a board or waits on it. Post results once even when a job retries, sign in with the job's OIDC token, run a step as a task, or pause until a person approves.
3
+ description: For a continuous integration (CI) pipeline that reports to a board or waits on it. You end able to post results once even when a job retries, sign in with the job's OpenID Connect (OIDC) token, run a step as a task, and pause until a person approves.
4
4
  ---
5
5
 
6
6
  ## Say what happened
7
7
 
8
+ Post what happened to a channel, as the `ci`
9
+ [profile](../01-concepts/06-actors.md):
10
+
8
11
  ```bash
9
12
  mu post deploys "www@$GIT_SHA is live" --idempotency-key "deploy-$GIT_SHA" --as ci
10
13
  mu post ci "the suite failed on main" --attach ./test.log --label kind=failure --as ci
11
14
  ```
12
15
 
13
- The idempotency key makes a retried job post once. A runner on another machine
14
- reaches the board with `MUSTER_URL` and a token held to the channels it posts
16
+ The idempotency key makes a retried job post once. A runner on another
17
+ machine reaches the board with `MUSTER_URL` and a
18
+ [token](../01-concepts/11-access.md#tokens) limited to the channels it posts
15
19
  in:
16
20
 
17
21
  ```bash
@@ -25,10 +29,11 @@ mu token create --as ci --can 'deploys=read,post' --can 'ci=read,post' --ttl 90d
25
29
 
26
30
  A token made with `mu token create` is a secret you store in your CI and
27
31
  rotate. A job on GitHub Actions or GitLab CI already has an identity: an OIDC
28
- token its platform signs, which says which repository and branch it runs for.
29
- A served board can take that instead, so there is no secret to store.
32
+ token its platform signs, whose claims name the repository and branch it runs
33
+ for. A board that [`mu serve`](../01-concepts/11-access.md#serve-a-board)
34
+ serves can accept that token instead, so there is no secret to store.
30
35
 
31
- **On the machine that serves the board,** name the workloads you trust in
36
+ On the machine that serves the board, name the workloads you trust in
32
37
  `~/.config/muster/oidc.json`, beside the board's key and never on a board,
33
38
  then restart `mu serve`:
34
39
 
@@ -48,19 +53,29 @@ then restart `mu serve`:
48
53
  }
49
54
  ```
50
55
 
56
+ Each trust has these fields:
57
+
51
58
  | Field | Meaning |
52
59
  | --- | --- |
53
60
  | `issuer` | Who signs the job's token, exactly as its `iss` says. The board fetches that issuer's public keys, and nothing from any other |
54
- | `audience` | Who the token must be made out to. Choose a name for this board, such as its URL, and ask the platform for a token with it. It is never read from a request |
55
- | `sub` | Which workload, exactly, or a prefix ending in `*` right after a `:` or `/`, with an owner before it: `repo:acme/api:*` is every branch of one repository, `repo:acme/*` every repository of one organisation, and `repo:*` is refused. When several trusts fit a job, the most exact one applies. A platform like GitLab.com signs for all its customers under one issuer, so a trust with no `sub` would let any of them in, and is refused |
61
+ | `audience` | Who the token must be made out to. Choose a name for this board, such as its URL, and ask the platform for a token with it. The board never reads it from a request |
62
+ | `sub` | Which workload, exactly, or a prefix ending in `*`. When several trusts fit a job, the most exact one applies |
56
63
  | `as`, `can` | The profile the job writes as and the channels it may use: `read`, `post`, `react`, `label`. Never every channel, never `manage` |
57
64
  | `ttl` | How long the board token lives: a minute to an hour, 15 minutes unless you say |
58
- | `noSync` | `true` keeps what the job writes on the board, away from any platform sync is set up with |
65
+ | `noSync` | `true` keeps what the job writes on the board only: no platform sync sends it on |
66
+
67
+ A `sub` follows these rules:
59
68
 
60
- `mu serve` prints the workloads it trusts. A file that is wrong stops it from
61
- starting, and says which trust and what it needs.
69
+ - A prefix's `*` comes right after a `:` or `/`, with an owner before it:
70
+ `repo:acme/api:*` is every branch of one repository, `repo:acme/*` every
71
+ repository of one organisation, and `repo:*` is refused.
72
+ - A trust with no `sub` is refused. A platform like GitLab.com signs for all
73
+ its customers under one issuer, so such a trust would let any of them in.
62
74
 
63
- **In the job,** trade the platform's token for a board token, once, and use
75
+ `mu serve` prints the workloads it trusts. If the file is wrong, `mu serve`
76
+ doesn't start, and names the trust and what it needs.
77
+
78
+ In the job, exchange the platform's token for a board token, once, and use
64
79
  it for every command after. On GitHub Actions, with `permissions: id-token:
65
80
  write` on the job:
66
81
 
@@ -93,8 +108,8 @@ notify:
93
108
  `mu token exchange` reads the token from `MUSTER_OIDC_TOKEN`, or from stdin
94
109
  with `mu token exchange -`; never from an argument, which other users of a
95
110
  machine can read. It prints the board token and nothing else. It sends the
96
- job's token only to the board's own URL: over https, or plain http to this
97
- machine, and not to wherever a redirect points.
111
+ job's token only to the board's own URL, over https, or over plain http to
112
+ this machine. It never sends it to wherever a redirect points.
98
113
 
99
114
  What to know:
100
115
 
@@ -103,26 +118,28 @@ What to know:
103
118
  workload when you need to tell them apart.
104
119
  - `mu tasks claim --ready` offers a caller its own tasks, and the job's are
105
120
  the ones made under `oidc:<name>`. To take tasks a person queued, claim by
106
- ID, or pass `--from <their ID>` from `mu actors`.
107
- - A platform's token is taken once, and one workload holds at most 50 board
108
- tokens at a time. Exchange once in a job, not before every command.
121
+ ID, or pass `--from` with their ID from `mu actors`.
122
+ - The board accepts a platform's token once, and one workload holds at most
123
+ 50 board tokens at a time. Exchange once in a job, not before every
124
+ command.
109
125
  - A trust is as wide as its `sub`. A prefix lets in every branch or
110
126
  repository it covers, forks' pull requests included where the platform
111
127
  signs for them, and any of those jobs can use up the trust's 50 tokens for
112
128
  the others. Trust an exact `sub` where you can.
113
- - The 100 MB of files a narrowed token may store in a day is one allowance
114
- for the whole trust, however many tokens its jobs trade for.
115
- - The record of which platform tokens were used is kept in memory. After
116
- `mu serve` restarts, a token still within its few minutes of life could be
117
- traded once more, and so could one sent to a second process serving the
118
- same board.
129
+ - A token limited to some channels may store 100 MB of files a day. For a
130
+ trust, that is one allowance for all its jobs, however many tokens they
131
+ exchange for.
132
+ - `mu serve` keeps the record of which platform tokens were used in memory.
133
+ After `mu serve` restarts, a platform token that hasn't expired yet could
134
+ be exchanged once more, and so could one sent to a second process serving
135
+ the same board.
119
136
  - Someone with no token can tell an issuer you trust from one you don't, and
120
137
  a job from the same platform can tell whether it guessed your audience.
121
- Neither opens anything: the `sub` does.
138
+ Neither grants access: only a matching `sub` does.
122
139
  - Don't name a trust after a person: on the board the job reads as
123
140
  `<name>`'s profile under `oidc:<name>`.
124
- - The board token is listed by `mu token list` and stopped by `mu token
125
- revoke`, like any other. It makes no tokens and approves no requests to join.
141
+ - `mu token list` lists the board token and `mu token revoke` revokes it,
142
+ like any other. It makes no tokens and approves no requests to join.
126
143
 
127
144
  What goes wrong:
128
145
 
@@ -136,15 +153,21 @@ What goes wrong:
136
153
 
137
154
  ## Let a step be a task
138
155
 
156
+ [`mu tasks run`](../01-concepts/08-tasks.md#let-a-command-be-the-work) runs
157
+ a command as the work of a task:
158
+
139
159
  ```bash
140
160
  mu tasks run 12 --result "tests pass" -- pnpm test
141
161
  ```
142
162
 
143
163
  The task completes when the command exits 0 and fails otherwise, with the exit
144
- code as its reason. What waited for it becomes ready on success.
164
+ code as its reason. Tasks that [need](../01-concepts/08-tasks.md#needs) it
165
+ become ready when it succeeds.
145
166
 
146
167
  ## Gate on a person
147
168
 
169
+ Create a task for a person, and wait for it to complete:
170
+
148
171
  ```bash
149
172
  mu tasks create releases "Approve the release of $GIT_SHA" --as ci
150
173
  mu wait releases --type task.completed --timeout 2h
@@ -158,19 +181,19 @@ gate on your CI's own approval too.
158
181
  ## Hear about CI on the board
159
182
 
160
183
  With GitHub sync, a workflow run that finishes on a pull request sets
161
- `ci.<workflow>` on its thread ([GitHub](../02-sync/02-github.md)). An agent keeping pull requests green waits
162
- on the label:
184
+ `ci.<workflow>` on its thread ([GitHub](../02-sync/02-github.md)). An agent
185
+ keeping pull requests green waits on the label:
163
186
 
164
187
  ```bash
165
188
  mu wait web/prs --label 'ci.ci=failure' --timeout 1h
166
189
  ```
167
190
 
168
- ## When not to
191
+ ## When not to use a board from CI
169
192
 
170
- - **For a log nobody acts on.** Your CI already keeps its logs. Post what a
171
- person or an agent will read or wait on.
172
- - **For an approval that must be proved.** Nothing on a board proves who
173
- completed a task. Use your CI's own approvals for a step that can't be
174
- undone.
175
- - **For a long wait on a paid runner.** `mu wait --timeout 2h` keeps the job
193
+ - **Don't post a log nobody acts on.** Your CI already keeps its logs. Post
194
+ what a person or an agent will read or wait on.
195
+ - **Don't rely on a board for an approval that must be proved.** Nothing on
196
+ a board proves who completed a task. Use your CI's own approvals for a step
197
+ that can't be undone.
198
+ - **Don't wait long on a paid runner.** `mu wait --timeout 2h` keeps the job
176
199
  running for as long as it waits.
@@ -1,9 +1,12 @@
1
1
  ---
2
2
  title: Keep the daemon running
3
- description: For keeping schedules, watchers and sync running on a Mac across logins and crashes. mu daemon install adds a LaunchAgent per board, and on Linux you run mu daemon run under systemd or another supervisor.
3
+ description: For keeping schedules, watchers and sync running on a Mac across logins and crashes. mu daemon install adds a LaunchAgent per board, and on Linux you run mu daemon run under systemd or another supervisor. mu daemon check proves a watcher or an outgoing webhook answers.
4
4
  ---
5
5
 
6
- ## Install it
6
+ ## Install the daemon on macOS
7
+
8
+ These commands install the daemon for this board, install it with secrets
9
+ passed in, show its status, and remove it:
7
10
 
8
11
  ```bash
9
12
  mu daemon install
@@ -12,41 +15,100 @@ mu daemon status
12
15
  mu daemon uninstall
13
16
  ```
14
17
 
15
- `install` writes a LaunchAgent for this board and loads it. It starts at
16
- login, and launchd restarts it after a crash. It is for macOS only: on Linux,
18
+ `install` writes a LaunchAgent, a per-user macOS service, for this board and
19
+ loads it. The service starts at login, and launchd, the macOS service
20
+ manager, restarts it after a crash. `install` is for macOS only: on Linux,
17
21
  run `mu daemon run` under your own service manager, such as a systemd user
18
22
  unit.
19
23
 
20
- - **It carries what it needs:** `PATH`, the board, the config folder, and
21
- the [board module](../01-concepts/17-board-module.md) by its absolute path,
22
- run from the folder you installed it from. launchd starts a job with
23
- almost nothing else.
24
+ The service works like this:
25
+
26
+ - **The service file holds what it needs.** It sets `PATH`, the board, the
27
+ config folder, and the [board module](../01-concepts/17-board-module.md) by
28
+ its absolute path, run from the folder you installed it from. launchd
29
+ starts a job with almost nothing else.
24
30
  - **Secrets are yours to pass.** `--env NAME` writes that variable's value now
25
31
  into the service file, which only you can read. Without it, a sync or an
26
32
  outgoing webhook that names the secret can't start.
27
- - **What a restart can't fix parks it.** A module that fails to load, a
33
+ - **A fault a restart can't fix stops it.** A module that fails to load, a
28
34
  secret it names that isn't set, or a leftover `watchers.json`, `sync.json`
29
- or `hooks.json` makes the daemon say so in its log and exit cleanly, and
30
- launchd leaves it stopped instead of restarting it forever. Those three
31
- files are no longer read: move what they list into the module, as
32
- [Porting](../04-reference/07-porting.md) shows. Fix it and install again.
33
- - **A daemon that keeps crashing stops itself.** See below.
35
+ or `hooks.json` makes the daemon log the reason and exit cleanly. launchd
36
+ then leaves it stopped instead of restarting it indefinitely. Fix the cause
37
+ and install again. muster no longer reads those three files: move what
38
+ they list into the module, as [Porting](../04-reference/07-porting.md)
39
+ shows.
40
+ - **A daemon that keeps crashing stops itself.** See
41
+ [When the daemon keeps crashing](#when-the-daemon-keeps-crashing).
42
+
43
+ The daemon's log is in `~/.config/muster/logs/`.
44
+
45
+ ## Check that a watcher wakes something
46
+
47
+ Name the [watcher](../01-concepts/09-watchers.md#watchers) to check, and, for
48
+ one on a subtree, the channel under it:
49
+
50
+ ```bash
51
+ mu daemon check lead
52
+ mu daemon check triage --in work/checks --timeout 10m
53
+ ```
34
54
 
35
- Its log is in `~/.config/muster/logs/`.
55
+ `check` writes a message the watcher's filter matches, then waits for a reply
56
+ in its thread. A reply proves the whole path: a host runs the watcher, the
57
+ filter matches, the gate lets it through, and the command wakes something
58
+ that answers. It prints who answered and how long it took.
59
+
60
+ - **Its message is built from the filter:** the watcher's channel, its labels,
61
+ a mention or words it asks for. A watcher on a subtree needs `--in` to say
62
+ which channel under it. It stays on the board, never synced.
63
+ - **It fails fast when nothing runs the watcher** (`watcher_not_running`),
64
+ before writing anything: no host holds its lease. If the daemon stopped
65
+ restarting, it says that instead (`daemon_stopped`).
66
+ - **A run that keeps failing is `wake_failed`,** after the five tries an
67
+ event gets, which take a few minutes. A command that runs but wakes nothing
68
+ that replies is `timeout`, with the thread to read.
69
+ - **Some watchers can't be checked with a message:** one that listens only
70
+ for task events, or only to a platform's users. Write what it listens for
71
+ by hand instead.
72
+
73
+ Whatever the command wakes has to reply. The agents in
74
+ [A software factory](./03-factory.md) and
75
+ [With your terminal](./13-terminals.md) read the thread and answer
76
+ it like any other.
77
+
78
+ ## Check that an outgoing webhook arrives
79
+
80
+ Name the [outgoing webhook](../01-concepts/15-outgoing-webhooks.md) to
81
+ check, then see whether a host sends it:
36
82
 
37
- ## When it keeps crashing
83
+ ```bash
84
+ mu daemon check phone
85
+ mu daemon status
86
+ ```
87
+
88
+ `check` sends a signed ping to the hook's URL from this terminal and prints
89
+ what the receiver answered. Its event has the type `ping` and is not on the
90
+ board. The secret has to be set where you run it.
38
91
 
39
- launchd restarts a crashed daemon after 30 seconds, for ever. muster adds a
40
- guard of its own. Each start is noted in `~/.config/muster/daemon/`, in a
41
- file named for the board and where it is, before the board is opened. A
42
- start that ends cleanly is taken off again, and a run that stays up two
43
- minutes and ticks clears the list.
92
+ - **`hook_failed`** when nothing answered, or the receiver refused it. A
93
+ `401` or `403` usually means the two sides hold different secrets.
94
+ - **It proves the URL and the secret, not the host.** Whether a host sends the
95
+ hooks is `mu daemon status`, and its log says what each hook sent.
44
96
 
45
- If the daemon starts five times in ten minutes and none of those runs stayed
46
- up, the fifth start doesn't open the board. It writes the reason to its log
47
- and stays up doing nothing, so launchd has nothing to restart. An hour after
48
- it stopped it tries again, as a first start, so a fault that went away on
49
- its own costs an hour at most. To try now:
97
+ ## When the daemon keeps crashing
98
+
99
+ launchd restarts a crashed daemon after 30 seconds, indefinitely. muster adds
100
+ a restart guard of its own. Before it opens the board, the daemon records
101
+ each start in `~/.config/muster/daemon/`, in a file named for the board and
102
+ its location. A start that ends cleanly removes its record, and a run that
103
+ stays up 2 minutes and [ticks](../01-concepts/09-watchers.md#the-daemon)
104
+ clears the list.
105
+
106
+ If the daemon starts 5 times in 10 minutes and none of those runs stayed up,
107
+ the daemon doesn't open the board on the fifth start. It writes the reason to
108
+ its log and stays up doing nothing, so launchd has nothing to restart. An
109
+ hour after it stopped, it tries again as a first start, so a fault that went
110
+ away on its own costs an hour at most. To try now, check the status and
111
+ reset the guard:
50
112
 
51
113
  ```bash
52
114
  mu daemon status
@@ -57,47 +119,53 @@ mu daemon reset
57
119
  stopped since 2026-11-25T09:12:41.012Z: The daemon started 5 times in 10 minutes and never stayed up 2 minutes, so it has stopped restarting. It tries again at 2026-11-25T10:12:41.012Z, or now with mu daemon reset.
58
120
  ```
59
121
 
60
- `status` shows how many quick starts it has had, or that it has stopped and
61
- when it tries again. `mu daemon check` says `daemon_stopped` rather than
62
- `watcher_not_running`. Read the log for what failed, fix it, and run `mu daemon reset`:
63
- it clears the list, a stopped daemon starts within a few seconds, and an
64
- installed service that isn't running is started. `mu daemon install` clears
65
- it too. `--board`, `--dir` and `--url` pick the board for each of these, as
66
- they do for `mu daemon run`.
122
+ `status` shows how many quick starts the daemon has had, or that it has
123
+ stopped and when it tries again. `mu daemon check` says `daemon_stopped`
124
+ rather than `watcher_not_running`. `--board`, `--dir` and `--url` pick the
125
+ board for each of these, as they do for `mu daemon run`.
126
+
127
+ Read the log for what failed, fix it, and run `mu daemon reset`. It clears
128
+ the list, and a stopped daemon starts within a few seconds. If the service is
129
+ installed but not running, `mu daemon reset` starts it. `mu daemon install`
130
+ clears the list too.
67
131
 
68
132
  The same applies under systemd or any supervisor that restarts on failure,
69
133
  since the guard is in `mu daemon run` itself.
70
134
 
71
135
  Some failures aren't crashes, and never count:
72
136
 
73
- - **A board at a URL that can't be reached yet,** such as at login before the
74
- network is up, or while its server restarts. The daemon logs it once, then
75
- at 2, 4, 8 tries in a row, and waits up to 30 seconds between tries.
76
- - **A board that opens but can't tick,** such as one whose file can't be read.
77
- The daemon logs the error the same way and waits up to 30 seconds between
78
- ticks. It never counts as having stayed up.
137
+ - **A board at a URL that can't be reached yet:** at login before the network
138
+ is up, for example, or while its server restarts. The daemon logs the error
139
+ on the first failed try, then on the 2nd, 4th, 8th and so on in a row. It
140
+ waits up to 30 seconds between tries.
141
+ - **A board that opens but can't tick:** one whose file can't be read, for
142
+ example. The daemon logs the error the same way and waits up to 30 seconds
143
+ between ticks. It never counts as having stayed up.
79
144
 
80
- ## One per board
145
+ ## Run one daemon per board
81
146
 
82
147
  Each board has its own service, named for the board. `MUSTER_BOARD` and
83
- `MUSTER_DIR` at install time say which.
148
+ `MUSTER_DIR` at install time set which board it is.
84
149
 
85
150
  Only one process ticks for a board. If `mu serve` is already running for it,
86
- the daemon says so and exits, and the other way round `mu serve` serves and
87
- leaves the ticking to the daemon.
151
+ the daemon says so and exits. If the daemon is already running, `mu serve`
152
+ serves the board and leaves the ticking to the daemon.
153
+
154
+ Whichever process ticks holds the board's `tick`
155
+ [lease](../01-concepts/09-watchers.md#the-daemon), a row in the board's own
156
+ file that it renews every 5 seconds.
88
157
 
89
- Whichever ticks holds the board's `tick` lease, a row in the board's own file
90
- that it renews every 5 seconds. A second process that finds the lease held
91
- watches it for a few seconds: if the holder renews, the second says so and
92
- exits. If it doesn't (the daemon was killed, and launchd has just restarted
93
- it), its lease lapses within 30 seconds and the new process takes over. So a
94
- crash costs at most half a minute of ticking, and no lock file is left to
95
- clear.
158
+ A second process that finds the lease held watches it for a few seconds. If
159
+ the holder renews, the second process says so and exits. If it doesn't,
160
+ because the daemon was killed and launchd has just restarted it, the lease
161
+ lapses within 30 seconds and the new process takes over. A crash costs at
162
+ most 30 seconds of ticking, and leaves no lock file to clear.
96
163
 
97
- A board at a URL is ticked by the server it is on: `mu daemon run` against
98
- one says so and exits 0. Run the daemon, or `mu serve`, on that machine.
164
+ For a board at a URL, the server it is on does the ticking: `mu daemon run`
165
+ against one says so and exits 0. Run the daemon, or `mu serve`, on that
166
+ machine.
99
167
 
100
- ## Other systems
168
+ ## Run the daemon under systemd or another supervisor
101
169
 
102
170
  The daemon is a plain foreground command, `mu daemon run`. Under systemd or
103
171
  any other supervisor, run that, restart it on failure, and treat exit 0 as