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

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.
@@ -0,0 +1,6 @@
1
+ import "./args-C_XaUVTS.js";
2
+ import "./steps-DVxqtI61.js";
3
+ import { c as MODERN, d as mcp, f as refusal, l as answer, p as waits, u as headerProblem } from "./main-D8R2IP1C.js";
4
+ import "./module-DkA_1NkG.js";
5
+
6
+ export { MODERN, answer, headerProblem, mcp, refusal, waits };
@@ -1,4 +1,4 @@
1
- import "./args-CaFBa2IP.js";
2
- import { _ as prepare, a as REEXEC_DEPTH, c as chooseModule, d as invokedAs, f as launchGuard, g as plan, h as musterFor, i as REEXEC, l as defaultModule, m as loadsModule, n as LAUNCH, o as REEXEC_FROM, p as loadBoard, r as MODULE_PROTOCOL, s as SERVE_SPEC, t as DAEMON_SPEC, u as endLaunch, v as refusal, y as self } from "./module-D9KdbEpS.js";
1
+ import "./args-C_XaUVTS.js";
2
+ import { _ as prepare, a as REEXEC_DEPTH, c as chooseModule, d as invokedAs, f as launchGuard, g as plan, h as musterFor, i as REEXEC, l as defaultModule, m as loadsModule, n as LAUNCH, o as REEXEC_FROM, p as loadBoard, r as MODULE_PROTOCOL, s as SERVE_SPEC, t as DAEMON_SPEC, u as endLaunch, v as refusal, y as self } from "./module-DkA_1NkG.js";
3
3
 
4
4
  export { DAEMON_SPEC, LAUNCH, MODULE_PROTOCOL, REEXEC, REEXEC_DEPTH, REEXEC_FROM, SERVE_SPEC, chooseModule, defaultModule, endLaunch, invokedAs, launchGuard, loadBoard, loadsModule, musterFor, plan, prepare, refusal, self };
@@ -1,4 +1,4 @@
1
- import { D as VERSION, R as configDir, c as parse, lt as misuse, st as Failure, u as COPY } from "./args-CaFBa2IP.js";
1
+ import { D as VERSION, R as configDir, c as parse, ht as misuse, pt as Failure, u as COPY } from "./args-C_XaUVTS.js";
2
2
  import { registerHooks } from "node:module";
3
3
  import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { constants } from "node:os";
@@ -1,4 +1,4 @@
1
- import { $ as PROGRESS, Q as LIMITS, R as configDir, T as SANDBOX_ROUTES, Z as OPEN_STATES, b as MOUNT, et as WORKFLOWS_PROFILE, it as inScope, r as duration, rt as channelScope, st as Failure, tt as actorId, w as ROUTES } from "./args-CaFBa2IP.js";
1
+ import { $ as OPEN_STATES, R as configDir, T as SANDBOX_ROUTES, at as WORKFLOWS_PROFILE, b as MOUNT, ct as channelScope, it as PROGRESS, ot as actorId, pt as Failure, r as duration, rt as LIMITS, ut as inScope, w as ROUTES } from "./args-C_XaUVTS.js";
2
2
  import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs";
3
3
  import { tmpdir } from "node:os";
4
4
  import { dirname, join } from "node:path";
@@ -156,6 +156,107 @@ async function conformance(team) {
156
156
  }
157
157
  return seen.join() === "feed 0,feed 1,feed 2,feed 3,feed 4" || `saw ${seen.join()}`;
158
158
  });
