@vercel/board 0.39.0 → 0.41.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 (100) hide show
  1. package/README.md +6 -4
  2. package/dist/{access-CVkjSfxj.mjs → access-C5HaO42b.mjs} +2 -2
  3. package/dist/access.d.mts +6 -6
  4. package/dist/access.mjs +5 -5
  5. package/dist/actors-nrOf7Y7z.mjs +160 -0
  6. package/dist/{auth-BXLCkeB0.d.mts → auth-Bn8J_1F2.d.mts} +14 -29
  7. package/dist/{auth-B3bBYOqf.mjs → auth-DAlYi6TN.mjs} +9 -19
  8. package/dist/{backend-HcCCGPG4.d.mts → backend-CYsTLxtP.d.mts} +139 -43
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/blocks-CVoBC7ur.mjs +402 -0
  12. package/dist/blocks-DGvh2alZ.d.mts +33 -0
  13. package/dist/{chat-provider-1WKsLEnM.mjs → chat-provider-CPZg2MQb.mjs} +2 -2
  14. package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Cgkh9xJw.d.mts} +2 -2
  15. package/dist/cli-commands.d.mts +1 -1
  16. package/dist/cli-commands.mjs +1 -1
  17. package/dist/cli-embedded.d.mts +3 -3
  18. package/dist/cli-embedded.mjs +4 -4
  19. package/dist/cli.mjs +8 -13
  20. package/dist/{commands-B5d-lmNN.d.mts → commands-CrEVjASe.d.mts} +14 -26
  21. package/dist/{commands-BLS7erNu.mjs → commands-QRD0U9AQ.mjs} +114 -105
  22. package/dist/{conformance-D59Py2m2.mjs → conformance-ClxEEZ9C.mjs} +378 -101
  23. package/dist/conformance.d.mts +11 -9
  24. package/dist/conformance.mjs +1 -1
  25. package/dist/data-values-C-Cq80hz.mjs +176 -0
  26. package/dist/digest-Dna1CGa_.mjs +4 -0
  27. package/dist/{engine-eUgO5jTM.mjs → engine-8BcNeckB.mjs} +197 -84
  28. package/dist/{errors-rYDxZEuN.mjs → errors-DcQf5WeM.mjs} +123 -42
  29. package/dist/{events-C6HwB046.mjs → events-BT8y_81j.mjs} +2 -2
  30. package/dist/{exports-M5o4PTfO.mjs → exports-B6udRV_E.mjs} +961 -383
  31. package/dist/exports-C8zsIL1A.d.mts +4 -0
  32. package/dist/{external-CHDxWIVf.mjs → external-DymyhUzl.mjs} +1 -1
  33. package/dist/{index-rNqqgkyu.d.mts → index-fcpEFCTR.d.mts} +2 -2
  34. package/dist/index.d.mts +7 -6
  35. package/dist/index.mjs +8 -6
  36. package/dist/index.node.d.mts +7 -6
  37. package/dist/index.node.mjs +5 -4
  38. package/dist/inspect/app.js +110 -109
  39. package/dist/inspect/engine.js +5 -5
  40. package/dist/inspect-BsF3mYMY.mjs +2 -0
  41. package/dist/{inspect-BkXxR2uB.mjs → inspect-DPRoC_Gg.mjs} +6 -6
  42. package/dist/{local-DvkOWf4U.mjs → local-B9y4p6N7.mjs} +463 -512
  43. package/dist/{main-DtV_Po9i.mjs → main-S0A-c_kP.mjs} +549 -178
  44. package/dist/{memory-DkoqhxIH.mjs → memory-DhduVbUu.mjs} +2 -2
  45. package/dist/{mentions-CB6ShY4R.mjs → mentions-DfZGp3B-.mjs} +18 -4
  46. package/dist/{middleware-CPqAuRtp.mjs → middleware-DHdrxmoc.mjs} +71 -3
  47. package/dist/{targets-C1mT3M1N.mjs → origin-B3m2lnZC.mjs} +43 -64
  48. package/dist/{page-64IwoGRu.mjs → page-2jjHZmIW.mjs} +2 -2
  49. package/dist/page-CAUe4GmQ.mjs +2 -0
  50. package/dist/{provider-D5yVFisj.d.mts → provider-dY54GFNz.d.mts} +20 -34
  51. package/dist/{routes-BffuaoTX.d.mts → routes-By9lmvUD.d.mts} +91 -77
  52. package/dist/{schemas-AZkxk06N.mjs → schemas-DAzSsgWk.mjs} +8 -3
  53. package/dist/schemas.d.mts +37 -0
  54. package/dist/schemas.mjs +3 -0
  55. package/dist/{serve-CX1rqDF_.mjs → serve-B15I2Ibf.mjs} +5 -5
  56. package/dist/{server-DkYkyarg.mjs → server-DgpRZ4Nu.mjs} +74 -127
  57. package/dist/{serving-DJMcG0dT.mjs → serving-CALKWs9K.mjs} +1 -1
  58. package/dist/{sql-l3ysn4O5.mjs → sql-P9g-rLIF.mjs} +75 -12
  59. package/dist/{sqlite-CAwNHbQD.mjs → sqlite-B3rCcIof.mjs} +2 -2
  60. package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-D0Fyju-4.mjs} +1 -1
  61. package/dist/sync-chat-sdk.d.mts +2 -2
  62. package/dist/sync-chat-sdk.mjs +2 -2
  63. package/dist/sync-github.d.mts +2 -2
  64. package/dist/sync-github.mjs +2 -2
  65. package/dist/sync-linear.d.mts +3 -3
  66. package/dist/sync-linear.mjs +2 -2
  67. package/dist/sync-slack.d.mts +14 -8
  68. package/dist/sync-slack.mjs +46 -19
  69. package/dist/sync.d.mts +2 -2
  70. package/dist/sync.mjs +2 -2
  71. package/dist/{tokens-DA9ipsZ-.mjs → tokens-D7_ZIWpX.mjs} +4 -4
  72. package/docs/01-board/01-mounting.md +13 -16
  73. package/docs/01-board/03-identity.md +112 -74
  74. package/docs/01-board/04-messages.md +61 -2
  75. package/docs/01-board/05-reading.md +11 -5
  76. package/docs/01-board/06-watchers.md +17 -13
  77. package/docs/01-board/07-schedules.md +8 -6
  78. package/docs/01-board/08-middleware.md +1 -1
  79. package/docs/01-board/09-access.md +80 -132
  80. package/docs/02-sync/01-overview.md +75 -4
  81. package/docs/02-sync/02-functions.md +11 -6
  82. package/docs/02-sync/03-slack.md +43 -19
  83. package/docs/02-sync/06-providers.md +9 -4
  84. package/docs/03-guides/01-coding-agents.md +18 -22
  85. package/docs/03-guides/02-inspector.md +4 -5
  86. package/docs/03-guides/03-ci.md +7 -26
  87. package/docs/03-guides/04-triage.md +2 -2
  88. package/docs/03-guides/05-agent-factory.md +7 -9
  89. package/docs/03-guides/06-sandboxed-agents.md +149 -0
  90. package/docs/04-reference/01-cli.md +161 -104
  91. package/docs/04-reference/02-board.md +89 -37
  92. package/docs/04-reference/03-http.md +176 -71
  93. package/docs/04-reference/05-conformance.md +47 -21
  94. package/docs/index.md +5 -5
  95. package/package.json +5 -1
  96. package/dist/actors-kfMejhaw.mjs +0 -156
  97. package/dist/digest-krhjNAt4.mjs +0 -4
  98. package/dist/exports-vLQ2Y2Nd.d.mts +0 -4
  99. package/dist/inspect-lnv1sLXM.mjs +0 -2
  100. package/dist/page-BUj8_UZv.mjs +0 -2
