@vercel/board 0.45.1 → 0.47.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 (88) hide show
  1. package/dist/{access-3udXjJAg.mjs → access-C06pIr0M.mjs} +2 -2
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +5 -5
  4. package/dist/{actors-DasGZnfb.mjs → actors-Dkyg-oo0.mjs} +3 -3
  5. package/dist/{auth-aiOVE82-.mjs → auth-B9-wXQ-x.mjs} +29 -9
  6. package/dist/{auth-BG_whr9_.d.mts → auth-li3lKwJG.d.mts} +1 -1
  7. package/dist/{backend-D6yTo8Un.d.mts → backend-i_esjwUS.d.mts} +144 -5
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-V2jnjVLq.d.mts → chat-provider-BWBGZOZY.d.mts} +4 -2
  11. package/dist/{chat-provider-BvNqOQFL.mjs → chat-provider-CD7jskh7.mjs} +7 -4
  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 +3 -2
  16. package/dist/cli.mjs +46 -15
  17. package/dist/{commands-DewS14_P.d.mts → commands-CJsOA-hf.d.mts} +60 -0
  18. package/dist/{commands-CqdnjUkm.mjs → commands-Dk6_cHLS.mjs} +325 -0
  19. package/dist/{conformance-BInS4_6b.mjs → conformance-CDP8y2Zm.mjs} +1063 -6
  20. package/dist/conformance.d.mts +6 -5
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/{engine-XVBt02Bl.mjs → engine-j2VeNuKG.mjs} +51 -50
  23. package/dist/{errors-ZazTZh-s.mjs → errors-QhkdzI-o.mjs} +176 -9
  24. package/dist/{events-D17RndlV.mjs → events-MOcxGpOQ.mjs} +2 -2
  25. package/dist/{exports-DCxecX15.mjs → exports-CEqS-IPP.mjs} +1417 -84
  26. package/dist/exports-CF9rKCXd.d.mts +44 -0
  27. package/dist/{external-DfhN7lKK.mjs → external-BuVTXT1R.mjs} +7 -3
  28. package/dist/{index-Djmr4GzQ.d.mts → index-ttfx1TZ6.d.mts} +2 -2
  29. package/dist/index.d.mts +6 -6
  30. package/dist/index.mjs +5 -5
  31. package/dist/index.node.d.mts +7 -6
  32. package/dist/index.node.mjs +5 -4
  33. package/dist/inspect/app.js +215 -115
  34. package/dist/inspect/engine.js +5 -5
  35. package/dist/inspect-8YAhl_h3.mjs +2 -0
  36. package/dist/{inspect-CHsgnf_5.mjs → inspect-vOSrW_g6.mjs} +322 -50
  37. package/dist/{local-DE9vmanM.mjs → local-0ajWOVhN.mjs} +1673 -98
  38. package/dist/{main-CF1Me3jg.mjs → main-B8Zkd4Pm.mjs} +1282 -58
  39. package/dist/{memory-DyEL0fvN.mjs → memory-CMm-Fk_A.mjs} +2 -2
  40. package/dist/{mentions-DfZGp3B-.mjs → mentions-CnWt9Z5b.mjs} +34 -1
  41. package/dist/{middleware-BHHKHA9q.mjs → middleware-CT6vMNUc.mjs} +2 -2
  42. package/dist/{provider-BC9mPYVh.d.mts → provider-Bc3xI90K.d.mts} +199 -6
  43. package/dist/{routes-CkUetTO2.mjs → routes-ABXf3CKq.mjs} +261 -8
  44. package/dist/{routes-zm4TXKCC.d.mts → routes-CjA6Mp4D.d.mts} +610 -6
  45. package/dist/{schemas-BhZaystC.mjs → schemas-7VFdomFB.mjs} +34 -1
  46. package/dist/serve-BepKXDH3.mjs +285 -0
  47. package/dist/{server-Bmz0zqYM.mjs → server-4rQL3xuH.mjs} +41 -22
  48. package/dist/{serving-BLVRrJ7P.mjs → serving-BNdiReQT.mjs} +1 -1
  49. package/dist/{sql-CyVcjw8x.mjs → sql-IEbO5vXs.mjs} +174 -9
  50. package/dist/{sqlite-Con-8duk.mjs → sqlite-CVG8XKHm.mjs} +2 -2
  51. package/dist/{sqlite-db-BdzxtUOV.mjs → sqlite-db-BJjPQYx4.mjs} +1 -1
  52. package/dist/sync-chat-sdk.d.mts +16 -2
  53. package/dist/sync-chat-sdk.mjs +2 -2
  54. package/dist/sync-github.d.mts +16 -2
  55. package/dist/sync-github.mjs +3 -3
  56. package/dist/sync-linear.d.mts +17 -3
  57. package/dist/sync-linear.mjs +2 -2
  58. package/dist/sync-slack.d.mts +17 -3
  59. package/dist/sync-slack.mjs +107 -15
  60. package/dist/sync.d.mts +2 -2
  61. package/dist/sync.mjs +2 -2
  62. package/dist/{origin-BbwhnKrg.mjs → task-batch-BZXm6kOE.mjs} +83 -8
  63. package/dist/{tokens-BErYXuHZ.mjs → tokens-BCp4EWTQ.mjs} +2 -2
  64. package/docs/01-board/01-mounting.md +8 -5
  65. package/docs/01-board/03-identity.md +43 -23
  66. package/docs/01-board/04-messages.md +3 -2
  67. package/docs/01-board/06-watchers.md +3 -3
  68. package/docs/01-board/07-schedules.md +2 -2
  69. package/docs/01-board/08-middleware.md +7 -0
  70. package/docs/01-board/09-access.md +6 -4
  71. package/docs/01-board/10-local.md +4 -1
  72. package/docs/01-board/11-tasks.md +348 -0
  73. package/docs/02-sync/01-overview.md +4 -5
  74. package/docs/02-sync/02-functions.md +2 -2
  75. package/docs/02-sync/03-slack.md +8 -5
  76. package/docs/02-sync/06-providers.md +8 -0
  77. package/docs/03-guides/02-inspector.md +83 -10
  78. package/docs/03-guides/06-sandboxed-agents.md +7 -5
  79. package/docs/03-guides/07-build-a-ui.md +210 -0
  80. package/docs/03-guides/08-tailnet.md +123 -0
  81. package/docs/04-reference/01-cli.md +272 -23
  82. package/docs/04-reference/02-board.md +287 -7
  83. package/docs/04-reference/03-http.md +208 -13
  84. package/docs/04-reference/05-conformance.md +10 -7
  85. package/package.json +1 -1
  86. package/dist/exports-Gspe1eEq.d.mts +0 -4
  87. package/dist/inspect-C8U3A4jQ.mjs +0 -2
  88. package/dist/serve-CEMvl0EH.mjs +0 -181
