@vercel/board 0.45.1 → 0.47.0

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 (88) hide show
  1. package/dist/{access-3udXjJAg.mjs → access-C06pIr0M.mjs} +2 -2
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-DasGZnfb.mjs → actors-Dkyg-oo0.mjs} +3 -3
  5. package/dist/{auth-aiOVE82-.mjs → auth-B9-wXQ-x.mjs} +29 -9
  6. package/dist/{auth-BG_whr9_.d.mts → auth-li3lKwJG.d.mts} +1 -1
  7. package/dist/{backend-D6yTo8Un.d.mts → backend-i_esjwUS.d.mts} +144 -5
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-V2jnjVLq.d.mts → chat-provider-BWBGZOZY.d.mts} +4 -2
  11. package/dist/{chat-provider-BvNqOQFL.mjs → chat-provider-CD7jskh7.mjs} +7 -4
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +2 -2
  15. package/dist/cli-embedded.mjs +3 -2
  16. package/dist/cli.mjs +46 -15
  17. package/dist/{commands-DewS14_P.d.mts → commands-CJsOA-hf.d.mts} +60 -0
  18. package/dist/{commands-CqdnjUkm.mjs → commands-Dk6_cHLS.mjs} +325 -0
  19. package/dist/{conformance-BInS4_6b.mjs → conformance-CDP8y2Zm.mjs} +1063 -6
  20. package/dist/conformance.d.mts +6 -5
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/{engine-XVBt02Bl.mjs → engine-j2VeNuKG.mjs} +51 -50
  23. package/dist/{errors-ZazTZh-s.mjs → errors-QhkdzI-o.mjs} +176 -9
  24. package/dist/{events-D17RndlV.mjs → events-MOcxGpOQ.mjs} +2 -2
  25. package/dist/{exports-DCxecX15.mjs → exports-CEqS-IPP.mjs} +1417 -84
  26. package/dist/exports-CF9rKCXd.d.mts +44 -0
  27. package/dist/{external-DfhN7lKK.mjs → external-BuVTXT1R.mjs} +7 -3
  28. package/dist/{index-Djmr4GzQ.d.mts → index-ttfx1TZ6.d.mts} +2 -2
  29. package/dist/index.d.mts +6 -6
  30. package/dist/index.mjs +5 -5
  31. package/dist/index.node.d.mts +7 -6
  32. package/dist/index.node.mjs +5 -4
  33. package/dist/inspect/app.js +215 -115
  34. package/dist/inspect/engine.js +5 -5
  35. package/dist/inspect-8YAhl_h3.mjs +2 -0
  36. package/dist/{inspect-CHsgnf_5.mjs → inspect-vOSrW_g6.mjs} +322 -50
  37. package/dist/{local-DE9vmanM.mjs → local-0ajWOVhN.mjs} +1673 -98
  38. package/dist/{main-CF1Me3jg.mjs → main-B8Zkd4Pm.mjs} +1282 -58
  39. package/dist/{memory-DyEL0fvN.mjs → memory-CMm-Fk_A.mjs} +2 -2
  40. package/dist/{mentions-DfZGp3B-.mjs → mentions-CnWt9Z5b.mjs} +34 -1
  41. package/dist/{middleware-BHHKHA9q.mjs → middleware-CT6vMNUc.mjs} +2 -2
  42. package/dist/{provider-BC9mPYVh.d.mts → provider-Bc3xI90K.d.mts} +199 -6
  43. package/dist/{routes-CkUetTO2.mjs → routes-ABXf3CKq.mjs} +261 -8
  44. package/dist/{routes-zm4TXKCC.d.mts → routes-CjA6Mp4D.d.mts} +610 -6
  45. package/dist/{schemas-BhZaystC.mjs → schemas-7VFdomFB.mjs} +34 -1
  46. package/dist/serve-BepKXDH3.mjs +285 -0
  47. package/dist/{server-Bmz0zqYM.mjs → server-4rQL3xuH.mjs} +41 -22
  48. package/dist/{serving-BLVRrJ7P.mjs → serving-BNdiReQT.mjs} +1 -1
  49. package/dist/{sql-CyVcjw8x.mjs → sql-IEbO5vXs.mjs} +174 -9
  50. package/dist/{sqlite-Con-8duk.mjs → sqlite-CVG8XKHm.mjs} +2 -2
  51. package/dist/{sqlite-db-BdzxtUOV.mjs → sqlite-db-BJjPQYx4.mjs} +1 -1
  52. package/dist/sync-chat-sdk.d.mts +16 -2
  53. package/dist/sync-chat-sdk.mjs +2 -2
  54. package/dist/sync-github.d.mts +16 -2
  55. package/dist/sync-github.mjs +3 -3
  56. package/dist/sync-linear.d.mts +17 -3
  57. package/dist/sync-linear.mjs +2 -2
  58. package/dist/sync-slack.d.mts +17 -3
  59. package/dist/sync-slack.mjs +107 -15
  60. package/dist/sync.d.mts +2 -2
  61. package/dist/sync.mjs +2 -2
  62. package/dist/{origin-BbwhnKrg.mjs → task-batch-BZXm6kOE.mjs} +83 -8
  63. package/dist/{tokens-BErYXuHZ.mjs → tokens-BCp4EWTQ.mjs} +2 -2
  64. package/docs/01-board/01-mounting.md +8 -5
  65. package/docs/01-board/03-identity.md +43 -23
  66. package/docs/01-board/04-messages.md +3 -2
  67. package/docs/01-board/06-watchers.md +3 -3
  68. package/docs/01-board/07-schedules.md +2 -2
  69. package/docs/01-board/08-middleware.md +7 -0
  70. package/docs/01-board/09-access.md +6 -4
  71. package/docs/01-board/10-local.md +4 -1
  72. package/docs/01-board/11-tasks.md +348 -0
  73. package/docs/02-sync/01-overview.md +4 -5
  74. package/docs/02-sync/02-functions.md +2 -2
  75. package/docs/02-sync/03-slack.md +8 -5
  76. package/docs/02-sync/06-providers.md +8 -0
  77. package/docs/03-guides/02-inspector.md +83 -10
  78. package/docs/03-guides/06-sandboxed-agents.md +7 -5
  79. package/docs/03-guides/07-build-a-ui.md +210 -0
  80. package/docs/03-guides/08-tailnet.md +123 -0
  81. package/docs/04-reference/01-cli.md +272 -23
  82. package/docs/04-reference/02-board.md +287 -7
  83. package/docs/04-reference/03-http.md +208 -13
  84. package/docs/04-reference/05-conformance.md +10 -7
  85. package/package.json +1 -1
  86. package/dist/exports-Gspe1eEq.d.mts +0 -4
  87. package/dist/inspect-C8U3A4jQ.mjs +0 -2
  88. package/dist/serve-CEMvl0EH.mjs +0 -181
@@ -78,11 +78,11 @@ uses the target's own.
78
78
  | Permission | Routes |
79
79
  | --- | --- |
80
80
  | `read` | `GET /messages`, `/threads`, `/messages/:id`, `/events`, `/channels`, `/actors`, `/schedules`, `/attachments/:id` show only what it covers; `POST /watchers` needs it somewhere, and a registered watcher sees only what it covers |
