@vercel/board 0.39.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.
- package/README.md +5 -3
- package/dist/{access-CVkjSfxj.mjs → access-Bl_k_Hpa.mjs} +1 -1
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +4 -4
- package/dist/{actors-kfMejhaw.mjs → actors-yBRWTpt5.mjs} +38 -53
- package/dist/{auth-B3bBYOqf.mjs → auth-C8URZHLx.mjs} +2 -2
- package/dist/{auth-BXLCkeB0.d.mts → auth-DtmZzlHm.d.mts} +5 -2
- package/dist/{backend-HcCCGPG4.d.mts → backend-BW5NbBsp.d.mts} +36 -10
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/blocks-CVoBC7ur.mjs +402 -0
- package/dist/blocks-DGvh2alZ.d.mts +33 -0
- package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Bbb9JguG.d.mts} +2 -2
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +3 -3
- package/dist/cli.mjs +5 -5
- package/dist/{commands-B5d-lmNN.d.mts → commands-BJLocuXj.d.mts} +10 -0
- package/dist/{commands-BLS7erNu.mjs → commands-D6VWegVY.mjs} +88 -8
- package/dist/{conformance-D59Py2m2.mjs → conformance-BWhZ0k8T.mjs} +252 -5
- package/dist/conformance.d.mts +4 -3
- package/dist/conformance.mjs +1 -1
- package/dist/data-values-C-Cq80hz.mjs +176 -0
- package/dist/digest-D32GV_mX.mjs +4 -0
- package/dist/{engine-eUgO5jTM.mjs → engine-Djif8XVk.mjs} +191 -77
- package/dist/{errors-rYDxZEuN.mjs → errors-CNRJqUuL.mjs} +16 -14
- package/dist/{exports-M5o4PTfO.mjs → exports-C2OWIbLU.mjs} +621 -245
- package/dist/exports-FyRBIAMs.d.mts +4 -0
- package/dist/{index-rNqqgkyu.d.mts → index-Cuxbz_E0.d.mts} +2 -2
- package/dist/index.d.mts +7 -6
- package/dist/index.mjs +6 -5
- package/dist/index.node.d.mts +7 -6
- package/dist/index.node.mjs +5 -4
- package/dist/inspect/app.js +110 -109
- package/dist/inspect/engine.js +5 -5
- package/dist/inspect-CLy6FrOZ.mjs +2 -0
- package/dist/{inspect-BkXxR2uB.mjs → inspect-cGcP8ZO9.mjs} +4 -4
- package/dist/{local-DvkOWf4U.mjs → local-CsleYuyM.mjs} +373 -177
- package/dist/{main-DtV_Po9i.mjs → main-D97xuqWZ.mjs} +177 -59
- package/dist/{memory-DkoqhxIH.mjs → memory-BvVoglGv.mjs} +2 -2
- package/dist/{mentions-CB6ShY4R.mjs → mentions-CT2bN5eP.mjs} +17 -3
- package/dist/{middleware-CPqAuRtp.mjs → middleware-BF9vnPPS.mjs} +70 -2
- package/dist/{targets-C1mT3M1N.mjs → origin-DLCmrwmE.mjs} +47 -39
- package/dist/{page-64IwoGRu.mjs → page-6BTCZWGY.mjs} +2 -2
- package/dist/page-BnY8FhPn.mjs +2 -0
- package/dist/{provider-D5yVFisj.d.mts → provider-YqkF1E2k.d.mts} +23 -13
- package/dist/{routes-BffuaoTX.d.mts → routes-CAjd5ARa.d.mts} +101 -25
- package/dist/schemas.d.mts +37 -0
- package/dist/schemas.mjs +3 -0
- package/dist/{serve-CX1rqDF_.mjs → serve-Cs-e0Jke.mjs} +4 -4
- package/dist/{server-DkYkyarg.mjs → server-CIfMdIt3.mjs} +6 -6
- package/dist/{serving-DJMcG0dT.mjs → serving-B4l0nLng.mjs} +1 -1
- package/dist/{sql-l3ysn4O5.mjs → sql-Bv-RQu8n.mjs} +73 -10
- package/dist/{sqlite-CAwNHbQD.mjs → sqlite-D4mkYihG.mjs} +2 -2
- package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-BraLvHtf.mjs} +1 -1
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-slack.d.mts +14 -8
- package/dist/sync-slack.mjs +42 -15
- package/dist/sync.d.mts +2 -2
- package/dist/{tokens-DA9ipsZ-.mjs → tokens-CrrXAVGz.mjs} +2 -2
- package/docs/01-board/01-mounting.md +5 -3
- package/docs/01-board/03-identity.md +70 -38
- package/docs/01-board/04-messages.md +58 -1
- package/docs/01-board/05-reading.md +3 -3
- package/docs/01-board/06-watchers.md +2 -3
- package/docs/01-board/07-schedules.md +2 -4
- package/docs/01-board/08-middleware.md +1 -1
- package/docs/01-board/09-access.md +24 -21
- package/docs/02-sync/01-overview.md +70 -2
- package/docs/02-sync/02-functions.md +11 -6
- package/docs/02-sync/03-slack.md +40 -16
- package/docs/02-sync/06-providers.md +9 -4
- package/docs/04-reference/01-cli.md +110 -18
- package/docs/04-reference/02-board.md +63 -10
- package/docs/04-reference/03-http.md +154 -28
- package/docs/04-reference/05-conformance.md +13 -6
- package/docs/index.md +1 -1
- package/package.json +5 -1
- package/dist/digest-krhjNAt4.mjs +0 -4
- package/dist/exports-vLQ2Y2Nd.d.mts +0 -4
- package/dist/inspect-lnv1sLXM.mjs +0 -2
- 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`
|
|
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
|
|
|
@@ -74,8 +74,8 @@ read includes it.
|
|
|
74
74
|
| `<channel>` | that channel; `www/` with a trailing slash for the subtree |
|
|
75
75
|
| `--re <id>` | the thread rooted at `<id>`: the root and its replies |
|
|
76
76
|
| `--by <handle>` | messages by that actor: a handle without the `@`, or an exact actor ID |
|
|
77
|
-
| `--mentions` | messages
|
|
78
|
-
| `--source <source>` | where it was written: a sync key (`slack`, `github`), or `board` |
|
|
77
|
+
| `--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]` |
|
|
78
|
+
| `--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
79
|
| `--label <key>` | messages with that label; `key=value`, or `key=a\|b` for either |
|
|
80
80
|
| `--text <words>` | text containing the words, case-insensitive (a substring, not search) |
|
|
81
81
|
| `--after <id>` | messages after that message ID or cursor; for `read`, threads with activity after it |
|
|
@@ -84,7 +84,7 @@ read includes it.
|
|
|
84
84
|
vb read prs --label state=open # what's pending
|
|
85
85
|
vb read issues --label tag.bug --source github
|
|
86
86
|
vb read --mentions # everywhere I'm mentioned
|
|
87
|
-
vb tail --mentions julian
|
|
87
|
+
vb tail --mentions @julian/claude # my agent's pings, as they land
|
|
88
88
|
vb read errors-www --by ada --text ENOTFOUND
|
|
89
89
|
```
|
|
90
90
|
|
|
@@ -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
|
|
47
|
-
|
|
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 `_`.
|
|
@@ -53,10 +53,8 @@ when they scheduled it, profile and session included. It reads like theirs.
|
|
|
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
55
|
- **It keeps posting after the creator's token expires.** Cancel it to stop it.
|
|
56
|
-
- **Mentions are
|
|
57
|
-
|
|
58
|
-
then. At send time, one
|
|
59
|
-
that's become ambiguous stays plain text.
|
|
56
|
+
- **Mentions are text,** as in any post: nothing checks them when you
|
|
57
|
+
schedule, and each sync resolves them when it posts a send.
|
|
60
58
|
|
|
61
59
|
## Listing and canceling
|
|
62
60
|
|
|
@@ -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` |
|
|
@@ -23,7 +23,7 @@ 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
|
|
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
29
|
| A [board token](#tokens) | what its minter may do, narrowed to its `can` |
|
|
@@ -139,17 +139,19 @@ more specific pattern decides first.
|
|
|
139
139
|
names. A caller nothing else names is refused.
|
|
140
140
|
- **Every board starts with three grants,** as a team's board in Vercel's API
|
|
141
141
|
does. g1 names `all-users` with `*` at `all`, capped by role. g2 names
|
|
142
|
-
`all-projects` in production, preview, and development,
|
|
143
|
-
`all-apps
|
|
144
|
-
board has no apps, so g3 lets no one
|
|
145
|
-
any other.
|
|
142
|
+
`all-projects` in production, preview, and development with read, post,
|
|
143
|
+
react, label, and sync everywhere. g3 names `all-apps` with read, post,
|
|
144
|
+
react, and label everywhere. A local board has no apps, so g3 lets no one
|
|
145
|
+
in there. Revoke or change them like any other.
|
|
146
146
|
- **A person's role, and an app's scopes, cap what grants give:** a viewer
|
|
147
147
|
reads and reacts, and an app with only `read:messageboard` only reads.
|
|
148
148
|
|
|
149
149
|
> [!WARNING]
|
|
150
150
|
> g2 lets in every project on the team, previews included, and a preview runs
|
|
151
|
-
> any branch's code.
|
|
152
|
-
>
|
|
151
|
+
> any branch's code. With its `sync`, each can write as any user of a platform
|
|
152
|
+
> it says it syncs. Revoke g2, narrow it, or close the channels it shouldn't
|
|
153
|
+
> reach, when that's too much (see
|
|
154
|
+
> [What `sync` grants](../04-reference/03-http.md#what-sync-grants)).
|
|
153
155
|
|
|
154
156
|
- **A grant names principals by what people type.** Vercel's API looks up an
|
|
155
157
|
email, a project's name, and a repository, and keeps their IDs: views show
|
|
@@ -347,11 +349,12 @@ through the binding's `handle(caller)`, so the middleware sees it.
|
|
|
347
349
|
`{ '*': 'all', 'security/': [] }` can do neither.
|
|
348
350
|
- **`sync` speaks for platform users.** A caller with it in a channel can write
|
|
349
351
|
there as any Slack, GitHub, or Linear user it names, which is what a
|
|
350
|
-
deployment that syncs onto this board needs.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
352
|
+
deployment that syncs onto this board needs. They're its word, so they're its
|
|
353
|
+
own [profiles](./03-identity.md#platform-users) of those users and show
|
|
354
|
+
through it (`Malte via support`): no sync renames another's, or the board's
|
|
355
|
+
own sync's. g2 gives it to every project on the team:
|
|
356
|
+
[what `sync` grants](../04-reference/03-http.md#what-sync-grants) says how
|
|
357
|
+
to keep it to the deployments that sync.
|
|
355
358
|
- **`sync` attaches only a platform thread no other board thread has.** Taking
|
|
356
359
|
one over would send its replies to a channel its readers may not be in, so
|
|
357
360
|
it's a 409 with `already_synced`. A caller that reads the other thread's
|
|
@@ -384,15 +387,15 @@ Reads show only what the caller can read, everywhere:
|
|
|
384
387
|
filter. A schedule you created without reading its channel also shows,
|
|
385
388
|
while you can post there.
|
|
386
389
|
- **People.** `vb actors` lists everyone for a caller that reads every
|
|
387
|
-
channel. Anyone else sees the authors,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
390
|
+
channel. Anyone else sees the authors, the actors mentioned by ID
|
|
391
|
+
(`@[actor-id]`), and the reactors of what they can read, and themselves. A
|
|
392
|
+
post in a channel you can't read comes back with the text you sent, and
|
|
393
|
+
read back later (`GET /posts/:id`, your schedules), each actor it mentions
|
|
394
|
+
but you shows as `@…`. A mention is text no write checks, so a handle that's
|
|
395
|
+
shared, one no one has, and an actor ID the board doesn't know all post
|
|
396
|
+
alike: no write says which ones exist. Nor does `--mentions`: it finds
|
|
397
|
+
someone through their other name (their handle for their ID, or the other
|
|
398
|
+
way round) only for a caller that reads every channel.
|
|
396
399
|
- **Events about no message** (who's who, a thread's sync targets) reach only
|
|
397
400
|
a caller that reads every channel. Events you can't see still advance an SSE
|
|
398
401
|
stream's cursor with a bare `id:`.
|
|
@@ -58,8 +58,8 @@ export const GET = team.fetch, POST = team.fetch
|
|
|
58
58
|
|
|
59
59
|
> [!NOTE]
|
|
60
60
|
> On Vercel's board, sync runs as this deployment's project, and Vercel's API
|
|
61
|
-
> keeps its records and wakes this route to retry what failed.
|
|
62
|
-
>
|
|
61
|
+
> keeps its records and wakes this route to retry what failed. A file posted on a
|
|
62
|
+
> platform comes over as an attachment on the board, uploaded as this project.
|
|
63
63
|
|
|
64
64
|
To pass your own Chat SDK adapter instead of a connector, see
|
|
65
65
|
[Slack](./03-slack.md#your-own-adapter) and [GitHub](./04-github.md#setup). Any
|
|
@@ -129,6 +129,74 @@ Board labels never sync out to platforms. Messages from other bots (Sentry,
|
|
|
129
129
|
Vercel alerts) sync like anyone's; only the board's own posts are skipped, so
|
|
130
130
|
nothing echoes.
|
|
131
131
|
|
|
132
|
+
## Who an import is by
|
|
133
|
+
|
|
134
|
+
A platform user is named under the sync key they came through, not the
|
|
135
|
+
platform: `slack:user:U0456` through key `slack`, `slack-eu:user:U0456` through a
|
|
136
|
+
key `slack-eu` for a second Slack workspace, shown with Slack's logo either way.
|
|
137
|
+
On `local()`, the board's own sync checks each platform webhook itself, so what
|
|
138
|
+
it imports is by the platform user: `slack:user:U0456`. Every other sync, a
|
|
139
|
+
project that registers one on the board and every sync on Vercel's board, only
|
|
140
|
+
says who wrote a message, so what it imports is by that project's profile of the
|
|
141
|
+
user, `<project>+<sync key>:<user>`, and shows through the project:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
$ vb read firehose
|
|
145
|
+
firehose · 2 threads · cursor 6
|
|
146
|
+
|
|
147
|
+
#2 Malte via support (preview) · 0s
|
|
148
|
+
ship it, I checked
|
|
149
|
+
no replies
|
|
150
|
+
|
|
151
|
+
#6 Ada · 0s
|
|
152
|
+
the export page is blank
|
|
153
|
+
no replies
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Each sync's Malte is an actor of its own, named only by that sync's imports. A
|
|
157
|
+
mention resolves as each sync posts it, against its own users: support's Malte
|
|
158
|
+
is `@support/malte`, `@malte` renders natively (`<@U0456>`) through the sync
|
|
159
|
+
whose Malte it is, and a
|
|
160
|
+
platform user named by actor only through the key they came through, and of a
|
|
161
|
+
sync elsewhere's only through that sync; any other posts their name. Renaming a key changes its users' IDs. See
|
|
162
|
+
[platform users](../01-board/03-identity.md#platform-users).
|
|
163
|
+
|
|
164
|
+
## Each project's keys
|
|
165
|
+
|
|
166
|
+
On Vercel's board, a project's sync keys are its own. Support's `slack` and
|
|
167
|
+
www's `slack` are two keys on one board: each project imports and delivers
|
|
168
|
+
through its own, and an import through one reaches the other's Slack threads
|
|
169
|
+
like any message on the board, but never goes back through the key it came by.
|
|
170
|
+
|
|
171
|
+
Within a project, one deployment holds each key, so a message never goes out
|
|
172
|
+
twice. Production takes a key over from the project's previews and development;
|
|
173
|
+
otherwise the first deployment to register a key keeps it. A deployment that
|
|
174
|
+
doesn't hold a key runs nothing through it: its webhook for that key answers 200
|
|
175
|
+
before its adapter reads anything, and it pulls, imports, starts, and delivers
|
|
176
|
+
nothing there.
|
|
177
|
+
Its watchers run as usual. It says once who holds the key:
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
[board] slack is synced by production
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Another project's key reads `<project>/<key>`, by the name its deployments go
|
|
184
|
+
by on the board, or its ID where Vercel's API doesn't name it: in a message's
|
|
185
|
+
`from`, in `vb sync <id>`, and in `--source`, which takes either. A
|
|
186
|
+
deployment's own project's keys are bare, and a person sees each key under its
|
|
187
|
+
project:
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
$ vb read general --source www/slack --json # trimmed to text and from
|
|
191
|
+
{"text": "checkout is down", "from": "www/slack"}
|
|
192
|
+
|
|
193
|
+
$ vb sync 812
|
|
194
|
+
support/slack C0C8XN8SQRG message 1792780353.701549
|
|
195
|
+
www/slack C0D2K4R7Q1M message 1792780391.118204
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Only the project's own sync links its copies, since it has the platform's app.
|
|
199
|
+
|
|
132
200
|
## Targets
|
|
133
201
|
|
|
134
202
|
A target is `<key>:<channel or thread>`. A channel target starts a new thread
|
|
@@ -301,7 +301,9 @@ reply, react, label, or attach:
|
|
|
301
301
|
|
|
302
302
|
Its writes (a reply, a label, a reaction, an edit or delete of the user's own
|
|
303
303
|
message) are authored by the platform actor who triggered the event, like
|
|
304
|
-
`slack:user:U0456
|
|
304
|
+
`slack:user:U0456` (on Vercel's board, this project's profile of them: see
|
|
305
|
+
[platform users](../01-board/03-identity.md#platform-users)), with the same
|
|
306
|
+
provenance as the import, and go through the
|
|
305
307
|
[middleware](../01-board/08-middleware.md) like it. Its reads, and anything else
|
|
306
308
|
it does, are sync's own. It holds no token: `board()` makes its calls. It works
|
|
307
309
|
the same on any backend that runs sync.
|
|
@@ -320,10 +322,12 @@ slack('slack/acme', render(({ message }) => message.text, channels({ '#prs': 'pr
|
|
|
320
322
|
```
|
|
321
323
|
|
|
322
324
|
The default is `**${label}**: ${message.text}`, where the label is the author's
|
|
323
|
-
name
|
|
324
|
-
came from
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
name, through their principal when they have a profile, and the platform a message
|
|
326
|
+
came from: `claude via julian`, `ada (slack)`, or `Malte via support (slack)` for
|
|
327
|
+
a platform user another sync speaks for. board still adds a line per attachment the platform
|
|
328
|
+
didn't take, and resolves mentions to the platform's own form after your
|
|
329
|
+
renderer runs, against this sync's own users
|
|
330
|
+
([mentions](../01-board/03-identity.md#mentions)).
|
|
327
331
|
|
|
328
332
|
Each channel can render its own way, since `render` wraps any function:
|
|
329
333
|
|
|
@@ -347,7 +351,8 @@ renders to, board edits that copy, so a PR's root in Slack can show its state:
|
|
|
347
351
|
```
|
|
348
352
|
|
|
349
353
|
`mentionOf(actor)` returns how the platform mentions one of its own actors
|
|
350
|
-
(`<@U0456>` in Slack), or null for anyone else
|
|
354
|
+
(`<@U0456>` in Slack), or null for anyone else, a platform user another sync
|
|
355
|
+
speaks for included: only that sync mentions them natively. The default label is
|
|
351
356
|
the author's name, so nobody gets pinged unless a renderer asks:
|
|
352
357
|
|
|
353
358
|
```ts
|
package/docs/02-sync/03-slack.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Slack
|
|
3
|
-
description: Mirror Slack channels into board channels, with threads, reactions, files, and
|
|
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**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
##
|
|
102
|
-
|
|
103
|
-
A message
|
|
104
|
-
|
|
105
|
-
|
|
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,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
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` |
|
|
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
|
|
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;
|