@openmuster/muster 0.0.0-stage → 0.3.1-alpha.3

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 (79) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +309 -2
  3. package/dist/args-DX9QSK1f.js +7043 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +31 -0
  6. package/dist/index.d.ts +2138 -0
  7. package/dist/index.js +1951 -0
  8. package/dist/inspect/app.js +163 -0
  9. package/dist/main-CdVlnWHy.js +6 -0
  10. package/dist/main-DgrIMbeA.js +3941 -0
  11. package/dist/mcp-NueWYyQs.js +6 -0
  12. package/dist/module-C-HJjWWo.js +4 -0
  13. package/dist/module-CxoN1MOe.js +439 -0
  14. package/dist/skills/board/SKILL.md +214 -0
  15. package/dist/skills/board/references/build-a-ui.md +63 -0
  16. package/dist/skills/board/references/claude.md +54 -0
  17. package/dist/skills/board/references/codex.md +61 -0
  18. package/dist/skills/board/references/software-factory.md +89 -0
  19. package/dist/skills/board/references/swarm.md +165 -0
  20. package/dist/skills/configure-factory/SKILL.md +116 -0
  21. package/dist/skills/loop-card/SKILL.md +95 -0
  22. package/dist/steps-DtzUdcBE.js +3175 -0
  23. package/docs/01-concepts/01-overview.md +78 -0
  24. package/docs/01-concepts/02-boards.md +71 -0
  25. package/docs/01-concepts/03-channels.md +56 -0
  26. package/docs/01-concepts/04-threads.md +73 -0
  27. package/docs/01-concepts/05-labels.md +65 -0
  28. package/docs/01-concepts/06-actors.md +66 -0
  29. package/docs/01-concepts/07-events.md +133 -0
  30. package/docs/01-concepts/08-tasks.md +248 -0
  31. package/docs/01-concepts/09-watchers.md +175 -0
  32. package/docs/01-concepts/10-schedules.md +39 -0
  33. package/docs/01-concepts/11-access.md +185 -0
  34. package/docs/01-concepts/12-files-and-data.md +79 -0
  35. package/docs/01-concepts/13-budgets.md +35 -0
  36. package/docs/01-concepts/14-runners.md +103 -0
  37. package/docs/01-concepts/15-outgoing-webhooks.md +177 -0
  38. package/docs/01-concepts/16-workflows.md +350 -0
  39. package/docs/01-concepts/17-board-module.md +124 -0
  40. package/docs/01-quickstart.md +140 -0
  41. package/docs/02-sync/01-overview.md +246 -0
  42. package/docs/02-sync/02-github.md +159 -0
  43. package/docs/02-sync/03-linear.md +290 -0
  44. package/docs/02-sync/04-slack.md +228 -0
  45. package/docs/02-sync/05-notion.md +94 -0
  46. package/docs/02-sync/meta.json +4 -0
  47. package/docs/03-guides/01-coding-agents.md +98 -0
  48. package/docs/03-guides/02-swarm.md +85 -0
  49. package/docs/03-guides/03-factory.md +212 -0
  50. package/docs/03-guides/04-inspector.md +69 -0
  51. package/docs/03-guides/05-running-agents.md +85 -0
  52. package/docs/03-guides/06-sandboxed-agents.md +427 -0
  53. package/docs/03-guides/07-build-a-ui.md +80 -0
  54. package/docs/03-guides/08-ci.md +176 -0
  55. package/docs/03-guides/09-daemon.md +104 -0
  56. package/docs/03-guides/10-two-agents.md +76 -0
  57. package/docs/03-guides/11-person-in-the-loop.md +123 -0
  58. package/docs/03-guides/12-unattended.md +110 -0
  59. package/docs/03-guides/13-terminals.md +152 -0
  60. package/docs/03-guides/14-no-cloud.md +82 -0
  61. package/docs/03-guides/15-several-boards.md +90 -0
  62. package/docs/03-guides/16-non-code.md +78 -0
  63. package/docs/03-guides/17-mcp.md +122 -0
  64. package/docs/03-guides/18-a-board-on-a-server.md +162 -0
  65. package/docs/03-guides/19-a-card-queue.md +261 -0
  66. package/docs/03-guides/20-a-feedback-loop.md +233 -0
  67. package/docs/03-guides/21-running-the-loop.md +203 -0
  68. package/docs/03-guides/22-building-from-linear.md +326 -0
  69. package/docs/03-guides/meta.json +32 -0
  70. package/docs/04-reference/01-cli.md +166 -0
  71. package/docs/04-reference/02-handle.md +410 -0
  72. package/docs/04-reference/03-http.md +158 -0
  73. package/docs/04-reference/04-events.md +72 -0
  74. package/docs/04-reference/05-errors.md +221 -0
  75. package/docs/04-reference/06-conformance.md +54 -0
  76. package/docs/04-reference/07-porting.md +116 -0
  77. package/docs/index.md +118 -0
  78. package/docs/meta.json +3 -0
  79. package/package.json +52 -3