@@ -1,5 +1,5 @@
1
- import { a as forbidden } from "./errors-ZazTZh-s.mjs";
2
- import { a as CAN_MAX, s as ChannelPath } from "./schemas-BhZaystC.mjs";
1
+ import { o as forbidden } from "./errors-QhkdzI-o.mjs";
2
+ import { a as CAN_MAX, s as ChannelPath } from "./schemas-7VFdomFB.mjs";
3
3
  //#region src/server/access.ts
4
4
  /**
5
5
  * What a principal may do in a channel. `read` covers messages, threads,
package/dist/access.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $t as compileAccess, Bt as Can, Gt as GrantChangeRefusal, Ht as FULL_ACCESS, Kt as GrantShape, Qt as checkGrantChange, Rt as Access, Ut as Grant, Vt as ChannelPattern, Wt as GrantChange, Xt as Permission, Yt as PERMISSIONS, an as Author, en as parseCan, nn as Actor, on as CAN_MAX, qt as InvalidCan, tn as union, zt as AccessSummary } from "./routes-zm4TXKCC.mjs";
2
- import { _ as GrantFacts, a as DEFAULT_CAN, b as grantAccess, c as IssuerConfig, d as Principal, f as PrincipalKind, g as GrantExplanation, h as DecidingGrant, i as Claims, l as Known, m as Caller, n as AuthenticateContext, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions, v as GrantSource, y as explainGrants } from "./auth-BG_whr9_.mjs";
1
+ import { Cn as union, Dn as Author, On as CAN_MAX, Sn as parseCan, _n as PERMISSIONS, bn as checkGrantChange, cn as Can, dn as Grant, fn as GrantChange, hn as InvalidCan, ln as ChannelPattern, mn as GrantShape, on as Access, pn as GrantChangeRefusal, sn as AccessSummary, un as FULL_ACCESS, vn as Permission, wn as Actor, xn as compileAccess } from "./routes-CjA6Mp4D.mjs";
2
+ import { _ as GrantFacts, a as DEFAULT_CAN, b as grantAccess, c as IssuerConfig, d as Principal, f as PrincipalKind, g as GrantExplanation, h as DecidingGrant, i as Claims, l as Known, m as Caller, n as AuthenticateContext, r as CallerRequest, s as HostPrincipal, t as Authenticate, u as OidcTokensOptions, v as GrantSource, y as explainGrants } from "./auth-li3lKwJG.mjs";
3
3
  //#region src/server/tokens.d.ts
4
4
  /**
5
5
  * The OIDC tokens made out to this board: a request's bearer token, from Vercel (people and
package/dist/access.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { a as CAN_MAX } from "./schemas-BhZaystC.mjs";
2
- import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-3udXjJAg.mjs";
3
- import { C as explainGrants, t as DEFAULT_CAN, w as grantAccess } from "./auth-aiOVE82-.mjs";
4
- import { a as resolveActor } from "./actors-DasGZnfb.mjs";
5
- import { t as oidcTokens } from "./tokens-BErYXuHZ.mjs";
1
+ import { a as CAN_MAX } from "./schemas-7VFdomFB.mjs";
2
+ import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-C06pIr0M.mjs";
3
+ import { D as grantAccess, E as explainGrants, t as DEFAULT_CAN } from "./auth-B9-wXQ-x.mjs";
4
+ import { a as resolveActor } from "./actors-Dkyg-oo0.mjs";
5
+ import { t as oidcTokens } from "./tokens-BCp4EWTQ.mjs";
6
6
  export { CAN_MAX, DEFAULT_CAN, FULL_ACCESS, InvalidCan, PERMISSIONS, checkGrantChange, compileAccess, explainGrants, grantAccess, oidcTokens, parseCan, resolveActor, union };
@@ -1,6 +1,6 @@
1
- import { g as parseProfileHeader, r as badRequest } from "./errors-ZazTZh-s.mjs";
2
- import { C as toStorable } from "./schemas-BhZaystC.mjs";
3
- import { u as parseCan } from "./access-3udXjJAg.mjs";
1
+ import { r as badRequest, v as parseProfileHeader } from "./errors-QhkdzI-o.mjs";
2
+ import { N as toStorable } from "./schemas-7VFdomFB.mjs";
3
+ import { u as parseCan } from "./access-C06pIr0M.mjs";
4
4
  import { t as own } from "./own-OwgPWdmh.mjs";
5
5
  //#region src/server/actors.ts
6
6
  /** Agents whose marks the board serves at `/avatars/<name>`, for a caller to pass as an avatar. */
