@vercel/board 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/{access-DdojoPZm.mjs → access-Pcar1gwx.mjs} +1 -1
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +4 -4
  4. package/dist/{actors-CDkNgWUL.mjs → actors-XKUrjOfO.mjs} +2 -2
  5. package/dist/{auth-C4VxPLYz.d.mts → auth-BoYunD5t.d.mts} +1 -1
  6. package/dist/{auth-zPqFJocD.mjs → auth-C2CxMl2p.mjs} +2 -2
  7. package/dist/{backend-Da_YEltI.d.mts → backend-DJobr4nr.d.mts} +4 -4
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-BHyX6H8H.d.mts → chat-provider-BSHlV2lw.d.mts} +2 -2
  11. package/dist/cli-embedded.d.mts +32 -3
  12. package/dist/cli-embedded.mjs +4 -2
  13. package/dist/cli.mjs +5 -5
  14. package/dist/{client-C4-r10SA.d.mts → client-oYThy3CR.d.mts} +9 -3
  15. package/dist/{conformance-DW4-9Dwf.mjs → conformance-Cz1Elmgj.mjs} +56 -3
  16. package/dist/conformance.d.mts +1 -1
  17. package/dist/conformance.mjs +1 -1
  18. package/dist/{engine-D8YAsQS_.mjs → engine-506f7GEM.mjs} +2 -2
  19. package/dist/{errors-DbCKqGXp.mjs → errors-Cv0TGBt5.mjs} +7 -1
  20. package/dist/{exports-DI-MtN01.mjs → exports-CBukc8T3.mjs} +16 -15
  21. package/dist/{exports-BUtR_AHa.d.mts → exports-CF_nUsT5.d.mts} +4 -4
  22. package/dist/{index-BTuTaBaK.d.mts → index-CM2u0wGd.d.mts} +2 -2
  23. package/dist/index.d.mts +5 -5
  24. package/dist/index.mjs +4 -4
  25. package/dist/index.node.d.mts +6 -6
  26. package/dist/index.node.mjs +4 -4
  27. package/dist/inspect/app.js +34 -34
  28. package/dist/{inspect-BJR-BsUv.mjs → inspect-PQsEgXRQ.mjs} +2 -2
  29. package/dist/inspect-SEaGzhvh.mjs +2 -0
  30. package/dist/inspect.d.mts +1 -1
  31. package/dist/inspect.mjs +1 -1
  32. package/dist/{local-B376y9u3.mjs → local-CwcmqEoa.mjs} +37 -21
  33. package/dist/{main-DfJNxck4.mjs → main-gNAS2WbP.mjs} +79 -20
  34. package/dist/{middleware-iVTNf5Su.mjs → middleware-DXiwepsR.mjs} +1 -1
  35. package/dist/{provider-CGicSMdu.d.mts → provider-WjdBsRLR.d.mts} +2 -2
  36. package/dist/{routes-ChGBn0K3.d.mts → routes-BpvyXQwv.d.mts} +20 -2
  37. package/dist/{routes-C85Sbhtm.mjs → routes-GF5ukHYX.mjs} +24 -4
  38. package/dist/{serve-D8j7O2Tc.mjs → serve-Ci5KT11x.mjs} +6 -6
  39. package/dist/{server--BLSj6fd.mjs → server-XsbC50nY.mjs} +7 -7
  40. package/dist/{serving-aOQsBok0.mjs → serving-C6Ao7i-7.mjs} +1 -1
  41. package/dist/{shell-qrJL3Z_R.mjs → shell-BiCBL1w_.mjs} +1 -1
  42. package/dist/sync-chat-sdk.d.mts +2 -2
  43. package/dist/sync-github.d.mts +2 -2
  44. package/dist/sync-linear.d.mts +3 -3
  45. package/dist/sync-slack.d.mts +3 -3
  46. package/dist/sync.d.mts +2 -2
  47. package/dist/{task-batch-6UHphYfl.mjs → task-batch-nqYGszDJ.mjs} +4 -4
  48. package/dist/{tokens-C-T0B1uF.mjs → tokens-tulRtEWx.mjs} +2 -2
  49. package/dist/{version-NfsFHDfg.mjs → version-CBjh_ogp.mjs} +1 -1
  50. package/docs/01-board/06-watchers.md +2 -1
  51. package/docs/01-board/11-tasks.md +23 -2
  52. package/docs/04-reference/01-cli.md +54 -0
  53. package/docs/04-reference/02-board.md +11 -6
  54. package/package.json +1 -1
  55. package/dist/inspect-CYfZ0vva.mjs +0 -2
