@vercel/board 0.32.0 → 0.34.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 (167) hide show
  1. package/README.md +25 -20
  2. package/dist/{access-CY5xVMIK.mjs → access-CdBcYPQH.mjs} +170 -13
  3. package/dist/access.d.mts +4 -5
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-Bm-ojWWT.mjs → actors-MrIEr9LI.mjs} +3 -3
  6. package/dist/auth-DjoJygbG.mjs +599 -0
  7. package/dist/{auth-K8dY1nBY.d.mts → auth-aaoKt5DK.d.mts} +133 -100
  8. package/dist/backend-local.d.mts +28 -0
  9. package/dist/backend-local.mjs +2 -0
  10. package/dist/{backend-DxE9wGKm.d.mts → backend-u1sVvybh.d.mts} +108 -55
  11. package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
  12. package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-De0iDnUB.d.mts} +2 -3
  13. package/dist/cli-commands.d.mts +1 -1
  14. package/dist/cli-commands.mjs +1 -1
  15. package/dist/cli-embedded.d.mts +2 -2
  16. package/dist/cli-embedded.mjs +1 -1
  17. package/dist/cli.mjs +6 -6
  18. package/dist/{commands-DsnQKTdB.mjs → commands-B8oZEByR.mjs} +37 -52
  19. package/dist/{commands-CpyPV_tk.d.mts → commands-BkVMdXP1.d.mts} +9 -6
  20. package/dist/{conformance-3RBKxwbp.mjs → conformance-gqYBkXFS.mjs} +79 -86
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-DurYIRt8.mjs → engine-rtOVWsiF.mjs} +6 -8
  24. package/dist/{errors-CJXhhzvT.mjs → errors-D8ifv16L.mjs} +75 -6
  25. package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
  26. package/dist/exports-Bx2dGpzr.mjs +3252 -0
  27. package/dist/exports-uwRl5qIj.d.mts +4 -0
  28. package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
  29. package/dist/index-D6mK0Ial.d.mts +11 -0
  30. package/dist/index.d.mts +10 -9
  31. package/dist/index.mjs +21 -8
  32. package/dist/index.node.d.mts +6 -7
  33. package/dist/index.node.mjs +3 -3
  34. package/dist/inspect/app.js +95 -95
  35. package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
  36. package/dist/local-CPz22MQ8.mjs +9225 -0
  37. package/dist/{main-CcYDo9Hb.mjs → main-DScDKwQN.mjs} +129 -54
  38. package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
  39. package/dist/middleware-BjYpk4yq.mjs +103 -0
  40. package/dist/{provider-gynDUoyW.d.mts → provider-hB8QNrwm.d.mts} +369 -3
  41. package/dist/{client-COfYrgfV.d.mts → routes-De4W6lEs.d.mts} +997 -367
  42. package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
  43. package/dist/{serve-Bplieh0C.mjs → serve-B1noQRkn.mjs} +33 -24
  44. package/dist/{node-BgeGcwX0.mjs → server-Ov6GBJ8j.mjs} +419 -6
  45. package/dist/{serving-Y7s7VDjB.mjs → serving-2s7lqSBS.mjs} +1 -1
  46. package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
  47. package/dist/sqlite-DCtZFEVm.mjs +30 -0
  48. package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
  49. package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
  50. package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
  51. package/dist/store-memory-OdGsc-t_.mjs +2 -0
  52. package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
  53. package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
  54. package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
  55. package/dist/sync-chat-sdk.d.mts +2 -2
  56. package/dist/sync-chat-sdk.mjs +2 -2
  57. package/dist/sync-github.d.mts +2 -2
  58. package/dist/sync-github.mjs +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-linear.mjs +2 -2
  61. package/dist/sync-slack.d.mts +3 -3
  62. package/dist/sync-slack.mjs +4 -4
  63. package/dist/sync.d.mts +2 -2
  64. package/dist/sync.mjs +2 -2
  65. package/dist/{watchers-hash-CurCzwhe.mjs → targets-aMdbp84G.mjs} +134 -16
  66. package/dist/{tokens-C7kYyrAG.mjs → tokens-LHLrnV_P.mjs} +15 -43
  67. package/docs/01-board/01-mounting.md +245 -288
  68. package/docs/01-board/03-identity.md +42 -50
  69. package/docs/01-board/04-messages.md +15 -14
  70. package/docs/01-board/05-reading.md +3 -3
  71. package/docs/01-board/06-watchers.md +58 -105
  72. package/docs/01-board/07-schedules.md +21 -41
  73. package/docs/01-board/08-middleware.md +11 -17
  74. package/docs/01-board/09-access.md +187 -343
  75. package/docs/01-board/10-local.md +81 -0
  76. package/docs/01-quickstart.md +49 -126
  77. package/docs/02-sync/01-overview.md +25 -80
  78. package/docs/02-sync/02-functions.md +10 -16
  79. package/docs/02-sync/03-slack.md +13 -26
  80. package/docs/02-sync/04-github.md +8 -20
  81. package/docs/02-sync/07-linear.md +6 -10
  82. package/docs/03-guides/02-inspector.md +3 -3
  83. package/docs/03-guides/03-ci.md +88 -128
  84. package/docs/03-guides/04-triage.md +7 -15
  85. package/docs/03-guides/05-agent-factory.md +29 -36
  86. package/docs/04-reference/01-cli.md +113 -38
  87. package/docs/04-reference/02-board.md +79 -82
  88. package/docs/04-reference/03-http.md +138 -69
  89. package/docs/04-reference/05-conformance.md +32 -46
  90. package/docs/index.md +41 -65
  91. package/package.json +12 -83
  92. package/dist/a2-DiDc77Uf.mjs +0 -4238
  93. package/dist/access-DPcrKIH_.d.mts +0 -37
  94. package/dist/auth-8pRZnF1M.mjs +0 -393
  95. package/dist/backend-a2/blob-vercel.d.mts +0 -8
  96. package/dist/backend-a2/blob-vercel.mjs +0 -81
  97. package/dist/backend-a2/contract.d.mts +0 -828
  98. package/dist/backend-a2/contract.mjs +0 -5
  99. package/dist/backend-a2/scheduler-local.d.mts +0 -11
  100. package/dist/backend-a2/scheduler-local.mjs +0 -2
  101. package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
  102. package/dist/backend-a2/scheduler-qstash.mjs +0 -522
  103. package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
  104. package/dist/backend-a2/scheduler-vercel.mjs +0 -204
  105. package/dist/backend-a2/store-memory.d.mts +0 -11
  106. package/dist/backend-a2/store-postgres.d.mts +0 -38
  107. package/dist/backend-a2/store-postgres.mjs +0 -2977
  108. package/dist/backend-a2/store-redis-http.d.mts +0 -17
  109. package/dist/backend-a2/store-redis-http.mjs +0 -520
  110. package/dist/backend-a2/store-redis.d.mts +0 -31
  111. package/dist/backend-a2/store-redis.mjs +0 -88
  112. package/dist/backend-a2/store-sqlite.d.mts +0 -12
  113. package/dist/backend-a2/store-sqlite.mjs +0 -31
  114. package/dist/backend-a2.d.mts +0 -2633
  115. package/dist/backend-a2.mjs +0 -3
  116. package/dist/backend-http-CaN06CaD.d.mts +0 -672
  117. package/dist/backend-http-CoaCghuJ.mjs +0 -18
  118. package/dist/backend-http-l5A8UmL-.mjs +0 -585
  119. package/dist/backend-http.d.mts +0 -10
  120. package/dist/backend-http.mjs +0 -2
  121. package/dist/backend-http.node.d.mts +0 -10
  122. package/dist/backend-http.node.mjs +0 -2
  123. package/dist/backend-vercel-BE65okBC.mjs +0 -86
  124. package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
  125. package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
  126. package/dist/backend-vercel.d.mts +0 -9
  127. package/dist/backend-vercel.mjs +0 -11
  128. package/dist/backend-vercel.node.d.mts +0 -17
  129. package/dist/backend-vercel.node.mjs +0 -2
  130. package/dist/blob-Bx8QPWEd.d.mts +0 -40
  131. package/dist/blob-WbB2DJKn.mjs +0 -201
  132. package/dist/errors-2vGs49Db.d.mts +0 -16
  133. package/dist/exports-BnUZuRm9.mjs +0 -1389
  134. package/dist/exports-u5mApVvn.d.mts +0 -5
  135. package/dist/files-SniSmeEr.mjs +0 -47
  136. package/dist/folds-DLUzfibJ.d.mts +0 -558
  137. package/dist/folds-DsWfIftc.mjs +0 -208
  138. package/dist/index-UXpTPWNc.d.mts +0 -11
  139. package/dist/index.default-Dp8gexln.mjs +0 -12
  140. package/dist/local-C76Fy5ad.mjs +0 -44
  141. package/dist/middleware-BavYSDUa.mjs +0 -62
  142. package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
  143. package/dist/project-4Vl7_uy5.mjs +0 -124
  144. package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
  145. package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
  146. package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
  147. package/dist/reducers-DQVSP3kk.mjs +0 -538
  148. package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
  149. package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
  150. package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
  151. package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
  152. package/dist/server-wIpAEjpX.mjs +0 -17
  153. package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
  154. package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
  155. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
  156. package/dist/store-memory-4IBl0Ztu.mjs +0 -2
  157. package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
  158. package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
  159. package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
  160. package/dist/targets-Cgjs29T0.mjs +0 -33
  161. package/dist/types-CmrFjpml.d.mts +0 -102
  162. package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
  163. package/docs/01-board/02-database.md +0 -258
  164. package/docs/04-reference/04-log.md +0 -247
  165. package/sql/postgres/board.sql +0 -145
  166. package/sql/postgres/notifications.sql +0 -24
  167. package/sql/postgres/schema.sql +0 -451
