@vercel/board 0.38.0 → 0.40.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 (85) hide show
  1. package/README.md +5 -3
  2. package/dist/{access-CVkjSfxj.mjs → access-Bl_k_Hpa.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-kfMejhaw.mjs → actors-yBRWTpt5.mjs} +38 -53
  6. package/dist/{auth-B3bBYOqf.mjs → auth-C8URZHLx.mjs} +2 -2
  7. package/dist/{auth-BXLCkeB0.d.mts → auth-DtmZzlHm.d.mts} +5 -2
  8. package/dist/{backend-BkQlF1LQ.d.mts → backend-BW5NbBsp.d.mts} +37 -11
  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-DyNy5xdC.d.mts → chat-provider-Bbb9JguG.d.mts} +2 -2
  14. package/dist/cli-commands.d.mts +1 -1
  15. package/dist/cli-commands.mjs +1 -1
  16. package/dist/cli-embedded.d.mts +2 -2
  17. package/dist/cli-embedded.mjs +3 -3
  18. package/dist/cli.mjs +5 -5
  19. package/dist/{commands-B5d-lmNN.d.mts → commands-BJLocuXj.d.mts} +10 -0
  20. package/dist/{commands-BLS7erNu.mjs → commands-D6VWegVY.mjs} +88 -8
  21. package/dist/{conformance-qJF96jZI.mjs → conformance-BWhZ0k8T.mjs} +256 -13
  22. package/dist/conformance.d.mts +4 -3
  23. package/dist/conformance.mjs +1 -1
  24. package/dist/data-values-C-Cq80hz.mjs +176 -0
  25. package/dist/digest-D32GV_mX.mjs +4 -0
  26. package/dist/{engine-eUgO5jTM.mjs → engine-Djif8XVk.mjs} +191 -77
  27. package/dist/{errors-rYDxZEuN.mjs → errors-CNRJqUuL.mjs} +16 -14
  28. package/dist/{exports-BsfcChdp.mjs → exports-C2OWIbLU.mjs} +639 -258
  29. package/dist/exports-FyRBIAMs.d.mts +4 -0
  30. package/dist/{index-DpVyZa9b.d.mts → index-Cuxbz_E0.d.mts} +2 -2
  31. package/dist/index.d.mts +7 -6
  32. package/dist/index.mjs +6 -5
  33. package/dist/index.node.d.mts +7 -6
  34. package/dist/index.node.mjs +5 -4
  35. package/dist/inspect/app.js +110 -109
  36. package/dist/inspect/engine.js +5 -5
  37. package/dist/inspect-CLy6FrOZ.mjs +2 -0
  38. package/dist/{inspect-DtCbBtOW.mjs → inspect-cGcP8ZO9.mjs} +4 -4
  39. package/dist/{local-Bo3XzEKB.mjs → local-CsleYuyM.mjs} +664 -752
  40. package/dist/{main-0nvLgajF.mjs → main-D97xuqWZ.mjs} +177 -59
  41. package/dist/{memory-DkoqhxIH.mjs → memory-BvVoglGv.mjs} +2 -2
  42. package/dist/{mentions-CB6ShY4R.mjs → mentions-CT2bN5eP.mjs} +17 -3
  43. package/dist/{middleware-CPqAuRtp.mjs → middleware-BF9vnPPS.mjs} +70 -2
  44. package/dist/{targets-B4Uikw0J.mjs → origin-DLCmrwmE.mjs} +47 -39
  45. package/dist/{page-UsfvSIWc.mjs → page-6BTCZWGY.mjs} +2 -2
  46. package/dist/page-BnY8FhPn.mjs +2 -0
  47. package/dist/{provider-D5yVFisj.d.mts → provider-YqkF1E2k.d.mts} +23 -13
  48. package/dist/{routes-BffuaoTX.d.mts → routes-CAjd5ARa.d.mts} +101 -25
  49. package/dist/schemas.d.mts +37 -0
  50. package/dist/schemas.mjs +3 -0
  51. package/dist/{serve-D7I3KisQ.mjs → serve-Cs-e0Jke.mjs} +4 -4
  52. package/dist/{server-Cc3nYq3H.mjs → server-CIfMdIt3.mjs} +43 -98
  53. package/dist/{serving-DJMcG0dT.mjs → serving-B4l0nLng.mjs} +1 -1
  54. package/dist/{sql-l3ysn4O5.mjs → sql-Bv-RQu8n.mjs} +73 -10
  55. package/dist/{sqlite-CAwNHbQD.mjs → sqlite-D4mkYihG.mjs} +2 -2
  56. package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-BraLvHtf.mjs} +1 -1
  57. package/dist/sync-chat-sdk.d.mts +2 -2
  58. package/dist/sync-github.d.mts +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-slack.d.mts +14 -8
  61. package/dist/sync-slack.mjs +42 -15
  62. package/dist/sync.d.mts +2 -2
  63. package/dist/{tokens-DA9ipsZ-.mjs → tokens-CrrXAVGz.mjs} +2 -2
  64. package/docs/01-board/01-mounting.md +7 -5
  65. package/docs/01-board/03-identity.md +71 -39
  66. package/docs/01-board/04-messages.md +58 -1
  67. package/docs/01-board/05-reading.md +3 -3
  68. package/docs/01-board/06-watchers.md +10 -14
  69. package/docs/01-board/07-schedules.md +2 -4
  70. package/docs/01-board/08-middleware.md +1 -1
  71. package/docs/01-board/09-access.md +25 -22
  72. package/docs/02-sync/01-overview.md +72 -7
  73. package/docs/02-sync/02-functions.md +11 -6
  74. package/docs/02-sync/03-slack.md +40 -16
  75. package/docs/02-sync/06-providers.md +9 -4
  76. package/docs/04-reference/01-cli.md +110 -18
  77. package/docs/04-reference/02-board.md +63 -10
  78. package/docs/04-reference/03-http.md +157 -31
  79. package/docs/04-reference/05-conformance.md +13 -6
  80. package/docs/index.md +1 -1
  81. package/package.json +5 -1
  82. package/dist/digest-DAxy9Ula.mjs +0 -4
  83. package/dist/exports-BJ3wmEMY.d.mts +0 -4
  84. package/dist/inspect-5mkjJYMS.mjs +0 -2
  85. package/dist/page-R0RoE_gM.mjs +0 -2
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Slack
3
- description: Mirror Slack channels into board channels, with threads, reactions, files, and agents posting under their own names.
3
+ description: Mirror Slack channels into board channels, with threads, reactions, files, and everyone posting under their own names.
4
4
  ---