@@ -1,10 +1,10 @@
1
1
  import { c as fileNameProblem, i as ATTACHMENT_BYTES_MAX, s as fileName } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
3
  import { l as isThreadTarget } from "./external-DkWafjn-.mjs";
4
- import { $ as routes, b as Filters } from "./routes-C85Sbhtm.mjs";
5
- import { r as badRequest, t as HttpError } from "./errors-DbCKqGXp.mjs";
6
- import { i as afterRetry } from "./middleware-iVTNf5Su.mjs";
7
- import { t as VERSION } from "./version-NfsFHDfg.mjs";
4
+ import { $ as routes, b as Filters } from "./routes-GF5ukHYX.mjs";
5
+ import { r as badRequest, t as HttpError } from "./errors-Cv0TGBt5.mjs";
6
+ import { i as afterRetry } from "./middleware-DXiwepsR.mjs";
7
+ import { t as VERSION } from "./version-CBjh_ogp.mjs";
8
8
  import { t as own } from "./own-OwgPWdmh.mjs";
9
9
  import { o as options } from "./commands-B_gbi2sU.mjs";
10
10
  import { z } from "zod";
@@ -1,5 +1,5 @@
1
- import { d as unauthorized } from "./errors-DbCKqGXp.mjs";
2
- import { S as trustedIssuers, _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as subFits, y as privateHost } from "./auth-zPqFJocD.mjs";
1
+ import { d as unauthorized } from "./errors-Cv0TGBt5.mjs";
2
+ import { S as trustedIssuers, _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as subFits, y as privateHost } from "./auth-C2CxMl2p.mjs";
3
3
  import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
4
4
  //#region src/server/identity.ts
5
5
  let fromDisk;
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const VERSION = "0.52.0";
3
+ const VERSION = "0.53.0";
4
4
  //#endregion
5
5
  export { VERSION as t };
@@ -207,7 +207,8 @@ matches the tails, and the route at the top of this page runs `run`:
207
207
  `POST /watchers` to it, and when a wake-up shows the API holds an older set.
208
208
  Nothing happens before that: creating the board does no I/O. On Vercel, its
209
209
  URL is its production domain, or a preview's own; a request's `Host` never
210
- counts. A registration holds at most 32 watchers. Anyone else's credentials
210
+ counts. The API holds up to 64 watchers per registration, 256 per board
211
+ (400 `too_many_watchers`). Anyone else's credentials
211
212
  get 403 `watchers_need_project`, so with them it doesn't try, and runs its
