@vercel/board 0.33.0 → 0.35.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 (59) hide show
  1. package/dist/{access-N3XmkKXg.mjs → access-BsP0hvcC.mjs} +169 -12
  2. package/dist/access.d.mts +3 -3
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-ihyN47OV.mjs → actors-DFOpTw89.mjs} +2 -2
  5. package/dist/{auth-D6z3rMNj.d.mts → auth-C21V0EK1.d.mts} +128 -9
  6. package/dist/auth-CrjXLgOb.mjs +599 -0
  7. package/dist/{backend-CWpyR1A7.d.mts → backend-D21q8mdm.d.mts} +30 -7
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-DJpFUaFv.d.mts → chat-provider-DmZCmBkb.d.mts} +2 -2
  11. package/dist/cli-commands.d.mts +1 -1
  12. package/dist/cli-commands.mjs +1 -1
  13. package/dist/cli-embedded.d.mts +2 -2
  14. package/dist/cli-embedded.mjs +1 -1
  15. package/dist/cli.mjs +5 -5
  16. package/dist/{commands-BOBQHVqM.d.mts → commands-BorACIFS.d.mts} +168 -1
  17. package/dist/{commands-CHoMl06v.mjs → commands-CENWob9m.mjs} +281 -11
  18. package/dist/{conformance-qKmGLTAT.mjs → conformance-CKrwglzA.mjs} +491 -105
  19. package/dist/conformance.d.mts +20 -2
  20. package/dist/conformance.mjs +1 -1
  21. package/dist/{engine-JxgZiikU.mjs → engine-wN7quvbU.mjs} +2 -2
  22. package/dist/{errors-Pk0XV1hK.mjs → errors-rYDxZEuN.mjs} +116 -7
  23. package/dist/exports-BxljH73E.d.mts +4 -0
  24. package/dist/{exports-gHDHlg0i.mjs → exports-GIRJm2Ja.mjs} +136 -26
  25. package/dist/{index-CXvvYNYj.d.mts → index-LREsSZb2.d.mts} +2 -2
  26. package/dist/index.d.mts +6 -6
  27. package/dist/index.mjs +4 -4
  28. package/dist/index.node.d.mts +6 -6
  29. package/dist/index.node.mjs +3 -3
  30. package/dist/inspect/app.js +32 -32
  31. package/dist/{local-BbLjA5vI.mjs → local-yKwdgukb.mjs} +1981 -1574
  32. package/dist/{main-CQpCZJFw.mjs → main-DjokcEAL.mjs} +440 -50
  33. package/dist/{middleware-BU7rVi9F.mjs → middleware-BxgizazV.mjs} +1 -1
  34. package/dist/provider-DEOfc4Ls.d.mts +1049 -0
  35. package/dist/{provider-BlzUvcM9.d.mts → routes-BpKdMvgX.d.mts} +2461 -2480
  36. package/dist/{serve-D8_W4UN6.mjs → serve-CJ8hauK2.mjs} +4 -4
  37. package/dist/{server-BiIUXWbU.mjs → server-CtaTtyhw.mjs} +7 -7
  38. package/dist/{serving-D7rcUtSC.mjs → serving-6_bhBNAW.mjs} +1 -1
  39. package/dist/sync-chat-sdk.d.mts +2 -2
  40. package/dist/sync-github.d.mts +2 -2
  41. package/dist/sync-linear.d.mts +3 -2
  42. package/dist/sync-slack.d.mts +3 -3
  43. package/dist/sync.d.mts +2 -2
  44. package/dist/{targets-CknPGGVi.mjs → targets-n2i2ZOWI.mjs} +104 -12
  45. package/dist/{tokens-DPKjl3jf.mjs → tokens-Dn4cPZIr.mjs} +2 -2
  46. package/docs/01-board/01-mounting.md +12 -5
  47. package/docs/01-board/03-identity.md +14 -13
  48. package/docs/01-board/07-schedules.md +1 -1
  49. package/docs/01-board/09-access.md +170 -58
  50. package/docs/03-guides/03-ci.md +19 -17
  51. package/docs/03-guides/05-agent-factory.md +5 -6
  52. package/docs/04-reference/01-cli.md +99 -22
  53. package/docs/04-reference/02-board.md +42 -11
  54. package/docs/04-reference/03-http.md +21 -14
  55. package/docs/04-reference/05-conformance.md +31 -5
  56. package/package.json +1 -1
  57. package/dist/auth-r-_PeZyw.mjs +0 -277
  58. package/dist/exports-BuKjVq2t.d.mts +0 -4
  59. package/dist/folds-DjFTiqIM.d.mts +0 -552
