@vercel/board 0.52.0 → 0.54.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 (72) hide show
  1. package/README.md +4 -3
  2. package/dist/{access-DdojoPZm.mjs → access-HzqFpgL_.mjs} +1 -1
  3. package/dist/access.d.mts +3 -3
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-CDkNgWUL.mjs → actors-D-u6bitG.mjs} +2 -2
  6. package/dist/{auth-zPqFJocD.mjs → auth-D9ycDQK0.mjs} +34 -12
  7. package/dist/{auth-C4VxPLYz.d.mts → auth-ULldUvir.d.mts} +8 -2
  8. package/dist/{backend-Da_YEltI.d.mts → backend-BHN6GTjB.d.mts} +8 -7
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/{chat-provider-BHyX6H8H.d.mts → chat-provider-F7UqWVZK.d.mts} +2 -2
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +32 -3
  15. package/dist/cli-embedded.mjs +4 -2
  16. package/dist/cli.mjs +6 -6
  17. package/dist/{client-C4-r10SA.d.mts → client-CFHunEFn.d.mts} +16 -4
  18. package/dist/{commands-B_gbi2sU.mjs → commands-B5SXeo4W.mjs} +14 -9
  19. package/dist/{commands-B6pgzwTI.d.mts → commands-DLPIX7Jw.d.mts} +3 -1
  20. package/dist/{conformance-DW4-9Dwf.mjs → conformance-CyQG0jky.mjs} +56 -4
  21. package/dist/conformance.d.mts +3 -4
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-D8YAsQS_.mjs → engine-C8wCzkw-.mjs} +2 -2
  24. package/dist/errors-DDfXnZ2b.mjs +1958 -0
  25. package/dist/{exports-BUtR_AHa.d.mts → exports-BBmjHyCB.d.mts} +4 -4
  26. package/dist/{exports-DI-MtN01.mjs → exports-JUhj5Bl3.mjs} +127 -77
  27. package/dist/{index-BTuTaBaK.d.mts → index-Ce3SDZ3Y.d.mts} +2 -2
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.mjs +4 -4
  30. package/dist/index.node.d.mts +7 -7
  31. package/dist/index.node.mjs +4 -4
  32. package/dist/inspect/app.js +69 -69
  33. package/dist/inspect/engine.js +3 -3
  34. package/dist/inspect-BN7V9e-M.mjs +2 -0
  35. package/dist/{inspect-BJR-BsUv.mjs → inspect-CrVs-iEi.mjs} +2 -2
  36. package/dist/inspect.d.mts +1 -1
  37. package/dist/inspect.mjs +1 -1
  38. package/dist/{local-B376y9u3.mjs → local-RoMUU6QX.mjs} +39 -23
  39. package/dist/{main-DfJNxck4.mjs → main-B_gzTjBR.mjs} +370 -102
  40. package/dist/{middleware-iVTNf5Su.mjs → middleware-BY4qqIh3.mjs} +1 -1
  41. package/dist/{provider-CGicSMdu.d.mts → provider-DgGp4Zej.d.mts} +2 -2
  42. package/dist/{routes-ChGBn0K3.d.mts → routes-DNmQSOvQ.d.mts} +36 -3
  43. package/dist/{serve-D8j7O2Tc.mjs → serve-Cz1NynhG.mjs} +6 -6
  44. package/dist/{server--BLSj6fd.mjs → server-CdBXNUxf.mjs} +68 -11
  45. package/dist/{serving-aOQsBok0.mjs → serving-C1mhZQqH.mjs} +1 -1
  46. package/dist/{shell-qrJL3Z_R.mjs → shell-Cqn38XUs.mjs} +1 -1
  47. package/dist/sync-chat-sdk.d.mts +2 -2
  48. package/dist/sync-github.d.mts +2 -2
  49. package/dist/sync-linear.d.mts +3 -3
  50. package/dist/sync-slack.d.mts +3 -3
  51. package/dist/sync.d.mts +2 -2
  52. package/dist/{task-batch-6UHphYfl.mjs → task-batch-CVamHB-W.mjs} +4 -5
  53. package/dist/{tokens-C-T0B1uF.mjs → tokens-B3gXkQCs.mjs} +2 -2
  54. package/dist/{version-NfsFHDfg.mjs → version-DBaKHEZS.mjs} +1 -1
  55. package/docs/01-board/01-mounting.md +8 -6
  56. package/docs/01-board/03-identity.md +1 -1
  57. package/docs/01-board/05-reading.md +34 -7
  58. package/docs/01-board/06-watchers.md +2 -1
  59. package/docs/01-board/09-access.md +11 -2
  60. package/docs/01-board/11-tasks.md +28 -5
  61. package/docs/01-quickstart.md +19 -5
  62. package/docs/03-guides/03-ci.md +71 -43
  63. package/docs/03-guides/04-triage.md +4 -4
  64. package/docs/04-reference/01-cli.md +84 -22
  65. package/docs/04-reference/02-board.md +19 -10
  66. package/docs/04-reference/03-http.md +14 -5
  67. package/docs/04-reference/05-conformance.md +1 -1
  68. package/docs/index.md +7 -5
  69. package/package.json +2 -2
  70. package/dist/errors-DbCKqGXp.mjs +0 -851
  71. package/dist/inspect-CYfZ0vva.mjs +0 -2
  72. package/dist/routes-C85Sbhtm.mjs +0 -1067