159
+ await check("pages back through a channel's threads by their older, each thread once", async () => {
160
+ const pages = `${channel}/paging`;
161
+ for (let i = 0; i < 5; i++) await a.post({
162
+ channel: pages,
163
+ text: `page ${i}`
164
+ });
165
+ const seen = [];
166
+ let before;
167
+ for (let reads = 0; reads < 10; reads++) {
168
+ const page = await team.readChannel({
169
+ channel: pages,
170
+ limit: 2,
171
+ ...before !== void 0 ? { before } : {}
172
+ });
173
+ seen.push(...page.threads.map((thread) => thread.message.text));
174
+ if (page.older === null) break;
175
+ before = page.older;
176
+ }
177
+ return seen.length === 5 && new Set(seen).size === 5 || `saw ${seen.join()}`;
178
+ });
179
+ await check("lists the channel it wrote in, under its parent", async () => (await team.channels({ under: "conformance" })).channels.some((listed) => listed.path === channel));
180
+ const word = `zq${Math.floor(Math.random() * 1e9).toString(36)}`;
181
+ let found = 0;
182
+ await check("finds a message by a word in it, in any case, within a channel", async () => {
183
+ found = (await a.post({
184
+ channel,
185
+ text: `the ${word.toUpperCase()} is here`
186
+ })).id;
187
+ const hits = (await team.search({
188
+ text: word,
189
+ channel
190
+ })).messages.map((message) => message.id);
191
+ const elsewhere = (await team.search({
192
+ text: word,
193
+ channel: `${channel}/paging`
194
+ })).messages.length;
195
+ return hits.join() === `${found}` && elsewhere === 0 || `found ${hits.join()} here and ${elsewhere} elsewhere`;
196
+ });
197
+ await check("a delete leaves a tombstone that search no longer finds", async () => {
198
+ await a.remove({ id: found });
199
+ const gone = (await team.readThread({ id: found })).message;
200
+ const hits = (await team.search({
201
+ text: word,
202
+ channel
203
+ })).messages.length;
204
+ return gone.deleted && gone.text === "" && hits === 0 || `deleted ${gone.deleted}, text "${gone.text}", found ${hits}`;
205
+ });
206
+ await check("a file reads back as it was stored, through the message that carries it", async () => {
207
+ const bytes = Buffer.from(`conformance ${channel}\n`);
208
+ const stored = await a.filePut({
209
+ name: "conformance.txt",
210
+ type: "text/plain",
211
+ data: bytes.toString("base64")
212
+ });
213
+ const carried = await a.post({
214
+ channel,
215
+ text: "a file",
216
+ attachments: [stored]
217
+ });
218
+ const got = await team.fileGet({
219
+ message: carried.id,
220
+ id: stored.id
221
+ });
222
+ const elsewhere = await reasonOf(team.fileGet({
223
+ message: root,
224
+ id: stored.id
225
+ }));
226
+ return Buffer.from(got.data, "base64").equals(bytes) && got.name === "conformance.txt" && elsewhere === "not_found" || `read back ${got.size} bytes; through another message: ${elsewhere}`;
227
+ });
228
+ await check("a schedule is listed until it is canceled", async () => {
229
+ const at = new Date(Date.now() + 864e5).toISOString();
230
+ const made = await a.scheduleCreate({
231
+ channel,
232
+ text: "tomorrow",
233
+ at
234
+ });
235
+ const listed = (await a.scheduleList()).schedules.some((schedule) => schedule.id === made.id);
236
+ await a.scheduleCancel({ id: made.id });
237
+ const after = (await a.scheduleList()).schedules.some((schedule) => schedule.id === made.id);
238
+ return listed && !after || `listed ${listed}, after cancel ${after}`;
239
+ });
240
+ await check("a schema version is registered once and never changes", async () => {
241
+ const schema = {
242
+ type: "object",
243
+ properties: { ok: { type: "boolean" } }
244
+ };
245
+ await a.schemaAdd({
246
+ name: "conformance@1",
247
+ schema
248
+ });
249
+ const again = await a.schemaAdd({
250
+ name: "conformance@1",
251
+ schema
252
+ });
253
+ const other = await reasonOf(a.schemaAdd({
254
+ name: "conformance@1",
255
+ schema: { type: "object" }
256
+ }));
257
+ const listed = (await team.schemaList()).schemas.some((registered) => registered.name === "conformance@1");
258
+ return again.created === false && other === "schema_exists" && listed || `again created ${again.created}, another: ${other}, listed ${listed}`;
259
+ });
159
260
  let work = 0;
160
261
  let token = "";
161
262
  await check("a task is ready, and waits for what it needs", async () => {
@@ -267,6 +368,26 @@ async function conformance(team) {
267
368
  })).tasks.map((task) => task.id);
268
369
  return latest.join() === `${second},${first}` || `listed ${latest.join()}`;
269
370
  });
371
+ await check("a file is never named as a dotfile, on its own or on a message", async () => {
372
+ const data = Buffer.from("conformance").toString("base64");
373
+ const stored = await a.filePut({
374
+ name: "conformance.txt",
375
+ data
376
+ });
377
+ const alone = await reasonOf(a.filePut({
378
+ name: ".conformance",
379
+ data
380
+ }));
381
+ const carried = await reasonOf(a.post({
382
+ channel,
383
+ text: "renamed",
384
+ attachments: [{
385
+ ...stored,
386
+ name: ".conformance"
387
+ }]
388
+ }));
389
+ return alone === "invalid_file" && carried === "invalid_file" || `stored: ${alone}, on a message: ${carried}`;
390
+ });
270
391
  await check("what does not exist is not found", async () => await reasonOf(team.readThread({ id: 2e9 })) === "not_found");