@@ -1,7 +1,7 @@
1
- import { u as BoardError } from "./errors-Pk0XV1hK.mjs";
2
- import { t as board, u as localTokenFile } from "./server-BiIUXWbU.mjs";
3
- import { t as oidcTokens } from "./tokens-DPKjl3jf.mjs";
4
- import { t as local } from "./local-BbLjA5vI.mjs";
1
+ import { u as BoardError } from "./errors-rYDxZEuN.mjs";
2
+ import { t as board, u as localTokenFile } from "./server-CtaTtyhw.mjs";
3
+ import { t as oidcTokens } from "./tokens-Dn4cPZIr.mjs";
4
+ import { t as local } from "./local-yKwdgukb.mjs";
5
5
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
6
6
  import { userInfo } from "node:os";
7
7
  import { dirname, join, resolve } from "node:path";
@@ -1,8 +1,8 @@
1
- import { d as createBoardClient, o as json, t as HttpError, u as BoardError } from "./errors-Pk0XV1hK.mjs";
1
+ import { d as createBoardClient, o as json, t as HttpError, u as BoardError } from "./errors-rYDxZEuN.mjs";
2
2
  import "./schemas-BG205xds.mjs";
3
- import { N as RegisterBody, a as compileWatcher, c as METHODS, i as canonicalWatchers, q as routes } from "./targets-CknPGGVi.mjs";
4
- import { a as DERIVED_ID, c as keyId, l as sha256 } from "./middleware-BU7rVi9F.mjs";
5
- import { a as registrant, o as wakePath, r as createVercel, t as createBoard } from "./exports-gHDHlg0i.mjs";
3
+ import { P as RegisterBody, Y as routes, a as compileWatcher, c as METHODS, i as canonicalWatchers } from "./targets-n2i2ZOWI.mjs";
4
+ import { a as DERIVED_ID, c as keyId, l as sha256 } from "./middleware-BxgizazV.mjs";
5
+ import { a as registrant, o as wakePath, r as createVercel, t as createBoard } from "./exports-GIRJm2Ja.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";
@@ -841,7 +841,7 @@ function createHttp(url, options, environment) {
841
841
  }).catch(rethrow);
842
842
  } else if (route.method === "GET") response = await client.request(`${path}${queryString(fields)}`, { signal }).catch(rethrow);