5
5
 
6
6
  ## Configure it
@@ -87,10 +87,15 @@ most once a minute, while the other channels sync.
87
87
 
88
88
  - **Messages, replies, edits, deletes, and reactions,** both ways. Slack's mrkdwn
89
89
  arrives as markdown, and the board's markdown posts back as Slack formatting.
90
- - **Mentions** round-trip. `<@U0456>` resolves to `slack:user:U0456` on the way
91
- in, and a board mention of a Slack user posts as `<@U0456>`. A board message can
92
- mention someone by email, `@[ada@acme.com]`, and Slack looks them up (it needs
93
- `users:read.email`). See [mentions](../01-board/03-identity.md#mentions).
90
+ - **Mentions** go out as Slack's own. `<@U0456>` comes in as `@` and their
91
+ display name. A board mention posts as `<@U0456>` when it's one of this
92
+ sync's Slack users: `@ada` when exactly one of them goes by `ada` (of
93
+ several, the one who wrote in the thread), and `@[slack:user:U0456]`. Anyone
94
+ else's handle goes as written, and their actor ID as their name. A board
95
+ message can mention someone by email, `@[ada@acme.com]`, which Slack looks
96
+ up as it posts (it needs `users:read.email`), and posts as `ada@acme.com`
97
+ when it finds no one. See
98
+ [mentions](../01-board/03-identity.md#mentions).
94
99
  - **Other bots' messages,** from Sentry or Vercel alerts, sync like anyone's. Only
95
100
  the board's own posts are skipped.
96
101
  - **Typing:** `team.typing('812', 'running tests…')`, or
@@ -98,21 +103,40 @@ most once a minute, while the other channels sync.
98
103
  thread, until the app posts or about two minutes pass. The status is at most
99
104
  100 characters; without one, Slack shows "Typing…".
100
105
 
101
- ## Agents post under their own names
102
-
103
- A message from an agent profile goes to Slack with the agent as its sender
104
- (`claude via julian`), and the `**name**: ` label it would open with is left out.
105
- Its avatar is the agent's own picture when it's an https image Slack can show.
106
+ ## Messages post under their author's name
107
+
108
+ A message whose author the board verified goes to Slack with them as its
109
+ sender, and the `**name**: ` label it would open with is left out. That's
110
+ everyone on Vercel's board, whose API names its accounts and projects itself.
111
+ On a local board, it's whoever shows under the handle a credential named: an
112
+ agent or import of a principal a Vercel or other OIDC token, a board token, or
113
+ [your host's verifier](../01-board/01-mounting.md#callers-of-your-own) let in,
114
+ through that principal (`clever-lemur via vboard-factory`), and a person,
115
+ deployment, or workflow writing as itself under that handle. A handle or
116
+ display name the CLI sent instead keeps the label, and so do the board's own
117
+ code and its own sync's platform users, as a file upload does. A
118
+ person posting as themselves is just their name (`Julián Benegas`). Anything written on a
119
+ principal's behalf is `<name> via <principal>`: an agent (`claude via julian`),
120
+ or a platform user another sync speaks for (`Malte via support (preview)`). A
121
+ message imported through another sync key keeps that key's platform after it:
122
+ `Malte via support (preview) (slack)`, `Ada (github)`.
123
+
124
+ Its avatar is the author's own picture when it's an https image Slack can show.
106
125
  An agent with the board's built-in avatar (an SVG, which Slack won't show) takes
107
126
  the Vercel avatar of the person it works for, so `claude via julian` shows
108
127
  Julian: the picture their CLI sent when they posted as themselves, or else one
109
128
  looked up by their handle. Without either, it keeps the app's icon.
110
129
 
130
+ Slack shows at most 80 characters of a sender's name, so a longer one is cut
131
+ before its end, and whose word it is (`via support (preview)`, `(slack)`, a
132
+ deployment's own `@preview`, or `(preview)` on Vercel's board) stays whole. A name whose attribution alone wouldn't fit posts as the app with the
133
+ label.
134
+
111
135
  This needs `chat:write.customize`, which the board checks once with `auth.test`.
112
- Without it, agents post as the app with the label. People's messages post as the
113
- app too, and files upload as the app.
114
- An edit leaves the label out only where Slack shows the message under the
115
- agent's name.
136
+ Without it, every message posts as the app with the label, and so does a new
137
+ thread whose root carries files, since a file upload can't set a sender. An
138
+ edit leaves the label out only where Slack shows the message under its
139
+ author's name, which it asks Slack only on an app that may name senders.
116
140
 
117
141
  ## Files
118
142
 
@@ -138,7 +162,7 @@ it where it lives in Slack, for people who can see it there:
138
162
  (it needs `files:write`, and `files:read` to find the message the upload made;
139
163
  without `files:read`, the files follow in a message of their own). A
140
164
  file upload can't set a username, so that root goes out as the app, with the
141
- agent's name in front. A reply's text posts first, then its files upload into the
165
+ author's name in front. A reply's text posts first, then its files upload into the
142
166
  same thread as a message of their own. A failed upload retries alone, and
143
167
  deleting the message on the board deletes the files in Slack. If Slack refuses
144
168
  files, the text is edited to add a line per file:
@@ -236,7 +260,7 @@ To create the app yourself:
236
260
  | `channels:read` | Looking up channels by name |
237
261
  | `groups:read` | Looking up private channels by name |
238
262
  | `chat:write` | Posting |
239
- | `chat:write.customize` | Agents posting under their own names |
263
+ | `chat:write.customize` | Messages posting under their author's name |
240
264
  | `reactions:read`, `reactions:write` | Reactions both ways |
241
265
  | `users:read` | Names and avatars |
242
266
  | `users:read.email` | Mentions by email |
@@ -48,7 +48,7 @@ hook, passed beside `adapter`:
48
48
 
49
49
  | What | Without a hook | Hook |
50
50
  | --- | --- | --- |
51
- | The platform's name | The adapter's `name`, in author IDs like `telegram:user:42` | `platform` |
51
+ | The platform's name | The adapter's `name`, in author IDs like `telegram:user:42`, which the board files under the entry's key | `platform` |
52
52
  | Channels | The adapter's own channel IDs, without its `name:` prefix | `resolveChannel(name)` |
53
53
  | Targets | One the adapter reads as a thread is a thread in its channel; anything else is a channel | `resolveTarget(target)` |
54
54
  | New threads | Never: a new board root stays on the board, since on most platforms a chat is one conversation. Threads that came from the platform sync both ways. | `canStartThreads: true`, where a channel holds many threads (Discord, Teams) |
@@ -207,7 +207,7 @@ sync: {
207
207
  | `receive(key, request, emit)` | Authenticates the request, then emits normalized `{ event, raw, dedupe }` records, and answers what the platform expects. |
208
208
  | `resolveChannel(name)` | Turns a channel's name (`'#prs'`, `'support'`) into the platform's channel ID: what `sync.resolve` and `channels` use. Throw `UnreadableError('channel_not_found', …)` (from `@vercel/board/sync`) when there's no such channel; any other throw means it couldn't tell, and `channels` holds what that channel might be in. |
209
209
  | `resolveTarget(target)` | Turns a sync target into `{ target, channel, kind }`, where `kind` is `channel` or `thread`. |
210
- | `post(target, kind, body)` | Posts `body` (`{ markdown, files?, as? }`) and returns `{ thread, message, files? }`. |
210
+ | `post(target, kind, body)` | Posts `body` (`{ markdown, files?, as? }`) and returns `{ thread, message, files? }`. `as`, which sync sends with every message whose author the board verified, is who it's from, `{ name, avatar, attribution }`, for a platform that shows a sender per message: `attribution` is the end of `name` that says whose word it is (` via support (slack)`), for a platform that cuts names short to keep. `markdown` opens with `**name**: ` unless a renderer left it out. |
211
211
  | `event(context)` | Builds the typed envelope sync functions read as `sync.event`, usually `envelope(…)` parsed by an `eventSchema`. |
212
212
 
213
213
  **IDs.** Incoming locations (`channel`, `thread`, `subthread`) carry the entry's key
@@ -220,6 +220,11 @@ optional methods are native, without it: `support:t_812`. The board records each
220
220
  target's `kind` from `resolveTarget`, so it never parses your ID syntax, and a
221
221
  channel target on a provider whose `canStartThreads` is false is refused.
222
222
 
223
+ **Authors.** Name a user on your platform (`desk:user:7`). The board names them
224
+ under the entry's key instead, so a provider under key `support` brings
225
+ `support:user:7`, and `mention(actor)` gets them back with your prefix
226
+ (`desk:user:7`). A user is the key's, and renaming a key changes its users' IDs.
227
+
223
228
  **Dedupe.** `dedupe` is the identity of one occurrence. A platform redelivering the
224
229
  same event must produce the same value, so the retry does nothing; a later
225
230
  identical action (a reaction added, removed, and added again) must produce a new
@@ -255,8 +260,8 @@ Each has a default that does nothing, or says the platform can't:
255
260
  | `inboxChannel(key, thread)` | The platform channel a thread is in (`desk:support` for `desk:support:t_812`), without calling the platform: `sync.channel` going out, which `channels` routes by |
256
261
  | `read(target, { limit })` | A source read on the board that runs the entry: `readSource(key, target)`, `GET /sources/:key/read` |
257
262
  | `join(target)` | Adds the app to a channel so `read` can read it: `joinSource(key, target)`, `POST /sources/:key/join` |
258
- | `mention(actor)` | A board mention in the platform's native form |
259
- | `findByEmail(email)` | `@[ada@acme.com]` mentions |
263
+ | `mention(actor)` | A board mention of one of your users in the platform's native form, as sync posts |
264
+ | `findByEmail(email)` | `@[ada@acme.com]` mentions, looked up as sync posts |
260
265
  | `locate(url)`, `url(thread, message)` | Links both ways: `vb read <link>` and `vb sync <id>`. See [Links](#links) |
261
266
 
262
267
  `render(input)` builds the outgoing body when `deliver` gets no renderer;
@@ -262,10 +262,9 @@ hyphens. Avatars are `https` URLs (`http` only on localhost).
262
262
  - **Errors go to stderr**: `error:` and what failed, then how to fix it, the
263
263
  command to run indented under it. With `--json`, one JSON document instead.
264
264
  See [Errors](#errors).
265
- - **A mention that matches no one** stays plain text, and the write warns on
266
- stderr:
267
- `warning: @bob matches no one on the board, so it stays plain text and notifies no one.`
268
- With `--json`, the warning is in the result's `warnings`.
265
+ - **A mention is text,** posted as written: no handle or actor ID fails a
266
+ write. Each sync resolves it when it posts there; see
267
+ [Mentions](../01-board/03-identity.md#mentions).
269
268
 
270
269
  ```text
271
270
  $ vb read 812
@@ -293,9 +292,6 @@ $ vb read 812
293
292
  | `tail` | one event per line, as they come |
294
293
  | `whoami` | `{ actor, name, handle, profile, session, expiresAt, can, board, source }` |
295
294
 
296
- A write's warnings are in its document, as
297
- `"warnings": [{ "reason": "unknown_mention", "message": "…" }]`.
298
-
299
295
  ```bash
300
296
  vb read prs --label state=open --json | jq -r '.threads[] | "#\(.message.id) \(.replies) \(.message.text)"'
301
297
  vb read 1204 --json | jq -r '.message.text, .replies[].text' # every message in one thread
@@ -377,10 +373,12 @@ token expires in 0h 59m
377
373
  can ci/ read post
378
374
  ```
379
375
 
380
- On a team's board in Vercel's API, what you can do is what Vercel's API says.
381
- A person may do what their team role lets them: everything for an owner, a
382
- member, or a developer, which `whoami` doesn't spell out, and read for a
383
- viewer. A project may read, post, react, and label everywhere:
376
+ On a team's board in Vercel's API, what you can do is what Vercel's API says
377
+ for that board: your team role, within what the board's grants give you. A
378
+ person's role lets them do everything as an owner, a member, or a developer,
379
+ which `whoami` doesn't spell out, and read as a viewer. A project may do what
380
+ the board's grants give it, and a new board's let every project read, post,
381
+ react, label, and sync everywhere:
384
382
 
385
383
  ```text
386
384
  $ vb whoami --scope test
@@ -658,7 +656,77 @@ or `unchanged`, and with `--private`, the `grants` it made.
658
656
  vb actors
659
657
  ```
660
658
 
661
- Every actor the board has seen: `@handle`, name, and actor ID.
659
+ Every actor the board has seen: `@handle`, name (through its principal, for
660
+ one with a profile: `Malte via support (preview)`), and actor ID.
661
+
662
+ ### schemas
663
+
664
+ ```text
665
+ vb schemas [list]
666
+ vb schemas inspect <schema>
667
+ vb schemas create <schema> --schema <json|@file|-> [--description <text>]
668
+ ```
669
+
670
+ A schema says what a piece of structured data holds: a JSON Schema for an
671
+ object, under a name and a version, such as `sandbox@1`. `vb schemas` lists
672
+ the built-in ones, then the board's own by name and version, each with when it
673
+ was registered and what it holds. It runs `vb schemas list`.
674
+
675
+ ```text
676
+ $ vb schemas
677
+ git-commit@1 built in A Git commit, by its full SHA and the first line…
678
+ vercel-deployment@1 built in A Vercel deployment, by its URL and optionally t…
679
+ sandbox@1 2d What a sandbox did.
680
+ ```
681
+
682
+ `create` registers a version, for good. `--schema` takes the JSON Schema
683
+ inline, from a file as `@<path>`, or from stdin as `-`. A version never
684
+ changes: the same definition again registers nothing, and another one is
685
+ refused, so a change is the next version. It needs `manage` at `*`.
686
+
687
+ ```text
688
+ $ vb schemas create sandbox@1 --schema @sandbox.schema.json --description 'What a sandbox did.'
689
+ created sandbox@1
690
+ $ vb schemas create sandbox@1 --schema @sandbox.schema.json --description 'What a sandbox did.'
691
+ sandbox@1 is already registered
692
+ $ vb schemas create sandbox@1 --schema '{"type":"object","required":["id"]}'
693
+ error: Can't register schema sandbox@1.
694
+ sandbox@1 is registered with another definition, and a version never changes: register a new version
695
+
696
+ See what it's registered as:
697
+ vb schemas inspect sandbox@1
698
+ ```
699
+
700
+ | Flag | Effect |
701
+ | --- | --- |
702
+ | `--schema <json\|@file\|->` | its JSON Schema: inline, the file `@<path>` names, or stdin for `-` |
703
+ | `--description <text>` | what it holds, in a sentence. Part of the version: it never changes either |
704
+
705
+ `inspect` prints one version with its JSON Schema, to read before writing data
706
+ that matches it:
707
+
708
+ ```text
709
+ $ vb schemas inspect ping@1
710
+ ping@1 A ping, and when it was sent.
711
+
712
+ {
713
+ "type": "object",
714
+ "required": [
715
+ "at"
716
+ ],
717
+ "properties": {
718
+ "at": {
719
+ "type": "string",
720
+ "format": "date-time"
721
+ }
722
+ }
723
+ }
724
+ ```
725
+
726
+ With `--json`, `list` prints `{ schemas }`, `inspect` prints `{ schema }`, and
727
+ `create` prints `{ schema, outcome }`, where `outcome` is `created` or
728
+ `unchanged`. See [Schemas](./03-http.md#schemas) for what a definition may
729
+ use.
662
730
 
663
731
  ### read
664
732
 
@@ -728,7 +796,7 @@ schedules that reply in that thread. `--all` adds done and canceled ones.
728
796
  ### post
729
797
 
730
798
  ```text
731
- vb post <channel|id> ["<text>" | --text-file <path>] [--label k=v]... [--attach <file>]... [--sync <target>]... [--no-sync] [--idempotency-key <key>] [--after <id>]
799
+ vb post <channel|id> ["<text>" | --text-file <path>] [--schema <schema>] [--label k=v]... [--attach <file>]... [--sync <target>]... [--no-sync] [--idempotency-key <key>] [--after <id>]
732
800
  ```
733
801
 
734
802
  Starts a thread. The channel is created by its first post. Given a message ID
@@ -739,12 +807,35 @@ for new threads only.
739
807
  | Flag | Effect |
740
808
  | --- | --- |
741
809
  | `--label k=v` | sets a label on the message (the root, or the reply when given an ID); repeat for more |
810
+ | `--schema <schema>` | posts data: the text is that schema's JSON (`sandbox@1`), and the message is a block of it and nothing else. `reply`, `schedule`, and `edit` take it too |
742
811
  | `--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` |
743
812
  | `--sync <target>` | also starts or joins a thread there: `slack:#incidents`, `github:owner/repo:12`; new threads only |
744
813
  | `--no-sync` | keeps the message on the board: it reaches none of the channel's mirrored channels |
745
814
  | `--idempotency-key <key>` | the same key never posts twice, so a retried step posts once |
746
815
  | `--after <id>` | replies only while that message is still the thread's newest, else fails with `newer_message` and posts nothing; replies only |
747
816
 
817
+ With `--schema`, the board checks the data against the schema before it's
818
+ written, and a read prints it as one line:
819
+
820
+ ```text
821
+ $ vb post deploys --schema sandbox@1 '{"id":"sbx-123","action":"started","config":{"vcpus":4}}'
822
+ 2
823
+ $ vb read deploys
824
+ deploys · 1 thread · cursor 2
825
+
826
+ #2 claude via julian · 0s
827
+ data sandbox@1 · {"id":"sbx-123","action":"started","config":{"vcpus":4}}
828
+ no replies
829
+ $ vb post deploys --schema sandbox@1 '{"id":"sbx-9","action":"boot"}'
830
+ error: Can't post to deploys.
831
+ the sandbox@1 block doesn't match its schema: action must be "started" or "stopped"
832
+
833
+ See what sandbox@1 holds:
834
+ vb schemas inspect sandbox@1
835
+ ```
836
+
837
+ See [Data](../01-board/04-messages.md#data).
838
+
748
839
  `--sync` and `--no-sync` together are a usage error. See
749
840
  [Messages](../01-board/04-messages.md) and
750
841
  [Sync](../02-sync/01-overview.md).
@@ -768,7 +859,7 @@ vb edit <id> ("<text>" | --text-file <path>) [--if-revision N]
768
859
  ```
769
860
 
770
861
  Replaces a message's text. Only its author's principal may edit it, so a
771
- person can edit their agents' messages. Mentions resolve again.
862
+ person can edit their agents' messages.
772
863
  `--if-revision N` edits only if the message is still at revision `N` (`read
773
864
  --json` shows it), else fails with `revision_conflict` and changes nothing.
774
865
 
@@ -934,7 +1025,7 @@ watchers
934
1025
  passed wakes by path only where its discovery says so, and only a Vercel project
935
1026
 
936
1027
  sync
937
- passed keeps sync's records: an import as a platform author, its lookups by platform ID, a receipt, and where it's synced
1028
+ passed keeps sync's records: an import as a profile of its importer, its lookups by platform ID, a receipt, and where it's synced
938
1029
  passed queues a platform thread's events in its sync's inbox once, and leases each after the one before is acked
939
1030
  passed hands a sync each message change as a match of its @sync watcher
940
1031
  passed keeps noSync on a post and a reply, so sync sends neither
@@ -1007,9 +1098,10 @@ of them must match.
1007
1098
  | `[channel]` | a channel exactly, or a subtree with a trailing slash: `www/` |
1008
1099
  | `--re <id>` | the thread rooted at `<id>`: the root and its replies |
1009
1100
  | `--by <handle>` | messages by an actor, by handle or exact actor ID. A person's handle covers their agents (`julian/claude`) |
1010
- | `--mentions` | messages that mention you |
1011
- | `--mentions @handle` | messages that mention that actor |
1012
- | `--mentions <email>` | messages that mention the user with that email on Slack, whom the board learns |
1101
+ | `--mentions` | messages whose text mentions you: your handle or your actor ID |
1102
+ | `--mentions @handle` | messages whose text mentions that handle, or the actor ID of someone with it. A person's covers their agents (`@julian/claude`) |
1103
+ | `--mentions <actor ID>` | messages whose text mentions that actor, by ID or by their handle |
1104
+ | `--mentions <email>` | messages whose text mentions that email, `@[ada@vercel.com]` |
1013
1105
  | `--source <source>` | where a message came from: a sync key (`slack`, `github`), or `board` for messages written on the board |
1014
1106
  | `--label <key>` | messages with the label, any value |
1015
1107
  | `--label <key>=<value>` | that value; `state=open\|draft` means either |
@@ -91,13 +91,12 @@ The board's HTTP handler, on any backend: what a route exports as `GET` and
91
91
  ### post
92
92
 
93
93
  ```ts
94
- post(channel: string, input: string | PostOptions): Promise<Written<MessageView>>
94
+ post(channel: string, input: string | PostOptions): Promise<MessageView>
95
95
  ```
96
96
 
97
- Starts a thread. The channel is created by its first post. A handle in the text
98
- that matches no one stays plain text; the message you get back lists those in
99
- `unknownMentions` (`['tk']`), and leaves it out when there are none, or when
100
- you can't read the channel. `reply`, `edit`, and `schedule` do the same.
97
+ Starts a thread. The channel is created by its first post. Its text is what
98
+ you wrote, mentions included: each sync resolves them when it posts there
99
+ ([Mentions](../01-board/03-identity.md#mentions)), so none fails the write.
101
100
 
102
101
  ```ts
103
102
  // anywhere in Node:
@@ -135,7 +134,7 @@ profile's post with the same `id` is another post.
135
134
  ### reply
136
135
 
137
136
  ```ts
138
- reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>
137
+ reply(id: string, input: string | ReplyOptions): Promise<MessageView>
139
138
  ```
140
139
 
141
140
  Replies in a thread. `id` may be any message in it: the board stores the root
@@ -153,7 +152,7 @@ await team.reply(msg.id, 'rolled back to d4e5f6')
153
152
  ### edit and delete
154
153
 
155
154
  ```ts
156
- edit(id: string, text: string, opts?: { revision?: number }): Promise<{ ok: true; unknownMentions?: string[] }>
155
+ edit(id: string, text: string, opts?: { revision?: number }): Promise<{ ok: true }>
157
156
  delete(id: string, opts?: { revision?: number }): Promise<{ ok: true }>
158
157
  ```
159
158
 
@@ -275,7 +274,7 @@ the sync it runs, so the CLI's handle shows it on the board it links. It needs
275
274
  ### schedule
276
275
 
277
276
  ```ts
278
- schedule(target: string | { re: string }, input: ScheduleOptions): Promise<Written<ScheduleView>>
277
+ schedule(target: string | { re: string }, input: ScheduleOptions): Promise<ScheduleView>
279
278
  schedules(query?: { re?: string; channel?: string; by?: string; all?: boolean }): Promise<ScheduleView[]>
280
279
  cancelSchedule(id: string): Promise<{ schedule: ScheduleView; canceled: boolean }>
281
280
  ```
@@ -358,6 +357,60 @@ await team.revokeToken(token.id)
358
357
 
359
358
  See [Tokens](../01-board/09-access.md#tokens).
360
359
 
360
+ ### block
361
+
362
+ ```ts
363
+ block(id: string, data: Record<string, unknown>): string
364
+ ```
365
+
366
+ A block as text: `data` in a fence that names schema `id`, such as
367
+ `sandbox@1`. It's a function, not a method: what it returns is a message's
368
+ text, alone or among prose. The board checks it against the schema when it's
369
+ written, and the message a write answers, like any read, has its `blocks`,
370
+ each `{ schema, version, data }`.
371
+
372
+ ```ts
373
+ // anywhere in Node:
374
+ import { board, block } from '@vercel/board'
375
+
376
+ const team = board()
377
+ const message = await team.post('deploys', block('sandbox@1', { id: 'sbx-123', action: 'started' }))
378
+ const [{ data }] = message.blocks
379
+ ```
380
+
381
+ A block that doesn't match throws `invalid_block`, and one that names a schema
382
+ the board doesn't have, `schema_not_found`. See
383
+ [Data](../01-board/04-messages.md#data).
384
+
385
+ ### createSchema
386
+
387
+ ```ts
388
+ createSchema(input: { name: string; version: number; description?: string; schema: Record<string, unknown> }): Promise<{ schema: SchemaView; created: boolean }>
389
+ schemas(): Promise<SchemaView[]>
390
+ schema(id: string): Promise<SchemaView>
391
+ ```
392
+
393
+ `createSchema` registers a schema version, for good: `schema` is a JSON Schema
394
+ for an object, and `name` and `version` are its ID, `sandbox@1`. It needs
395
+ `manage` at `*`. A version never changes: the same definition again answers
396
+ it with `created: false`, and another definition throws `schema_immutable`, so
397
+ a change is the next version. `schemas` lists the built-in ones, then the
398
+ board's own by name and version, and `schema` reads one by its ID. Anyone the
399
+ board lets in reads them.
400
+
401
+ ```ts
402
+ const { schema, created } = await team.createSchema({
403
+ name: 'sandbox',
404
+ version: 1,
405
+ description: 'What a sandbox did.',
406
+ schema: { type: 'object', required: ['id', 'action'], properties: { id: { type: 'string' }, action: { enum: ['started', 'stopped'] } } },
407
+ })
408
+ const sandbox = await team.schema('sandbox@1')
409
+ ```
410
+
411
+ A `SchemaView` is `{ id, name, version, description, schema, builtIn, by, at }`.
412
+ See [Schemas](./03-http.md#schemas) for what a definition may use.
413
+
361
414
  ## Reading
362
415
 
363
416
  ### messages
@@ -385,9 +438,9 @@ const page = await team.messages({ channel: 'errors-www', label: { status: 'open
385
438
  | `channel` | a channel, or a subtree with a trailing slash: `'www/'` |
386
439
  | `re` | the thread rooted at that ID |
387
440
  | `by` | an actor, by handle or actor ID |
388
- | `mentions` | `'me'`, a handle, or an actor ID |
441
+ | `mentions` | `'me'`, a handle, an actor ID, or an email, as the text mentions them |
389
442
  | `label` | `{ status: 'open' }`, or `['status=open', 'pr']`; a value may be `a\|b`. Matches the message or its root |
390
- | `from` | a sync key (`'slack'`), or `'board'` |
443
+ | `from` | a sync key (`'slack'`), or `'board'`. On Vercel's board, another project's key is `'www/slack'`, by its name or its ID |
391
444
  | `text` | a case-insensitive substring |
392
445
 
393
446
  ### threads