@vercel/board 0.34.0 → 0.36.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 (67) hide show
  1. package/dist/{access-CdBcYPQH.mjs → access-BsP0hvcC.mjs} +1 -1
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +4 -4
  4. package/dist/{actors-MrIEr9LI.mjs → actors-DFOpTw89.mjs} +2 -2
  5. package/dist/{auth-aaoKt5DK.d.mts → auth-C21V0EK1.d.mts} +1 -1
  6. package/dist/{auth-DjoJygbG.mjs → auth-CrjXLgOb.mjs} +2 -2
  7. package/dist/{backend-u1sVvybh.d.mts → backend-D21q8mdm.d.mts} +3 -3
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-9hCT654s.mjs → chat-provider-Bb-jeJLY.mjs} +2 -2
  11. package/dist/{chat-provider-De0iDnUB.d.mts → chat-provider-DmZCmBkb.d.mts} +2 -2
  12. package/dist/cli-commands.d.mts +1 -1
  13. package/dist/cli-commands.mjs +1 -1
  14. package/dist/cli-embedded.d.mts +2 -2
  15. package/dist/cli-embedded.mjs +1 -1
  16. package/dist/cli.mjs +5 -5
  17. package/dist/{commands-B8oZEByR.mjs → commands-BLtqSwha.mjs} +324 -26
  18. package/dist/{commands-BkVMdXP1.d.mts → commands-DGID-4Z2.d.mts} +175 -0
  19. package/dist/{conformance-gqYBkXFS.mjs → conformance-CKrwglzA.mjs} +480 -87
  20. package/dist/conformance.d.mts +20 -2
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/{engine-rtOVWsiF.mjs → engine-B_prP0b8.mjs} +4 -4
  23. package/dist/{errors-D8ifv16L.mjs → errors-rYDxZEuN.mjs} +98 -4
  24. package/dist/{events-IQg0k281.mjs → events-AEKh9tJm.mjs} +1 -1
  25. package/dist/exports-BxljH73E.d.mts +4 -0
  26. package/dist/{exports-Bx2dGpzr.mjs → exports-Ck4Xu3OV.mjs} +135 -24
  27. package/dist/{external-CYe424fO.mjs → external-BA2aCC_3.mjs} +1 -1
  28. package/dist/{index-D6mK0Ial.d.mts → index-LREsSZb2.d.mts} +2 -2
  29. package/dist/index.d.mts +6 -6
  30. package/dist/index.mjs +4 -4
  31. package/dist/index.node.d.mts +6 -6
  32. package/dist/index.node.mjs +3 -3
  33. package/dist/inspect/app.js +32 -32
  34. package/dist/{local-CPz22MQ8.mjs → local-DJ_qI9q7.mjs} +10 -10
  35. package/dist/{main-DScDKwQN.mjs → main-Jz4nbNJi.mjs} +409 -24
  36. package/dist/{memory-7RRnLa4X.mjs → memory-DqwXlyK4.mjs} +2 -2
  37. package/dist/{middleware-BjYpk4yq.mjs → middleware-BxgizazV.mjs} +1 -1
  38. package/dist/{provider-hB8QNrwm.d.mts → provider-DEOfc4Ls.d.mts} +21 -3
  39. package/dist/{routes-De4W6lEs.d.mts → routes-BpKdMvgX.d.mts} +19 -8
  40. package/dist/{serve-B1noQRkn.mjs → serve-Puf3I-oI.mjs} +4 -4
  41. package/dist/{server-Ov6GBJ8j.mjs → server-CS-1aeTl.mjs} +6 -6
  42. package/dist/{serving-2s7lqSBS.mjs → serving-6_bhBNAW.mjs} +1 -1
  43. package/dist/{sql-BQzKUqQt.mjs → sql-aetuEBZC.mjs} +1 -1
  44. package/dist/{sqlite-DCtZFEVm.mjs → sqlite-DvsB8ENQ.mjs} +2 -2
  45. package/dist/{sqlite-db-qLTs52Ny.mjs → sqlite-db-BPwRoDI7.mjs} +1 -1
  46. package/dist/sync-chat-sdk.d.mts +2 -2
  47. package/dist/sync-chat-sdk.mjs +2 -2
  48. package/dist/sync-github.d.mts +2 -2
  49. package/dist/sync-github.mjs +2 -2
  50. package/dist/sync-linear.d.mts +3 -3
  51. package/dist/sync-linear.mjs +2 -2
  52. package/dist/sync-slack.d.mts +3 -3
  53. package/dist/sync-slack.mjs +3 -3
  54. package/dist/sync.d.mts +2 -2
  55. package/dist/sync.mjs +2 -2
  56. package/dist/{targets-aMdbp84G.mjs → targets-Dk_xgS9q.mjs} +10 -6
  57. package/dist/{tokens-LHLrnV_P.mjs → tokens-Dn4cPZIr.mjs} +2 -2
  58. package/docs/01-board/01-mounting.md +7 -2
  59. package/docs/01-board/03-identity.md +1 -1
  60. package/docs/01-board/09-access.md +31 -0
  61. package/docs/03-guides/03-ci.md +5 -3
  62. package/docs/04-reference/01-cli.md +98 -14
  63. package/docs/04-reference/02-board.md +28 -3
  64. package/docs/04-reference/03-http.md +1 -1
  65. package/docs/04-reference/05-conformance.md +31 -5
  66. package/package.json +1 -1
  67. package/dist/exports-uwRl5qIj.d.mts +0 -4
