@vercel/board 0.40.0 → 0.41.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 (91) hide show
  1. package/README.md +1 -1
  2. package/dist/{access-Bl_k_Hpa.mjs → access-C5HaO42b.mjs} +2 -2
  3. package/dist/access.d.mts +6 -6
  4. package/dist/access.mjs +5 -5
  5. package/dist/{actors-yBRWTpt5.mjs → actors-nrOf7Y7z.mjs} +59 -40
  6. package/dist/{auth-DtmZzlHm.d.mts → auth-Bn8J_1F2.d.mts} +12 -30
  7. package/dist/{auth-C8URZHLx.mjs → auth-DAlYi6TN.mjs} +9 -19
  8. package/dist/{backend-BW5NbBsp.d.mts → backend-CYsTLxtP.d.mts} +116 -46
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/{chat-provider-1WKsLEnM.mjs → chat-provider-CPZg2MQb.mjs} +2 -2
  12. package/dist/{chat-provider-Bbb9JguG.d.mts → chat-provider-Cgkh9xJw.d.mts} +2 -2
  13. package/dist/cli-commands.d.mts +1 -1
  14. package/dist/cli-commands.mjs +1 -1
  15. package/dist/cli-embedded.d.mts +3 -3
  16. package/dist/cli-embedded.mjs +4 -4
  17. package/dist/cli.mjs +8 -13
  18. package/dist/{commands-BJLocuXj.d.mts → commands-CrEVjASe.d.mts} +8 -30
  19. package/dist/{commands-D6VWegVY.mjs → commands-QRD0U9AQ.mjs} +30 -101
  20. package/dist/{conformance-BWhZ0k8T.mjs → conformance-ClxEEZ9C.mjs} +139 -109
  21. package/dist/conformance.d.mts +9 -8
  22. package/dist/conformance.mjs +1 -1
  23. package/dist/digest-Dna1CGa_.mjs +4 -0
  24. package/dist/{engine-Djif8XVk.mjs → engine-8BcNeckB.mjs} +11 -12
  25. package/dist/{errors-CNRJqUuL.mjs → errors-DcQf5WeM.mjs} +109 -30
  26. package/dist/{events-C6HwB046.mjs → events-BT8y_81j.mjs} +2 -2
  27. package/dist/{exports-C2OWIbLU.mjs → exports-B6udRV_E.mjs} +363 -161
  28. package/dist/exports-C8zsIL1A.d.mts +4 -0
  29. package/dist/{external-CHDxWIVf.mjs → external-DymyhUzl.mjs} +1 -1
  30. package/dist/{index-Cuxbz_E0.d.mts → index-fcpEFCTR.d.mts} +2 -2
  31. package/dist/index.d.mts +6 -6
  32. package/dist/index.mjs +6 -5
  33. package/dist/index.node.d.mts +6 -6
  34. package/dist/index.node.mjs +3 -3
  35. package/dist/inspect/app.js +31 -31
  36. package/dist/inspect/engine.js +2 -2
  37. package/dist/inspect-BsF3mYMY.mjs +2 -0
  38. package/dist/{inspect-cGcP8ZO9.mjs → inspect-DPRoC_Gg.mjs} +6 -6
  39. package/dist/{local-CsleYuyM.mjs → local-B9y4p6N7.mjs} +113 -358
  40. package/dist/{main-D97xuqWZ.mjs → main-S0A-c_kP.mjs} +392 -139
  41. package/dist/{memory-BvVoglGv.mjs → memory-DhduVbUu.mjs} +2 -2
  42. package/dist/{mentions-CT2bN5eP.mjs → mentions-DfZGp3B-.mjs} +1 -1
  43. package/dist/{middleware-BF9vnPPS.mjs → middleware-DHdrxmoc.mjs} +2 -2
  44. package/dist/{origin-DLCmrwmE.mjs → origin-B3m2lnZC.mjs} +7 -36
  45. package/dist/{page-6BTCZWGY.mjs → page-2jjHZmIW.mjs} +2 -2
  46. package/dist/page-CAUe4GmQ.mjs +2 -0
  47. package/dist/{provider-YqkF1E2k.d.mts → provider-dY54GFNz.d.mts} +1 -25
  48. package/dist/{routes-CAjd5ARa.d.mts → routes-By9lmvUD.d.mts} +1 -63
  49. package/dist/{schemas-AZkxk06N.mjs → schemas-DAzSsgWk.mjs} +8 -3
  50. package/dist/{serve-Cs-e0Jke.mjs → serve-B15I2Ibf.mjs} +5 -5
  51. package/dist/{server-CIfMdIt3.mjs → server-DgpRZ4Nu.mjs} +74 -127
  52. package/dist/{serving-B4l0nLng.mjs → serving-CALKWs9K.mjs} +1 -1
  53. package/dist/{sql-Bv-RQu8n.mjs → sql-P9g-rLIF.mjs} +3 -3
  54. package/dist/{sqlite-D4mkYihG.mjs → sqlite-B3rCcIof.mjs} +2 -2
  55. package/dist/{sqlite-db-BraLvHtf.mjs → sqlite-db-D0Fyju-4.mjs} +1 -1
  56. package/dist/sync-chat-sdk.d.mts +2 -2
  57. package/dist/sync-chat-sdk.mjs +2 -2
  58. package/dist/sync-github.d.mts +2 -2
  59. package/dist/sync-github.mjs +2 -2
  60. package/dist/sync-linear.d.mts +3 -3
  61. package/dist/sync-linear.mjs +2 -2
  62. package/dist/sync-slack.d.mts +3 -3
  63. package/dist/sync-slack.mjs +4 -4
  64. package/dist/sync.d.mts +2 -2
  65. package/dist/sync.mjs +2 -2
  66. package/dist/{tokens-CrrXAVGz.mjs → tokens-D7_ZIWpX.mjs} +4 -4
  67. package/docs/01-board/01-mounting.md +12 -17
  68. package/docs/01-board/03-identity.md +45 -39
  69. package/docs/01-board/04-messages.md +3 -1
  70. package/docs/01-board/05-reading.md +8 -2
  71. package/docs/01-board/06-watchers.md +15 -10
  72. package/docs/01-board/07-schedules.md +6 -2
  73. package/docs/01-board/09-access.md +56 -111
  74. package/docs/02-sync/01-overview.md +5 -2
  75. package/docs/02-sync/03-slack.md +12 -12
  76. package/docs/03-guides/01-coding-agents.md +18 -22
  77. package/docs/03-guides/02-inspector.md +4 -5
  78. package/docs/03-guides/03-ci.md +7 -26
  79. package/docs/03-guides/04-triage.md +2 -2
  80. package/docs/03-guides/05-agent-factory.md +7 -9
  81. package/docs/03-guides/06-sandboxed-agents.md +149 -0
  82. package/docs/04-reference/01-cli.md +52 -87
  83. package/docs/04-reference/02-board.md +35 -36
  84. package/docs/04-reference/03-http.md +32 -53
  85. package/docs/04-reference/05-conformance.md +37 -18
  86. package/docs/index.md +4 -4
  87. package/package.json +1 -1
  88. package/dist/digest-D32GV_mX.mjs +0 -4
  89. package/dist/exports-FyRBIAMs.d.mts +0 -4
  90. package/dist/inspect-CLy6FrOZ.mjs +0 -2
  91. package/dist/page-BnY8FhPn.mjs +0 -2