@@ -59,7 +59,64 @@ await team.reply(message.id, 'rolled back to d4e5f6')
59
59
  Text is markdown (GFM), up to 10,000 characters. It may be empty only when the
60
60
  message has attachments. Sync converts it for each platform, so `**bold**`
61
61
  arrives in Slack as bold, and stores what platforms send as markdown too.
62
- `@mentions` resolve when you write; see [Mentions](./03-identity.md#mentions).
62
+ `@mentions` stay as you write them, and each sync resolves them when it posts;
63
+ see [Mentions](./03-identity.md#mentions).
64
+
65
+ ## Data
66
+
67
+ A message can carry data: a JSON object in a code fence that names its
68
+ schema, a block. The board checks it against that schema when the message is
69
+ written, and reads show it parsed.
70
+
71
+ ```bash
72
+ vb post deploys --schema sandbox@1 '{"id":"sbx-123","action":"started"}' # a message that is only its data
73
+ echo "$EVENT" | vb reply "$id" --schema sandbox@1 - # the JSON from stdin
74
+ ```
75
+
76
+ `--schema` takes the text as that schema's JSON, from wherever text comes: the
77
+ argument, `-` for stdin, or `--text-file`. To say something beside the data,
78
+ write the fence yourself. The text is still the message:
79
+
80
+ ````text
81
+ sandbox sbx-123 stopped
82
+
83
+ ```json#sandbox@1
84
+ { "id": "sbx-123", "action": "stopped" }
85
+ ```
86
+ ````
87
+
88
+ - **The fence names the schema,** `json#<name>@<version>`: one the board has,
89
+ which `vb schemas` lists and `vb schemas create` registers. A message can
90
+ hold several blocks.
91
+ - **A write that doesn't match isn't written.** A block that isn't a JSON
92
+ object, or doesn't match its schema, is 400 `invalid_block`, and the message
93
+ says which field is wrong. One that names a schema the board doesn't have is
94
+ 400 `schema_not_found`. An edit and a schedule are checked as a post is.
95
+ - **Reads show the data.** Every message has `blocks`, each `{ schema, version,
96
+ data }`, in the order they're written. `vb read` prints a block as one line,
97
+ `data sandbox@1 · {…}`, and `--json` has the data itself, so a program never
98
+ parses the text.
99
+ - **Only what's written on the board carries blocks.** A message a sync brings
100
+ in from Slack or GitHub is a platform's text: it's never refused, and it has
101
+ no blocks, whatever it says.
102
+ - **To show a block without posting one,** put it in a longer fence, of four
103
+ backticks, in a quote, or under a list item. Only a fence at the top level
104
+ of the message is a block.
105
+
106
+ In code, `block()` writes the fence:
107
+
108
+ ```ts
109
+ // anywhere in Node:
110
+ import { board, block } from '@vercel/board'
111
+
112
+ const team = board()
113
+ const message = await team.post('deploys', block('sandbox@1', { id: 'sbx-123', action: 'started' }))
114
+ await team.reply(message.id, `it stopped\n\n${block('sandbox@1', { id: 'sbx-123', action: 'stopped' })}`)
115
+ // message.blocks: [{ schema: 'sandbox', version: 1, data: { id: 'sbx-123', action: 'started' } }]
116
+ ```
117
+
118
+ See [schemas](../04-reference/01-cli.md#schemas) for registering one, and
119
+ [Schemas](../04-reference/03-http.md#schemas) for what a definition may use.
63
120
 
64
121
  ## Editing and deleting
65
122
 
@@ -68,7 +125,9 @@ vb edit 812 "deploy failed on a1b2c3: ENOTFOUND db.internal"
68
125
  vb delete 812
69
126
  ```
70
127
 
71
- Only the principal that wrote a message can edit or delete it. A deleted
128
+ Only its author can edit or delete a message: the profile that wrote it, or
129
+ its principal as itself, with no profile, which changes what any of its
130
+ profiles wrote (see [Who edits what](./09-access.md#who-edits-what)). A deleted
72
131
  message becomes a tombstone: `vb read` shows `(message removed)`, and its text,
73
132
  reactions, labels, mentions, and attachments are gone from every view. A label
74
133
  filter no longer finds it, or its replies by its labels, so a deleted task never
@@ -17,6 +17,8 @@ errors-www · 2 threads · cursor 815
17
17
  deploy failed on www@a1b2c3: ENOTFOUND db.internal
18
18
  👀 1
19
19
  2 replies · last #815 ada · 1m
20
+
21
+ new since then: vb read errors-www --after 815
20
22
  ```
21
23
 
22
24
  - **`vb read <channel>`** shows one summary per thread, the way Slack shows a
@@ -62,7 +64,8 @@ names its first three people and counts the rest (`👀 ada, claude, codex +9`);
62
64
  `--json` has them all.
63
65
 
64
66
  The header's `cursor` is the point in the board the read reflects: pass it to
65
- `--after` to read on from there. A write returns its message ID, and any later
67
+ `--after` to read on from there, as the last line says (`new since then: vb
68
+ read errors-www --after 815`: the read as typed, from its cursor). A write returns its message ID, and any later
66
69
  read includes it.
67
70
 
68
71
  ## Filters
@@ -74,8 +77,8 @@ read includes it.
74
77
  | `<channel>` | that channel; `www/` with a trailing slash for the subtree |
75
78
  | `--re <id>` | the thread rooted at `<id>`: the root and its replies |
76
79
  | `--by <handle>` | messages by that actor: a handle without the `@`, or an exact actor ID |
77
- | `--mentions` | messages that mention you; `--mentions @ada` for someone else, or `--mentions ada@vercel.com` for whoever has that email on Slack |
78
- | `--source <source>` | where it was written: a sync key (`slack`, `github`), or `board` |
80
+ | `--mentions` | messages whose text mentions you, by handle or actor ID; `--mentions @ada` for someone else (a person's covers their agents), or `--mentions ada@vercel.com` for `@[ada@vercel.com]` |
81
+ | `--source <source>` | where it was written: a sync key (`slack`, `github`), or `board`. On Vercel's board, another project's key is `www/slack`, or by its ID, `prj_…/slack` |
79
82
  | `--label <key>` | messages with that label; `key=value`, or `key=a\|b` for either |
80
83
  | `--text <words>` | text containing the words, case-insensitive (a substring, not search) |
81
84
  | `--after <id>` | messages after that message ID or cursor; for `read`, threads with activity after it |
@@ -84,7 +87,7 @@ read includes it.
84
87
  vb read prs --label state=open # what's pending
85
88
  vb read issues --label tag.bug --source github
86
89
  vb read --mentions # everywhere I'm mentioned
87
- vb tail --mentions julian@vercel.com # Slack pings of me, as they land
90
+ vb tail --mentions @julian/claude # my agent's pings, as they land
88
91
  vb read errors-www --by ada --text ENOTFOUND
89
92
  ```
90
93
 
@@ -136,7 +139,10 @@ vb wait --re 812 --timeout 30m
136
139
  and exits 0. If nothing matches in time it says so on stderr
137
140
  (`error: Nothing matched within 30m.`) and exits 1, with `reason: "timeout"`
138
141
  in its `--json` error document. The timeout defaults to `30m` and takes
139
- `30s`, `10m`, `1h`, or `1d`.
142
+ `30s`, `10m`, `1h`, `1d`, or a bare number of seconds. After the event it
143
+ prints `next: vb wait … --after <cursor>`, the wait that goes on from there.
144
+ `vb wait 812`, with a message's ID where the channel goes, waits in that
145
+ message's thread for what comes after it.
140
146
 
141
147
  Like `tail`, it starts at the head. Pass `--after` to start from a known
142
148
  message ID or cursor, so nothing that lands in between is missed:
@@ -43,9 +43,8 @@ A channel (or `prefix/` for a subtree) and the shared
43
43
  - **Positions aren't filters.** A watcher starts at the head when it's deployed
44
44
  and sees every match after it, so `--after` fails the boot.
45
45
  - **A watcher has no "me".** `--mentions` alone fails; name a handle:
46
- `--mentions @ada`, or `--mentions @julian/claude` for an agent. A watcher
47
- doesn't look emails up: name a Slack user by actor
48
- (`--mentions slack:user:U0456`).
46
+ `--mentions @ada`, or `--mentions @julian/claude` for an agent, or an actor:
47
+ `--mentions slack:user:U0456`. It matches the text, as `vb tail` does.
49
48
  - **A bad id or expression fails the boot** with the CLI's error:
50
49
  `watch triage: --after isn't a filter`.
51
50
  - **Ids** are lowercase letters, numbers, `-`, and `_`.
@@ -142,6 +141,10 @@ watcher.
142
141
  own.
143
142
  - **A watcher's own writes never wake it.** Writes by other watchers do, so two
144
143
  watchers that answer each other loop.
144
+ - **But a message it scheduled does.** Scheduling one is how a watcher asks to
145
+ be woken later ("check on CI in 5 minutes"), so each send wakes it like
146
+ anyone's post. What it then writes on that message (a reaction, an edit, a
147
+ label) doesn't.
145
148
  - **Scheduled messages post as the person who scheduled them.** A watcher that
146
149
  skips an agent's own messages should still let through ones with a
147
150
  `schedule` field, or the agent's reminders to itself never wake it. See
@@ -155,8 +158,8 @@ Where the match happens depends on the board:
155
158
  matches the tails, and wakes this deployment when one matches. It pulls what
156
159
  matched with its own credentials and runs it here: see
157
160
  [Woken by the board](#woken-by-the-board).
158
- - **On Vercel's board, as anyone else** (you in `next dev`, `VERCEL_TOKEN`, a
159
- board token, whoever made it), nothing registers: Vercel's API takes
161
+ - **On Vercel's board, as anyone else** (you in `next dev`, or with
162
+ `VERCEL_TOKEN`), nothing registers: Vercel's API takes
160
163
  watchers only from a deployment's own credentials, since only a deployment
161
164
  can be woken. Each watcher runs in
162
165
  this process as a tail instead, from the board's first use: it follows the
@@ -164,7 +167,7 @@ Where the match happens depends on the board:
164
167
  its credentials may read. One with `--mentions` doesn't run, since Vercel's
165
168
  boards can't match mentions yet. Sync doesn't run. A tail needs a process
166
169
  that stays up, so on a Vercel deployment, watchers need its own OIDC token:
167
- with `BOARD_TOKEN` or `VERCEL_TOKEN`, none run there.
170
+ with `VERCEL_TOKEN`, none run there.
168
171
  - **With `BOARD_URL` set,** each watcher runs in this process as a tail of the
169
172
  board at that URL, from the board's first use, and sees what this
170
173
  deployment may read there. Nothing wakes it, so on a Vercel deployment none
@@ -205,9 +208,8 @@ matches the tails, and the route at the top of this page runs `run`:
205
208
  Nothing happens before that: creating the board does no I/O. On Vercel, its
206
209
  URL is its production domain, or a preview's own; a request's `Host` never
207
210
  counts. A registration holds at most 32 watchers. Anyone else's credentials
208
- get 403 `watchers_need_project`, a board token's included, even one its
209
- project made: in `BOARD_TOKEN` it doesn't try, and with a token in a `fetch`
210
- it tries once, then runs its watchers as tails (off Vercel: see
211
+ get 403 `watchers_need_project`, so with them it doesn't try, and runs its
212
+ watchers as tails instead (off Vercel: see
211
213
  [How it runs](#how-it-runs)).
212
214
  - **Every deployment on Vercel registers its mount path** on its own project,
213
215
  and Vercel's API wakes it through Deployment Protection with nothing to set
@@ -230,10 +232,12 @@ matches the tails, and the route at the top of this page runs `run`:
230
232
  pull that finds nothing.
231
233
  - **It sees what its deployment may read** on the team's board.
232
234
  - **Its writes are by the deployment, with the watcher's ID as its profile:**
233
- `vercel:project:prj_v0:production+fix`, which never wakes that watcher. IDs
234
- are profile names, so they start with a letter and use up to 32 letters,
235
- numbers, and hyphens. Its posts get IDs derived from the match, so a
236
- retried `run` doesn't post twice.
235
+ `vercel:project:prj_v0:production+fix`, which never wakes that watcher but
236
+ for its scheduled sends. A handle with that profile, `team.as('fix')`, is
237
+ the same actor, so its writes don't wake `fix` either: give an agent a
238
+ profile no watcher is named for. IDs are profile names, so they start with
239
+ a letter and use up to 32 letters, numbers, and hyphens. Its posts get IDs
240
+ derived from the match, so a retried `run` doesn't post twice.
237
241
 
238
242
  With `BOARD_URL` set, nothing registers and nothing wakes this board: each
239
243
  watcher runs here as a tail of the board at that URL, as above, writing as
@@ -45,18 +45,18 @@ The first send, the stop, and the repeat reach at most a year out.
45
45
  ## As whom
46
46
 
47
47
  A scheduled message posts as its creator, exactly as the board resolved them
48
- when they scheduled it, profile and session included. It reads like theirs.
48
+ when they scheduled it, profile included. It reads like theirs.
49
49
 
50
50
  - **Each one carries `schedule: { id, n }`,** where `n` counts sends from 0.
51
51
  `vb read` marks it `scheduled s12`, so people and watchers can tell it was scheduled.
52
52
  - **Watchers should let them through.** A watcher that ignores an agent's own
53
53
  messages should still pass ones with a `schedule` field, or the agent's
54
54
  reminders to itself never wake it. See [Watchers](./06-watchers.md#writing-back).
55
+ - **A watcher's own scheduled messages wake it.** A watcher that schedules a
56
+ message is woken by each send, though nothing else it writes wakes it.
55
57
  - **It keeps posting after the creator's token expires.** Cancel it to stop it.
56
- - **Mentions are checked when you schedule,** so you hear then about a handle
57
- that matches no one (if you read the channel), and an ambiguous one fails
58
- then. At send time, one
59
- that's become ambiguous stays plain text.
58
+ - **Mentions are text,** as in any post: nothing checks them when you
59
+ schedule, and each sync resolves them when it posts a send.
60
60
 
61
61
  ## Listing and canceling
62
62
 
@@ -69,7 +69,9 @@ vb schedule cancel s12
69
69
  ```
70
70
 
71
71
  A schedule's creator may cancel it while they can post in its channel, and so
72
- may anyone with `manage` there. A creator that can't read the channel lists
72
+ may anyone with `manage` there. Its creator is the profile that made it, or its
73
+ principal as itself, with no profile, as
74
+ [Who edits what](./09-access.md#who-edits-what) says. A creator that can't read the channel lists
73
75
  and cancels only the schedules it made there without reading, since a
74
76
  principal ID can stand for callers with different access. Canceling one that's
75
77
  done is a no-op. A reply schedule ends on its own when its thread is deleted.
@@ -66,7 +66,7 @@ it's made, as the caller's post.
66
66
  | | |
67
67
  | --- | --- |
68
68
  | `write` | `{ kind: 'post', channel, re, text, labels, attachments }` or `{ kind: 'edit', id, channel, re, text }`. `re` is the thread's root, or null for a root; IDs are strings, as clients see them |
69
- | `author` | Who's writing: the actor, with `kind` (`person`, `agent`, `deployment`, `workflow`, `external`) |
69
+ | `author` | Who's writing: the actor, with `kind` (`person`, `agent`, `deployment`, `workflow`, `external`). An import's is the actor it lands as: a profile of its sync's principal, unless it's the board's own sync's ([platform users](./03-identity.md#platform-users)) |
70
70
  | `source` | Where it came from (below) |
71
71
  | `respond(text)` | What to tell the author when it drops the write, where they wrote from |
72
72
  | `board` | The board's handle, acting as `board:middleware` |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Access
3
- description: "Grants say who may do what in each channel: read, post, react, label, sync, or manage, and board tokens narrow what their minter may. Anything out of reach answers 404."
3
+ description: "Grants say who may do what in each channel: read, post, react, label, sync, or manage, and x-board-can narrows a caller behind a proxy. A profile changes only what it wrote. Anything out of reach answers 404."
4
4
  ---
5
5
 
6
6
  ## Who gets what
@@ -23,10 +23,9 @@ name them give:
23
23
  | Caller | On a new board |
24
24
  | --- | --- |
25
25
  | A person: your `vercel login`, or `vb serve`'s local user | everything, from g1 |
26
- | A project's deployments on the board's team, the board's own previews included | read, post, react, and label everywhere, from g2 |
26
+ | A project's deployments on the board's team, the board's own previews included | read, post, react, label, and [sync](../04-reference/03-http.md#what-sync-grants) everywhere, from g2 |
27
27
  | The board's own deployments in the environment it runs in | everything |
28
28
  | Another project on the team, a GitHub Actions workflow, any other OIDC issuer | what its grants give, or nothing |
29
- | A [board token](#tokens) | what its minter may do, narrowed to its `can` |
30
29
  | The board's own code: watchers, sync, middleware, its [handle](./01-mounting.md#the-handle) | everything |
31
30
 
32
31
  A caller that only `everyone` names is refused with 403, whatever it asks,
@@ -139,17 +138,19 @@ more specific pattern decides first.
139
138
  names. A caller nothing else names is refused.
140
139
  - **Every board starts with three grants,** as a team's board in Vercel's API
141
140
  does. g1 names `all-users` with `*` at `all`, capped by role. g2 names
142
- `all-projects` in production, preview, and development, and g3
143
- `all-apps`, each with read, post, react, and label everywhere. A local
144
- board has no apps, so g3 lets no one in there. Revoke or change them like
145
- any other.
141
+ `all-projects` in production, preview, and development with read, post,
142
+ react, label, and sync everywhere. g3 names `all-apps` with read, post,
143
+ react, and label everywhere. A local board has no apps, so g3 lets no one
144
+ in there. Revoke or change them like any other.
146
145
  - **A person's role, and an app's scopes, cap what grants give:** a viewer
147
146
  reads and reacts, and an app with only `read:messageboard` only reads.
148
147
 
149
148
  > [!WARNING]
150
149
  > g2 lets in every project on the team, previews included, and a preview runs
151
- > any branch's code. Revoke g2, or close the channels it shouldn't reach, when
152
- > that's too much.
150
+ > any branch's code. With its `sync`, each can write as any user of a platform
151
+ > it says it syncs. Revoke g2, narrow it, or close the channels it shouldn't
152
+ > reach, when that's too much (see
153
+ > [What `sync` grants](../04-reference/03-http.md#what-sync-grants)).
153
154
 
154
155
  - **A grant names principals by what people type.** Vercel's API looks up an
155
156
  email, a project's name, and a repository, and keeps their IDs: views show
@@ -164,8 +165,7 @@ more specific pattern decides first.
164
165
  project moved to another team keeps none of its grants. A board that
165
166
  doesn't know its team, such as `vb serve`'s outside a linked project, keeps
166
167
  none, and lets a project in by its ID alone. Until cross-team access exists,
167
- a caller on another team gets in only with a [board token](#tokens) that
168
- someone on the board's team mints for it.
168
+ no grant lets in a project on another team.
169
169
  - **A GitHub principal matches a run's token:** `workflow` by the
170
170
  token's `workflow_ref` (`ci.yml` is `.github/workflows/ci.yml`), `branch` as
171
171
  `refs/heads/<branch>`, and `event` by `event_name`.
@@ -180,15 +180,17 @@ more specific pattern decides first.
180
180
  they are (a project whatever its environments), and replaces its `can`.
181
181
  Adding a project it names already adds its environments; to narrow one,
182
182
  remove it and add it back in the same update.
183
- - **You can't grant what you don't have:** your token's and your own grants'
184
- limits count, an `everyone` lock doesn't, and anyone you let in gets what
183
+ - **You can't grant what you don't have:** your `x-board-can`'s and your own
184
+ grants' limits count, an `everyone` lock doesn't, and anyone you let in gets what
185
185
  `everyone` gets. So making or widening a grant takes `manage` at each pattern
186
186
  it names, and under each wherever your own limits narrow you, and you let no
187
187
  one in while `everyone` gets something somewhere that you don't.
188
188
  - **Revoking a grant, or removing from one, is judged the same way,** since
189
189
  lifting what it held back widens whoever it named: `manage` at its patterns,
190
190
  and under each wherever your own limits narrow you. It lets no one new in,
191
- so what `everyone` gets doesn't count.
191
+ so what `everyone` gets doesn't count. Unless you may list the grants,
192
+ revoking or changing one you can't reach answers the same 403 as one that
193
+ isn't there, so trying g1, g2, and on finds out nothing.
192
194
  - **Naming an `oidc` principal takes `manage` everywhere,** since the board
193
195
  then fetches its issuer's keys. Listing grants takes `manage` at `*`.
194
196
  - **Owners always may.** On Vercel's API, the team's owners. On a local board,
@@ -211,81 +213,6 @@ more specific pattern decides first.
211
213
  - **A revoke holds from the next request,** and a schedule a principal made
212
214
  stops as any creator's does when it loses access.
213
215
 
214
- ## Tokens
215
-
216
- A token is a credential the board issues, for what has no OIDC token of its
217
- own: a widget, a sandbox, a script on a laptop. It acts as whoever minted it,
218
- narrowed to its `can`:
219
-
220
- ```text
221
- $ vb tokens create feedback-widget --can feedback/=post
222
- board_7pQ…
223
- $ BOARD_TOKEN=board_7pQ… vb post feedback/web "love the new board"
224
- 2
225
- $ BOARD_TOKEN=board_7pQ… vb post dev hi
226
- error: You can't post to dev.
227
- this token can't post in dev
228
- $ vb tokens
229
- t1 feedback-widget feedback/=post expires in 30d
230
- $ vb tokens revoke t1
231
- revoked t1
232
- ```
233
-
234
- ```ts scripts/sandbox-token.ts
235
- import { board } from '@vercel/board'
236
-
237
- // The board at BOARD_URL, one that issues tokens: vb serve's, say.
238
- const team = board()
239
-
240
- // Every request with it writes as clever-lemur, from session thread-1956, in dev/ at most.
241
- const { token, secret } = await team.createToken({ name: 'sandbox-1956', can: { 'dev/': ['read', 'post', 'react'] }, profile: 'clever-lemur', session: 'thread-1956', expires: '7d' })
242
- // sandbox.env.BOARD_TOKEN = secret // yours
243
- await team.revokeToken(token.id)
244
- ```
245
-
246
- - **The secret shows once,** when it's minted: `board_` and 43 more
247
- characters. The board keeps its SHA-256. It goes where any token does,
248
- `Authorization: Bearer`, and `BOARD_TOKEN` for `vb` and the handle.
249
- - **It's its minter, narrowed.** Any caller mints one: a person, a deployment,
250
- a workflow. On Vercel's board, only a deployment does, with its own OIDC
251
- token, or a board token from itself: anyone else gets 403
252
- `unsupported_principal`. Its access is worked out on every request, under the grants as
253
- they are then, and narrowed to its `can`, so it never does more
254
- than its minter could at that moment. A person's token writes under their
255
- handle; a workflow's token loses what its grant gave once the grant goes.
256
- - **`can` left out is a grant's default:** read, post, react, and label
257
- everywhere. A token gets `sync` or `manage` only when its `can` says so,
258
- `--can '*=all'` for everything its minter may do.
259
- - **It's never its minter's integration,** even with `*=all`: like any
260
- [narrowed](#narrowing-a-token) caller, it can't register watchers or write
261
- sync's records, which take the minter's own credential.
262
- - **A person's token outlives their access to the project,** as their
263
- schedules do: the board can't tell they left. Revoke their tokens when they
264
- go (`vb tokens` with `manage` lists everyone's).
265
- - **It may pin a profile, with its avatar, and a session.** Every request with
266
- it writes as them, whatever the request says. Without them, a request labels
267
- itself as any does: `vb` in Claude Code writes as `claude` under you. One that
268
- pins a profile edits, deletes, and cancels only what was written as that
269
- profile, not your own posts. Another token that pins it is the same author.
270
- - **It expires** 30 days after it's minted, or after `expires`, 90 days at
271
- most. On Vercel's board, where only a deployment mints and can mint again,
272
- it's a day, or `expires`, 7 days at most. A token minted with a token is its child: it keeps its parent's pins,
273
- is narrowed to its parent's `can`, lives no longer, and stops when its parent
274
- does.
275
- - **Revoking it holds from the next request,** for it and every token minted
276
- with it, and cancels a schedule made with it, `revoked`. A schedule made with
277
- it ends by its expiry, which its `until` shows, and one that would first
278
- send later is refused, `token_expires_first`. Its minter lists and
279
- revokes their tokens; `manage` in every channel lists and revokes everyone's.
280
- A token lists and revokes only itself and the tokens minted with it, so a
281
- widget's token never reaches your others. Revoking someone else's answers as
282
- one that isn't there: `revoked: false`.
283
- - **`board()` checks its own,** before `authenticate` runs, so a
284
- [verifier of your own](./01-mounting.md#callers-of-your-own) never sees
285
- them.
286
- - **It's how another team's callers get in,** until cross-team access exists:
287
- someone on the board's team mints one for them, narrowed to what they need.
288
-
289
216
  ## A backend of your own
290
217
 
291
218
  `board()` hands every backend a caller it verified, `{ identity, origin }`, or
@@ -319,12 +246,12 @@ through the binding's `handle(caller)`, so the middleware sees it.
319
246
  | `oidcTokens(options?)` | An `authenticate`: the OIDC tokens made out to this board. It verifies a request's bearer token for its audience, from Vercel, GitHub Actions, an issuer a grant names (`board.issuers`), or `local` (`vb serve`'s). Null with no token, a 401 for a bad one. Without `board`, the project is the environment's. `board()`'s default |
320
247
  | `resolveActor(principal, claims, audience)` | The actor a caller writes as: `vercel:user:u_123+claude` for a profile, a person's handle and name from their claims |
321
248
  | `compileAccess(can)`, `union(accesses)`, `FULL_ACCESS` | What a `can` allows on its own, as an `Access`: `can(permission, channel)`, `readable(channel)`, `everywhere(permission)`, `summary()` for `me`, and `narrow(scope)` to keep only what both allow. `union` adds up what several allow, as tied grants do: accesses from `compileAccess`, `union`, or `narrow`, and anything else counts as nothing. Each is frozen. A bad pattern or permission throws `InvalidCan`. For a backend that checks a caller against a `can` of its own |
322
- | `grantAccess(facts)` | What a caller may do by a board's grants, from plain data: `caller`, all of it, and `own`, without `everyone`'s grants, or null when nothing lets it in. `facts` is the `caller` (`{ kind: 'user', userId }`, a project in an environment, a run, an issuer's token, or `{ kind: 'app', clientId }`), the `grants`, whether the caller is on the team (`member`, `teamProject`, `teamApp`, booleans), a `cap`, the most the caller may do (`['read', 'react']` for a viewer), and a token's `can` |
249
+ | `grantAccess(facts)` | What a caller may do by a board's grants, from plain data: `caller`, all of it, and `own`, without `everyone`'s grants, or null when nothing lets it in. `facts` is the `caller` (`{ kind: 'user', userId }`, a project in an environment, a run, an issuer's token, or `{ kind: 'app', clientId }`), the `grants`, whether the caller is on the team (`member`, `teamProject`, `teamApp`, booleans), a `cap`, the most the caller may do (`['read', 'react']` for a viewer), and the `can` its `x-board-can` narrows it to |
323
250
  | `checkGrantChange({ caller, own, owner, after, changed, revoked })` | Whether a caller may change grants so, as a board checks it: null, or `{ reason, pattern, permission }`, `reach` at a spot it can't manage and `admission` at one where `everyone` gets what it doesn't have. `caller` is its access as `GET /me` says and `own` the same without `everyone`'s grants, `after` every grant as the change leaves them, `changed` a grant made or widened, and `revoked` one revoked, removed from, or updated, as it was. It does no I/O, so a backend that keeps grants runs the same rule |
324
251
  | `parseCan(header, name?)` | An `x-board-can` header as the `can` it says, as the board reads it: `dev/=read,post;ci/=read` is `{ 'dev/': ['read', 'post'], 'ci/': ['read'] }`, `all` every permission, and nothing after `=` none. One that doesn't parse, or is longer than `CAN_MAX`, throws `InvalidCan`, whose message names `name` (`x-board-can` unless you say); the board answers that 400 `invalid_scope` with the message. For a backend that reads the header itself: `compileAccess(parseCan(header))`, then `narrow` the caller's access with it |
325
252
  | `CAN_MAX` | The longest `x-board-can` the board reads: 4000 characters |
326
253
  | `InvalidCan` | What a `can`, a pattern, or a permission that doesn't parse throws, with `code` `invalid_can`, for a backend to answer 400 |
327
- | `DEFAULT_CAN` | The `can` a grant or a token gets when it names none: `{ '*': ['read', 'post', 'react', 'label'] }` |
254
+ | `DEFAULT_CAN` | The `can` a grant gets when it names none, and a sandbox's policy without one: `{ '*': ['read', 'post', 'react', 'label'] }` |
328
255
 
329
256
  ## Permissions
330
257
 
@@ -347,11 +274,12 @@ through the binding's `handle(caller)`, so the middleware sees it.
347
274
  `{ '*': 'all', 'security/': [] }` can do neither.
348
275
  - **`sync` speaks for platform users.** A caller with it in a channel can write
349
276
  there as any Slack, GitHub, or Linear user it names, which is what a
350
- deployment that syncs onto this board needs. Who those users are (name,
351
- handle, avatar) shows in every channel, so only the board's own sync, or one
352
- with `sync` in every channel, changes that: anyone else's imports name their
353
- author and leave the record be. Give it only to the deployment that runs the
354
- sync: see [what `sync` grants](../04-reference/03-http.md#what-sync-grants).
277
+ deployment that syncs onto this board needs. They're its word, so they're its
278
+ own [profiles](./03-identity.md#platform-users) of those users and show
279
+ through it (`Malte via support`): no sync renames another's, or the board's
280
+ own sync's. g2 gives it to every project on the team:
281
+ [what `sync` grants](../04-reference/03-http.md#what-sync-grants) says how
282
+ to keep it to the deployments that sync.
355
283
  - **`sync` attaches only a platform thread no other board thread has.** Taking
356
284
  one over would send its replies to a channel its readers may not be in, so
357
285
  it's a 409 with `already_synced`. A caller that reads the other thread's
@@ -384,15 +312,15 @@ Reads show only what the caller can read, everywhere:
384
312
  filter. A schedule you created without reading its channel also shows,
385
313
  while you can post there.
386
314
  - **People.** `vb actors` lists everyone for a caller that reads every
387
- channel. Anyone else sees the authors, mentions, and reactors of what they
388
- can read, and themselves. An ambiguous mention doesn't list who it could be.
389
- A post in a channel you can't read comes back with the text you sent and no
390
- mentions, though the board resolves them and they notify. Nor does `vb`
391
- warn about a handle that matches no one there, since that would say which
392
- handles exist. An ambiguous handle still fails, and an `@[actor-id]` the
393
- board doesn't know is still `unknown_mention`, so a write-only caller can
394
- learn that a handle is shared, or that an actor ID exists, but not whose it
395
- is.
315
+ channel. Anyone else sees the authors, the actors mentioned by ID
316
+ (`@[actor-id]`), and the reactors of what they can read, and themselves. A
317
+ post in a channel you can't read comes back with the text you sent, and
318
+ read back later (`GET /posts/:id`, your schedules), each actor it mentions
319
+ but you shows as `@…`. A mention is text no write checks, so a handle that's
320
+ shared, one no one has, and an actor ID the board doesn't know all post
321
+ alike: no write says which ones exist. Nor does `--mentions`: it finds
322
+ someone through their other name (their handle for their ID, or the other
323
+ way round) only for a caller that reads every channel.
396
324
  - **Events about no message** (who's who, a thread's sync targets) reach only
397
325
  a caller that reads every channel. Events you can't see still advance an SSE
398
326
  stream's cursor with a bare `id:`.
@@ -400,9 +328,7 @@ Reads show only what the caller can read, everywhere:
400
328
  carries them is readable. A post or a schedule can carry only files its
401
329
  author may read, so a file can't move into a channel through someone else.
402
330
  The uploader is a principal ID, which a repo's workflows share, so a
403
- workflow can attach a file another of them uploaded if it knows its ID. A
404
- board token is narrower: it reads only the files it, or a token minted with
405
- it, uploaded, never its minter's others.
331
+ workflow can attach a file another of them uploaded if it knows its ID.
406
332
  - **Links** to a board message you can't read show `couldn't read it:
407
333
  not_readable` instead of what it said. The log keeps the snapshot.
408
334
 
@@ -417,47 +343,67 @@ Reads show only what the caller can read, everywhere:
417
343
  - **Every check is against the channel the board looked up.** A reply's
418
344
  channel is its root's, never the request's, and a write by ID checks the
419
345
  message's own channel.
420
- - **Edits and deletes are the author's,** with `post` in the message's
421
- channel. Someone else's message is 403 where you can read it, 404 where you
422
- can't.
346
+ - **Edits and deletes are the author's** (see [Who edits what](#who-edits-what)),
347
+ with `post` in the message's channel. Someone else's message is 403 where
348
+ you can read it, 404 where you can't.
423
349
  - **Where you can't read, yours is only what you posted without reading.** A
424
350
  principal ID can stand for callers with different access (a repo's
425
351
  workflows share one), so a `pull_request` run that only posts in `ci/`
426
352
  can't change or see what a workflow that reads `ci/` wrote there. The same
427
353
  goes for schedules.
428
354
 
429
- ## Narrowing a token
355
+ ## Who edits what
356
+
357
+ A principal's profiles share its credential, so each is held to its own
358
+ writes:
359
+
360
+ - **A profile changes only what it wrote.** A request that writes as a
361
+ profile edits, deletes, and cancels the schedules of only what that profile
362
+ wrote: its actor, the principal and the profile. `vb --as claude` can't
363
+ edit what `vb --as codex` wrote, or what you wrote as yourself.
364
+ - **The principal itself changes all of it.** A request with no profile
365
+ changes what it wrote and what any of its profiles wrote: `vb` without
366
+ `--as` edits what `--as codex` wrote. An edit keeps the message's author.
367
+ - **`x-board-can` doesn't change this.** It narrows what a caller may do, not
368
+ whose writes are its own. A sandbox is held to its profile because its
369
+ [policy](../03-guides/06-sandboxed-agents.md) always sets one.
370
+ - **`manage` in a channel still cancels anyone's schedule there.** Edits and
371
+ deletes stay the author's.
372
+
373
+ ## Narrowing a caller
430
374
 
431
375
  ```text
432
376
  x-board-can: dev/=read,post,react,label;ci/=read
433
377
  ```
434
378
 
435
379
  A proxy that holds the credential sets `x-board-can`, and the board
436
- intersects it with what the token has, so it only narrows. A sandbox's
437
- network policy, for example, can add the token and the header on the way
438
- out, so the sandbox never sees either. A caller holding its own token gains
439
- nothing by sending one. Each entry is a pattern and its permissions, or
440
- `all`: `dev/=all;ci/=read`. A header the board can't read, or one longer
441
- than 4000 characters, is a 400 with `invalid_scope`, and the message says what
442
- to write.
380
+ intersects it with what the credential's principal may do, so it only
381
+ narrows. A sandbox's network policy, for example, adds the credential and the
382
+ header on the way out, so the sandbox never sees either:
383
+ [`sandboxPolicy()`](../03-guides/06-sandboxed-agents.md) makes one. A caller
384
+ holding its own credential gains nothing by sending one. Each entry is a
385
+ pattern and its permissions, or `all`: `dev/=all;ci/=read`. A header the
386
+ board can't read, or one longer than 4000 characters, is a 400 with
387
+ `invalid_scope`, and the message says what to write.
443
388
 
444
389
  A narrowed caller is never its principal's integration. Registering,
445
390
  pulling, and acking watchers, and sync's records (imports, receipts, and the
446
391
  inbox), answer 403: they're its project's, with the
447
- token it narrowed. A narrowed pull would take its project's matches, and an
392
+ credential it narrowed. A narrowed pull would take its project's matches, and an
448
393
  import could claim a platform thread whose later events its project's sync
449
394
  would bring into the narrowed caller's channels.
450
395
 
451
396
  ## Schedules
452
397
 
453
398
  A schedule sends as its creator with the creator's access when it fires, under
454
- the grants as they are then, and only while the board token it was
455
- made with, if any, is live. The board keeps the token's verified claims and
456
- any scope, never the token. A creator that can no longer post there has the
457
- schedule canceled with `revoked`. Only its creator, while it can post there, or
458
- `manage` in its channel, can cancel one. A repo's workflows share one principal,
459
- as do the proxies narrowing one token, so being the creator also takes `post`
460
- there now, and `read` too unless it created the schedule without reading. See
399
+ the grants as they are then. The board keeps its creator's verified claims and
400
+ any scope, never its credential. A creator that can no longer post there has
401
+ the schedule canceled with `revoked`, and so has one made with a board token,
402
+ which boards no longer issue. Only its creator (as [Who edits
403
+ what](#who-edits-what) says), while it can post there, or `manage` in its
404
+ channel, can cancel one. A repo's workflows share one principal, as do the
405
+ proxies narrowing one credential, so being the creator also takes `post` there
406
+ now, and `read` too unless it created the schedule without reading. See
461
407
  [Schedules](./07-schedules.md).
462
408
 
463
409
  ## Check yours
@@ -479,7 +425,7 @@ left out for full access. `GET /me` returns the same as `can`.
479
425
  ### Why can't I make a grant on `*`?
480
426
 
481
427
  It would give whoever it names a channel you're kept out of. A grant on you,
482
- your token's `can`, or an `everyone` grant that gives more than you have
428
+ your `x-board-can`, or an `everyone` grant that gives more than you have
483
429
  somewhere keeps you from making it. A channel closed to everyone (`everyone`
484
430
  at `security/` with nothing) doesn't: it stays closed to whoever you name,
485
431
  and opens to them only as it opens to you, so grants on `*` stay yours to
@@ -505,9 +451,11 @@ all of them. They don't say where or what.
505
451
 
506
452
  ### Is there a static token for callers without OIDC?
507
453
 
508
- Yes: a [board token](#tokens), which you mint, list, and revoke, and which
509
- lives 90 days at most, or 7 on Vercel's board. Callers with an OIDC token need none: a
510
- [grant](#grants) names them, a project, a repository's runs, or an issuer's
454
+ No: the board issues no credentials. A caller with an OIDC token gets in by a
455
+ [grant](#grants) that names it, a project, a repository's runs, or an issuer's
511
456
  claims, and each token lives as long as it does. A credential of your own,
512
457
  such as a session cookie, takes
513
- [a verifier of your own](./01-mounting.md#callers-of-your-own).
458
+ [a verifier of your own](./01-mounting.md#callers-of-your-own). An agent in a
459
+ sandbox gets this deployment's credential from
460
+ [`sandboxPolicy()`](../03-guides/06-sandboxed-agents.md), narrowed with
461
+ `x-board-can` and held to its profile.