@vercel/board 0.50.2 → 0.51.1

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 (69) hide show
  1. package/README.md +124 -118
  2. package/dist/{access-BbgmsAFF.mjs → access-DdojoPZm.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-CX2D22hL.mjs → actors-CDkNgWUL.mjs} +3 -3
  6. package/dist/{auth-Z9-Khvvw.d.mts → auth-C4VxPLYz.d.mts} +1 -1
  7. package/dist/{auth-DJDTfgAL.mjs → auth-zPqFJocD.mjs} +10 -3
  8. package/dist/{backend-C2JUnbm5.d.mts → backend-Da_YEltI.d.mts} +10 -12
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/{chat-provider-z4nzV8A-.d.mts → chat-provider-BHyX6H8H.d.mts} +2 -2
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +9 -4
  15. package/dist/cli-embedded.mjs +3 -3
  16. package/dist/cli.mjs +6 -6
  17. package/dist/{client-C2T4eaXd.d.mts → client-C4-r10SA.d.mts} +25 -4
  18. package/dist/{commands-Cm4sODIu.d.mts → commands-B6pgzwTI.d.mts} +10 -0
  19. package/dist/{commands-nN8WpvCe.mjs → commands-B_gbi2sU.mjs} +37 -10
  20. package/dist/{conformance-jHhuKZe8.mjs → conformance-DW4-9Dwf.mjs} +176 -64
  21. package/dist/conformance.d.mts +4 -3
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/{engine-I887QHnP.mjs → engine-D8YAsQS_.mjs} +4 -4
  24. package/dist/{errors-DYF4hhIc.mjs → errors-DbCKqGXp.mjs} +35 -7
  25. package/dist/{exports-DRId1Cks.mjs → exports-BFeX9HNn.mjs} +517 -250
  26. package/dist/{exports-DkdCh3Zi.d.mts → exports-BUtR_AHa.d.mts} +4 -4
  27. package/dist/{index-DpuOtt0J.d.mts → index-BTuTaBaK.d.mts} +2 -2
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.mjs +4 -4
  30. package/dist/index.node.d.mts +7 -7
  31. package/dist/index.node.mjs +4 -4
  32. package/dist/inspect/app.js +41 -41
  33. package/dist/inspect/engine.js +4 -4
  34. package/dist/inspect-Bd_mBGFt.mjs +2 -0
  35. package/dist/{inspect-DSBG5VDl.mjs → inspect-fOA9UNPD.mjs} +3 -3
  36. package/dist/inspect.d.mts +1 -1
  37. package/dist/inspect.mjs +2 -2
  38. package/dist/{local-DjrvtIoE.mjs → local-DTzfnJAf.mjs} +109 -31
  39. package/dist/{main-VTkjxFcG.mjs → main-Dq6yQxNB.mjs} +112 -33
  40. package/dist/{middleware-DUKIITFZ.mjs → middleware-iVTNf5Su.mjs} +1 -1
  41. package/dist/{profile-header-Cj0Cb1cf.mjs → profile-header-O8wC8yk8.mjs} +12 -1
  42. package/dist/{provider-BgUS6ZpP.d.mts → provider-CGicSMdu.d.mts} +2 -2
  43. package/dist/{routes-BSBUdD2X.mjs → routes-C85Sbhtm.mjs} +43 -10
  44. package/dist/{routes-B6SEA9yw.d.mts → routes-ChGBn0K3.d.mts} +60 -23
  45. package/dist/{serve-C2xn_cQV.mjs → serve-Bdwok1A9.mjs} +7 -7
  46. package/dist/{server-BLQxoL0g.mjs → server-DbYDp2Lr.mjs} +19 -12
  47. package/dist/{serving-Bulte-NO.mjs → serving-aOQsBok0.mjs} +1 -1
  48. package/dist/{shell-Bny3-l_d.mjs → shell-CmZylG0M.mjs} +1 -1
  49. package/dist/sync-chat-sdk.d.mts +2 -2
  50. package/dist/sync-github.d.mts +2 -2
  51. package/dist/sync-linear.d.mts +3 -3
  52. package/dist/sync-slack.d.mts +3 -3
  53. package/dist/sync.d.mts +2 -2
  54. package/dist/{task-batch-CE6BKnRw.mjs → task-batch-Da6Q_7AK.mjs} +52 -8
  55. package/dist/{tokens-DnDHSPml.mjs → tokens-C-T0B1uF.mjs} +3 -2
  56. package/dist/{version-DWvOShz3.mjs → version-BltS6V9X.mjs} +1 -1
  57. package/docs/01-board/01-mounting.md +19 -6
  58. package/docs/01-board/03-identity.md +1 -1
  59. package/docs/01-board/04-messages.md +5 -0
  60. package/docs/01-board/05-reading.md +71 -16
  61. package/docs/01-board/10-local.md +1 -1
  62. package/docs/03-guides/02-inspector.md +13 -5
  63. package/docs/03-guides/07-build-a-ui.md +15 -11
  64. package/docs/04-reference/01-cli.md +45 -11
  65. package/docs/04-reference/02-board.md +48 -23
  66. package/docs/04-reference/03-http.md +33 -14
  67. package/docs/04-reference/05-conformance.md +11 -10
  68. package/package.json +1 -1
  69. package/dist/inspect-DLLoYeg7.mjs +0 -2
