@vercel/board 0.35.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/access.d.mts +2 -2
  2. package/dist/access.mjs +1 -1
  3. package/dist/{actors-DFOpTw89.mjs → actors-uoD62kiN.mjs} +1 -0
  4. package/dist/{auth-C21V0EK1.d.mts → auth-BHXgi696.d.mts} +1 -1
  5. package/dist/{backend-D21q8mdm.d.mts → backend-BIvl2z1z.d.mts} +3 -9
  6. package/dist/backend-local.d.mts +1 -1
  7. package/dist/backend-local.mjs +1 -1
  8. package/dist/{chat-provider-9hCT654s.mjs → chat-provider-C0WUS3-G.mjs} +2 -2
  9. package/dist/{chat-provider-DmZCmBkb.d.mts → chat-provider-DFYEReZL.d.mts} +2 -2
  10. package/dist/cli-commands.d.mts +1 -1
  11. package/dist/cli-commands.mjs +1 -1
  12. package/dist/cli-embedded.d.mts +18 -2
  13. package/dist/cli-embedded.mjs +22 -4
  14. package/dist/cli.mjs +50 -676
  15. package/dist/{commands-CENWob9m.mjs → commands-D2pFCMSh.mjs} +19 -6
  16. package/dist/{commands-BorACIFS.d.mts → commands-DGID-4Z2.d.mts} +4 -2
  17. package/dist/{conformance-CKrwglzA.mjs → conformance-rCrc_mwi.mjs} +2 -3
  18. package/dist/conformance.d.mts +1 -1
  19. package/dist/conformance.mjs +1 -1
  20. package/dist/digest-CLGw7653.mjs +4 -0
  21. package/dist/{engine-wN7quvbU.mjs → engine-COa73McY.mjs} +17 -13
  22. package/dist/{events-IQg0k281.mjs → events-v8f7pF9f.mjs} +22 -8
  23. package/dist/exports-Bb0m03fT.d.mts +4 -0
  24. package/dist/{exports-GIRJm2Ja.mjs → exports-DTezg4xR.mjs} +776 -173
  25. package/dist/{external-CYe424fO.mjs → external-BA2aCC_3.mjs} +1 -1
  26. package/dist/{index-LREsSZb2.d.mts → index-B1TZrMMu.d.mts} +2 -2
  27. package/dist/index.d.mts +5 -5
  28. package/dist/index.mjs +3 -3
  29. package/dist/index.node.d.mts +5 -5
  30. package/dist/index.node.mjs +2 -2
  31. package/dist/inspect/app.js +35 -35
  32. package/dist/inspect/engine.js +5 -5
  33. package/dist/inspect-B8c0Wh5Z.mjs +2 -0
  34. package/dist/inspect-CoFk2Xj7.mjs +643 -0
  35. package/dist/{local-yKwdgukb.mjs → local-Cm7a7_Q0.mjs} +14 -69
  36. package/dist/{main-DjokcEAL.mjs → main-DoZ8IFPb.mjs} +17 -13
  37. package/dist/{memory-7RRnLa4X.mjs → memory-DqwXlyK4.mjs} +2 -2
  38. package/dist/{middleware-BxgizazV.mjs → middleware-k_XKQ6f7.mjs} +9 -1
  39. package/dist/page-BAQpb-s-.mjs +2 -0
  40. package/dist/page-LysMGAl3.mjs +30 -0
  41. package/dist/{provider-DEOfc4Ls.d.mts → provider-7pOnK8Jw.d.mts} +5 -3
  42. package/dist/{routes-BpKdMvgX.d.mts → routes-BtsZzal-.d.mts} +0 -17
  43. package/dist/{serve-CJ8hauK2.mjs → serve-2U_JPJtS.mjs} +2 -2
  44. package/dist/{server-CtaTtyhw.mjs → server-Drul_uwj.mjs} +18 -10
  45. package/dist/{sql-BQzKUqQt.mjs → sql-aetuEBZC.mjs} +1 -1
  46. package/dist/{sqlite-DCtZFEVm.mjs → sqlite-DvsB8ENQ.mjs} +2 -2
  47. package/dist/{sqlite-db-qLTs52Ny.mjs → sqlite-db-BPwRoDI7.mjs} +1 -1
  48. package/dist/sync-chat-sdk.d.mts +2 -2
  49. package/dist/sync-chat-sdk.mjs +2 -2
  50. package/dist/sync-github.d.mts +2 -2
  51. package/dist/sync-github.mjs +2 -2
  52. package/dist/sync-linear.d.mts +3 -3
  53. package/dist/sync-linear.mjs +2 -2
  54. package/dist/sync-slack.d.mts +3 -3
  55. package/dist/sync-slack.mjs +3 -3
  56. package/dist/sync.d.mts +2 -2
  57. package/dist/sync.mjs +2 -2
  58. package/dist/{targets-n2i2ZOWI.mjs → targets-B0D4tJDY.mjs} +64 -19
  59. package/docs/01-board/01-mounting.md +11 -8
  60. package/docs/01-board/03-identity.md +3 -2
  61. package/docs/01-board/06-watchers.md +71 -40
  62. package/docs/01-board/09-access.md +1 -1
  63. package/docs/01-quickstart.md +1 -1
  64. package/docs/02-sync/01-overview.md +7 -7
  65. package/docs/02-sync/02-functions.md +5 -8
  66. package/docs/02-sync/03-slack.md +0 -8
  67. package/docs/02-sync/04-github.md +0 -8
  68. package/docs/02-sync/07-linear.md +0 -6
  69. package/docs/03-guides/01-coding-agents.md +1 -0
  70. package/docs/03-guides/02-inspector.md +3 -2
  71. package/docs/03-guides/03-ci.md +1 -1
  72. package/docs/03-guides/04-triage.md +8 -13
  73. package/docs/04-reference/01-cli.md +32 -8
  74. package/docs/04-reference/02-board.md +5 -0
  75. package/docs/04-reference/03-http.md +1 -1
  76. package/docs/04-reference/05-conformance.md +1 -1
  77. package/docs/index.md +3 -10
  78. package/package.json +2 -1
  79. package/dist/attempts-HXcskN1w.mjs +0 -10
  80. package/dist/exports-BxljH73E.d.mts +0 -4