@@ -1,8 +1,8 @@
1
- import { d as createBoardClient, t as HttpError, u as BoardError } from "./errors-CNRJqUuL.mjs";
2
- import "./schemas-AZkxk06N.mjs";
3
- import { X as routes, a as compileWatcher, c as METHODS } from "./origin-DLCmrwmE.mjs";
4
- import { g as keyId, p as DERIVED_ID } from "./middleware-BF9vnPPS.mjs";
5
- import { a as tailWatchers, o as deployedOnVercel, r as createVercel, t as createBoard } from "./exports-C2OWIbLU.mjs";
1
+ import { d as createBoardClient, p as formatProfileHeader, t as HttpError, u as BoardError } from "./errors-DcQf5WeM.mjs";
2
+ import "./schemas-DAzSsgWk.mjs";
3
+ import { Y as routes, a as compileWatcher, c as METHODS } from "./origin-B3m2lnZC.mjs";
4
+ import { g as keyId, p as DERIVED_ID } from "./middleware-DHdrxmoc.mjs";
5
+ import { a as PROTOCOL_ROUTES, c as deployedOnVercel, o as withoutToken, r as createVercel, s as tailWatchers, t as createBoard } from "./exports-B6udRV_E.mjs";
6
6
  import { execFile } from "node:child_process";
7
7
  import { createHash } from "node:crypto";
8
8
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -74,49 +74,11 @@ function localToken(url) {
74
74
  if (!LOOPBACK.has(new URL(url).hostname)) return null;
75
75
  const saved = JSON.parse(readFileSync(localTokenFile(url), "utf8"));
76
76
  if (saved.url !== url.replace(/\/+$/, "") || typeof saved.token !== "string") return null;
77
- return {
78
- token: saved.token,
79
- handle: saved.handle ?? null
80
- };
77
+ return { token: saved.token };
81
78
  } catch {
82
79
  return null;
83
80
  }
84
81
  }