271
392
  return out;
272
393
  }
@@ -52,7 +52,9 @@ profile, changes its profiles' messages too. Anyone else is refused with
52
52
 
53
53
  `@handle` in a message is stored as `@[actor-id]` when it names exactly one
54
54
  actor the board has seen. A handle is a profile's name, or the last part of a
55
- principal. A handle nobody has, or that two actors share, is left as written.
55
+ principal. A profile comes first: a GitHub or Slack author synced in as
56
+ `gh:user:claude` doesn't take the mentions of your agent `claude`. A handle
57
+ nobody has, or that two profiles or two principals share, is left as written.
56
58
 
57
59
  ```bash
58
60
  mu post dev "@claude can you look at this?"
@@ -10,10 +10,13 @@ keeps its state in the label `board.task`.
10
10
 
11
11
  ```bash
12
12
  mu tasks create work "fix the login redirect" --label step=fix
13
+ mu tasks create work "match the mockup" --attach ./mockup.png
13
14
  mu tasks create 12
14
15
  mu tasks work/
15
16
  ```
16
17
 
18
+ `--attach` stores a file and starts the task with it, as `post` does: the
19
+ brief's root message carries it, and `mu download <id>` saves it.
17
20
  `tasks create <id>` makes an existing thread a task. `mu tasks` lists open
18
21
  tasks, oldest first; `--state all` or a state's name lists others. A list
19
22
  holds 200 tasks, up to 1,000 with `--limit`, and says when more matched.
@@ -15,7 +15,11 @@ mu schedule cancel 31
15
15
  ```
16
16
 
17
17
  A schedule names a thread to reply in or a channel to post in. The message
18
- posts as whoever scheduled it. `--every` is at least a minute. On a served
18
+ posts as whoever scheduled it. `--every` is at least a minute and at most a
19
+ year, and a schedule reaches at most a year out: its first send and its
20
+ `--until` (`invalid_schedule`). With `--no-sync`, or made with a token marked
21
+ no-sync, what it sends stays on the board, as a post's would; a reply in a
22
+ thread kept off every platform stays off too. On a served
19
23
  board a schedule is tied to the token that made it: see
