@vercel/board 0.46.0 → 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 (82) hide show
  1. package/dist/{access-Crbvd2Dm.mjs → access-C06pIr0M.mjs} +1 -1
  2. package/dist/access.d.mts +2 -2
  3. package/dist/access.mjs +4 -4
  4. package/dist/{actors-BBphaJ_G.mjs → actors-Dkyg-oo0.mjs} +2 -2
  5. package/dist/{auth-C-pFnJBA.mjs → auth-B9-wXQ-x.mjs} +29 -9
  6. package/dist/{auth-CkNXnQno.d.mts → auth-li3lKwJG.d.mts} +1 -1
  7. package/dist/{backend-D3p8gjba.d.mts → backend-i_esjwUS.d.mts} +21 -4
  8. package/dist/backend-local.d.mts +1 -1
  9. package/dist/backend-local.mjs +1 -1
  10. package/dist/{chat-provider-Bn33acHd.d.mts → chat-provider-BWBGZOZY.d.mts} +4 -2
  11. package/dist/{chat-provider-1zpY6Qo_.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 +2 -2
  16. package/dist/cli.mjs +46 -15
  17. package/dist/{commands-CSZPQ38I.d.mts → commands-CJsOA-hf.d.mts} +6 -0
  18. package/dist/{commands-D0lyo8O8.mjs → commands-Dk6_cHLS.mjs} +6 -0
  19. package/dist/{conformance-Blzd4CXG.mjs → conformance-CDP8y2Zm.mjs} +94 -3
  20. package/dist/conformance.d.mts +1 -1
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/{engine-C_SlBihU.mjs → engine-j2VeNuKG.mjs} +43 -50
  23. package/dist/{errors-DZ1tbwSM.mjs → errors-QhkdzI-o.mjs} +27 -8
  24. package/dist/{events-mGuhF4i5.mjs → events-MOcxGpOQ.mjs} +1 -1
  25. package/dist/{exports-DQauuHrc.mjs → exports-CEqS-IPP.mjs} +205 -56
  26. package/dist/{exports-DUX_Yzo7.d.mts → exports-CF9rKCXd.d.mts} +4 -4
  27. package/dist/{external-BVr1Sq0y.mjs → external-BuVTXT1R.mjs} +6 -2
  28. package/dist/{index-BHXg4Xdo.d.mts → index-ttfx1TZ6.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 +7 -7
  32. package/dist/index.node.mjs +4 -4
  33. package/dist/inspect/app.js +44 -44
  34. package/dist/inspect/engine.js +1 -1
  35. package/dist/inspect-8YAhl_h3.mjs +2 -0
  36. package/dist/{inspect-2OIjv2lW.mjs → inspect-vOSrW_g6.mjs} +82 -32
  37. package/dist/{local-11FMUJrU.mjs → local-0ajWOVhN.mjs} +92 -50
  38. package/dist/{main-BYmbTDgo.mjs → main-B8Zkd4Pm.mjs} +127 -46
  39. package/dist/{memory-CZBdVNn8.mjs → memory-CMm-Fk_A.mjs} +2 -2
  40. package/dist/{mentions-DfZGp3B-.mjs → mentions-CnWt9Z5b.mjs} +34 -1
  41. package/dist/{middleware-BKsTcMAv.mjs → middleware-CT6vMNUc.mjs} +1 -1
  42. package/dist/{provider-D3bfHRHA.d.mts → provider-Bc3xI90K.d.mts} +82 -5
  43. package/dist/{routes-B2HHHD_C.mjs → routes-ABXf3CKq.mjs} +17 -4
  44. package/dist/{routes-NEc6w3QC.d.mts → routes-CjA6Mp4D.d.mts} +70 -0
  45. package/dist/serve-BepKXDH3.mjs +285 -0
  46. package/dist/{server-Ch3tuK2k.mjs → server-4rQL3xuH.mjs} +38 -19
  47. package/dist/{serving-9riPNrHk.mjs → serving-BNdiReQT.mjs} +1 -1
  48. package/dist/{sql-Bml29DpM.mjs → sql-IEbO5vXs.mjs} +2 -2
  49. package/dist/{sqlite-4C5u7-ag.mjs → sqlite-CVG8XKHm.mjs} +2 -2
  50. package/dist/{sqlite-db-eVb9v3zc.mjs → sqlite-db-BJjPQYx4.mjs} +1 -1
  51. package/dist/sync-chat-sdk.d.mts +16 -2
  52. package/dist/sync-chat-sdk.mjs +2 -2
  53. package/dist/sync-github.d.mts +16 -2
  54. package/dist/sync-github.mjs +3 -3
  55. package/dist/sync-linear.d.mts +17 -3
  56. package/dist/sync-linear.mjs +2 -2
  57. package/dist/sync-slack.d.mts +17 -3
  58. package/dist/sync-slack.mjs +106 -14
  59. package/dist/sync.d.mts +2 -2
  60. package/dist/sync.mjs +2 -2
  61. package/dist/{task-batch-BJcLiYe1.mjs → task-batch-BZXm6kOE.mjs} +6 -6
  62. package/dist/{tokens-DPKF_cb5.mjs → tokens-BCp4EWTQ.mjs} +2 -2
  63. package/docs/01-board/01-mounting.md +7 -4
  64. package/docs/01-board/03-identity.md +43 -23
  65. package/docs/01-board/04-messages.md +3 -2
  66. package/docs/01-board/06-watchers.md +3 -3
  67. package/docs/01-board/07-schedules.md +2 -2
  68. package/docs/01-board/09-access.md +6 -4
  69. package/docs/01-board/10-local.md +4 -1
  70. package/docs/02-sync/01-overview.md +4 -5
  71. package/docs/02-sync/02-functions.md +2 -2
  72. package/docs/02-sync/03-slack.md +8 -5
  73. package/docs/02-sync/06-providers.md +8 -0
  74. package/docs/03-guides/02-inspector.md +17 -1
  75. package/docs/03-guides/06-sandboxed-agents.md +2 -2
  76. package/docs/03-guides/08-tailnet.md +123 -0
  77. package/docs/04-reference/01-cli.md +56 -15
  78. package/docs/04-reference/02-board.md +10 -5
  79. package/docs/04-reference/03-http.md +24 -3
  80. package/package.json +1 -1
  81. package/dist/inspect-F-b4GPXX.mjs +0 -2
  82. package/dist/serve-DS2T2iWI.mjs +0 -181
@@ -1,4 +1,4 @@
1
- import { o as forbidden } from "./errors-DZ1tbwSM.mjs";
1
+ import { o as forbidden } from "./errors-QhkdzI-o.mjs";
2
2
  import { a as CAN_MAX, s as ChannelPath } from "./schemas-7VFdomFB.mjs";
3
3
  //#region src/server/access.ts
4
4
  /**
package/dist/access.d.mts CHANGED
@@ -1,5 +1,5 @@
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-NEc6w3QC.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-CkNXnQno.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
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-Crbvd2Dm.mjs";
3
- import { C as explainGrants, t as DEFAULT_CAN, w as grantAccess } from "./auth-C-pFnJBA.mjs";
4
- import { a as resolveActor } from "./actors-BBphaJ_G.mjs";
5
- import { t as oidcTokens } from "./tokens-DPKF_cb5.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 { r as badRequest, v as parseProfileHeader } from "./errors-DZ1tbwSM.mjs";
1
+ import { r as badRequest, v as parseProfileHeader } from "./errors-QhkdzI-o.mjs";
2
2
  import { N as toStorable } from "./schemas-7VFdomFB.mjs";
3
- import { u as parseCan } from "./access-Crbvd2Dm.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 { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-DZ1tbwSM.mjs";
2
- import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-Crbvd2Dm.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 { cn as Can, gn as Level, on as Access, vn as Permission, yn as WrittenCan } from "./routes-NEc6w3QC.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 { $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-NEc6w3QC.mjs";
2
- import { l as Known, o as Granted, p as StoredGrant, t as Authenticate } from "./auth-CkNXnQno.mjs";
3
- import { G as ProfileOption, L as ErrorOrigin, P as BoardClient, m as SyncProvider } from "./provider-D3bfHRHA.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. */
@@ -154,10 +154,12 @@ type Protocol = {
154
154
  input: Id;
155
155
  output: ThreadView;
156
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. */
157
158
  post: {
158
159
  input: Input<typeof PostBody>;
159
160
  output: {
160
161
  message: MessageView;
162
+ mentions?: Mentioned[];
161
163
  };
162
164
  };
163
165
  /** The caller's own post with client ID `id`, as it landed: 404 `post_not_found` when there's none. */
@@ -171,6 +173,7 @@ type Protocol = {
171
173
  input: Id & Input<typeof EditBody>;
172
174
  output: {
173
175
  ok: true;
176
+ mentions?: Mentioned[];
174
177
  };
175
178
  };
176
179
  delete: {
@@ -195,6 +198,7 @@ type Protocol = {
195
198
  input: Input<typeof ScheduleBody>;
196
199
  output: {
197
200
  schedule: ScheduleView;
201
+ mentions?: Mentioned[];
198
202
  };
199
203
  };
200
204
  schedules: {
@@ -221,6 +225,7 @@ type Protocol = {
221
225
  output: {
222
226
  task: MessageView;
223
227
  claim?: TaskClaim;
228
+ mentions?: Mentioned[];
224
229
  };
225
230
  };
226
231
  /**
@@ -232,6 +237,7 @@ type Protocol = {
232
237
  input: Input<typeof CreateTasksBody>;
233
238
  output: {
234
239
  tasks: MessageView[];
240
+ mentions?: Mentioned[];
235
241
  };
236
242
  };
237
243
  /**
@@ -797,7 +803,7 @@ type DefaultOptions = {
797
803
  backend?: undefined;
798
804
  /**
799
805
  * How requests reach Vercel's API, with credentials it takes: a token for the team. In Node it
800
- * 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
801
807
  * browser say, pass one. A board at `BOARD_URL` gets the credentials `vb` sends it instead.
802
808
  */
803
809
  fetch?: typeof fetch;
@@ -956,6 +962,11 @@ type BoardBinding = {
956
962
  id: string | null;
957
963
  teamId: string | null;
958
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;
959
970
  /**
960
971
  * A handle through board(), as `caller`: what a backend writes for someone outside a request
961
972
  * goes through it, so board()'s middleware sees it, a schedule's send as its creator, say. A
@@ -992,6 +1003,12 @@ interface Backend extends ProtocolMethods {
992
1003
  * board() screens a schedule's message once, when it's made. True when left out.
993
1004
  */
994
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;
995
1012
  /**
996
1013
  * Whether board()'s sync runs its entry `key` here: false for one another deployment holds, as vercel()'s
997
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-D3p8gjba.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-11FMUJrU.mjs";
1
+ import { t as local } from "./local-0ajWOVhN.mjs";
2
2
  export { local };
@@ -1,5 +1,5 @@
1
- import { An as ExternalAuthor, Mn as ExternalFile, Nn as ExternalLink, Ot as SourceRead, Tt as SourceJoin, wn as Actor } from "./routes-NEc6w3QC.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-D3bfHRHA.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-BVr1Sq0y.mjs";
2
- import { c as SyncProvider, s as ResolvedTarget } from "./events-mGuhF4i5.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-CSZPQ38I.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-D0lyo8O8.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-D3p8gjba.mjs";
2
- import "./index-BHXg4Xdo.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 { a as stoppedBy } from "./exports-DQauuHrc.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-BYmbTDgo.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
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as option } from "./commands-D0lyo8O8.mjs";
3
- import { m as projectDir } from "./server-Ch3tuK2k.mjs";
4
- import { r as main } from "./main-BYmbTDgo.mjs";
5
- import { n as stopped, r as startInspector } from "./inspect-2OIjv2lW.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-F-b4GPXX.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-DS2T2iWI.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;
@@ -226,6 +226,12 @@ declare const options: {
226
226
  readonly value: 'host';
227
227
  readonly description: 'also answer requests for this host, from a proxy in front: whoever reaches it there acts as you';
228
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
+ };
229
235
  readonly in: {
230
236
  readonly type: 'string';
231
237
  readonly value: 'duration';
@@ -176,6 +176,12 @@ const options = {
176
176
  value: "host",
177
177
  description: "also answer requests for this host, from a proxy in front: whoever reaches it there acts as you"
178
178
  },
179
+ tailscale: {
180
+ type: "string",
181
+ multiple: true,
182
+ value: "host",
183
+ 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"
184
+ },
179
185
  in: {
180
186
  type: "string",
181
187
  value: "duration",
@@ -1,7 +1,7 @@
1
- import { f as BoardError } from "./errors-DZ1tbwSM.mjs";
2
- import "./routes-B2HHHD_C.mjs";
1
+ import { f as BoardError } from "./errors-QhkdzI-o.mjs";
2
+ import "./routes-ABXf3CKq.mjs";
3
3
  import { c as canonical, t as block } from "./blocks-CVoBC7ur.mjs";
4
- import { a as canText, c as compileAccess } from "./access-Crbvd2Dm.mjs";
4
+ import { a as canText, c as compileAccess } from "./access-C06pIr0M.mjs";
5
5
  //#region src/conformance/index.ts
6
6
  var Mismatch = class extends Error {};
7
7
  const show = (value) => JSON.stringify(value) ?? String(value);
@@ -630,6 +630,25 @@ const CHECKS = [
630
630
  }), 400, "invalid_request", "threads with before and after");
631
631
  }
632
632
  },
633
+ {
634
+ group: "core",
635
+ name: "stores a handle one actor has as a mention of them, and keeps one no one has as typed",
636
+ run: async (ctx) => {
637
+ check(ctx.root, "posting failed, so there's no thread to reply in");
638
+ const { handle, actor } = ctx.me;
639
+ if (!/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?(?:\/[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?)?$/i.test(handle)) return `the caller's handle, ${handle}, isn't one a mention can type`;
640
+ const nobody = `conformance-nobody-${Date.now().toString(36)}`;
641
+ const sent = await reply(ctx, ctx.root.id, `conformance: over to @${handle} and @${nobody}`);
642
+ const settled = `conformance: over to @[${actor}] and @${nobody}`;
643
+ check(sent.text === settled, `a handle one actor has should be stored as @[actor-id], and one no one has as typed: expected ${show(settled)}, got ${show(sent.text)}`);
644
+ const [mine, none, ...more] = sent.mentions ?? [];
645
+ check(mine?.written === `@${handle}` && mine.actor?.id === actor, `the answer's mentions should say @${handle} mentions ${actor}, got ${show(mine)}`);
646
+ check(none?.written === `@${nobody}` && none.actor === null && none.candidates.length === 0, `the answer's mentions should say @${nobody} mentions no one, got ${show(none)}`);
647
+ check(more.length === 0, `the answer's mentions should have one entry a handle, got ${more.length + 2}`);
648
+ const kept = (await ctx.board.thread(ctx.root.id)).replies.find((message) => message.id === sent.id);
649
+ check(kept?.text === settled, `the message should read back as it was stored, got ${show(kept?.text)}`);
650
+ }
651
+ },
633
652
  {
634
653
  group: "core",
635
654
  name: "matches text anywhere in a message's own, in any case, as it reads now",
@@ -2488,6 +2507,78 @@ const CHECKS = [
2488
2507
  }
2489
2508
  }
2490
2509
  },
2510
+ {
2511
+ group: "sync",
2512
+ name: "meets a platform user an import's text mentions: an actor as one who wrote would be, whom the text names by that actor's ID",
2513
+ run: async (ctx) => {
2514
+ const key = SYNC_KEY;
2515
+ const thread = `${key}:${ctx.labels.conformance}:mentioned`;
2516
+ const author = {
2517
+ id: `${key}:user:${ctx.labels.conformance}`,
2518
+ handle: "conformance",
2519
+ name: "Conformance",
2520
+ avatar: null,
2521
+ isBot: false
2522
+ };
2523
+ const cc = {
2524
+ id: `${key}:user:${ctx.labels.conformance}-cc`,
2525
+ handle: "conformance-cc",
2526
+ name: "Conformance Cc",
2527
+ avatar: null,
2528
+ isBot: false
2529
+ };
2530
+ const origin = {
2531
+ thread,
2532
+ message: "1"
2533
+ };
2534
+ const registered = await registerSync(ctx);
2535
+ if ("skip" in registered) return registered.skip;
2536
+ const { where } = registered;
2537
+ try {
2538
+ let imported;
2539
+ try {
2540
+ imported = await ctx.board.syncImport({
2541
+ op: "post",
2542
+ author,
2543
+ from: key,
2544
+ channel: ctx.channel,
2545
+ text: `conformance: cc @[${cc.id}]`,
2546
+ mentioned: [cc],
2547
+ labels: ctx.labels,
2548
+ noSync: true,
2549
+ origin: {
2550
+ channel: `${key}:${ctx.labels.conformance}`,
2551
+ thread,
2552
+ subthread: null,
2553
+ message: "1",
2554
+ context: null
2555
+ },
2556
+ id: `conformance-mentioned-${ctx.labels.conformance}`
2557
+ });
2558
+ } catch (error) {
2559
+ if (error instanceof BoardError && error.status === 403) return `this token can't sync in ${ctx.channel}`;
2560
+ throw error;
2561
+ }
2562
+ isRef(imported.message, "an import's message");
2563
+ const actor = `${ctx.me.principal}+${cc.id}`;
2564
+ same((await ctx.board.thread(imported.message)).message.text, `conformance: cc @[${actor}]`, "the import's text, its mention by the actor's ID");
2565
+ const met = (await ctx.board.actors()).find((known) => known.id === actor);
2566
+ check(met !== void 0, `the board should know the user the import mentioned as ${actor}`);
2567
+ same(met?.name, cc.name, "the mentioned user's name");
2568
+ } finally {
2569
+ await ctx.board.syncImport({
2570
+ op: "delete",
2571
+ author,
2572
+ from: key,
2573
+ origin
2574
+ }).catch(() => {});
2575
+ await ctx.board.register({
2576
+ ...where,
2577
+ watch: {}
2578
+ }).catch(() => {});
2579
+ }
2580
+ }
2581
+ },
2491
2582
  {
2492
2583
  group: "sync",
2493
2584
  name: "queues a platform thread's events in its sync's inbox once, and leases each after the one before is acked",
@@ -1,4 +1,4 @@
1
- import { f as Board } from "./backend-D3p8gjba.mjs";
1
+ import { f as Board } from "./backend-i_esjwUS.mjs";
2
2
  //#region src/conformance/index.d.ts
3
3
  /**
4
4
  * Checks that a board speaks the protocol, through a handle on it (`conformance(board())`), as
@@ -1,2 +1,2 @@
1
- import { t as conformance } from "./conformance-Blzd4CXG.mjs";
1
+ import { t as conformance } from "./conformance-CDP8y2Zm.mjs";
2
2
  export { conformance };