85
- /** fx, Claude Code, Codex, and Grok sessions select their own profile, like Just Chat's CLI. */
86
- function detectAgent(env = process.env) {
87
- const found = [];
88
- if (env.AI_AGENT?.trim().toLowerCase() === "fx") found.push({
89
- profile: "fx",
90
- session: env.FX_SESSION_ID || null
91
- });
92
- if (env.CLAUDECODE === "1" || env.CLAUDE_CODE_SESSION_ID) found.push({
93
- profile: "claude",
94
- session: env.CLAUDE_CODE_SESSION_ID || null
95
- });
96
- if (env.CODEX_THREAD_ID || env.CODEX_SESSION_ID) found.push({
97
- profile: "codex",
98
- session: env.CODEX_THREAD_ID || env.CODEX_SESSION_ID || null
99
- });
100
- if (env.GROK_SESSION_ID) found.push({
101
- profile: "grok",
102
- session: env.GROK_SESSION_ID
103
- });
104
- if (env.CURSOR_AGENT === "1") found.push({
105
- profile: "cursor",
106
- session: null
107
- });
108
- if (env.PI_CODING_AGENT === "true" || env.AI_AGENT === "pi") found.push({
109
- profile: "pi",
110
- session: env.PI_SESSION_ID || null
111
- });
112
- const named = env.AI_AGENT?.trim().toLowerCase();
113
- if (named && /^[a-z][a-z0-9-]{0,31}$/.test(named) && !found.some((agent) => agent.profile === named)) found.push({
114
- profile: named,
115
- session: null
116
- });
117
- if (found.length > 1) throw new BoardError("ambiguous_agent", `Several coding agents' environments are set (${found.map((a) => a.profile).join(", ")}), so it can't tell which one is writing.`, 0, { hint: "Pick one with a profile, or none to write as yourself." });
118
- return found[0] ?? null;
119
- }
120
82
  const expiry = (token) => {
121
83
  try {
122
84
  const { exp } = decodeJwt(token);
@@ -197,7 +159,7 @@ const loginHanded = () => handed$1 !== null || !!process.env.VERCEL_AUTH_TOKEN;
197
159
  */
198
160
  const vercelLogin = () => handed$1 ? handed$1() : process.env.VERCEL_AUTH_TOKEN ? Promise.resolve(process.env.VERCEL_AUTH_TOKEN) : getVercelToken();
199
161
  /**
200
- * A handed login's token, which its board tokens are cached by: null for `vercel login`'s own. One
162
+ * A handed login's token, which its tokens for boards are cached by: null for `vercel login`'s own. One
201
163
  * that fails fails the request: `vercel login`'s, cached or in the `vercel` on PATH, can be someone
202
164
  * else's.
203
165
  */
@@ -219,17 +181,6 @@ const apiLogin = async (handed) => handed ?? await getVercelToken().catch(() =>
219
181
  async function personToken(audience, discovery) {
220
182
  const login = await handedToken();
221
183
  const cached = await readCache(audience, login);
222
- if (cached && cached.name === void 0) {
223
- const authToken = await apiLogin(login);
224
- const user = authToken ? await vercelUser(authToken) : null;
225
- const filled = {
226
- ...cached,
227
- name: user?.name ?? null,
228
- avatar: user?.avatar ?? null
229
- };
230
- await writeCache(audience, login, filled).catch(() => {});
231
- return filled;
232
- }
233
184
  if (cached) return cached;
234
185
  if (!discovery.project_id) throw new BoardError("no_project", `The board at ${audience} doesn't know its Vercel project, so there's no Vercel login token to mint for it.`, 0, { hint: "Pass a token it accepts in BOARD_TOKEN." });
235
186
  const authToken = await apiLogin(login);
@@ -249,13 +200,9 @@ async function personToken(audience, discovery) {
249
200
  token: development,
250
201
  audience
251
202
  });
252
- const user = authToken ? await vercelUser(authToken) : null;
253
203
  const fresh = {
254
204
  token,
255
- expiresAt: expiry(token),
256
- handle: user?.handle ?? null,
257
- name: user?.name ?? null,
258
- avatar: user?.avatar ?? null
205
+ expiresAt: expiry(token)
259
206
  };
260
207
  await writeCache(audience, login, fresh).catch(() => {});
261
208
  return fresh;
@@ -301,21 +248,6 @@ async function tokenFromVercelCli(project) {
301
248
  throw new BoardError("not_logged_in", "You're not logged in to Vercel.", 0, { hint: "Run vercel login." });
302
249
  }
303
250
  }
304
- /** Your Vercel username, display name, and avatar (Vercel serves avatars publicly). */
305
- async function vercelUser(authToken) {
306
- try {
307
- const response = await asYou("https://api.vercel.com/v2/user", {}, authToken);
308
- if (!response.ok) return null;
309
- const { user } = await response.json();
310
- return {
311
- handle: user?.username?.toLowerCase() ?? null,
312
- name: user?.name?.trim() || null,
313
- avatar: user?.avatar && /^[0-9a-f]+$/i.test(user.avatar) ? `https://vercel.com/api/www/avatar/${user.avatar}?s=128` : null
314
- };
315
- } catch {
316
- return null;
317
- }
318
- }
319
251
  async function githubActionsToken(audience) {
320
252
  const url = new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);
321
253
  url.searchParams.set("audience", audience);
@@ -332,8 +264,8 @@ function boardUrl() {
332
264
  /**
333
265
  * How a client reaches the board at `url` from Node: through Deployment Protection, with a token
334
266
  * from `token`, `BOARD_TOKEN`, a local board's token file (`vb serve`), GitHub Actions, the Vercel
335
- * runtime, or your Vercel CLI login, in that order. `handle` is yours, in place of `BOARD_HANDLE`
336
- * or your Vercel username.
267
+ * runtime, or your Vercel CLI login, in that order. Who you are is the token's to say: the board
268
+ * names you from what it verifies.
337
269
  */
338
270
  function connect(url, options = {}) {
339
271
  url = url.replace(/\/+$/, "");
@@ -372,10 +304,7 @@ function connect(url, options = {}) {
372
304
  source = "vb serve";
373
305
  return {
374
306
  token: local.token,
375
- expiresAt: expiry(local.token),
376
- handle: local.handle,
377
- name: null,
378
- avatar: null
307
+ expiresAt: expiry(local.token)
379
308
  };
380
309
  }
381
310
  const discovered = await discover();
@@ -413,12 +342,6 @@ function connect(url, options = {}) {
413
342
  const headers = new Headers(init.headers ?? (input instanceof Request ? input.headers : void 0));
414
343
  if (!(method === "GET" && path === "/")) {
415
344
  if (!headers.has("authorization")) headers.set("authorization", `Bearer ${await token()}`);
416
- const handle = options.handle ?? (process.env.BOARD_HANDLE || (options.token === void 0 ? cached?.handle : null));
417
- if (handle && !headers.has("x-board-handle")) headers.set("x-board-handle", handle);
418
- if (!headers.has("x-board-profile") && options.token === void 0) {
419
- if (cached?.name && !headers.has("x-board-name")) headers.set("x-board-name", encodeURIComponent(cached.name));
420
- if (cached?.avatar && !headers.has("x-board-avatar")) headers.set("x-board-avatar", cached.avatar);
421
- }
422
345
  }
423
346
  return doFetch(input, {
424
347
  ...init,
@@ -430,18 +353,18 @@ function connect(url, options = {}) {
430
353
  source: () => source
431
354
  };
432
355
  }
433
- /** The profile the environment picks: `BOARD_AS`, or the coding agent it runs in, with its session. */
356
+ /**
357
+ * The profile the environment names: `BOARD_PROFILE`, with `BOARD_AVATAR`. Nothing else picks one, a coding
358
+ * agent included: without it, you write as yourself.
359
+ */
434
360
  function environmentProfile() {
435
- const detected = detectAgent();
436
- const name = process.env.BOARD_AS || detected?.profile;
361
+ if (process.env.BOARD_AS) throw new BoardError("renamed_env", "BOARD_AS is BOARD_PROFILE now, and nothing reads BOARD_AS.", 0, { hint: "Set BOARD_PROFILE to the same name, and unset BOARD_AS." });
362
+ const name = process.env.BOARD_PROFILE;
437
363
  const avatar = process.env.BOARD_AVATAR;
438
- return {
439
- profile: name ? avatar ? {
440
- name,
441
- avatar
442
- } : name : null,
443
- session: detected?.session ?? null
444
- };
364
+ return name ? avatar ? {
365
+ name,
366
+ avatar
367
+ } : name : null;
445
368
  }
446
369
  const WHERE = "Project → Settings → Deployment Protection → Protection Bypass for Automation";
447
370
  var Wall = class extends Error {
@@ -481,6 +404,29 @@ const ownHost = (host) => [
481
404
  process.env.VERCEL_BRANCH_URL,
482
405
  process.env.VERCEL_PROJECT_PRODUCTION_URL
483
406
  ].some((own) => !!own && own.toLowerCase() === host.toLowerCase());
407
+ /**
408
+ * What a sandbox's requests to the board at `url` carry, from this deployment: `token`, or this
409
+ * deployment's own Vercel OIDC token, for `audience` (the board's URL; null for Vercel's API, which
410
+ * takes it as it is), and on a board behind Deployment Protection what a hosted client sends to get
411
+ * through it: this deployment's bypass secret on its own hosts, or else its OIDC token for Trusted
412
+ * Sources. Never a person's login or `VERCEL_TOKEN`: what a policy holds, its sandbox can use.
413
+ */
414
+ async function sandboxHeaders(url, audience, token) {
415
+ const oidc = async () => {
416
+ try {
417
+ return await getVercelOidcToken(audience === null ? void 0 : { audience });
418
+ } catch (cause) {
419
+ throw Object.assign(new BoardError("no_token", `There's no Vercel OIDC token here to hand a sandbox for ${url}.`, 0, { hint: "Run it in a Vercel deployment with OIDC, or pass the credential: sandboxPolicy({ token })." }), { cause });
420
+ }
421
+ };
422
+ const credential = token ?? await oidc();
423
+ const headers = { authorization: `Bearer ${credential}` };
424
+ if (audience === null) return headers;
425
+ const bypass = process.env.VERCEL_AUTOMATION_BYPASS_SECRET;
426
+ if (bypass && (process.env.VERCEL !== "1" || ownHost(new URL(url).host))) headers["x-vercel-protection-bypass"] = bypass;
427
+ else if (process.env.VERCEL === "1") headers["x-vercel-trusted-oidc-idp-token"] = credential;
428
+ return headers;
429
+ }
484
430
  /** Explicit bypass wins; otherwise hosted calls use OIDC and local people use their saved bypass. */
485
431
  function guarded(url, doFetch, suppliedToken) {
486
432
  const host = new URL(url).host;
@@ -507,16 +453,13 @@ function guarded(url, doFetch, suppliedToken) {
507
453
  envRejected = true;
508
454
  }
509
455
  if (process.env.VERCEL === "1") {
510
- let edgeless = false;
511
456
  if (!headers.has("x-vercel-trusted-oidc-idp-token")) {
512
457
  const token = headers.get("authorization")?.match(/^Bearer (.+)$/i)?.[1] ?? (typeof suppliedToken === "function" ? await suppliedToken() : suppliedToken) ?? (process.env.BOARD_TOKEN || await hostedToken(url));
513
- const edge = token.startsWith("board_") ? await hostedToken(url).catch(() => null) : token;
514
- if (edge === null) edgeless = true;
515
- else headers.set("x-vercel-trusted-oidc-idp-token", edge);
458
+ headers.set("x-vercel-trusted-oidc-idp-token", token);
516
459
  }
517
460
  return through(doFetch, input, init, null).catch((error) => {
518
461
  if (!(error instanceof Wall)) throw error;
519
- throw edgeless ? new BoardError("protected", `${url} is behind Vercel Deployment Protection, and this deployment has no Vercel OIDC token to get through it.`, error.status, { hint: "Enable OIDC on its project, and add it to the board project's Deployment Protection Trusted Sources." }) : new BoardError("protected", `${url} is behind Vercel Deployment Protection, and it rejected this deployment's Vercel OIDC token.`, error.status, { hint: "Add this project and environment to the board project's Deployment Protection Trusted Sources." });
462
+ throw new BoardError("protected", `${url} is behind Vercel Deployment Protection, and it rejected this deployment's Vercel OIDC token.`, error.status, { hint: "Add this project and environment to the board project's Deployment Protection Trusted Sources." });
520
463
  });
521
464
  }
522
465
  const used = await (secret ??= readBypass(host));
@@ -756,23 +699,21 @@ function createHttp(url, options, environment) {
756
699
  return binding;
757
700
  };
758
701
  /**
759
- * The SDK against the remote, as this deployment with `profile`. `quiet` names no session: this
760
- * deployment's own code. Otherwise a profile chosen in code keeps the environment's session, and
761
- * yourself (`null`) has none. Who the token's holder is, `fetch` says.
702
+ * The SDK against the remote, as this deployment with `profile`, or the environment's for
703
+ * `undefined`. Who the token's holder is, `fetch` says.
762
704
  */
763
- const sdk = (profile, quiet) => createBoardClient({
705
+ const sdk = (profile) => createBoardClient({
764
706
  url: remote,
765
707
  fetch: doFetch,
766
- profile: profile !== void 0 ? profile : () => environment?.profile().profile ?? null,
767
- session: quiet || profile === null ? null : () => environment?.profile().session ?? null
708
+ profile: profile !== void 0 ? profile : () => environment?.profile() ?? null
768
709
  });
769
- const own = sdk(null, true);
710
+ const own = sdk(null);
770
711
  const profiles = /* @__PURE__ */ new Map();
771
712
  /** This deployment as `profile`: a watcher's ID, or the middleware. */
772
713
  function asProfile(profile) {
773
714
  if (!PROFILE.test(profile)) throw new HttpError(400, "invalid_request", `as: ${profile}: profiles start with a letter and use up to 32 letters, numbers, and hyphens`);
774
715
  let client = profiles.get(profile);
775
- if (!client) profiles.set(profile, client = sdk(profile, true));
716
+ if (!client) profiles.set(profile, client = sdk(profile));
776
717
  return client;
777
718
  }
778
719
  const holders = /* @__PURE__ */ new Map();
@@ -780,7 +721,7 @@ function createHttp(url, options, environment) {
780
721
  function holder(profile) {
781
722
  const key = JSON.stringify(profile ?? (profile === null ? null : "\0"));
782
723
  let client = holders.get(key);
783
- if (!client) holders.set(key, client = sdk(profile, false));
724
+ if (!client) holders.set(key, client = sdk(profile));
784
725
  return client;
785
726
  }
786
727
  /**
@@ -906,6 +847,18 @@ function createHttp(url, options, environment) {
906
847
  ...methods,
907
848
  routes: [],
908
849
  keeps: false,
850
+ async sandbox({ profile, can, token }) {
851
+ const credential = environment ? await environment.sandbox(remote, token) : token === void 0 ? withoutToken(remote) : { authorization: `Bearer ${token}` };
852
+ return {
853
+ url: remote,
854
+ headers: {
855
+ ...credential,
856
+ "x-board-profile": formatProfileHeader(profile),
857
+ "x-board-can": can
858
+ },
859
+ routes: PROTOCOL_ROUTES
860
+ };
861
+ },
909
862
  bind(next) {
910
863
  if (binding) throw new Error("http: this backend already serves a board: create one http() per board()");
911
864
  for (const [id, spec] of Object.entries(next.subscriptions)) {
@@ -932,7 +885,8 @@ function createHttp(url, options, environment) {
932
885
  const environment$1 = {
933
886
  url: boardUrl,
934
887
  fetch: (url) => connect(url).fetch,
935
- profile: environmentProfile
888
+ profile: environmentProfile,
889
+ sandbox: (url, token) => sandboxHeaders(url, url, token)
936
890
  };
937
891
  /**
938
892
  * The board at `url`, which keeps the log: this board uses it as this deployment. Without a
@@ -947,17 +901,10 @@ function http(url, options = {}) {
947
901
  /** On Vercel, or with its OIDC token pulled (`vercel env pull`): a deployment acts as its project. */
948
902
  const deployed = () => process.env.VERCEL === "1" || !!process.env.VERCEL_OIDC_TOKEN;
949
903
  /**
950
- * A token you set for the board: it goes as `Authorization: Bearer <token>`, as it is, whatever its
951
- * format (that's Vercel's API's), ahead of every other, as it does to a board at a URL.
952
- */
953
- const boardToken = () => process.env.BOARD_TOKEN || null;
954
- /**
955
- * A token Vercel's API takes: `BOARD_TOKEN`, `VERCEL_TOKEN`, this deployment's OIDC token, or your
956
- * Vercel login, the one the CLI that runs board's hands it (`vercel board`'s) or your `vercel login`.
904
+ * A token Vercel's API takes: `VERCEL_TOKEN`, this deployment's OIDC token, or your Vercel login,
905
+ * the one the CLI that runs board's hands it (`vercel board`'s) or your `vercel login`.
957
906
  */
958
907
  async function token() {
959
- const given = boardToken();
960
- if (given) return given;
961
908
  if (process.env.VERCEL_TOKEN) return process.env.VERCEL_TOKEN;
962
909
  if (deployed()) return getVercelOidcToken();
963
910
  return vercelLogin().catch(() => {
@@ -969,7 +916,6 @@ async function token() {
969
916
  }
970
917
  /** Where `token` comes from, in words: what `vb whoami` says. */
971
918
  function credentialSource() {
972
- if (boardToken()) return "BOARD_TOKEN";
973
919
  if (process.env.VERCEL_TOKEN) return "VERCEL_TOKEN";
974
920
  if (deployed()) return "Vercel OIDC";
975
921
  return loginHanded() ? "the Vercel CLI" : "vercel login";
@@ -1010,7 +956,7 @@ async function team() {
1010
956
  const environment = {
1011
957
  fetch: () => async (input, init = {}) => {
1012
958
  const credential = await token();
1013
- if (!boardToken() && !process.env.VERCEL_TOKEN && !deployed()) return asYou(input, init, credential);
959
+ if (!process.env.VERCEL_TOKEN && !deployed()) return asYou(input, init, credential);
1014
960
  const headers = new Headers(init.headers);
1015
961
  headers.set("authorization", `Bearer ${credential}`);
1016
962
  return globalThis.fetch(input, {
@@ -1020,7 +966,7 @@ const environment = {
1020
966
  },
1021
967
  team,
1022
968
  profile: environmentProfile,
1023
- boardToken: () => boardToken() !== null
969
+ sandbox: (url, token) => sandboxHeaders(url, null, token)
1024
970
  };
1025
971
  /** The fetch `vercel()` sends by default, with the credentials it finds: for the CLI to add a header of its own to. */
1026
972
  const credentialed = () => environment.fetch();
@@ -1042,8 +988,9 @@ function vercel(options = {}) {
1042
988
  function board(options = {}) {
1043
989
  return createBoard(options, {
1044
990
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
1045
- sync: () => import("./engine-Djif8XVk.mjs"),
1046
- serving: () => import("./serving-B4l0nLng.mjs")
991
+ sync: () => import("./engine-8BcNeckB.mjs"),
992
+ serving: () => import("./serving-CALKWs9K.mjs"),
993
+ sandbox: (url, token) => sandboxHeaders(url, url, token)
1047
994
  });
1048
995
  }
1049
996
  //#endregion
@@ -1,2 +1,2 @@
1
- import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-CrrXAVGz.mjs";
1
+ import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-D7_ZIWpX.mjs";
2
2
  export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
@@ -1,8 +1,8 @@
1
- import { _ as actorKind } from "./schemas-AZkxk06N.mjs";
2
- import { c as externalMessageKey, l as isThreadTarget } from "./external-CHDxWIVf.mjs";
1
+ import { _ as actorKind } from "./schemas-DAzSsgWk.mjs";
2
+ import { c as externalMessageKey, l as isThreadTarget } from "./external-DymyhUzl.mjs";
3
3
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
4
4
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
5
- import { i as mentionTerms } from "./mentions-CT2bN5eP.mjs";
5
+ import { i as mentionTerms } from "./mentions-DfZGp3B-.mjs";
6
6
  //#region src/contract/folds.ts
7
7
  const iso = (date) => typeof date === "string" ? date : date.toISOString();
8
8
  function foldMessages(state, event) {
@@ -1,6 +1,6 @@
1
- import { r as sqlTables } from "./sql-Bv-RQu8n.mjs";
1
+ import { r as sqlTables } from "./sql-P9g-rLIF.mjs";
2
2
  import { t as sqlite$1 } from "./store-sqlite-D6fIszST.mjs";
3
- import { t as sqliteDb } from "./sqlite-db-BraLvHtf.mjs";
3
+ import { t as sqliteDb } from "./sqlite-db-D0Fyju-4.mjs";
4
4
  //#region src/store/sqlite.ts
5
5
  /**
6
6
  * A local board in one SQLite file, its log and board's tables side by side. It
@@ -1,4 +1,4 @@
1
- import { n as ddl } from "./sql-Bv-RQu8n.mjs";
1
+ import { n as ddl } from "./sql-P9g-rLIF.mjs";
2
2
  import { mkdirSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  //#region src/store/sqlite-db.ts
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-YqkF1E2k.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-Bbb9JguG.mjs";
1
+ import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-dY54GFNz.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-Cgkh9xJw.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 { f as channels, i as eventSchema, r as envelope } from "./events-C6HwB046.mjs";
2
- import { t as ChatSyncProvider } from "./chat-provider-1WKsLEnM.mjs";
1
+ import { f as channels, i as eventSchema, r as envelope } from "./events-BT8y_81j.mjs";
2
+ import { t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  //#region src/sync/chat-sdk.ts
5
5
  const schemaOf = (platform) => eventSchema(platform, "message");
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-YqkF1E2k.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-Bbb9JguG.mjs";
1
+ import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-dY54GFNz.mjs";
2
+ import { n as ChatSyncProvider } from "./chat-provider-Cgkh9xJw.mjs";
3
3
  import { z } from "zod";
4
4
  import { Adapter } from "chat";
5
5
  //#region src/sync/github.d.ts
@@ -1,5 +1,5 @@
1
- import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-C6HwB046.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-1WKsLEnM.mjs";
1
+ import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-BT8y_81j.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
3
3
  import { n as tagOf } from "./tags-BpFo6q0_.mjs";
4
4
  import { z } from "zod";
5
5
  import { connectGitHubAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { dt as SourceRead } from "./routes-CAjd5ARa.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-YqkF1E2k.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-Bbb9JguG.mjs";
1
+ import { dt as SourceRead } from "./routes-By9lmvUD.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-dY54GFNz.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-Cgkh9xJw.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/linear.d.ts
@@ -1,5 +1,5 @@
1
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-C6HwB046.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-1WKsLEnM.mjs";
1
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-BT8y_81j.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
3
3
  import { n as tagOf, t as slug } from "./tags-BpFo6q0_.mjs";
4
4
  import "zod";
5
5
  import { connectLinearAdapter } from "@vercel/connect/chat";
@@ -1,6 +1,6 @@
1
- import { fn as ExternalLink } from "./routes-CAjd5ARa.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-YqkF1E2k.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-Bbb9JguG.mjs";
1
+ import { ln as ExternalLink } from "./routes-By9lmvUD.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-dY54GFNz.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-Cgkh9xJw.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/slack.d.ts
@@ -1,7 +1,7 @@
1
- import { f as MESSAGE_TEXT_MAX } from "./schemas-AZkxk06N.mjs";
2
- import "./external-CHDxWIVf.mjs";
3
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-C6HwB046.mjs";
4
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-1WKsLEnM.mjs";
1
+ import { f as MESSAGE_TEXT_MAX } from "./schemas-DAzSsgWk.mjs";
2
+ import "./external-DymyhUzl.mjs";
3
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-BT8y_81j.mjs";
4
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
5
5
  import { z } from "zod";
6
6
  import { stringifyMarkdown } from "chat";
7
7
  import { createSlackAdapter } from "@chat-adapter/slack";
package/dist/sync.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { dn as ExternalFile, ln as ExternalAuthor, un as ExternalEvent } from "./routes-CAjd5ARa.mjs";
2
- import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, 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-YqkF1E2k.mjs";
1
+ import { cn as ExternalFile, on as ExternalAuthor, sn as ExternalEvent } from "./routes-By9lmvUD.mjs";
2
+ import { A as SyncRoot, C as mirror, D as RootOverride, E as ProviderEvent, M as eventSchema, 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-dY54GFNz.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, channels, envelope, eventSchema, into, mirror, render };
package/dist/sync.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ExternalEvent } from "./external-CHDxWIVf.mjs";
2
- import { c as SyncProvider, f as channels, h as render, i as eventSchema, l as UnreadableError, m as mirror, n as SyncOverrides, o as ReceivedEvent, p as into, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-C6HwB046.mjs";
1
+ import { n as ExternalEvent } from "./external-DymyhUzl.mjs";
2
+ import { c as SyncProvider, f as channels, h as render, i as eventSchema, l as UnreadableError, m as mirror, n as SyncOverrides, o as ReceivedEvent, p as into, r as envelope, s as ResolvedTarget, t as EventBase } from "./events-BT8y_81j.mjs";
3
3
  export { EventBase, ExternalEvent, ReceivedEvent, ResolvedTarget, SyncOverrides, SyncProvider, UnreadableError, channels, envelope, eventSchema, into, mirror, render };
@@ -1,5 +1,5 @@
1
- import { l as unauthorized } from "./errors-CNRJqUuL.mjs";
2
- import { _ as privateHost, a as VERCEL_ISSUER, b as trustedIssuers, g as markVerified, i as TOKENS, m as issuerName } from "./auth-C8URZHLx.mjs";
1
+ import { l as unauthorized } from "./errors-DcQf5WeM.mjs";
2
+ import { g as privateHost, h as markVerified, i as VERCEL_ISSUER, p as issuerName, r as TOKENS, v as trustedIssuers } from "./auth-DAlYi6TN.mjs";
3
3
  import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
4
4
  //#region src/server/identity.ts
5
5
  let fromDisk;
@@ -164,7 +164,7 @@ function createVerifier(options) {
164
164
  return {
165
165
  id: `vercel:user:${claims.user_id}`,
166
166
  kind: "person",
167
- handle: `user-${claims.user_id.slice(0, 6).toLowerCase()}`,
167
+ handle: claims.user_id,
168
168
  expiresAt
169
169
  };
170
170
  }
@@ -195,7 +195,7 @@ async function localPerson(token, local, audience) {
195
195
  const deployment = (facts, project, environment, expiresAt) => ({
196
196
  id: `vercel:project:${String(facts.claims.project_id)}:${environment}`,
197
197
  kind: "deployment",
198
- handle: environment === "production" ? project : `${project}@${environment}`,
198
+ handle: project,
199
199
  expiresAt,
200
200
  facts
201
201
  });
@@ -64,12 +64,8 @@ on any backend, and the backend stores. SSE, [the handle](#the-handle),
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
66
66
  your Vercel CLI login, and writes as you. `fetch` sends other credentials.
67
- - **A board token reaches its own board, by its ID.** `BOARD_TOKEN` goes to
68
- Vercel's API as it is, and acts as whoever minted it. Name its board in
69
- `BOARD_URL`, `--url`, or `vercel({ board })`: finding one by name, or the
70
- team's default, answers 403 `board_token_scope`.
71
67
  - **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
68
+ (yours, an app's) answer 403 `watchers_need_project`, and
73
69
  a board run with them runs its config's watchers in this process: see
74
70
  [How it runs](./06-watchers.md#how-it-runs).
75
71
  - **What Vercel's API doesn't keep yet answers 501 `not_supported`:** files on
@@ -78,7 +74,7 @@ on any backend, and the backend stores. SSE, [the handle](#the-handle),
78
74
 
79
75
  A request's caller is who `board()` verified it is: `authenticate` checks its
80
76
  credential for the board's URL, which a token's audience must equal, works out
81
- the actor from its claims (the profile it writes as, its session, its scope),
77
+ the actor from its claims (the profile it writes as, its scope),
82
78
  and works out what it may do (see [Access](./09-access.md)). Nothing runs for
83
79
  a request before that.
84
80
 
@@ -248,8 +244,8 @@ do. The team is `VERCEL_ORG_ID`, the deployment's, or the nearest
248
244
  `.vercel/project.json`'s, unless `team` says another (`acme`). The
249
245
  credentials are `VERCEL_TOKEN`, the deployment's OIDC token, then your
250
246
  `vercel login`, or what `fetch` sends: a deployment writes as its project, and
251
- you as yourself. Its profile is `BOARD_AS`, or the coding agent it runs in,
252
- with that agent's session; `team.as(null)` acts as yourself.
247
+ you as yourself. Its profile is the one `BOARD_PROFILE` names, or none;
248
+ `team.as(null)` acts as yourself.
253
249
 
254
250
  With `BOARD_URL` set, it's the board at that URL instead, whatever the name:
255
251
  a board `vb serve` runs, say:
@@ -314,8 +310,8 @@ What a backend has:
314
310
  | --- | --- |
315
311
  | `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 |
316
312
  | `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 |
317
- | `keeps` | Whether the board lives here. `true` serves its callers: the board's people, its own deployments, and whoever grants and board tokens let in. `false` serves no requests: on Vercel's board, only wake-ups and webhooks, and at `BOARD_URL`, nothing |
318
- | `trust` | Its [grants](./09-access.md#grants) and [board tokens](./09-access.md#tokens), for a backend that keeps them: `grants()`, `token(hash)`, and `live(id)`. `board()` checks each request against them as they are then. Without it, they let no one in |
313
+ | `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 |
314
+ | `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 |
319
315
  | `bind(binding)` | Called once, when `board()` is created, before any request. It does no I/O. `binding.name` and `binding.team` are `board({ name, team })`'s, or null |
320
316
 
321
317
  - **A caller is one `board()` verified, or its own code.** `{ identity, origin }`
@@ -401,13 +397,12 @@ write.
401
397
  (its project, and the issuers its grants name), which `oidcTokens()` reads.
402
398
  - **A host's own returns the principal:** `id` in the board's scheme
403
399
  (`vercel:user:<id>`, `vercel:project:<id>:<env>`, …), `kind`, `handle`, and
404
- optionally `expiresAt`. Its handle stands: the one the CLI sends doesn't
405
- replace it, so a verifier that wants it returns `request.claims.handle`
406
- itself. The name, profile, and `x-board-can` the caller sends still apply
407
- on top of it. The board takes the handle as checked: a person posts to Slack
408
- under it as a plain sender ([who posts under a name](../02-sync/03-slack.md#messages-post-under-their-authors-name)),
409
- so a verifier that echoes the caller's handle lets them pick the name they
410
- post under.
400
+ optionally `expiresAt`. Its handle is who the caller is to people, their
401
+ handle and their name: nothing the caller sends replaces it, and one that
402
+ knows only an ID gives the ID. The profile and `x-board-can` the caller
403
+ sends still apply on top of it. The board takes the handle as checked: a
404
+ person posts to Slack under it as a plain sender
405
+ ([who posts under a name](../02-sync/03-slack.md#messages-post-under-their-authors-name)).
411
406
  - **`kind: 'person'` is a person on the team:** it gets what grants give
412
407
  people, as the board's own people do (g1 gives everything), and a channel
413
408
  closed to `everyone` keeps it out unless a grant names it. So your verifier