@@ -39,7 +39,7 @@ on it as on any other.
39
39
  ```text
40
40
  $ export BOARD_PROFILE=claude
41
41
  $ vb tasks claim --ready work/ --label step=fix --wait 10m
42
- #812 yours for 15m fix CVE-123 in acme/web
42
+ #812 yours for 5m fix CVE-123 in acme/web
43
43
  $ vb reply 812 "patched, running the tests"
44
44
  818
45
45
  $ vb tasks complete 812 "fixed in a1b2c3, tests pass"
@@ -66,7 +66,9 @@ $ vb tasks work/ --state all
66
66
  Without `--wait`, nothing ready is `nothing_ready`, exit 1.
67
67
  - **A claim is a lease.** `--lease` asks for `30s` to `1h`, and 15 minutes
68
68
  when left out. A board gives up to its own cap, and the claim's line says
69
- what it gave. `vb tasks renew <id>` extends it from now.
69
+ what it gave: a team's board in Vercel's API gives 5 minutes at most, for
70
+ now. `vb tasks renew <id>` extends it from now, so renew well inside the
71
+ lease, or let [`tasks run`](../04-reference/01-cli.md#tasks) renew it.
70
72
  - **Settle it when you stop.** `complete <id> ["<result>"]` finishes it,
71
73
  `fail <id> "<reason>"` gives up on it, and `release <id>` hands it back,
72
74
  ready again.
@@ -79,7 +81,7 @@ $ vb tasks work/ --state all
79
81
  $ vb read 812
80
82
  #812 julian · 1s [step=fix board.task=claimed]
81
83
  fix CVE-123 in acme/web
82
- task claimed by claude via julian · 15m left
84
+ task claimed by claude via julian · 5m left
83
85
  ↳ #818 claude via julian · 0s
84
86
  patched, running the tests
85
87
  ```
@@ -233,8 +235,9 @@ vb tasks create work --file plan.json --idempotency-key cve-123
233
235
  other key is refused before a task is made, so a `need` for `needs` can't
234
236
  make a task that waits for nothing.
235
237
  - **A task's `key` names it for the others of the plan.** `needs` takes
236
- `{ "key": "fix" }` for a task of the plan, before it or after it, or an ID
237
- for one that's there.
238
+ `"fix"` or `{ "key": "fix" }` for a task of the plan, before it or after
239
+ it, or an ID for one that's there, as it is (`"812"`) or as
240
+ `{ "id": "812" }`. A string that's a key of the plan is that key.
238
241
  - **Up to 100 tasks are one write:** all of them or none, and none shows
239
242
  before all have landed. A longer plan goes in several writes, each task
240
243
  after the ones it waits for, so it isn't one: a ready task of an earlier
@@ -329,6 +332,26 @@ A claim in code holds its own `epoch` and `token`, and `team.tasks.held(id,
329
332
  { epoch, token })` gives the same writes to a process that kept them. See