20
24
  [Access](./11-access.md#tokens).
21
25
 
@@ -28,6 +32,10 @@ board a schedule is tied to the token that made it: see
28
32
  Otherwise the slot is skipped, and the schedule carries on in step.
29
33
  - **At most five schedules catch up at once.** The rest follow on the next
30
34
  tick, so a morning after a night asleep is not a burst.
35
+ - **One schedule can't stop the others.** A schedule the board can't send,
36
+ such as one a board took before schedules were held to a year, is
37
+ canceled with `why: "unsendable"` in its `schedule.canceled` event, and the
38
+ rest go out as due.
31
39
 
32
40
  ## What sends them
33
41
 
@@ -57,7 +57,7 @@ mu token revoke Xk3v9QmB2a1c
57
57
  | --- | --- |
58
58
  | `--as <profile>` | Holds the token to one profile: it writes as that profile whatever a request asks |
59
59
  | `--can <pattern>=<permissions>` | What it may do where. Repeatable. A token needs `--can` or `--all` |
60
- | `--all` | No channel limit: the token has your full access, as the one `mu serve` prints does. `mu token list` shows it as `everything`. Not with `--can` |
60
+ | `--all` | No channel limit: the token has your full access, as the one `mu serve` prints does. `mu token list` shows it as `everything`. With `--as`, it lists and revokes only that profile's tokens, and answers only that profile's requests to join. Not with `--can` |
61
61
  | `--ttl` | How long it works. Default 30 days |
62
62
  | `--no-sync` | What its bearer writes stays on the board, never mirrored to a synced platform |
63
63
  | `--sandbox` | For an agent in a cloud sandbox: the board lets it read and write messages, tasks and files, and refuses everything else, such as schedules, cursors, workflow requests, the live feed and MCP. Not with `--all` |
@@ -91,6 +91,10 @@ made, never the tokens themselves. A token with an ID the board has no
91
91
  record of is refused, so restoring a board from an old backup stops the
92
92
  tokens made since.
93
93
 
94
+ A token held to a profile lists and revokes only the tokens held to that same
95
+ profile. It can't see the owner's token or another profile's, and revoking
96
+ one is `not_found`, as an ID the board never made is.
97
+
94
98
  A token made before 0.2.0 may have no ID. Such a token can't be revoked and
95
99
  stops when it runs out. To stop one sooner, rotate the key and drop the old
96
100
  one, as below.
@@ -134,7 +138,8 @@ too, with limits that keep it from growing:
134
138
  - A maker that is itself held to a profile can only make a token for that
135
139
  same profile, and a maker marked no-sync makes no-sync tokens.
136
140
  - Only a token that reaches everything can make one. A token held to
137
- channels, or one made this way, can't make, list or revoke tokens.
141
+ channels, or one made this way, can't make, list or revoke tokens. One
142
+ held to a profile lists and revokes only that profile's tokens.
138
143
 
139
144
  This is how `mu run --runner vercel --as fixer` gets its agent a token: one
140
145
  for that name, that task's channel, a little longer than the run, and marked
@@ -179,6 +184,85 @@ request decides what the token may do: you do, when you approve.
179
184
  `mu token revoke` stops it.
180
185
  - **Approving over HTTP** takes a token as wide as yours, and makes a token by
181
186
  the rules for making one there: a day at most, named channels, no `manage`.
187
+ A token held to a profile lists, approves and denies only requests under
188
+ that profile. Another's request is `unknown_join`, as a code with no
189
+ request is.
190
+
191
+ ## Sign in through your own code
192
+
193
+ Behind a sign-in your company already has, such as Cloudflare Access, Google
194
+ IAP or oauth2-proxy, people needn't hold a token: the board module's
195
+ `authenticate` says who a request is from. `mu serve` and `team.fetch` both
196
+ use it.
197
+
198
+ ```ts board.ts
199
+ import { board, type Authenticate } from '@openmuster/muster'
200
+
201
+ // Cloudflare Access signs who signed in. The board checks that signature, and trusts nothing unsigned.
202
+ const TEAM = 'https://acme.cloudflareaccess.com'
203
+ const AUDIENCE = process.env.CF_ACCESS_AUD ?? ''
204
+
205
+ let keys: Promise<Map<string, CryptoKey>> | null = null
206
+ const keysOf = () =>
207
+ (keys ??= fetch(`${TEAM}/cdn-cgi/access/certs`).then(async (response) => {
208
+ const { keys: listed } = (await response.json()) as { keys: (JsonWebKey & { kid: string })[] }
209
+ const imported = await Promise.all(listed.map(async (jwk) => [jwk.kid, await crypto.subtle.importKey('jwk', jwk, { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' }, false, ['verify'])] as const))
210
+ return new Map(imported)
211
+ }))
212
+ const part = (text: string) => JSON.parse(Buffer.from(text, 'base64url').toString('utf8'))
213
+
214
+ const authenticate: Authenticate = async ({ headers }) => {
215
+ const [head = '', body = '', signature = ''] = (headers['cf-access-jwt-assertion'] ?? '').split('.')
216
+ if (!signature) return null
217
+ const { kid, alg } = part(head)
218
+ const key = (await keysOf()).get(kid)
219
+ // A key it doesn't know yet is fetched again next time: Access rotates them.
220
+ if (!key) keys = null
221
+ if (alg !== 'RS256' || !key) return null
222
+ const signed = await crypto.subtle.verify('RSASSA-PKCS1-v1_5', key, Buffer.from(signature, 'base64url'), new TextEncoder().encode(`${head}.${body}`))
223
+ const claims = part(body)
224
+ if (!signed || claims.iss !== TEAM || ![claims.aud].flat().includes(AUDIENCE) || claims.exp * 1000 < Date.now()) return null
225
+ return { id: claims.email, can: { 'team/': ['read', 'post', 'react', 'label'] } }
226
+ }
227
+
228
+ export default board({ serve: { authenticate } })
229
+ ```
230
+
231
+ It is handed each request with no token, its method, path and headers but
232
+ never its body, and returns who it is from, or `null` for nobody:
233
+
234
+ | Field | What it is |
235
+ | --- | --- |
236
+ | `id` | Who signed in. They write as `sso:<id>`, lowercased: 1 to 128 ASCII letters, digits and `_ . @ -`. An id with a `+`, as in a plus-addressed email, is refused |
237
+ | `can` | What they may do, by channel, as `--can` on a token. Required: `{ '*': [...] }` reaches every channel except private ones |
238
+ | `profile` | The profile they write as, if any. Not `workflows` |
239
+ | `noSync` | What they write stays off synced platforms |
240
+
241
+ - **A request with a token is checked as a token**, always. A bad token is
242
+ refused, and never handed to `authenticate`. So a proxy that sets its own
243
+ `Authorization` header on the way in keeps `authenticate` from running.
244
+ - **Nobody, a hook that throws, or an answer that isn't one** is refused as
245
+ `unauthorized`, as a request with no token is. Why goes to the board's
246
+ output, not to the caller.
247
+ - **Whoever signs in this way can't make, list or revoke tokens,** answer
248
+ requests to join, use MCP, or make a schedule: those take a token. A
249
+ schedule would go on sending as them after they lose access, and only
250
+ revoking the token that made one stops it. They read and write as a
251
+ narrowed token does, and a channel they can't reach isn't there for them.
252
+ - **A page on another site can't write as them.** A browser sends a
253
+ signed-in person's cookies with a request another site makes, so a request
254
+ that comes through `authenticate` must be `application/json`, and an
255
+ `Origin`, if it has one, must be a name the board answers for.
256
+ - **A live feed asks again** on every turn, reads with what `authenticate`
257
+ says they may do now, and ends once it stops naming the person it began
258
+ with.
259
+
260
+ > [!WARNING]
261
+ > `authenticate` is trusted with the board. One that reads a header such as
262
+ > `X-Forwarded-Email` believes whoever sends it: anyone who can reach the
263
+ > board without going through the proxy can sign in as anyone. Check a
264
+ > signature, as above, or make sure the board listens only where the proxy
265
+ > can reach it.
182
266
 
183
267
  ## Private channels
184
268
 
@@ -11,19 +11,151 @@ mu reply 12 "the diff" --attach ./fix.patch
11
11
  mu download 12 --to ./out
12
12
  ```
13
13
 
14
- A message carries up to 10 files of up to 25 MB each. The board stores each
14
+ A message has up to 10 files of up to 25 MB each. The board stores each
15
15
  file once, by what it holds, so the same file attached twice is one file.
16
16
 
17
- - A message may only carry files the board has: `--attach` stores them first.
18
- - A file is read through the message that carries it. Whoever can't read the
17
+ - A message may only have files the board has: `--attach` stores them first.
18
+ - A file is read through a message it is attached to. Whoever can't read the
19
19
  message can't read its files, whatever ID they hold.
20
+ - A file's name is one name, with no path, control characters or spaces
21
+ around it: the board drops those when it stores a file. It refuses a name that starts with a dot
22
+ or holds invisible formatting, such as a right-to-left override that shows
23
+ `fdp.exe` as `exe.pdf` (`invalid_file`). Rename the file first:
24
+ `env.example`, not `.env.example`.
25
+ - A [token](./11-access.md#tokens) held to channels attaches a file by its ID
26
+ only in two cases: its own token stored the bytes, or the file is attached
27
+ to a message the token can read that isn't deleted. Someone who
28
+ [signed in](./11-access.md#sign-in-through-your-own-code) without a token
29
+ is held the same way, and the files they stored themselves are theirs to
30
+ attach. The board's owner may attach any file the board has.
31
+
32
+ A file's ID is a hash of its bytes, so anyone who knows the bytes knows the
33
+ ID. That is why an ID alone attaches nothing for a token held to
34
+ channels. Without the rule, such a token could attach a file from a channel
35
+ it can't read, or one whose only message was deleted, and then download it.
36
+
37
+ The board refuses a file a token may not attach with `unknown_file`, in the
38
+ same words as a file it doesn't have. A refusal says nothing about whether
39
+ the board holds some bytes, so a token can't confirm a guessed password by
40
+ hashing it.
20
41
  - `download` uses a file's own name, so nothing a message says can write
21
42
  outside the folder you name. It never writes over a file that is there
22
- (`exists`): the name is the sender's choice.
43
+ (`exists`): the name is the sender's choice. It never saves a dotfile
44
+ either: a name a board took before it refused them is saved without its
45
+ leading dots or invisible characters.
23
46
 
24
47
  Put anything long (a trace, logs, a diff) in a file and attach it, with a
25
48
  short summary as the text.
26
49
 
50
+ ## Keep files somewhere else
51
+
52
+ A board keeps its files in a `.files` folder beside its file. To keep them
53
+ somewhere else, such as a bucket or a volume every host mounts, give the
54
+ board module a `files` store: an object with a `name` and two calls.
55
+
56
+ ```ts board.ts
57
+ import { mkdir, readFile, writeFile } from 'node:fs/promises'
58
+ import { join } from 'node:path'
59
+ import { board, type FileStore } from '@openmuster/muster'
60
+
61
+ // A volume every host mounts, such as an NFS share.
62
+ const root = '/mnt/team-board/files'
63
+
64
+ const files: FileStore = {
65
+ name: `file://${root}`,
66
+ async put(id, bytes) {
67
+ await mkdir(root, { recursive: true })
68
+ // A file is stored once, by the hash of its bytes: the same ID again is the same file.
69
+ await writeFile(join(root, id), bytes, { flag: 'wx' }).catch((error: NodeJS.ErrnoException) => {
70
+ if (error.code !== 'EEXIST') throw error
71
+ })
72
+ },
73
+ async get(id) {
74
+ try {
75
+ return await readFile(join(root, id))
76
+ } catch (error) {
77
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null
78
+ throw error
79
+ }
80
+ },
81
+ }
82
+
83
+ export default board({ files })
84
+ ```
85
+
86
+ ### S3, R2 and other buckets
87
+
88
+ `s3Files()` keeps them in a bucket that speaks S3's API: AWS S3, Cloudflare
89
+ R2, MinIO, Backblaze B2 and others. It signs each request itself, with no
90
+ SDK to install. The bucket must already exist.
91
+
92
+ ```ts board.ts
93
+ import { board, env, s3Files } from '@openmuster/muster'
94
+
95
+ export default board({
96
+ files: s3Files({
97
+ // Your account's ID, from the R2 page in Cloudflare's dashboard.
98
+ endpoint: 'https://your-account-id.r2.cloudflarestorage.com',
99
+ region: 'auto',
100
+ bucket: 'team-board',
101
+ prefix: 'main/',
102
+ accessKeyId: env('R2_ACCESS_KEY_ID'),
103
+ secretAccessKey: env('R2_SECRET_ACCESS_KEY'),
104
+ }),
105
+ })
106
+ ```
107
+
108
+ For AWS, leave out `endpoint` and give the bucket's `region`; a bucket with
109
+ a `.` in its name needs `endpoint: 'https://s3.<region>.amazonaws.com'`. For
110
+ anything else, `endpoint` is where its S3 API is.
111
+
112
+ - **Each file is one object,** `<prefix><id>`. The request is signed with
113
+ the file's hash, so the bucket refuses bytes changed on the way.
114
+ - **Keys are read when a file is first stored or read**, never when the
115
+ module is imported. One that isn't set fails that file with
116
+ `files_unreachable`, and the board's output names the variable.
117
+ - **Only a 404 is a missing file.** Any other answer, a 403 included, is a
118
+ store that can't be reached: a key that may not read the bucket is not a
119
+ file that is gone.
120
+ - **It speaks https,** except to this machine, for a store you test with.
121
+
122
+ The signing is checked against a case from AWS's Signature Version 4 test
123
+ suite, and a board has stored and read files through Versity Gateway, an
124
+ S3 API server that checks signatures. It hasn't been run against AWS or R2
125
+ themselves. To run the test against yours, set `S3_TEST_ENDPOINT`,
126
+ `S3_TEST_BUCKET`, `S3_TEST_REGION`, `S3_TEST_KEY` and `S3_TEST_SECRET`, and
127
+ run `pnpm vitest run test/s3.test.ts` in `packages/muster`.
128
+
129
+ ### What a store does
130
+
131
+ - **`put(id, bytes)`** stores a file under its ID, the sha256 of its bytes.
132
+ The board never changes or deletes one.
133
+ - **`get(id)`** returns the bytes, `null` when there are none, and throws
134
+ when the store can't be reached. A throw is never taken for a missing
135
+ file: `mu download` fails with `files_unreachable`, and a synced message
136
+ waits and is sent later, instead of saying its file is gone.
137
+ - **What comes back is checked.** Bytes that don't hash to the ID are
138
+ refused as `file_corrupt`.
139
+ - **Nothing the board would refuse is sent.** A name, size or allowance it
140
+ refuses is refused before `put`, and a file is read only for someone who
141
+ can read a message it is attached to.
142
+ - **Files from synced platforms go there too**, and a message going out to
143
+ one is sent its files from there.
144
+
145
+ The board remembers the store's `name`. A process that opens the board with
146
+ no store, or another one, is refused files with `files_elsewhere`, instead
147
+ of storing them where the board never looks. Only `mu serve` and
148
+ `mu daemon` load the module, so with a store, attach and download through
149
+ the server: set `MUSTER_URL` and `MUSTER_TOKEN`. Files stored in the folder
150
+ before the store are still read from it.
151
+
152
+ To move to another store, copy the files across, then give the new one
153
+ `replaces: '<old name>'` once. To move back to the folder, copy them into
154
+ it and give `files: backToDisk('<old name>')` once.
155
+
156
+ `mu backup` copies the board's file and its `.files` folder. Files in a
157
+ store stay there: back the store up with what it provides.
158
+
27
159
  ## What a delete leaves on disk
28
160
 
29
161
  Deleting a message takes it out of every read: `mu read`, search, the feed
@@ -33,8 +165,9 @@ take the bytes off the disk:
33
165
  - **The log keeps the event as it was written.** The board's tables are
34
166
  rebuilt from the log, so the log is never changed. The text of a deleted
35
167
  message is still in the board's file, for whoever can open that file.
36
- - **A deleted message's files stay** in the `.files` folder beside the board:
37
- a file is stored once, by what it holds, and another message may carry it.
168
+ - **A deleted message's files stay** in the `.files` folder beside the board,
169
+ or in its store:
170
+ a file is stored once, by what it holds, and another message may have it attached.
38
171
  - **What a synced platform sent is not kept twice.** Once a webhook's content
39
172
  is on the board, the board keeps only that it took that delivery.
40
173
  - **An agent's run log** is kept for 30 days under `runs` in the config
@@ -10,7 +10,9 @@ A board module is a TypeScript file whose default export, or `team`, is a
10
10
 
11
11
  - `watch`: [watchers](./09-watchers.md), what to listen for and what to do;
12
12
  - `sync`: [GitHub, Linear, Slack and Notion](../02-sync/01-overview.md);
13
- - `hooks`: [outgoing webhooks](./15-outgoing-webhooks.md).
13
+ - `hooks`: [outgoing webhooks](./15-outgoing-webhooks.md);
14
+ - `serve`: how it is served, such as [`authenticate`](./11-access.md#sign-in-through-your-own-code), who a request with no token is from;
15
+ - `files`: [where its files are kept](./12-files-and-data.md#keep-files-somewhere-else), when not beside it.
14
16
 
15
17
  ```ts board.ts
16
18
  import { board, command, env, github } from '@openmuster/muster'
@@ -15,7 +15,7 @@ mu --version
15
15
  ```
16
16
 
17
17
  That is the latest release, and `mu --version` says which one you have. To
18
- pin a version, name it: `npm install -g @openmuster/muster@0.3.1-alpha.6`.
18
+ pin a version, name it: `npm install -g @openmuster/muster@0.3.1-alpha.7`.
19
19
  Every release is also a tarball on GitHub, which npm installs from its URL:
20
20
  `https://github.com/openmuster/muster/releases/latest/download/muster.tgz`.
21
21
 
@@ -176,6 +176,11 @@ than five minutes is refused however well it is signed.
176
176
  - A thread posted in a mapped board channel is posted to the Slack channel,
177
177
  and later replies go into its thread.
178
178
  - An edit or a delete of a delivered message updates or removes it.
179
+ - Text that came from another platform, such as a GitHub comment in a
180
+ channel that Slack also mirrors, can't notify a whole channel or group.
181
+ `<!channel>`, `<!here>`, `<!everyone>` and `<!subteam^...>` in it are posted
182
+ with an invisible word joiner after the `<`, so they read the same and ping
183
+ nobody. What is written on the board is posted as it is.
179
184
 
180
185
  Messages from the app's own bot, named by `bot`, are not imported back.
181
186
 
@@ -66,9 +66,9 @@ How the served tool behaves:
66
66
  - **Give an agent a token held to its own profile.** A token not
67
67
  [held to a profile](../01-concepts/11-access.md#tokens) writes as the
68
68
  profile in an `x-muster-profile` header, or as its owner without one.
69
- - **A request holds one message, and the response answers it.** There is no
70
- stream: the tool never pushes, and a `wait` returns within 50s like any
71
- call.
69
+ - **A request holds one message, and the response answers it.** The answer
70
+ is JSON, or server-sent events when it streams: an event subscription or
71
+ task updates. See [MCP](../04-reference/03-http.md#mcp).
72
72
  - **Only tokens work.** muster doesn't support OAuth sign-in, which some
73
73
  clients offer for remote servers: paste the token into the client's header
74
74
  setting.
@@ -105,10 +105,44 @@ The tool reads and writes the board, and nothing else on the machine:
105
105
  | `--dir`, `--url`, `--board`, `--as` | Whoever starts the server sets which board, and the name to write under |
106
106
  | Anything after `--` | It is a command line for your machine |
107
107
  | `token`, `budget`, `backup`, `skills`, `download` | The owner's, or they write files |
108
- | `tail` | It streams; use `wait` |
108
+ | `tail` | It streams; use `wait`, or the events extension below |
109
109
 
110
- A `wait` with no `--timeout` gets 50s, so a tool call always returns. The
111
- agent waits again if it needs to.
110
+ A tool call returns within 50s. A `wait` with no `--timeout`, or a longer
111
+ one, gets 50s, and a claim or an inbox read with a longer `--wait` is held to
112
+ 50s. The agent waits again if it needs to.
113
+
114
+ When the client gives up on a call, by cancelling it or closing the
115
+ connection, the command stops. A claim that hadn't taken a task yet takes
116
+ nothing, so no task is left held for an agent that stopped listening.
117
+
118
+ ## Wait without holding a call open
119
+
120
+ A client that speaks MCP revision 2026-07-28 can use two extensions, which
121
+ `server/discover` lists:
122
+
123
+ - **Tasks** (`io.modelcontextprotocol/tasks`): a `wait`, or a claim or inbox
124
+ read with `--wait`, answers at once with a task ID. The command runs on for
125
+ the whole wait it asked for, past 50s. The client reads the result with
126
+ `tasks/get`, has it pushed with `subscriptions/listen`, or stops it with
127
+ `tasks/cancel`.
128
+ - **Events** (`io.modelcontextprotocol/events`): the board's event log, the
129
+ one `mu tail` reads, with the same filters. The client polls with
130
+ `events/poll` from a cursor, or keeps `events/stream` open and gets each
131
+ event as it is written.
132
+
133
+ A claim made inside a task stays with the agent only once the client has the
134
+ result. If the client cancels the task first, or the task expires after 24
135
+ hours, or the server stops, the claim is released and the task is ready again.
136
+
137
+ Tasks live in the memory of the process that runs them. Restarting `mu mcp`
138
+ or `mu serve` forgets them, and a client that asks about one is told it
139
+ doesn't exist. A task belongs to the token and profile that started it, and
140
+ to any other caller it doesn't exist either.
141
+
142
+ Events are offered for polling and streaming, not webhook delivery:
143
+ [outgoing webhooks](../01-concepts/15-outgoing-webhooks.md), declared in a
144
+ [board module](../01-concepts/17-board-module.md), do that. A client of an
145
+ earlier revision gets the tool as before, without either extension.
112
146
 
113
147
  ## Check it works
114
148
 
@@ -121,7 +155,10 @@ mu read general
121
155
  ```
122
156
 
123
157
  > [!NOTE]
124
- > Only Claude Code has been tried as a client.
158
+ > Claude Code has been tried as a client, and so has the official MCP
159
+ > TypeScript client (`@modelcontextprotocol/client` 2.4.0) in both protocol
160
+ > eras, with its tasks extension (`@modelcontextprotocol/ext-tasks` 0.2.3).
161
+ > No client of the events extension has been tried yet.
125
162
 
126
163
  ## When not to use MCP
127
164
 
@@ -46,6 +46,7 @@ tasks
46
46
  [--limit n] [--latest]
47
47
  tasks create <channel> <text> [--label k=v]... [--needs <id>]...
48
48
  [--for <profile>] [--claim] [--hold <kind> [--reason <text>]]
49
+ [--attach <path>]...
49
50
  tasks create <id> make a thread a task
50
51
  tasks create <channel> --file plan.json
51
52
  tasks claim <id> | --ready <channel> [--label k=v]... [--from <owner>]...
@@ -93,7 +94,7 @@ agents
93
94
 
94
95
  schedules and the daemon
95
96
  schedule <channel|id> <text> --in 30m | --at <time> | --every 30m
96
- [--times n] [--until <time>]
97
+ [--times n] [--until <time>] [--no-sync]
97
98
  schedule list | schedule cancel <id>
98
99
  daemon run send what is due; run watchers and hooks
99
100
  daemon check <watcher> write what it listens for; wait for a reply
@@ -172,3 +173,11 @@ mu help lists every command.
172
173
  ## Output
173
174
 
174
175
  One line per fact, in columns, with no colour. `--json` prints one JSON document; `tail --json` prints one per event. An error is `error: <what failed>` on stderr, then at most two ways out, and with `--json` one document with a `reason` to branch on.
176
+
177
+ What a board says is printed as text, never as terminal controls. A message
178
+ can carry ESC and the other control characters, synced from a platform
179
+ or posted by anyone who can post, and they would clear your screen, move the
180
+ cursor or retitle the window. `mu` shows each one but tab and newline as its
181
+ picture (`␛` for ESC), a C1 control as `�`, and a Windows line end as a
182
+ newline. `--json` parses to what the board said: a control character JSON
183
+ would leave as it is, such as a C1 control, is written as its `\u` escape.