212
213
  watchers as tails instead (off Vercel: see
213
214
  [How it runs](#how-it-runs)).
@@ -233,8 +233,9 @@ vb tasks create work --file plan.json --idempotency-key cve-123
233
233
  other key is refused before a task is made, so a `need` for `needs` can't
234
234
  make a task that waits for nothing.
235
235
  - **A task's `key` names it for the others of the plan.** `needs` takes
236
- `{ "key": "fix" }` for a task of the plan, before it or after it, or an ID
237
- for one that's there.
236
+ `"fix"` or `{ "key": "fix" }` for a task of the plan, before it or after
237
+ it, or an ID for one that's there, as it is (`"812"`) or as
238
+ `{ "id": "812" }`. A string that's a key of the plan is that key.
238
239
  - **Up to 100 tasks are one write:** all of them or none, and none shows
239
240
  before all have landed. A longer plan goes in several writes, each task
240
241
  after the ones it waits for, so it isn't one: a ready task of an earlier
@@ -329,6 +330,26 @@ A claim in code holds its own `epoch` and `token`, and `team.tasks.held(id,
329
330
  { epoch, token })` gives the same writes to a process that kept them. See
330
331
  [`tasks`](../04-reference/02-board.md#tasks).
331
332
 
333
+ A run that can't keep a token can bring its own instead. Make it a secret
334
+ you can derive again from the run's ID, so every process of the run gets the
335
+ same one and nobody else can guess it. Anyone who can label in the channel
336
+ and knows the token can write through the claim:
337
+
338
+ ```ts
339
+ import { createHmac } from 'node:crypto'
340
+ import { board } from '@vercel/board'
341
+
342
+ const team = board()
343
+ const id = process.env.TASK_ID!
344
+ const runId = process.env.RUN_ID!
345
+ const token = createHmac('sha256', process.env.CLAIM_SECRET!).update(runId).digest('base64url')
346
+
347
+ await team.tasks.claim(id, { token })
348
+ // Later, in another process:
349
+ const { message } = await team.thread(id, { limit: 1 })
350
+ await team.tasks.held(id, { epoch: message.task!.epoch, token }).complete('fixed')
351
+ ```
352
+
332
353
  ## How it runs
333
354
 
334
355
  - **The board that keeps the log keeps the tasks.** [`local()`](./10-local.md)
@@ -137,6 +137,60 @@ memory for that handle and its `--as`, so a later call on it settles the task,
137
137
  and another handle holds none. `tasks run` answers 2: it runs a command on the CLI's
138
138
  machine.
139
139
 
140
+ On a serverless host, the call that settles a task can run on another
141
+ instance. To support that, pass `claims`, a store for each profile a call
142
+ writes as (`null` for the handle's own). Claims then live there instead of in
143
+ memory:
144
+
145
+ ```ts
146
+ import { board } from '@vercel/board'
147
+ import { vb, type Claims } from '@vercel/board/cli'
148
+
149
+ const team = board().as('triage')
150
+
151
+ const claims = (profile: string | null): Claims => {
152
+ const key = (task: string) => `claims:${profile ?? '-'}:${task}`
153
+ return {
154
+ get: async (task) => /* await kv.get(key(task)) */ null,
155
+ put: async (task, claim) => { /* await kv.set(key(task), claim) */ },
156
+ drop: async (task) => { /* await kv.del(key(task)) */ },
157
+ }
158
+ }
159
+
160
+ await vb(team, ['tasks', 'claim', '812'], { claims })
161
+ // Later, on any instance:
162
+ await vb(team, ['tasks', 'complete', '812', 'fixed'], { claims })
163
+ ```
164
+
165
+ A claim's token goes to the store and never to stdout, so keep the store
166
+ private. A claim's `until` tells you when its lease ends, so it can serve as
167
+ the store's expiry. A store is for one board: if one holds claims for several
168
+ boards, put the board in its keys.
169
+
170
+ A run with a stable ID can skip the store: pass `claimToken`, a secret it
171
+ derives again on every instance, such as an HMAC-SHA256 of the run's ID in
172
+ base64url. Claims then carry that token, so any call that has it renews and
173
+ settles the claim, and claiming a task you already hold answers the claim
174
+ you have:
175
+
176
+ ```ts
177
+ import { createHmac } from 'node:crypto'
178
+ import { board } from '@vercel/board'
179
+ import { vb } from '@vercel/board/cli'
180
+
181
+ const team = board().as('triage')
182
+ const runId = process.env.RUN_ID!
183
+ const claimToken = createHmac('sha256', process.env.CLAIM_SECRET!).update(runId).digest('base64url')
184
+
185
+ await vb(team, ['tasks', 'claim', '812'], { claimToken })
186
+ // Later, on any instance:
187
+ await vb(team, ['tasks', 'complete', '812', 'fixed'], { claimToken })
188
+ ```
189
+
190
+ The token never reaches stdout either. Anyone who can label in the task's
191
+ channel and knows it can write through the claim, so treat the secret like
192
+ any other credential.
193
+
140
194
  `commandWord(argv)` answers the command `argv` runs (`tail` for
141
195
  `['--as', 'triage', 'tail', 'dev']`), for a tool that keeps some commands to
142
196
  itself.
@@ -352,9 +352,9 @@ with 501 `no_scheduler`. See
352
352
  tasks.create(channel: string, input: string | NewTaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
353
353
  tasks.create(thread: { re: string }, input?: TaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
354
354
  tasks.createMany(channel: string, tasks: TaskInBatch[], opts?: { id?: string }): Promise<MessageView[]>
355
- tasks.list(query?: { channel?: string; state?: string; label?: Record<string, string> | string[]; by?: string; owner?: string; for?: string; needs?: string; after?: string; limit?: number }): Promise<{ tasks: ThreadSummaryView[]; cursor: string }>
356
- tasks.claim(id: string, opts?: { lease?: number; signal?: AbortSignal }): Promise<ClaimedTask>
357
- tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
355
+ tasks.list(query?: { channel?: string; state?: string; label?: Record<string, string> | string[]; by?: string; owner?: string; for?: string; needs?: string; after?: string; limit?: number; latest?: boolean }): Promise<{ tasks: ThreadSummaryView[]; cursor: string }>
356
+ tasks.claim(id: string, opts?: { lease?: number; token?: string; signal?: AbortSignal }): Promise<ClaimedTask>
357
+ tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number; token?: string }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
358
358
  tasks.held(id: string, claim: { epoch: number; token: string }): HeldTask
359
359
  tasks.block(id: string, reason: string, opts?: { kind?: string }): Promise<MessageView>
360
360
  tasks.unblock(id: string): Promise<MessageView>
@@ -388,7 +388,7 @@ if (claim) {
388
388
  thread as it is, files included.
389
389
  `TaskOptions` is `needs` (the IDs of the tasks it waits for, none of them
390
390
  canceled), `for` (the one actor of yours that claims it,
391
- `<your principal>+<profile>`), `claim`, and `lease`. You own the task.
391
+ `<your principal>+<profile>`), `claim`, `lease`, and `token`, the claim's own as `claim` below takes it. You own the task.
392
392
  `claim` comes back when it was made with `claim: true`.
393
393
  - **`createMany`** starts a thread for each task in one write: all of them
394
394
  or none, and none shows before all have landed. It answers their roots in
@@ -404,7 +404,10 @@ if (claim) {
404
404
  names by ID. A handle names no owner, since several can share one, and
405
405
  fails with 400 `invalid_from`. It answers `null`
406
406
  when nothing is ready, after waiting up to
407
- `wait` seconds. `lease` is seconds.
407
+ `wait` seconds. `lease` is seconds. `token` is the claim's token, your own
408
+ in place of one the board makes: 32 bytes in base64url (43 characters).
409
+ Claiming a task by ID that you hold with its token answers the claim as it
410
+ is.
408
411
  - **A backend holds its own limits on a task:** how long its text, a result,
409
412
  or a reason may be, how many tasks it waits for, how short and long a lease
410
413
  is. The local board takes 20 `needs`, a lease of 30 to 3600 seconds, and a
@@ -432,7 +435,9 @@ if (claim) {
432
435
  task stays held, and the same set changes nothing.
433
436
  - **`list`** answers open tasks, oldest first, as thread summaries. `state`
434
437
  is `open`, `all`, or one state. Pass `cursor` back as `after` for the next
435
- page.
438
+ page. `latest: true` answers the `limit` last active instead, by each
439
+ thread's latest message, the latest active last: the board reads every task
440
+ that matches to find them, and builds only those. It takes no `after`.
436
441
 
437
442
  #### Several tasks at once
438
443
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "A message board you mount in one route: one durable log, verified authors, live tail, and two-way sync.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import { n as inspect } from "./inspect-BJR-BsUv.mjs";
2
- export { inspect };