@vercel/board 0.45.0 → 0.46.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/dist/{access-3udXjJAg.mjs → access-Crbvd2Dm.mjs} +2 -2
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +5 -5
- package/dist/{actors-DasGZnfb.mjs → actors-BBphaJ_G.mjs} +3 -3
- package/dist/{auth-aiOVE82-.mjs → auth-C-pFnJBA.mjs} +2 -2
- package/dist/{auth-BG_whr9_.d.mts → auth-CkNXnQno.d.mts} +1 -1
- package/dist/{backend-D6yTo8Un.d.mts → backend-D3p8gjba.d.mts} +126 -4
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/{chat-provider-BvNqOQFL.mjs → chat-provider-1zpY6Qo_.mjs} +2 -2
- package/dist/{chat-provider-V2jnjVLq.d.mts → chat-provider-Bn33acHd.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 -2
- package/dist/cli.mjs +6 -6
- package/dist/{commands-DewS14_P.d.mts → commands-CSZPQ38I.d.mts} +54 -0
- package/dist/{commands-CqdnjUkm.mjs → commands-D0lyo8O8.mjs} +319 -0
- package/dist/{conformance-BInS4_6b.mjs → conformance-Blzd4CXG.mjs} +972 -6
- package/dist/conformance.d.mts +6 -5
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-XVBt02Bl.mjs → engine-C_SlBihU.mjs} +15 -7
- package/dist/{errors-ZazTZh-s.mjs → errors-DZ1tbwSM.mjs} +151 -3
- package/dist/{events-D17RndlV.mjs → events-mGuhF4i5.mjs} +2 -2
- package/dist/{exports-DCf75prP.mjs → exports-DQauuHrc.mjs} +1248 -45
- package/dist/exports-DUX_Yzo7.d.mts +44 -0
- package/dist/{external-DfhN7lKK.mjs → external-BVr1Sq0y.mjs} +1 -1
- package/dist/{index-Djmr4GzQ.d.mts → index-BHXg4Xdo.d.mts} +2 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -5
- package/dist/index.node.d.mts +7 -6
- package/dist/index.node.mjs +5 -4
- package/dist/inspect/app.js +215 -115
- package/dist/inspect/engine.js +5 -5
- package/dist/{inspect-B0_aKQM8.mjs → inspect-2OIjv2lW.mjs} +242 -20
- package/dist/inspect-F-b4GPXX.mjs +2 -0
- package/dist/{local-Bel_oeFa.mjs → local-11FMUJrU.mjs} +1593 -60
- package/dist/{main-DmsdcUZ_.mjs → main-BYmbTDgo.mjs} +1167 -24
- package/dist/{memory-DyEL0fvN.mjs → memory-CZBdVNn8.mjs} +2 -2
- package/dist/{middleware-BHHKHA9q.mjs → middleware-BKsTcMAv.mjs} +2 -2
- package/dist/{provider-BC9mPYVh.d.mts → provider-D3bfHRHA.d.mts} +119 -3
- package/dist/{routes-CkUetTO2.mjs → routes-B2HHHD_C.mjs} +246 -6
- package/dist/{routes-zm4TXKCC.d.mts → routes-NEc6w3QC.d.mts} +540 -6
- package/dist/{schemas-BhZaystC.mjs → schemas-7VFdomFB.mjs} +34 -1
- package/dist/{serve-bPSEx_8X.mjs → serve-DS2T2iWI.mjs} +4 -4
- package/dist/{server-CcvxkXzG.mjs → server-Ch3tuK2k.mjs} +10 -10
- package/dist/{serving-BLVRrJ7P.mjs → serving-9riPNrHk.mjs} +1 -1
- package/dist/{sql-CyVcjw8x.mjs → sql-Bml29DpM.mjs} +174 -9
- package/dist/{sqlite-Con-8duk.mjs → sqlite-4C5u7-ag.mjs} +2 -2
- package/dist/{sqlite-db-BdzxtUOV.mjs → sqlite-db-eVb9v3zc.mjs} +1 -1
- 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/{origin-BHmEdok7.mjs → task-batch-BJcLiYe1.mjs} +83 -8
- package/dist/{tokens-BErYXuHZ.mjs → tokens-DPKF_cb5.mjs} +2 -2
- package/docs/01-board/01-mounting.md +3 -3
- package/docs/01-board/07-schedules.md +2 -2
- package/docs/01-board/08-middleware.md +7 -0
- package/docs/01-board/11-tasks.md +348 -0
- package/docs/03-guides/02-inspector.md +66 -9
- package/docs/03-guides/06-sandboxed-agents.md +5 -3
- package/docs/03-guides/07-build-a-ui.md +210 -0
- package/docs/04-reference/01-cli.md +216 -8
- package/docs/04-reference/02-board.md +277 -2
- package/docs/04-reference/03-http.md +185 -11
- package/docs/04-reference/05-conformance.md +10 -7
- package/package.json +1 -1
- package/dist/exports-Gspe1eEq.d.mts +0 -4
- package/dist/inspect-CULoD54F.mjs +0 -2
|
@@ -339,6 +339,269 @@ already done or canceled. A board that keeps no schedules fails `schedule`
|
|
|
339
339
|
with 501 `no_scheduler`. See
|
|
340
340
|
[Scheduled messages](../01-board/07-schedules.md).
|
|
341
341
|
|
|
342
|
+
### tasks
|
|
343
|
+
|
|
344
|
+
```ts
|
|
345
|
+
tasks.create(channel: string, input: string | NewTaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
|
|
346
|
+
tasks.create(thread: { re: string }, input?: TaskOptions): Promise<{ task: MessageView; claim?: ClaimedTask }>
|
|
347
|
+
tasks.createMany(channel: string, tasks: TaskInBatch[], opts?: { id?: string }): Promise<MessageView[]>
|
|
348
|
+
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 }>
|
|
349
|
+
tasks.claim(id: string, opts?: { lease?: number; signal?: AbortSignal }): Promise<ClaimedTask>
|
|
350
|
+
tasks.claim(ready: { channel: string; label?: Record<string, string>; from?: string[]; wait?: number; lease?: number }, opts?: { signal?: AbortSignal }): Promise<ClaimedTask | null>
|
|
351
|
+
tasks.held(id: string, claim: { epoch: number; token: string }): HeldTask
|
|
352
|
+
tasks.block(id: string, reason: string, opts?: { kind?: string }): Promise<MessageView>
|
|
353
|
+
tasks.unblock(id: string): Promise<MessageView>
|
|
354
|
+
tasks.reopen(id: string): Promise<MessageView>
|
|
355
|
+
tasks.assign(id: string, actor: string | null): Promise<MessageView>
|
|
356
|
+
tasks.needs(id: string, needs: string[]): Promise<MessageView>
|
|
357
|
+
tasks.cancel(id: string, reason: string): Promise<MessageView>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
A task is a thread with a state the board keeps. Its ID is its root's, and
|
|
361
|
+
its root's `task` says its state, whose it is, what it waits for, and who
|
|
362
|
+
holds it.
|
|
363
|
+
|
|
364
|
+
```ts
|
|
365
|
+
import { board } from '@vercel/board'
|
|
366
|
+
|
|
367
|
+
const team = board()
|
|
368
|
+
|
|
369
|
+
const { task: fix } = await team.tasks.create('work', { text: 'fix CVE-123 in acme/web', labels: { step: 'fix' } })
|
|
370
|
+
await team.tasks.create('work', { text: 'review the fix for CVE-123', labels: { step: 'review' }, needs: [fix.id] })
|
|
371
|
+
|
|
372
|
+
const claim = await team.tasks.claim({ channel: 'work/', label: { step: 'fix' }, wait: 600 }) // null when none came
|
|
373
|
+
if (claim) {
|
|
374
|
+
await team.reply(claim.task.id, 'patched, running the tests')
|
|
375
|
+
await claim.complete('fixed in a1b2c3, tests pass')
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
- **`create`** starts a thread as a task, taking `text`, `labels`, `noSync`,
|
|
380
|
+
`attachments`, and `id` as `post` does, or with `{ re }` makes a task of a
|
|
381
|
+
thread as it is, files included.
|
|
382
|
+
`TaskOptions` is `needs` (the IDs of the tasks it waits for, none of them
|
|
383
|
+
canceled), `for` (the one actor of yours that claims it,
|
|
384
|
+
`<your principal>+<profile>`), `claim`, and `lease`. You own the task.
|
|
385
|
+
`claim` comes back when it was made with `claim: true`.
|
|
386
|
+
- **`createMany`** starts a thread for each task in one write: all of them
|
|
387
|
+
or none, and none shows before all have landed. It answers their roots in
|
|
388
|
+
the order given. A `TaskInBatch` is `text`, `labels`, `noSync`, and
|
|
389
|
+
`attachments` as `post` takes them, `for`, and `needs`: a task's ID, or
|
|
390
|
+
`{ key }` for a task of the same call, which names itself with `key`. See
|
|
391
|
+
[Several tasks at once](#several-tasks-at-once).
|
|
392
|
+
- **`claim`** by ID throws a 409 when the task can't be claimed:
|
|
393
|
+
`task_claimed`, `task_waiting`, `task_blocked`, `task_finished`, or
|
|
394
|
+
`task_assigned`. With `{ channel }` it claims the oldest ready task in that
|
|
395
|
+
channel (`work`) or subtree (`work/`) that has every label in `label`: one
|
|
396
|
+
assigned to you first, then an unassigned one you own, or whose owner `from`
|
|
397
|
+
names by ID. A handle names no owner, since several can share one, and
|
|
398
|
+
fails with 400 `invalid_from`. It answers `null`
|
|
399
|
+
when nothing is ready, after waiting up to
|
|
400
|
+
`wait` seconds. `lease` is seconds.
|
|
401
|
+
- **A backend holds its own limits on a task:** how long its text, a result,
|
|
402
|
+
or a reason may be, how many tasks it waits for, how short and long a lease
|
|
403
|
+
is. The local board takes 20 `needs`, a lease of 30 to 3600 seconds, and a
|
|
404
|
+
result or reason of 1,000 characters, and answers 400 `invalid_request`
|
|
405
|
+
past one. On Vercel's board the API refuses what's over its own, and its
|
|
406
|
+
error is the one you get.
|
|
407
|
+
- **A `ClaimedTask`** is `{ task, epoch, token, until }` and what the claim
|
|
408
|
+
does: `renew(lease?)`, `release()`, `complete(result?)`, `fail(reason)`, and
|
|
409
|
+
`block(reason, { kind? })`. `until` is when its lease ends. Once the claim is
|
|
410
|
+
over, each throws a 409 `claim_lost` and changes nothing.
|
|
411
|
+
- **`held`** gives the same writes from an `epoch` and a `token`, for a
|
|
412
|
+
process that kept them.
|
|
413
|
+
- **`block`, `unblock`, `reopen`, `assign`, `needs`, and `cancel`** are for the
|
|
414
|
+
task's owner, or `manage` in its channel: anyone else gets 403
|
|
415
|
+
`task_not_owned`.
|
|
416
|
+
A handle that writes as a profile (`team.as('fixer')`) owns only the tasks
|
|
417
|
+
it made. The principal itself owns what any of its profiles made. A task's
|
|
418
|
+
`by` is the actor that made it, so a UI knows whose these are to offer.
|
|
419
|
+
`block` here holds a task no one has claimed.
|
|
420
|
+
- **`needs`** replaces what a task waits for, by their IDs: it waits for those
|
|
421
|
+
now, and is ready once they've all completed, or at once with `[]`. It takes
|
|
422
|
+
what `create` takes, while no one has claimed the task (409 `task_claimed`)
|
|
423
|
+
and it isn't finished (409 `task_finished`). One that would make the task
|
|
424
|
+
wait for itself, through however many tasks, is 400 `invalid_needs`. A held
|
|
425
|
+
task stays held, and the same set changes nothing.
|
|
426
|
+
- **`list`** answers open tasks, oldest first, as thread summaries. `state`
|
|
427
|
+
is `open`, `all`, or one state. Pass `cursor` back as `after` for the next
|
|
428
|
+
page.
|
|
429
|
+
|
|
430
|
+
#### Several tasks at once
|
|
431
|
+
|
|
432
|
+
```ts
|
|
433
|
+
import { board } from '@vercel/board'
|
|
434
|
+
|
|
435
|
+
const team = board()
|
|
436
|
+
|
|
437
|
+
const [fix, review, ship] = await team.tasks.createMany(
|
|
438
|
+
'work',
|
|
439
|
+
[
|
|
440
|
+
{ key: 'fix', text: 'fix CVE-123 in acme/web', labels: { step: 'fix' } },
|
|
441
|
+
{ key: 'review', text: 'review the fix', labels: { step: 'review' }, needs: [{ key: 'fix' }] },
|
|
442
|
+
{ text: 'ship it', needs: [{ key: 'review' }, { key: 'fix' }] },
|
|
443
|
+
],
|
|
444
|
+
{ id: 'cve-123' },
|
|
445
|
+
)
|
|
446
|
+
// fix is ready. review and ship wait: review.task.needs is [fix.id].
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
- **One write.** Every task is made or none is, and the feed has no event of
|
|
450
|
+
any before all have landed: each task's `message.posted`, then its
|
|
451
|
+
`task.created`, in the order given.
|
|
452
|
+
- **A task's `key` names it for the others of the call.** A task waits for
|
|
453
|
+
one before it or after it. A `key` two tasks have, one no task has, and
|
|
454
|
+
tasks that wait for each other are 400 `invalid_needs`. A `key` means
|
|
455
|
+
nothing once the call returns: use the IDs it answers. How long one may be
|
|
456
|
+
is the backend's to say: 64 characters on the local board and on Vercel's. It's no part of what makes a repeat safe: that's the call's `id`.
|
|
457
|
+
- **A task that waits for one of the call waits.** One that waits only for
|
|
458
|
+
tasks that were there and have all completed is ready in the same write.
|
|
459
|
+
- **Each task is checked as `create` checks one:** its text and blocks, its
|
|
460
|
+
labels, its files, its assignee, and the tasks it waits for. `post` in the
|
|
461
|
+
channel, and `label` when any task has labels. There's no `claim`: claim
|
|
462
|
+
one once it's made.
|
|
463
|
+
- **`id` names the request.** The same `id` again, with the same channel and
|
|
464
|
+
the same tasks, answers the tasks the first call made, as they are now, and
|
|
465
|
+
makes none. The tasks are the same when there are as many, in the same
|
|
466
|
+
order, each with the same `key`, text, labels, `noSync`, files, needs, and
|
|
467
|
+
`for`, as you gave them. Anything else under that `id` is 409
|
|
468
|
+
`duplicate_id`. A board keeps an `id` for good.
|
|
469
|
+
- **100 tasks at most.** More is 400 `batch_too_large`, before the
|
|
470
|
+
[middleware](../01-board/08-middleware.md) sees any of them, and so is a
|
|
471
|
+
batch with more than a board holds in one write. Nothing is made.
|
|
472
|
+
[`local()`](../01-board/10-local.md) holds all 100, one append of at most
|
|
473
|
+
301 events. Vercel's board holds fewer: see below.
|
|
474
|
+
- **The middleware sees each task's root as a post,** one after the other,
|
|
475
|
+
before any is written: one it drops makes none. A retry of a batch that
|
|
476
|
+
landed never reaches it.
|
|
477
|
+
|
|
478
|
+
```ts
|
|
479
|
+
import { board, createTasksInChunks, TasksInChunksError, type TaskInBatch } from '@vercel/board'
|
|
480
|
+
|
|
481
|
+
const team = board()
|
|
482
|
+
|
|
483
|
+
// 400 steps, each waiting for the one before it.
|
|
484
|
+
const plan: TaskInBatch[] = Array.from({ length: 400 }, (_, n) => ({
|
|
485
|
+
key: `shard-${n}`,
|
|
486
|
+
text: `migrate shard ${n}`,
|
|
487
|
+
...(n > 0 ? { needs: [{ key: `shard-${n - 1}` }] } : {}),
|
|
488
|
+
}))
|
|
489
|
+
|
|
490
|
+
try {
|
|
491
|
+
const tasks = await createTasksInChunks(team, 'work', plan, { id: 'migration-7' })
|
|
492
|
+
console.log(tasks.length) // 400, in the order of plan
|
|
493
|
+
} catch (error) {
|
|
494
|
+
if (!(error instanceof TasksInChunksError)) throw error
|
|
495
|
+
console.log(error.code, error.created.filter(Boolean).length) // why it stopped, and how many were made
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
`createTasksInChunks(team, channel, tasks, { id? })` makes a plan longer than
|
|
500
|
+
one batch holds, with as many `createMany` calls as it takes. It answers the
|
|
501
|
+
tasks' roots in the order given.
|
|
502
|
+
|
|
503
|
+
- **It makes each task after the ones it waits for,** so a chunk needs only
|
|
504
|
+
tasks made before it. A task an earlier chunk made is named by the ID it
|
|
505
|
+
got. Tasks that can't be ordered are 400 `invalid_needs`, and nothing is
|
|
506
|
+
sent.
|
|
507
|
+
- **It sends fewer when a board answers `batch_too_large`:** 50 tasks, then
|
|
508
|
+
25, down to one, and goes on with chunks that size.
|
|
509
|
+
- **It isn't one write.** Each chunk is all or nothing, and the chunks land
|
|
510
|
+
one after another. A ready task of an earlier chunk can be claimed before a
|
|
511
|
+
later chunk lands, and a chunk that fails leaves the ones before it made.
|
|
512
|
+
- **A failure stops it.** It throws a `TasksInChunksError` with the failure's
|
|
513
|
+
own `code`, `status`, and `message`, and `created`: the task made for each
|
|
514
|
+
of `tasks`, at its place, or `undefined`.
|
|
515
|
+
- **With `id`, call it again.** Each chunk goes under an ID made from `id` and
|
|
516
|
+
where the chunk starts, so the same call again answers the chunks that
|
|
517
|
+
landed and makes the rest.
|
|
518
|
+
- **What an `id` made stays as it is.** A task that landed can't change, and
|
|
519
|
+
a plan that finished takes no more tasks, wherever its chunks ended: both
|
|
520
|
+
are 409 `duplicate_id`, and nothing new is made. What a call that stopped
|
|
521
|
+
didn't make can still change, so a plan is fixed and finished under the
|
|
522
|
+
same `id`.
|
|
523
|
+
- **A chunk's keys are the function's own.** A `key` lasts no longer than a
|
|
524
|
+
call, so it sends each task under its place in the chunk, and the plan's
|
|
525
|
+
last task as `end`: that's what tells a board the plan ends there.
|
|
526
|
+
|
|
527
|
+
A plan that must not start before all of it is there waits for a task of your
|
|
528
|
+
own, in a channel no worker claims in. Nothing in `createTasksInChunks` does
|
|
529
|
+
this: it's a task every task of the plan needs, which you complete once the
|
|
530
|
+
plan is there.
|
|
531
|
+
|
|
532
|
+
```ts
|
|
533
|
+
import { board, createTasksInChunks, type TaskInBatch } from '@vercel/board'
|
|
534
|
+
|
|
535
|
+
const team = board()
|
|
536
|
+
|
|
537
|
+
const plan: TaskInBatch[] = Array.from({ length: 400 }, (_, n) => ({ text: `migrate shard ${n}` }))
|
|
538
|
+
|
|
539
|
+
// A task where no worker claims: nothing that waits for it is ready until it completes.
|
|
540
|
+
const { task: gate } = await team.tasks.create('plans', { text: 'migration-7 is being planned' })
|
|
541
|
+
const gated = plan.map((task) => ({ ...task, needs: [...(task.needs ?? []), gate.id] }))
|
|
542
|
+
await createTasksInChunks(team, 'work', gated, { id: 'migration-7' })
|
|
543
|
+
await (await team.tasks.claim(gate.id)).complete('planned') // now the plan's tasks are ready
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
If the plan fails, run it again with the same `id`, or cancel the gate: what
|
|
547
|
+
was made then waits for good.
|
|
548
|
+
|
|
549
|
+
Vercel's board keeps tasks on its threads, and a claim there differs in what
|
|
550
|
+
it gives:
|
|
551
|
+
|
|
552
|
+
- **A lease is 5 minutes at most.** `until` says what a claim got, whatever
|
|
553
|
+
`lease` asked for, and `renew` extends it the same way.
|
|
554
|
+
- **Nothing times a lease.** A claim whose lease ran out is over at once, and
|
|
555
|
+
still reads `claimed` until the next task write or list that sees it.
|
|
556
|
+
- **A task's changes stay in the feed 30 days.** Its thread and its state stay.
|
|
557
|
+
- **`claim({ channel })` looks only at tasks you may take.** In each channel
|
|
558
|
+
you may claim in, it looks in one place for each owner it takes from: your
|
|
559
|
+
own unassigned tasks, those of each owner `from` names, and with a profile,
|
|
560
|
+
what's assigned to it. So a task of yours is found behind any number of
|
|
561
|
+
other owners'.
|
|
562
|
+
- **It looks in 200 places at most:** the channels you may claim in, times
|
|
563
|
+
those owners. Past that it fails with 400 `claim_too_wide`, and a subtree
|
|
564
|
+
with more than 50 such channels with 400 `channel_tree_too_large`. Name
|
|
565
|
+
fewer owners, or a smaller subtree.
|
|
566
|
+
- **One request for a ready task waits 25 seconds at most, and can answer
|
|
567
|
+
sooner.** What wakes it is a change to a task, or to a root's labels, in
|
|
568
|
+
the channels it names, and it looks 12 times at most. Where many tasks
|
|
569
|
+
change it answers that it took nothing after a few seconds, so
|
|
570
|
+
`claim({ channel, wait })` asks again until `wait` is up.
|
|
571
|
+
- **With `label`, it finds a task among the oldest 25 in each place.** One
|
|
572
|
+
with those labels behind 25 ready tasks of the same owner that lack them
|
|
573
|
+
isn't found until one of those is claimed.
|
|
574
|
+
- **A list reads 50 channels at most for a caller that doesn't read the whole
|
|
575
|
+
board.** One held to a `can`, as a sandbox is, lists the board or a subtree
|
|
576
|
+
only where it reads 50 channels or fewer. Past that it fails with 400
|
|
577
|
+
`channel_tree_too_large`: name a channel, or a smaller subtree.
|
|
578
|
+
- **A batch holds what fits one of the API's writes: 15 plain tasks, or 14
|
|
579
|
+
with an `id`.** A task's labels, files, and needs count toward it, so a
|
|
580
|
+
chain of 13 fits, or of 12 with an `id`, and 11 tasks with a label each
|
|
581
|
+
either way. More is 400 `batch_too_large`, with nothing made, and its
|
|
582
|
+
message says how many the batch counts for.
|
|
583
|
+
- **A retried batch goes through the middleware again there.** The API has
|
|
584
|
+
no read of a batch by its `id`, and tells the same request by what it's
|
|
585
|
+
sent, after the middleware. One that isn't the same twice makes a retry
|
|
586
|
+
409 `duplicate_id`.
|
|
587
|
+
- **A batch's request is 64 KB at most,** which long texts reach first: six
|
|
588
|
+
tasks of 10,000 characters fit, and seven don't. That's `batch_too_large`
|
|
589
|
+
too, with nothing made, so one code says "send less". `createTasksInChunks`
|
|
590
|
+
halves until a chunk fits both.
|
|
591
|
+
- **A file is on one task.** Two tasks of a batch with the same file are 400
|
|
592
|
+
`invalid_attachments`.
|
|
593
|
+
- **A completion readies 65 of the tasks that waited for it before it
|
|
594
|
+
answers.** Any more become ready as later task requests reach them: a claim
|
|
595
|
+
of one, a list that shows one or the completed task, or a
|
|
596
|
+
`claim({ channel })` that finds nothing else to take.
|
|
597
|
+
- **Lists and `claim({ channel })` can trail a write by a moment.** They find
|
|
598
|
+
tasks through an index, so a task made or readied just now can be missing
|
|
599
|
+
from the next list or look. A claim by ID never misses, and a claim that
|
|
600
|
+
waits looks again shortly after it's woken.
|
|
601
|
+
|
|
602
|
+
A board that keeps no tasks fails each with 501 `no_tasks`. See
|
|
603
|
+
[Tasks](./03-http.md#tasks) for the routes and the `task` view.
|
|
604
|
+
|
|
342
605
|
### createGrant
|
|
343
606
|
|
|
344
607
|
```ts
|
|
@@ -464,19 +727,31 @@ const page = await team.messages({ channel: 'errors-www', label: { status: 'open
|
|
|
464
727
|
### threads
|
|
465
728
|
|
|
466
729
|
```ts
|
|
467
|
-
threads(query?: Filters & { after?: string; limit?: number }): Promise<ThreadsPage>
|
|
730
|
+
threads(query?: Filters & { after?: string; before?: string; limit?: number }): Promise<ThreadsPage>
|
|
468
731
|
```
|
|
469
732
|
|
|
470
|
-
Returns `{ threads, cursor }`: one summary per thread with a matching message,
|
|
733
|
+
Returns `{ threads, cursor, older }`: one summary per thread with a matching message,
|
|
471
734
|
by latest activity, newest last. Each is `{ message, replies, last }`: the
|
|
472
735
|
root, its reply count, and its latest reply (`null` when it has none).
|
|
473
736
|
Deleted replies don't count. `limit` counts threads (50 by default, at most
|
|
474
737
|
500), so a thread's root is there however many replies it has; `after` is the
|
|
475
738
|
first `limit` threads active after that cursor.
|
|
476
739
|
|
|
740
|
+
`older` is the `before` for the threads last active before the page's, or
|
|
741
|
+
`null` when none are: pass it back to page back through every thread once. A
|
|
742
|
+
page read with `after`, or from a board before `older`, has none. `before`
|
|
743
|
+
doesn't go with `after`.
|
|
744
|
+
|
|
477
745
|
```ts
|
|
478
746
|
const open = await team.threads({ channel: 'prs', label: { state: 'open' } })
|
|
479
747
|
for (const { message, replies, last } of open.threads) console.log(message.id, replies, last?.createdAt)
|
|
748
|
+
|
|
749
|
+
// Every thread in prs, newest activity first, a page at a time.
|
|
750
|
+
for (let page = await team.threads({ channel: 'prs' }); ; ) {
|
|
751
|
+
console.log(page.threads.map((t) => t.message.id))
|
|
752
|
+
if (!page.older) break
|
|
753
|
+
page = await team.threads({ channel: 'prs', before: page.older })
|
|
754
|
+
}
|
|
480
755
|
```
|
|
481
756
|
|
|
482
757
|
### thread
|
|
@@ -78,11 +78,11 @@ uses the target's own.
|
|
|
78
78
|
| Permission | Routes |
|
|
79
79
|
| --- | --- |
|
|
80
80
|
| `read` | `GET /messages`, `/threads`, `/messages/:id`, `/events`, `/channels`, `/actors`, `/schedules`, `/attachments/:id` show only what it covers; `POST /watchers` needs it somewhere, and a registered watcher sees only what it covers |
|
|
81
|
-
| `post` | `POST /messages` (a reply also needs `read`), `/channels` (with `read`), `/messages/:id/edit` and `/messages/:id/delete` (your own: see [Who edits what](../01-board/09-access.md#who-edits-what)), `/messages/:id/typing` (with `read`), `/schedules
|
|
81
|
+
| `post` | `POST /messages` (a reply also needs `read`), `/channels` (with `read`), `/messages/:id/edit` and `/messages/:id/delete` (your own: see [Who edits what](../01-board/09-access.md#who-edits-what)), `/messages/:id/typing` (with `read`), `/schedules`, `/tasks` and `/tasks/batch` for new threads; `/attachments` needs it, or `sync`, somewhere |
|
|
82
82
|
| `react` | `POST /messages/:id/reactions` |
|
|
83
|
-
| `label` | `POST /messages/:id/labels`, and a post or
|
|
83
|
+
| `label` | `POST /messages/:id/labels`, and a post, schedule, or new task with `labels`; `POST /tasks` with `re`, `/tasks/:id/claim`, `/tasks/claim`, and a task made with `claim` |
|
|
84
84
|
| `sync` | `POST /messages/:id/sync`, a post with `sync` targets, and [sync's routes](#syncs-routes); in every channel, `GET /inbox/:key` for the board's own inbox |
|
|
85
|
-
| `manage` | `POST /schedules/:id/cancel` for someone else's; in every channel, `GET /sources/:key/read`, `POST /sources/:key/join`, every registration in `GET /watchers`, and `/grants`; at `*`, `POST /schemas` |
|
|
85
|
+
| `manage` | `POST /schedules/:id/cancel` for someone else's; `POST /tasks/:id/block`, `/unblock`, `/reopen`, `/assign`, and `/cancel` for someone else's task; in every channel, `GET /sources/:key/read`, `POST /sources/:key/join`, every registration in `GET /watchers`, and `/grants`; at `*`, `POST /schemas` |
|
|
86
86
|
|
|
87
87
|
`react`, `label`, and `sync` imply `read`, and `manage` implies everything. A
|
|
88
88
|
message, schedule, or file the caller can't read answers 404 on every route;
|
|
@@ -99,7 +99,7 @@ a refused write it can read answers 403. `GET /me` returns the caller's
|
|
|
99
99
|
| POST | `/channels` | `{ path }`: makes a channel before anything posts to it. `{ channel, created }`, 201 when it made it, and 200 with `created: false` for one that's there, which it leaves as it is. A key it doesn't know is 400, so `private` makes nothing |
|
|
100
100
|
| GET | `/actors` | `{ actors, cursor }`: each `{ id, kind, handle, name, avatar, via?, platform?, verified? }`, sorted by handle. `verified: true` is for one the board checked rather than took their name from what they sent: shown under the handle a credential it checked gave them (an OIDC token, a host's verifier), as itself or after `via` |
|
|
101
101
|
| GET | `/messages` | `{ messages, cursor }`, filtered. See [Listing messages](#listing-messages) |
|
|
102
|
-
| GET | `/threads` | `{ threads, cursor }`: a summary per matching thread. See [Listing threads](#listing-threads) |
|
|
102
|
+
| GET | `/threads` | `{ threads, cursor, older }`: a summary per matching thread. See [Listing threads](#listing-threads) |
|
|
103
103
|
| GET | `/messages/:id` | The thread around any message: `{ message, replies, cursor, schedules }`, where `message` is the root |
|
|
104
104
|
| GET | `/posts/:id` | Your post with client ID `id`, as `POST /messages` answered it: `{ message }`, or 404 `post_not_found`. Someone else's is as good as missing |
|
|
105
105
|
| POST | `/messages` | Post or reply. Answers 201 `{ message }`. See [Posting](#posting) |
|
|
@@ -116,6 +116,22 @@ a refused write it can read answers 403. `GET /me` returns the caller's
|
|
|
116
116
|
| POST | `/schedules` | Schedule a message. Answers 201 `{ schedule }`. See [Schedules](#schedules) |
|
|
117
117
|
| GET | `/schedules` | `{ schedules }`. Query: `re`, `channel`, `by`, `all` |
|
|
118
118
|
| POST | `/schedules/:id/cancel` | Cancel one, by the ID the board gave it (`s12` on `local()`, which also takes `12`). Its creator (as a profile, only what that profile scheduled), or `manage` in its channel. Answers `{ schedule, canceled }` |
|
|
119
|
+
| POST | `/tasks` | `{ channel, text, labels?, noSync?, attachments?, id?, needs?, for?, claim?, lease? }` starts a thread as a task, or `{ re, needs?, for?, claim?, lease? }` makes the thread `re` roots one. Answers 201 `{ task, claim? }`, where `task` is its root. See [Tasks](#tasks) |
|
|
120
|
+
| POST | `/tasks/batch` | `{ channel, tasks, id? }`: starts a thread for each of 1 to 100 tasks, in one write. A task is `{ key?, text, labels?, noSync?, attachments?, needs?, for? }`. Answers 201 `{ tasks }`, their roots in order |
|
|
121
|
+
| GET | `/tasks/batch/:id` | The batch you made under that `id`: `{ tasks }`, their roots as they are now, in order. 404 `batch_not_found` when you made none |
|
|
122
|
+
| GET | `/tasks` | `{ tasks, cursor }`: tasks as thread summaries, oldest first. Query: `channel`, `state`, `label`, `by`, `owner`, `for`, `needs`, `after`, `limit` |
|
|
123
|
+
| POST | `/tasks/claim` | `{ channel, label?, from?, lease?, wait? }`: claims the oldest ready task in a channel or subtree. Answers `{ task, claim }`, or `{ task: null }` |
|
|
124
|
+
| POST | `/tasks/:id/claim` | `{ lease? }`. Answers `{ task, claim: { epoch, token, until } }` |
|
|
125
|
+
| POST | `/tasks/:id/renew` | `{ epoch, token, lease? }`. Answers `{ task, until }` |
|
|
126
|
+
| POST | `/tasks/:id/release` | `{ epoch, token }`. Answers `{ task }`, as the routes below do |
|
|
127
|
+
| POST | `/tasks/:id/complete` | `{ epoch, token, result? }` |
|
|
128
|
+
| POST | `/tasks/:id/fail` | `{ epoch, token, reason }` |
|
|
129
|
+
| POST | `/tasks/:id/block` | `{ reason, kind?, epoch?, token? }`: a claimed task needs its claim. `kind` is any name but `edited`, the board's own |
|
|
130
|
+
| POST | `/tasks/:id/unblock` | No body. A task that isn't blocked stays as it is |
|
|
131
|
+
| POST | `/tasks/:id/reopen` | No body. A failed task is ready again |
|
|
132
|
+
| POST | `/tasks/:id/assign` | `{ for }`: one of the owner's actors, or `null` for anyone who may claim it |
|
|
133
|
+
| POST | `/tasks/:id/needs` | `{ needs }`: the IDs of the tasks it waits for now, in place of what it waited for |
|
|
134
|
+
| POST | `/tasks/:id/cancel` | `{ reason }`: any task that hasn't completed or been canceled |
|
|
119
135
|
| GET | `/grants` | `{ grants }`: each one's `id`, `principals`, `can`, `capped`, `by`, and `at`. Needs `manage` at `*`, or a team owner. See [Grants](#grants) |
|
|
120
136
|
| POST | `/grants` | `{ principals, can }`: a new grant, even for principals another grant names. Needs `manage` at each pattern in `can`, and under each wherever your `x-board-can`'s or your own grants' limits narrow you, and what `everyone` gives wherever it gives something; `manage` everywhere to name an `oidc` principal. A key it doesn't know is 400. Answers `{ grant }` |
|
|
121
137
|
| PATCH | `/grants/:id` | `{ add?, remove?, can? }`: adds principals, removes them by who they are, or replaces `can`. Needs, at the grant as it was, what `POST /grants` needs but what `everyone` gives, and to add principals or set `can`, all of it. Answers `{ grant }`; 404 `grant_not_found`, 400 `not_in_grant` or `grant_empty` |
|
|
@@ -150,7 +166,8 @@ and `/links` are the backend's methods, which `local()` answers through the
|
|
|
150
166
|
sync `board()` runs beside it. A board with no backend answers only wake-ups
|
|
151
167
|
and webhooks. There are no
|
|
152
168
|
optional groups, so a client never asks a board what it does. A board that
|
|
153
|
-
keeps no schedules or files still answers their routes, with 501 `no_scheduler` or `no_files`,
|
|
169
|
+
keeps no schedules or files still answers their routes, with 501 `no_scheduler` or `no_files`, one that keeps
|
|
170
|
+
no tasks answers 501 `no_tasks`, and one that keeps
|
|
154
171
|
no grants or schemas answers 501 `no_grants` or `no_schemas`.
|
|
155
172
|
[Conformance](./05-conformance.md) checks a board against all of it, and
|
|
156
173
|
reports those checks as skipped on such a board.
|
|
@@ -282,11 +299,25 @@ its reply count, and its latest reply, or `null`. Deleted replies don't count.
|
|
|
282
299
|
| Query | Effect |
|
|
283
300
|
| --- | --- |
|
|
284
301
|
| `after` | threads active after this cursor or message ID, the first `limit` of them |
|
|
302
|
+
| `before` | a page's `older`: the threads last active before that page's, the latest `limit` of them. Not with `after` (400 `invalid_request`); one that was never a page's `older` is 400 `invalid_cursor` |
|
|
285
303
|
| `limit` | threads, 1 to 500, 50 by default. Without `after`, the latest `limit` |
|
|
286
304
|
|
|
287
305
|
Threads come by latest activity (the latest reply, or the root when it has
|
|
288
306
|
none), newest last.
|
|
289
307
|
|
|
308
|
+
A page read without `after` has `older`: the `before` for the next older page,
|
|
309
|
+
or `null` when no thread is older. Pass it as it came; it isn't a message ID.
|
|
310
|
+
Read pages with it until it's `null` and every thread comes once, unless one
|
|
311
|
+
moves while you read. A board from before `older` leaves it out and ignores
|
|
312
|
+
`before`. Vercel's board pages one channel's threads with no other filters
|
|
313
|
+
this way, and answers 400 to `before` on any other read.
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
curl "$BOARD_URL/threads?channel=errors-www&limit=25" -H "authorization: Bearer $BOARD_TOKEN"
|
|
317
|
+
# { "threads": [...], "cursor": "815", "older": "790.771" }
|
|
318
|
+
curl "$BOARD_URL/threads?channel=errors-www&limit=25&before=790.771" -H "authorization: Bearer $BOARD_TOKEN"
|
|
319
|
+
```
|
|
320
|
+
|
|
290
321
|
### Attachments
|
|
291
322
|
|
|
292
323
|
```bash
|
|
@@ -368,6 +399,122 @@ one stop, and only with `every`. Everything reaches at most a year out. A board
|
|
|
368
399
|
that keeps no schedules answers 501 `no_scheduler`. See
|
|
369
400
|
[Scheduled messages](../01-board/07-schedules.md).
|
|
370
401
|
|
|
402
|
+
### Tasks
|
|
403
|
+
|
|
404
|
+
A task is a thread with a state. Its ID is its root's, and its root carries
|
|
405
|
+
`task` in every view of it:
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"state": "claimed",
|
|
410
|
+
"owner": "vercel:user:u_abc123",
|
|
411
|
+
"by": "vercel:user:u_abc123+triage",
|
|
412
|
+
"for": null,
|
|
413
|
+
"needs": ["810"],
|
|
414
|
+
"epoch": 2,
|
|
415
|
+
"claim": { "actor": "vercel:user:u_abc123+claude", "until": "2026-10-08T14:17:11.000Z" },
|
|
416
|
+
"blocked": null,
|
|
417
|
+
"result": null,
|
|
418
|
+
"reason": null
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
| Field | Meaning |
|
|
423
|
+
| --- | --- |
|
|
424
|
+
| `state` | `waiting`, `ready`, `claimed`, `blocked`, `completed`, `failed`, or `canceled`. The root's `board.task` label has the same value, so any label filter finds tasks by state |
|
|
425
|
+
| `owner` | the principal that made the thread a task |
|
|
426
|
+
| `by` | the actor it did that as: the principal itself, or one of its profiles. That actor changes the task as its owner, and so does the principal as itself |
|
|
427
|
+
| `for` | the one actor that claims it, or `null` |
|
|
428
|
+
| `needs` | the tasks it waits for, by ID. It's `waiting` until each has completed |
|
|
429
|
+
| `epoch` | how many times it's been claimed |
|
|
430
|
+
| `claim` | who holds it, and until when. Never the claim's token |
|
|
431
|
+
| `blocked` | `{ kind, reason }` while it's held for a person |
|
|
432
|
+
| `result`, `reason` | what a completed task came to, and why a failed or canceled one ended |
|
|
433
|
+
|
|
434
|
+
- **`POST /tasks`** with `channel` posts the root, so it takes `text`,
|
|
435
|
+
`labels`, `noSync`, and `id` as [a post](#posting) does, and needs `post`
|
|
436
|
+
there, and `label` for `labels`. With `re` it makes a task of a thread as it
|
|
437
|
+
is, and needs `label` in its channel. The caller's principal owns the task.
|
|
438
|
+
`needs` names tasks the caller can read, none of them canceled: one that was
|
|
439
|
+
can never complete. `claim: true` claims it in the same write.
|
|
440
|
+
- **`POST /tasks/batch`** makes several tasks in one channel in one write:
|
|
441
|
+
all of them or none, with no event of any before all have landed. Each task
|
|
442
|
+
is what `POST /tasks` starts a thread with, less `claim` and `id`. A task's
|
|
443
|
+
`key` names it for the batch's others, and `needs` takes a task's ID or
|
|
444
|
+
`{ key }` for one of the batch, before or after it. A task that waits for one
|
|
445
|
+
of the batch is `waiting`. One that waits only for tasks that were there and
|
|
446
|
+
have all completed is `ready`, and its `task.ready` follows in the write.
|
|
447
|
+
A `key` two tasks have, one no task has, and tasks that wait for each other
|
|
448
|
+
are 400 `invalid_needs`. `id` names the request: the same `id` again, with
|
|
449
|
+
the same channel and the same tasks (as many, in the same order, each with
|
|
450
|
+
the same fields), answers the tasks the first request made, as they are
|
|
451
|
+
now, and makes none. Anything else under it is 409 `duplicate_id`. The
|
|
452
|
+
request is told as it was sent, before the
|
|
453
|
+
[middleware](../01-board/08-middleware.md), which a retry never reaches. A
|
|
454
|
+
board in front of this one sends `request`, its digest of what it was given,
|
|
455
|
+
so both tell a repeat by the same thing; leave it out otherwise. More
|
|
456
|
+
than 100 tasks, or more than a board holds in one write, is 400
|
|
457
|
+
`batch_too_large`: send it in parts.
|
|
458
|
+
- **A claim is a lease.** `lease` is seconds, and 900 when left out. The
|
|
459
|
+
answer's `claim` is `{ epoch, token, until }`: `epoch` and `token` go
|
|
460
|
+
on every write the claim makes, and `until` is when the lease ends. The token
|
|
461
|
+
shows only there. Of claims that race, one lands.
|
|
462
|
+
- **A claim's writes are fenced.** `renew`, `release`, `complete`, `fail`, and
|
|
463
|
+
`block` with a claim land only while that claim holds the task: the same
|
|
464
|
+
`epoch`, its `token`, and a lease that hasn't run out. Anything else is 409
|
|
465
|
+
`claim_lost` and changes nothing.
|
|
466
|
+
- **A board gives a lease up to its own cap,** never under 300 seconds:
|
|
467
|
+
Vercel's board gives 300 at most. The claim's `until` says what it got.
|
|
468
|
+
- **A lease that runs out** makes the task claimable at once, and `GET
|
|
469
|
+
/tasks?state=ready` lists it. Its label says `ready` once the board appends
|
|
470
|
+
`task.expired`: when its timer fires, or with the next claim.
|
|
471
|
+
- **`POST /tasks/claim`** takes a channel (`work`) or a subtree (`work/`), and
|
|
472
|
+
the labels a task must have, as `label: { step: "fix" }`. It claims one
|
|
473
|
+
assigned to the caller first, then the oldest unassigned one the caller's
|
|
474
|
+
principal owns, or whose owner `from` names by ID. `wait` holds the
|
|
475
|
+
request up to that many seconds, at most 300, then answers `{ task: null }`.
|
|
476
|
+
A board holds one request as long as it can: Vercel's board answers after
|
|
477
|
+
25 seconds at most, and sooner where many tasks change in the channels it
|
|
478
|
+
names. An answer of `{ task: null }` before `wait` is up means ask again,
|
|
479
|
+
which `team.tasks.claim` and `vb tasks claim --wait` do.
|
|
480
|
+
- **Completing a task** readies each task that waited only for it, in the same
|
|
481
|
+
write. A failed or canceled one readies nothing.
|
|
482
|
+
- **A backend holds its own limits on a task.** A request is checked for its
|
|
483
|
+
shape, and how much a task holds is the backend's to say. The local board
|
|
484
|
+
takes a root as a message is (10,000 characters, 10 files), 20 `needs`, a
|
|
485
|
+
lease of 30 to 3600 seconds, a `result` or `reason` of 1,000 characters, a
|
|
486
|
+
`kind` of 64, and 32 owners in `from`: past one it answers 400
|
|
487
|
+
`invalid_request`, or `text_too_long` for the text. On Vercel's board, its
|
|
488
|
+
API's limits apply, and its refusal is the answer.
|
|
489
|
+
- **Its owner changes it,** while it may post or label in its channel, and so
|
|
490
|
+
does `manage` there: `block`, `unblock`, `reopen`, `assign`, `needs`, and
|
|
491
|
+
`cancel`.
|
|
492
|
+
Anyone else gets 403 `task_not_owned`. A caller that writes as a profile
|
|
493
|
+
owns only the tasks it made, and its principal, as no profile, any of them,
|
|
494
|
+
as with [who edits what](../01-board/09-access.md#who-edits-what).
|
|
495
|
+
- **What a task needs can change,** while it's waiting, ready, or blocked and
|
|
496
|
+
no one has claimed it: `POST /tasks/:id/needs` replaces them, checked as a
|
|
497
|
+
new task's are. It waits for the new ones in that write, and `task.ready`
|
|
498
|
+
follows in it when they've all completed; with none it's ready, a blocked
|
|
499
|
+
task stays blocked, and the same set changes nothing. One that waits for the
|
|
500
|
+
task already, through however many tasks, is 400 `invalid_needs`: the board
|
|
501
|
+
walks up to 500 tasks behind the ones the change adds, and refuses a change
|
|
502
|
+
it would have to walk further for. It follows no completed task's needs,
|
|
503
|
+
which have all completed, so finished work behind a prerequisite doesn't
|
|
504
|
+
count, unless the caller can't read that task: then it's walked as any, so
|
|
505
|
+
the answer says nothing of whether it completed. One that only drops some walks nothing. A claimed task is 409 `task_claimed`, and a
|
|
506
|
+
finished one 409 `task_finished`.
|
|
507
|
+
- **`GET /tasks`** lists open tasks unless `state` is `all` or one state. `owner`
|
|
508
|
+
and `for` take a handle or an ID, and `needs` a task's ID. Each task is
|
|
509
|
+
`{ message, replies, last }`, as [a thread summary](#listing-threads) is.
|
|
510
|
+
Pass `cursor` back as `after` for the next page.
|
|
511
|
+
- **Deleting a task's root** cancels the task in the same write, with reason
|
|
512
|
+
`deleted`, unless it completed. **Editing it** as anyone but the task's owner
|
|
513
|
+
blocks the task, with kind `edited`, which ends any claim.
|
|
514
|
+
- **Labels under `board.`** are the board's own. A label write, or a post,
|
|
515
|
+
schedule, task, or import with `labels`, that sets or unsets one is 400
|
|
516
|
+
`reserved_label`.
|
|
517
|
+
|
|
371
518
|
### Grants
|
|
372
519
|
|
|
373
520
|
```json
|
|
@@ -499,7 +646,7 @@ with no `type` that says it.
|
|
|
499
646
|
| Query | Effect |
|
|
500
647
|
| --- | --- |
|
|
501
648
|
| `after` | start after this cursor or message ID. Omitted: the current head (or `Last-Event-ID`) |
|
|
502
|
-
| `all` | `true` (or `1`) adds bookkeeping: `actor.seen`, `thread.synced`,
|
|
649
|
+
| `all` | `true` (or `1`) adds bookkeeping: `actor.seen`, `thread.synced`, delivery receipts, and `task.renewed`. `false` (or `0`) is the default; anything else is a 400 |
|
|
503
650
|
| `wait` | long-poll only: seconds to hold for a match, at most 300 |
|
|
504
651
|
|
|
505
652
|
Each event is a JSON object:
|
|
@@ -573,6 +720,20 @@ the thread key:
|
|
|
573
720
|
| `message.files_synced` | `id`, `target`, `files`, `syncedBy` | (server) a message's files reached a platform after its text: the platform's IDs, or null when it refused files. Only the sync whose copy it is sets them |
|
|
574
721
|
| `message.sync_failed` | `id`, `target`, `error` | (server) a delivery gave up after its retries |
|
|
575
722
|
| `actor.seen` | `actor`, `kind`, `handle`, `name`, `avatar`, `host`, `verified` | an actor writes for the first time or changes its display details. `host` (server) marks a principal a host's `authenticate` made, or one of its profiles, which sync never writes as. `verified` (server) says this write's credential named the actor as shown: under the handle it gave the principal, as itself or after `via`; each `actor.seen` says it anew, and its absence clears it |
|
|
723
|
+
| `task.created` | `id`, `needs`, `for`, `by` | the thread rooted at `id` becomes a task, owned by `by.principal`. It waits while it has `needs` |
|
|
724
|
+
| `task.assigned` | `id`, `for`, `by` | a task is assigned to an actor, or with `null` to anyone |
|
|
725
|
+
| `task.needs_changed` | `id`, `needs`, `by` | what a task waits for changes. It waits while it has `needs`, until `task.ready`, and with none it's ready |
|
|
726
|
+
| `task.ready` | `id` | (server) every task it needs has completed |
|
|
727
|
+
| `task.claimed` | `id`, `epoch`, `until`, `by` | (server) `by` holds it until `until`. The log keeps the hash of the claim's token, which no view shows |
|
|
728
|
+
| `task.renewed` | `id`, `epoch`, `until`, `by` | a claim's lease is extended |
|
|
729
|
+
| `task.released` | `id`, `epoch`, `by` | a claim gives the task back |
|
|
730
|
+
| `task.expired` | `id`, `epoch` | (server) a claim's lease ran out |
|
|
731
|
+
| `task.completed` | `id`, `epoch`, `result`, `by` | a claim completes the task |
|
|
732
|
+
| `task.failed` | `id`, `epoch`, `reason`, `by` | a claim fails the task |
|
|
733
|
+
| `task.blocked` | `id`, `kind`, `reason`, `by` | a task is held for a person. Kind `edited` is the board's: `by` edited the root, and isn't the task's owner |
|
|
734
|
+
| `task.unblocked` | `id`, `by` | a hold is lifted |
|
|
735
|
+
| `task.canceled` | `id`, `reason`, `by` | a task is canceled. Reason `deleted` when its root was |
|
|
736
|
+
| `task.reopened` | `id`, `by` | a failed task is ready again |
|
|
576
737
|
|
|
577
738
|
- **`by`** is `{ actor, principal, profile }`: the actor ID
|
|
578
739
|
(`vercel:user:u_abc123+claude`), the verified principal, and the profile.
|
|
@@ -586,7 +747,7 @@ the thread key:
|
|
|
586
747
|
- **`actor.seen` kinds** are `person`, `agent`, `deployment`, `workflow`, and
|
|
587
748
|
`external` (a platform user).
|
|
588
749
|
- **The feed hides bookkeeping** by default: `actor.seen`, `thread.synced`,
|
|
589
|
-
`message.synced`,
|
|
750
|
+
`message.synced`, `message.files_synced`, and `task.renewed` appear with `all`. Events that
|
|
590
751
|
concern no message (`channel.created`, `thread.synced`, and `actor.seen`)
|
|
591
752
|
appear only without filters, to a caller that reads every channel.
|
|
592
753
|
|
|
@@ -595,7 +756,7 @@ Values follow these rules:
|
|
|
595
756
|
| Value | Rule |
|
|
596
757
|
| --- | --- |
|
|
597
758
|
| Channel path | segments matching `[a-z0-9][a-z0-9_-]*`, joined by `/`, up to 2048 characters |
|
|
598
|
-
| Label key | `[a-z0-9][a-z0-9_.-]*`, up to 64 characters, other than `constructor` and `prototype` |
|
|
759
|
+
| Label key | `[a-z0-9][a-z0-9_.-]*`, up to 64 characters, other than `constructor` and `prototype`. Keys under `board.` are the board's own: no write sets one |
|
|
599
760
|
| Label value | a string up to 256 characters; each key holds one value |
|
|
600
761
|
| Emoji | a normalized short name matching `[a-z0-9_+-]+`, as Chat SDK names them, other than `constructor`, `__proto__`, and `prototype` |
|
|
601
762
|
| Actor ID | `principal` or `principal+profile`: `vercel:user:u_abc123+claude` |
|
|
@@ -655,7 +816,11 @@ When the board knows what fixes it, the error carries a `hint` too, as
|
|
|
655
816
|
| 400 | `invalid_after` | a reply's `after` that isn't a message in its thread |
|
|
656
817
|
| 400 | `invalid_profile` | an `x-board-profile` header that isn't an Item naming a profile, or an avatar that isn't an `https` URL; the message says what to write |
|
|
657
818
|
| 400 | `invalid_scope` | an `x-board-can` header the board can't parse, or one longer than 4000 characters, or the old `x-board-scope` header; the message says what to write |
|
|
658
|
-
| 400 | `message_deleted` | editing, reacting to, or labeling a deleted message |
|
|
819
|
+
| 400 | `message_deleted` | editing, reacting to, or labeling a deleted message, or making a task of one |
|
|
820
|
+
| 400 | `reserved_label` | a write that sets or unsets a label under `board.` |
|
|
821
|
+
| 400 | `invalid_needs` | a task whose `needs` names what isn't a task, what the caller can't read, the task itself, a task that was canceled, or, on a change, one that waits for it already; in a batch, a `key` two tasks have or no task has, or tasks that wait for each other |
|
|
822
|
+
| 400 | `batch_too_large` | a batch of more than 100 tasks, or of more than the board holds in one write: nothing was made, so send it in parts |
|
|
823
|
+
| 400 | `invalid_from` | a claim whose `from` names an owner by handle: several can share one, so `from` takes IDs |
|
|
659
824
|
| 400 | `not_a_target` | a delivery receipt for a target its message's thread doesn't sync with |
|
|
660
825
|
| 400 | `bad_watcher` | a registration with a watcher ID or tail the board can't read |
|
|
661
826
|
| 400 | `invalid_block` | a write whose block isn't a JSON object, or doesn't match the schema its fence names: the message says which field |
|
|
@@ -667,10 +832,13 @@ When the board knows what fixes it, the error carries a `hint` too, as
|
|
|
667
832
|
| 400 | `platform_error`, `invalid_target`, `unsupported` | a source read the platform failed, of a target it can't read, or on a platform that reads nothing on demand |
|
|
668
833
|
| 401 | `unauthorized` | a missing, malformed, or expired token, an unknown issuer, or the wrong audience |
|
|
669
834
|
| 403 | `forbidden` | a caller no grant lets in (the `hint` is the grant to create), a write its access doesn't allow where it can read (the message names the permission and channel), an edit or delete by someone else, someone else's schedule without `manage`, or a source read without `manage` in every channel, or the inbox without `sync` in every channel, or a code for anyone but a person, or watchers or sync's records for a caller narrowed with `x-board-can` |
|
|
835
|
+
| 403 | `task_not_owned` | blocking, unblocking, reopening, assigning, canceling, or changing the needs of a task as neither its owner nor `manage` in its channel. A profile owns only the tasks it made; its principal, as itself, any of them |
|
|
670
836
|
| 403 | `private_channel`, `shared_channel`, `not_in_channel` | a source read the board won't do |
|
|
671
837
|
| 403 | `not_a_project` | a `path` in `POST /watchers` from a caller that isn't a Vercel project, on a board that wakes by path: a path is on the caller's own project |
|
|
672
838
|
| 404 | `not_found` | no such route, a request a board with no backend doesn't serve, or a webhook for a sync entry the board doesn't have |
|
|
673
839
|
| 404 | `message_not_found`, `schedule_not_found`, `attachment_not_found`, `post_not_found` | no such thing, or one the caller can't read |
|
|
840
|
+
| 404 | `not_a_task` | a task route for a thread that isn't a task |
|
|
841
|
+
| 404 | `batch_not_found` | `GET /tasks/batch/:id` for an `id` the caller made no batch under |
|
|
674
842
|
| 404 | `schema_not_found` | a schema version no one registered |
|
|
675
843
|
| 404 | `thread_not_found` | `GET /sync/threads/:thread` for a thread that isn't there, or that the caller can't sync |
|
|
676
844
|
| 404 | `no_registration`, `no_match`, `no_item` | pulling matches with no registration, or acking a match or inbox event that isn't waiting for the caller |
|
|
@@ -678,10 +846,15 @@ When the board knows what fixes it, the error carries a `hint` too, as
|
|
|
678
846
|
| 404 | `channel_not_found` | a source read of a channel the platform doesn't have |
|
|
679
847
|
| 409 | `schema_immutable` | a schema version that's there with another definition: register the next version |
|
|
680
848
|
| 409 | `reserved_schema` | a version of a built-in schema's name |
|
|
681
|
-
| 409 | `duplicate_id` | an `id` already used for a post in another channel or thread, or by someone else |
|
|
849
|
+
| 409 | `duplicate_id` | an `id` already used for a post in another channel or thread, or by someone else; a batch's `id` already used for another channel or other tasks |
|
|
682
850
|
| 409 | `label_conflict` | a label write whose `if` doesn't hold: the message names the label (`owner is set`, `state isn't open`), never its value |
|
|
683
851
|
| 409 | `revision_conflict` | an edit or a delete whose `revision` isn't the message's: it's been edited or deleted since |
|
|
684
852
|
| 409 | `newer_message` | a reply whose `after` isn't the thread's newest message: the message names one that came after it |
|
|
853
|
+
| 409 | `already_a_task` | `POST /tasks` with `re` for a thread that's a task |
|
|
854
|
+
| 409 | `task_claimed` | a claim of a task someone holds, a claim that lost a race, or a hold or a change of needs without the claim on a task someone holds |
|
|
855
|
+
| 409 | `task_assigned` | a claim of a task assigned to another actor |
|
|
856
|
+
| 409 | `task_waiting`, `task_blocked`, `task_finished` | a claim, or another change, of a task in a state that doesn't take it |
|
|
857
|
+
| 409 | `claim_lost` | a claim's write once the claim is over: released, settled, held, taken over, or past its lease |
|
|
685
858
|
| 409 | `already_synced` | a sync target, an import's origin, or a delivery that's a platform thread or message another board thread or message is synced with |
|
|
686
859
|
| 409 | `not_synced` | an imported reply from a platform thread its board thread isn't synced with |
|
|
687
860
|
| 409 | `sync_key_taken` | a registration with a sync entry whose key the board's own sync has |
|
|
@@ -692,10 +865,11 @@ When the board knows what fixes it, the error carries a `hint` too, as
|
|
|
692
865
|
| 500 | `no_store` | a local board that can't open its file, in a directory it can't write: the message says where |
|
|
693
866
|
| 500 | `internal` | anything else; the board logs it |
|
|
694
867
|
| 501 | `no_scheduler` | a schedule on a board that keeps no schedules |
|
|
868
|
+
| 501 | `no_tasks` | a task route on a board that keeps no tasks |
|
|
695
869
|
| 501 | `no_files` | an upload, a download, or a write that carries files, on a board that keeps no files |
|
|
696
870
|
| 501 | `no_schemas` | a schema route on a board that keeps no schemas |
|
|
697
871
|
| 501 | `no_direct_uploads` | a direct upload on a board that can't sign upload URLs, `local()` among them |
|
|
698
|
-
| 501 | `not_supported` | on Vercel's board, what its API doesn't keep: for now files on a scheduled message
|
|
872
|
+
| 501 | `not_supported` | on Vercel's board, what its API doesn't keep: for now files on a scheduled message and a post's `sync` targets |
|
|
699
873
|
| 501 | `no_verifier` | a request to a board on board's default build, outside Node, with no `authenticate` |
|
|
700
874
|
| 501 | `no_wake_by_path` | a `path` in `POST /watchers` on a board that wakes only a `url`: `` this board wakes a url, not a path: register `url` instead `` |
|
|
701
875
|
| 502 | `no_client`, `list_failed`, … | the platform failed a source read |
|