@@ -1,5 +1,5 @@
1
- import { a as forbidden, r as badRequest, t as HttpError, u as unauthorized } from "./errors-ZazTZh-s.mjs";
2
- import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-3udXjJAg.mjs";
1
+ import { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-QhkdzI-o.mjs";
2
+ import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-C06pIr0M.mjs";
3
3
  //#region src/server/grants.ts
4
4
  /**
5
5
  * How close `principal` is to the caller, or null when it doesn't name it: `principal` for its own
@@ -174,6 +174,8 @@ const TEAM_ENVIRONMENTS = [
174
174
  ];
175
175
  const PROJECT_ID = /^prj_[A-Za-z0-9]+$/;
176
176
  const USER_ID = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,199}$/;
177
+ /** A login that's a user's ID where the board's verifier names people by one: what a principal's ID can hold, so no `+`. */
178
+ const LOGIN = /^[a-z0-9][a-z0-9._-]{0,63}@[a-z0-9][a-z0-9.-]{0,127}$/;
177
179
  /** An app's client ID, as a board that verifies tokens itself takes it. */
178
180
  const APP_ID = USER_ID;
179
181
  const REPOSITORY = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
@@ -221,18 +223,28 @@ const workflowPath = (workflow) => workflow.includes("/") ? workflow : `.github/
221
223
  * project's `prj_…`, and a repository's `owner/name`, which it matches on the token's claims.
222
224
  * `removal`: one to take out of a grant, which names a project without its environments. `team`: the
223
225
  * board's own team, which a project it names is kept on, so it no longer matches once it's moved to
224
- * another; null where the board doesn't know it, and then a project is its ID on any team.
226
+ * another; null where the board doesn't know it, and then a project is its ID on any team. `logins`:
227
+ * the board's verifier names people by their logins, so a user's email is its ID, with nothing to look up.
225
228
  */
226
- function checkPrincipal(input, trusted, removal = false, team = null) {
229
+ function checkPrincipal(input, trusted, removal = false, team = null, logins = false) {
227
230
  switch (input.kind) {
228
- case "user":
231
+ case "user": {
229
232
  if (input.email !== void 0 && input.userId !== void 0) throw invalidGrant("a user is its email or its userId, not both");
230
- if (input.email !== void 0) throw invalidGrant(`this board can't look up ${input.email}: it verifies tokens itself, so name the user by ID, { kind: 'user', userId }`);
233
+ if (input.email !== void 0 && !logins) throw invalidGrant(`this board can't look up ${input.email}: it verifies tokens itself, so name the user by ID, { kind: 'user', userId }`);
234
+ const login = (input.email ?? (logins && input.userId?.includes("@") ? input.userId : void 0))?.toLowerCase();
235
+ if (login !== void 0) {
236
+ if (!LOGIN.test(login)) throw invalidGrant(`a user here is the login they're known by, like ada@example.com, got ${login}`);
237
+ return {
238
+ kind: "user",
239
+ userId: login
240
+ };
241
+ }
231
242
  if (input.userId === void 0 || !USER_ID.test(input.userId)) throw invalidGrant("a user is its userId, letters, numbers, and ._-");
232
243
  return {
233
244
  kind: "user",
234
245
  userId: input.userId
235
246
  };
247
+ }
236
248
  case "project":
237
249
  if (!PROJECT_ID.test(input.project)) throw invalidGrant(`this board can't look up the project ${input.project}: it verifies tokens itself, so name it by ID, prj_…`);