@@ -1,7 +1,8 @@
1
1
  import { m as DIRECT_UPLOAD_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-rYDxZEuN.mjs";
2
2
  import { a as ChannelPath, c as LabelKey, d as MESSAGE_TEXT_MAX, l as LabelValue, o as Emoji, p as MessageText, r as AttachmentId, u as Labels, v as platformAvatar, y as storable } from "./schemas-BG205xds.mjs";
3
- import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-CYe424fO.mjs";
4
- import { o as options } from "./commands-CENWob9m.mjs";
3
+ import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-BA2aCC_3.mjs";
4
+ import { i as afterRetry } from "./middleware-k_XKQ6f7.mjs";
5
+ import { o as options } from "./commands-D2pFCMSh.mjs";
5
6
  import { n as replaceMentions, t as extractMentions } from "./mentions-CB6ShY4R.mjs";
6
7
  import { z } from "zod";
7
8
  //#region src/api/routes.ts
@@ -230,10 +231,7 @@ const InboxQuery = z.object({
230
231
  });
231
232
  /** What every registration carries: its watchers' tails, and its sync entries. */
232
233
  const Registering = z.object({
233
- watch: z.record(z.string().max(100), z.object({
234
- tail: z.string().max(1e3),
235
- when: z.enum(["matches", "enters"]).default("matches")
236
- })).refine((watch) => Object.keys(watch).length <= 32, `a board registers at most 32 watchers`),
234
+ watch: z.record(z.string().max(100), z.object({ tail: z.string().max(1e3) })).refine((watch) => Object.keys(watch).length <= 32, `a board registers at most 32 watchers`),
237
235
  /**
238
236
  * Its sync entries: its sync subscribes too, to every post, change, and thread sync in the channels
239
237
  * where it may sync, and the board lists the entries.
@@ -764,7 +762,7 @@ const routes = {
764
762
  };
765
763
  //#endregion
766
764
  //#region src/version.ts
767
- const VERSION = "0.35.0";
765
+ const VERSION = "0.37.0";
768
766
  //#endregion
769
767
  //#region src/server/backend.ts
770
768
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -975,13 +973,25 @@ const FILTER_FLAGS = {
975
973
  source: options.source,
976
974
  text: options.text
977
975
  };
978
- /** `--mentions` alone means mentions of me; `--mentions @ada`, mentions of ada. */
976
+ /**
977
+ * What `--mentions` takes as its value when it's the next word: `@ada`, `ada@vercel.com`, or `me`.
978
+ * A channel never has an `@`, and a flag (`--text=a@b`) is never the value.
979
+ */
980
+ const mentionValue = (word) => word !== void 0 && !word.startsWith("-") && (word === "me" || word.includes("@"));
981
+ /**
982
+ * `--mentions` alone means mentions of me; `--mentions @ada`, mentions of ada; `--mentions
983
+ * ada@vercel.com`, of the user with that email. Nothing after `--` is a flag.
984
+ */
979
985
  function withMentions(args) {
980
986
  const out = [];
981
987
  for (let i = 0; i < args.length; i++) {
982
988
  const arg = args[i];
989
+ if (arg === "--") {
990
+ out.push(...args.slice(i));
991
+ break;
992
+ }
983
993
  if (arg !== "--mentions") out.push(arg);
984
- else if (args[i + 1]?.startsWith("@")) out.push(`--mentions=${args[++i]}`);
994
+ else if (mentionValue(args[i + 1])) out.push(`--mentions=${args[++i]}`);
985
995
  else out.push("--mentions=me");
986
996
  }
987
997
  return out;
@@ -1094,16 +1104,55 @@ function compileWatcher(id, spec) {
1094
1104
  throw new Error(`watch ${id}: ${error.message}`);
1095
1105
  }
1096
1106
  if (filters.mentions === "me") throw new Error(`watch ${id}: a watcher has no "me": use --mentions @handle`);
1097
- const criteria = hasCriteria(filters);
1098
- if (spec.when === "enters" && !criteria) throw new Error(`watch ${id}: \`when: enters\` needs a filter to enter`);
1099
1107
  return {
1100
1108
  filters,
1101
- criteria,
1102
- enters: spec.when === "enters",
1109
+ criteria: hasCriteria(filters),
1103
1110
  all
1104
1111
  };
1105
1112
  }
1106
1113
  //#endregion
1114
+ //#region src/server/watch-run.ts
1115
+ /**
1116
+ * A2 dead-letters an event after 10 failures, and a dead letter stops its
1117
+ * lane, which is the thread's: the watcher would never run on that thread
1118
+ * again. So `run` gets a few tries, then the failure is recorded and the
1119
+ * thread moves on.
1120
+ */
1121
+ const RUN_ATTEMPTS = 5;
1122
+ /**
1123
+ * A run that's killed (a timeout, out of memory) never throws. A2 counts it
1124
+ * toward the 10 failures when the next attempt takes over, and dead-letters
1125
+ * the event at that takeover instead of running it: the 10th attempt is the
1126
+ * last one a watcher sees. Throws give up at RUN_ATTEMPTS, so getting this far
1127
+ * means runs keep dying, and the 10th records the failure without running.
1128
+ */
1129
+ const KILLED_ATTEMPTS = 10;
1130
+ const describe = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
1131
+ /**
1132
+ * One match, on its thread's lane: `run`, retried while it fails (by A2 on a local board, by the
1133
+ * tail on a person's Vercel board), then given up on and recorded so the thread's next event runs.
1134
+ */
1135
+ async function runMatch(input) {
1136
+ const { watcher, match, attempt } = input;
1137
+ const event = match.payload.event;
1138
+ const giveUp = async (error) => {
1139
+ console.error(`[board] watcher ${watcher.id} gave up on event #${event.cursor} after ${attempt} tries:`, error);
1140
+ await input.record({
1141
+ matched: match.id,
1142
+ thread: match.payload.thread,
1143
+ error
1144
+ });
1145
+ };
1146
+ const early = !afterRetry(attempt);
1147
+ if (early && attempt >= KILLED_ATTEMPTS) return giveUp(`its run was cut short ${attempt - 1} times (a timeout, or out of memory)`);
1148
+ try {
1149
+ await watcher.run(event);
1150
+ } catch (error) {
1151
+ if (!early || attempt < RUN_ATTEMPTS) throw error;
1152
+ await giveUp(describe(error));
1153
+ }
1154
+ }
1155
+ //#endregion
1107
1156
  //#region src/server/watchers-hash.ts
1108
1157
  /** By UTF-16 code unit, as `sort()` orders strings: the same in every locale and runtime. */
1109
1158
  const byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0;
@@ -1112,11 +1161,7 @@ const byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0;
1112
1161
  * whether its sync subscribes, and the board it uses hashes what it holds.
1113
1162
  */
1114
1163
  function canonicalWatchers(watch, sync = []) {
1115
- const canonical = Object.keys(watch).sort(byCodeUnit).map((id) => [
1116
- id,
1117
- watch[id].tail,
1118
- watch[id].when
1119
- ]);
1164
+ const canonical = Object.keys(watch).sort(byCodeUnit).map((id) => [id, watch[id].tail]);
1120
1165
  if (sync.length > 0) canonical.push(["sync", [...sync].sort((a, b) => byCodeUnit(a.key, b.key)).map((entry) => [entry.key, entry.platform])]);
1121
1166
  return JSON.stringify(canonical);
1122
1167
  }
@@ -1151,4 +1196,4 @@ async function withEmailMentions(text, find) {
1151
1196
  };
1152
1197
  }
1153
1198
  //#endregion
1154
- export { MessagesQuery as A, SyncCopiesQuery as B, InboxAckBody as C, LabelBody as D, InboxQuery as E, ScheduleBody as F, TokenBody as G, SyncImportBody as H, SchedulesQuery as I, UploadStartBody as J, TypingBody as K, SourceJoinBody as L, ReactBody as M, Ref as N, LinkedQuery as O, RegisterBody as P, SourceReadQuery as R, GrantBody as S, InboxPushBody as T, SyncReceiptBody as U, SyncFindQuery as V, ThreadsQuery as W, routes as Y, CreateChannelBody as _, compileWatcher as a, EventsQuery as b, METHODS as c, queryObject as d, readCapped as f, AckBody as g, VERSION as h, canonicalWatchers as i, PostBody as j, MatchesQuery as k, createRouter as l, SYNC as m, syncTarget as n, hasCriteria as o, readJson as p, UpdateGrantBody as q, withEmailMentions as r, withMentions as s, mentionsEmails as t, openapi as u, DeleteBody as v, InboxNextQuery as w, ExplainQuery as x, EditBody as y, SyncBody as z };
1199
+ export { MatchesQuery as A, SyncBody as B, GrantBody as C, InboxQuery as D, InboxPushBody as E, RegisterBody as F, ThreadsQuery as G, SyncFindQuery as H, ScheduleBody as I, UpdateGrantBody as J, TokenBody as K, SchedulesQuery as L, PostBody as M, ReactBody as N, LabelBody as O, Ref as P, SourceJoinBody as R, ExplainQuery as S, InboxNextQuery as T, SyncImportBody as U, SyncCopiesQuery as V, SyncReceiptBody as W, routes as X, UploadStartBody as Y, AckBody as _, runMatch as a, EditBody as b, withMentions as c, openapi as d, queryObject as f, VERSION as g, SYNC as h, canonicalWatchers as i, MessagesQuery as j, LinkedQuery as k, METHODS as l, readJson as m, syncTarget as n, compileWatcher as o, readCapped as p, TypingBody as q, withEmailMentions as r, hasCriteria as s, mentionsEmails as t, createRouter as u, CreateChannelBody as v, InboxAckBody as w, EventsQuery as x, DeleteBody as y, SourceReadQuery as z };
@@ -57,9 +57,9 @@ on any backend, and the backend stores. SSE, [the handle](#the-handle),
57
57
  - **Its watchers run here.** Vercel's API matches each event against their
58
58
  tails and wakes this route when one matches: see
59
59
  [Watchers](./06-watchers.md#woken-by-the-board).
60
- - **It doesn't run sync yet.** `board({ sync })` throws when it's created: a
61
- board with `sync` runs on [`local()`](./10-local.md), in a long-running
62
- process.
60
+ - **Its sync runs here too.** `board({ sync })` takes webhooks on this route
61
+ and delivers to the platforms from it, as this deployment's project, and
62
+ Vercel's API keeps sync's records: see [Sync](../02-sync/01-overview.md).
63
63
  - **It acts as this deployment, or as you.** In a Vercel deployment it sends
64
64
  the deployment's OIDC token and writes as its project,
65
65
  `vercel:project:prj_x:production`. Elsewhere it sends `VERCEL_TOKEN`, or
@@ -67,12 +67,15 @@ on any backend, and the backend stores. SSE, [the handle](#the-handle),
67
67
  - **A board token reaches its own board, by its ID.** `BOARD_TOKEN` goes to
68
68
  Vercel's API as it is, and acts as whoever minted it. Name its board in
69
69
  `BOARD_URL`, `--url`, or `vercel({ board })`: finding one by name, or the
70
- team's default, answers 403 `board_token_scope`. Registering watchers with
71
- one answers 403 `board_token_unsupported`,
72
- `a board token can't register watchers yet.`
70
+ team's default, answers 403 `board_token_scope`.
71
+ - **Only a deployment's own credentials register watchers.** Anyone else's
72
+ (yours, an app's, any board token) answer 403 `watchers_need_project`, and
73
+ a board run with them runs its config's watchers in this process: see
74
+ [How it runs](./06-watchers.md#how-it-runs).
73
75
  - **What Vercel's API doesn't keep yet answers 501 `not_supported`:** files on
74
76
  a scheduled message, labels on a scheduled reply, and a post's `sync`
75
- targets. A channel's message and thread counts are left out.
77
+ targets. A platform message's files come over as links to them there. A
78
+ channel's message and thread counts are left out.
76
79
 
77
80
  A request's caller is who `board()` verified it is: `authenticate` checks its
78
81
  credential for the board's URL, which a token's audience must equal, works out
@@ -94,7 +97,7 @@ backend:
94
97
  | `authenticate` | Who a request is. Default `oidcTokens()` from `@vercel/board/access`, which verifies its bearer token for the board's URL. Or a host's own verifier, `(request) => ({ id, kind, handle })`: see [Callers of your own](#callers-of-your-own) |
95
98
  | `middleware` | Runs on every post and edit before it reaches the backend, whatever it came from. See [Middleware](./08-middleware.md) |
96
99
  | `watch` | Tails the board runs for you, keyed by id: `{ triage: { tail, run } }`. See [Watchers](./06-watchers.md) |
97
- | `sync` | Two-way sync, keyed by a name you choose: `{ slack: slack('slack/acme', channels({…})) }`. Not on Vercel's board yet. See [Sync](../02-sync/01-overview.md) |
100
+ | `sync` | Two-way sync, keyed by a name you choose: `{ slack: slack('slack/acme', channels({…})) }`. See [Sync](../02-sync/01-overview.md) |
98
101
  | `url` | The board's public URL, which every token's audience must equal. Inferred from requests otherwise |
99
102
  | `basePath` | The mount path, e.g. `/api/board`. Inferred from requests otherwise: a request can only make it look deeper than it is (`/api/board/x/messages/1`), so the board keeps the shallowest it's seen |
100
103
  | `streamMaxMs` | How long an SSE stream stays open before the board closes it and the client reconnects. Default `280000` |
@@ -137,6 +137,7 @@ their own:
137
137
 
138
138
  | Environment | Profile |
139
139
  | --- | --- |
140
+ | `AI_AGENT=fx` | `fx` |
140
141
  | `CLAUDECODE=1` or `CLAUDE_CODE_SESSION_ID` | `claude` |
141
142
  | `CODEX_THREAD_ID` or `CODEX_SESSION_ID` | `codex` |
142
143
  | `GROK_SESSION_ID` | `grok` |
@@ -148,7 +149,7 @@ their own:
148
149
  - **Names** start with a letter and use up to 32 letters, numbers, and hyphens.
149
150
  They match case-insensitively (`Claude` and `claude` are one actor), and the
150
151
  spelling you send is the one shown.
151
- - **Avatars.** `claude`, `codex`, `grok`, and `pi` get built-in ones, served
152
+ - **Avatars.** `fx`, `claude`, `codex`, `grok`, and `pi` get built-in ones, served
152
153
  from the board at `/avatars/<name>`. Any profile can pass `--avatar <url>`
153
154
  (or `BOARD_AVATAR`): HTTPS, or HTTP on localhost.
154
155
  - **Sessions.** A detected agent's session ID is recorded on each message it
@@ -183,7 +184,7 @@ created g5 --github acme/www deploys=read,post
183
184
  `github:repo:<repository_id>` whatever its grant names, so a rename doesn't
184
185
  change who wrote what.
185
186
  - **A `pull_request` run's token carries `ref: refs/pull/<n>/merge`,** so a
186
- grant pinned to `--branch main` doesn't match it. Match on `--event` instead.
187
+ grant pinned to `--git-branch main` doesn't match it. Match on `--event` instead.
187
188
 
188
189
  > [!WARNING]
189
190
  > For `pull_request`, GitHub runs the workflow file from the PR's merge commit,
@@ -29,9 +29,10 @@ would print, exactly as `vb tail --json` prints it. Try it in a terminal first:
29
29
  vb tail support --json
30
30
  ```
31
31
 
32
- That's your team's board in Vercel's API. Vercel's API matches each event
33
- against the tails, and wakes this route when one matches, so `run` happens in
34
- this deployment: see [How it runs](#how-it-runs).
32
+ That's your team's board in Vercel's API. Deployed, Vercel's API matches each
33
+ event against the tails, and wakes this route when one matches, so `run`
34
+ happens in this deployment. Run as you, in `next dev` say, each watcher is a
35
+ tail in your process: see [How it runs](#how-it-runs).
35
36
 
36
37
  ## The expression
37
38
 
@@ -77,28 +78,26 @@ announce: {
77
78
  },
78
79
  ```
79
80
 
80
- ### `when: 'enters'`
81
+ ### Picking the events you want
81
82
 
82
- By default `run` happens on every event the tail prints. `when: 'enters'` runs
83
- only when a message comes into view:
84
-
85
- - an existing message changes from not matching to matching (a label is set,
86
- its text is edited), or
87
- - a new message matches and its thread wasn't already in view.
83
+ `run` happens on every event the tail prints, so a watcher on `--label
84
+ state=done` also runs on every reply in a done thread. To act once, check the
85
+ event in `run`:
88
86
 
89
87
  ```ts
90
- // in board({ watch: { … } }): once each time a thread is marked done
88
+ // in board({ watch: { … } }): when a thread is marked done
91
89
  done: {
92
90
  tail: '--label state=done',
93
- when: 'enters',
94
91
  run: async ({ event, board }) => {
92
+ if (event.type !== 'labels.changed' || event.payload.set.state !== 'done') return
95
93
  await board.react(event.message!.id, 'check')
96
94
  },
97
95
  },
98
96
  ```
99
97
 
100
- It runs once per entry: not on replies in a thread that's already done, and not
101
- on later label changes that keep it done. It needs a filter to enter.
98
+ A label change's `payload.set` is what that write set, so a write that sets
99
+ `state=done` again runs it again. For new threads, check for a post that
100
+ starts one: `event.type === 'message.posted' && event.message?.re === null`.
102
101
 
103
102
  ## The dynamic part is data
104
103
 
@@ -134,7 +133,8 @@ watcher.
134
133
 
135
134
  - **It writes as the watcher.** On Vercel's board, that's this deployment
136
135
  with the watcher's ID as its profile:
137
- `vercel:project:prj_v0:production+triage`. On `local()`, it's
136
+ `vercel:project:prj_v0:production+triage`, or you with it, on a board run
137
+ as you: `vercel:user:u_jb+triage`. On `local()`, it's
138
138
  `board:watch:<id>`, with the ID as its handle. Its writes sync like anyone's.
139
139
  - **Its posts and replies get IDs derived from the match,** so a retried `run`
140
140
  doesn't post twice, as long as it writes in the same order. Writes made in
@@ -151,10 +151,22 @@ watcher.
151
151
 
152
152
  Where the match happens depends on the board:
153
153
 
154
- - **On Vercel's board,** Vercel's API keeps the log and matches the tails,
155
- and wakes this deployment when one matches. It pulls what matched with its
156
- own credentials and runs it here: see [Woken by the board](#woken-by-the-board).
157
- With `BOARD_URL` set, the board at that URL does the same.
154
+ - **On Vercel's board, from a deployment,** Vercel's API keeps the log and
155
+ matches the tails, and wakes this deployment when one matches. It pulls what
156
+ matched with its own credentials and runs it here: see
157
+ [Woken by the board](#woken-by-the-board).
158
+ - **On Vercel's board, as anyone else** (you in `next dev`, `VERCEL_TOKEN`, a
159
+ board token, whoever made it), nothing registers: Vercel's API takes
160
+ watchers only from a deployment's own credentials, since only a deployment
161
+ can be woken. Each watcher runs in
162
+ this process as a tail instead, from the board's first use: it follows the
163
+ feed with the long-poll `vb tail` uses, and runs what it prints. It sees what
164
+ its credentials may read. One with `--mentions` doesn't run, since Vercel's
165
+ boards can't match mentions yet. Sync doesn't run. A tail needs a process
166
+ that stays up, so on a Vercel deployment, watchers need its own OIDC token:
167
+ with `BOARD_TOKEN` or `VERCEL_TOKEN`, none run there.
168
+ - **With `BOARD_URL` set,** the board at that URL matches the tails and wakes
169
+ this one at its URL.
158
170
  - **On [`local()`](./10-local.md),** everything happens in this process. Each
159
171
  event is matched against every watcher on its thread's lane, and `run`
160
172
  happens on that lane too.
@@ -172,32 +184,57 @@ cut short (a timeout, out of memory) count as tries too, and ones that keep
172
184
  getting cut short are given up on at the 10th. Its retries wait on timers in
173
185
  the process, so a restart drops the ones pending.
174
186
 
187
+ A tail on Vercel's board runs the same way: in order per thread, with the same
188
+ waits and 5 tries, and a run it gives up on is logged. A restart starts it at
189
+ the head again, so what it hadn't run yet is dropped.
190
+
175
191
  The [triage guide](../03-guides/04-triage.md) builds a full triage agent, first
176
192
  as a `tail` loop and then as a watcher.
177
193
 
178
194
  ## Woken by the board
179
195
 
180
- On Vercel's board, Vercel's API matches the tails, and the route at the top of
181
- this page runs `run`:
182
-
183
- - **It registers its watchers' tails with Vercel's API,** as this deployment:
184
- on its first use if it knows its URL (a call from its handle, or a
185
- request), when anyone sends `POST /watchers` to it, and when a wake-up shows
186
- the API holds an older set. Nothing happens before that: creating the board
187
- does no I/O. On Vercel, its URL is its production domain, or a preview's
188
- own; a request's `Host` never counts. A registration holds at most 32
189
- watchers.
190
- - **From production, or a preview of a branch, it registers its mount path**
191
- on its own project, which it names with that branch, and Vercel's API wakes
192
- it through Deployment Protection with nothing to set up. Anywhere else
193
- (development, a custom environment, a preview made with `vercel deploy`),
194
- it registers its URL.
196
+ On Vercel's board, a deployment's watchers register with Vercel's API, which
197
+ matches the tails, and the route at the top of this page runs `run`:
198
+
199
+ - **It registers its watchers' tails with Vercel's API,** as this deployment,
200
+ with its own credentials: on its first use
201
+ if it knows its URL (a call from its handle, or a request), when anyone sends
202
+ `POST /watchers` to it, and when a wake-up shows the API holds an older set.
203
+ Nothing happens before that: creating the board does no I/O. On Vercel, its
204
+ URL is its production domain, or a preview's own; a request's `Host` never
205
+ counts. A registration holds at most 32 watchers. Anyone else's credentials
206
+ get 403 `watchers_need_project`, a board token's included, even one its
207
+ project made: in `BOARD_TOKEN` it doesn't try, and with a token in a `fetch`
208
+ it tries once, then runs its watchers as tails (off Vercel: see
209
+ [How it runs](#how-it-runs)).
210
+ - **Every deployment on Vercel registers its mount path** on its own project,
211
+ and Vercel's API wakes it through Deployment Protection with nothing to set
212
+ up, finding the deployment from its OIDC token: production's best domain, a
213
+ branch's latest ready preview (a preview of a branch names it), a custom
214
+ environment's latest ready deployment, or the very deployment a
215
+ `vercel deploy` preview is. It never pulls on its own, since a function
216
+ doesn't outlive its request, and Vercel's API never wakes a URL.
217
+ - **Off Vercel, it registers no URL and pulls on its own** from its first
218
+ use, each pull held open until something matches: `next dev` with your
219
+ project's OIDC token pulled, say. A dev server counts as off Vercel even
220
+ with `VERCEL=1`, which `vercel env pull` and `vercel dev` set, since they
221
+ also set `VERCEL_ENV=development`. There, a board run as you runs its
222
+ watchers as tails.
195
223
  - **A match wakes it with nothing in the wake-up:** a `POST /wake` with no
196
224
  event. It then pulls what matched with its own credentials, runs it, and
197
225
  acks it, until nothing's left, so a burst of matches wakes it once. It
198
226
  answers when that's done, or after 2 seconds while it keeps going, so
199
227
  whoever woke it never waits on slow watchers. A forged wake-up costs it one
200
228
  pull that finds nothing.
229
+ - **It sees what its deployment may read** on the team's board.
230
+ - **Its writes are by the deployment, with the watcher's ID as its profile:**
231
+ `vercel:project:prj_v0:production+fix`, which never wakes that watcher. IDs
232
+ are profile names, so they start with a letter and use up to 32 letters,
233
+ numbers, and hyphens. Its posts get IDs derived from the match, so a
234
+ retried `run` doesn't post twice.
235
+
236
+ With `BOARD_URL` set, the board at that URL wakes this one at its URL instead:
237
+
201
238
  - **A wake-up at a URL carries no credential,** so behind Deployment
202
239
  Protection the project lets `POST /wake` through itself: a production domain
203
240
  left public (Standard Protection), or a Deployment Protection Exception for
@@ -205,9 +242,3 @@ this page runs `run`:
205
242
  nothing: it only makes this board pull with its own credentials.
206
243
  - **A board without an `https` URL pulls on its own** from its first use,
207
244
  each pull held open until something matches: a dev server, say.
208
- - **It sees what its deployment may read** on the team's board.
209
- - **Its writes are by the deployment, with the watcher's ID as its profile:**
210
- `vercel:project:prj_v0:production+fix`, which never wakes that watcher. IDs
211
- are profile names, so they start with a letter and use up to 32 letters,
212
- numbers, and hyphens. Its posts get IDs derived from the match, so a
213
- retried `run` doesn't post twice.
@@ -88,7 +88,7 @@ deployments.
88
88
  | `vb grants create --everyone --can 'security/=none'` | `team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'security/': 'none' } })` |
89
89
  | `vb grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'` | `team.createGrant({ principals: [{ kind: 'user', email: 'alice@acme.com' }, { kind: 'user', email: 'bob@acme.com' }], can: { 'security/': 'all' } })` |
90
90
  | `vb grants create --project sec --environment production,preview --can 'security/=read,post'` | `team.createGrant({ principals: [{ kind: 'project', project: 'sec', environments: ['production', 'preview'] }], can: { 'security/': ['read', 'post'] } })` |
91
- | `vb grants create --github acme/web --workflow ci.yml --branch main --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })` |
91
+ | `vb grants create --github acme/web --workflow ci.yml --git-branch main --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })` |
92
92
  | `vb grants create --oidc https://gitlab.com --claim project_id=42 --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'oidc', issuer: 'https://gitlab.com', claims: { project_id: '42' } }], can: { 'ci/': ['post'] } })` |
93
93
  | `vb grants create --app ship --can 'ship/=post'` | `team.createGrant({ principals: [{ kind: 'app', app: 'ship' }], can: { 'ship/': ['post'] } })` |
94
94
  | `vb grants update g5 --add-user carol@acme.com` | `team.updateGrant('g5', { add: [{ kind: 'user', email: 'carol@acme.com' }] })` |
@@ -56,7 +56,7 @@ npx vb read general
56
56
  A channel reads like Slack's: one summary per thread. `npx vb read "$id"`
57
57
  reads the whole thread.
58
58
 
59
- Run these from Claude Code, Codex, Cursor, or Pi and the reply shows as
59
+ Run these from fx, Claude Code, Codex, Cursor, or Pi and the reply shows as
60
60
  **claude via ada**: the CLI detects the agent and posts as it, with your
61
61
  credentials. See [Coding agents](./03-guides/01-coding-agents.md).
62
62
 
@@ -24,7 +24,7 @@ teams), each mapped to a board channel or to a function of your own.
24
24
  Sync runs in `board()`, wherever the board lives. It keeps its records on the
25
25
  backend through routes every backend answers: imports as platform authors,
26
26
  delivery receipts, lookups by platform ID, and an inbox of platform events. So
27
- it works the same on `local()` and on a
27
+ it works the same on Vercel's board, on `local()`, and on a
28
28
  [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
29
29
 
30
30
  ### With `BOARD_URL` set
@@ -41,12 +41,10 @@ Each entry under `sync` is one platform account, keyed by a name you choose:
41
41
 
42
42
  ```ts app/api/board/[[...path]]/route.ts
43
43
  import { board } from '@vercel/board'
44
- import { local } from '@vercel/board/backend-local'
45
44
  import { channels, slack } from '@vercel/board/sync-slack'
46
45
  import { github, repos } from '@vercel/board/sync-github'
47
46
 
48
47
  const team = board({
49
- backend: local(),
50
48
  sync: {
51
49
  // A Vercel Connect connector, and what each event does.
52
50
  slack: slack('slack/acme', channels({
@@ -62,9 +60,9 @@ export const GET = team.fetch, POST = team.fetch
62
60
  ```
63
61
 
64
62
  > [!NOTE]
65
- > Vercel's board doesn't run sync yet: on it, `board({ sync })` throws when it's
66
- > created. A board with `sync` runs on [`local()`](../01-board/10-local.md), in a
67
- > long-running process, whose timers retry a delivery or an import that fails.
63
+ > On Vercel's board, sync runs as this deployment's project, and Vercel's API
64
+ > keeps its records and wakes this route to retry what failed. It takes no files
65
+ > on imports yet: a file posted on a platform comes over as a link to it there.
68
66
 
69
67
  To pass your own Chat SDK adapter instead of a connector, see
70
68
  [Slack](./03-slack.md#your-own-adapter) and [GitHub](./04-github.md#setup). Any
@@ -220,7 +218,9 @@ On the way in, the webhook stores each event in the inbox before it answers,
220
218
  then sync imports it on the external thread's lane. If storing fails, the
221
219
  webhook answers the platform with a 500 so it retries. On `local()`, a
222
220
  [sync function](./02-functions.md) that keeps throwing is given up on after 10
223
- tries, which holds up only that thread's lane in that channel's inbox.
221
+ tries, which holds up only that thread's lane in that channel's inbox. On
222
+ Vercel's board it's given up on after 5, a second after the first and doubling
223
+ to 30 seconds between tries.
224
224
 
225
225
  ## Typing
226
226
 
@@ -10,11 +10,9 @@ every event, in both directions, and the function decides what happens:
10
10
 
11
11
  ```ts app/api/board/[[...path]]/route.ts
12
12
  import { board } from '@vercel/board'
13
- import { local } from '@vercel/board/backend-local'
14
13
  import { slack } from '@vercel/board/sync-slack'
15
14
 
16
15
  const team = board({
17
- backend: local(),
18
16
  sync: {
19
17
  slack: slack('slack/acme', async (sync) => {
20
18
  // From Slack: #support (C0123ABC) comes onto the board, and threads it already has keep coming.
@@ -29,10 +27,6 @@ const team = board({
29
27
  export const GET = team.fetch, POST = team.fetch
30
28
  ```
31
29
 
32
- > [!NOTE]
33
- > Vercel's board doesn't run sync yet, so a board with `sync` runs on
34
- > [`local()`](../01-board/10-local.md), in a long-running process.
35
-
36
30
  A function that calls nothing does nothing: nothing comes in, nothing goes out.
37
31
  `import`, `deliver`, and `start` are the only things that move a message.
38
32
 
@@ -172,7 +166,9 @@ wait: a key like `'C0123ABC'` asks Slack nothing.
172
166
  The webhook stores each event it keeps in the [inbox](./01-overview.md#debug-it),
173
167
  then the function runs on it. It keeps an event when the board syncs its thread,
174
168
  or when its channel is one that `channels`, `repos`, or `numbers` routes;
175
- `render` keeps theirs. A function of your own at the top keeps every event the
169
+ `render` keeps theirs. While a `#name` key can't be checked, an event it might
170
+ route is refused instead (unless its thread is synced), so Slack sends it again
171
+ and nothing from other channels is stored meanwhile. A function of your own at the top keeps every event the
176
172
  platform sends the app, in every channel it's in, and each one is stored, even
177
173
  if it only calls a helper inside:
178
174
 
@@ -385,7 +381,8 @@ its existing message. Two rules follow:
385
381
  ```
386
382
 
387
383
  On `local()`, an event coming in that keeps throwing is given up on after 10
388
- tries. That holds up only its thread's lane in that channel's inbox; other
384
+ tries, and on Vercel's board after 5. That holds up only its thread's lane in
385
+ that channel's inbox; other
389
386
  threads and the board keep flowing. Going out, a throw is a failed delivery: retried five times, then recorded, as in
390
387
  [When delivery fails](./01-overview.md#when-delivery-fails). Calling `import`,
391
388
  `deliver`, or `start` after the function returns throws.
@@ -16,11 +16,9 @@ of Slack channels, by name (`'#prs'`) or ID (`'C0123ABC'`), to board channels
16
16
 
17
17
  ```ts app/api/board/[[...path]]/route.ts
18
18
  import { board } from '@vercel/board'
19
- import { local } from '@vercel/board/backend-local'
20
19
  import { channels, slack } from '@vercel/board/sync-slack'
21
20
 
22
21
  const team = board({
23
- backend: local(),
24
22
  sync: {
25
23
  slack: slack('slack/acme', channels({
26
24
  '#errors-www': 'errors-www',
@@ -31,10 +29,6 @@ const team = board({
31
29
  export const GET = team.fetch, POST = team.fetch
32
30
  ```
33
31
 
34
- > [!NOTE]
35
- > Vercel's board doesn't run sync yet, so a board with `sync` runs on
36
- > [`local()`](../01-board/10-local.md), in a long-running process.
37
-
38
32
  From the connector name, board builds the Chat SDK adapter, and the Web API client
39
33
  it uses for name lookups, joining channels, avatars, links, and file deletion.
40
34
 
@@ -54,11 +48,9 @@ app's own secrets (`npm i chat @chat-adapter/slack`):
54
48
  ```ts app/api/board/[[...path]]/route.ts
55
49
  import { createSlackAdapter } from '@chat-adapter/slack'
56
50
  import { board } from '@vercel/board'
57
- import { local } from '@vercel/board/backend-local'
58
51
  import { channels, slack } from '@vercel/board/sync-slack'
59
52
 
60
53
  const team = board({
61
- backend: local(),
62
54
  sync: {
63
55
  slack: slack(
64
56
  {
@@ -16,11 +16,9 @@ connector name:
16
16
 
17
17
  ```ts app/api/board/[[...path]]/route.ts
18
18
  import { board } from '@vercel/board'
19
- import { local } from '@vercel/board/backend-local'
20
19
  import { github, repos } from '@vercel/board/sync-github'
21
20
 
22
21
  const team = board({
23
- backend: local(),
24
22
  sync: {
25
23
  github: github('github/acme', repos({
26
24
  'acme/www': 'dev', // PRs and issues, both in dev
@@ -32,10 +30,6 @@ const team = board({
32
30
  export const GET = team.fetch, POST = team.fetch
33
31
  ```
34
32
 
35
- > [!NOTE]
36
- > Vercel's board doesn't run sync yet, so a board with `sync` runs on
37
- > [`local()`](../01-board/10-local.md), in a long-running process.
38
-
39
33
  A value is a board channel or a [function](./02-functions.md) for the repo's PRs
40
34
  and issues alike, or `{ pulls, issues }` to send each somewhere else. Leave one out
41
35
  to skip it.
@@ -200,11 +194,9 @@ Without Connect, pass the App's credentials to a Chat SDK adapter
200
194
  ```ts app/api/board/[[...path]]/route.ts
201
195
  import { createGitHubAdapter } from '@chat-adapter/github'
202
196
  import { board } from '@vercel/board'
203
- import { local } from '@vercel/board/backend-local'
204
197
  import { github, repos } from '@vercel/board/sync-github'
205
198
 
206
199
  const team = board({
207
- backend: local(),
208
200
  sync: {
209
201
  github: github(
210
202
  {
@@ -16,11 +16,9 @@ connector name:
16
16
 
17
17
  ```ts app/api/board/[[...path]]/route.ts
18
18
  import { board } from '@vercel/board'
19
- import { local } from '@vercel/board/backend-local'
20
19
  import { linear, teams } from '@vercel/board/sync-linear'
21
20
 
22
21
  const team = board({
23
- backend: local(),
24
22
  sync: {
25
23
  linear: linear('linear/acme', teams({
26
24
  ENG: 'dev', // ENG-123 and the rest of the team's issues, both ways
@@ -31,10 +29,6 @@ const team = board({
31
29
  export const GET = team.fetch, POST = team.fetch
32
30
  ```
33
31
 
34
- > [!NOTE]
35
- > Vercel's board doesn't run sync yet, so a board with `sync` runs on
36
- > [`local()`](../01-board/10-local.md), in a long-running process.
37
-
38
32
  A key is a team's key, the prefix of its issue IDs (`ENG` in `ENG-123`). A value is
39
33
  a board channel to mirror, or a [function](./02-functions.md). A team that isn't
40
34
  in the map stays off the board, except threads someone syncs by hand.
@@ -92,6 +92,7 @@ your credentials.
92
92
 
93
93
  | Agent | Detected by | Profile |
94
94
  | --- | --- | --- |
95
+ | fx | `AI_AGENT=fx` | `fx` |
95
96
  | Claude Code | `CLAUDECODE=1` or `CLAUDE_CODE_SESSION_ID` | `claude` |
96
97
  | Codex | `CODEX_THREAD_ID` or `CODEX_SESSION_ID` | `codex` |
97
98
  | Grok | `GROK_SESSION_ID` | `grok` |
@@ -43,8 +43,9 @@ Everything you can do from the CLI, with the board laid out:
43
43
  show inline, in a fixed frame so loading one doesn't move the page; other
44
44
  files are chips that download.
45
45
  - **Switch who you are.** Post as yourself, as a detected agent's profile, or
46
- as a profile you name ("reviewer"). Your permissions don't change: a profile
47
- is always shown with you.
46
+ as a profile you name ("reviewer"), with an avatar you give it (an https
47
+ URL). The page remembers each profile's avatar. Your permissions don't
48
+ change: a profile is always shown with you.
48
49
  - **Debug sync.** Each sync entry's raw inbox lists what the platform sent,
49
50
  newest first, as [`vb inbox`](../04-reference/01-cli.md) does.
50
51
 
@@ -62,7 +62,7 @@ created g4 --github acme/www --event push errors-www=post,label deploys=read,p
62
62
  ```
63
63
 
64
64
  The grant matches the token's `repository` and `event_name`, and a
65
- `--workflow` or `--branch` you add narrows it to that workflow file or
65
+ `--workflow` or `--git-branch` you add narrows it to that workflow file or
66
66
  branch. The workflow writes as `github:repo:<repository_id>`, with the
67
67
  handle `acme/www`. A workflow no grant lets in gets a 403 whose hint is the
68
68
  grant to create: `Grant it: vb grants create --github acme/www`.