843
843
  else response = await client.request(path, {
844
- method: "POST",
844
+ method: route.method,
845
845
  body: new TextEncoder().encode(JSON.stringify(fields)),
846
846
  headers: { "content-type": "application/json" },
847
847
  signal
@@ -1087,8 +1087,8 @@ function vercel(options = {}) {
1087
1087
  function board(options = {}) {
1088
1088
  return createBoard(options, {
1089
1089
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
1090
- sync: () => import("./engine-JxgZiikU.mjs"),
1091
- serving: () => import("./serving-D7rcUtSC.mjs")
1090
+ sync: () => import("./engine-wN7quvbU.mjs"),
1091
+ serving: () => import("./serving-6_bhBNAW.mjs")
1092
1092
  });
1093
1093
  }
1094
1094
  //#endregion
@@ -1,2 +1,2 @@
1
- import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-DPKjl3jf.mjs";
1
+ import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-Dn4cPZIr.mjs";
2
2
  export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
@@ -1,5 +1,5 @@
1
- import { b as channels, g as SyncFn, p as SyncProvider } from "./provider-BlzUvcM9.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-DJpFUaFv.mjs";
1
+ import { b as channels, g as SyncFn, p as SyncProvider } from "./provider-DEOfc4Ls.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-DmZCmBkb.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 SyncContext, g as SyncFn, y as SyncUnit } from "./provider-BlzUvcM9.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-DJpFUaFv.mjs";
1
+ import { f as SyncContext, g as SyncFn, y as SyncUnit } from "./provider-DEOfc4Ls.mjs";
2
+ import { n as ChatSyncProvider } from "./chat-provider-DmZCmBkb.mjs";
3
3
  import { z } from "zod";
4
4
  import { Adapter } from "chat";
5
5
  //#region src/sync/github.d.ts
@@ -1,5 +1,6 @@
1
- import { Gt as SourceRead, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery, y as SyncUnit } from "./provider-BlzUvcM9.mjs";
2
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DJpFUaFv.mjs";
1
+ import { st as SourceRead } from "./routes-BpKdMvgX.mjs";
2
+ import { c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery, y as SyncUnit } from "./provider-DEOfc4Ls.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DmZCmBkb.mjs";
3
4
  import { z } from "zod";
4
5
  import { Adapter } from "chat";
5
6
  //#region src/sync/linear.d.ts
@@ -1,6 +1,6 @@
1
- import { c as ExternalLink } from "./folds-DjFTiqIM.mjs";
2
- import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-BlzUvcM9.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DJpFUaFv.mjs";
1
+ import { on as ExternalLink } from "./routes-BpKdMvgX.mjs";
2
+ import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-DEOfc4Ls.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-DmZCmBkb.mjs";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/slack.d.ts
package/dist/sync.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as ExternalAuthor, o as ExternalEvent, s as ExternalFile } from "./folds-DjFTiqIM.mjs";
2
- import { A as envelope, C as render, D as SyncOverrides, E as RootOverride, O as SyncResult, S as mirror, T as ProviderEvent, _ as SyncIn, a as ProviderOptions, b as channels, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, h as Sync, i as ProviderFile, j as eventSchema, k as SyncRoot, l as RenderInput, m as UnreadableError, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, u as Renderer, v as SyncOut, w as EventBase, x as into, y as SyncUnit } from "./provider-BlzUvcM9.mjs";
1
+ import { an as ExternalFile, in as ExternalEvent, rn as ExternalAuthor } from "./routes-BpKdMvgX.mjs";
2
+ import { A as envelope, C as render, D as SyncOverrides, E as RootOverride, O as SyncResult, S as mirror, T as ProviderEvent, _ as SyncIn, a as ProviderOptions, b as channels, c as ReceivedEvent, d as ResolvedTarget, f as SyncContext, g as SyncFn, h as Sync, i as ProviderFile, j as eventSchema, k as SyncRoot, l as RenderInput, m as UnreadableError, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, u as Renderer, v as SyncOut, w as EventBase, x as into, y as SyncUnit } from "./provider-DEOfc4Ls.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 };
@@ -1,7 +1,7 @@
1
- import { m as DIRECT_UPLOAD_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-Pk0XV1hK.mjs";
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
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-CHoMl06v.mjs";
4
+ import { o as options } from "./commands-CENWob9m.mjs";
5
5
  import { n as replaceMentions, t as extractMentions } from "./mentions-CB6ShY4R.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/api/routes.ts
@@ -132,12 +132,87 @@ const CanGrant = z.union([z.literal("all"), z.array(z.string().min(1).max(16)).m
132
132
  /** What a grant or token lets do: `'all'`, a list for every channel, or a map from channel pattern to one. board() checks the patterns. */
133
133
  const Can = z.union([CanGrant, z.record(z.string().min(1).max(300), CanGrant)]);
134
134
  const ClaimValue = z.string().min(1).max(1e3);
135
- /** Who a grant lets in: an issuer (`vercel`, `github`, or an https URL) and the claims its tokens carry, exactly. */
136
- const GrantBody = z.object({
137
- issuer: z.string().min(1).max(1e3),
138
- claims: z.record(z.string().min(1).max(200), z.union([ClaimValue, z.array(ClaimValue).min(1).max(32)])),
139
- can: Can.optional()
135
+ const Environments = z.array(z.string().min(1).max(100)).min(1).max(16);
136
+ /**
137
+ * Who a grant names, as people write it: a user by email (or, where the board can't look one up,
138
+ * by ID), a project by name or ID, a repository by `owner/name`. The board resolves names and keeps
139
+ * IDs; a board that verifies tokens itself takes IDs only. A `user` names `email` or `userId`.
140
+ * Nothing else: a key it doesn't know (a misspelled `workflows`, say) is a 400, never dropped,
141
+ * since dropping it would name more than was meant.
142
+ */
143
+ const PrincipalInput = z.discriminatedUnion("kind", [
144
+ z.strictObject({
145
+ kind: z.literal("user"),
146
+ email: z.string().min(3).max(320).optional(),
147
+ userId: z.string().min(1).max(200).optional()
148
+ }),
149
+ z.strictObject({
150
+ kind: z.literal("project"),
151
+ project: z.string().min(1).max(200),
152
+ environments: Environments.optional()
153
+ }),
154
+ z.strictObject({
155
+ kind: z.literal("github"),
156
+ repository: z.string().min(3).max(200),
157
+ workflow: z.string().min(1).max(300).optional(),
158
+ branch: z.string().min(1).max(255).optional(),
159
+ event: z.string().min(1).max(64).optional()
160
+ }),
161
+ z.strictObject({
162
+ kind: z.literal("oidc"),
163
+ issuer: z.string().min(1).max(1e3),
164
+ claims: z.record(z.string().min(1).max(200), z.union([ClaimValue, z.array(ClaimValue).min(1).max(32)]))
165
+ }),
166
+ z.strictObject({ kind: z.literal("all-users") }),
167
+ z.strictObject({
168
+ kind: z.literal("all-projects"),
169
+ environments: Environments.optional()
170
+ }),
171
+ z.strictObject({
172
+ kind: z.literal("app"),
173
+ app: z.string().min(1).max(200)
174
+ }),
175
+ z.strictObject({ kind: z.literal("all-apps") }),
176
+ z.strictObject({ kind: z.literal("everyone") })
177
+ ]);
178
+ /** What a grant lets its principals do: a map from channel pattern to `'all'` or a list, `[]` for none. Kept as written. */
179
+ const GrantCan = z.record(z.string().min(1).max(300), CanGrant);
180
+ /** A grant: who it names, and one `can` for all of them. The same principals again are another grant. */
181
+ const GrantBody = z.strictObject({
182
+ principals: z.array(PrincipalInput).min(1).max(32),
183
+ can: GrantCan
140
184
  });
185
+ /**
186
+ * Which grant decides a channel, and what it gives, for the caller or a principal it names: a
187
+ * `user` (by email, or by ID where the board can't look one up), a `project` in one `environment`
188
+ * (production by default), a `github` repository's run (with its `workflow`, `branch`, and
189
+ * `event`), or an `oidc` issuer's token with each `claim` as `name=value`.
190
+ */
191
+ const ExplainQuery = z.object({
192
+ channel: ChannelPath,
193
+ user: z.string().min(1).max(320).optional(),
194
+ project: z.string().min(1).max(200).optional(),
195
+ environment: z.string().min(1).max(100).optional(),
196
+ github: z.string().min(3).max(200).optional(),
197
+ workflow: z.string().min(1).max(300).optional(),
198
+ branch: z.string().min(1).max(255).optional(),
199
+ event: z.string().min(1).max(64).optional(),
200
+ oidc: z.string().min(1).max(1e3).optional(),
201
+ claim: repeated.optional(),
202
+ app: z.string().min(1).max(200).optional()
203
+ }).refine((query) => [
204
+ query.user,
205
+ query.project,
206
+ query.github,
207
+ query.oidc,
208
+ query.app
209
+ ].filter((value) => value !== void 0).length <= 1, "name one principal: user, project, github, oidc, or app").refine((query) => query.environment === void 0 || query.project !== void 0, "environment goes with project").refine((query) => query.workflow === void 0 && query.branch === void 0 && query.event === void 0 || query.github !== void 0, "workflow, branch, and event go with github").refine((query) => query.claim === void 0 || query.oidc !== void 0, "claim goes with oidc");
210
+ /** A grant's change: principals to add and to remove, and a `can` to replace its own. */
211
+ const UpdateGrantBody = z.strictObject({
212
+ add: z.array(PrincipalInput).min(1).max(32).optional(),
213
+ remove: z.array(PrincipalInput).min(1).max(32).optional(),
214
+ can: GrantCan.optional()
215
+ }).refine((body) => body.add !== void 0 || body.remove !== void 0 || body.can !== void 0, "name principals to add or remove, or a can");
141
216
  /** A token acting as the caller: what it may do, and the profile and session every request with it writes as. */
142
217
  const TokenBody = z.object({
143
218
  name: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/, "a token name is up to 64 letters, numbers, and ._-"),
@@ -394,8 +469,12 @@ const ReactBody = z.object({
394
469
  emoji: Emoji,
395
470
  remove: z.boolean().optional()
396
471
  });
397
- /** A channel to make before anything posts to it. */
398
- const CreateChannelBody = z.object({ path: ChannelPath });
472
+ /**
473
+ * A channel to make before anything posts to it, and nothing else: a key it doesn't know is a 400,
474
+ * so a client that asks for more than a channel (one that expects `private: true` to close it, say)
475
+ * is told, never handed an open one.
476
+ */
477
+ const CreateChannelBody = z.strictObject({ path: ChannelPath });
399
478
  const LabelBody = z.object({
400
479
  set: Labels.optional(),
401
480
  unset: z.array(LabelKey).optional(),
@@ -509,7 +588,7 @@ const routes = {
509
588
  method: "POST",
510
589
  path: "/schedules/:id/cancel"
511
590
  },
512
- /** Grants need manage in every channel. Setting one with the same issuer and claims changes its `can`. */
591
+ /** Listing grants needs manage at `*`; changing one, manage at each pattern its `can` names. Team owners always may. */
513
592
  grants: {
514
593
  method: "GET",
515
594
  path: "/grants"
@@ -519,6 +598,17 @@ const routes = {
519
598
  path: "/grants",
520
599
  body: GrantBody
521
600
  },
601
+ updateGrant: {
602
+ method: "PATCH",
603
+ path: "/grants/:id",
604
+ body: UpdateGrantBody
605
+ },
606
+ /** Which grant decides a channel, for the caller or, with `manage` at `*`, a principal it names. */
607
+ explain: {
608
+ method: "GET",
609
+ path: "/grants/explain",
610
+ query: ExplainQuery
611
+ },
522
612
  revokeGrant: {
523
613
  method: "POST",
524
614
  path: "/grants/:id/revoke"
@@ -674,7 +764,7 @@ const routes = {
674
764
  };
675
765
  //#endregion
676
766
  //#region src/version.ts
677
- const VERSION = "0.33.0";
767
+ const VERSION = "0.35.0";
678
768
  //#endregion
679
769
  //#region src/server/backend.ts
680
770
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -709,6 +799,8 @@ const METHODS = [
709
799
  "cancelSchedule",
710
800
  "grants",
711
801
  "createGrant",
802
+ "updateGrant",
803
+ "explain",
712
804
  "revokeGrant",
713
805
  "tokens",
714
806
  "createToken",
@@ -1059,4 +1151,4 @@ async function withEmailMentions(text, find) {
1059
1151
  };
1060
1152
  }
1061
1153
  //#endregion
1062
- export { PostBody as A, SyncFindQuery as B, InboxNextQuery as C, LinkedQuery as D, LabelBody as E, SchedulesQuery as F, TypingBody as G, SyncReceiptBody as H, SourceJoinBody as I, UploadStartBody as K, SourceReadQuery as L, Ref as M, RegisterBody as N, MatchesQuery as O, ScheduleBody as P, SyncBody as R, InboxAckBody as S, InboxQuery as T, ThreadsQuery as U, SyncImportBody as V, TokenBody as W, 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, ReactBody as j, MessagesQuery as k, createRouter as l, SYNC as m, syncTarget as n, hasCriteria as o, readJson as p, routes as q, withEmailMentions as r, withMentions as s, mentionsEmails as t, openapi as u, DeleteBody as v, InboxPushBody as w, GrantBody as x, EditBody as y, SyncCopiesQuery as z };
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 };
@@ -1,5 +1,5 @@
1
- import { l as unauthorized } from "./errors-Pk0XV1hK.mjs";
2
- import { a as VERCEL_ISSUER, f as issuerName, g as trustedIssuers, i as TOKENS, m as privateHost, p as markVerified } from "./auth-r-_PeZyw.mjs";
1
+ import { l as unauthorized } from "./errors-rYDxZEuN.mjs";
2
+ import { _ as privateHost, a as VERCEL_ISSUER, b as trustedIssuers, g as markVerified, i as TOKENS, m as issuerName } from "./auth-CrjXLgOb.mjs";
3
3
  import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
4
4
  //#region src/server/identity.ts
5
5
  let fromDisk;
@@ -64,10 +64,15 @@ 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`. Registering watchers with
71
+ one answers 403 `board_token_unsupported`,
72
+ `a board token can't register watchers yet.`
67
73
  - **What Vercel's API doesn't keep yet answers 501 `not_supported`:** files on
68
74
  a scheduled message, labels on a scheduled reply, and a post's `sync`
69
- targets. Grants and board tokens go to Vercel's API, which doesn't keep them
70
- yet. A channel's message and thread counts are left out.
75
+ targets. A channel's message and thread counts are left out.
71
76
 
72
77
  A request's caller is who `board()` verified it is: `authenticate` checks its
73
78
  credential for the board's URL, which a token's audience must equal, works out
@@ -398,11 +403,13 @@ write.
398
403
  replace it, so a verifier that wants it returns `request.claims.handle`
399
404
  itself. The name, profile, and `x-board-scope` the caller sends still apply
400
405
  on top of it.
401
- - **`kind: 'person'` is a full member of the board:** it may do everything,
402
- as the board's own people do. So your verifier decides who counts as one.
406
+ - **`kind: 'person'` is a person on the team:** it gets what grants give
407
+ people, as the board's own people do (g1 gives everything), and a channel
408
+ closed to `everyone` keeps it out unless a grant names it. So your verifier
409
+ decides who counts as one.
403
410
  - **Anyone else gets what grants give its ID.** A host's principal carries no
404
411
  claims past its ID, and only a deployment's, `vercel:project:<id>:<env>`,
405
- says what a grant matches: that project's Vercel grants for that
412
+ says what a grant matches: the grants naming that project in that
406
413
  environment. Any other is refused with 403. One whose `expiresAt` has passed
407
414
  is refused, and a schedule it made is canceled `revoked`.
408
415
  - **Name your principals in a scheme no sync registers.** A sync writes as
@@ -163,26 +163,27 @@ verified principal.
163
163
 
164
164
  ## Machines outside the project
165
165
 
166
- Machines outside the board's project need a [grant](./09-access.md#grants),
167
- which says what they may do in each channel. Someone with `manage` in every
168
- channel creates it on the board, and it holds from the next request:
166
+ g2 lets every project on the board's team read, post, react, and label.
167
+ Anything else outside the board's project needs a
168
+ [grant](./09-access.md#grants), which says what it may do in each channel.
169
+ Someone with `manage` where it reaches creates it on the board, and it holds
170
+ from the next request:
169
171
 
170
172
  ```text
171
- $ vb grants create vercel --claim project_id=prj_marketing --claim environment=production --can feedback/=post
172
- granted g1
173
- $ vb grants create github --claim repository=acme/www --can deploys=read,post
174
- granted g2
173
+ $ vb grants create --project prj_marketing --environment production --can feedback/=post
174
+ created g4 --project prj_marketing --environment production feedback/=post
175
+ $ vb grants create --github acme/www --can deploys=read,post
176
+ created g5 --github acme/www deploys=read,post
175
177
  ```
176
178
 
177
- - **A Vercel grant names a project by its ID,** and the environment it calls
178
- from. A GitHub grant names a repository, by `repository` or
179
- `repository_id`; only `repository_id` survives a rename.
180
- - **Grants match claims; principals record IDs.** A workflow writes as
179
+ - **A project grant names a project,** and the environments it calls from. A
180
+ GitHub grant names a repository as `owner/name`; where the board can look
181
+ it up, it keeps the repository's ID, which survives a rename.
182
+ - **Principals record IDs.** A workflow writes as
181
183
  `github:repo:<repository_id>` whatever its grant names, so a rename doesn't
182
184
  change who wrote what.
183
185
  - **A `pull_request` run's token carries `ref: refs/pull/<n>/merge`,** so a
184
- grant pinned to `--claim ref=refs/heads/main` doesn't match it. Match on
185
- `event_name` instead.
186
+ grant pinned to `--branch main` doesn't match it. Match on `--event` instead.
186
187
 
187
188
  > [!WARNING]
188
189
  > For `pull_request`, GitHub runs the workflow file from the PR's merge commit,
@@ -81,7 +81,7 @@ post there (or read the thread, for a reply) has the schedule canceled with
81
81
  it`. A schedule from before board kept its creator's claims is worked out from
82
82
  the principal ID alone, which names a deployment's project ID and environment
83
83
  and nothing of a workflow's run. So the board's own deployments in its
84
- environment, and a project a Vercel grant names, keep sending; a workflow's is
84
+ environment, and a project a grant names, keep sending; a workflow's is
85
85
  `revoked` at its next send.
86
86
 
87
87
  ## In code