@@ -1360,10 +1360,14 @@ declare const ReactBody: z.ZodObject<{
1360
1360
  emoji: z.ZodString;
1361
1361
  remove: z.ZodOptional<z.ZodBoolean>;
1362
1362
  }, z.core.$strip>;
1363
- /** A channel to make before anything posts to it. */
1363
+ /**
1364
+ * A channel to make before anything posts to it, and nothing else: a key it doesn't know is a 400,
1365
+ * so a client that asks for more than a channel (one that expects `private: true` to close it, say)
1366
+ * is told, never handed an open one.
1367
+ */
1364
1368
  declare const CreateChannelBody: z.ZodObject<{
1365
1369
  path: z.ZodString;
1366
- }, z.core.$strip>;
1370
+ }, z.core.$strict>;
1367
1371
  /** At most this many labels in a label write's `if`. */
1368
1372
  declare const LABEL_CONDITIONS_MAX = 16;
1369
1373
  declare const LabelBody: z.ZodObject<{
@@ -1383,9 +1387,16 @@ type ScheduleInput = z.input<typeof ScheduleBody>;
1383
1387
  type ScheduleBodyOutput = z.output<typeof ScheduleBody>;
1384
1388
  type SchedulesQueryInput = z.input<typeof SchedulesQuery>;
1385
1389
  /** A principal as `createGrant` and `updateGrant` take it. */
1390
+ /**
1391
+ * A principal as a handle takes it. A project's environments, and every project's, are production
1392
+ * when left out, so the board always gets them; a principal to remove goes by who it is, and keeps
1393
+ * none.
1394
+ */
1386
1395
  type PrincipalInput = z.input<typeof PrincipalInput>;
1387
- /** A grant's `can`: each channel pattern and what it gives, `'all'` or a list, `[]` for none. */
1388
- type GrantCan = WrittenCan;
1396
+ /** What a grant gives at a pattern, as a handle takes it: `'all'`, `'none'`, or permissions. `'none'` is `[]` on the wire. */
1397
+ type CanAt = 'all' | 'none' | readonly Permission[];
1398
+ /** A grant's `can`, as a handle takes it: each channel pattern and what it gives. */
1399
+ type GrantCan = Readonly<Record<string, CanAt>>;
1389
1400
  /** What `createGrant` takes. */
1390
1401
  type GrantInput = {
1391
1402
  principals: readonly PrincipalInput[];
@@ -1397,9 +1408,9 @@ type UpdateGrantInput = {
1397
1408
  remove?: readonly PrincipalInput[];
1398
1409
  can?: GrantCan;
1399
1410
  };
1400
- /** What `token` takes: `can` as `access` writes it. */
1411
+ /** What `token` takes: `can` as `access` writes it, with `'none'` for a pattern it may do nothing in. */
1401
1412
  type TokenInput = Omit<z.input<typeof TokenBody>, 'can'> & {
1402
- can?: Can;
1413
+ can?: Can | GrantCan;
1403
1414
  };
1404
1415
  type SchedulesQueryOutput = z.output<typeof SchedulesQuery>;
1405
1416
  /** A scheduled message. It posts as `by`, its creator; each message it posts carries `schedule: { id, n }`. */
@@ -1813,7 +1824,7 @@ declare const routes: {
1813
1824
  readonly path: '/channels';
1814
1825
  readonly body: z.ZodObject<{
1815
1826
  path: z.ZodString;
1816
- }, z.core.$strip>;
1827
+ }, z.core.$strict>;
1817
1828
  };
1818
1829
  readonly actors: {
1819
1830
  readonly method: 'GET';
@@ -2652,4 +2663,4 @@ declare const routes: {
2652
2663
  };
2653
2664
  type RouteName = keyof typeof routes;
2654
2665
  //#endregion
2655
- export { ScheduleView as $, Attachment as $t, MatchView as A, UpdateGrantBody as At, PrincipalInput as B, Grant as Bt, InboxNextQuery as C, ThreadsQuery as Ct, LabelBody as D, TokenView as Dt, LABEL_CONDITIONS_MAX as E, TokenInput as Et, MessagesQuery as F, Access as Ft, RegisterBody as G, Level as Gt, REGISTERED_WATCHERS_MAX as H, GrantChangeRefusal as Ht, MessagesQueryInput as I, AccessSummary as It, ResolvedSyncTarget as J, checkGrantChange as Jt, RegisterInput as K, Permission as Kt, ParsedFilters as L, Can as Lt, Me as M, UploadStartBody as Mt, MessageView as N, UploadTicket as Nt, LinkView as O, TypingBody as Ot, MessagesPage as P, routes as Pt, ScheduleInput as Q, ExternalCopy as Qt, PostBody as R, ChannelPattern as Rt, InboxItem as S, ThreadsPage as St, InboxQuery as T, TokenBody as Tt, ReactBody as U, GrantShape as Ut, PrincipalView as V, GrantChange as Vt, Ref as W, InvalidCan as Wt, ScheduleBody as X, union as Xt, RouteName as Y, compileAccess as Yt, ScheduleBodyOutput as Z, Actor as Zt, GrantCan as _, SyncReceiptInput as _t, ChannelView as a, ExternalLink as an, SourceMessage as at, InboxAckBody as b, ThreadSummaryView as bt, Discovery as c, SyncBody as ct, EventsQuery as d, SyncFindInput as dt, Author as en, SchedulesQuery as et, EventsQueryInput as f, SyncFindQuery as ft, GrantBody as g, SyncReceiptBody as gt, FiltersInput as h, SyncImportInput as ht, BoardEventView as i, ExternalFile as in, SourceJoinBody as it, MatchesQuery as j, UpdateGrantInput as jt, LinkedQuery as k, TypingResult as kt, EditBody as l, SyncCopiesQuery as lt, Explanation as m, SyncImportBody as mt, ActorView as n, ExternalAuthor as nn, SchedulesQueryOutput as nt, CreateChannelBody as o, Link as on, SourceRead as ot, ExplainQuery as p, SyncFindView as pt, RegistrationView as q, WrittenCan as qt, ApiError as r, ExternalEvent as rn, SourceJoin as rt, DeleteBody as s, SourceReadQuery as st, AckBody as t, Labels as tn, SchedulesQueryInput as tt, EventsPage as u, SyncCopiesView as ut, GrantInput as v, SyncThreadView as vt, InboxPushBody as w, ThreadsQueryInput as wt, InboxEntry as x, ThreadView as xt, GrantView as y, SyncedView as yt, PostInput as z, FULL_ACCESS as zt };
2666
+ export { ScheduleInput as $, ExternalCopy as $t, LinkedQuery as A, TypingResult as At, PostInput as B, FULL_ACCESS as Bt, InboxItem as C, ThreadsPage as Ct, LABEL_CONDITIONS_MAX as D, TokenInput as Dt, InboxQuery as E, TokenBody as Et, MessagesPage as F, routes as Ft, Ref as G, InvalidCan as Gt, PrincipalView as H, GrantChange as Ht, MessagesQuery as I, Access as It, RegistrationView as J, WrittenCan as Jt, RegisterBody as K, Level as Kt, MessagesQueryInput as L, AccessSummary as Lt, MatchesQuery as M, UpdateGrantInput as Mt, Me as N, UploadStartBody as Nt, LabelBody as O, TokenView as Ot, MessageView as P, UploadTicket as Pt, ScheduleBodyOutput as Q, Actor as Qt, ParsedFilters as R, Can as Rt, InboxEntry as S, ThreadView as St, InboxPushBody as T, ThreadsQueryInput as Tt, REGISTERED_WATCHERS_MAX as U, GrantChangeRefusal as Ut, PrincipalInput as V, Grant as Vt, ReactBody as W, GrantShape as Wt, RouteName as X, compileAccess as Xt, ResolvedSyncTarget as Y, checkGrantChange as Yt, ScheduleBody as Z, union as Zt, GrantBody as _, SyncReceiptBody as _t, CanAt as a, ExternalFile as an, SourceJoinBody as at, GrantView as b, SyncedView as bt, DeleteBody as c, SourceReadQuery as ct, EventsPage as d, SyncCopiesView as dt, Attachment as en, ScheduleView as et, EventsQuery as f, SyncFindInput as ft, FiltersInput as g, SyncImportInput as gt, Explanation as h, SyncImportBody as ht, BoardEventView as i, ExternalEvent as in, SourceJoin as it, MatchView as j, UpdateGrantBody as jt, LinkView as k, TypingBody as kt, Discovery as l, SyncBody as lt, ExplainQuery as m, SyncFindView as mt, ActorView as n, Labels as nn, SchedulesQueryInput as nt, ChannelView as o, ExternalLink as on, SourceMessage as ot, EventsQueryInput as p, SyncFindQuery as pt, RegisterInput as q, Permission as qt, ApiError as r, ExternalAuthor as rn, SchedulesQueryOutput as rt, CreateChannelBody as s, Link as sn, SourceRead as st, AckBody as t, Author as tn, SchedulesQuery as tt, EditBody as u, SyncCopiesQuery as ut, GrantCan as v, SyncReceiptInput as vt, InboxNextQuery as w, ThreadsQuery as wt, InboxAckBody as x, ThreadSummaryView as xt, GrantInput as y, SyncThreadView as yt, PostBody as z, ChannelPattern as zt };
@@ -1,7 +1,7 @@
1
- import { u as BoardError } from "./errors-D8ifv16L.mjs";
2
- import { t as board, u as localTokenFile } from "./server-Ov6GBJ8j.mjs";
3
- import { t as oidcTokens } from "./tokens-LHLrnV_P.mjs";
4
- import { t as local } from "./local-CPz22MQ8.mjs";
1
+ import { u as BoardError } from "./errors-rYDxZEuN.mjs";
2
+ import { t as board, u as localTokenFile } from "./server-CS-1aeTl.mjs";
3
+ import { t as oidcTokens } from "./tokens-Dn4cPZIr.mjs";
4
+ import { t as local } from "./local-DJ_qI9q7.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-D8ifv16L.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 { P as RegisterBody, Y as routes, a as compileWatcher, c as METHODS, i as canonicalWatchers } from "./targets-aMdbp84G.mjs";
4
- import { a as DERIVED_ID, c as keyId, l as sha256 } from "./middleware-BjYpk4yq.mjs";
5
- import { a as registrant, o as wakePath, r as createVercel, t as createBoard } from "./exports-Bx2dGpzr.mjs";
3
+ import { P as RegisterBody, Y as routes, a as compileWatcher, c as METHODS, i as canonicalWatchers } from "./targets-Dk_xgS9q.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-Ck4Xu3OV.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";
@@ -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-rtOVWsiF.mjs"),
1091
- serving: () => import("./serving-2s7lqSBS.mjs")
1090
+ sync: () => import("./engine-B_prP0b8.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-LHLrnV_P.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
1
  import { _ as actorKind } from "./schemas-BG205xds.mjs";
2
- import { c as externalMessageKey, l as isThreadTarget } from "./external-CYe424fO.mjs";
2
+ import { c as externalMessageKey, l as isThreadTarget } from "./external-BA2aCC_3.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
5
  //#region src/contract/folds.ts
@@ -1,6 +1,6 @@
1
- import { r as sqlTables } from "./sql-BQzKUqQt.mjs";
1
+ import { r as sqlTables } from "./sql-aetuEBZC.mjs";
2
2
  import { t as sqlite$1 } from "./store-sqlite-D6fIszST.mjs";
3
- import { t as sqliteDb } from "./sqlite-db-qLTs52Ny.mjs";
3
+ import { t as sqliteDb } from "./sqlite-db-BPwRoDI7.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-BQzKUqQt.mjs";
1
+ import { n as ddl } from "./sql-aetuEBZC.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 { b as channels, g as SyncFn, p as SyncProvider } from "./provider-hB8QNrwm.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-De0iDnUB.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 channels, i as eventSchema, r as envelope } from "./events-IQg0k281.mjs";
2
- import { t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
1
+ import { f as channels, i as eventSchema, r as envelope } from "./events-AEKh9tJm.mjs";
2
+ import { t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.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 { f as SyncContext, g as SyncFn, y as SyncUnit } from "./provider-hB8QNrwm.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-De0iDnUB.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,5 @@
1
- import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-IQg0k281.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
1
+ import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-AEKh9tJm.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.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 { ot as SourceRead } from "./routes-De4W6lEs.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-hB8QNrwm.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-De0iDnUB.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";
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-IQg0k281.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
1
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-AEKh9tJm.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.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 { an as ExternalLink } from "./routes-De4W6lEs.mjs";
2
- import { b as channels, d as ResolvedTarget, f as SyncContext, g as SyncFn, o as ProviderPost, r as ProviderDelivery } from "./provider-hB8QNrwm.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-De0iDnUB.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
@@ -1,7 +1,7 @@
1
1
  import { d as MESSAGE_TEXT_MAX } from "./schemas-BG205xds.mjs";
2
- import "./external-CYe424fO.mjs";
3
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-IQg0k281.mjs";
4
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-9hCT654s.mjs";
2
+ import "./external-BA2aCC_3.mjs";
3
+ import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-AEKh9tJm.mjs";
4
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-Bb-jeJLY.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 { in as ExternalFile, nn as ExternalAuthor, rn as ExternalEvent } from "./routes-De4W6lEs.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-hB8QNrwm.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 };
package/dist/sync.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as ExternalEvent } from "./external-CYe424fO.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-IQg0k281.mjs";
1
+ import { n as ExternalEvent } from "./external-BA2aCC_3.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-AEKh9tJm.mjs";
3
3
  export { EventBase, ExternalEvent, ReceivedEvent, ResolvedTarget, SyncOverrides, SyncProvider, 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-D8ifv16L.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
- 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-B8oZEByR.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 { o as options } from "./commands-BLtqSwha.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
@@ -469,8 +469,12 @@ const ReactBody = z.object({
469
469
  emoji: Emoji,
470
470
  remove: z.boolean().optional()
471
471
  });
472
- /** A channel to make before anything posts to it. */
473
- 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 });
474
478
  const LabelBody = z.object({
475
479
  set: Labels.optional(),
476
480
  unset: z.array(LabelKey).optional(),
@@ -760,7 +764,7 @@ const routes = {
760
764
  };
761
765
  //#endregion
762
766
  //#region src/version.ts
763
- const VERSION = "0.34.0";
767
+ const VERSION = "0.36.0";
764
768
  //#endregion
765
769
  //#region src/server/backend.ts
766
770
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -1,5 +1,5 @@
1
- import { l as unauthorized } from "./errors-D8ifv16L.mjs";
2
- import { _ as privateHost, a as VERCEL_ISSUER, b as trustedIssuers, g as markVerified, i as TOKENS, m as issuerName } from "./auth-DjoJygbG.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
@@ -183,7 +183,7 @@ created g5 --github acme/www deploys=read,post
183
183
  `github:repo:<repository_id>` whatever its grant names, so a rename doesn't
184
184
  change who wrote what.
185
185
  - **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.
186
+ grant pinned to `--git-branch main` doesn't match it. Match on `--event` instead.
187
187
 
188
188
  > [!WARNING]
189
189
  > For `pull_request`, GitHub runs the workflow file from the PR's merge commit,
@@ -76,6 +76,27 @@ console.log(await team.grants())
76
76
  await team.revokeGrant(grant.id)
77
77
  ```
78
78
 
79
+ The CLI says the same with a flag for each principal, its modifiers after it
80
+ (see [`vb grants`](../04-reference/01-cli.md#grants)), and each command is the
81
+ handle call beside it. The handle fills in what the CLI does: `'none'` at a
82
+ pattern is `[]`, and a project without `environments` is its production
83
+ deployments.
84
+
85
+ | CLI | Handle |
86
+ | --- | --- |
87
+ | `vb grants` | `team.grants()` |
88
+ | `vb grants create --everyone --can 'security/=none'` | `team.createGrant({ principals: [{ kind: 'everyone' }], can: { 'security/': 'none' } })` |
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
+ | `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 --git-branch main --can 'ci/=post'` | `team.createGrant({ principals: [{ kind: 'github', repository: 'acme/web', workflow: 'ci.yml', branch: 'main' }], can: { 'ci/': ['post'] } })` |
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
+ | `vb grants create --app ship --can 'ship/=post'` | `team.createGrant({ principals: [{ kind: 'app', app: 'ship' }], can: { 'ship/': ['post'] } })` |
94
+ | `vb grants update g5 --add-user carol@acme.com` | `team.updateGrant('g5', { add: [{ kind: 'user', email: 'carol@acme.com' }] })` |
95
+ | `vb grants update g6 --remove-project sec --can 'security/=read'` | `team.updateGrant('g6', { remove: [{ kind: 'project', project: 'sec' }], can: { 'security/': ['read'] } })` |
96
+ | `vb grants revoke g4` | `team.revokeGrant('g4')` |
97
+ | `vb grants explain --user bob@acme.com security/incidents` | `team.explain('security/incidents', { user: 'bob@acme.com' })` |
98
+ | `vb channels create security --private` | `team.createChannel('security', { private: true })` |
99
+
79
100
  | Principal | Names | Level |
80
101
  | --- | --- | --- |
81
102
  | `user` | a person on the team, by `email`, or by `userId` on a board that verifies tokens itself | one principal |
@@ -174,6 +195,16 @@ more specific pattern decides first.
174
195
  its local user, the one `vb serve` mints a token for: a person on the team
175
196
  is a principal like any other. Reading a closed channel still takes a
176
197
  grant, an owner's too.
198
+ - **A private channel is two grants and the channel.**
199
+ `createChannel(path, { private: true })` makes a grant letting you in at
200
+ `<path>/`, then one closing it to `everyone`, then the channel. Before it
201
+ writes anything, it lists the grants, and refuses a path a grant other than
202
+ `*`'s reaches (409 `channel_granted`, naming it), since that grant would
203
+ still let in whom it names, and a path where it or a channel under it is
204
+ there (409 `channel_exists`), since the lock would close those too. Two
205
+ people making the same one at once never both keep a way in, and a grant
206
+ someone makes, or adds themselves to, before the lock lands undoes it, with
207
+ nothing made.
177
208
  - **A grant takes only the keys it knows.** A misspelled one, `workflows` for
178
209
  `workflow` say, is 400, never dropped, so a grant never names more than you
179
210
  wrote.
@@ -51,8 +51,10 @@ API by itself. A board that keeps [grants](../01-board/09-access.md#grants)
51
51
  lets it in by its token: one on [`local()`](../01-board/10-local.md) that your
52
52
  team serves in a long-running process, or a
53
53
  [backend of your own](../01-board/01-mounting.md#a-backend-of-your-own).
54
- Vercel's board doesn't keep grants yet. Someone with `manage` in every channel
55
- grants the repo's runs what they may do, with no deploy:
54
+ Vercel's board keeps these grants, but doesn't sign in GitHub or OIDC callers
55
+ yet, so a run's token gets a 401 there. The grant works once it does, with
56
+ nothing to change. Someone with `manage` in every channel grants the repo's
57
+ runs what they may do, with no deploy:
56
58
 
57
59
  ```text
58
60
  $ vb grants create --github acme/www --event push --can 'errors-www=post,label;deploys=read,post'
@@ -60,7 +62,7 @@ created g4 --github acme/www --event push errors-www=post,label deploys=read,p
60
62
  ```
61
63
 
62
64
  The grant matches the token's `repository` and `event_name`, and a
63
- `--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
64
66
  branch. The workflow writes as `github:repo:<repository_id>`, with the
65
67
  handle `acme/www`. A workflow no grant lets in gets a 403 whose hint is the
66
68
  grant to create: `Grant it: vb grants create --github acme/www`.
@@ -179,12 +179,12 @@ itself.
179
179
  $ vb read dev --name security --ensure
180
180
  error: this project has no access to board security (prj_pong, preview).
181
181
 
182
- Someone who manages the board can grant it.
182
+ Grant it: vb grants create --project prj_pong --environment preview --name security --can '*=read,post,react,label'
183
183
 
184
184
  $ vb read dev
185
185
  error: this project has no access to the team's board (prj_pong, preview).
186
186
 
187
- Someone who manages the board can grant it.
187
+ Grant it: vb grants create --project prj_pong --environment preview --can '*=read,post,react,label'
188
188
  ```
189
189
  - **A team's board has a URL too:** the one `whoami` prints for it
190
190
  (`https://api.vercel.com/v1/messageboard/boards/<board>?teamId=<team>`), which
@@ -299,6 +299,7 @@ error document:
299
299
  - **`reason` is what a program branches on:** `missing_scope`,
300
300
  `login_required`, `permission_denied`, `deployment_protected`,
301
301
  `board_not_found`, `board_not_granted`, `board_name_taken`,
302
+ `board_token_scope`, `board_token_unsupported`,
302
303
  `message_not_found`, `channel_not_found`,
303
304
  `unknown_command`, `unknown_option`, `invalid_arguments`, `timeout`, and
304
305
  the board's own codes, such as `already_synced` or `no_scheduler`.
@@ -485,22 +486,91 @@ t1 feedback-widget feedback/=post expires in 30d
485
486
 
486
487
  ```text
487
488
  vb grants [list]
489
+ vb grants create <principal>... --can <pattern=permissions>...
490
+ vb grants update <grant> [--add-<kind> <name>]... [--remove-<kind> <name>]... [--can <pattern=permissions>]...
491
+ vb grants explain [<principal>] <channel>
488
492
  vb grants revoke <grant>
489
493
  ```
490
494
 
491
495
  `vb grants` lists each grant's ID, the principals it names as the flags that
492
496
  name them, and what it lets them do: `*` alone in words, any other pattern as
493
- `pattern=permissions`, `none` for a closed one. It needs `manage` at `*`.
494
- `grants revoke g3` stops one and prints `revoked g3`, and needs `manage` at
495
- each pattern it names. See [Grants](../01-board/09-access.md#grants).
497
+ `pattern=permissions`, `none` for a closed one. It needs `manage` at `*`. See
498
+ [Grants](../01-board/09-access.md#grants).
496
499
 
497
- ```text
498
- $ vb grants
499
- g1 --all-users everything
500
- g2 --all-projects --environment production,preview,development read post react label
501
- $ vb grants revoke g2
502
- revoked g2
503
- ```
500
+ A principal is a flag, and repeating flags names several:
501
+
502
+ | Flag | Names | Its modifiers |
503
+ | --- | --- | --- |
504
+ | `--user <email>` | a person on the team | |
505
+ | `-p, --project <name\|id>` | a project's deployments | `-e, --environment` |
506
+ | `--github <owner/repo>` | GitHub Actions runs in a repository | `--workflow`, `--git-branch`, `--event` |
507
+ | `--oidc <issuer>` | an issuer's tokens | `--claim name=value` |
508
+ | `--app <slug\|id>` | an app installed on the team | |
509
+ | `--all-users` | every person on the team | |
510
+ | `--all-projects` | every project's deployments on the team | `-e, --environment` |
511
+ | `--all-apps` | every app installed on the team | |
512
+ | `--everyone` | everyone something else lets in | |
513
+
514
+ A modifier goes after the principal it's for, so one grant mixes them:
515
+ `--github acme/web --workflow ci.yml --github acme/api --workflow deploy.yml`.
516
+ `--environment` takes a comma-separated list and is `production` when left
517
+ out. `--workflow` matches the run's workflow file (`ci.yml` is
518
+ `.github/workflows/ci.yml`), `--git-branch` its `refs/heads/` branch, and
519
+ `--event` its event. `--can pattern=permissions` repeats; permissions are a
520
+ comma-separated list, `all`, or `none`. A board that verifies tokens itself,
521
+ as `vb serve` does, takes IDs: `--user u_123`, `--project prj_123`, and an
522
+ app's client ID.
523
+
524
+ `create` prints the grant it made as its row. `update` takes `--add-<kind>` and
525
+ `--remove-<kind>` for each kind (`--add-user`, `--remove-project`,
526
+ `--add-github … --workflow …`), and `--can`, which replaces the grant's.
527
+ Adding a project it names already adds the environments; to narrow one,
528
+ remove it and add it back in the same update. Each needs `manage` at the
529
+ patterns the grant names, before and after. `revoke` stops one.
530
+
531
+ ```text
532
+ $ vb grants create --everyone --can 'security/=none'
533
+ created g4 --everyone security/=none
534
+ $ vb grants create --user alice@acme.com --user bob@acme.com --can 'security/=all'
535
+ created g5 --user alice@acme.com --user bob@acme.com security/=all
536
+ $ vb grants create --project sec --environment production,preview --can 'security/=read,post'
537
+ created g6 --project sec --environment production,preview security/=read,post
538
+ $ vb grants update g5 --add-user carol@acme.com
539
+ updated g5 --user alice@acme.com --user bob@acme.com --user carol@acme.com security/=all
540
+ $ vb grants update g6 --remove-project sec --add-project sec --environment production --can 'security/=read'
541
+ updated g6 --project sec --environment production security/=read
542
+ $ vb grants revoke g4
543
+ revoked g4
544
+ ```
545
+
546
+ Vercel's board keeps a grant for `--github` or `--oidc`, but doesn't sign in
547
+ GitHub or OIDC callers yet, so `create` says so under it, and with `--json` in
548
+ `warnings` (`callers_not_signed_in`):
549
+
550
+ ```text
551
+ $ vb grants create --github acme/web --can 'ci/=post' --scope acme
552
+ created g4 --github acme/web ci/=post
553
+ note Vercel's board doesn't sign in GitHub or OIDC callers yet: this grant works once it does
554
+ ```
555
+
556
+ `explain` says which grant decides a channel: the pattern that won and those
557
+ it won over, the closest grants there, and what they give. It explains you, or
558
+ with `manage` at `*`, the one `--user`, `--project` (in one `--environment`),
559
+ `--github`, `--oidc`, or `--app` it names. A local board has no apps, so
560
+ nothing lets one in there. A caller that can't list grants sees that
561
+ one decides, not which:
562
+
563
+ ```text
564
+ $ vb grants explain --user bob@acme.com security/incidents
565
+ security/ wins over *. Closest grant for bob@acme.com: g4 (--user): all.
566
+ $ vb grants explain --user dan@acme.com security/incidents
567
+ security/ wins over *. Closest grant for dan@acme.com: g3 (--everyone): none.
568
+ $ vb grants explain dev
569
+ * wins. Closest grant for you: g1 (--all-users): all.
570
+ ```
571
+
572
+ With `--json`, `create` and `update` print `{ grant, outcome }` and `explain`
573
+ prints `{ explanation }`.
504
574
 
505
575
  ## Reading
506
576
 
@@ -508,7 +578,7 @@ revoked g2
508
578
 
509
579
  ```text
510
580
  vb channels
511
- vb channels create <channel>
581
+ vb channels create <channel> [--private]
512
582
  ```
513
583
 
514
584
  Channels, grouped by path prefix, each with its thread and message counts and
@@ -527,8 +597,22 @@ $ vb channels create dev/alerts
527
597
  dev/alerts already exists
528
598
  ```
529
599
 
600
+ `--private` closes it to everyone but you, as `createChannel(path, { private:
601
+ true })` does: a grant letting you in, one closing it to everyone else, then
602
+ the channel. It needs `manage` at `*`, since it lists the grants first, and
603
+ makes nothing where the channel, or one under it, is there already, or where a
604
+ grant other than `*`'s reaches it already, which it names, since that grant
605
+ would still let in whom it names:
606
+
607
+ ```text
608
+ $ vb channels create security --private
609
+ created channel security
610
+ created g7 --user alice@acme.com security/=all
611
+ created g8 --everyone security/=none
612
+ ```
613
+
530
614
  With `--json`, it prints `{ channel, outcome }`, where `outcome` is `created`
531
- or `unchanged`.
615
+ or `unchanged`, and with `--private`, the `grants` it made.
532
616
 
533
617
  ### actors
534
618
 
@@ -310,8 +310,10 @@ revokeGrant(id: string): Promise<{ revoked: boolean }>
310
310
  ```
311
311
 
312
312
  `createGrant` lets `principals` do what `can` says: a map from channel pattern
313
- to `'all'` or a list of permissions, `[]` for none. The same principals again
314
- are another grant. `updateGrant` adds principals (a project it names already
313
+ to `'all'`, `'none'`, or a list of permissions, which the handle sends as the
314
+ protocol has it (`'none'` as `[]`). A `project` or `all-projects` without
315
+ `environments` is its production deployments. The same principals again are
316
+ another grant. `updateGrant` adds principals (a project it names already
315
317
  gets the new environments), removes them by who they are, and replaces `can`.
316
318
  Making or widening one needs what you'd grant: `manage` at its patterns and
317
319
  under them wherever your own limits narrow you, and what `everyone` gives, for
@@ -368,6 +370,11 @@ cursor the read reflects. Without `after`, it's the latest `limit` (50 by
368
370
  default, at most 500); with `after`, the first `limit` after it. `before`
369
371
  pages back. Both take a cursor or a message ID.
370
372
 
373
+ A team board in Vercel's API lists a channel's newest 100 and no further back.
374
+ Up to a `limit` of 100, the latest across channels is exactly the latest
375
+ `limit`. Past that, it stops where the busiest channel's 100 do, so it can be
376
+ fewer than `limit`, but it never skips a message newer than its oldest.
377
+
371
378
  ```ts
372
379
  const page = await team.messages({ channel: 'errors-www', label: { status: 'open' }, limit: 100 })
373
380
  ```
@@ -414,7 +421,7 @@ that reply in it.
414
421
 
415
422
  ```ts
416
423
  channels(): Promise<ChannelView[]> // { path, lastIndex?, messages?, threads? }
417
- createChannel(path: string): Promise<{ channel: ChannelView; created: boolean }>
424
+ createChannel(path: string, options?: { private?: boolean }): Promise<{ channel: ChannelView; created: boolean; grants?: GrantView[] }>
418
425
  actors(): Promise<Actor[]> // { id, kind, handle, name, avatar }
419
426
  me(): Promise<Me> // who this handle writes as
420
427
  discovery(): Promise<Discovery> // no token needed: url, audience, team_id, project_id, version, sync
@@ -433,6 +440,24 @@ and Vercel's board, which counts nothing in a channel, leaves them out.
433
440
  would. It needs `read` and `post` there. `created` is false for one that's
434
441
  there already, made by a post or another create, which it leaves as it is.
435
442
 
443
+ `{ private: true }` closes it to everyone but you, with the grant methods
444
+ alone: a grant letting you in at `<path>/`, then one closing `<path>/` to
445
+ `everyone`, then the channel, answered as `grants`. Before it writes anything,
446
+ it refuses a caller that's neither a person nor a project's deployment (400
447
+ `no_own_principal`), one that can't list grants, a path a grant other than
448
+ `*`'s reaches (409 `channel_granted`, naming it), since that grant would still
449
+ let in whom it names, and a path where it or a channel under it is there (409
450
+ `channel_exists`), since closing `security/` closes `security/incidents` too.
451
+ A failure part way never shuts you out: it leaves the channel open with a
452
+ grant too many, or closed and not made yet. A board that keeps no grants fails
453
+ on the listing, with nothing made. Once its own grant is made, it lists the
454
+ grants again and takes its own back if another reaches the path, so two people
455
+ making the same channel at once never both keep a way in. Once the lock is
456
+ made, it lists them a last time: a grant someone made before the lock landed,
457
+ or its own two changed (someone added to its grant, or the lock opened), would
458
+ still let them in, so it takes both of its grants back, the lock first, and
459
+ refuses with `channel_granted`.
460
+
436
461
  `discovery()` is the backend's: on `local()`, the board's own, and with
437
462
  `BOARD_URL` set, the board at that URL's.
438
463
 
@@ -99,7 +99,7 @@ a refused write it can read answers 403. `GET /me` returns the caller's
99
99
  | GET | `/` | Discovery (no token): `{ version, url, audience, team_id, project_id, sync, wake_by_path? }`, where `sync` lists each entry's `key` and `platform`, and `wake_by_path` says `POST /watchers` takes a `path`. A board with no backend has none: it answers only wake-ups and webhooks |
100
100
  | GET | `/me` | Who this token and profile write as: `{ actor, principal, kind, handle, name, avatar, profile, session, expiresAt, can }`, where `can` maps each channel pattern to its permissions |
101
101
  | GET | `/channels` | `{ channels, cursor }`: each `{ path, lastIndex?, messages?, threads? }`, sorted by path. A board that doesn't count them, as one on Vercel's API doesn't, leaves the counts out |
102
- | POST | `/channels` | `{ path }`: makes a channel before anything posts to it. `{ channel, created }`, 201 when it made it, and 200 with `created: false` for one that's there, which it leaves as it is |
102
+ | POST | `/channels` | `{ path }`: makes a channel before anything posts to it. `{ channel, created }`, 201 when it made it, and 200 with `created: false` for one that's there, which it leaves as it is. A key it doesn't know is 400, so `private` makes nothing |
103
103
  | GET | `/actors` | `{ actors, cursor }`: each `{ id, kind, handle, name, avatar }`, sorted by handle |
104
104
  | GET | `/messages` | `{ messages, cursor }`, filtered. See [Listing messages](#listing-messages) |
105
105
  | GET | `/threads` | `{ threads, cursor }`: a summary per matching thread. See [Listing threads](#listing-threads) |