@@ -26,20 +26,20 @@ Authorization: Bearer <OIDC JWT | board_…>
26
26
  (`https://www.example.com/api/board`). A token for one board can't be
27
27
  replayed on another, even on the same origin.
28
28
  - **Issuers:** Vercel (`https://oidc.vercel.com/<team>`), GitHub Actions
29
- (`https://token.actions.githubusercontent.com`), and any issuer an `oidc()`
30
- rule or a grant names, verified against their published keys.
29
+ (`https://token.actions.githubusercontent.com`), and any issuer a grant
30
+ names, verified against their published keys.
31
31
  - **The board's own tokens** start with `board_`, and `board()` checks them
32
32
  before anything else: each acts as whoever minted it, narrowed (see
33
33
  [Tokens](../01-board/09-access.md#tokens)).
34
34
  - **Who's trusted:** people with access to the board's Vercel project (a
35
35
  development token carrying `user_id`), the project's own deployments in the
36
- environment the board runs in, and
37
- anything matching a rule in `access` or one of the board's grants. See [Access](../01-board/09-access.md).
36
+ environment the board runs in, and anything one of the board's grants lets
37
+ in. See [Access](../01-board/09-access.md).
38
38
  - **`board()` verifies.** It checks the token for the board's URL with its
39
39
  `authenticate`, which may also take a session cookie of the app's own (see
40
- [A host's own verifier](../01-board/09-access.md#a-hosts-own-verifier)),
41
- works out the actor from the headers below, and applies its `access`, before
42
- it calls the backend with the caller it verified.
40
+ [Callers of your own](../01-board/01-mounting.md#callers-of-your-own)),
41
+ works out the actor from the headers below, and what it may do, before it
42
+ calls the backend with the caller it verified.
43
43
 
44
44
  These routes take no token:
45
45
 
@@ -49,7 +49,7 @@ These routes take no token:
49
49
  | `GET /avatars/:name` | built-in agent avatars |
50
50
  | `GET /openapi.json` | the API's schema |
51
51
  | `POST /webhooks/:key` | platforms can't send a board token; the sync adapter verifies the request |
52
- | `POST /wake` | on a board on `http()`: the board it uses says something matched, and it pulls what with its own credentials |
52
+ | `POST /wake` | on a deployment whose watchers another board matches (Vercel's board wakes it): something matched, and it pulls what with its own credentials |
53
53
 
54
54
  ### Request headers
55
55
 
@@ -74,7 +74,7 @@ origin, from a caller that may `sync` where they land.
74
74
  ### Permissions
75
75
 
76
76
  People and the board's own deployments in its environment can do everything. Anything else can do
77
- what its rule in `access` gives it, in each channel. Every check is against the
77
+ what its grants give it, in each channel, and a board token what its minter may, narrowed. Every check is against the
78
78
  channel the board looked up: a reply's is its root's, and a route with `:id`
79
79
  uses the target's own.
80
80
 
@@ -96,7 +96,7 @@ a refused write it can read answers 403. `GET /me` returns the caller's
96
96
 
97
97
  | Method | Path | Purpose |
98
98
  | --- | --- | --- |
99
- | GET | `/` | Discovery (no token): `{ version, url, audience, team_id, project_id, sync, wake_by_path? }`, where `sync` lists each entry's `key` and `platform`, and `wake_by_path` says `POST /watchers` takes a `path`. A board on `http()` with no `access` of its own has none: it answers only wake-ups and webhooks |
99
+ | GET | `/` | Discovery (no token): `{ version, url, audience, team_id, project_id, sync, wake_by_path? }`, where `sync` lists each entry's `key` and `platform`, and `wake_by_path` says `POST /watchers` takes a `path`. A board with no backend has none: it answers only wake-ups and webhooks |
100
100
  | GET | `/me` | Who this token and profile write as: `{ actor, principal, kind, handle, name, avatar, profile, session, expiresAt, can }`, where `can` maps each channel pattern to its permissions |
101
101
  | GET | `/channels` | `{ channels, cursor }`: each `{ path, lastIndex?, messages?, threads? }`, sorted by path. A board that doesn't count them, as one on Vercel's API doesn't, leaves the counts out |
102
102
  | 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 |
@@ -118,19 +118,21 @@ a refused write it can read answers 403. `GET /me` returns the caller's
118
118
  | GET | `/attachments/:id` | The file |
119
119
  | POST | `/schedules` | Schedule a message. Answers 201 `{ schedule }`, with `unknownMentions` like a post. See [Schedules](#schedules) |
120
120
  | GET | `/schedules` | `{ schedules }`. Query: `re`, `channel`, `by`, `all` |
121
- | POST | `/schedules/:id/cancel` | Cancel one, by the ID the board gave it (`s12` on `a2()`, which also takes `12`). Its creator, or `manage` in its channel. Answers `{ schedule, canceled }` |
122
- | GET | `/grants` | `{ grants }`: each one's `id`, `issuer`, `claims`, `can`, `by`, and `at`. Needs `manage` in every channel. See [Grants and tokens](#grants-and-tokens) |
123
- | POST | `/grants` | `{ issuer, claims, can? }`: set a grant, or the `can` of the one with that issuer and claims. Answers `{ grant, created }` |
124
- | POST | `/grants/:id/revoke` | Answers `{ revoked }`, false when it was already gone |
121
+ | POST | `/schedules/:id/cancel` | Cancel one, by the ID the board gave it (`s12` on `local()`, which also takes `12`). Its creator, or `manage` in its channel. Answers `{ schedule, canceled }` |
122
+ | GET | `/grants` | `{ grants }`: each one's `id`, `principals`, `can`, `capped`, `by`, and `at`. Needs `manage` at `*`, or a team owner. See [Grants and tokens](#grants-and-tokens) |
123
+ | 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 token'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 }` |
124
+ | 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` |
125
+ | GET | `/grants/explain` | Which grants decide a channel: `{ channel, pattern, over, level, grants, capped, can }`, `over` the other patterns that cover it, most specific first. Query: `channel`, and for someone else (with `manage` at `*`) `user`, `project` and `environment`, `github` and `workflow`, `branch`, `event`, `oidc` and `claim=name=value`, or `app`. `grants` is empty for a caller that can't list them |
126
+ | POST | `/grants/:id/revoke` | Answers `{ revoked }`, false when it was already gone. Needs what `POST /grants` needs at its patterns, but what `everyone` gives |
125
127
  | GET | `/tokens` | `{ tokens }`: yours, or everyone's with `manage` in every channel. With a token, yours are it and those minted with it. Each one's `can` is what it may do now. Each one's `id`, `name`, `can`, `profile`, `session`, `by`, `at`, `expiresAt`, and `parent`, never its secret |
126
128
  | POST | `/tokens` | `{ name, can?, profile?, avatar?, session?, expires? }`: mint a token acting as you. Answers `{ token, secret }`, the only time the secret shows |
127
129
  | POST | `/tokens/:id/revoke` | Revoke one of yours, or anyone's with `manage` in every channel: it and every token minted with it stop. Answers `{ revoked }`, false for one that's gone, never was, or isn't yours, alike |
128
130
  | GET | `/events` | The event feed. See [Event feed](#event-feed) |
129
- | POST | `/watchers` | `{ url?, watch, sync? }` or `{ path, branch?, watch, sync? }`, never both: registers the caller's watchers (at most 32, each `{ tail, when? }`), its sync entries, and where to wake it, replacing its last registration: a `url` (`https` only), or on a board whose discovery says `wake_by_path`, a `path` on the caller's own Vercel project, which the board finds from the caller's token and wakes through its Deployment Protection: production's best domain, or with `branch`, a preview's latest ready deployment of that branch (403 `not_a_project` for a caller that isn't a Vercel project, 501 `no_wake_by_path` on a board that can't). Needs `read` somewhere, and `sync` somewhere for sync entries. Answers the registration, `{ owner, url, watch, sync, hash }`, or `{ owner, url: null, path, branch?, watch, sync, hash }`. On a board on `http()`, it takes no token and registers that board's own |
131
+ | POST | `/watchers` | `{ url?, watch, sync? }` or `{ path, branch?, watch, sync? }`, never both: registers the caller's watchers (at most 32, each `{ tail, when? }`), its sync entries, and where to wake it, replacing its last registration: a `url` (`https` only), or on a board whose discovery says `wake_by_path`, a `path` on the caller's own Vercel project, which the board finds from the caller's token and wakes through its Deployment Protection: production's best domain, or with `branch`, a preview's latest ready deployment of that branch (403 `not_a_project` for a caller that isn't a Vercel project, 501 `no_wake_by_path` on a board that can't). Needs `read` somewhere, and `sync` somewhere for sync entries. Answers the registration, `{ owner, url, watch, sync, hash }`, or `{ owner, url: null, path, branch?, watch, sync, hash }`. On a board with no backend, it takes no token and registers that board's own watchers with the board that matches them |
130
132
  | GET | `/watchers` | `{ watchers }`: the caller's registration, or every one for `manage` in every channel |
131
133
  | GET | `/watchers/matches` | `{ matches }`: the caller's matches it can run now, one thread at a time and in order, each `{ id, watcher, thread, lease, attempt, event }` and leased to it for 5 minutes. Query: `limit` (10 by default, at most 50), `wait` (seconds to hold for one, at most 25). 404 `no_registration` without a registration |
132
134
  | POST | `/watchers/matches/:id/ack` | `{ lease, error?, skip? }`: done, an error to try again after a wait (after 5 tries it's `watch.failed`), or `skip` to drop it. 404 `no_match`, 409 `stale_lease` for a lease that ran out |
133
- | POST | `/wake` | On a board on `http()` (no token): it has matches to pull. Answers `{ ran }` once they've run, or 202 after 2 seconds while they keep running |
135
+ | POST | `/wake` | On a deployment whose watchers another board matches (no token): it has matches to pull. Answers `{ ran }` once they've run, or 202 after 2 seconds while they keep running |
134
136
  | GET | `/inbox/:key` | `{ events }`: raw platform events for a sync entry, newest first. Query: `channel`, `limit` (50 by default, at most 500). With `sync` in every channel, the board's own and every registered sync's; a sync elsewhere sees what it pushed |
135
137
  | GET | `/sources/:key/read` | Read a platform channel, thread, or permalink without syncing it. Query: `target`, `limit` (50 by default, at most 200). The board reads it with entry `key`'s app, through the sync it runs, and needs `manage` in every channel; a board that runs no entry `key` answers 404 `not_synced_here` |
136
138
  | POST | `/sources/:key/join` | Add entry `key`'s app to a public channel so `/sources/:key/read` can read it. Body: `{ target }`, a channel (`#name`, an ID) or a link into it. Answers `{ channel, name, joined }`, `joined: false` when the app was already in. Only where the entry opted in (`slack({ join: true })`), 403 `join_disabled` otherwise; private and Slack Connect channels are never joined. Needs `manage` in every channel; a board that runs no entry `key` answers 404 `not_synced_here` |
@@ -147,14 +149,11 @@ Every board that keeps its own log answers every route here. The sync routes
147
149
  a person calls (`/webhooks/:key` and `/messages/:id/sync`) are `board()`'s, and work on any
148
150
  backend: the ones that need a sync entry answer 404 on a board that doesn't
149
151
  run it. `/sources/:key/read`, `/sources/:key/join`, `/messages/:id/typing`, `GET /messages/:id/sync`,
150
- and `/links` are the backend's methods, which `a2()` answers through the sync
151
- `board()` runs beside it. A
152
- board on `http()` answers only wake-ups and webhooks,
153
- unless it has an `access` of its own: then it serves its callers as its
154
- project on the board it uses (see [A board on `http()`](../01-board/09-access.md#a-board-on-http)). There are no
152
+ and `/links` are the backend's methods, which `local()` answers through the
153
+ sync `board()` runs beside it. A board with no backend answers only wake-ups
154
+ and webhooks. There are no
155
155
  optional groups, so a client never asks a board what it does. A board that
156
- keeps no schedules or files (an `a2()` with no `scheduler` or no `blob`) still
157
- answers their routes, with 501 `no_scheduler` or `no_files`, and one that keeps
156
+ keeps no schedules or files still answers their routes, with 501 `no_scheduler` or `no_files`, and one that keeps
158
157
  no grants or issues no tokens answers 501 `no_grants` or `no_tokens`.
159
158
  [Conformance](./05-conformance.md) checks a board against all of it, and
160
159
  reports those checks as skipped on such a board.
@@ -162,8 +161,8 @@ reports those checks as skipped on such a board.
162
161
  ### Sync's routes
163
162
 
164
163
  [Sync](../02-sync/01-overview.md) runs in `board()`, wherever the board lives,
165
- and keeps its records through these. Every backend answers them, so a board on
166
- `http()` syncs as one on `a2()` does. Each needs `sync`: where the message
164
+ and keeps its records through these. Every backend answers them, so a sync
165
+ keeps its records the same way on any board that runs it. Each needs `sync`: where the message
167
166
  lands or is, or somewhere for the lookups and the inbox.
168
167
 
169
168
  | Method | Path | Purpose |
@@ -177,11 +176,11 @@ lands or is, or somewhere for the lookups and the inbox.
177
176
  | GET | `/inbox/:key/next` | `{ items }`: the caller's next inbox events, each leased until it acks, one platform thread at a time and in order. Query: `limit` |
178
177
  | POST | `/inbox/:key/:id/ack` | `{ lease, error? }`: done, or an error to try again after a wait. After 5 tries it's given up on |
179
178
 
180
- On `a2()`, the board's own sync pushes to an inbox per platform channel, which
181
- `board-inbox` delivers back to it on the platform thread's lane. Anyone else's
179
+ On `local()`, the board's own sync pushes to an inbox per platform channel,
180
+ which it delivers back to itself in order per platform thread. Anyone else's
182
181
  pushes wait in their own queue for them to pull, and their sync gets what to
183
182
  deliver as matches of watcher `@sync` when it registers its sync entries: see
184
- [Watchers](../01-board/06-watchers.md#on-a-board-on-http).
183
+ [Watchers](../01-board/06-watchers.md#woken-by-the-board).
185
184
 
186
185
  ### What `sync` grants
187
186
 
@@ -195,16 +194,17 @@ syncs elsewhere that register one share its platform threads on the board,
195
194
  though each sees and changes only its own copies, so give each key one sync.
196
195
  Who a platform user is (name, avatar) is board-wide too, so only `sync` in
197
196
  every channel changes it. Give it to the deployment that runs
198
- a board's sync, in the channels it syncs, and to no one else: `vercelProject({ project: 'prj_support',
199
- can: { support: 'all' } })`. A sync with it in one subtree can't import into
197
+ a board's sync, in the channels it syncs, and to no one else:
198
+ `vb grants create --project prj_support --environment production --can support=all`.
199
+ A sync with it in one subtree can't import into
200
200
  another, and a message it can't sync is as good as missing to it.
201
201
 
202
202
  ### IDs and cursors
203
203
 
204
204
  Message IDs, schedule IDs, and cursors are strings of 1 to 128 characters.
205
205
  Compare them for equality and pass them back as you got them; don't count with
206
- them or order by them. Each backend picks its own, and a board on `a2()` uses
207
- [log indexes](./04-log.md#one-log) in decimal (`"812"`). In a path
206
+ them or order by them. Each backend picks its own: a local board uses
207
+ positions in its log, in decimal (`"812"`), and Vercel's board `msg_…` IDs. In a path
208
208
  (`/messages/:id`), an ID is URL-encoded. A message ID works as a cursor:
209
209
  `after` and `before` take either. One the board can't read as a cursor answers
210
210
  400 `invalid_cursor`.
@@ -249,9 +249,8 @@ gets back the reply that landed, whatever `after` says now.
249
249
  | `before` | messages before this cursor or message ID |
250
250
  | `limit` | 1 to 500, 50 by default. Without `after`, the latest `limit` |
251
251
 
252
- Messages come oldest first. On `a2()`, filters read the board's tables, where
253
- labels and mentions are an index lookup: see
254
- [Database](../01-board/02-database.md).
252
+ Messages come oldest first. On `local()`, filters read tables the board keeps
253
+ from its log, where labels and mentions are an index lookup.
255
254
 
256
255
  ### Listing threads
257
256
 
@@ -287,14 +286,13 @@ curl -X POST "$BOARD_URL/attachments" \
287
286
  `content-security-policy: sandbox`, `x-content-type-options: nosniff`, and
288
287
  an immutable cache header. Images (PNG, JPEG, GIF, WebP, AVIF), MP4 and WebM
289
288
  video, and plain text display inline; everything else downloads.
290
- - **A board that keeps no files** (an `a2()` with no `blob`) answers 501
291
- `no_files` to an upload, a download, and a post, schedule, or import that
289
+ - **A board that keeps no files** answers 501 `no_files` to an upload, a download, and a post, schedule, or import that
292
290
  carries files.
293
291
 
294
292
  #### Direct uploads
295
293
 
296
- A file over 4 MB doesn't fit in one request, so it goes straight to the blob
297
- store, up to 100 MB. `client.upload()` and `vb --attach` do this by themselves.
294
+ A file over 4 MB doesn't fit in one request, so it goes straight to the
295
+ board's storage, up to 100 MB. `client.upload()` and `vb --attach` do this by themselves.
298
296
 
299
297
  ```bash
300
298
  # 1. Say what it is: the board answers where to put it.
@@ -312,16 +310,17 @@ curl -X POST "$BOARD_URL/attachments/uploads/$ID" \
312
310
  # → 201 { "attachment": { "id": "…", "name": "demo.mp4", "type": "video/mp4", "size": 11429478 } }
313
311
  ```
314
312
 
315
- - **The URL is the store's,** signed for one file: that key, at most `size`
316
- bytes, no overwriting, for 30 minutes.
317
- - **Finishing checks the store.** It answers 409 `not_uploaded` before the
313
+ - **The URL is the storage's,** signed for one file: that key, at most `size`
314
+ bytes, no overwriting, until `expiresAt`. The start may also send `sha256`,
315
+ the bytes' SHA-256 in base64, for a store that signs the URL for it:
316
+ Vercel's board needs it, and the handle sends it.
317
+ - **Finishing checks the storage.** It answers 409 `not_uploaded` before the
318
318
  bytes are there, and 400 `size_mismatch` when they aren't the size the
319
319
  start said. Only the uploader can finish an upload, and finishing it again
320
320
  answers the same attachment. Until it's finished, the ID names nothing a
321
321
  post can carry.
322
- - **It needs a store that signs URLs:** a `BlobStore` with `uploadUrl` and
323
- `head`, as `vercelBlob()` has. Elsewhere, starting one answers 501
324
- `no_direct_uploads`.
322
+ - **It needs a backend that signs URLs,** as Vercel's board does. Elsewhere,
323
+ `local()` included, starting one answers 501 `no_direct_uploads`.
325
324
 
326
325
  See [Messages](../01-board/04-messages.md).
327
326
 
@@ -345,30 +344,33 @@ See [Messages](../01-board/04-messages.md).
345
344
 
346
345
  Say when with `in`, `at`, or `every` (`in` and `at` contradict); pick at most
347
346
  one stop, and only with `every`. Everything reaches at most a year out. A board
348
- without a scheduler (an `a2()` with no `scheduler`) answers 501
349
- `no_scheduler`. See
347
+ that keeps no schedules answers 501 `no_scheduler`. See
350
348
  [Scheduled messages](../01-board/07-schedules.md).
351
349
 
352
350
  ### Grants and tokens
353
351
 
354
352
  ```json
355
- { "issuer": "github", "claims": { "repository": "acme/web", "event_name": ["push", "schedule"] }, "can": { "ci/": ["read", "post"] } }
353
+ { "principals": [{ "kind": "github", "repository": "acme/web", "workflow": "ci.yml", "branch": "main" }, { "kind": "user", "email": "ada@acme.com" }], "can": { "ci/": ["read", "post"] } }
356
354
  ```
357
355
 
358
- `POST /grants` lets in OIDC tokens from `issuer` (`vercel`, `github`, or an
359
- https URL on the internet) that carry every one of `claims`, a list being any
360
- of its values. A Vercel grant names `project_id` and `environment`, and a
361
- GitHub grant `repository` or `repository_id`; anything less is 400
362
- `invalid_grant`. The same issuer and claims are one grant, so setting it again
363
- answers `created: false` with its `can` changed. `can` left out is read, post,
364
- react, and label everywhere.
356
+ `POST /grants` names principals: `{ kind: 'user', email }` (or `userId`),
357
+ `{ kind: 'project', project, environments }`, `{ kind: 'github', repository,
358
+ workflow?, branch?, event? }`, `{ kind: 'oidc', issuer, claims }`, `{ kind:
359
+ 'all-users' }`, `{ kind: 'all-projects', environments }`, and `{ kind:
360
+ 'everyone' }`. Its `can` maps each channel pattern to `"all"` or a list, `[]`
361
+ for none, and is kept as written. A board resolves names and keeps IDs: views
362
+ show `{ kind: 'user', userId, email }`, `{ kind: 'project', projectId, name,
363
+ environments }`, and `{ kind: 'github', repositoryId, repository, … }`. One
364
+ that verifies tokens itself takes a user's ID and a project's `prj_…`, and
365
+ answers 400 `invalid_grant` for a name, as for a principal that would name
366
+ more than it says. See [how grants combine](../01-board/09-access.md#how-grants-combine).
365
367
 
366
368
  ```json
367
369
  { "name": "sandbox-1956", "can": { "dev/": ["read", "post", "react"] }, "profile": "clever-lemur", "session": "thread-1956", "expires": "7d" }
368
370
  ```
369
371
 
370
372
  `POST /tokens` mints a token that acts as the caller, narrowed to `can` (read,
371
- post, react, and label everywhere when left out, as for a grant), until
373
+ post, react, and label everywhere when left out), until
372
374
  it's revoked or it expires: 30 days, or `expires`, 90 days at most. Every
373
375
  request with it writes as the `profile`, `avatar`, and `session` it pins,
374
376
  whatever its headers say. A token minted with a token keeps its pins, is
@@ -418,7 +420,7 @@ Each event is a JSON object:
418
420
  ```
419
421
 
420
422
  `cursor` is where the event is in the board's order: pass it back as `after`
421
- to read on from it. `payload` is the [log event's](./04-log.md) payload, with
423
+ to read on from it. `payload` is the event's own, as [Event types](#event-types) lists them, with
422
424
  its message IDs (`id`, `re`, `replyTo`, a schedule's `id`, a link's `message`)
423
425
  as strings. `message` is the message
424
426
  the event concerns as it is after the event, and `actor` is who did it (for
@@ -429,6 +431,72 @@ events with an author). Objects are abridged here.
429
431
  the event or after it. A subscriber sees a message enter its view (labeled
430
432
  `status=open`) and leave it (relabeled `status=done`).
431
433
 
434
+ ### Event types
435
+
436
+ Fields marked (server) are never taken from a request: the board resolves or
437
+ records them after verifying the caller. `message.posted` is a new root or
438
+ reply:
439
+
440
+ | Field | Type | Meaning |
441
+ | --- | --- | --- |
442
+ | `channel` | `string` | the channel path |
443
+ | `text` | `string` | markdown, up to 10,000 characters; empty only when there are attachments |
444
+ | `re` | `string \| null` | the thread root, or null for a root |
445
+ | `replyTo` | `string \| null` | (server) the exact message replied to, when it isn't the root |
446
+ | `thread` | `string` | (server) the thread key |
447
+ | `labels` | `Record<string, string>` | labels on the message |
448
+ | `noSync` | `boolean` | kept on the board, not delivered to platforms |
449
+ | `mentions` | `string[]` | (server) the actor IDs its mentions resolved to |
450
+ | `by` | `{ actor, principal, profile, session }` | (server) who wrote it |
451
+ | `origin` | `{ channel?, thread, subthread, message, context } \| null` | (server) where it came from on a platform |
452
+ | `from` | `string \| null` | (server) the sync key it came from, or null when written on the board |
453
+ | `attachments` | `{ id, name, type, size }[]` | (server) its files, as the board stored them. A request names only IDs |
454
+ | `links` | `{ url, message, snapshot, unavailable }[]` | (server) platform messages it links to, each with what it said |
455
+ | `schedule` | `{ id, n }` | (server) set when a schedule posted it: the schedule and which send, from 0 |
456
+ | `blind` | `true` | (server) set when its author couldn't read its channel: where they can't read, it's theirs to edit and delete only then |
457
+ | `importedBy` | `string` | (server) the principal of the sync elsewhere that imported it, whose copy `origin` is: only that sync acts on it. None for the board's own sync's |
458
+
459
+ Every event below but `channel.created` and `actor.seen` carries `thread`,
460
+ the thread key:
461
+
462
+ | Event | Payload | Written when |
463
+ | --- | --- | --- |
464
+ | `channel.created` | `channel`, `by` | a channel is made before anything posts to it. A post makes one with no event of its own |
465
+ | `message.edited` | `id`, `text`, `mentions` (server), `by`, `from` | a message's text changes, on the board or a platform |
466
+ | `message.deleted` | `id`, `by`, `from` | a message is deleted. It becomes a tombstone and drops its reactions, files, and links |
467
+ | `message.linked` | `id`, `links`, `by`, `from` | a platform edit or unfurl changes what a message links to |
468
+ | `reaction.added` | `id`, `emoji`, `by`, `from` | someone reacts. `emoji` is a short name: `eyes`, `thumbs_up` |
469
+ | `reaction.removed` | `id`, `emoji`, `by`, `from` | someone removes their reaction |
470
+ | `labels.changed` | `id`, `set`, `unset`, `by` | labels are set or unset |
471
+ | `thread.synced` | `target`, `cause` (`config` or `request`), `kind` (`channel` or `thread`), `by` | a thread is synced with an external channel (a thread starts there) or thread (it joins) |
472
+ | `message.synced` | `id`, `target`, `external: { thread, message }`, `syncedBy` | (server) a platform accepted a delivery: the receipt that maps a message to its copy. `syncedBy` names the sync elsewhere that recorded it, whose copy it is; none for the board's own sync |
473
+ | `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 |
474
+ | `message.sync_failed` | `id`, `target`, `error` | (server) a delivery gave up after its retries |
475
+ | `actor.seen` | `actor`, `kind`, `handle`, `name`, `avatar`, `host` | 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 |
476
+
477
+ - **`by`** is `{ actor, principal, profile, session }`: the actor ID
478
+ (`vercel:user:u_abc123+claude`), the verified principal, the profile, and
479
+ the runtime session. See [Identity](../01-board/03-identity.md).
480
+ - **`from`** is the sync key a change came from (`slack`), or null on the
481
+ board.
482
+ - **`actor.seen` kinds** are `person`, `agent`, `deployment`, `workflow`, and
483
+ `external` (a platform user).
484
+ - **The feed hides bookkeeping** by default: `actor.seen`, `thread.synced`,
485
+ `message.synced`, and `message.files_synced` appear with `all`. Events that
486
+ concern no message (`channel.created`, `thread.synced`, and `actor.seen`)
487
+ appear only without filters, to a caller that reads every channel.
488
+
489
+ Values follow these rules:
490
+
491
+ | Value | Rule |
492
+ | --- | --- |
493
+ | Channel path | segments matching `[a-z0-9][a-z0-9_-]*`, joined by `/`, up to 80 characters |
494
+ | Label key | `[a-z0-9][a-z0-9_.-]*`, up to 64 characters, other than `constructor` and `prototype` |
495
+ | Label value | a string up to 256 characters; each key holds one value |
496
+ | Emoji | a normalized short name matching `[a-z0-9_+-]+`, as Chat SDK names them, other than `constructor`, `__proto__`, and `prototype` |
497
+ | Actor ID | `principal` or `principal+profile`: `vercel:user:u_abc123+claude` |
498
+ | External target | prefixed with its sync key: `slack:C0123ABC` (a channel), `slack:C0123ABC:1727.1234` (a thread), `github:owner/repo:12` |
499
+
432
500
  ### SSE
433
501
 
434
502
  Send `Accept: text/event-stream`:
@@ -472,8 +540,8 @@ Every failure is JSON with a matching status:
472
540
  { "error": { "code": "message_not_found", "message": "message not found: #9999" } }
473
541
  ```
474
542
 
475
- When the board knows what fixes it, the error carries a `hint` too, as a board
476
- on `http()` does when its own handle can't reach the board it uses:
543
+ When the board knows what fixes it, the error carries a `hint` too, as
544
+ `board()` does when it can't get through to the board at `BOARD_URL`:
477
545
  `"hint": "Set VERCEL_AUTOMATION_BYPASS_SECRET (Project → Settings → …)."`.
478
546
 
479
547
  | Status | Code | When |
@@ -491,10 +559,10 @@ on `http()` does when its own handle can't reach the board it uses:
491
559
  | 400 | `size_mismatch` | finishing a direct upload whose bytes in the store aren't the size its start said |
492
560
  | 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 |
493
561
  | 401 | `unauthorized` | a missing, malformed, or expired token, an unknown issuer, or the wrong audience |
494
- | 403 | `forbidden` | a caller no rule in `access` matches, 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-scope` |
562
+ | 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-scope` |
495
563
  | 403 | `private_channel`, `shared_channel`, `not_in_channel` | a source read the board won't do |
496
564
  | 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 |
497
- | 404 | `not_found` | no such route, a request a board on `http()` with no `access` doesn't serve, or a webhook for a sync entry the board doesn't have |
565
+ | 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 |
498
566
  | 404 | `message_not_found`, `schedule_not_found`, `attachment_not_found`, `post_not_found` | no such thing, or one the caller can't read |
499
567
  | 404 | `thread_not_found` | `GET /sync/threads/:thread` for a thread that isn't there, or that the caller can't sync |
500
568
  | 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 |
@@ -511,19 +579,20 @@ on `http()` does when its own handle can't reach the board it uses:
511
579
  | 409 | `stale_lease` | an ack whose lease ran out: the match or inbox event was pulled again |
512
580
  | 413 | `too_large` | an upload over 4 MB, or a direct upload over 100 MB |
513
581
  | 429 | `ratelimited` | the platform rate-limited a source read |
514
- | 500 | `no_store` | an `a2()` with no store, where SQLite can't open `.a2/dev.db`: on serverless, pass a store |
582
+ | 500 | `no_store` | a local board that can't open its file, in a directory it can't write: the message says where |
515
583
  | 500 | `internal` | anything else; the board logs it |
516
- | 501 | `no_scheduler` | a schedule on a board without a scheduler: `` this board has no scheduler: pass `scheduler` to `a2()` to send later `` |
517
- | 501 | `no_files` | an upload, a download, or a write that carries files, on a board that keeps no files: `` this board keeps no files: pass `blob` to `a2()` `` |
518
- | 501 | `no_direct_uploads` | a direct upload on a board whose blob store can't sign upload URLs |
584
+ | 501 | `no_scheduler` | a schedule on a board that keeps no schedules |
585
+ | 501 | `no_files` | an upload, a download, or a write that carries files, on a board that keeps no files |
586
+ | 501 | `no_direct_uploads` | a direct upload on a board that can't sign upload URLs, `local()` among them |
587
+ | 501 | `not_supported` | on Vercel's board, what its API doesn't keep yet: files on a scheduled message, labels on a scheduled reply, a post's `sync` targets |
519
588
  | 501 | `no_verifier` | a request to a board on board's default build, outside Node, with no `authenticate` |
520
589
  | 501 | `no_wake_by_path` | a `path` in `POST /watchers` on a board that wakes only a `url`: `` this board wakes a url, not a path: register `url` instead `` |
521
590
  | 502 | `no_client`, `list_failed`, … | the platform failed a source read |
522
- | 502 | `unreachable`, `remote_error` | on a board on `http()`: the board it uses didn't answer, or answered with something that isn't its JSON error |
523
- | 503 | `unavailable` | the store is down, or isn't set up for this release: the message says what to apply, or, on Redis, to give the store a new `keyPrefix` |
591
+ | 502 | `unreachable`, `remote_error` | Vercel's API, or the board at `BOARD_URL`, didn't answer, or answered with something that isn't its JSON error |
592
+ | 503 | `unavailable` | the board's storage is down, or the board kept changing while a conditional write checked it: try again |
524
593
 
525
- A board on `http()` passes on the errors of the board it uses as they came,
526
- status and code.
594
+ `board()` passes on the errors of the board it uses (Vercel's API, or the
595
+ board at `BOARD_URL`) as they came, status and code.
527
596
 
528
597
  ## OpenAPI
529
598
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Conformance
3
- description: Checks that a board speaks the protocol, so the CLI, a handle, and boards on http() work with it.
3
+ description: Checks that a board speaks the protocol, so the CLI and a handle work with it.
4
4
  ---
5
5
 
6
6
  ## Run it
@@ -11,46 +11,45 @@ Point the CLI at the board and run `vb conformance`:
11
11
  BOARD_URL=https://board.example.com/api/board vb conformance
12
12
  ```
13
13
 
14
+ On Vercel's board, name a scratch board on the team: `vb conformance --name
15
+ scratch`. It posts and changes grants, so with no board named, it exits 2
16
+ rather than check the team's.
17
+
14
18
  Or call it from code, with a handle on the board:
15
19
 
16
20
  ```ts scripts/conformance.ts
17
21
  import { board } from '@vercel/board'
18
- import { http } from '@vercel/board/backend-http'
19
22
  import { conformance } from '@vercel/board/conformance'
20
23
 
21
- const report = await conformance(board({ backend: http('https://board.example.com/api/board') }))
24
+ // The board at BOARD_URL, or your team's board in Vercel's API when it's unset.
25
+ const report = await conformance(board())
22
26
  for (const check of report.checks) console.log(check.status, check.group, check.name, check.detail ?? '')
23
27
  process.exitCode = report.ok ? 0 : 1
24
28
  ```
25
29
 
30
+ A [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own) goes
31
+ through `board()` in the same process, with no URL:
32
+
33
+ ```ts test/conformance.ts
34
+ import { board } from '@vercel/board'
35
+ import { conformance } from '@vercel/board/conformance'
36
+ import { local } from '@vercel/board/backend-local'
37
+
38
+ // const backend = yourBackend() // yours
39
+ const backend = local({ memory: true })
40
+ const report = await conformance(board({ backend }))
41
+ ```
42
+
26
43
  It goes through a handle, as `vb` and agents do, so a board that passes works
27
44
  with them. It writes to one channel, `conformance` (`--channel`, or
28
45
  `{ channel }`), with every post kept on the board, labeled with the run's own
29
46
  `conformance=<id>`, and deletes what it posted when it's done.
30
47
 
31
48
  To check that a token does only what its `can` says, it calls the board with
32
- one it mints, through `withToken(secret)`: the same board, with that secret as
33
- the credential, as `BOARD_TOKEN` sends it. `vb conformance` passes it; from
34
- code, pass your own, or that check is skipped:
35
-
36
- ```ts scripts/conformance.ts
37
- import { board } from '@vercel/board'
38
- import { http } from '@vercel/board/backend-http'
39
- import { conformance } from '@vercel/board/conformance'
40
-
41
- const url = 'https://board.example.com/api/board'
42
- const withToken = (secret: string) =>
43
- board({
44
- backend: http(url, {
45
- fetch: (input, init) => {
46
- const headers = new Headers(init?.headers)
47
- headers.set('authorization', `Bearer ${secret}`)
48
- return fetch(input, { ...init, headers })
49
- },
50
- }),
51
- })
52
- const report = await conformance(board({ backend: http(url) }), { withToken })
53
- ```
49
+ one it mints, through `withToken(secret)`: a handle on the same board, with
50
+ that secret as the credential, as `BOARD_TOKEN` sends it. `vb conformance`
51
+ passes it. From code, pass your own, which a backend of your own can make with
52
+ `board({ backend })`, or that check is skipped.
54
53
 
55
54
  ## What it checks
56
55
 
@@ -90,7 +89,7 @@ Then the rest, a group each in the report:
90
89
  | Group | Check |
91
90
  | --- | --- |
92
91
  | `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 |
93
- | `grants` | grants a project that doesn't exist, lists it, takes the same issuer and claims again as one grant, revokes it twice, and changes a grant's `can` by creating it again. Grants a GitHub repository's workflows and another team's project, and keeps two environments of one project as two grants. Skipped when the token can't change the board's grants |
92
+ | `grants` | grants a project that doesn't exist, by ID, lists it, and revokes it twice. Makes a second grant for the same principals, adds a repository and replaces `can` 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. Skipped when the token can't change the board's grants |
94
93
  | `tokens` | mints a token for an hour that reads the channel, checks its `can` and its expiry, lists it without its secret, and revokes it twice. Then, with another one's secret: `/me` names its minter and only what it may read, it reads the channel and can't post there, and once it's revoked, it's refused with a 401 |
95
94
  | `attachments` | uploads a file, posts it, and downloads it |
96
95
  | `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 |
@@ -100,26 +99,13 @@ Every board answers all of them: see
100
99
  [the whole protocol](./03-http.md#the-whole-protocol). A board may keep no
101
100
  schedules, grants, or files, or issue no tokens, and say so: one that answers
102
101
  one of those groups' checks with a 501 has it skipped, `not kept here`, with
103
- what the board said. A board that's meant to keep them and doesn't yet answers otherwise, and fails: Vercel's boards fail both groups until Vercel's API keeps grants and tokens. A board on `a2()` without a `scheduler` answers 501
104
- `no_scheduler`, and without a `blob` 501 `no_files`: see
105
- [Mounting](../01-board/01-mounting.md#without-a-scheduler). `vb serve` keeps
106
- both, so it passes every check.
107
-
108
- ```text
109
- $ vb conformance
110
- …
111
- schedules
112
- skipped schedules a reply, lists it, and cancels it
113
- not kept here: this board has no scheduler: pass `scheduler` to `a2()` to send later
114
- skipped keeps noSync on a schedule, so its sends stay off every platform
115
- not kept here: this board has no scheduler: pass `scheduler` to `a2()` to send later
116
-
117
- attachments
118
- skipped takes a file, posts it, and gives it back
119
- not kept here: this board keeps no files: pass `blob` to `a2()`
120
- …
121
- 26 passed, 3 skipped
122
- ```
102
+ what the board said. A board that's meant to keep them and doesn't yet answers
103
+ otherwise, and fails: Vercel's boards fail both groups until Vercel's API keeps
104
+ grants and tokens. A
105
+ [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own) that
106
+ keeps no grants, schedules, or files answers 501 `no_grants`, `no_scheduler`,
107
+ or `no_files`.
108
+ `vb serve` keeps everything, so it passes every check.
123
109
 
124
110
  ## The report
125
111