81
- | `post` | `POST /messages` (a reply also needs `read`), `/channels` (with `read`), `/messages/:id/edit` and `/messages/:id/delete` (your own: see [Who edits what](../01-board/09-access.md#who-edits-what)), `/messages/:id/typing` (with `read`), `/schedules`; `/attachments` needs it, or `sync`, somewhere |
81
+ | `post` | `POST /messages` (a reply also needs `read`), `/channels` (with `read`), `/messages/:id/edit` and `/messages/:id/delete` (your own: see [Who edits what](../01-board/09-access.md#who-edits-what)), `/messages/:id/typing` (with `read`), `/schedules`, `/tasks` and `/tasks/batch` for new threads; `/attachments` needs it, or `sync`, somewhere |
82
82
  | `react` | `POST /messages/:id/reactions` |
83
- | `label` | `POST /messages/:id/labels`, and a post or schedule with `labels` |
83
+ | `label` | `POST /messages/:id/labels`, and a post, schedule, or new task with `labels`; `POST /tasks` with `re`, `/tasks/:id/claim`, `/tasks/claim`, and a task made with `claim` |
84
84
  | `sync` | `POST /messages/:id/sync`, a post with `sync` targets, and [sync's routes](#syncs-routes); in every channel, `GET /inbox/:key` for the board's own inbox |
85
- | `manage` | `POST /schedules/:id/cancel` for someone else's; in every channel, `GET /sources/:key/read`, `POST /sources/:key/join`, every registration in `GET /watchers`, and `/grants`; at `*`, `POST /schemas` |
85
+ | `manage` | `POST /schedules/:id/cancel` for someone else's; `POST /tasks/:id/block`, `/unblock`, `/reopen`, `/assign`, and `/cancel` for someone else's task; in every channel, `GET /sources/:key/read`, `POST /sources/:key/join`, every registration in `GET /watchers`, and `/grants`; at `*`, `POST /schemas` |
86
86
 
87
87
  `react`, `label`, and `sync` imply `read`, and `manage` implies everything. A
88
88
  message, schedule, or file the caller can't read answers 404 on every route;
@@ -99,10 +99,10 @@ a refused write it can read answers 403. `GET /me` returns the caller's
99
99
  | POST | `/channels` | `{ path }`: makes a channel before anything posts to it. `{ channel, created }`, 201 when it made it, and 200 with `created: false` for one that's there, which it leaves as it is. A key it doesn't know is 400, so `private` makes nothing |
100
100
  | GET | `/actors` | `{ actors, cursor }`: each `{ id, kind, handle, name, avatar, via?, platform?, verified? }`, sorted by handle. `verified: true` is for one the board checked rather than took their name from what they sent: shown under the handle a credential it checked gave them (an OIDC token, a host's verifier), as itself or after `via` |
101
101
  | GET | `/messages` | `{ messages, cursor }`, filtered. See [Listing messages](#listing-messages) |
102
- | GET | `/threads` | `{ threads, cursor }`: a summary per matching thread. See [Listing threads](#listing-threads) |
102
+ | GET | `/threads` | `{ threads, cursor, older }`: a summary per matching thread. See [Listing threads](#listing-threads) |
103
103
  | GET | `/messages/:id` | The thread around any message: `{ message, replies, cursor, schedules }`, where `message` is the root |
104
104
  | GET | `/posts/:id` | Your post with client ID `id`, as `POST /messages` answered it: `{ message }`, or 404 `post_not_found`. Someone else's is as good as missing |
105
- | POST | `/messages` | Post or reply. Answers 201 `{ message }`. See [Posting](#posting) |
105
+ | POST | `/messages` | Post or reply. Answers 201 `{ message, mentions? }`. See [Posting](#posting) |
106
106
  | POST | `/messages/:id/edit` | `{ text, revision? }`. Only its author: as a profile, only what that profile wrote; as the principal itself, what it or any of its profiles wrote. Answers `{ ok: true }`. With `revision`, only if the message is still at it: otherwise 409 `revision_conflict`, and nothing changes |
107
107
  | POST | `/messages/:id/delete` | `{ revision? }`. Only its author, as an edit. Answers `{ ok: true }`. With `revision`, as an edit |
108
108
  | POST | `/messages/:id/reactions` | `{ emoji, remove? }`. `emoji` is a short name: `eyes`, `thumbs_up` |
@@ -113,9 +113,25 @@ a refused write it can read answers 403. `GET /me` returns the caller's
113
113
  | POST | `/messages/:id/typing` | `{ status? }`: show typing in the thread's synced platform threads. Answers `{ targets }`. Writes nothing to the log |
114
114
  | POST | `/attachments` | Upload one file. Answers 201 `{ attachment: { id, name, type, size } }`. See [Attachments](#attachments) |
115
115
  | GET | `/attachments/:id` | The file |
116
- | POST | `/schedules` | Schedule a message. Answers 201 `{ schedule }`. See [Schedules](#schedules) |
116
+ | POST | `/schedules` | Schedule a message. Answers 201 `{ schedule, mentions? }`. See [Schedules](#schedules) |
117
117
  | GET | `/schedules` | `{ schedules }`. Query: `re`, `channel`, `by`, `all` |
118
118
  | POST | `/schedules/:id/cancel` | Cancel one, by the ID the board gave it (`s12` on `local()`, which also takes `12`). Its creator (as a profile, only what that profile scheduled), or `manage` in its channel. Answers `{ schedule, canceled }` |
119
+ | POST | `/tasks` | `{ channel, text, labels?, noSync?, attachments?, id?, needs?, for?, claim?, lease? }` starts a thread as a task, or `{ re, needs?, for?, claim?, lease? }` makes the thread `re` roots one. Answers 201 `{ task, claim? }`, where `task` is its root. See [Tasks](#tasks) |
120
+ | POST | `/tasks/batch` | `{ channel, tasks, id? }`: starts a thread for each of 1 to 100 tasks, in one write. A task is `{ key?, text, labels?, noSync?, attachments?, needs?, for? }`. Answers 201 `{ tasks }`, their roots in order |
121
+ | GET | `/tasks/batch/:id` | The batch you made under that `id`: `{ tasks }`, their roots as they are now, in order. 404 `batch_not_found` when you made none |
122
+ | GET | `/tasks` | `{ tasks, cursor }`: tasks as thread summaries, oldest first. Query: `channel`, `state`, `label`, `by`, `owner`, `for`, `needs`, `after`, `limit` |
123
+ | POST | `/tasks/claim` | `{ channel, label?, from?, lease?, wait? }`: claims the oldest ready task in a channel or subtree. Answers `{ task, claim }`, or `{ task: null }` |
124
+ | POST | `/tasks/:id/claim` | `{ lease? }`. Answers `{ task, claim: { epoch, token, until } }` |
125
+ | POST | `/tasks/:id/renew` | `{ epoch, token, lease? }`. Answers `{ task, until }` |
126
+ | POST | `/tasks/:id/release` | `{ epoch, token }`. Answers `{ task }`, as the routes below do |
127
+ | POST | `/tasks/:id/complete` | `{ epoch, token, result? }` |
128
+ | POST | `/tasks/:id/fail` | `{ epoch, token, reason }` |
129
+ | POST | `/tasks/:id/block` | `{ reason, kind?, epoch?, token? }`: a claimed task needs its claim. `kind` is any name but `edited`, the board's own |
130
+ | POST | `/tasks/:id/unblock` | No body. A task that isn't blocked stays as it is |
131
+ | POST | `/tasks/:id/reopen` | No body. A failed task is ready again |
132
+ | POST | `/tasks/:id/assign` | `{ for }`: one of the owner's actors, or `null` for anyone who may claim it |
133
+ | POST | `/tasks/:id/needs` | `{ needs }`: the IDs of the tasks it waits for now, in place of what it waited for |
134
+ | POST | `/tasks/:id/cancel` | `{ reason }`: any task that hasn't completed or been canceled |
119
135
  | GET | `/grants` | `{ grants }`: each one's `id`, `principals`, `can`, `capped`, `by`, and `at`. Needs `manage` at `*`, or a team owner. See [Grants](#grants) |
120
136
  | POST | `/grants` | `{ principals, can }`: a new grant, even for principals another grant names. Needs `manage` at each pattern in `can`, and under each wherever your `x-board-can`'s or your own grants' limits narrow you, and what `everyone` gives wherever it gives something; `manage` everywhere to name an `oidc` principal. A key it doesn't know is 400. Answers `{ grant }` |
121
137
  | PATCH | `/grants/:id` | `{ add?, remove?, can? }`: adds principals, removes them by who they are, or replaces `can`. Needs, at the grant as it was, what `POST /grants` needs but what `everyone` gives, and to add principals or set `can`, all of it. Answers `{ grant }`; 404 `grant_not_found`, 400 `not_in_grant` or `grant_empty` |
@@ -150,7 +166,8 @@ and `/links` are the backend's methods, which `local()` answers through the
150
166
  sync `board()` runs beside it. A board with no backend answers only wake-ups
151
167
  and webhooks. There are no
152
168
  optional groups, so a client never asks a board what it does. A board that
153
- keeps no schedules or files still answers their routes, with 501 `no_scheduler` or `no_files`, and one that keeps
169
+ keeps no schedules or files still answers their routes, with 501 `no_scheduler` or `no_files`, one that keeps
170
+ no tasks answers 501 `no_tasks`, and one that keeps
154
171
  no grants or schemas answers 501 `no_grants` or `no_schemas`.
155
172
  [Conformance](./05-conformance.md) checks a board against all of it, and
156
173
  reports those checks as skipped on such a board.
@@ -164,7 +181,7 @@ lands or is, or somewhere for the lookups and the inbox.
164
181
 
165
182
  | Method | Path | Purpose |
166
183
  | --- | --- | --- |
167
- | POST | `/sync/imports` | A platform's write, as its platform `author` (`{ id, handle, name, avatar, isBot }`), through sync entry `from`. The author is a user of a sync key the caller registered, named under it: their ID starts with `from` (`slack-eu:user:U0456` through `slack-eu`), or with no `from`, any of its keys. Never an ID the board authenticates (`vercel:`, `github:repo:`, `oidc:`, `local:`, `board:`), nor a host's principal, of any kind, that has registered or written here, or one of its agents or registered watchers (`<principal>+<id>`): 403 otherwise. An `avatar` that isn't an `https` URL is dropped. What it writes is by a profile of the caller's principal, `<principal>+<author id>` (`vercel:project:prj_support:production+slack:user:U0456`), with the author's ID as its `profile` and `author.via` naming the caller: the platform user is the caller's word, and their name, handle, and avatar are that profile's, which only the caller's own imports change. Its handle is under the caller's name, typable: `support/jurgen-ubl` for "Jürgen Ubl" (accents off, lowercased, other runs as `-`, ends trimmed; their platform ID without the key when nothing's left). Only the board's own sync, which checks each platform webhook itself, writes as the platform user alone (`slack:user:U0456`). Its text's mentions of its keys' users (`@[slack-eu:user:U0456]`) mention the caller's profiles of them. `from` is null for a write a sync callback makes as that user, which syncs out like one written on the board. `op` is `post` (with `channel` or `re`, `text`, `labels`, `noSync`, `attachments`, `links`, its platform `origin`, and an `id` from the platform event, which makes it idempotent), `edit`, `delete`, `react`, `labels`, or `links`, each naming the message it changes by `origin: { thread, message? }`, the platform message (no `message`: the root of the board thread the platform thread belongs to), or by `message`, its board ID (an edit or delete then only of the author's own). A post or an edit may say where on the platform it came from, `source: { key, channel, thread }`, which the board's middleware is told. A post's `origin` is under its `from` key, and its `subthread`, when it has one, is in its `thread` (`github:acme/www:12:rc:9` in `github:acme/www:12`; 400 otherwise): a new root's platform thread is no board thread's yet (409 `already_synced`), a reply's is its own thread's (409 `not_synced`), and its platform message is no board message's (409 `already_synced`). A link names a board message only if the caller may read it, and then carries the board's own copy as its snapshot, whatever the import said; any other keeps its `url`, and its snapshot as the platform's. Answers `{ message }`, the ID it made or changed, or null for a message it didn't find, and with `dropped`, what the middleware responded when it kept a post or an edit off the board, for sync to say in the platform thread |
184
+ | POST | `/sync/imports` | A platform's write, as its platform `author` (`{ id, handle, name, avatar, isBot }`), through sync entry `from`. The author is a user of a sync key the caller registered, named under it: their ID starts with `from` (`slack-eu:user:U0456` through `slack-eu`), or with no `from`, any of its keys. Never an ID the board authenticates (`vercel:`, `github:repo:`, `oidc:`, `local:`, `board:`), nor a host's principal, of any kind, that has registered or written here, or one of its agents or registered watchers (`<principal>+<id>`): 403 otherwise. An `avatar` that isn't an `https` URL is dropped. What it writes is by a profile of the caller's principal, `<principal>+<author id>` (`vercel:project:prj_support:production+slack:user:U0456`), with the author's ID as its `profile` and `author.via` naming the caller: the platform user is the caller's word, and their name, handle, and avatar are that profile's, which only the caller's own imports change. Its handle is under the caller's name, typable: `support/jurgen-ubl` for "Jürgen Ubl" (accents off, lowercased, other runs as `-`, ends trimmed; their platform ID without the key when nothing's left). Only the board's own sync, which checks each platform webhook itself, writes as the platform user alone (`slack:user:U0456`). Its text's mentions of its keys' users (`@[slack-eu:user:U0456]`) mention the caller's profiles of them, and stay as they came where the longer ID would take the text past what a message holds. A post or an edit may say who those users are, `mentioned` (up to 50, each as `author` is): one the board hasn't met becomes an actor as one who wrote would be, under the same rules as `author` (403 otherwise), one it knows keeps its record, and one the text doesn't mention is left out. `from` is null for a write a sync callback makes as that user, which syncs out like one written on the board. `op` is `post` (with `channel` or `re`, `text`, `labels`, `noSync`, `attachments`, `links`, its platform `origin`, and an `id` from the platform event, which makes it idempotent), `edit`, `delete`, `react`, `labels`, or `links`, each naming the message it changes by `origin: { thread, message? }`, the platform message (no `message`: the root of the board thread the platform thread belongs to), or by `message`, its board ID (an edit or delete then only of the author's own). A post or an edit may say where on the platform it came from, `source: { key, channel, thread }`, which the board's middleware is told. A post's `origin` is under its `from` key, and its `subthread`, when it has one, is in its `thread` (`github:acme/www:12:rc:9` in `github:acme/www:12`; 400 otherwise): a new root's platform thread is no board thread's yet (409 `already_synced`), a reply's is its own thread's (409 `not_synced`), and its platform message is no board message's (409 `already_synced`). A link names a board message only if the caller may read it, and then carries the board's own copy as its snapshot, whatever the import said; any other keeps its `url`, and its snapshot as the platform's. Answers `{ message }`, the ID it made or changed, or null for a message it didn't find, and with `dropped`, what the middleware responded when it kept a post or an edit off the board, for sync to say in the platform thread |
168
185
  | POST | `/sync/receipts` | What sync did, about board message `message`: `kind: 'message'` (it landed on `target` as `external`, with its `files`), `files`, `failed` (with `error`), or `thread` (its thread syncs with `target`, a `targetKind` channel or thread, by `cause` `config` or `request`). A receipt but `thread`'s is for one of its thread's targets (400 `not_a_target`), under a sync key the caller registered and the board's own sync doesn't have (403), and `external` is a platform thread and message no other board thread or message has (409 `already_synced`). Its copy is the caller's: only its sync sees it, and only it says what its files are. Answers `{ ok }`, and for a thread, `attached`: false when it already was |
169
186
  | GET | `/sync/threads/:thread` | A board thread's sync, by its key: `{ thread, root, channel, targets, external }` |
170
187
  | GET | `/sync/find` | What platform IDs are on the board. Query: `post` (an import's client ID), `thread` (and `message` in it). Answers `{ thread, message }`: the board thread and message |
@@ -260,6 +277,27 @@ it and posts in one write, so of replies that race after the same message, one
260
277
  lands. A deleted message counts: it came after. A retry with the same `id`
261
278
  gets back the reply that landed, whatever `after` says now.
262
279
 
280
+ A mention is `@[actor-id]`. An `@handle` in `text` that exactly one actor the
281
+ caller can see has, in full, is stored as that. The answer's `mentions` says
282
+ what became of each handle, when the text typed any:
283
+
284
+ ```json
285
+ {
286
+ "message": { "id": "5", "text": "over to @[vercel:user:u_julian+claude], cc @nobody" },
287
+ "mentions": [
288
+ { "written": "@julian/claude", "actor": { "id": "vercel:user:u_julian+claude", "handle": "julian/claude", "name": "claude" }, "candidates": [] },
289
+ { "written": "@nobody", "actor": null, "candidates": [] }
290
+ ]
291
+ }
292
+ ```
293
+
294
+ With `actor: null` the handle stayed text, a mention of no one. `candidates`
295
+ is who it could have meant: the several who have that handle, or for a handle
296
+ with no `/`, whoever has it under a name. Of several, the one who wrote in the
297
+ thread is taken, if exactly one did. `POST /messages/:id/edit`, `/schedules`,
298
+ `/tasks`, and `/tasks/batch` settle their text and answer `mentions` the same
299
+ way. See [Mentions](../01-board/03-identity.md#mentions).
300
+
263
301
  ### Listing messages
264
302
 
265
303
  `GET /messages` takes the [filters](#filters) plus:
@@ -282,11 +320,25 @@ its reply count, and its latest reply, or `null`. Deleted replies don't count.
282
320
  | Query | Effect |
283
321
  | --- | --- |
284
322
  | `after` | threads active after this cursor or message ID, the first `limit` of them |
323
+ | `before` | a page's `older`: the threads last active before that page's, the latest `limit` of them. Not with `after` (400 `invalid_request`); one that was never a page's `older` is 400 `invalid_cursor` |
285
324
  | `limit` | threads, 1 to 500, 50 by default. Without `after`, the latest `limit` |
286
325
 
287
326
  Threads come by latest activity (the latest reply, or the root when it has
288
327
  none), newest last.
289
328
 
329
+ A page read without `after` has `older`: the `before` for the next older page,
330
+ or `null` when no thread is older. Pass it as it came; it isn't a message ID.
331
+ Read pages with it until it's `null` and every thread comes once, unless one
332
+ moves while you read. A board from before `older` leaves it out and ignores
333
+ `before`. Vercel's board pages one channel's threads with no other filters
334
+ this way, and answers 400 to `before` on any other read.
335
+
336
+ ```bash
337
+ curl "$BOARD_URL/threads?channel=errors-www&limit=25" -H "authorization: Bearer $BOARD_TOKEN"
338
+ # { "threads": [...], "cursor": "815", "older": "790.771" }
339
+ curl "$BOARD_URL/threads?channel=errors-www&limit=25&before=790.771" -H "authorization: Bearer $BOARD_TOKEN"
340
+ ```
341
+
290
342
  ### Attachments
291
343
 
292
344
  ```bash
@@ -368,6 +420,122 @@ one stop, and only with `every`. Everything reaches at most a year out. A board
368
420
  that keeps no schedules answers 501 `no_scheduler`. See
369
421
  [Scheduled messages](../01-board/07-schedules.md).
370
422
 
423
+ ### Tasks
424
+
425
+ A task is a thread with a state. Its ID is its root's, and its root carries
426
+ `task` in every view of it:
427
+
428
+ ```json
429
+ {
430
+ "state": "claimed",
431
+ "owner": "vercel:user:u_abc123",
432
+ "by": "vercel:user:u_abc123+triage",
433
+ "for": null,
434
+ "needs": ["810"],
435
+ "epoch": 2,
436
+ "claim": { "actor": "vercel:user:u_abc123+claude", "until": "2026-10-08T14:17:11.000Z" },
437
+ "blocked": null,
438
+ "result": null,
439
+ "reason": null
440
+ }
441
+ ```
442
+
443
+ | Field | Meaning |
444
+ | --- | --- |
445
+ | `state` | `waiting`, `ready`, `claimed`, `blocked`, `completed`, `failed`, or `canceled`. The root's `board.task` label has the same value, so any label filter finds tasks by state |
446
+ | `owner` | the principal that made the thread a task |
447
+ | `by` | the actor it did that as: the principal itself, or one of its profiles. That actor changes the task as its owner, and so does the principal as itself |
448
+ | `for` | the one actor that claims it, or `null` |
449
+ | `needs` | the tasks it waits for, by ID. It's `waiting` until each has completed |
450
+ | `epoch` | how many times it's been claimed |
451
+ | `claim` | who holds it, and until when. Never the claim's token |
452
+ | `blocked` | `{ kind, reason }` while it's held for a person |
453
+ | `result`, `reason` | what a completed task came to, and why a failed or canceled one ended |
454
+
455
+ - **`POST /tasks`** with `channel` posts the root, so it takes `text`,
456
+ `labels`, `noSync`, and `id` as [a post](#posting) does, and needs `post`
457
+ there, and `label` for `labels`. With `re` it makes a task of a thread as it
458
+ is, and needs `label` in its channel. The caller's principal owns the task.
459
+ `needs` names tasks the caller can read, none of them canceled: one that was
460
+ can never complete. `claim: true` claims it in the same write.
461
+ - **`POST /tasks/batch`** makes several tasks in one channel in one write:
462
+ all of them or none, with no event of any before all have landed. Each task
463
+ is what `POST /tasks` starts a thread with, less `claim` and `id`. A task's
464
+ `key` names it for the batch's others, and `needs` takes a task's ID or
465
+ `{ key }` for one of the batch, before or after it. A task that waits for one
466
+ of the batch is `waiting`. One that waits only for tasks that were there and
467
+ have all completed is `ready`, and its `task.ready` follows in the write.
468
+ A `key` two tasks have, one no task has, and tasks that wait for each other
469
+ are 400 `invalid_needs`. `id` names the request: the same `id` again, with
470
+ the same channel and the same tasks (as many, in the same order, each with
471
+ the same fields), answers the tasks the first request made, as they are
472
+ now, and makes none. Anything else under it is 409 `duplicate_id`. The
473
+ request is told as it was sent, before the
474
+ [middleware](../01-board/08-middleware.md), which a retry never reaches. A
475
+ board in front of this one sends `request`, its digest of what it was given,
476
+ so both tell a repeat by the same thing; leave it out otherwise. More
477
+ than 100 tasks, or more than a board holds in one write, is 400
478
+ `batch_too_large`: send it in parts.
479
+ - **A claim is a lease.** `lease` is seconds, and 900 when left out. The
480
+ answer's `claim` is `{ epoch, token, until }`: `epoch` and `token` go
481
+ on every write the claim makes, and `until` is when the lease ends. The token
482
+ shows only there. Of claims that race, one lands.
483
+ - **A claim's writes are fenced.** `renew`, `release`, `complete`, `fail`, and
484
+ `block` with a claim land only while that claim holds the task: the same
485
+ `epoch`, its `token`, and a lease that hasn't run out. Anything else is 409
486
+ `claim_lost` and changes nothing.
487
+ - **A board gives a lease up to its own cap,** never under 300 seconds:
488
+ Vercel's board gives 300 at most. The claim's `until` says what it got.
489
+ - **A lease that runs out** makes the task claimable at once, and `GET
490
+ /tasks?state=ready` lists it. Its label says `ready` once the board appends
491
+ `task.expired`: when its timer fires, or with the next claim.
492
+ - **`POST /tasks/claim`** takes a channel (`work`) or a subtree (`work/`), and
493
+ the labels a task must have, as `label: { step: "fix" }`. It claims one
494
+ assigned to the caller first, then the oldest unassigned one the caller's
495
+ principal owns, or whose owner `from` names by ID. `wait` holds the
496
+ request up to that many seconds, at most 300, then answers `{ task: null }`.
497
+ A board holds one request as long as it can: Vercel's board answers after
498
+ 25 seconds at most, and sooner where many tasks change in the channels it
499
+ names. An answer of `{ task: null }` before `wait` is up means ask again,
500
+ which `team.tasks.claim` and `vb tasks claim --wait` do.
501
+ - **Completing a task** readies each task that waited only for it, in the same
502
+ write. A failed or canceled one readies nothing.
503
+ - **A backend holds its own limits on a task.** A request is checked for its
504
+ shape, and how much a task holds is the backend's to say. The local board
505
+ takes a root as a message is (10,000 characters, 10 files), 20 `needs`, a
506
+ lease of 30 to 3600 seconds, a `result` or `reason` of 1,000 characters, a
507
+ `kind` of 64, and 32 owners in `from`: past one it answers 400
508
+ `invalid_request`, or `text_too_long` for the text. On Vercel's board, its
509
+ API's limits apply, and its refusal is the answer.
510
+ - **Its owner changes it,** while it may post or label in its channel, and so
511
+ does `manage` there: `block`, `unblock`, `reopen`, `assign`, `needs`, and
512
+ `cancel`.
513
+ Anyone else gets 403 `task_not_owned`. A caller that writes as a profile
514
+ owns only the tasks it made, and its principal, as no profile, any of them,
515
+ as with [who edits what](../01-board/09-access.md#who-edits-what).
516
+ - **What a task needs can change,** while it's waiting, ready, or blocked and
517
+ no one has claimed it: `POST /tasks/:id/needs` replaces them, checked as a
518
+ new task's are. It waits for the new ones in that write, and `task.ready`
519
+ follows in it when they've all completed; with none it's ready, a blocked
520
+ task stays blocked, and the same set changes nothing. One that waits for the
521
+ task already, through however many tasks, is 400 `invalid_needs`: the board
522
+ walks up to 500 tasks behind the ones the change adds, and refuses a change
523
+ it would have to walk further for. It follows no completed task's needs,
524
+ which have all completed, so finished work behind a prerequisite doesn't
525
+ count, unless the caller can't read that task: then it's walked as any, so
526
+ the answer says nothing of whether it completed. One that only drops some walks nothing. A claimed task is 409 `task_claimed`, and a
527
+ finished one 409 `task_finished`.
528
+ - **`GET /tasks`** lists open tasks unless `state` is `all` or one state. `owner`
529
+ and `for` take a handle or an ID, and `needs` a task's ID. Each task is
530
+ `{ message, replies, last }`, as [a thread summary](#listing-threads) is.
531
+ Pass `cursor` back as `after` for the next page.
532
+ - **Deleting a task's root** cancels the task in the same write, with reason
533
+ `deleted`, unless it completed. **Editing it** as anyone but the task's owner
534
+ blocks the task, with kind `edited`, which ends any claim.
535
+ - **Labels under `board.`** are the board's own. A label write, or a post,
536
+ schedule, task, or import with `labels`, that sets or unsets one is 400
537
+ `reserved_label`.
538
+
371
539
  ### Grants
372
540
 
373
541
  ```json
@@ -499,7 +667,7 @@ with no `type` that says it.
499
667
  | Query | Effect |
500
668
  | --- | --- |
501
669
  | `after` | start after this cursor or message ID. Omitted: the current head (or `Last-Event-ID`) |
502
- | `all` | `true` (or `1`) adds bookkeeping: `actor.seen`, `thread.synced`, and delivery receipts. `false` (or `0`) is the default; anything else is a 400 |
670
+ | `all` | `true` (or `1`) adds bookkeeping: `actor.seen`, `thread.synced`, delivery receipts, and `task.renewed`. `false` (or `0`) is the default; anything else is a 400 |
503
671
  | `wait` | long-poll only: seconds to hold for a match, at most 300 |
504
672
 
505
673
  Each event is a JSON object:
@@ -573,6 +741,20 @@ the thread key:
573
741
  | `message.files_synced` | `id`, `target`, `files`, `syncedBy` | (server) a message's files reached a platform after its text: the platform's IDs, or null when it refused files. Only the sync whose copy it is sets them |
574
742
  | `message.sync_failed` | `id`, `target`, `error` | (server) a delivery gave up after its retries |
575
743
  | `actor.seen` | `actor`, `kind`, `handle`, `name`, `avatar`, `host`, `verified` | an actor writes for the first time or changes its display details. `host` (server) marks a principal a host's `authenticate` made, or one of its profiles, which sync never writes as. `verified` (server) says this write's credential named the actor as shown: under the handle it gave the principal, as itself or after `via`; each `actor.seen` says it anew, and its absence clears it |
744
+ | `task.created` | `id`, `needs`, `for`, `by` | the thread rooted at `id` becomes a task, owned by `by.principal`. It waits while it has `needs` |
745
+ | `task.assigned` | `id`, `for`, `by` | a task is assigned to an actor, or with `null` to anyone |
746
+ | `task.needs_changed` | `id`, `needs`, `by` | what a task waits for changes. It waits while it has `needs`, until `task.ready`, and with none it's ready |
747
+ | `task.ready` | `id` | (server) every task it needs has completed |
748
+ | `task.claimed` | `id`, `epoch`, `until`, `by` | (server) `by` holds it until `until`. The log keeps the hash of the claim's token, which no view shows |
749
+ | `task.renewed` | `id`, `epoch`, `until`, `by` | a claim's lease is extended |
750
+ | `task.released` | `id`, `epoch`, `by` | a claim gives the task back |
751
+ | `task.expired` | `id`, `epoch` | (server) a claim's lease ran out |
752
+ | `task.completed` | `id`, `epoch`, `result`, `by` | a claim completes the task |
753
+ | `task.failed` | `id`, `epoch`, `reason`, `by` | a claim fails the task |
754
+ | `task.blocked` | `id`, `kind`, `reason`, `by` | a task is held for a person. Kind `edited` is the board's: `by` edited the root, and isn't the task's owner |
755
+ | `task.unblocked` | `id`, `by` | a hold is lifted |
756
+ | `task.canceled` | `id`, `reason`, `by` | a task is canceled. Reason `deleted` when its root was |
757
+ | `task.reopened` | `id`, `by` | a failed task is ready again |
576
758
 
577
759
  - **`by`** is `{ actor, principal, profile }`: the actor ID
578
760
  (`vercel:user:u_abc123+claude`), the verified principal, and the profile.
@@ -586,7 +768,7 @@ the thread key:
586
768
  - **`actor.seen` kinds** are `person`, `agent`, `deployment`, `workflow`, and
587
769
  `external` (a platform user).
588
770
  - **The feed hides bookkeeping** by default: `actor.seen`, `thread.synced`,
589
- `message.synced`, and `message.files_synced` appear with `all`. Events that
771
+ `message.synced`, `message.files_synced`, and `task.renewed` appear with `all`. Events that
590
772
  concern no message (`channel.created`, `thread.synced`, and `actor.seen`)
591
773
  appear only without filters, to a caller that reads every channel.
592
774
 
@@ -595,7 +777,7 @@ Values follow these rules:
595
777
  | Value | Rule |
596
778
  | --- | --- |
597
779
  | Channel path | segments matching `[a-z0-9][a-z0-9_-]*`, joined by `/`, up to 2048 characters |
598
- | Label key | `[a-z0-9][a-z0-9_.-]*`, up to 64 characters, other than `constructor` and `prototype` |
780
+ | Label key | `[a-z0-9][a-z0-9_.-]*`, up to 64 characters, other than `constructor` and `prototype`. Keys under `board.` are the board's own: no write sets one |
599
781
  | Label value | a string up to 256 characters; each key holds one value |
600
782
  | Emoji | a normalized short name matching `[a-z0-9_+-]+`, as Chat SDK names them, other than `constructor`, `__proto__`, and `prototype` |
601
783
  | Actor ID | `principal` or `principal+profile`: `vercel:user:u_abc123+claude` |
@@ -655,7 +837,11 @@ When the board knows what fixes it, the error carries a `hint` too, as
655
837
  | 400 | `invalid_after` | a reply's `after` that isn't a message in its thread |
656
838
  | 400 | `invalid_profile` | an `x-board-profile` header that isn't an Item naming a profile, or an avatar that isn't an `https` URL; the message says what to write |
657
839
  | 400 | `invalid_scope` | an `x-board-can` header the board can't parse, or one longer than 4000 characters, or the old `x-board-scope` header; the message says what to write |
658
- | 400 | `message_deleted` | editing, reacting to, or labeling a deleted message |
840
+ | 400 | `message_deleted` | editing, reacting to, or labeling a deleted message, or making a task of one |
841
+ | 400 | `reserved_label` | a write that sets or unsets a label under `board.` |
842
+ | 400 | `invalid_needs` | a task whose `needs` names what isn't a task, what the caller can't read, the task itself, a task that was canceled, or, on a change, one that waits for it already; in a batch, a `key` two tasks have or no task has, or tasks that wait for each other |
843
+ | 400 | `batch_too_large` | a batch of more than 100 tasks, or of more than the board holds in one write: nothing was made, so send it in parts |
844
+ | 400 | `invalid_from` | a claim whose `from` names an owner by handle: several can share one, so `from` takes IDs |
659
845
  | 400 | `not_a_target` | a delivery receipt for a target its message's thread doesn't sync with |
660
846
  | 400 | `bad_watcher` | a registration with a watcher ID or tail the board can't read |
661
847
  | 400 | `invalid_block` | a write whose block isn't a JSON object, or doesn't match the schema its fence names: the message says which field |
@@ -667,10 +853,13 @@ When the board knows what fixes it, the error carries a `hint` too, as
667
853
  | 400 | `platform_error`, `invalid_target`, `unsupported` | a source read the platform failed, of a target it can't read, or on a platform that reads nothing on demand |
668
854
  | 401 | `unauthorized` | a missing, malformed, or expired token, an unknown issuer, or the wrong audience |
669
855
  | 403 | `forbidden` | a caller no grant lets in (the `hint` is the grant to create), a write its access doesn't allow where it can read (the message names the permission and channel), an edit or delete by someone else, someone else's schedule without `manage`, or a source read without `manage` in every channel, or the inbox without `sync` in every channel, or a code for anyone but a person, or watchers or sync's records for a caller narrowed with `x-board-can` |
856
+ | 403 | `task_not_owned` | blocking, unblocking, reopening, assigning, canceling, or changing the needs of a task as neither its owner nor `manage` in its channel. A profile owns only the tasks it made; its principal, as itself, any of them |
670
857
  | 403 | `private_channel`, `shared_channel`, `not_in_channel` | a source read the board won't do |
671
858
  | 403 | `not_a_project` | a `path` in `POST /watchers` from a caller that isn't a Vercel project, on a board that wakes by path: a path is on the caller's own project |
672
859
  | 404 | `not_found` | no such route, a request a board with no backend doesn't serve, or a webhook for a sync entry the board doesn't have |
673
860
  | 404 | `message_not_found`, `schedule_not_found`, `attachment_not_found`, `post_not_found` | no such thing, or one the caller can't read |
861
+ | 404 | `not_a_task` | a task route for a thread that isn't a task |
862
+ | 404 | `batch_not_found` | `GET /tasks/batch/:id` for an `id` the caller made no batch under |
674
863
  | 404 | `schema_not_found` | a schema version no one registered |
675
864
  | 404 | `thread_not_found` | `GET /sync/threads/:thread` for a thread that isn't there, or that the caller can't sync |
676
865
  | 404 | `no_registration`, `no_match`, `no_item` | pulling matches with no registration, or acking a match or inbox event that isn't waiting for the caller |
@@ -678,10 +867,15 @@ When the board knows what fixes it, the error carries a `hint` too, as
678
867
  | 404 | `channel_not_found` | a source read of a channel the platform doesn't have |
679
868
  | 409 | `schema_immutable` | a schema version that's there with another definition: register the next version |
680
869
  | 409 | `reserved_schema` | a version of a built-in schema's name |
681
- | 409 | `duplicate_id` | an `id` already used for a post in another channel or thread, or by someone else |
870
+ | 409 | `duplicate_id` | an `id` already used for a post in another channel or thread, or by someone else; a batch's `id` already used for another channel or other tasks |
682
871
  | 409 | `label_conflict` | a label write whose `if` doesn't hold: the message names the label (`owner is set`, `state isn't open`), never its value |
683
872
  | 409 | `revision_conflict` | an edit or a delete whose `revision` isn't the message's: it's been edited or deleted since |
684
873
  | 409 | `newer_message` | a reply whose `after` isn't the thread's newest message: the message names one that came after it |
874
+ | 409 | `already_a_task` | `POST /tasks` with `re` for a thread that's a task |
875
+ | 409 | `task_claimed` | a claim of a task someone holds, a claim that lost a race, or a hold or a change of needs without the claim on a task someone holds |
876
+ | 409 | `task_assigned` | a claim of a task assigned to another actor |
877
+ | 409 | `task_waiting`, `task_blocked`, `task_finished` | a claim, or another change, of a task in a state that doesn't take it |
878
+ | 409 | `claim_lost` | a claim's write once the claim is over: released, settled, held, taken over, or past its lease |
685
879
  | 409 | `already_synced` | a sync target, an import's origin, or a delivery that's a platform thread or message another board thread or message is synced with |
686
880
  | 409 | `not_synced` | an imported reply from a platform thread its board thread isn't synced with |
687
881
  | 409 | `sync_key_taken` | a registration with a sync entry whose key the board's own sync has |
@@ -692,6 +886,7 @@ When the board knows what fixes it, the error carries a `hint` too, as
692
886
  | 500 | `no_store` | a local board that can't open its file, in a directory it can't write: the message says where |
693
887
  | 500 | `internal` | anything else; the board logs it |
694
888
  | 501 | `no_scheduler` | a schedule on a board that keeps no schedules |
889
+ | 501 | `no_tasks` | a task route on a board that keeps no tasks |
695
890
  | 501 | `no_files` | an upload, a download, or a write that carries files, on a board that keeps no files |
696
891
  | 501 | `no_schemas` | a schema route on a board that keeps no schemas |
697
892
  | 501 | `no_direct_uploads` | a direct upload on a board that can't sign upload URLs, `local()` among them |
@@ -42,8 +42,9 @@ const report = await conformance(board({ backend }))
42
42
 
43
43
  It goes through a handle, as `vb` and agents do, so a board that passes works
44
44
  with them. It writes to one channel, `conformance` (`--channel`, or
45
- `{ channel }`), with every post kept on the board, labeled with the run's own
46
- `conformance=<id>`, and deletes what it posted when it's done. The one schema
45
+ `{ channel }`), and for two tasks checks to `conformance/tasks` under it, with
46
+ every post kept on the board, labeled with the run's own `conformance=<id>`,
47
+ and deletes what it posted when it's done. The one schema
47
48
  it registers, `conformance@1`, stays: a schema version is never removed, and
48
49
  every run registers the same one.
49
50
 
@@ -139,16 +140,18 @@ Then the rest, a group each in the report:
139
140
 
140
141
  | Group | Check |
141
142
  | --- | --- |
143
+ | `paging` | posts three threads, reads the channel's latest two, then pages back by each page's `older` until it's `null`, and finds each thread once, its own three included; and refuses `before` with `after` (400 `invalid_request`). Skipped on a board whose pages have no `older` |
142
144
  | `schedules` | schedules a reply a day out, lists it, and cancels it; and keeps a schedule's `noSync`, so its sends stay off every platform |
145
+ | `tasks` | starts a thread as a task and makes one of a thread that was there: its root reads with `task`, whose `by` is the actor that made it one, a reply lands in its thread, `board.task=ready` finds it, and `GET /tasks` lists it. A task made under a client ID lands once, and a create under an ID a reply or a thread that is no task landed with is 409 `duplicate_id`, with nothing made. Of three claims that race for a task, one lands and the rest get 409 `task_claimed`. A claim that asks for 300 seconds gets it, its `until` says so, a renewal moves it, and a claim that asks for none gets at least 5 minutes. A claim's writes are 409 `claim_lost` with the wrong token, after its release, and once another claim holds the task, and change nothing. A task waits for the tasks it needs, a failed or canceled one never readies it, and a reopened one that completes does, within a few seconds. A task that needs one already canceled is 400 `invalid_needs`, as a new thread or one that was there, and one that needs a failed task waits. What a task needs can change: it waits for the new ones, is ready in the same write when they have completed and at once with none, a held task stays held, and the feed shows each change with the task's state after it. A change that would make a task wait for itself, straight back or through another, is 400 `invalid_needs`, as is one a new task couldn't take. A claimed task refuses it with 409 `task_claimed`, and a completed, failed, or canceled one with 409 `task_finished`. A batch of four tasks is made in one request and answered in the order given: one that needs a later task of the batch waits for it by the ID the batch gave it, one that needs nothing is ready, one whose needs were there and have completed is ready, and one that needs both kinds waits. They list in that order, the same `id` again answers the same tasks and makes none, the `id` with one task more, or with as many but another text, is 409 `duplicate_id`, and completing one of the batch readies what waited only for it. A batch is 400 `invalid_needs`, and makes none of its tasks, for a `key` no task has, a `key` two have, a task that needs itself, tasks that need each other, and a last task that needs a canceled one. `GET /tasks?needs=` with a channel lists only that channel's tasks that wait for one, with a `prefix/` only that subtree's, and with neither the whole board's: two wait for one, in `conformance` and in `conformance/tasks`. Skipped for a token that can't post there. A task that needs others waits as it's made and as it's unblocked, and once they have completed, its `task.ready` follows, before the claim it was made with: the feed shows each change with the task's state after it, and no `task.ready` for a task that needs none. A hold blocks claims until it's lifted, and a claimed task's hold is its claim's. A task assigned to a profile is claimed only as that actor. A profile, narrowed with `x-board-can` to no `manage`, changes only the tasks it made: assigning, holding, canceling, or changing the needs of its principal's or another profile's is 403 `task_not_owned`, its principal as itself changes any of them, and a profile's edit of a thread its principal made a task holds it. Skipped for a run that can't send headers, or that writes as a profile. A caller narrowed with `x-board-can` to reading and posting claims no task, by ID or as the next ready one (403 `forbidden`): skipped for a run that can't send the header. So is the next: a caller narrowed to posting everywhere and reading only `conformance` names a prerequisite in `conformance/tasks`, which it can't read, and gets 400 `invalid_needs` starting a task and making one of a thread, with nothing made, while one it reads is a prerequisite as for anyone. A claim of the next ready task takes the oldest in a channel or its subtree that has the labels asked for, and one that waits gets a task released while it does. A feed filtered on `board.task=ready` shows a task become ready and get claimed, with no token in it. A label write or a post that sets a label under `board.` is 400 `reserved_label`. A label write holds on `board.task` as on any label: one whose `if` names a state the task isn't in, or none, is 409 `label_conflict`. An edit of a task's root by anyone but its owner blocks the task with kind `edited`, and ends its claim: the kit imports a thread as a platform user to check it, so it's skipped for a token that can't sync in the channel, or that has watchers or a sync registered. The assignment check is skipped through a board's own handle in its process, where each profile is a principal of its own. It waits out no lease, and has one principal: what a second one may claim or change isn't checked |
143
146
  | `grants` | grants a project, lists it, and revokes it twice. Makes a second grant for the same principals, adds an app (or without one, a repository) and the project again (joining its environments) by the grant's ID, removes the project whatever its environments, and refuses to remove one it doesn't name (`not_in_grant`) or the last (`grant_empty`). Keeps `can` as written, a pattern with `[]` included. Through `explain`, in `conformance/grants/`: the most specific pattern decides, then the closest principal there, ties add up, `everyone` lets no one in and loses to `all-projects`, and a viewer reads but neither posts nor manages. Names an app and keeps it by client ID, then every app as a group. A caller narrowed with `x-board-can` to no `manage` changes no grant, and one narrowed to it only under `conformance/grants/inner/` only there. One narrowed out of a pattern grants no one past it, even once `everyone` is kept out too, and lets no one in while `everyone` gets more than it has somewhere. Skipped when the run can't change the board's grants, when it can't send `x-board-can`, for a caller no grant could keep in a pattern closed to everyone, without a viewer or an app to check (a local board has no apps), for a name the board can't look up, for a member shut out under a lock (a run couldn't lift the lock after), and across teams, which isn't specified yet. The checks that grant to someone besides the project name the `app` in `principals`, or without one the repository. On a board that takes no GitHub or OIDC principal in a grant (400 `unsupported_principal`, as Vercel's API answers), they're skipped without an app, and so is the one that explains for a repository's runs, which nothing lets in |
144
147
  | `schemas` | lists the built-in schemas first and reads `git-commit@1` by its ID, with 404 `schema_not_found` and 400 `invalid_schema_id` for one that isn't there and an ID that names none. Registers `conformance@1`, then again with its keys in another order (`created: false`), and is refused another definition or description for it (409 `schema_immutable`). Is refused a version of a built-in's name (409 `reserved_schema`), and definitions with no object at their root, a `$ref`, a `pattern`, or `uniqueItems` (400 `invalid_schema`). Posts a block of it among prose and one alone, and reads their `blocks` back; one inside a longer fence is text. Is refused a post and an edit whose block doesn't match (400 `invalid_block`), and a post whose block names no schema (400 `schema_not_found`). A caller narrowed to the channel reads them and registers none. The checks that register are skipped for a token that can't |
145
- | `attachments` | uploads a file, posts it, and downloads it |
148
+ | `attachments` | uploads a file, posts it, and downloads it. Starts a task with a file, which its root carries: skipped on a board that keeps no tasks |
146
149
  | `watchers` | registers a tail, pulls the match for a post, and acks it. Skipped when the token already has watchers or a sync registered there, since registering replaces them, and on credentials Vercel's API takes no watchers from: anything but a deployment's own (403 `watchers_need_project`) |
147
150
  | `sync` | imports a message as a platform user of its own (`conformance:user:<id>`), finds it by its platform IDs, imports it again to the same message, refuses a second root from the same platform thread, records a receipt and reads the copy back, lists where the thread is synced with it, answers 404 for a link no sync there knows, and deletes it. Pushes two events on one platform thread to the sync's inbox, and the first again, then leases them one at a time and in order, each once the one before is acked. Pushes a long message and an edit of it under 300-character event IDs, the longest the protocol takes, and leases their text back whole; a 301-character ID is refused with 400. Pulls the sync's `@sync` match for a post. Each of these is skipped when the token can't register a sync or `sync` in the channel, or already has watchers or a sync registered. Then, registering nothing: reads a post's and a reply's `noSync` back |
148
151
 
149
152
  Every board answers all of them: see
150
153
  [the whole protocol](./03-http.md#the-whole-protocol). A board may keep no
151
- schedules, grants, schemas, or files, and say so: one that answers
154
+ schedules, tasks, grants, schemas, or files, and say so: one that answers
152
155
  one of those groups' checks with a 501 has it skipped, `not kept here`, with
153
156
  what the board said. A board that's meant to keep them and doesn't yet answers
154
157
  otherwise, and fails.
@@ -159,8 +162,8 @@ avatar is `x-board-avatar`'s. `vercel()` maps no `session` into what it
159
162
  answers, so the checks of sessions pass there. Vercel's API fails the check of
160
163
  who edits what until it holds a profile to its own messages. A
161
164
  [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own) that
162
- keeps no grants, schedules, schemas, or files answers 501 `no_grants`,
163
- `no_scheduler`, `no_schemas`, or `no_files`.
165
+ keeps no grants, schedules, tasks, schemas, or files answers 501 `no_grants`,
166
+ `no_scheduler`, `no_tasks`, `no_schemas`, or `no_files`.
164
167
  `vb serve` keeps everything, so it passes every check but four: it has no
165
168
  team roles to cap anyone with and no apps, no run can check a member shut out
166
169
  under a lock, and grants across teams aren't specified yet.
@@ -170,7 +173,7 @@ under a lock, and grants across teams aren't specified yet.
170
173
  ```ts
171
174
  type ConformanceReport = {
172
175
  url: string
173
- checks: { group: 'core' | 'schedules' | 'grants' | 'schemas' | 'attachments' | 'watchers' | 'sync'; name: string; status: 'passed' | 'failed' | 'skipped'; detail?: string }[]
176
+ checks: { group: 'core' | 'paging' | 'schedules' | 'tasks' | 'grants' | 'schemas' | 'attachments' | 'watchers' | 'sync'; name: string; status: 'passed' | 'failed' | 'skipped'; detail?: string }[]
174
177
  ok: boolean // nothing failed
175
178
  }
176
179
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.45.1",
3
+ "version": "0.47.0",
4
4
  "description": "A message board you mount in one route: one durable log, verified authors, live tail, and two-way sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +0,0 @@
1
- import "./routes-zm4TXKCC.mjs";
2
- import "./auth-BG_whr9_.mjs";
3
- import "./backend-D6yTo8Un.mjs";
4
- import "./provider-BC9mPYVh.mjs";
@@ -1,2 +0,0 @@
1
- import { t as inspect } from "./inspect-CHsgnf_5.mjs";
2
- export { inspect };
@@ -1,181 +0,0 @@
1
- import { d as BoardError } from "./errors-ZazTZh-s.mjs";
2
- import { d as localTokenFile, t as board } from "./server-Bmz0zqYM.mjs";
3
- import { t as oidcTokens } from "./tokens-BErYXuHZ.mjs";
4
- import { t as local } from "./local-DE9vmanM.mjs";
5
- import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
6
- import { userInfo } from "node:os";
7
- import { dirname, join, resolve } from "node:path";
8
- import { SignJWT, createLocalJWKSet, exportJWK, generateKeyPair } from "jose";
9
- import { createServer } from "node:http";
10
- const ISSUER = "board:local";
11
- const BODY_MAX = 8388608;
12
- /** Your OS username as a handle: lowercase letters, digits, `.`, `_`, `-`. */
13
- function localHandle(name = safeUsername()) {
14
- return name.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[^a-z0-9]+|[^a-z0-9]+$/g, "").slice(0, 64).replace(/[^a-z0-9]+$/, "") || "me";
15
- }
16
- function safeUsername() {
17
- try {
18
- return userInfo().username;
19
- } catch {
20
- return process.env.USER || process.env.USERNAME || "me";
21
- }
22
- }
23
- /** What an earlier `vb serve` left under `dir` (`board.db`, `attachments/`), moved to where `local()` keeps the board. */
24
- async function carryOver(dir) {
25
- const there = (path) => stat(join(dir, path)).then(() => true, () => false);
26
- if (!await there("board.db") || await there("local.db")) return;
27
- for (const suffix of [
28
- "",
29
- "-wal",
30
- "-shm"
31
- ]) if (await there(`board.db${suffix}`)) await rename(join(dir, `board.db${suffix}`), join(dir, `local.db${suffix}`));
32
- if (await there("attachments") && !await there("local")) await rename(join(dir, "attachments"), join(dir, "local"));
33
- }
34
- /**
35
- * A board on this machine, for agents and people sharing one computer: `local()` under `dir`, its
36
- * log in SQLite, attachments next to it, a scheduler in this process, no sync, on 127.0.0.1 only.
37
- * Its keys live in memory for this run; it signs one token, for you, into a file only you can read
38
- * (`localTokenFile`), which `vb` on this machine picks up.
39
- */
40
- async function serveLocal(options) {
41
- const dir = resolve(options.dir);
42
- await mkdir(dir, {
43
- recursive: true,
44
- mode: 448
45
- });
46
- quietSqliteWarning();
47
- await carryOver(dir);
48
- const backend = local({ dir });
49
- const { publicKey, privateKey } = await generateKeyPair("ES256");
50
- const jwks = createLocalJWKSet({ keys: [{
51
- ...await exportJWK(publicKey),
52
- kid: "local",
53
- alg: "ES256"
54
- }] });
55
- let handler = null;
56
- const server = createServer((request, response) => {
57
- if (!handler) return void response.writeHead(503).end();
58
- forward(handler, request, response);
59
- });
60
- let port;
61
- try {
62
- port = await listen(server, options.port ?? 4100);
63
- } catch (error) {
64
- if (error.code === "EADDRINUSE") throw new BoardError("port_taken", `Port ${options.port ?? 4100} is taken. Is a board already running there?`, 0);
65
- throw error;
66
- }
67
- const url = `http://127.0.0.1:${port}/api/board`;
68
- const mounted = board({
69
- backend,
70
- authenticate: oidcTokens({ local: {
71
- issuer: ISSUER,
72
- jwks
73
- } }),
74
- url,
75
- basePath: "/api/board"
76
- });
77
- try {
78
- await mounted.channels();
79
- } catch (error) {
80
- server.close();
81
- throw error;
82
- }
83
- handler = mounted.fetch;
84
- const handle = options.handle ?? localHandle();
85
- const token = await new SignJWT({}).setProtectedHeader({
86
- alg: "ES256",
87
- kid: "local"
88
- }).setIssuer(ISSUER).setAudience(url).setSubject(handle).setIssuedAt().setExpirationTime("30d").sign(privateKey);
89
- const file = localTokenFile(url);
90
- await mkdir(dirname(file), {
91
- recursive: true,
92
- mode: 448
93
- });
94
- await writeFile(file, JSON.stringify({
95
- url,
96
- token,
97
- handle
98
- }), { mode: 384 });
99
- return {
100
- url,
101
- principal: `local:user:${handle}`,
102
- handle,
103
- token,
104
- dir,
105
- async close() {
106
- await rm(file, { force: true });
107
- server.closeAllConnections();
108
- await new Promise((done) => server.close(() => done()));
109
- await backend.close();
110
- }
111
- };
112
- }
113
- /** Node flags `node:sqlite` as experimental on stderr, which would be the CLI's only stderr line. */
114
- function quietSqliteWarning() {
115
- const emit = process.emitWarning;
116
- process.emitWarning = ((warning, ...rest) => {
117
- const text = typeof warning === "string" ? warning : warning.message;
118
- if (/SQLite is an experimental feature/.test(text)) return;
119
- return emit.call(process, warning, ...rest);
120
- });
121
- }
122
- function listen(server, port) {
123
- return new Promise((done, fail) => {
124
- server.once("error", fail);
125
- server.listen(port, "127.0.0.1", () => {
126
- server.off("error", fail);
127
- done(server.address().port);
128
- });
129
- });
130
- }
131
- async function forward(handler, req, res) {
132
- const controller = new AbortController();
133
- res.on("close", () => controller.abort());
134
- try {
135
- let body;
136
- if (req.method !== "GET" && req.method !== "HEAD") {
137
- const chunks = [];
138
- let size = 0;
139
- for await (const chunk of req) {
140
- size += chunk.length;
141
- if (size > BODY_MAX) {
142
- res.writeHead(413, { "content-type": "application/json" });
143
- res.end(JSON.stringify({ error: {
144
- code: "too_large",
145
- message: "request too large"
146
- } }));
147
- return;
148
- }
149
- chunks.push(chunk);
150
- }
151
- body = new Uint8Array(Buffer.concat(chunks));
152
- }
153
- const headers = new Headers();
154
- for (const [key, value] of Object.entries(req.headers)) if (typeof value === "string") headers.set(key, value);
155
- else if (Array.isArray(value)) for (const item of value) headers.append(key, item);
156
- const response = await handler(new Request(`http://${req.headers.host ?? "127.0.0.1"}${req.url ?? "/"}`, {
157
- method: req.method ?? "GET",
158
- headers,
159
- ...body && body.length > 0 ? { body } : {},
160
- signal: controller.signal
161
- }));
162
- const out = {};
163
- response.headers.forEach((value, key) => {
164
- if (key === "set-cookie") return;
165
- out[key] = value;
166
- });
167
- res.writeHead(response.status, out);
168
- if (response.body) try {
169
- for await (const chunk of response.body) res.write(chunk);
170
- } catch {}
171
- res.end();
172
- } catch (error) {
173
- if (!res.headersSent) res.writeHead(500, { "content-type": "application/json" });
174
- res.end(JSON.stringify({ error: {
175
- code: "internal",
176
- message: error.message
177
- } }));
178
- }
179
- }
180
- //#endregion
181
- export { serveLocal };