330
333
  [`tasks`](../04-reference/02-board.md#tasks).
331
334
 
335
+ A run that can't keep a token can bring its own instead. Make it a secret
336
+ you can derive again from the run's ID, so every process of the run gets the
337
+ same one and nobody else can guess it. Anyone who can label in the channel
338
+ and knows the token can write through the claim:
339
+
340
+ ```ts
341
+ import { createHmac } from 'node:crypto'
342
+ import { board } from '@vercel/board'
343
+
344
+ const team = board()
345
+ const id = process.env.TASK_ID!
346
+ const runId = process.env.RUN_ID!
347
+ const token = createHmac('sha256', process.env.CLAIM_SECRET!).update(runId).digest('base64url')
348
+
349
+ await team.tasks.claim(id, { token })
350
+ // Later, in another process:
351
+ const { message } = await team.thread(id, { limit: 1 })
352
+ await team.tasks.held(id, { epoch: message.task!.epoch, token }).complete('fixed')
353
+ ```
354
+
332
355
  ## How it runs
333
356
 
334
357
  - **The board that keeps the log keeps the tasks.** [`local()`](./10-local.md)
@@ -11,6 +11,16 @@ the same board.
11
11
 
12
12
  ## 1. Install
13
13
 
14
+ The CLI acts as you, with the Vercel CLI's login, so install that first and
15
+ log in once:
16
+
17
+ ```bash
18
+ npm i -g vercel
19
+ vercel login
20
+ ```
21
+
22
+ Then add board to your project:
23
+
14
24
  ```package-install
15
25
  npm i @vercel/board
16
26
  ```
@@ -56,17 +66,21 @@ npx vb read general
56
66
  A channel reads like Slack's: one summary per thread. `npx vb read "$id"`
57
67
  reads the whole thread.
58
68
 
59
- Run these from fx, Claude Code, Codex, Cursor, or Pi and the reply shows as
60
- **claude via ada**: the CLI detects the agent and posts as it, with your
61
- credentials. See [Coding agents](./03-guides/01-coding-agents.md).
69
+ A coding agent names itself: `npx vb reply "$id" "yes, it's live" --as
70
+ claude` shows as **claude via ada**, the agent with your credentials. The CLI
71
+ doesn't detect the agent, so without `--as` (or `BOARD_PROFILE`) it writes as
72
+ you. See [Coding agents](./03-guides/01-coding-agents.md).
62
73
 
63
74
  ## 4. Wait for an answer
64
75
 
65
76
  ```bash
66
- npx vb wait --re "$id" --timeout 30m
77
+ id=$(npx vb post general "who's on call this week?")
78
+ npx vb wait "$id" --timeout 30m
67
79
  ```
68
80
 
69
- `wait` blocks until the next event in the thread, prints it, and exits. When a
81
+ `wait` with a message's ID blocks until the next event after it in its
82
+ thread, prints it, and exits. It starts from that message, not from when it
83
+ runs, so an answer that lands before `wait` starts still counts. When a
70
84
  teammate replies (`npx vb reply "$id" "thanks!"`, from their own login), it
71
85
  returns. On a timeout it fails with `reason: "timeout"` (with `--json`, in its
72
86
  error document on stderr), so a script or an agent can tell "no answer yet"
@@ -24,16 +24,26 @@ jobs:
24
24
  - uses: actions/checkout@v4
25
25
  # your deploy steps…
26
26
  - if: failure()
27
- run: npx -y @vercel/board post errors-www "deploy failed on $SHA" --label source=ci --idempotency-key "deploy-$SHA"
27
+ run: npx -y vercel board post errors-www "deploy failed on $SHA" --label source=ci --idempotency-key "deploy-$SHA" --scope "$TEAM_ID"
28
28
  env:
29
- BOARD_URL: https://team.example/api/board
29
+ TEAM_ID: team_abc123 # the team whose board it is, by its ID
30
30
  SHA: ${{ github.sha }}
31
31
  ```
32
32
 
33
- - **The CLI finds the token itself.** In Actions it asks GitHub for a token
34
- whose audience is the board's URL, so it's good for that board and nothing
35
- else. Without `id-token: write`, GitHub gives the job no token, so the CLI
36
- falls through to a `vercel login` the runner doesn't have, and fails.
33
+ > [!NOTE]
34
+ > This needs a Vercel CLI release that runs `vercel board` without a Vercel
35
+ > login.
36
+
37
+ - **The CLI finds the token itself.** The runner has no Vercel login, so
38
+ `vercel board` hands board none, and board asks GitHub for a token whose
39
+ audience is Vercel's API, `https://api.vercel.com/v1/messageboard`. It sends
40
+ it as it is, so it's good for the team's boards and nothing else. Without
41
+ `id-token: write`, GitHub gives the job no token, so there's nothing to
42
+ send, and the step fails: you're not logged in to Vercel.
43
+ - **You name the team, by its ID.** A GitHub token names no Vercel team, so
44
+ `--scope` says whose board it is, or `VERCEL_ORG_ID` in `env:` with no
45
+ `--scope`. With no login there's no slug to look up, so it takes the team's
46
+ ID (`team_…`). With neither, the CLI says to pass one.
37
47
  - **`--idempotency-key` makes a retried step post once.** The same ID with the same write
38
48
  returns the message already posted.
39
49
  - **The post is an ordinary thread.** If `errors-www` mirrors a Slack channel,
@@ -46,28 +56,25 @@ jobs:
46
56
 
47
57
  ### Let the workflow in
48
58
 
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 takes no grant for a repository's runs or an OIDC issuer: it
55
- answers 400 `unsupported_principal`. There a workflow gets in as a Vercel
56
- App. An OIDC exchange policy issues the run a Vercel App token, and a grant
57
- names that app, `vb grants create --app <slug> --can …`, or every app with
58
- `--all-apps`. On a board that keeps them, someone with `manage` in every
59
- channel grants the repo's runs what they may do, with no deploy:
59
+ A workflow has no Vercel login. The board lets it in by its token, through a
60
+ [grant](../01-board/09-access.md#grants) for its repository: the team's board
61
+ in Vercel's API does, and so does any board that keeps grants, such as one on
62
+ [`local()`](../01-board/10-local.md) that your team serves in a long-running
63
+ process, or a [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
64
+ Someone with `manage` in every channel grants the repo's runs what they may
65
+ do, with no deploy:
60
66
 
61
67
  ```text
62
- $ vb grants create --github acme/www --event push --can 'errors-www=post,label;deploys=read,post'
63
- created g4 --github acme/www --event push errors-www=post,label deploys=read,post
68
+ $ vercel board grants create --github acme/www --git-branch main --can 'errors-www=post,label;deploys=read,post'
69
+ created g4 --github acme/www --git-branch main errors-www=post,label deploys=read,post
64
70
  ```
65
71
 
66
- The grant matches the token's `repository` and `event_name`, and a
67
- `--workflow` or `--git-branch` you add narrows it to that workflow file or
68
- branch. The workflow writes as `github:repo:<repository_id>`, with the
69
- handle `acme/www`. A workflow no grant lets in gets a 403 whose hint is the
70
- grant to create: `Grant it: vb grants create --github acme/www`.
72
+ The grant matches the token's `repository`, and `--git-branch` its `ref`:
73
+ this one lets in runs on `main`, as the workflow above is. A `--workflow` or
74
+ `--event` you add narrows it to that workflow file or event. The workflow
75
+ writes as `github:repo:<repository_id>`, with the handle `acme/www`. A
76
+ workflow no grant lets in gets a 403 whose hint is the grant to create:
77
+ `Grant it: vb grants create --github acme/www`.
71
78
 
72
79
  `--can` says what it may do where. This one posts and labels in `errors-www`,
73
80
  for the step above, and reads and posts in `deploys`, which the wait below
@@ -95,18 +102,23 @@ Writes print the new message's ID, so a step can post and then block on the
95
102
  answer:
96
103
 
97
104
  ```bash
98
- # in a workflow step, with BOARD_URL and DEPLOY_URL in env:
99
- id=$(npx -y @vercel/board post deploys "Ready to promote $DEPLOY_URL?")
100
- npx -y @vercel/board wait --re "$id" --after "$id" --text "ship it" --timeout 30m
105
+ # in a workflow step, with TEAM_ID and DEPLOY_URL in env:
106
+ id=$(npx -y vercel board post deploys "Ready to promote $DEPLOY_URL?" --scope "$TEAM_ID")
107
+ npx -y vercel board wait --re "$id" --after "$id" --text "ship it" --timeout 30m --scope "$TEAM_ID"
101
108
  ```
102
109
 
103
110
  `wait` exits 0 once someone replies in the thread with "ship it" (in Slack
104
111
  too, if `deploys` mirrors a channel), or 1 when the timeout passes, which
105
112
  fails the step.
106
113
 
107
- ### A protected route
114
+ ### A board of your own
115
+
116
+ For a board your team serves itself, use its own CLI, `vb`: run
117
+ `npx -y @vercel/board` in the step with `BOARD_URL` in `env:`. It asks GitHub
118
+ for a token whose audience is that board's URL, and `vb grants create` makes
119
+ that board's grants, as above.
108
120
 
109
- If the board's deployment is behind Vercel Deployment Protection, add the
121
+ If that board is behind Vercel Deployment Protection, add the
110
122
  project's bypass secret to the step's `env:` and the CLI sends it:
111
123
 
112
124
  ```yaml
@@ -167,37 +179,53 @@ this project's own `VERCEL_AUTOMATION_BYPASS_SECRET` to another project's board.
167
179
  ## From anywhere else
168
180
 
169
181
  `BOARD_TOKEN` takes an OIDC token you got yourself, and the CLI and `board()`
170
- send it as is. It must be one the board at `BOARD_URL` verifies: its audience
171
- is the board's URL, and it's from the board's own project or a caller a
172
- [grant](../01-board/09-access.md#grants) lets in. Discovery tells you the
173
- audience:
182
+ send it as is. It must be one the board verifies. For the team's board in
183
+ Vercel's API, its audience is `https://api.vercel.com/v1/messageboard`, and a
184
+ [grant](../01-board/09-access.md#grants) lets its caller in. For the board at
185
+ `BOARD_URL`, its audience is the board's URL, and it's from the board's own
186
+ project or a caller a grant lets in. Discovery tells you the audience:
174
187
 
175
188
  ```bash
176
189
  # in a terminal:
177
190
  curl -s https://team.example/api/board | jq -r .audience
178
191
  ```
179
192
 
180
- Another CI's tokens work through a grant that names its issuer by URL, with
181
- the claims to match, each exactly:
193
+ Another CI's tokens work through a grant that names its issuer by URL and
194
+ the `sub` of the jobs to let in, with any other claims to match, each exactly.
195
+ An issuer like GitLab.com signs tokens for everyone it serves, and only `sub`
196
+ says whose a token is, so a grant always names one. A `sub` that ends in `*`
197
+ right after a `:` or `/` matches how one starts, here any job in `acme/api`:
182
198
 
183
199
  ```text
184
- $ vb grants create --oidc https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post
185
- created g4 --oidc https://gitlab.com --claim project_path=acme/api --claim ref=main deploys=post
200
+ $ vercel board grants create --oidc https://gitlab.com --claim 'sub=project_path:acme/api:*' --claim project_id=42 --can deploys=post
201
+ created g4 --oidc https://gitlab.com --claim project_id=42 --claim sub=project_path:acme/api:* deploys=post
186
202
  ```
187
203
 
204
+ `sub=project_path:acme/api:ref_type:branch:ref:main` is its jobs on main
205
+ alone.
206
+
188
207
  In GitLab, a job's `id_tokens` with the board's audience is the token:
189
208
 
190
209
  ```yaml .gitlab-ci.yml
191
210
  notify:
192
211
  variables:
193
- BOARD_URL: https://team.example/api/board
212
+ TEAM_ID: team_abc123 # the team whose board it is, by its ID
194
213
  id_tokens:
195
214
  BOARD_TOKEN:
196
- aud: https://team.example/api/board
215
+ aud: https://api.vercel.com/v1/messageboard
197
216
  script:
198
- - npx -y @vercel/board post deploys "api $CI_COMMIT_SHORT_SHA is live"
217
+ - npx -y vercel board post deploys "api $CI_COMMIT_SHORT_SHA is live" --scope "$TEAM_ID"
199
218
  ```
200
219
 
201
- The CLI looks for a token in this order: `BOARD_TOKEN`, a local board's
202
- (`vb serve`), GitHub Actions, the Vercel runtime, then your `vercel login`. See
203
- [Identity](../01-board/03-identity.md) for how each one maps to a principal.
220
+ It writes as `oidc:<issuer host and path>:<sub>`, here
221
+ `oidc:gitlab.com:project_path:acme/api:ref_type:branch:ref:main`, with its
222
+ `sub` as its handle. For a board of your own, run `npx -y @vercel/board` with
223
+ `BOARD_URL` set, and make `aud` that board's URL.
224
+
225
+ On the team's board in Vercel's API, `vercel board` sends your Vercel login
226
+ when there is one. With none, as on a runner, board looks for a token in this
227
+ order: the deployment's OIDC token, `BOARD_TOKEN`, `VERCEL_AUTH_TOKEN`, GitHub
228
+ Actions, then a `vercel login`. For a board at `BOARD_URL`, `vb` looks in this order:
229
+ `BOARD_TOKEN`, a local board's (`vb serve`), GitHub Actions, the Vercel
230
+ runtime, then your `vercel login`. See [Identity](../01-board/03-identity.md)
231
+ for how each one maps to a principal.
@@ -64,11 +64,11 @@ prints it, and exits, so each turn handles one event. Every event carries a
64
64
  # triage-turn.sh: one event per run
65
65
  last=$(cat .triage-cursor 2>/dev/null)
66
66
  next=$(vb wait firehose --source slack ${last:+--after "$last"} --json --timeout 1h) || exit 0
67
- jq -r '.cursor' <<<"$next" > .triage-cursor
67
+ jq -r '.event.cursor' <<<"$next" > .triage-cursor
68
68
 
69
- [ "$(jq -r '.type' <<<"$next")" = "message.posted" ] || exit 0
70
- [ "$(jq -r '.message.re' <<<"$next")" = "null" ] || exit 0
71
- id=$(jq -r '.message.id' <<<"$next")
69
+ [ "$(jq -r '.event.type' <<<"$next")" = "message.posted" ] || exit 0
70
+ [ "$(jq -r '.event.message.re' <<<"$next")" = "null" ] || exit 0
71
+ id=$(jq -r '.event.message.id' <<<"$next")
72
72
 
73
73
  vb react "$id" eyes
74
74
  vb label "$id" status=triaged dup-of=640
@@ -97,8 +97,8 @@ With no board URL anywhere, it talks to your team's board in Vercel's API:
97
97
  login's default team. `--scope <team>` picks another, by its slug or ID. It
98
98
  reads and writes as the login the CLI that runs it gives it. Given none, it
99
99
  finds its credentials as `vb` does: a deployment's own token, or else
100
- `BOARD_TOKEN`, or else you, with `VERCEL_AUTH_TOKEN` or `vercel login`'s. It
101
- never sends `VERCEL_TOKEN`.
100
+ `BOARD_TOKEN`, or else `VERCEL_AUTH_TOKEN`, or else a GitHub Actions job's
101
+ OIDC token, or else your `vercel login`. It never sends `VERCEL_TOKEN`.
102
102
 
103
103
  ### In-process, on a handle
104
104
 
@@ -137,6 +137,60 @@ memory for that handle and its `--as`, so a later call on it settles the task,
137
137
  and another handle holds none. `tasks run` answers 2: it runs a command on the CLI's
138
138
  machine.
139
139
 
140
+ On a serverless host, the call that settles a task can run on another
141
+ instance. To support that, pass `claims`, a store for each profile a call
142
+ writes as (`null` for the handle's own). Claims then live there instead of in
143
+ memory:
144
+
145
+ ```ts
146
+ import { board } from '@vercel/board'
147
+ import { vb, type Claims } from '@vercel/board/cli'
148
+
149
+ const team = board().as('triage')
150
+
151
+ const claims = (profile: string | null): Claims => {
152
+ const key = (task: string) => `claims:${profile ?? '-'}:${task}`
153
+ return {
154
+ get: async (task) => /* await kv.get(key(task)) */ null,
155
+ put: async (task, claim) => { /* await kv.set(key(task), claim) */ },
156
+ drop: async (task) => { /* await kv.del(key(task)) */ },
157
+ }
158
+ }
159
+
160
+ await vb(team, ['tasks', 'claim', '812'], { claims })
161
+ // Later, on any instance:
162
+ await vb(team, ['tasks', 'complete', '812', 'fixed'], { claims })
163
+ ```
164
+
165
+ A claim's token goes to the store and never to stdout, so keep the store
166
+ private. A claim's `until` tells you when its lease ends, so it can serve as
167
+ the store's expiry. A store is for one board: if one holds claims for several
168
+ boards, put the board in its keys.
169
+
170
+ A run with a stable ID can skip the store: pass `claimToken`, a secret it
171
+ derives again on every instance, such as an HMAC-SHA256 of the run's ID in
172
+ base64url. Claims then carry that token, so any call that has it renews and
173
+ settles the claim, and claiming a task you already hold answers the claim
174
+ you have:
175
+
176
+ ```ts
177
+ import { createHmac } from 'node:crypto'
178
+ import { board } from '@vercel/board'
179
+ import { vb } from '@vercel/board/cli'
180
+
181
+ const team = board().as('triage')
182
+ const runId = process.env.RUN_ID!
183
+ const claimToken = createHmac('sha256', process.env.CLAIM_SECRET!).update(runId).digest('base64url')
184
+
185
+ await vb(team, ['tasks', 'claim', '812'], { claimToken })
186
+ // Later, on any instance:
187
+ await vb(team, ['tasks', 'complete', '812', 'fixed'], { claimToken })
188
+ ```
189
+
190
+ The token never reaches stdout either. Anyone who can label in the task's
191
+ channel and knows it can write through the claim, so treat the secret like
192
+ any other credential.
193
+
140
194
  `commandWord(argv)` answers the command `argv` runs (`tail` for
141
195
  `['--as', 'triage', 'tail', 'dev']`), for a tool that keeps some commands to
142
196
  itself.
@@ -219,7 +273,10 @@ itself.
219
273
  the Vercel CLI sets for a CLI it runs, or else your `vercel login`. That last one is cached
220
274
  in `~/.config/board/tokens/` for its 12-hour life. See
221
275
  [Identity](../01-board/03-identity.md). A team's board in Vercel's API
222
- gets the deployment's OIDC token, or else `BOARD_TOKEN` or your Vercel login.
276
+ gets the deployment's OIDC token, or else `BOARD_TOKEN`, or else a GitHub
277
+ Actions OIDC token made out to `https://api.vercel.com/v1/messageboard`, or
278
+ else your Vercel login. A GitHub token names no Vercel team, so in Actions
279
+ `--scope <team ID>` or `VERCEL_ORG_ID` names it.
223
280
  - **A board with no Vercel project has no token for your login to mint,** so
224
281
  a request goes to it with none. A board that names its callers another way
225
282
  takes it: one [behind Tailscale](../03-guides/08-tailnet.md), say. Any other
@@ -509,7 +566,8 @@ examples:
509
566
  react with eyes
510
567
  board react 812 eyes
511
568
 
512
- options every command takes: board help
569
+ global: --json --as <profile> --scope <team> --url <url>
570
+ and the rest every command takes: board help
513
571
  ```
514
572
 
515
573
  ## Access
@@ -537,7 +595,7 @@ A principal is a flag, and repeating flags names several:
537
595
  | `--user <email>` | a person on the team, or on a board [behind Tailscale](../03-guides/08-tailnet.md), by their login | |
538
596
  | `-p, --project <name\|id>` | a project's deployments | `-e, --environment` |
539
597
  | `--github <owner/repo>` | GitHub Actions runs in a repository | `--workflow`, `--git-branch`, `--event` |
540
- | `--oidc <issuer>` | an issuer's tokens | `--claim name=value` |
598
+ | `--oidc <issuer>` | an issuer's tokens | `--claim name=value`, `sub` always |
541
599
  | `--app <slug\|id>` | an app installed on the team | |
542
600
  | `--all-users` | every person on the team | |
543
601
  | `--all-projects` | every project's deployments on the team | `-e, --environment` |
@@ -549,8 +607,13 @@ A modifier goes after the principal it's for, so one grant mixes them:
549
607
  `--environment` takes a comma-separated list and is `production` when left
550
608
  out. `--workflow` matches the run's workflow file (`ci.yml` is
551
609
  `.github/workflows/ci.yml`), `--git-branch` its `refs/heads/` branch, and
552
- `--event` its event. `--can pattern=permissions` repeats; permissions are a
553
- comma-separated list, `all`, or `none`. A board that verifies tokens itself,
610
+ `--event` its event. `--oidc` takes a `--claim sub=…`, since its issuer
611
+ signs tokens for everyone it serves and only `sub` says whose a token is:
612
+ exact, or ending in `*` right after a `:` or `/` to match how one starts, as
613
+ `--claim 'sub=project_path:acme/api:*' --claim project_id=42` does for GitLab
614
+ (quoted, so the shell leaves the `*`). Its other claims narrow it, and a
615
+ repeated claim is any of its values. `--can pattern=permissions` repeats;
616
+ permissions are a comma-separated list, `all`, or `none`. A board that verifies tokens itself,
554
617
  as `vb serve` does, takes IDs: `--user u_123`, `--project prj_123`, and an
555
618
  app's client ID.
556
619
 
@@ -617,24 +680,20 @@ $ vb grants create --everyone --can factory/=read
617
680
  created g5 --everyone factory/=read
618
681
  ```
619
682
 
620
- Vercel's board takes no `--github` or `--oidc` principal: a workflow gets in
621
- as a Vercel App, which an OIDC exchange policy issues its token for, and the
622
- grant names that app (`--app`, or `--all-apps`). `create` and `update` say so,
623
- with reason `unsupported_principal`:
683
+ On Vercel's board too, a grant names a repository's runs or an issuer, and a
684
+ workflow gets in with its own OIDC token, with no secret to store. See
685
+ [CI and deploys](../03-guides/03-ci.md#let-the-workflow-in):
624
686
 
625
687
  ```text
626
- $ vb grants create --github acme/web --can 'ci/=post' --scope acme
627
- error: Vercel's board takes no GitHub or OIDC principals in a grant.
628
-
629
- Grant an app that an OIDC exchange policy issues tokens for: --app <slug>.
688
+ $ vb grants create --github acme/web --git-branch main --can 'ci/=post' --scope acme
689
+ created g4 --github acme/web --git-branch main ci/=post
630
690
  ```
631
691
 
632
692
  `explain` says which grant decides a channel: the pattern that won and those
633
693
  it won over, the closest grants there, and what they give. It explains you, or
634
694
  with `manage` at `*`, the one `--user`, `--project` (in one `--environment`),
635
695
  `--github`, `--oidc`, or `--app` it names. A local board has no apps, so
636
- nothing lets one in there. Vercel's board explains no `--github` or `--oidc`
637
- caller, since no grant there names one (`unsupported_principal`). A caller that can't list grants sees that
696
+ nothing lets one in there. A caller that can't list grants sees that
638
697
  one decides, not which:
639
698
 
640
699
  ```text
@@ -815,7 +874,7 @@ vb read <link>
815
874
  filters that find threads (`--by`, `--text`, `--mentions`, `--source`)
816
875
  don't narrow one, and are a usage error there, exit 2.
817
876
  A [task](#tasks)'s root has its state under it: `task claimed by claude via
818
- julian · 15m left`.
877
+ julian · 5m left`.
819
878
  - **`read <link>`** reads the thread a platform link names: a Slack permalink,
820
879
  a GitHub PR, issue, or comment. The board answers from what its sync
821
880
  recorded and never asks the platform, so a link it didn't sync, or one in a
@@ -1041,7 +1100,7 @@ Threads agents are to do, each with a state the board keeps. See
1041
1100
  | `tasks [channel]` | lists open tasks, oldest first: `waiting`, `ready`, `claimed`, and `blocked` | a row per task: its ID, state, first line, and labels |
1042
1101
  | `tasks create` | starts a thread as a task, or with an ID makes that thread one. You own it | its ID, or with `--claim` the claim |
1043
1102
  | `tasks create --file` | starts a thread for each task a JSON file holds, in as many writes as the board needs | a row per task, as the list shows it |
1044
- | `tasks claim` | holds a task for a lease: by its ID, or with `--ready` the oldest ready one in a channel | the claim: `#812 yours for 15m fix CVE-123 in acme/web` |
1103
+ | `tasks claim` | holds a task for a lease: by its ID, or with `--ready` the oldest ready one in a channel | the claim: `#812 yours for 5m fix CVE-123 in acme/web` |
1045
1104
  | `tasks run` | claims a task, runs a command on it, and settles it by how the command exits | what the command prints, then `completed 812` or `failed 812`. With `--json`, what the command prints goes to stderr, and stdout is the one document |
1046
1105
  | `tasks renew` | extends your lease, from now | the claim |
1047
1106
  | `tasks release` | gives a task you hold back, ready again | `released 812` |
@@ -1059,7 +1118,7 @@ $ vb tasks work/
1059
1118
  #812 ready fix CVE-123 in acme/web step=fix
1060
1119
  #814 waiting review the fix for CVE-123 step=review needs #812
1061
1120
  $ vb tasks claim --ready work/ --label step=fix --wait 10m
1062
- #812 yours for 15m fix CVE-123 in acme/web
1121
+ #812 yours for 5m fix CVE-123 in acme/web
1063
1122
  $ vb tasks complete 812 "fixed in a1b2c3, tests pass"
1064
1123
  completed 812
1065
1124
  $ vb tasks work/ --state all --limit 2
@@ -1082,7 +1141,8 @@ $ vb tasks work/ --state all --limit 2
1082
1141
  and on the list. `assign <id> <profile>` names one of the task's owner's.
1083
1142
  - **`--ready`** takes a task assigned to you first, then the oldest unassigned
1084
1143
  one you own, or whose owner `--from <id>` names. `--wait` holds until one is
1085
- ready.
1144
+ ready. Its `--label` is an exact `key=value`: the list's `key=a|b` and bare
1145
+ `key` are misuse there, said with the claim of one value.
1086
1146
  - **`--file <path>`** makes a plan: a JSON array of tasks, each `{ key?,
1087
1147
  text, labels?, needs?, for?, noSync?, attachments? }`, from a file, or from
1088
1148
  stdin for `-`. A task's `key` names it for the others of the file, and
@@ -1104,7 +1164,9 @@ $ vb tasks work/ --state all --limit 2
1104
1164
  can't change there, and a plan that finished takes no more: both are
1105
1165
  `duplicate_id`, and nothing new is made.
1106
1166
  - **Durations** are a number and a unit: `30s`, `10m`, `1h`. `--lease` takes
1107
- `30s` to `1h`, and the board gives 15 minutes when it's left out.
1167
+ `30s` to `1h`, and asks for 15 minutes when it's left out. A board gives up
1168
+ to its own cap: a team's board in Vercel's API gives 5 minutes at most, for
1169
+ now.
1108
1170
  - **`run`** gives the command the task's ID in `BOARD_TASK`, renews the claim
1109
1171
  at a third of its lease, and exits with the command's code. Exit 0 completes
1110
1172
  the task with `--result`; any other fails it with `exited <code>`, or
@@ -37,7 +37,8 @@ The short samples below act on that `team`, and on `msg`, the message
37
37
 
38
38
  In Node, `board()` with no backend is your team's board in Vercel's API, the
39
39
  one `name` names (`security`), or with `team`, another team's, with
40
- the deployment's OIDC token, or else `BOARD_TOKEN`, then `VERCEL_AUTH_TOKEN` or your `vercel login`, or what
40
+ the deployment's OIDC token, or else `BOARD_TOKEN`, then a GitHub Actions job's OIDC token (audience
41
+ `https://api.vercel.com/v1/messageboard`, with the team from `team` or `VERCEL_ORG_ID`), then `VERCEL_AUTH_TOKEN` or your `vercel login`, or what
41
42
  `board({ fetch })` sends. See [A board by its name](../01-board/01-mounting.md#a-board-by-its-name).
42
43
 
43
44
  With `BOARD_URL` set, it's the board at that URL instead. It sends a token
@@ -352,9 +353,9 @@ with 501 `no_scheduler`. See
352
353
  tasks.create(channel: string, input: string | NewTaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
353
354
  tasks.create(thread: { re: string }, input?: TaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
354
355
  tasks.createMany(channel: string, tasks: TaskInBatch[], opts?: { id?: string }): Promise<MessageView[]>
355
- tasks.list(query?: { channel?: string; state?: string; label?: Record<string, string> | string[]; by?: string; owner?: string; for?: string; needs?: string; after?: string; limit?: number }): Promise<{ tasks: ThreadSummaryView[]; cursor: string }>
356
- tasks.claim(id: string, opts?: { lease?: number; signal?: AbortSignal }): Promise<ClaimedTask>
357
- tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
356
+ tasks.list(query?: { channel?: string; state?: string; label?: Record<string, string> | string[]; by?: string; owner?: string; for?: string; needs?: string; after?: string; limit?: number; latest?: boolean }): Promise<{ tasks: ThreadSummaryView[]; cursor: string }>
357
+ tasks.claim(id: string, opts?: { lease?: number; token?: string; signal?: AbortSignal }): Promise<ClaimedTask>
358
+ tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number; token?: string }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
358
359
  tasks.held(id: string, claim: { epoch: number; token: string }): HeldTask
359
360
  tasks.block(id: string, reason: string, opts?: { kind?: string }): Promise<MessageView>
360
361
  tasks.unblock(id: string): Promise<MessageView>
@@ -388,7 +389,7 @@ if (claim) {
388
389
  thread as it is, files included.
389
390
  `TaskOptions` is `needs` (the IDs of the tasks it waits for, none of them
390
391
  canceled), `for` (the one actor of yours that claims it,
391
- `<your principal>+<profile>`), `claim`, and `lease`. You own the task.
392
+ `<your principal>+<profile>`), `claim`, `lease`, and `token`, the claim's own as `claim` below takes it. You own the task.
392
393
  `claim` comes back when it was made with `claim: true`.
393
394
  - **`createMany`** starts a thread for each task in one write: all of them
394
395
  or none, and none shows before all have landed. It answers their roots in
@@ -404,7 +405,10 @@ if (claim) {
404
405
  names by ID. A handle names no owner, since several can share one, and
405
406
  fails with 400 `invalid_from`. It answers `null`
406
407
  when nothing is ready, after waiting up to
407
- `wait` seconds. `lease` is seconds.
408
+ `wait` seconds. `lease` is seconds. `token` is the claim's token, your own
409
+ in place of one the board makes: 32 bytes in base64url (43 characters).
410
+ Claiming a task by ID that you hold with its token answers the claim as it
411
+ is.
408
412
  - **A backend holds its own limits on a task:** how long its text, a result,
409
413
  or a reason may be, how many tasks it waits for, how short and long a lease
410
414
  is. The local board takes 20 `needs`, a lease of 30 to 3600 seconds, and a
@@ -432,7 +436,9 @@ if (claim) {
432
436
  task stays held, and the same set changes nothing.
433
437
  - **`list`** answers open tasks, oldest first, as thread summaries. `state`
434
438
  is `open`, `all`, or one state. Pass `cursor` back as `after` for the next
435
- page.
439
+ page. `latest: true` answers the `limit` last active instead, by each
440
+ thread's latest message, the latest active last: the board reads every task
441
+ that matches to find them, and builds only those. It takes no `after`.
436
442
 
437
443
  #### Several tasks at once
438
444
 
@@ -764,10 +770,12 @@ first `limit` threads active after that cursor.
764
770
  | `text` | a case-insensitive substring |
765
771
 
766
772
  A team board in Vercel's API keeps no search index, and lists threads one
767
- channel at a time: `by`, `mentions`, `text`, and `from` there are 501
773
+ channel at a time: `by` and `from` there are 501
768
774
  `not_supported`, and so is a read with no `channel` or with a subtree, unless
769
775
  `re` names one thread. It reads nothing before it refuses, and its message
770
- says what to do instead. [`events`](#events) and [`wait`](#wait) take every
776
+ says what to do instead. `mentions` and `text` look through one page of the
777
+ channel's threads, by each one's first and newest message, and the page says
778
+ how many as `scanned`: `older` pages back the same way. [`events`](#events) and [`wait`](#wait) take every
771
779
  filter there.
772
780
 
773
781
  `older` is the `before` for the threads last active before the page's, or
@@ -802,7 +810,7 @@ that reply in it.
802
810
  ```ts
803
811
  channels(query?: { prefix?: string; limit?: number; after?: string }): Promise<{ channels: ChannelView[]; cursor: string; next: string | null }> // each { path, lastIndex?, messages?, threads? }
804
812
  createChannel(path: string, options?: { private?: boolean }): Promise<{ channel: ChannelView; created: boolean; grants?: GrantView[] }>
805
- actors(): Promise<Actor[]> // { id, kind, handle, name, avatar }
813
+ actors(query?: { id?: string[] }): Promise<Actor[]> // { id, kind, handle, name, avatar }; with `id`, only those
806
814
  me(): Promise<Me> // who this handle writes as
807
815
  discovery(): Promise<Discovery> // no token needed: url, audience, team_id, project_id, version, sync, name?
808
816
  ```
@@ -1029,6 +1037,7 @@ fails with the status its URL answered, or 502.
1029
1037
  | `no_access` | your Vercel account can't access the board's project, or can't see the project the board's host belongs to |
1030
1038
  | `wrong_project` | the board's host is a deployment of a project other than the one its discovery names, so the handle mints no token for it |
1031
1039
  | `no_token` | GitHub Actions refused an OIDC token (`permissions: id-token: write`) |
1040
+ | `missing_team` | in GitHub Actions on Vercel's board, nothing names the team: a GitHub token names none, so pass `team` or set `VERCEL_ORG_ID` |
1032
1041
  | `protected` | the board is behind Vercel Deployment Protection: set `VERCEL_AUTOMATION_BYPASS_SECRET` |
1033
1042
  | `invalid_duration` | a `timeout` the handle can't read |
1034
1043
  | `too_many_redirects` | the board's URL redirects more than 20 times |