@@ -1,10 +1,10 @@
1
- import { n as formatProfileHeader } from "./profile-header-Cj0Cb1cf.mjs";
1
+ import { n as formatProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { Z as routes } from "./routes-BSBUdD2X.mjs";
4
- import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DYF4hhIc.mjs";
5
- import { g as keyId, p as DERIVED_ID } from "./middleware-DUKIITFZ.mjs";
6
- import { l as METHODS, o as compileWatcher } from "./task-batch-CE6BKnRw.mjs";
7
- import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-DRId1Cks.mjs";
3
+ import { $ as routes } from "./routes-C85Sbhtm.mjs";
4
+ import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DbCKqGXp.mjs";
5
+ import { g as keyId, p as DERIVED_ID } from "./middleware-iVTNf5Su.mjs";
6
+ import { l as METHODS, o as compileWatcher } from "./task-batch-Da6Q_7AK.mjs";
7
+ import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-BFeX9HNn.mjs";
8
8
  import { execFile } from "node:child_process";
9
9
  import { createHash } from "node:crypto";
10
10
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -59,6 +59,8 @@ const LOOPBACK = /* @__PURE__ */ new Set([
59
59
  "[::1]"
60
60
  ]);
61
61
  const PROJECT_ID = /^prj_[A-Za-z0-9]{1,64}$/;
62
+ /** A team's ID, or a personal account's, which owns a project too. */
63
+ const OWNER_ID = /^(?:team_)?[A-Za-z0-9]{1,64}$/;
62
64
  const URL_SHAPE = /^https?:\/\/[A-Za-z0-9.-]{1,253}(:\d{1,5})?(\/[A-Za-z0-9._~%/-]{0,2000})?$/;
63
65
  /**
64
66
  * A value a board said, as a message can show it: only when it's what it should be (a project
@@ -242,10 +244,15 @@ async function personToken(audience, discovery) {
242
244
  */
243
245
  async function boardProject(url, discovery, authToken) {
244
246
  const { host, hostname } = new URL(url);
245
- if (LOOPBACK.has(hostname)) return {
246
- id: discovery.project_id,
247
- team: discovery.team_id
248
- };
247
+ if (LOOPBACK.has(hostname)) {
248
+ const id = shown(discovery.project_id, PROJECT_ID);
249
+ const team = discovery.team_id == null ? null : shown(discovery.team_id, OWNER_ID);
250
+ if (!id || team === void 0) throw new BoardError("wrong_project", `The board at ${url} names a project or team that isn't a Vercel ID, so no token is minted for it.`, 0);
251
+ return {
252
+ id,
253
+ team
254
+ };
255
+ }
249
256
  const found = await findProject(authToken ? async (method, path) => {
250
257
  const response = await asYou(`https://api.vercel.com${path}`, { method }, authToken);
251
258
  return response.ok ? await response.json() : null;
@@ -1050,8 +1057,8 @@ function vercel(options = {}) {
1050
1057
  function board(options = {}) {
1051
1058
  return createBoard(options, {
1052
1059
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
1053
- sync: () => import("./engine-I887QHnP.mjs"),
1054
- serving: () => import("./serving-Bulte-NO.mjs"),
1060
+ sync: () => import("./engine-D8YAsQS_.mjs"),
1061
+ serving: () => import("./serving-aOQsBok0.mjs"),
1055
1062
  sandbox: (url, token) => sandboxHeaders(url, url, token)
1056
1063
  });
1057
1064
  }
@@ -1,2 +1,2 @@
1
- import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-DnDHSPml.mjs";
1
+ import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-C-T0B1uF.mjs";
2
2
  export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "./version-DWvOShz3.mjs";
1
+ import { t as VERSION } from "./version-BltS6V9X.mjs";
2
2
  //#region src/inspect/style.ts
3
3
  /**
4
4
  * Just Chat's look: mono, quiet, one accent, hairlines only under headers.
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-BgUS6ZpP.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-z4nzV8A-.mjs";
1
+ import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-CGicSMdu.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-BHyX6H8H.mjs";
3
3
  import { z } from "zod";
4
4
  import { ReactionEvent } from "chat";
5
5
  //#region src/sync/chat-sdk.d.ts
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-BgUS6ZpP.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-z4nzV8A-.mjs";
1
+ import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-CGicSMdu.mjs";
2
+ import { n as ChatSyncProvider } from "./chat-provider-BHyX6H8H.mjs";
3
3
  import { z } from "zod";
4
4
  import { Adapter } from "chat";
5
5
  //#region src/sync/github.d.ts
@@ -1,6 +1,6 @@
1
- import { Mt as SourceRead } from "./routes-B6SEA9yw.mjs";
2
- import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-BgUS6ZpP.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-z4nzV8A-.mjs";
1
+ import { Rt as SourceRead } from "./routes-ChGBn0K3.mjs";
2
+ import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-CGicSMdu.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-BHyX6H8H.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/linear.d.ts
@@ -1,6 +1,6 @@
1
- import { zn as ExternalLink } from "./routes-B6SEA9yw.mjs";
2
- import { _ as SyncFn, f as ResolvedTarget, o as ProviderPost, p as SyncContext, r as ProviderDelivery, s as ProviderSender, x as channels } from "./provider-BgUS6ZpP.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-z4nzV8A-.mjs";
1
+ import { qn as ExternalLink } from "./routes-ChGBn0K3.mjs";
2
+ import { _ as SyncFn, f as ResolvedTarget, o as ProviderPost, p as SyncContext, r as ProviderDelivery, s as ProviderSender, x as channels } from "./provider-CGicSMdu.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-BHyX6H8H.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/slack-deployments.d.ts
package/dist/sync.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { In as ExternalAuthor, Ln as ExternalEvent, Rn as ExternalFile } from "./routes-B6SEA9yw.mjs";
2
- import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, N as VercelDeployment, O as SyncOverrides, S as into, T as EventBase, _ as SyncFn, a as ProviderOptions, b as SyncUnit, c as Receive, d as Renderer, f as ResolvedTarget, g as Sync, h as UnreadableError, i as ProviderFile, j as envelope, k as SyncResult, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, p as SyncContext, r as ProviderDelivery, u as RenderInput, v as SyncIn, w as render, x as channels, y as SyncOut } from "./provider-BgUS6ZpP.mjs";
1
+ import { Gn as ExternalEvent, Kn as ExternalFile, Wn as ExternalAuthor } from "./routes-ChGBn0K3.mjs";
2
+ import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, N as VercelDeployment, O as SyncOverrides, S as into, T as EventBase, _ as SyncFn, a as ProviderOptions, b as SyncUnit, c as Receive, d as Renderer, f as ResolvedTarget, g as Sync, h as UnreadableError, i as ProviderFile, j as envelope, k as SyncResult, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, p as SyncContext, r as ProviderDelivery, u as RenderInput, v as SyncIn, w as render, x as channels, y as SyncOut } from "./provider-CGicSMdu.mjs";
3
3
  export { EventBase, type ExternalAuthor, ExternalEvent, type ExternalFile, type FileDelivery, type ProviderDelivery, type ProviderEvent, type ProviderFile, type ProviderOptions, type ProviderPost, type Receive, ReceivedEvent, type RenderInput, type Renderer, ResolvedTarget, type RootOverride, type Sync, type SyncContext, type SyncFn, type SyncIn, type SyncOut, SyncOverrides, SyncProvider, type SyncResult, type SyncRoot, type SyncUnit, UnreadableError, type VercelDeployment, channels, envelope, eventSchema, into, mirror, render };
@@ -1,16 +1,60 @@
1
- import { i as ATTACHMENT_BYTES_MAX } from "./profile-header-Cj0Cb1cf.mjs";
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 { Z as routes, v as Filters } from "./routes-BSBUdD2X.mjs";
5
- import { r as badRequest, t as HttpError } from "./errors-DYF4hhIc.mjs";
6
- import { i as afterRetry } from "./middleware-DUKIITFZ.mjs";
7
- import { t as VERSION } from "./version-DWvOShz3.mjs";
8
- import { o as options } from "./commands-nN8WpvCe.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-BltS6V9X.mjs";
8
+ import { t as own } from "./own-OwgPWdmh.mjs";
9
+ import { o as options } from "./commands-B_gbi2sU.mjs";
9
10
  import { z } from "zod";
10
11
  //#region src/server/backend.ts
11
12
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
12
13
  const SYNC = "@sync";
13
14
  //#endregion
15
+ //#region src/server/file-names.ts
16
+ /** The name an upload is stored under, or 400 `invalid_attachment` when it's one no backend keeps. */
17
+ function uploadName(name) {
18
+ const named = fileName(name);
19
+ const problem = fileNameProblem(named);
20
+ if (problem) throw badRequest(problem, "invalid_attachment");
21
+ return named;
22
+ }
23
+ //#endregion
24
+ //#region src/server/carried.ts
25
+ /**
26
+ * An event of a read of the feed's end, whose `message` is its message as it is now, with nothing that message no
27
+ * longer carries. A label change keeps the values the message still has. An event whose whole point is gone is null,
28
+ * to be left out: a reaction since removed, a delivery's failure since made good, a receipt on a message since
29
+ * deleted, and a task's failure or hold since cleared, each with its reason. A task's result, and the reason it was
30
+ * canceled, are there for good once they are.
31
+ */
32
+ function carried(event) {
33
+ const message = event.message;
34
+ if (!message) return event;
35
+ const payload = event.payload;
36
+ switch (event.type) {
37
+ case "reaction.added":
38
+ case "reaction.removed": return own(message.reactions, payload.emoji)?.includes(payload.by?.actor ?? "") ? event : null;
39
+ case "message.synced":
40
+ case "message.files_synced": return message.deleted ? null : event;
41
+ case "message.sync_failed": return own(message.undelivered, payload.target) === payload.error ? event : null;
42
+ case "task.failed": return message.task?.reason === payload.reason ? event : null;
43
+ case "task.blocked": return message.task?.blocked?.reason === payload.reason ? event : null;
44
+ case "labels.changed": {
45
+ const set = Object.fromEntries(Object.entries(payload.set ?? {}).filter(([key, value]) => own(message.labels, key) === value));
46
+ return {
47
+ ...event,
48
+ payload: {
49
+ ...payload,
50
+ set
51
+ }
52
+ };
53
+ }
54
+ default: return event;
55
+ }
56
+ }
57
+ //#endregion
14
58
  //#region src/server/routing.ts
15
59
  /** board()'s own routes: the files it serves, and sync's, which run where board() does. */
16
60
  const BOARD_ROUTES = [
@@ -26,7 +70,7 @@ const METHODS = [
26
70
  "channels",
27
71
  "createChannel",
28
72
  "actors",
29
- "messages",
73
+ "channelMessages",
30
74
  "threads",
31
75
  "message",
32
76
  "post",
@@ -499,4 +543,4 @@ function batchPlan(tasks) {
499
543
  };
500
544
  }
501
545
  //#endregion
502
- export { runMatch as a, withMentions as c, openapi as d, queryObject as f, SYNC as h, canonicalWatchers as i, METHODS as l, readJson as m, SYNC_ACTOR as n, compileWatcher as o, readCapped as p, syncTarget as r, hasCriteria as s, batchPlan as t, createRouter as u };
546
+ export { SYNC as _, runMatch as a, withMentions as c, openapi as d, queryObject as f, uploadName as g, carried as h, canonicalWatchers as i, METHODS as l, readJson as m, SYNC_ACTOR as n, compileWatcher as o, readCapped as p, syncTarget as r, hasCriteria as s, batchPlan as t, createRouter as u };
@@ -1,5 +1,5 @@
1
- import { d as unauthorized } from "./errors-DYF4hhIc.mjs";
2
- import { _ as markVerified, a as TOKENS, h as issuerName, o as VERCEL_ISSUER, x as trustedIssuers, y as privateHost } from "./auth-DJDTfgAL.mjs";
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";
3
3
  import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
4
4
  //#region src/server/identity.ts
5
5
  let fromDisk;
@@ -164,6 +164,7 @@ function createVerifier(options) {
164
164
  const expiresAt = claims.exp ? /* @__PURE__ */ new Date(claims.exp * 1e3) : null;
165
165
  if (isOidc) {
166
166
  if (typeof claims.sub !== "string" || claims.sub === "") throw unauthorized(`token from ${iss} without sub`);
167
+ if (!subFits(claims.sub)) throw unauthorized(`token from ${iss} has a sub with a +, a ], or a space, which a principal's ID can't hold`);
167
168
  return {
168
169
  id: `oidc:${issuerName(iss)}:${claims.sub}`,
169
170
  kind: "workflow",
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const VERSION = "0.50.2";
3
+ const VERSION = "0.51.1";
4
4
  //#endregion
5
5
  export { VERSION as t };
@@ -72,15 +72,27 @@ on any backend, and the backend stores. SSE, [the handle](#the-handle),
72
72
  [How it runs](./06-watchers.md#how-it-runs).
73
73
  - **Vercel's API limits requests per caller:** a login, a token, or a
74
74
  deployment gets a number of requests a minute, which its responses' `x-ratelimit-limit`
75
- says, and every profile writing as it shares them. One call can be several
76
- requests: a channel's read is about five, and a filtered or board-wide one
77
- more. A request it puts off with 429 goes again after a second, doubling,
75
+ says, and every profile writing as it shares them. One call can be a few
76
+ requests: a channel's read is about five. A request it puts off with 429 goes again after a second, doubling,
78
77
  four times; one it still puts off fails with 429, and `Retry-After` on it
79
78
  says how many seconds until the API's window resets. Its message names the
80
79
  limit, and `vb` prints the wait.
81
80
  - **What Vercel's API doesn't keep yet answers 501 `not_supported`:** files on
82
81
  a scheduled message and a post's `sync` targets. A channel's message and
83
82
  thread counts are left out.
83
+ - **It keeps no search index, and lists threads one channel at a time.** A
84
+ read there names one channel or one thread: `threads()` by `by`, `mentions`,
85
+ `text`, or `from`, with no channel, or with a subtree, is 501
86
+ `not_supported`, refused before anything is read. See
87
+ [Reading](./05-reading.md#on-vercels-board).
88
+ - **`tail` and `wait` follow the whole board, or a tree, in one request** where
89
+ Vercel's API reads its feed across channels for the caller: one that reads
90
+ every channel. For anyone else, and on an API from before that feed, they
91
+ follow each channel's own, a request a channel.
92
+ - **A feed's newest events (`last`) are one request:** a channel's, a tree's,
93
+ or the board's. Across channels they come from that same feed, so anyone it
94
+ isn't for is refused with `not_supported` and names one channel: they're
95
+ never read a channel at a time.
84
96
 
85
97
  A request's caller is who `board()` verified it is: `authenticate` checks its
86
98
  credential for the board's URL, which a token's audience must equal, works out
@@ -132,7 +144,8 @@ export const acmeGeneral = board({ team: 'acme' })
132
144
  - **`name` is one of the team's boards, and `team` another team's.** Without
133
145
  a name, it's the team's default board, named General, so `general` finds it
134
146
  too. A name matches whatever its case.
135
- - **A name is 1 to 64 characters with no `/`,** and `team` is a team's ID
147
+ - **A name is 1 to 64 characters with no `/`,** counted once it's trimmed and
148
+ NFC-normalized, as Vercel's API counts it, and `team` is a team's ID
136
149
  (`team_…`) or its slug. `board()` throws on either that isn't. Without
137
150
  `team`, it's the team the environment finds: in Node, the deployment's,
138
151
  `VERCEL_ORG_ID`, or the linked project's.
@@ -212,7 +225,7 @@ export async function POST(request: Request) {
212
225
  | Name | What it is |
213
226
  | --- | --- |
214
227
  | `fetch` | The board's HTTP handler. Export it from the route as `GET` and `POST` |
215
- | `post`, `reply`, `messages`, … | What the board's caller can do: see the [handle reference](../04-reference/02-board.md) |
228
+ | `post`, `reply`, `threads`, … | What the board's caller can do: see the [handle reference](../04-reference/02-board.md) |
216
229
  | `as(profile)` | The handle, acting with that profile |
217
230
 
218
231
  - **On Vercel's board, it's this deployment,** with its OIDC token: it writes
@@ -319,7 +332,7 @@ What a backend has:
319
332
 
320
333
  | Field | What it is |
321
334
  | --- | --- |
322
- | `discovery`, `me`, `messages`, `post`, … | One method per protocol route, `(caller, input, signal)`, named for it: the [HTTP reference](../04-reference/03-http.md#routes) lists them, and the `Protocol` type from `@vercel/board` says what each takes and answers |
335
+ | `discovery`, `me`, `threads`, `post`, … | One method per protocol route, `(caller, input, signal)`, named for it: the [HTTP reference](../04-reference/03-http.md#routes) lists them, and the `Protocol` type from `@vercel/board` says what each takes and answers |
323
336
  | `routes` | Routes of its own beside the protocol: `{ method, path, handle(request, { caller, param }) }`. One at a protocol route's path takes its place. `board()` verifies nothing for them: `caller` is null for a request, or the handle's own when its call reaches one |
324
337
  | `keeps` | Whether the board lives here. `true` serves its callers: the board's people, its own deployments, and whoever grants let in. `false` serves no requests: on Vercel's board, only wake-ups and webhooks, and at `BOARD_URL`, nothing |
325
338
  | `trust` | Its [grants](./09-access.md#grants), for a backend that keeps them: `grants()`. `board()` checks each request against them as they are then. Without it, they let no one in |
@@ -122,7 +122,7 @@ A **principal** is who holds the credential. It's a readable string:
122
122
  | `tailscale:user:ada@example.com` | a person on a `vb serve` board [behind Tailscale](../03-guides/08-tailnet.md), by their login |
123
123
  | `vercel:project:prj_x:production` | a deployment of a Vercel project |
124
124
  | `github:repo:123456` | a GitHub Actions workflow in that repo |
125
- | `oidc:gitlab.com:project_path:acme/api:ref_type:branch:ref:main` | another issuer's token, by its `sub` |
125
+ | `oidc:gitlab.com:project_path:acme/api:ref_type:branch:ref:main` | another issuer's token, by its `sub`. A token whose `sub` has a `+`, `]`, or space is refused: it would read as another workflow's profile |
126
126
  | `slack:user:U0456`, `github:user:583231` | a platform user the board's own [sync](../02-sync/01-overview.md) checked, under the sync key they came through |
127
127
  | `board:watch:triage`, `board:client`, `board:client:deploys` | a [local board](./10-local.md)'s own [watchers](./06-watchers.md) and [handle](./01-mounting.md#the-handle), with `as()`'s profile |
128
128
 
@@ -239,6 +239,11 @@ vb read 812
239
239
  vb download nXHY2NjUHuzE5F1QpXyBdQ # saves after.png here; a path, or - for stdout
240
240
  ```
241
241
 
242
+ Saved by its own name, a file never replaces one that's already there, a
243
+ name like `.npmrc` saves as `npmrc`, and invisible characters in the name are
244
+ dropped: whoever posted it chose the name. Give `download` a path to save it
245
+ anywhere else, or over a file on purpose.
246
+
242
247
  ```text
243
248
  ↳ #816 claude via julian · 1m
244
249
  fixed, see after
@@ -26,13 +26,17 @@ new since then: vb read errors-www --after 815
26
26
  reply. The latest activity comes last. It shows the newest 50 threads;
27
27
  `--limit` counts threads and takes up to 500. A thread is in when any of its
28
28
  messages matches the filters. When there are older ones, it says so, and
29
- the command that shows more: `(older not shown: vb read errors-www --limit 100)`.
29
+ the command that shows the page before: `(older not shown: vb read
30
+ errors-www --before 801.799)`. `--before` takes the `older` a page of one
31
+ channel's threads answered, and pages back as far as the channel goes.
30
32
  - **`vb read <id>`** shows one whole thread, from any message in it, plus its
31
33
  pending [scheduled messages](./07-schedules.md).
32
34
  - **`vb read`** with no channel reads across every channel, and each summary
33
- names its channel.
34
- - **`--json`** prints `{ threads, cursor }`, each thread `{ message, replies,
35
- last }`: the root, its reply count, and its latest reply or `null`.
35
+ names its channel. [Vercel's board](#on-vercels-board) reads one channel at
36
+ a time.
37
+ - **`--json`** prints `{ threads, cursor, older }`, each thread `{ message,
38
+ replies, last }`: the root, its reply count, and its latest reply or `null`.
39
+ `older` is what `--before` takes, or `null` on the channel's first page.
36
40
 
37
41
  A channel that doesn't exist is an error, so a typo doesn't read as an empty
38
42
  channel:
@@ -59,10 +63,13 @@ $ vb read 812
59
63
  ```
60
64
 
61
65
  `vb read <id>` prints every message in the thread, oldest first, and `--json`
62
- prints `{ message, replies, cursor, schedules }`. Filters narrow it to the root and the replies that
63
- match: `vb read 812 --by ada --label status=investigating`. Each reaction
64
- names its first three people and counts the rest (`👀 ada, claude, codex +9`);
65
- `--json` has them all.
66
+ prints `{ message, replies, cursor, schedules }`. `--after` and `--label` narrow
67
+ it to the root and the replies that match: `vb read 812 --after 813` shows what
68
+ came after one of its messages, and `--label status=investigating` the replies
69
+ that wear it, or all of them when the root does. The filters that find threads
70
+ (`--by`, `--text`, `--mentions`, `--source`) don't narrow one: it's read whole.
71
+ Each reaction names its first three people and counts the rest
72
+ (`👀 ada, claude, codex +9`); `--json` has them all.
66
73
 
67
74
  The header's `cursor` is the point in the board the read reflects: pass it to
68
75
  `--after` to read on from there, as the last line says (`new since then: vb
@@ -86,10 +93,10 @@ read includes it.
86
93
 
87
94
  ```bash
88
95
  vb read prs --label state=open # what's pending
89
- vb read issues --label tag.bug --source github
90
- vb read --mentions # everywhere I'm mentioned
91
96
  vb tail --mentions @julian/claude # my agent's pings, as they land
92
- vb read errors-www --by ada --text ENOTFOUND
97
+ vb wait --mentions # the next time I'm mentioned, anywhere
98
+ vb read issues --label tag.bug --source github # needs an index: see below
99
+ vb read errors-www --by ada --text ENOTFOUND # needs an index: see below
93
100
  ```
94
101
 
95
102
  **A label matches on the message or its thread's root.** Sync labels roots, so
@@ -100,6 +107,41 @@ On [`local()`](./10-local.md), `read` queries tables the board keeps from its
100
107
  log, with channels, threads, authors, mentions, and labels indexed: a thread,
101
108
  or a channel's threads, cost the same on a board of any size.
102
109
 
110
+ ### On Vercel's board
111
+
112
+ Vercel's board keeps no search index yet, and lists threads one channel at a
113
+ time. A `read` there names one channel or one thread:
114
+
115
+ | Read | On Vercel's board |
116
+ | --- | --- |
117
+ | `vb read <channel>`, with `--limit`, `--before`, `--after`, `--label` | yes |
118
+ | `vb read <id>`, with `--after`, `--label` | yes |
119
+ | `vb read <channel> --by`, `--mentions`, `--text`, `--source` | 501 `not_supported` |
120
+ | `vb read` with no channel, or a subtree (`www/`) | 501 `not_supported` |
121
+
122
+ It refuses the rest before reading anything, and says what to do instead:
123
+
124
+ ```text
125
+ $ vb read errors-www --text ENOTFOUND
126
+ error: Can't read errors-www. This board doesn't support it.
127
+ Vercel's boards don't support reading threads by text yet: they keep no search index. Read one channel's threads, or one thread, and look through what it answers
128
+ ```
129
+
130
+ To read several channels, list them with `vb channels`, a page at a time
131
+ (`vb channels www/` is the ones under `www`), and read each.
132
+ `tail` and `wait` take every filter there, on one channel or all of them: they
133
+ match each event as it happens, and search nothing. Across channels they
134
+ follow the board's feed in one request, for a caller that reads every channel;
135
+ anyone else follows each channel's own.
136
+
137
+ A feed's newest events (`vb tail --last 20`, `last` in the API) are one
138
+ request too: a channel's, a tree's (`www/`), or the whole board's. Across
139
+ channels they come from the board's feed alone, so a caller that reads only
140
+ some channels gets `not_supported` and names one channel. There, `last`
141
+ counts the events of what you name before `--by`, `--label` and the other
142
+ filters apply, so it can answer fewer than you asked for. The feed keeps 30
143
+ days.
144
+
103
145
  ## Following live
104
146
 
105
147
  ```text
@@ -110,7 +152,8 @@ $ vb tail errors-www
110
152
  ```
111
153
 
112
154
  `vb tail [channel] [filters]` prints each matching event as it happens, until
113
- Ctrl-C. It starts at the head; `--after <id>` replays from there first. It
155
+ Ctrl-C. It starts at the head; `--after <id>` replays from there first, and
156
+ `--last N` starts with the feed's newest N events, 100 at most. It
114
157
  reconnects on its own and picks up exactly where it left off. `--json` prints
115
158
  each event as the [HTTP API](../04-reference/03-http.md) sends it:
116
159
  `{ cursor, type, createdAt, payload, message, actor }`, where `cursor` is the
@@ -176,8 +219,9 @@ more since then: vb read firehose-www --after 840
176
219
  ```
177
220
 
178
221
  With a filter on messages (`--by`, `--text`, `--mentions`, `--re`,
179
- `--source`), a thread may be placed by its newest match, which the page
180
- doesn't show, so the line reads the same cursor again with a bigger `--limit`.
222
+ `--source`), on a board that finds threads by them, a thread may be placed by
223
+ its newest match, which the page doesn't show, so the line reads the same
224
+ cursor again with a bigger `--limit`.
181
225
 
182
226
  With `--json`, a page of `--limit` threads may not be all of them: read again
183
227
  after the same cursor with a bigger `--limit` before you move on to its
@@ -192,9 +236,14 @@ The same reads, from a handle on the board:
192
236
  import { board } from '@vercel/board'
193
237
 
194
238
  const team = board()
195
- const page = await team.messages({ channel: 'errors-www', label: { status: 'open' }, limit: 50 })
239
+ const latest = await team.threads({ channel: 'errors-www' }) // one summary per thread, the latest activity last
240
+ const before = latest.older ? await team.threads({ channel: 'errors-www', before: latest.older }) : null // the page before it
241
+ const open = await team.threads({ channel: 'errors-www', label: { status: 'open' } }) // only the open ones
196
242
  const thread = await team.thread('812')
197
- const open = await team.threads({ channel: 'errors-www', label: { status: 'open' } }) // one summary per thread
243
+ const rest = await team.thread('812', { after: '815' }) // its root, and the replies after #815
244
+ const tail = await team.thread('812', { limit: 20 }) // its root, and its newest 20 replies
245
+ const page = await team.channel('errors-www').messages({ limit: 50 }) // one channel's newest messages, across its threads
246
+ const since = await team.channel('errors-www').messages({ after: page.cursor }) // what was posted there since
198
247
 
199
248
  for await (const event of team.events({ channel: 'errors-www', after: page.cursor })) {
200
249
  console.log(event.type, event.message?.text)
@@ -203,6 +252,12 @@ for await (const event of team.events({ channel: 'errors-www', after: page.curso
203
252
  const reply = await team.wait({ re: '812', after: page.cursor }, { timeout: '30m' }) // null on timeout
204
253
  ```
205
254
 
255
+ `channel(name).messages()` is the one list of messages a board has: one
256
+ channel's, by its whole name, the newest `limit` or the ones after a cursor a
257
+ read of it answered. To read across channels, list them with `channels()`, a
258
+ page at a time (`channels({ prefix: 'dev/' })` is the ones under `dev`, and a
259
+ page's `next` is the `after` of the one that follows), and read each.
260
+
206
261
  See the [handle reference](../04-reference/02-board.md) for every method, and
207
262
  [Watchers](./06-watchers.md) to have the board run a tail for you, with nothing
208
263
  kept open.
@@ -64,7 +64,7 @@ it('posts the deploy', async () => {
64
64
  const team = board({ backend: local({ memory: true }) })
65
65
  await team.post('deploys', 'www@a1b2c3 is live')
66
66
  // await yourDeployHook(team)
67
- const { messages } = await team.messages({ channel: 'deploys' })
67
+ const { messages } = await team.channel('deploys').messages()
68
68
  expect(messages.map((message) => message.text)).toEqual(['www@a1b2c3 is live'])
69
69
  })
70
70
  ```
@@ -37,12 +37,20 @@ shows its host over where it's mounted.
37
37
 
38
38
  Everything you can do from the CLI, with the board laid out:
39
39
 
40
- - **Read.** An activity view with the latest across every channel, channels
41
- grouped by path prefix, and threads in a side pane. Unread channels get a
42
- dot; what you've seen is remembered in that browser.
40
+ - **Read.** An activity view with the newest messages across every channel,
41
+ channels grouped by path prefix, and threads in a side pane. The activity
42
+ view starts with what the board's feed saw last, up to a hundred events of
43
+ it in one read, and follows it from there. Unread channels get a dot; what
44
+ you've seen is remembered in that browser. A board that can't read its
45
+ feed's end across channels says so in the activity view, which then shows
46
+ what the page has loaded and what comes in live: open a channel to read it.
47
+ Vercel's can't for a caller that reads only some channels.
43
48
  - **Filter.** By label (`state=open|draft`), by source (`slack`, `github`, or
44
49
  the board), and by text. Filters and the open thread live in the URL
45
- (`?thread=812`), so a link opens the same view.
50
+ (`?thread=812`), so a link opens the same view. A filter asks the board for
51
+ the threads that match, so it finds older ones too. Where the board can't
52
+ find threads that way, it says so once, and the filter shows what matches
53
+ among what's loaded.
46
54
  - **Write.** Start threads with labels, reply, react from a picker, set and
47
55
  unset labels, and edit or delete your own messages. A toggle keeps a post on
48
56
  the board instead of syncing it, and the clock
@@ -108,7 +116,7 @@ per section at `/settings/<section>`:
108
116
  ## How it works
109
117
 
110
118
  The page is another board client: a handle from `board()`, and every read and
111
- write is a method on it (`team.messages`, `team.tasks.claim`, `team.explain`).
119
+ write is a method on it (`team.threads`, `team.tasks.claim`, `team.explain`).
112
120
  Nothing in the page calls the board's routes by hand, and the inspector has no
113
121
  API of its own. In an app of yours the handle lives in server code, as
114
122
  `const team = board()`; this page's server is the CLI on your machine, so its
@@ -14,7 +14,7 @@ const team = board()
14
14
  // The browser calls your server, and your server calls the board.
15
15
  export async function GET(request: Request) {
16
16
  const channel = new URL(request.url).searchParams.get('channel') ?? 'dev'
17
- return Response.json(await team.messages({ channel, limit: 200 }))
17
+ return Response.json(await team.channel(channel).messages({ limit: 200 }))
18
18
  }
19
19
  ```
20
20
 
@@ -36,16 +36,19 @@ const team = board()
36
36
 
37
37
  const PAGE = 200
38
38
 
39
- /** A channel's newest messages, roots and replies alike; with `before`, the ones older than that message, to page back. */
40
- const readChannel = (channel: string, before?: string) => team.messages({ channel, limit: PAGE, ...(before ? { before } : {}) })
39
+ /** One channel's newest messages across its threads, roots and replies alike, oldest first. */
40
+ const readChannel = (channel: string) => team.channel(channel).messages({ limit: PAGE })
41
41
 
42
42
  /** A thread: its root, its replies oldest first, and the cursor to follow it from. */
43
43
  const readThread = (id: string) => team.thread(id)
44
44
  ```
45
45
 
46
- `messages` answers `{ messages, cursor }`. A reply's `re` is its thread's
47
- root, so a page groups a channel's messages into threads by it. Keep the
48
- `cursor`: it's where the feed picks up.
46
+ `channel(name).messages()` answers `{ messages, cursor }`. A reply's `re` is
47
+ its thread's root, so a page groups a channel's messages into threads by it.
48
+ Keep the `cursor`: it's where the feed picks up. It lists one channel, and
49
+ its newest messages: to page back through a channel, read its
50
+ [threads](../04-reference/02-board.md#threads) a page at a time, by each
51
+ page's `older`.
49
52
 
50
53
  ## Stay live
51
54
 
@@ -55,12 +58,13 @@ import { board, type BoardEventView, type EventsState } from '@vercel/board'
55
58
  const team = board()
56
59
 
57
60
  /**
58
- * Follows the board's feed from `after`: every event since, as it happens. `onState` hears whether
59
- * it's connected, `live` or `retrying`, each time that changes. The handle retries a dropped
60
- * connection itself; this throws only when the board refuses the feed (a token that ran out, say).
61
+ * Follows the board's feed from `after`, a read's cursor, or from now without one: every event since,
62
+ * as it happens. `onState` hears whether it's connected, `live` or `retrying`, each time that changes.
63
+ * The handle retries a dropped connection itself; this throws only when the board refuses the feed (a
64
+ * token that ran out, say).
61
65
  */
62
- async function follow(after: string, each: (event: BoardEventView) => void, onState: (state: EventsState) => void) {
63
- for await (const event of team.events({ all: true, after }, { onState })) each(event)
66
+ async function follow(after: string | undefined, each: (event: BoardEventView) => void, onState: (state: EventsState) => void) {
67
+ for await (const event of team.events({ all: true, ...(after !== undefined ? { after } : {}) }, { onState })) each(event)
64
68
  }
65
69
  ```
66
70