238
250
  if (removal) return {
@@ -290,12 +302,12 @@ function checkPrincipal(input, trusted, removal = false, team = null) {
290
302
  /** One principal's key: two that share it are the same principal. */
291
303
  const principalKey = (principal) => JSON.stringify(principal);
292
304
  /** Principals checked, without repeats, and a `can` kept as written: what a board that verifies tokens itself stores of a grant. */
293
- function checkGrant(body, trusted, team = null) {
305
+ function checkGrant(body, trusted, team = null, logins = false) {
294
306
  if (body.principals.length === 0) throw invalidGrant("a grant names at least one principal");
295
307
  if (body.principals.length > GRANT_PRINCIPALS_MAX) throw invalidGrant(`a grant names at most ${GRANT_PRINCIPALS_MAX} principals`);
296
308
  const seen = [...trusted];
297
309
  const checked = body.principals.map((input) => {
298
- const principal = checkPrincipal(input, seen, false, team);
310
+ const principal = checkPrincipal(input, seen, false, team, logins);
299
311
  if (principal.kind === "oidc") seen.push(principal.issuer);
300
312
  return principal;
301
313
  });
@@ -539,6 +551,14 @@ function factsFromId(id) {
539
551
  }
540
552
  /** What marks `oidcTokens()`, so board() can tell it makes no host's principals. */
541
553
  const TOKENS = Symbol("board.oidcTokens");
554
+ /**
555
+ * What marks a verifier whose people's user IDs are the logins they're known by (`ada@example.com`),
556
+ * as Tailscale's are: a grant on its board names a user by one, where any other board that verifies
557
+ * tokens itself has nothing to look an email up with.
558
+ */
559
+ const LOGINS = Symbol("board.logins");
560
+ /** Whether `authenticate` names people by their logins. */
561
+ const namesByLogin = (authenticate) => LOGINS in authenticate;
542
562
  /** The principals `oidcTokens()` made: board() takes them as they are, and checks the rest as a host's. */
543
563
  const verifiedTokens = /* @__PURE__ */ new WeakSet();
544
564
  /** Marks a principal `oidcTokens()` made. */
@@ -586,4 +606,4 @@ function hostPrincipal(value) {
586
606
  };
587
607
  }
588
608
  //#endregion
589
- export { explainGrants as C, wroteAs as S, removes as _, authenticates as a, verifiesTokens as b, checkPrincipal as c, grantIssuers as d, hostPrincipal as f, privateHost as g, markVerified as h, VERCEL_ISSUER as i, createAuthority as l, joined as m, GITHUB_ISSUER as n, checkCan as o, issuerName as p, TOKENS as r, checkGrant as s, DEFAULT_CAN as t, fromTokens as u, trustedIssuers as v, grantAccess as w, workflowPath as x, verifiedIssuers as y };
609
+ export { verifiesTokens as C, grantAccess as D, explainGrants as E, verifiedIssuers as S, wroteAs as T, markVerified as _, TOKENS as a, removes as b, checkCan as c, createAuthority as d, fromTokens as f, joined as g, issuerName as h, LOGINS as i, checkGrant as l, hostPrincipal as m, GITHUB_ISSUER as n, VERCEL_ISSUER as o, grantIssuers as p, LOGIN as r, authenticates as s, DEFAULT_CAN as t, checkPrincipal as u, namesByLogin as v, workflowPath as w, trustedIssuers as x, privateHost as y };
@@ -1,4 +1,4 @@
1
- import { Bt as Can, Jt as Level, Rt as Access, Xt as Permission, Zt as WrittenCan } from "./routes-zm4TXKCC.mjs";
1
+ import { cn as Can, gn as Level, on as Access, vn as Permission, yn as WrittenCan } from "./routes-CjA6Mp4D.mjs";
2
2
  import { JWTVerifyGetKey } from "jose";
3
3
  //#region src/server/grants.d.ts
4
4
  /** Who asks, as a verified token says, in the terms grants name them by. */
@@ -1,6 +1,6 @@
1
- import { $ as ScheduleBody, A as LabelBody, Bt as Can, C as InboxAckBody, D as InboxPushBody, Dt as ThreadView, E as InboxNextQuery, F as Me, Ft as UploadStartBody, I as MessageView, It as UploadTicket, J as RegisterBody, Jt as Level, K as ReactBody, L as MessagesPage, M as LinkedQuery, N as MatchView, Nt as UpdateGrantBody, O as InboxQuery, Ot as ThreadsPage, P as MatchesQuery, R as MessagesQuery, Rt as Access, St as SyncReceiptBody, T as InboxItem, Tt as SyncedView, V as PostBody, X as RegistrationView, Xt as Permission, a as BoardEventView, an as Author, bt as SyncImportBody, c as CreateChannelBody, ct as SchemaView, d as EditBody, f as EventsPage, ft as SourceRead, g as Explanation, gt as SyncCopiesView, h as ExplainQuery, ht as SyncCopiesQuery, in as Attachment, jt as TypingBody, kt as ThreadsQuery, l as DeleteBody, ln as ExternalEvent, lt as SourceJoin, n as ActorView, nn as Actor, nt as ScheduleView, ot as SchemaBody, p as EventsQuery, pt as SourceReadQuery, rt as SchedulesQuery, s as ChannelView, sn as Labels, t as AckBody, u as Discovery, ut as SourceJoinBody, v as GrantBody, vt as SyncFindQuery, w as InboxEntry, wt as SyncThreadView, x as GrantView, yt as SyncFindView } from "./routes-zm4TXKCC.mjs";
2
- import { l as Known, o as Granted, p as StoredGrant, t as Authenticate } from "./auth-BG_whr9_.mjs";
3
- import { H as ProfileOption, I as ErrorOrigin, P as BoardClient, m as SyncProvider } from "./provider-BC9mPYVh.mjs";
1
+ import { $t as TypingBody, B as InboxPushBody, Bt as SyncThreadView, C as EditBody, D as ExplainQuery, Dn as Author, En as Attachment, Et as SourceJoinBody, Ft as SyncFindView, Gt as TasksPage, Ht as TaskClaim, I as InboxAckBody, It as SyncImportBody, J as MatchesQuery, K as LinkedQuery, Kt as TasksQuery, L as InboxEntry, Mt as SyncCopiesView, O as Explanation, Ot as SourceRead, P as GrantView, Pt as SyncFindQuery, Q as MessagesQuery, R as InboxItem, Rt as SyncReceiptBody, S as Discovery, St as SchemaBody, T as EventsQuery, Tt as SourceJoin, Ut as TaskNeedsBody, V as InboxQuery, Vt as SyncedView, W as LabelBody, X as MessageView, Xt as ThreadsPage, Y as Me, Yt as ThreadView, Z as MessagesPage, Zt as ThreadsQuery, a as BlockTaskBody, b as CreatedTasksQuery, cn as Can, ct as RegisterBody, d as ClaimReadyTaskBody, dt as ReleaseTaskBody, ft as RenewTaskBody, g as CreateTaskBody, gn as Level, h as CreateChannelBody, ht as ScheduleBody, i as AssignTaskBody, in as UploadTicket, j as GrantBody, jn as ExternalEvent, jt as SyncCopiesQuery, k as FailTaskBody, kn as Labels, kt as SourceReadQuery, l as CancelTaskBody, m as CompleteTaskBody, n as ActorView, on as Access, ot as ReactBody, p as ClaimTaskBody, q as MatchView, rn as UploadStartBody, s as BoardEventView, t as AckBody, tn as UpdateGrantBody, tt as PostBody, u as ChannelView, ut as RegistrationView, v as CreateTasksBody, vn as Permission, vt as ScheduleView, w as EventsPage, wn as Actor, wt as SchemaView, x as DeleteBody, yt as SchedulesQuery, z as InboxNextQuery } from "./routes-CjA6Mp4D.mjs";
2
+ import { l as Known, o as Granted, p as StoredGrant, t as Authenticate } from "./auth-li3lKwJG.mjs";
3
+ import { G as ProfileOption, L as ErrorOrigin, P as BoardClient, m as SyncProvider, tt as Mentioned } from "./provider-Bc3xI90K.mjs";
4
4
  import { z } from "zod";
5
5
  //#region src/server/sandbox.d.ts
6
6
  /** How a rule matches a value: a regular expression (RE2), or the value exactly. */
@@ -74,13 +74,18 @@ type SandboxRoute = {
74
74
  /**
75
75
  * How a sandbox reaches a board, from a backend: its URL, the headers its requests carry, the routes
76
76
  * under the board's path that carry them, every one by method and shape (the protocol's, or another
77
- * API's), and what else they ask (`GET`s outside the board's path).
77
+ * API's), and what else they ask: `GET`s outside the board's path (`reads`), and routes the same
78
+ * board has under another path of its host (`under`), as an API that versions some of its routes does.
78
79
  */
79
80
  type SandboxReach = {
80
81
  url: string;
81
82
  headers: Record<string, string>;
82
83
  routes: readonly SandboxRoute[];
83
84
  reads?: readonly string[];
85
+ under?: readonly {
86
+ path: string;
87
+ routes: readonly SandboxRoute[];
88
+ }[];
84
89
  };
85
90
  /** What a backend gets to say how a sandbox reaches its board. */
86
91
  type SandboxInput = {
@@ -149,10 +154,12 @@ type Protocol = {
149
154
  input: Id;
150
155
  output: ThreadView;
151
156
  };
157
+ /** `mentions` says what became of each `@handle` the text typed, when it typed any: see `Mentioned`. A write that takes a text answers it the same way. */
152
158
  post: {
153
159
  input: Input<typeof PostBody>;
154
160
  output: {
155
161
  message: MessageView;
162
+ mentions?: Mentioned[];
156
163
  };
157
164
  };
158
165
  /** The caller's own post with client ID `id`, as it landed: 404 `post_not_found` when there's none. */
@@ -166,6 +173,7 @@ type Protocol = {
166
173
  input: Id & Input<typeof EditBody>;
167
174
  output: {
168
175
  ok: true;
176
+ mentions?: Mentioned[];
169
177
  };
170
178
  };
171
179
  delete: {
@@ -190,6 +198,7 @@ type Protocol = {
190
198
  input: Input<typeof ScheduleBody>;
191
199
  output: {
192
200
  schedule: ScheduleView;
201
+ mentions?: Mentioned[];
193
202
  };
194
203
  };
195
204
  schedules: {
@@ -205,6 +214,125 @@ type Protocol = {
205
214
  canceled: boolean;
206
215
  };
207
216
  };
217
+ /** Tasks, oldest first, each as its thread's summary. 501 `no_tasks` where the board keeps none, as every task method answers there. */
218
+ tasks: {
219
+ input: Input<typeof TasksQuery>;
220
+ output: TasksPage;
221
+ };
222
+ /** `task` is the task's root. `claim` comes with a task made with `claim`; a retry of one that landed gets the task without it. */
223
+ createTask: {
224
+ input: Input<typeof CreateTaskBody>;
225
+ output: {
226
+ task: MessageView;
227
+ claim?: TaskClaim;
228
+ mentions?: Mentioned[];
229
+ };
230
+ };
231
+ /**
232
+ * `tasks` are the tasks' roots, in the body's order. 400 `invalid_needs` for a `key` two tasks go by, one no task has,
233
+ * or tasks that wait for each other; 400 `batch_too_large` for more than a board holds in one write. Nothing is made
234
+ * then, and a retry with the same `id` answers the tasks the first made.
235
+ */
236
+ createTasks: {
237
+ input: Input<typeof CreateTasksBody>;
238
+ output: {
239
+ tasks: MessageView[];
240
+ mentions?: Mentioned[];
241
+ };
242
+ };
243
+ /**
244
+ * The caller's own batch made under `id`, its tasks' roots as they are now, in order: 404 `batch_not_found` when
245
+ * there's none. With `request`, 409 `duplicate_id` when the batch was made for another one.
246
+ */
247
+ createdTasks: {
248
+ input: Id & Input<typeof CreatedTasksQuery>;
249
+ output: {
250
+ tasks: MessageView[];
251
+ };
252
+ };
253
+ /** The oldest ready task there, claimed, or `{ task: null }` when there's none, after waiting up to `wait` seconds. */
254
+ claimReadyTask: {
255
+ input: Input<typeof ClaimReadyTaskBody>;
256
+ output: {
257
+ task: MessageView;
258
+ claim: TaskClaim;
259
+ } | {
260
+ task: null;
261
+ };
262
+ };
263
+ /** 409 `task_claimed` while someone holds it, and of claims that race, for all but one. */
264
+ claimTask: {
265
+ input: Id & Input<typeof ClaimTaskBody>;
266
+ output: {
267
+ task: MessageView;
268
+ claim: TaskClaim;
269
+ };
270
+ };
271
+ /** `until` is the lease's new end. */
272
+ renewTask: {
273
+ input: Id & Input<typeof RenewTaskBody>;
274
+ output: {
275
+ task: MessageView;
276
+ until: string;
277
+ };
278
+ };
279
+ releaseTask: {
280
+ input: Id & Input<typeof ReleaseTaskBody>;
281
+ output: {
282
+ task: MessageView;
283
+ };
284
+ };
285
+ completeTask: {
286
+ input: Id & Input<typeof CompleteTaskBody>;
287
+ output: {
288
+ task: MessageView;
289
+ };
290
+ };
291
+ failTask: {
292
+ input: Id & Input<typeof FailTaskBody>;
293
+ output: {
294
+ task: MessageView;
295
+ };
296
+ };
297
+ blockTask: {
298
+ input: Id & Input<typeof BlockTaskBody>;
299
+ output: {
300
+ task: MessageView;
301
+ };
302
+ };
303
+ /** A task that isn't blocked is left as it is. */
304
+ unblockTask: {
305
+ input: Id;
306
+ output: {
307
+ task: MessageView;
308
+ };
309
+ };
310
+ /** A failed task is ready again; one that's open is left as it is. */
311
+ reopenTask: {
312
+ input: Id;
313
+ output: {
314
+ task: MessageView;
315
+ };
316
+ };
317
+ assignTask: {
318
+ input: Id & Input<typeof AssignTaskBody>;
319
+ output: {
320
+ task: MessageView;
321
+ };
322
+ };
323
+ /** 400 `invalid_needs` for a prerequisite that isn't one, or that would make the task wait for itself. The same set is left as it is. */
324
+ setTaskNeeds: {
325
+ input: Id & Input<typeof TaskNeedsBody>;
326
+ output: {
327
+ task: MessageView;
328
+ };
329
+ };
330
+ cancelTask: {
331
+ input: Id & Input<typeof CancelTaskBody>;
332
+ output: {
333
+ task: MessageView;
334
+ };
335
+ };
208
336
  /** The board's grants: needs `manage` at `*`, or a team owner. 501 `no_grants` where the board keeps none. */
209
337
  grants: {
210
338
  input: Nothing;
@@ -675,7 +803,7 @@ type DefaultOptions = {
675
803
  backend?: undefined;
676
804
  /**
677
805
  * How requests reach Vercel's API, with credentials it takes: a token for the team. In Node it
678
- * defaults to `VERCEL_TOKEN`, the deployment's OIDC token, or your `vercel login`; elsewhere, a
806
+ * defaults to the deployment's OIDC token, `BOARD_TOKEN`, or your Vercel login, never `VERCEL_TOKEN`; elsewhere, a
679
807
  * browser say, pass one. A board at `BOARD_URL` gets the credentials `vb` sends it instead.
680
808
  */
681
809
  fetch?: typeof fetch;
@@ -834,6 +962,11 @@ type BoardBinding = {
834
962
  id: string | null;
835
963
  teamId: string | null;
836
964
  }>;
965
+ /**
966
+ * Whether board()'s verifier names people by their logins (`ada@example.com`), as a board behind
967
+ * Tailscale does: a grant then names a user by one, which is that user's ID.
968
+ */
969
+ logins: boolean;
837
970
  /**
838
971
  * A handle through board(), as `caller`: what a backend writes for someone outside a request
839
972
  * goes through it, so board()'s middleware sees it, a schedule's send as its creator, say. A
@@ -870,6 +1003,12 @@ interface Backend extends ProtocolMethods {
870
1003
  * board() screens a schedule's message once, when it's made. True when left out.
871
1004
  */
872
1005
  readonly sendsSchedulesHere?: boolean;
1006
+ /**
1007
+ * Whether a board behind this backend settles a write's `@handle`s itself, as one at `BOARD_URL`
1008
+ * does: board() then leaves a text as typed and passes on what that board answers of its mentions.
1009
+ * False when left out, as for a backend that only stores, where board() settles them.
1010
+ */
1011
+ readonly settlesMentions?: boolean;
873
1012
  /**
874
1013
  * Whether board()'s sync runs its entry `key` here: false for one another deployment holds, as vercel()'s
875
1014
  * deployments of one project hold each of its keys once (production takes one from a preview). Sync takes webhooks,
@@ -1,4 +1,4 @@
1
- import { t as Backend } from "./backend-D6yTo8Un.mjs";
1
+ import { t as Backend } from "./backend-i_esjwUS.mjs";
2
2
  //#region src/server/local.d.ts
3
3
  type LocalOptions = {
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { t as local } from "./local-DE9vmanM.mjs";
1
+ import { t as local } from "./local-0ajWOVhN.mjs";
2
2
  export { local };
@@ -1,5 +1,5 @@
1
- import { cn as ExternalAuthor, dn as ExternalLink, ft as SourceRead, lt as SourceJoin, nn as Actor, un as ExternalFile } from "./routes-zm4TXKCC.mjs";
2
- import { A as SyncRoot, E as ProviderEvent, _ as SyncFn, a as ProviderOptions, c as Receive, f as ResolvedTarget, i as ProviderFile, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, r as ProviderDelivery, t as FetchedLink } from "./provider-BC9mPYVh.mjs";
1
+ import { An as ExternalAuthor, Mn as ExternalFile, Nn as ExternalLink, Ot as SourceRead, Tt as SourceJoin, wn as Actor } from "./routes-CjA6Mp4D.mjs";
2
+ import { A as SyncRoot, E as ProviderEvent, _ as SyncFn, a as ProviderOptions, c as Receive, f as ResolvedTarget, i as ProviderFile, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, r as ProviderDelivery, t as FetchedLink } from "./provider-Bc3xI90K.mjs";
3
3
  import { Adapter, Author, FileUpload, Message, ReactionEvent, StateAdapter } from "chat";
4
4
  //#region src/sync/chat-provider.d.ts
5
5
  type ChatInput = {
@@ -23,6 +23,8 @@ type ChatTransport = Omit<ProviderOptions, 'uploadsFiles'> & {
23
23
  state?: StateAdapter;
24
24
  findByEmail?(email: string): Promise<ExternalAuthor | null>;
25
25
  mention?(actor: Actor): string | null;
26
+ /** The platform's users a message's text mentions as `@[<their id>]`, which `markdown` wrote there. */
27
+ mentioned?(text: string): Promise<ExternalAuthor[]>;
26
28
  author?(author: Author, raw: unknown): ExternalAuthor;
27
29
  /** A channel's name as its native ID. Without it, a name is the ID. */
28
30
  resolveChannel?(key: string): Promise<string>;
@@ -1,5 +1,5 @@
1
- import "./external-DfhN7lKK.mjs";
2
- import { c as SyncProvider, s as ResolvedTarget } from "./events-D17RndlV.mjs";
1
+ import "./external-BuVTXT1R.mjs";
2
+ import { c as SyncProvider, s as ResolvedTarget } from "./events-MOcxGpOQ.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { Chat, stringifyMarkdown } from "chat";
@@ -243,12 +243,15 @@ var ChatSyncProvider = class extends SyncProvider {
243
243
  const message = input.message;
244
244
  const found = this.transport.links?.(key, message) ?? [];
245
245
  const links = found.length ? { links: found.slice(0, 10) } : {};
246
+ const text = this.transport.markdown?.(message) ?? markdownOf(message);
247
+ const mentioned = await this.transport.mentioned?.(text) ?? [];
246
248
  const common = {
247
249
  ...this.locationOf(key, message.threadId),
248
250
  message: message.id,
249
- text: this.transport.markdown?.(message) ?? markdownOf(message),
251
+ text,
250
252
  author: await this.authorOf(message),
251
- ...links
253
+ ...links,
254
+ ...mentioned.length ? { mentioned } : {}
252
255
  };
253
256
  return {
254
257
  dedupe,
@@ -1,2 +1,2 @@
1
- import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-DewS14_P.mjs";
1
+ import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-CJsOA-hf.mjs";
2
2
  export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-CqdnjUkm.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-Dk6_cHLS.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,5 +1,5 @@
1
- import { f as Board } from "./backend-D6yTo8Un.mjs";
2
- import "./index-Djmr4GzQ.mjs";
1
+ import { f as Board } from "./backend-i_esjwUS.mjs";
2
+ import "./index-ttfx1TZ6.mjs";
3
3
  //#region src/cli/failure.d.ts
4
4
  /**
5
5
  * What kind of failure it is, which fixes the exit code: 2 for `usage` and `missing_input`, 130
@@ -1,5 +1,5 @@
1
- import { r as stoppedBy } from "./exports-DCxecX15.mjs";
2
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-CF1Me3jg.mjs";
1
+ import { a as stoppedBy } from "./exports-CEqS-IPP.mjs";
2
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-B8Zkd4Pm.mjs";
3
3
  //#region src/cli/embedded.ts
4
4
  /**
5
5
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
@@ -75,6 +75,7 @@ function vb(board, argv, options = {}) {
75
75
  commands: {}
76
76
  }, {
77
77
  board: options.signal && stoppedBy(board, options.signal) || board,
78
+ claimsOf: board,
78
79
  write: (chunk) => void (stdout += typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true })),
79
80
  error: (chunk) => void (stderr += chunk),
80
81
  readFile: options.readFile ? async (path) => options.readFile(path) : lacking("--attach and --text-file can't read files", "readFile"),
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as option } from "./commands-CqdnjUkm.mjs";
3
- import { f as projectDir } from "./server-Bmz0zqYM.mjs";
4
- import { r as main } from "./main-CF1Me3jg.mjs";
5
- import { n as stopped, r as startInspector } from "./inspect-CHsgnf_5.mjs";
2
+ import { a as option } from "./commands-Dk6_cHLS.mjs";
3
+ import { m as projectDir } from "./server-4rQL3xuH.mjs";
4
+ import { r as main } from "./main-B8Zkd4Pm.mjs";
5
+ import { i as createInspector, r as stopped, t as allowedHosts } from "./inspect-vOSrW_g6.mjs";
6
6
  import { appendFile, readFile } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
8
  //#region src/cli/local.ts
@@ -37,7 +37,7 @@ const local = {
37
37
  },
38
38
  async run(args, context) {
39
39
  if (args.length > 0) throw context.usage("inspect takes no arguments: pass its port with --port.");
40
- return (await import("./inspect-C8U3A4jQ.mjs")).inspect(context);
40
+ return (await import("./inspect-8YAhl_h3.mjs")).inspect(context);
41
41
  }
42
42
  },
43
43
  serve: {
@@ -49,20 +49,43 @@ const local = {
49
49
  option("port", "the port to listen on (default: 4100)"),
50
50
  option("dir"),
51
51
  option("no-inspect"),
52
- option("no-open")
52
+ option("no-open"),
53
+ option("allow-host", "also answer requests for this host, from a proxy in front: the board is at its URL there, and whoever reaches the inspector there acts as you"),
54
+ option("tailscale")
53
55
  ],
54
- examples: [{
55
- name: "run a board here, and open it",
56
- value: "serve"
57
- }]
56
+ examples: [
57
+ {
58
+ name: "run a board here, and open it",
59
+ value: "serve"
60
+ },
61
+ {
62
+ name: "share it on your tailnet, behind tailscale serve",
63
+ value: "serve --tailscale box.tailnet.ts.net"
64
+ },
65
+ {
66
+ name: "serve it behind another proxy, on another name",
67
+ value: "serve --allow-host box.example.com"
68
+ }
69
+ ]
58
70
  },
59
71
  async run(args, { flags, out, usage, portFlag, connection, openBrowser }) {
60
72
  if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
61
73
  const port = portFlag();
74
+ const hosts = allowedHosts({
75
+ flags,
76
+ usage
77
+ });
78
+ const tailscale = allowedHosts({
79
+ flags,
80
+ usage
81
+ }, "tailscale");
82
+ if (tailscale.length > 0 && hosts.length > 0) throw usage("--tailscale takes Tailscale's word for who's calling, which another proxy in front could forge: it doesn't go with --allow-host.");
62
83
  const root = projectDir();
63
- const { serveLocal } = await import("./serve-CEMvl0EH.mjs");
84
+ const { serveLocal } = await import("./serve-BepKXDH3.mjs");
64
85
  const local = await serveLocal({
65
86
  dir: flags.dir ?? join(root, ".board"),
87
+ hosts,
88
+ tailscale,
66
89
  ...port !== void 0 ? { port } : {}
67
90
  });
68
91
  let inspector = null;
@@ -70,15 +93,23 @@ const local = {
70
93
  if (!flags.dir) await ignoreLog(root);
71
94
  out(`serving a local board at ${local.url} as ${local.principal}, its log in ${local.dir} (Ctrl-C to stop)`);
72
95
  out(`reach it with --url ${local.url}, or BOARD_URL=${local.url}`);
96
+ for (const host of new Set(tailscale.map((named) => new URL(`https://${named}`).host))) out(`on your tailnet, behind tailscale serve --bg ${local.port}: BOARD_URL=https://${host}/api/board`);
73
97
  if (!flags["no-inspect"]) {
74
98
  const { board } = connection(local.url, { token: local.token });
75
- inspector = await startInspector({ client: board.as(null) });
76
- out(`inspector at ${inspector.url}`);
77
- if (!flags["no-open"]) openBrowser(inspector.url);
99
+ const page = (await createInspector({
100
+ client: board.as(null),
101
+ hosts: [...hosts, ...tailscale],
102
+ visitor: local.visitor
103
+ })).at(local.port);
104
+ inspector = page;
105
+ local.page(page.handle);
106
+ const at = new URL(local.url).origin;
107
+ out(`inspector at ${at}`);
108
+ if (!flags["no-open"]) openBrowser(at);
78
109
  }
79
110
  await stopped();
80
111
  } finally {
81
- await inspector?.close();
112
+ inspector?.close();
82
113
  await local.close();
83
114
  }
84
115
  return 0;
@@ -169,6 +169,11 @@ declare const options: {
169
169
  readonly value: 'path';
170
170
  readonly description: 'the text, from a file: - reads stdin';
171
171
  };
172
+ readonly 'tasks-file': {
173
+ readonly type: 'string';
174
+ readonly value: 'path';
175
+ readonly description: 'several tasks, from a JSON file: - reads stdin';
176
+ };
172
177
  readonly unset: {
173
178
  readonly type: 'string';
174
179
  readonly multiple: true;
@@ -221,6 +226,12 @@ declare const options: {
221
226
  readonly value: 'host';
222
227
  readonly description: 'also answer requests for this host, from a proxy in front: whoever reaches it there acts as you';
223
228
  };
229
+ readonly tailscale: {
230
+ readonly type: 'string';
231
+ readonly multiple: true;
232
+ readonly value: 'host';
233
+ readonly description: "also answer requests for this host, the board's name on your tailnet behind tailscale serve: whoever Tailscale says is calling is a person on the board";
234
+ };
224
235
  readonly in: {
225
236
  readonly type: 'string';
226
237
  readonly value: 'duration';
@@ -456,6 +467,55 @@ declare const options: {
456
467
  readonly type: 'boolean';
457
468
  readonly description: "don't start the inspector";
458
469
  };
470
+ readonly state: {
471
+ readonly type: 'string';
472
+ readonly value: 'state';
473
+ readonly description: 'in a state: waiting, ready, claimed, blocked, completed, failed, canceled, open, or all (default: open)';
474
+ };
475
+ readonly needs: {
476
+ readonly type: 'string';
477
+ readonly multiple: true;
478
+ readonly value: 'id';
479
+ readonly description: 'wait for a task to complete first';
480
+ };
481
+ readonly ready: {
482
+ readonly type: 'boolean';
483
+ readonly description: 'the oldest ready task in a channel, or under a prefix (work/)';
484
+ };
485
+ readonly from: {
486
+ readonly type: 'string';
487
+ readonly multiple: true;
488
+ readonly value: 'id';
489
+ readonly description: "with --ready: take this owner's tasks too, by their ID";
490
+ };
491
+ readonly wait: {
492
+ readonly type: 'string';
493
+ readonly value: 'duration';
494
+ readonly description: 'with --ready: how long to wait for one, e.g. 10m';
495
+ };
496
+ readonly lease: {
497
+ readonly type: 'string';
498
+ readonly value: 'duration';
499
+ readonly description: 'how long to hold it: 30s to 1h (default: 15m, or what the board gives)';
500
+ };
501
+ readonly result: {
502
+ readonly type: 'string';
503
+ readonly value: 'text';
504
+ readonly description: 'what it came to, when the command exits 0';
505
+ };
506
+ readonly kind: {
507
+ readonly type: 'string';
508
+ readonly value: 'kind';
509
+ readonly description: 'what the hold is for: needs_input, awaiting_approval';
510
+ };
511
+ readonly pool: {
512
+ readonly type: 'boolean';
513
+ readonly description: 'back to anyone who may claim it';
514
+ };
515
+ readonly none: {
516
+ readonly type: 'boolean';
517
+ readonly description: 'wait for nothing';
518
+ };
459
519
  readonly agent: {
460
520
  readonly type: 'string';
461
521
  readonly value: 'name';