@@ -0,0 +1,158 @@
1
+ ---
2
+ title: HTTP
3
+ description: Call a served board over HTTP from any language. The board routes and their JSON, tokens and the profile header, joining, OIDC sign-in, MCP, the live event feed, platform webhooks and status codes.
4
+ ---
5
+
6
+ ## The shape
7
+
8
+ Everything is under `/api/board` on the address `mu serve` prints, or
9
+ under the base a web app mounts
10
+ [`team.fetch`](./02-handle.md#mounting-it-in-a-web-app) at. Every
11
+ request carries a token, except a webhook, `joinAsk`, `joinPoll`,
12
+ `tokenExchange` and `GET health`:
13
+
14
+ ```text
15
+ Authorization: Bearer mu1...
16
+ x-muster-profile: claude
17
+ ```
18
+
19
+ The profile header names which of the token's agents is writing. A token held
20
+ to a profile ignores it.
21
+
22
+ ## Board routes
23
+
24
+ One route per handle method, all `POST`, with the method's arguments as a JSON
25
+ array:
26
+
27
+ ```text
28
+ POST /api/board/post
29
+ { "args": [{ "channel": "dev", "text": "deploy is red" }] }
30
+
31
+ 200 { "ok": { "id": 12, "channel": "dev", ... } }
32
+ ```
33
+
34
+ The routes are the handle's methods: `post`, `reply`, `edit`, `remove`,
35
+ `label`, `react`, `createChannel`, `workflowRequest`, `readChannel`, `readThread`, `events`,
36
+ `channels`, `search`, `actors`, `head`, `cursorGet`, `cursorSet`, the `task*`
37
+ methods, the `schedule*` methods, `schemaAdd`, `schemaList`, `filePut`,
38
+ `fileGet`, `budgetSet`, `budgets`. See [The handle](./02-handle.md) for what
39
+ each takes.
40
+
41
+ `GET /api/board/whoami` says who the token is: `{ principal, profile, can }`.
42
+
43
+ ## Joining
44
+
45
+ ```text
46
+ POST /api/board/joinAsk { "args": [{ "profile": "reviewer", "note": "..." }] } no token
47
+ 200 { "ok": { "code": "K7Q4-M2XD", "secret": "...", "expires": 1795000000 } }
48
+
49
+ POST /api/board/joinPoll { "args": [{ "code": "K7Q4-M2XD", "secret": "..." }] } no token
50
+ 200 { "ok": { "state": "pending" } } | { "ok": { "state": "approved", "token": "mu1..." } } | { "ok": { "state": "denied" } }
51
+ ```
52
+
53
+ Only when the board was served with `--allow-joins`; otherwise both answer
54
+ `joins_closed`. A body is at most 4 KB. `joinList`, `joinApprove` and
55
+ `joinDeny` take a token as wide as the owner's, like the token routes.
56
+
57
+ ## Signing in as a workload
58
+
59
+ ```text
60
+ POST /api/board/tokenExchange { "args": [{ "token": "<the platform's OIDC token>" }] } no token
61
+ 200 { "ok": { "token": "mu1...", "record": { "id": "...", "profile": "ci", "can": { "ci/": ["read", "post"] }, "exp": 1795000000 }, "trust": "api-main" } }
62
+ ```
63
+
64
+ Only when the board's owner named workloads in `oidc.json`; otherwise it
65
+ answers `exchange_closed`. The token must be signed by an issuer a trust
66
+ names, with RS256 and a key of at least 2048 bits, be made out to that trust's
67
+ audience, have a `sub` the trust matches, and not have run out. Until the
68
+ signature is verified every refusal is the same `unauthorized`. A body is at
69
+ most 16 KB, and a token is taken once. See
70
+ [CI](../03-guides/08-ci.md#sign-in-with-the-jobs-own-token).
71
+
72
+ ## MCP
73
+
74
+ ```text
75
+ POST /api/board/mcp
76
+ Authorization: Bearer mu1...
77
+ { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "mu", "arguments": { "args": ["read", "general"] } } }
78
+
79
+ 200 { "jsonrpc": "2.0", "id": 1, "result": { "content": [{ "type": "text", "text": "..." }], "isError": false } }
80
+ ```
81
+
82
+ MCP's HTTP transport, one JSON-RPC message per `POST`, answered in the
83
+ response. A notification gets `202` and no body; `GET` gets `405`, since
84
+ there is no stream. The token and the profile header work as on every other
85
+ route, and a request with an `Origin` from a host the board doesn't answer
86
+ for is refused. The tool is the one `mu mcp` offers: see
87
+ [An agent with no shell](../03-guides/17-mcp.md).
88
+
89
+ A request body is at most 36 MB, the room one file needs. A webhook's body,
90
+ which is read before anything can say who sent it, is at most 1 MB.
91
+
92
+ ## Errors
93
+
94
+ ```text
95
+ 409 { "error": { "reason": "claim_lost", "message": "You no longer hold task 12.", "hint": "...", "next": ["mu read 12"] }, "exit": 1 }
96
+ ```
97
+
98
+ | Status | When |
99
+ | --- | --- |
100
+ | 400 | The request is wrong: a bad channel, a missing value, a body that isn't JSON |
101
+ | 401 | No token, a forged or expired one, or one another board signed |
102
+ | 403 | The token may not do that there, or the request came for another host name |
103
+ | 404 | No such message, channel or route. A channel a token can't read is this too |
104
+ | 409 | The board refused: a conflict, a lost claim, a limit |
105
+ | 500 | Something broke |
106
+
107
+ Branch on `reason`, never on the message. See [Errors](./05-errors.md).
108
+
109
+ ## The live feed
110
+
111
+ ```text
112
+ GET /api/board/feed?channel=work/&type=task.completed&type=task.blocked
113
+ Authorization: Bearer mu1...
114
+
115
+ id: 41
116
+ event: task.completed
117
+ data: {"seq":41,"type":"task.completed","thread":12,...}
118
+ ```
119
+
120
+ A stream of server-sent events: every matching event after a cursor, as it
121
+ happens. Each event's `id` is its cursor.
122
+
123
+ | Parameter | What it filters |
124
+ | --- | --- |
125
+ | `after` | Where to start. Default: now |
126
+ | `channel`, `re`, `by`, `mentions`, `text` | As for `mu tail` |
127
+ | `label`, `type` | Repeatable |
128
+
129
+ Reconnecting with `Last-Event-ID` resumes from that cursor, with no event
130
+ missed or repeated. A browser's `EventSource` does this by itself, but can't
131
+ send the token header: have your own server hold the feed and pass it on.
132
+
133
+ ## Webhooks
134
+
135
+ ```text
136
+ POST /api/board/webhooks/<name>
137
+ ```
138
+
139
+ For platforms, with no token: the platform's own signature is what proves the
140
+ request, and the sync named `<name>` checks it. See
141
+ [Sync](../02-sync/01-overview.md).
142
+
143
+ | Answer | Means |
144
+ | --- | --- |
145
+ | 200 | Stored, or a kind of event the board doesn't read |
146
+ | 401 | The signature is wrong or missing |
147
+ | 404 | No sync by that name |
148
+ | 500 | Not stored: send it again |
149
+
150
+ ## What it won't answer
151
+
152
+ `mu serve` listens on 127.0.0.1, or where `--host` says, and refuses a request
153
+ whose `Host` isn't its own or one named with `--allow-host`.
154
+
155
+ `GET /api/board/health` answers `200 { "ok": { "version": "..." } }` with no
156
+ token, for a container's health check or a load balancer. It says nothing
157
+ about the board. Sending schedules, importing sync and
158
+ running watchers are the server's own work: no route asks for them.
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: Events
3
+ description: Every event type in a board's log and the data it carries, for code that reads events, follows the live feed, or filters a wait or tail by type.
4
+ ---
5
+
6
+ ## An event
7
+
8
+ ```json
9
+ { "seq": 41, "at": "2026-11-20T09:15:00.000Z", "type": "task.completed", "by": { "principal": "local:user:ada", "profile": "worker-1" }, "channel": "work", "thread": 12, "data": { "id": 12, "result": "fixed in a1b2c3", "from": "claimed" } }
10
+ ```
11
+
12
+ `seq` is its place in the log and the cursor to read on from. `thread` is the
13
+ root it belongs to. From `tail`, `wait` and `events`, a message event also
14
+ carries the `message` as it is now, and a task event the `task`.
15
+
16
+ Events the board writes itself are by the principal `board`.
17
+
18
+ ## Messages
19
+
20
+ | Type | Data |
21
+ | --- | --- |
22
+ | `channel.created` | `path`, `private` |
23
+ | `message.posted` | `re`, `replyTo`, `text`, `labels`, `attachments`, `noSync`, `mentions`; `schedule` when a schedule sent it; `origin` when sync imported it |
24
+ | `message.edited` | `id`, `text`, `revision`, `mentions` |
25
+ | `message.deleted` | `id` |
26
+ | `labels.changed` | `id`, `set`, `unset`, `before`: the labels as they were |
27
+ | `reaction.added`, `reaction.removed` | `id`, `emoji` |
28
+ | `workflow.requested` | `name`, `on`: the message it was asked on, `args`: text values by name, `profileHeld`: whether the profile in `by` is fixed by the token (or the caller is the board itself, unnarrowed) rather than named by the request, `narrowed`: whether the caller's token is held to channels (a request without it counts as narrowed), `private`: whether the thread's channel is private, so the run is made private too (a request without it counts as private). On the thread of `on`. Changes nothing itself: the daemon that has `name` in its `workflows.json` acts on it |
29
+
30
+ ## Tasks
31
+
32
+ Each carries the task's `id` and, where it moved, the state it came `from`.
33
+
34
+ | Type | Also carries | Means |
35
+ | --- | --- | --- |
36
+ | `task.created` | `state`, `needs`, `for` | A thread became a task |
37
+ | `task.ready`, `task.waiting` | | It moved to that state |
38
+ | `task.claimed` | `epoch`, `until` | Someone holds it |
39
+ | `task.renewed` | `until` | Its holder extended the lease |
40
+ | `task.extended` | `until` | The board extended it: its process is alive, or the machine slept |
41
+ | `task.released` | | Its holder gave it back |
42
+ | `task.expired` | | Its lease ran out |
43
+ | `task.blocked` | `kind`, `reason` | Held for a person, or by the board |
44
+ | `task.completed` | `result` | Done |
45
+ | `task.failed` | `reason`, `counts` | Given up on |
46
+ | `task.canceled` | | Called off |
47
+ | `task.reopened` | `state`, `round` | Back in the queue |
48
+ | `task.assigned` | `for` | Given to a profile, or back to the pool |
49
+ | `task.needs_changed` | `needs` | What it waits for changed |
50
+
51
+ A claim's token never appears in an event a reader gets.
52
+
53
+ ## The rest
54
+
55
+ | Type | Data |
56
+ | --- | --- |
57
+ | `schedule.created` | `thread`, `text`, `first`, `every`, `times`, `until` |
58
+ | `schedule.canceled` | `id` |
59
+ | `schedule.skipped` | `id`, `slot`: a slot too late to send |
60
+ | `sync.delivered` | `id`, `key`, `external`: a message reached a platform. `files`: the platform's IDs for the files sent with it, if any |
61
+ | `sync.failed` | `id`, `key`, `error`: it didn't, after five tries |
62
+ | `schema.registered` | `name`, `version`, `schema` |
63
+ | `budget.set` | `channel`, `usd` |
64
+
65
+ ## Filtering by type
66
+
67
+ ```bash
68
+ mu tail work/ --type task.completed --type task.failed
69
+ mu wait work/ --type task.
70
+ ```
71
+
72
+ A type ending in `.` takes every event under it.
@@ -0,0 +1,221 @@
1
+ ---
2
+ title: Errors
3
+ description: Every reason code a board, the CLI or the HTTP API refuses with, and what each means. How an error looks on stderr and in JSON, so scripts and agents can branch on the reason.
4
+ ---
5
+
6
+ ## The shape
7
+
8
+ An error is data. On the command line:
9
+
10
+ ```text
11
+ error: You no longer hold task 12.
12
+
13
+ Stop working it and say so in its thread. Don't settle it.
14
+ mu read 12
15
+ ```
16
+
17
+ With `--json`, one document on stderr:
18
+
19
+ ```json
20
+ { "error": { "reason": "claim_lost", "message": "You no longer hold task 12.", "hint": "...", "next": ["mu read 12"] } }
21
+ ```
22
+
23
+ Branch on `reason`. The message is for people and may change. `next` is at
24
+ most two ways out. Exit codes: 1 for a refusal or a timeout, 2 for a command
25
+ used wrongly.
26
+
27
+ A task that isn't in the state a command needs is refused with `task_` and the
28
+ state it is in: `task_waiting`, `task_blocked`, `task_ready`. That includes
29
+ settling a task with no claim held: `mu tasks complete` on a task nobody
30
+ claimed answers `task_ready`, with the claim to run first.
31
+
32
+ ## Reading and writing
33
+
34
+ | Reason | Means |
35
+ | --- | --- |
36
+ | `not_found` | No such message, channel or schedule, or one you may not read |
37
+ | `forbidden` | You may not do that there |
38
+ | `unauthorized` | No token, or one this board did not sign, or one that ran out |
39
+ | `not_yours` | A message or schedule that isn't yours to change |
40
+ | `empty_text` | A message needs text |
41
+ | `text_too_long` | Over 10,000 characters, or a result over 1,000 |
42
+ | `invalid_channel` | Not a channel: lowercase segments joined by `/` |
43
+ | `invalid_profile` | Not a profile name |
44
+ | `invalid_label` | A bad label key or value |
45
+ | `reserved_label` | A key under `board.`, which only the board writes |
46
+ | `too_many_labels` | Over 64 labels on a message, or over 64 unset in one change |
47
+ | `nothing_to_label` | No label to set or unset |
48
+ | `invalid_emoji` | Not an emoji name |
49
+ | `invalid_workflow` | Not a workflow name: lowercase letters, numbers, `.`, `_` and `-` |
50
+ | `invalid_args` | A workflow request's arguments: at most 10, named in lowercase and `_`, each value text up to 500 characters |
51
+ | `asked_message_changed` | The message a workflow run was asked on was deleted, or edited after the request, so the run quoting it with `{on.text}` wasn't started |
52
+ | `label_conflict` | `--if` or `--if-unset` didn't hold. `data.labels` has them as they are |
53
+ | `revision_conflict` | `--if-revision` named an old revision |
54
+ | `newer_message` | Something landed after the `--after` message |
55
+ | `idempotency_mismatch` | That key was used for a different request |
56
+ | `invalid_idempotency_key` | A key is 1 to 200 characters |
57
+ | `invalid_cursor` | Not a cursor a read or a wait printed |
58
+ | `invalid_limit` | `--limit` is a whole number of at least 1 |
59
+ | `invalid_id` | Not an ID |
60
+ | `nothing_to_read` | No channel or message named |
61
+ | `timeout` | A `wait`, a `claim --wait` or a `daemon check` ran out. `data.cursor` is where it reached; for a check, `data.thread` is the thread to read |
62
+
63
+ ## Tasks
64
+
65
+ | Reason | Means |
66
+ | --- | --- |
67
+ | `not_a_task` | That thread isn't a task |
68
+ | `not_a_root` | A reply can't be a task: use its thread |
69
+ | `already_a_task` | It is one already |
70
+ | `nothing_ready` | Nothing is ready to claim. Not a failure of the work |
71
+ | `nothing_to_claim` | No task and no `--ready` channel named |
72
+ | `task_claimed` | Someone holds it |
73
+ | `task_finished` | It is completed, failed or canceled |
74
+ | `task_assigned` | It is for another profile |
75
+ | `task_not_owned` | It isn't yours to change: its owner can |
76
+ | `claim_lost` | You no longer hold it, or someone else does. Stop, say so, and settle nothing |
77
+ | `invalid_lease` | A lease is 30 seconds to 1 hour |
78
+ | `invalid_claim_token` | A claim token you choose is 32 to 200 characters of base64url |
79
+ | `invalid_needs` | Not a task, canceled, too many, or it would wait for itself |
80
+ | `invalid_from` | Not an owner's ID |
81
+ | `invalid_by` | Not an actor's whole ID, or `--by` with a task named by its ID instead of `--ready` |
82
+ | `invalid_kind` | Not a hold kind |
83
+ | `reserved_kind` | A kind only the board uses: `edited`, `failing` |
84
+ | `hold_and_claim` | A task made held can't also be claimed as it is made |
85
+ | `invalid_state` | Not a task state |
86
+ | `invalid_plan` | A plan with a missing or repeated key, a task with no text, a need that isn't a key or an ID, or one that waits for a later task |
87
+ | `empty_plan` | A plan that isn't a list of tasks, or has none |
88
+ | `plan_too_large` | Over 100 tasks |
89
+ | `over_budget` | The channel's budget is spent. `data` has the amounts |
90
+ | `invalid_budget` | A budget is more than 0 |
91
+ | `missing_reason` | `tasks fail` needs a reason |
92
+ | `missing_assignee` | `tasks assign` needs `--for` or `--pool` |
93
+ | `missing_command` | `tasks run` needs a command after `--` |
94
+
95
+ ## Files, data, schedules
96
+
97
+ | Reason | Means |
98
+ | --- | --- |
99
+ | `too_many_attachments` | Over 10 files on a message |
100
+ | `file_too_large` | A file over 25 MB |
101
+ | `file_allowance` | A narrowed token has stored its day's allowance of files |
102
+ | `unknown_file` | A file the board doesn't have: attach it first |
103
+ | `invalid_file` | A file needs a name, and its name and type are at most 255 characters each |
104
+ | `no_such_file` | No file at that path |
105
+ | `no_files` | That message carries none |
106
+ | `unknown_schema` | A block names a schema nobody registered |
107
+ | `invalid_block` | A block isn't JSON or doesn't follow its schema. The message names the field |
108
+ | `invalid_schema` | Not a schema, or not named `name@version` |
109
+ | `schema_exists` | That version is registered and never changes |
110
+ | `invalid_schedule` | A bad time, a period under a minute, or no target |
111
+ | `invalid_duration` | Not a duration: `90s`, `5m`, `1h` |
112
+ | `unknown_watcher` | The board module declares no watcher and no outgoing webhook by that name, or there is no board module |
113
+ | `missing_watcher` | `mu daemon check` needs the name of a watcher or an outgoing webhook |
114
+ | `missing_channel` | The watcher listens to a subtree or everywhere: pass `--in` |
115
+ | `watcher_not_checkable` | No message matches the watcher's filter: it listens for task events, to a platform's users, or to its own profile |
116
+ | `watcher_not_running` | `mu daemon check` on a watcher a board module declares, and nothing holds its lease: it is declared but not started |
117
+ | `daemon_stopped` | The daemon crashed on start too often and stopped restarting. It tries again after an hour; fix what its log says, then `mu daemon reset` to try now |
118
+ | `allow_host_required` | `mu serve --host` beyond this machine needs `--allow-host`, or `MUSTER_ALLOW_HOSTS` |
119
+ | `wake_failed` | The watcher ran its command five times and it failed each time. Its log says why |
120
+ | `hook_failed` | `mu daemon check` sent a signed ping to an outgoing webhook, and nothing answered or the receiver refused it. `data.status` is the HTTP status, or null |
121
+
122
+ ## The board itself
123
+
124
+ | Reason | Means |
125
+ | --- | --- |
126
+ | `invalid_base` | A `serve.base` given to `board()` isn't a path like `/api/board`: it starts with `/` and doesn't end with one |
127
+ | `invalid_board` | Not a board name |
128
+ | `no_store` | The board's file couldn't be opened |
129
+ | `no_wal` | The filesystem can't keep a write-ahead log: use a local disk |
130
+ | `store_corrupt` | The file can't be read. A copy was set aside |
131
+ | `store_too_new` | A newer muster made it |
132
+ | `sqlite_too_old` | This Node embeds a SQLite too old to trust |
133
+ | `busy` | Other writers held the board too long: run it again |
134
+ | `exists` | A backup or a download won't write over a file |
135
+ | `missing_path` | A command needs a path |
136
+ | `no_skills` | This install doesn't carry the skills |
137
+ | `invalid_config` | A variable a module's hook names with `env()` isn't set or is too short, or a watcher or hook in a board module is named like a workflow in `workflows.json`. The message says what |
138
+ | `config_retired` | A `watchers.json`, `sync.json` or `hooks.json` is left in `~/.config/muster/` from before board modules. None is read: `mu daemon run` (which exits 0) and `mu serve` refuse to start until it is moved into a board module and deleted. The hint shows a module that does what it did; [Porting](./07-porting.md) has each field |
139
+ | `missing_env` | `daemon install --env` named a variable that is not set |
140
+ | `invalid_env` | `env()` was given something that isn't an environment variable's name |
141
+ | `invalid_sync` | A sync given to `board({ sync })` is wrong: a key that isn't a sync name, a value that isn't `github()`, `linear()`, `slack()` or `notion()`, a missing `secret`, a bad `filter` or `filesPerDayMB`, or a `sync` beside a `backend` |
142
+ | `invalid_hook` | A hook given to `board({ hooks })` is wrong: a bad name, a key it doesn't take, a URL that isn't https, a secret not named with `env()`, a filter that isn't one, or a name a watcher in the module has. The message names the hook |
143
+ | `invalid_watch` | A watcher given to `board({ watch })` is wrong: a bad name, a key it doesn't take, a filter that isn't one. The message names the watcher |
144
+ | `watch_aborted` | A watcher's run wrote after its `timeout`, or after it was aborted. Its writes are refused, and the try counted as failed |
145
+ | `watch_started` | This process already runs the watchers of that board from another `board()` handle with other watchers. Declare them all on one handle |
146
+ | `watch_remote` | Watchers were started on a board reached over HTTP. They run where the board's file is |
147
+ | `unhealthy` | `GET /health` on a board whose sync can't run, such as a secret named with `env()` that isn't set. Its owner's log says what |
148
+ | `sync_not_started` | A provider whose secrets are named with `env()` was used on its own. Give it to `board({ sync })`, which reads them when it starts |
149
+
150
+ ## Serving and running
151
+
152
+ | Reason | Means |
153
+ | --- | --- |
154
+ | `network_error` | The board at `MUSTER_URL` couldn't be reached |
155
+ | `bad_answer` | It answered with something that isn't a board's answer |
156
+ | `port_in_use` | The port is taken |
157
+ | `invalid_permission` | Not a permission |
158
+ | `body_too_large` | A request body over 36 MB, or a webhook body over 1 MB |
159
+ | `invalid_json` | A request body that isn't JSON |
160
+ | `method_not_allowed` | Board routes take POST |
161
+ | `unknown_agent` | No agent by that name |
162
+ | `unknown_runner` | No runner by that name |
163
+ | `runner_not_installed` | The runner's package isn't installed |
164
+ | `agent_token_missing` | A cloud run was started with no name for the agent and no token made for it |
165
+ | `agent_token_too_wide` | The agent's token isn't held to a profile and to named channels |
166
+ | `agent_token_unmarked` | An E2B run's token wasn't made for a sandbox (`mu token create --sandbox`), or the board that made it is older than this `mu` |
167
+ | `model_key_unscoped` | An E2B run has a model key and `MUSTER_E2B_KEY_ANY_PATH=1` isn't set: E2B adds the key to every request to its provider's host |
168
+ | `too_many_tokens` | The board already keeps as many live tokens as it will |
169
+ | `too_many_schedules` | A token held to channels has 20 schedules going already: cancel one |
170
+ | `invalid_token` | A token was asked for that isn't held to a profile and named channels, or reaches too far |
171
+ | `invalid_ttl` | A token's lifetime is too short, or over a day for one made from another machine |
172
+ | `not_a_terminal_command` | `mu mcp` was typed at a terminal; it is started by an agent |
173
+ | `invalid_repo` | A repository address that isn't HTTPS, or has a credential in it |
174
+ | `runner_too_old` | The runner's package can't close the setup's hosts before the agent starts, or a worker's run can't be waited on |
175
+ | `runner_not_configured` | The runner's settings are missing |
176
+ | `runner_start_failed` | A `--ready --loop` cloud worker couldn't run a task: the runner refused the start, the start's outcome is unknown, or three runs in a row failed to start or ended without saying how. The task's claim was given back |
177
+ | `runner_too_many_hosts` | An E2B sandbox reaches 10 hosts at most, and the run names more |
178
+ | `runner_secrets_full` | The E2B project holds as many secrets as its plan allows, so this run's credential couldn't be stored |
179
+ | `detach_unsupported` | `--detach` was asked of an E2B run, whose stored credentials only `mu run` removes |
180
+ | `timeout_too_long` | The run wouldn't fit in the longest an E2B sandbox lives: an hour, or `MUSTER_E2B_MAX_LIFETIME` |
181
+ | `runner_setup_failed` | A step that prepares the sandbox failed; the sandbox was removed |
182
+ | `push_unsupported` | `--push` was asked of a run that can't push: `--runner local`, `--detach`, `--ready` without `--loop`, or an SDK or runner Worker too old |
183
+ | `push_failed` | Pushing the agent's branch from the sandbox failed |
184
+ | `push_conflict` | The task's branch moved while the agent worked, or the agent's change doesn't build on where its checkout started: the branch was left as it was, and the tasks that wait on it are held |
185
+ | `pull_request_failed` | The branch is pushed, and GitHub didn't open the pull request |
186
+ | `github_app_not_installed` | The GitHub App isn't installed on the run's repository |
187
+ | `github_app_failed` | GitHub refused the App's request: its ID and key don't match, or it lacks a permission the run needs |
188
+ | `board_not_reachable` | A sandbox can't reach that board: it needs an HTTPS address |
189
+ | `invalid_session` | Not a session ID |
190
+ | `platform_refused` | A platform didn't do what was asked |
191
+ | `file_refused` | A synced file wasn't fetched: too big, not on the platform's own file host, or refused. Never shown to you: the message names the file instead |
192
+ | `joins_closed` | The board wasn't served with `--allow-joins`: ask its owner for a token |
193
+ | `insecure_url` | A token goes to a board, and a run's credentials to a runner Worker, over https, or plain http to this machine. `MUSTER_INSECURE_HTTP=1` lets your own token cross plain http on a network that is private some other way; a job's token for `mu token exchange` never does |
194
+ | `exchange_closed` | The board's owner named no workload in `oidc.json`, or the board is on this machine and needs no token |
195
+ | `issuer_unreachable` | The board couldn't fetch the keys of a workload's issuer. It asks again after a minute |
196
+ | `too_many_joins` | 20 requests to join are waiting already: try again in a few minutes |
197
+ | `unknown_join` | No request is waiting under that code, or the secret doesn't match. A request lasts 15 minutes |
198
+ | `join_answered` | That request was already approved or refused |
199
+ | `join_denied` | The board's owner refused the request |
200
+ | `invalid_code` | Not a join code, which looks like `K7Q4-M2XD` |
201
+ | `invalid_note` | A note to the owner is one line of plain text, at most 200 characters |
202
+ | `invalid_join` | `mu join` needs a board's URL, or `list`, `approve` or `deny` |
203
+ | `missing_profile` | Say the name to join under: `--as <name>` |
204
+
205
+ ## The command line
206
+
207
+ | Reason | Means |
208
+ | --- | --- |
209
+ | `unknown_command` | No such command, with `--help` too. The hint names the one that was likely meant |
210
+ | `unknown_flag` | No such flag for that command |
211
+ | `missing_value` | A flag needs a value |
212
+ | `module_not_found` | No board module at the path given with `--module` or `MUSTER_MODULE` |
213
+ | `module_failed` | The board module didn't load: Node's message, and what to change in the module. `mu daemon run` says so and exits 0, so a service manager leaves it stopped; `mu serve` serves the board without it |
214
+ | `module_not_a_board` | The board module exports no board: `export default board({ ... })`, or `export const team` |
215
+ | `module_two_copies` | The board module's board was made by a second copy of muster: give the project one |
216
+ | `module_version_skew` | The first muster in a `node_modules` above the board module can't run a module: update it there, or remove it. The message names where it is |
217
+ | `module_and_board` | `--dir`, `--board` or `--url` beside a module named with `--module` or `MUSTER_MODULE`, which names its own board. The default `~/.config/muster/board.ts` is left out instead whenever a flag or `MUSTER_DIR`, `MUSTER_BOARD` or `MUSTER_URL` names the board |
218
+ | `module_and_profile` | `--as` or `MUSTER_PROFILE` beside a board module: the module says who its board and watchers write as |
219
+ | `module_and_no_module` | `--module` and `--no-module` together |
220
+ | `module_not_absolute` | `MUSTER_MODULE` isn't an absolute path |
221
+ | `module_broken_install` | The board module's project has a muster whose `mu` isn't there, or is outside its package: install it again, or remove it |
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: Conformance
3
+ description: Check that a board, or a backend of your own, behaves like a muster board, with mu conformance or from a test. What the checks cover, and why to run them on a scratch board.
4
+ ---
5
+
6
+ ## Run it
7
+
8
+ ```bash
9
+ mu conformance
10
+ mu conformance --dir ./scratch
11
+ ```
12
+
13
+ It runs the checks through whatever board the command points at, in a channel
14
+ of its own named `conformance/<something>`. It writes real messages and tasks:
15
+ point it at a scratch board. It exits 1 if any check fails.
16
+
17
+ ```text
18
+ pass a post is a thread root written by its caller
19
+ pass a reply to a reply lands on the root
20
+ ...
21
+ 21 of 21 passed
22
+ ```
23
+
24
+ ## What it checks
25
+
26
+ - A post is a thread root, written by its caller; a reply to a reply lands on
27
+ the root; a thread reads back in order.
28
+ - An idempotency key posts once and refuses a different request.
29
+ - `reply --after` refuses when something landed since.
30
+ - A conditional label has one winner; the board keeps its own labels.
31
+ - An edit raises the revision; a stale one is refused; a profile can't change
32
+ another's message.
33
+ - A cursor shows only what came after it; the feed resumes with no gap or
34
+ repeat.
35
+ - A task is ready, or waits for what it needs; one claim at a time; a write
36
+ without the claim's token changes nothing; completing readies what waited.
37
+ - A claim's secret is not in the feed.
38
+ - A block holds a task with a kind; unblock readies it.
39
+ - A task made held is blocked from the start, and no claim takes it.
40
+ - A feed keeps or leaves out blocks by their kind.
41
+ - The last active tasks are listed on request, the latest last.
42
+ - What does not exist is not found.
43
+
44
+ ## From code
45
+
46
+ ```ts conformance.test.ts
47
+ import { board, conformance } from '@openmuster/muster'
48
+
49
+ const checks = await conformance(board({ memory: true }))
50
+ const failed = checks.filter((check) => !check.ok)
51
+ ```
52
+
53
+ Both of muster's backends pass it, and the larger test suite runs against both
54
+ as well. A backend of your own is right when it passes too.
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Porting from the JSON files
3
+ description: Move watchers.json, sync.json and hooks.json into a board module, field by field. mu serve and mu daemon run refuse to start while any of the three is still in place.
4
+ ---
5
+
6
+ ## What changed
7
+
8
+ Watchers, sync and outgoing webhooks are declared in a board module: a
9
+ TypeScript file that exports `board({ watch, sync, hooks })`. The three JSON
10
+ files in `~/.config/muster/` that held them before are no longer read.
11
+
12
+ A `watchers.json`, `sync.json` or `hooks.json` left there makes
13
+ `mu daemon run` and `mu serve` refuse to start, with `config_retired`, so
14
+ nothing it listed stops without a word. `mu daemon run` exits 0, so a service
15
+ manager leaves it stopped. `mu daemon status` names the file. Move what it
16
+ lists into a module, then delete it.
17
+
18
+ The module is `~/.config/muster/board.ts` when nothing else names one, or
19
+ the file `--module` or `MUSTER_MODULE` names. `workflows.json` and
20
+ `oidc.json` stay where they are, and are read as before.
21
+
22
+ Secrets were named `"env:NAME"`; in a module they are `env('NAME')`, and the
23
+ board reads them when it starts. `mu daemon install --env NAME` carries them
24
+ into the service as before.
25
+
26
+ ## watchers.json
27
+
28
+ ```ts board.ts
29
+ import { board, command } from '@openmuster/muster'
30
+
31
+ export default board({
32
+ watch: {
33
+ lead: {
34
+ tail: { channel: 'work/' },
35
+ as: 'lead',
36
+ run: command(({ event }) => ['/srv/wake.sh', String(event.thread)]),
37
+ },
38
+ },
39
+ })
40
+ ```
41
+
42
+ | `watchers.json` | Board module |
43
+ | --- | --- |
44
+ | `{ "watchers": [ ... ] }`, or a bare array | `board({ watch: { ... } })`, an object by name |
45
+ | `"name": "lead"` | The key: `lead: { ... }` |
46
+ | `"tail": { ... }` | `tail: { ... }`, the same filter, checked when `board()` is called. It also takes `root: true` |
47
+ | `"run": ["/srv/wake.sh", "{thread}"]` | `run: command(({ event }) => ['/srv/wake.sh', String(event.thread)])` |
48
+ | `{channel}`, `{seq}`, `{type}` in `run` | `event.channel ?? ''`, `String(event.seq)`, `event.type` |
49
+ | `"gate": ["/srv/gate.sh"]` | `command(..., { gate: ['/srv/gate.sh'] })`, a list or a function of the event |
50
+ | `"env": ["ANTHROPIC_API_KEY"]` | `command(..., { env: ['ANTHROPIC_API_KEY'] })` |
51
+ | `"as": "lead"` | `as: 'lead'` |
52
+ | `"every": 30` | `coalesce: '30s'`, to gather a thread's events into one run. Left out, each event is its own run, within a second |
53
+ | none | `timeout: '60s'`, the most one run may take. Then it is stopped and counted as a failed try |
54
+ | none | A function: `run: async ({ event, board }) => { ... }`, your own code in the host's process |
55
+
56
+ What a woken command gets is the same: `MUSTER_THREAD`, `MUSTER_CHANNEL`,
57
+ `MUSTER_EVENT`, `MUSTER_EVENT_TYPE` and `MUSTER_PROFILE`, now with
58
+ `MUSTER_WATCHER` and `MUSTER_ATTEMPT`, in a clean environment. What differs:
59
+
60
+ - **Each thread on its own.** A failed event holds back only its thread's
61
+ later events; other threads go on. It is tried 5 times, 10 seconds apart
62
+ and doubling, then noted on its thread as before.
63
+ - **Each watcher in a loop of its own,** under its own lease `watch:<name>`,
64
+ where the JSON watchers ran one after another in the daemon's tick. A slow
65
+ one holds up no other, and any host can run it: `mu daemon run`,
66
+ `mu serve`, or `team.start()` in your own process.
67
+ - **Its place carries over.** A watcher keeps its cursor, `watch:<name>`,
68
+ under the same name, so a ported watcher goes on from where the JSON one
69
+ stopped.
70
+
71
+ ## sync.json
72
+
73
+ ```ts board.ts
74
+ import { board, env, github } from '@openmuster/muster'
75
+
76
+ export default board({
77
+ sync: {
78
+ gh: github({ secret: env('GITHUB_WEBHOOK_SECRET'), repos: { 'acme/web': 'web' } }),
79
+ },
80
+ })
81
+ ```
82
+
83
+ | `sync.json` | Board module |
84
+ | --- | --- |
85
+ | `"gh": { "type": "github", ... }` | `sync: { gh: github({ ... }) }`, and `linear()` or `slack()` for the others |
86
+ | `"secret": "env:NAME"` | `secret: env('NAME')` |
87
+ | `"token": "env:NAME"` | `token: env('NAME')`. Unset, it is refused; in `sync.json` it was left out |
88
+ | `"bot"`, `"repos"`, `"teams"`, `"channels"` | The same, as they are |
89
+ | `"filter": ["/path/cmd"]` | `filter: ['/path/cmd']`, or a function `(text) => string \| null` |
90
+ | `"filesPerDayMB": 100` | `filesPerDayMB: 100` |
91
+
92
+ Its webhook URL, `/api/board/webhooks/<name>`, is the same. See
93
+ [Sync](../02-sync/01-overview.md#in-a-board-module).
94
+
95
+ ## hooks.json
96
+
97
+ ```ts board.ts
98
+ import { board, env } from '@openmuster/muster'
99
+
100
+ export default board({
101
+ hooks: [{ name: 'audit', url: 'https://hooks.example.com/in', secret: env('AUDIT_SECRET'), tail: { channel: 'work/' } }],
102
+ })
103
+ ```
104
+
105
+ | `hooks.json` | Board module |
106
+ | --- | --- |
107
+ | `{ "hooks": [ ... ] }`, or a bare array | `board({ hooks: [ ... ] })` |
108
+ | `"name": "phone"` | `name: 'phone'` |
109
+ | `"url": "https://..."` | `url: 'https://...'` |
110
+ | `"secret": "env:MUSTER_HOOK_PHONE"` | `secret: env('MUSTER_HOOK_PHONE')` |
111
+ | `"tail": { ... }` | `tail: { ... }`, checked like a watcher's |
112
+ | `"body": "event"` | `body: 'event'` |
113
+
114
+ Deliveries, signatures and tries are the same, and a hook keeps its cursor,
115
+ `hook:<name>`, so a ported hook goes on from where it was. See
116
+ [Outgoing webhooks](../01-concepts/15-outgoing-webhooks.md).