@vercel/board 0.44.0 → 0.45.1

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 (71) hide show
  1. package/dist/{access-BgBiaCyx.mjs → access-3udXjJAg.mjs} +2 -2
  2. package/dist/access.d.mts +3 -3
  3. package/dist/access.mjs +6 -6
  4. package/dist/{actors-DkZsnMgA.mjs → actors-DasGZnfb.mjs} +3 -3
  5. package/dist/{auth-C8jxty0C.d.mts → auth-BG_whr9_.d.mts} +1 -1
  6. package/dist/{auth-Ft4AJptx.mjs → auth-aiOVE82-.mjs} +2 -2
  7. package/dist/{backend-_3W_5g6y.d.mts → backend-D6yTo8Un.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-DZ4DsAZ7.mjs → chat-provider-BvNqOQFL.mjs} +2 -2
  11. package/dist/{chat-provider-HQo68RWL.d.mts → chat-provider-V2jnjVLq.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 +2 -2
  16. package/dist/cli.mjs +14 -7
  17. package/dist/{commands-B75pBXIV.mjs → commands-CqdnjUkm.mjs} +6 -0
  18. package/dist/{commands-DHGZWeSZ.d.mts → commands-DewS14_P.d.mts} +6 -0
  19. package/dist/{conformance-CHqXZoGe.mjs → conformance-BInS4_6b.mjs} +3 -3
  20. package/dist/conformance.d.mts +1 -1
  21. package/dist/conformance.mjs +1 -1
  22. package/dist/{engine-D07DTYSi.mjs → engine-XVBt02Bl.mjs} +5 -5
  23. package/dist/{errors-DUzpDSrJ.mjs → errors-ZazTZh-s.mjs} +20 -3
  24. package/dist/{events-voButVQW.mjs → events-D17RndlV.mjs} +2 -2
  25. package/dist/{exports-BNk4w-b2.mjs → exports-DCxecX15.mjs} +205 -48
  26. package/dist/exports-Gspe1eEq.d.mts +4 -0
  27. package/dist/{external-DymyhUzl.mjs → external-DfhN7lKK.mjs} +1 -1
  28. package/dist/{index-CwOOIT0e.d.mts → index-Djmr4GzQ.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 +88 -88
  34. package/dist/inspect-C8U3A4jQ.mjs +2 -0
  35. package/dist/{inspect-dtQlHBcq.mjs → inspect-CHsgnf_5.mjs} +23 -7
  36. package/dist/{local-CnGNTReZ.mjs → local-DE9vmanM.mjs} +25 -14
  37. package/dist/{main-CpsAmpEy.mjs → main-CF1Me3jg.mjs} +19 -11
  38. package/dist/{memory-DhduVbUu.mjs → memory-DyEL0fvN.mjs} +2 -2
  39. package/dist/{middleware-0DUFrav-.mjs → middleware-BHHKHA9q.mjs} +2 -2
  40. package/dist/{origin-D4ER_Tze.mjs → origin-BbwhnKrg.mjs} +7 -7
  41. package/dist/{provider-CVI-DlWl.d.mts → provider-BC9mPYVh.d.mts} +14 -6
  42. package/dist/{routes-DrByOCc1.mjs → routes-CkUetTO2.mjs} +12 -13
  43. package/dist/{routes-CErTwlSZ.d.mts → routes-zm4TXKCC.d.mts} +6 -1
  44. package/dist/{schemas-DAzSsgWk.mjs → schemas-BhZaystC.mjs} +8 -2
  45. package/dist/{serve-BQT5quKD.mjs → serve-CEMvl0EH.mjs} +4 -4
  46. package/dist/{server-FlDE6BDt.mjs → server-Bmz0zqYM.mjs} +8 -8
  47. package/dist/{serving-hcxzaCCO.mjs → serving-BLVRrJ7P.mjs} +1 -1
  48. package/dist/{sql-P9g-rLIF.mjs → sql-CyVcjw8x.mjs} +2 -2
  49. package/dist/{sqlite-B3rCcIof.mjs → sqlite-Con-8duk.mjs} +2 -2
  50. package/dist/{sqlite-db-D0Fyju-4.mjs → sqlite-db-BdzxtUOV.mjs} +1 -1
  51. package/dist/sync-chat-sdk.d.mts +2 -2
  52. package/dist/sync-chat-sdk.mjs +2 -2
  53. package/dist/sync-github.d.mts +2 -2
  54. package/dist/sync-github.mjs +2 -2
  55. package/dist/sync-linear.d.mts +3 -3
  56. package/dist/sync-linear.mjs +2 -2
  57. package/dist/sync-slack.d.mts +3 -3
  58. package/dist/sync-slack.mjs +4 -4
  59. package/dist/sync.d.mts +2 -2
  60. package/dist/sync.mjs +2 -2
  61. package/dist/{tokens-BSMpTPEe.mjs → tokens-BErYXuHZ.mjs} +2 -2
  62. package/docs/01-board/01-mounting.md +2 -2
  63. package/docs/01-board/04-messages.md +1 -1
  64. package/docs/01-board/07-schedules.md +2 -2
  65. package/docs/01-board/09-access.md +8 -0
  66. package/docs/03-guides/02-inspector.md +16 -0
  67. package/docs/04-reference/02-board.md +23 -2
  68. package/docs/04-reference/03-http.md +3 -3
  69. package/package.json +1 -1
  70. package/dist/exports-DFwXKst5.d.mts +0 -4
  71. package/dist/inspect-DBLdh9NM.mjs +0 -2
@@ -0,0 +1,2 @@
1
+ import { t as inspect } from "./inspect-CHsgnf_5.mjs";
2
+ export { inspect };
@@ -1,6 +1,6 @@
1
- import { h as ATTACHMENT_BYTES_MAX } from "./errors-DUzpDSrJ.mjs";
2
- import "./schemas-DAzSsgWk.mjs";
3
- import { t as Failed, u as who } from "./main-CpsAmpEy.mjs";
1
+ import { _ as ATTACHMENT_BYTES_MAX } from "./errors-ZazTZh-s.mjs";
2
+ import "./schemas-BhZaystC.mjs";
3
+ import { t as Failed, u as who } from "./main-CF1Me3jg.mjs";
4
4
  import { t as page } from "./page-D-OzDOAX.mjs";
5
5
  import { randomBytes, timingSafeEqual } from "node:crypto";
6
6
  import { createServer } from "node:http";
@@ -451,7 +451,8 @@ const CSP = [
451
451
  * 127.0.0.1. Because the proxy acts as you, it answers only its own page: every
452
452
  * request must name this server's host (no DNS rebinding) and carry the per-run
453
453
  * token that only the page has, and writes must also come from its origin. Your
454
- * credential for the board never leaves this process.
454
+ * credential for the board never leaves this process. `hosts` adds names a proxy in
455
+ * front of it serves the page on: whoever reaches the page there acts as you.
455
456
  */
456
457
  async function startInspector(options) {
457
458
  const { client } = options;
@@ -459,6 +460,7 @@ async function startInspector(options) {
459
460
  const board = (await client.discovery().catch(() => null))?.url ?? client.url;
460
461
  const app = options.page ?? await bundle();
461
462
  const token = randomBytes(24).toString("base64url");
463
+ let hosts = /* @__PURE__ */ new Set();
462
464
  let origins = /* @__PURE__ */ new Set();
463
465
  const streams = /* @__PURE__ */ new Set();
464
466
  async function proxy(request, response, url) {
@@ -519,14 +521,24 @@ async function startInspector(options) {
519
521
  }
520
522
  const server = createServer((request, response) => {
521
523
  const url = new URL(request.url ?? "/", "http://inspector");
522
- if (!origins.has(`http://${request.headers.host}`)) return send(response, 421, "text/plain; charset=utf-8", "wrong host");
524
+ if (!hosts.has(String(request.headers.host).toLowerCase())) return send(response, 421, "text/plain; charset=utf-8", "wrong host");
523
525
  if (url.pathname === "/board" || url.pathname.startsWith("/board/")) return void proxy(request, response, url).catch(() => response.headersSent ? response.end() : send(response, 500, "text/plain; charset=utf-8", "error"));
524
526
  if (request.method !== "GET") return send(response, 405, "text/plain; charset=utf-8", "method not allowed");
525
527
  if (url.pathname === "/app.js") return app ? send(response, 200, "text/javascript; charset=utf-8", app) : send(response, 503, "text/plain; charset=utf-8", "the inspector's UI isn't built: run `pnpm --filter @vercel/board build`");
526
528
  send(response, 200, "text/html; charset=utf-8", shell(token), { "content-security-policy": CSP });
527
529
  });
528
530
  const port = await listen(server, options.port ?? 4747, options.port === void 0);
529
- origins = /* @__PURE__ */ new Set([`http://127.0.0.1:${port}`, `http://localhost:${port}`]);
531
+ const allowed = (options.hosts ?? []).map((host) => host.toLowerCase());
532
+ hosts = /* @__PURE__ */ new Set([
533
+ `127.0.0.1:${port}`,
534
+ `localhost:${port}`,
535
+ ...allowed
536
+ ]);
537
+ origins = /* @__PURE__ */ new Set([
538
+ `http://127.0.0.1:${port}`,
539
+ `http://localhost:${port}`,
540
+ ...allowed.flatMap((host) => [`http://${host}`, `https://${host}`])
541
+ ]);
530
542
  return {
531
543
  url: `http://127.0.0.1:${port}`,
532
544
  board,
@@ -616,12 +628,16 @@ async function pageOf() {
616
628
  });
617
629
  return found;
618
630
  }
619
- async function inspect({ flags, out, portFlag, client, openBrowser }) {
631
+ async function inspect({ flags, out, usage, portFlag, client, openBrowser }) {
620
632
  const port = portFlag();
633
+ const hosts = flags["allow-host"] ?? [];
634
+ const bad = hosts.find((host) => !/^[a-z0-9.-]+(:\d+)?$/i.test(host));
635
+ if (bad !== void 0) throw usage(`--allow-host takes a host, with a port if it isn't the default, like box.tailnet.ts.net: not ${bad}.`);
621
636
  const page = await pageOf();
622
637
  const inspector = await startInspector({
623
638
  client: client(),
624
639
  page,
640
+ hosts,
625
641
  ...port !== void 0 ? { port } : {}
626
642
  });
627
643
  out(`inspecting ${inspector.board} as ${who(inspector.me)} at ${inspector.url} (Ctrl-C to stop)`);
@@ -1,17 +1,17 @@
1
- import { _ as IMPORT_BYTES_MAX, a as forbidden$1, b as mediaType, c as toErrorResponse, f as duration, g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, i as duplicateId, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-DUzpDSrJ.mjs";
2
- import { _ as actorKind, a as CAN_MAX, b as storable, c as Handle, d as Labels, g as SeenActorKind, h as RemoteWatcherId, i as Author, l as LabelKey, m as MessageText, n as Attachment, o as ChannelPath, p as MessageId, s as Emoji, t as ActorId, v as authorView, y as platformAvatar } from "./schemas-DAzSsgWk.mjs";
3
- import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-DymyhUzl.mjs";
1
+ import { S as mediaType, _ as ATTACHMENT_BYTES_MAX, a as forbidden$1, b as fileName, c as textTooLong, d as BoardError, i as duplicateId, l as toErrorResponse, p as duration, r as badRequest, s as notFound, t as HttpError, v as DIRECT_UPLOAD_BYTES_MAX, y as IMPORT_BYTES_MAX } from "./errors-ZazTZh-s.mjs";
2
+ import { S as storable, _ as SeenActorKind, a as CAN_MAX, b as authorView, c as Emoji, f as Labels, g as RemoteWatcherId, h as MessageText, i as Author, l as Handle, m as MessageId, n as Attachment, o as CHANNEL_PATTERN_MAX, s as ChannelPath, t as ActorId, u as LabelKey, x as platformAvatar, y as actorKind } from "./schemas-BhZaystC.mjs";
3
+ import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-DfhN7lKK.mjs";
4
+ import "./routes-CkUetTO2.mjs";
5
+ import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-BHHKHA9q.mjs";
4
6
  import { a as SCHEMA_DESCRIPTION_MAX, c as canonical, d as parseSchemaId, f as schemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, n as blocksIn, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX, u as isBuiltInName } from "./blocks-CVoBC7ur.mjs";
5
- import "./routes-DrByOCc1.mjs";
6
- import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-0DUFrav-.mjs";
7
- import { a as compileWatcher, c as METHODS, h as VERSION, i as runMatch, m as SYNC, n as syncTarget, o as hasCriteria, r as canonicalWatchers, t as SYNC_ACTOR } from "./origin-D4ER_Tze.mjs";
8
- import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
9
- import { S as wroteAs, _ as removes, a as authenticates, c as checkPrincipal, d as grantIssuers, m as joined, n as GITHUB_ISSUER, o as checkCan, p as issuerName, s as checkGrant, x as workflowPath } from "./auth-Ft4AJptx.mjs";
7
+ import { a as compileWatcher, c as METHODS, h as VERSION, i as runMatch, m as SYNC, n as syncTarget, o as hasCriteria, r as canonicalWatchers, t as SYNC_ACTOR } from "./origin-BbwhnKrg.mjs";
8
+ import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-3udXjJAg.mjs";
9
+ import { S as wroteAs, _ as removes, a as authenticates, c as checkPrincipal, d as grantIssuers, m as joined, n as GITHUB_ISSUER, o as checkCan, p as issuerName, s as checkGrant, x as workflowPath } from "./auth-aiOVE82-.mjs";
10
10
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
11
- import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-DkZsnMgA.mjs";
11
+ import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-DasGZnfb.mjs";
12
12
  import { C as sessionClearedError, a as SOCKET_TIMINGS, c as drainSettledHooks, d as nullProtoRecord, f as runtimeConsumerFactory, g as A2Error, h as stateTailReaders, i as RESERVED_PARTICIPANT_IDS, l as failedPreviousAttempt, m as serverInternals, n as POLL_TIMINGS, o as STATE_CACHE, p as runtimeConsumers, r as PRESENCE_TIMINGS, s as STREAM_TIMINGS, t as DRAIN_TIMINGS, u as markSchedulerSendFailure, v as NonRetriableError, x as isSessionCleared, y as asStoreUnavailable } from "./internal-CvsrprnU-CEPOUpAv.mjs";
13
13
  import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-oh3aU_An.mjs";
14
- import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-P9g-rLIF.mjs";
14
+ import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-CyVcjw8x.mjs";
15
15
  import { a as replaceMentions, i as mentionTerms, n as isEmail, r as mentionTerm, t as extractMentions } from "./mentions-DfZGp3B-.mjs";
16
16
  import { z } from "zod";
17
17
  import { createHash, randomBytes } from "node:crypto";
@@ -4245,7 +4245,7 @@ const schedulesContract = contract({
4245
4245
  const SCHEDULES_SESSION = "schedules";
4246
4246
  const Grant = z.union([z.literal("all"), z.array(z.string().min(1).max(16)).max(8)]);
4247
4247
  /** A `can`, as config writes it: board() checks it before it's kept. */
4248
- const Can = z.union([Grant, z.record(z.string().min(1).max(300), Grant)]);
4248
+ const Can = z.union([Grant, z.record(z.string().min(1).max(CHANNEL_PATTERN_MAX), Grant)]);
4249
4249
  const ClaimValue = z.string().min(1).max(1e3);
4250
4250
  const Environments = z.array(z.string().min(1).max(100)).max(16);
4251
4251
  /** Who a grant names, as the board keeps it: IDs, with the names it knows beside them. */
@@ -4289,7 +4289,7 @@ const GrantPrincipal = z.discriminatedUnion("kind", [
4289
4289
  z.object({ kind: z.literal("everyone") })
4290
4290
  ]);
4291
4291
  /** A grant's `can`, as written: each pattern and `'all'` or its permissions. */
4292
- const GrantCan = z.record(z.string().min(1).max(300), Grant);
4292
+ const GrantCan = z.record(z.string().min(1).max(CHANNEL_PATTERN_MAX), Grant);
4293
4293
  /**
4294
4294
  * Who the board trusts beside its code's rules, outside the board log: its grants. Session
4295
4295
  * `access`. A grant's ID comes from the fold, counting from the one the board starts with.
@@ -5981,6 +5981,9 @@ function createSchemas(options) {
5981
5981
  },
5982
5982
  async createSchema({ principal, actor }, body) {
5983
5983
  if (!principal.access.at("manage", "*")) throw forbidden$1("this token can't register schemas: it needs manage at *");
5984
+ if (!SCHEMA_NAME.test(body.name)) throw badRequest("name: a schema name is up to 80 lowercase letters, numbers, and ._-, starting with a letter");
5985
+ if (body.version > 99999) throw badRequest(`version: a schema version is at most ${SCHEMA_VERSION_MAX.toLocaleString("en-US")}`);
5986
+ if (body.description !== void 0 && body.description.length > 2e3) throw badRequest(`description: a schema description is at most ${SCHEMA_DESCRIPTION_MAX.toLocaleString("en-US")} characters`);
5984
5987
  const id = schemaId(body.name, body.version);
5985
5988
  if (isBuiltInName(body.name)) throw new HttpError(409, "reserved_schema", `${body.name} is a built-in schema: register yours under another name`);
5986
5989
  const problem = checkDefinition(body.schema);
@@ -7646,6 +7649,11 @@ function build(options, binding) {
7646
7649
  if (!await attachmentReadable(principal, id, uploader)) throw attachmentNotFound(id);
7647
7650
  return attachment;
7648
7651
  }));
7652
+ /** This board's own limits on a message, which requests leave to the backend. */
7653
+ const withinLimits = ({ text, attachments }) => {
7654
+ if (text.length > 1e4) throw textTooLong();
7655
+ if ((attachments?.length ?? 0) > 10) throw badRequest(`attachments: a message carries at most 10`);
7656
+ };
7649
7657
  /** A registrant's queue, in the watch contract: its watchers' and sync's matches, and its inbox. */
7650
7658
  const queueOf = (owner) => watchers.server.session(registrantSession(owner));
7651
7659
  /**
@@ -7668,6 +7676,7 @@ function build(options, binding) {
7668
7676
  /** A post as it lands: what the caller may post, with the files it may have. */
7669
7677
  async function postNow(caller, identity, parsed) {
7670
7678
  const { principal } = identity;
7679
+ withinLimits(parsed);
7671
7680
  const body = {
7672
7681
  ...parsed,
7673
7682
  re: parsed.re === void 0 ? void 0 : messageAt(parsed.re)
@@ -7837,6 +7846,7 @@ function build(options, binding) {
7837
7846
  return postNow(caller, await identityOf(caller), parsed);
7838
7847
  },
7839
7848
  async edit(caller, { id, text, revision }) {
7849
+ withinLimits({ text });
7840
7850
  const identity = await identityOf(caller);
7841
7851
  const authorized = await authorizeOwn(writes, identity, messageAt(id), "edit");
7842
7852
  await writeEdit(writes, {
@@ -7881,6 +7891,7 @@ function build(options, binding) {
7881
7891
  return { ok: true };
7882
7892
  },
7883
7893
  async schedule(caller, parsed) {
7894
+ withinLimits(parsed);
7884
7895
  const identity = await identityOf(caller);
7885
7896
  const body = {
7886
7897
  ...parsed,
@@ -8802,10 +8813,10 @@ function local(options = {}) {
8802
8813
  opening ??= (async () => {
8803
8814
  const file = localFile(bound.name);
8804
8815
  let store;
8805
- if (options.memory) store = (await import("./memory-DhduVbUu.mjs")).memory();
8816
+ if (options.memory) store = (await import("./memory-DyEL0fvN.mjs")).memory();
8806
8817
  else {
8807
8818
  const { mkdir } = await import("node:fs/promises");
8808
- const { sqlite } = await import("./sqlite-B3rCcIof.mjs");
8819
+ const { sqlite } = await import("./sqlite-Con-8duk.mjs");
8809
8820
  const path = join(dir, `${file}.db`);
8810
8821
  try {
8811
8822
  await mkdir(dir, {
@@ -1,14 +1,14 @@
1
- import { g as DIRECT_UPLOAD_BYTES_MAX, u as BoardError, y as fileSize } from "./errors-DUzpDSrJ.mjs";
2
- import { f as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-DAzSsgWk.mjs";
3
- import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
1
+ import { d as BoardError, v as DIRECT_UPLOAD_BYTES_MAX, x as fileSize } from "./errors-ZazTZh-s.mjs";
2
+ import { p as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-BhZaystC.mjs";
4
3
  import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
5
- import { l as shownName } from "./middleware-0DUFrav-.mjs";
6
- import { h as VERSION, s as withMentions } from "./origin-D4ER_Tze.mjs";
7
- import { r as PERMISSIONS } from "./access-BgBiaCyx.mjs";
8
- import { a as isApiMessageId, n as isBoardName } from "./exports-BNk4w-b2.mjs";
9
- import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-B75pBXIV.mjs";
10
- import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-FlDE6BDt.mjs";
11
- import { t as conformance } from "./conformance-CHqXZoGe.mjs";
4
+ import { l as shownName } from "./middleware-BHHKHA9q.mjs";
5
+ import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
6
+ import { h as VERSION, s as withMentions } from "./origin-BbwhnKrg.mjs";
7
+ import { r as PERMISSIONS } from "./access-3udXjJAg.mjs";
8
+ import { a as isApiMessageId, n as isBoardName } from "./exports-DCxecX15.mjs";
9
+ import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-CqdnjUkm.mjs";
10
+ import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-Bmz0zqYM.mjs";
11
+ import { t as conformance } from "./conformance-BInS4_6b.mjs";
12
12
  import { n as displayText } from "./bots-CLKKMgYf.mjs";
13
13
  import { spawn } from "node:child_process";
14
14
  import { readFile, stat, writeFile } from "node:fs/promises";
@@ -1096,6 +1096,8 @@ let typed = [];
1096
1096
  let warnings = [];
1097
1097
  /** The board this run reached by its URL, for a failure to name. */
1098
1098
  let reached = null;
1099
+ /** How long the message text this run sends is, for a backend's refusal of it to say what to do instead. */
1100
+ let sentLength = 0;
1099
1101
  /** The help `words` ask for: a command's page when they name one (`read`, `sources read`), or else every command. */
1100
1102
  function help(words = []) {
1101
1103
  const own = Object.values(app.commands).map((command) => command.spec);
@@ -1472,6 +1474,11 @@ function configuredUrl() {
1472
1474
  * JSON the text is, from wherever text comes (the argument, stdin, `--text-file`).
1473
1475
  */
1474
1476
  async function content(value, options = {}) {
1477
+ const said = await given(value, options);
1478
+ sentLength = said.length;
1479
+ return said;
1480
+ }
1481
+ async function given(value, options) {
1475
1482
  const schema = flags.schema;
1476
1483
  if (schema === void 0) return text(value, options);
1477
1484
  if (!parseSchemaId(schema)) throw usage(`${schema} doesn't name a schema. One is name@version, like sandbox@1.`);
@@ -1692,7 +1699,7 @@ function failureOf(error) {
1692
1699
  instruction: "See the schemas this board has",
1693
1700
  argv: [...cli(), "schemas"]
1694
1701
  }]);
1695
- if (status === 400 && code === "text_too_long") return {
1702
+ if (status === 400 && (code === "text_too_long" || code === "invalid_message" && sentLength > 1e4)) return {
1696
1703
  ...theirs("limit", "payload_too_large", `Can't ${doing()}. A message's text is at most ${MESSAGE_TEXT_MAX.toLocaleString("en-US")} characters.`, [{ instruction: current.command === "edit" ? "Keep the edit short, and reply with the long part in a file with --attach" : "Put the long part in a file and --attach it, with a short summary as the text" }]),
1697
1704
  details: []
1698
1705
  };
@@ -2903,6 +2910,7 @@ async function runOnce(argv, options) {
2903
2910
  positionals = [];
2904
2911
  warnings = [];
2905
2912
  reached = null;
2913
+ sentLength = 0;
2906
2914
  try {
2907
2915
  parse(argv);
2908
2916
  if (flags.version) {
@@ -1,6 +1,6 @@
1
- import { r as sqlTables } from "./sql-P9g-rLIF.mjs";
1
+ import { r as sqlTables } from "./sql-CyVcjw8x.mjs";
2
2
  import { t as memory$1 } from "./store-memory-CKQVEzXN.mjs";
3
- import { t as sqliteDb } from "./sqlite-db-D0Fyju-4.mjs";
3
+ import { t as sqliteDb } from "./sqlite-db-BdzxtUOV.mjs";
4
4
  //#region src/store/memory.ts
5
5
  /**
6
6
  * A board that lives in memory, for tests: its log in A2's memory store, its
@@ -1,5 +1,5 @@
1
- import { t as HttpError } from "./errors-DUzpDSrJ.mjs";
2
- import { d as Labels, f as MESSAGE_TEXT_MAX } from "./schemas-DAzSsgWk.mjs";
1
+ import { t as HttpError } from "./errors-ZazTZh-s.mjs";
2
+ import { f as Labels, p as MESSAGE_TEXT_MAX } from "./schemas-BhZaystC.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/client/ids.ts
5
5
  const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -1,13 +1,13 @@
1
- import { h as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-DUzpDSrJ.mjs";
2
- import "./schemas-DAzSsgWk.mjs";
3
- import { l as isThreadTarget } from "./external-DymyhUzl.mjs";
4
- import { F as routes, s as Filters } from "./routes-DrByOCc1.mjs";
5
- import { i as afterRetry } from "./middleware-0DUFrav-.mjs";
6
- import { o as options } from "./commands-B75pBXIV.mjs";
1
+ import { _ as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-ZazTZh-s.mjs";
2
+ import "./schemas-BhZaystC.mjs";
3
+ import { l as isThreadTarget } from "./external-DfhN7lKK.mjs";
4
+ import { F as routes, s as Filters } from "./routes-CkUetTO2.mjs";
5
+ import { i as afterRetry } from "./middleware-BHHKHA9q.mjs";
6
+ import { o as options } from "./commands-CqdnjUkm.mjs";
7
7
  import { z } from "zod";
8
8
  //#endregion
9
9
  //#region src/version.ts
10
- const VERSION = "0.44.0";
10
+ const VERSION = "0.45.1";
11
11
  //#endregion
12
12
  //#region src/server/backend.ts
13
13
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -1,4 +1,4 @@
1
- import { At as ThreadsQueryInput, Ct as SyncReceiptInput, Dt as ThreadView, F as Me, I as MessageView, L as MessagesPage, N as MatchView, Ot as ThreadsPage, Pt as UpdateGrantInput, T as InboxItem, Tt as SyncedView, X as RegistrationView, Y as RegisterInput, _ as FiltersInput, _t as SyncFindInput, a as BoardEventView, b as GrantInput, cn as ExternalEvent, ct as SchemaView, dn as Link, f as EventsPage, ft as SourceRead, g as Explanation, it as SchedulesQueryInput, ln as ExternalFile, lt as SourceJoin, n as ActorView, nn as ExternalCopy, nt as ScheduleView, rn as Attachment, s as ChannelView, sn as ExternalAuthor, st as SchemaInput, tn as Actor, u as Discovery, un as ExternalLink, w as InboxEntry, wt as SyncThreadView, x as GrantView, xt as SyncImportInput, yt as SyncFindView, z as MessagesQueryInput } from "./routes-CErTwlSZ.mjs";
1
+ import { At as ThreadsQueryInput, Ct as SyncReceiptInput, Dt as ThreadView, F as Me, I as MessageView, L as MessagesPage, N as MatchView, Ot as ThreadsPage, Pt as UpdateGrantInput, T as InboxItem, Tt as SyncedView, X as RegistrationView, Y as RegisterInput, _ as FiltersInput, _t as SyncFindInput, a as BoardEventView, b as GrantInput, cn as ExternalAuthor, ct as SchemaView, dn as ExternalLink, f as EventsPage, fn as Link, ft as SourceRead, g as Explanation, in as Attachment, it as SchedulesQueryInput, ln as ExternalEvent, lt as SourceJoin, n as ActorView, nn as Actor, nt as ScheduleView, rn as ExternalCopy, s as ChannelView, st as SchemaInput, u as Discovery, un as ExternalFile, w as InboxEntry, wt as SyncThreadView, x as GrantView, xt as SyncImportInput, yt as SyncFindView, z as MessagesQueryInput } from "./routes-zm4TXKCC.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/client/client.d.ts
4
4
  /**
@@ -84,6 +84,16 @@ type UploadInput = {
84
84
  /** A MIME type; a `Blob`'s own type, or one from the name's extension, otherwise. */
85
85
  type?: string;
86
86
  };
87
+ /** Whether live events are flowing: `live` once the board has answered a request for them, `retrying` once one failed and it's backing off. */
88
+ type EventsState = 'live' | 'retrying';
89
+ /**
90
+ * What following events takes: a `signal` that stops it, and `onState`, told each time the feed
91
+ * goes live or starts retrying. It hears nothing before the first answer or failure.
92
+ */
93
+ type EventsOptions = {
94
+ signal?: AbortSignal;
95
+ onState?: (state: EventsState) => void;
96
+ };
87
97
  type WaitOptions = {
88
98
  /** `'30s'`, `'10m'`, `'1h'`, or milliseconds. Default `'30m'`. */
89
99
  timeout?: string | number;
@@ -355,13 +365,11 @@ declare function createBoardClient(options: ClientOptions): {
355
365
  }) => Promise<{
356
366
  ok: true;
357
367
  }>;
358
- /** Live events. Reconnects from the last seen index whenever the stream closes. */
368
+ /** Live events. Reconnects from the last seen index whenever the stream closes, and tells `onState` whether it's live or retrying. */
359
369
  events(query?: Filters & {
360
370
  after?: string;
361
371
  all?: boolean;
362
- }, opts?: {
363
- signal?: AbortSignal;
364
- }): AsyncGenerator<BoardEventView>;
372
+ }, opts?: EventsOptions): AsyncGenerator<BoardEventView>;
365
373
  /** The next matching event after `after` (default: now), or null on timeout. */
366
374
  wait(query?: Filters & {
367
375
  after?: string;
@@ -1059,4 +1067,4 @@ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
1059
1067
  render(input: RenderInput): string;
1060
1068
  }
1061
1069
  //#endregion
1062
- export { SyncRoot as A, ReplyOptions as B, mirror as C, RootOverride as D, ProviderEvent as E, BoardError as F, duration as G, ScheduleTiming as H, ErrorOrigin as I, Filters as L, eventSchema as M, VercelDeployment as N, SyncOverrides as O, BoardClient as P, PostOptions as R, into as S, EventBase as T, UploadInput as U, ScheduleOptions as V, WaitOptions as W, SyncFn as _, ProviderOptions as a, SyncUnit as b, Receive as c, Renderer as d, ResolvedTarget as f, Sync as g, UnreadableError as h, ProviderFile as i, envelope as j, SyncResult as k, ReceivedEvent as l, SyncProvider as m, FileDelivery as n, ProviderPost as o, SyncContext as p, ProviderDelivery as r, ProviderSender as s, FetchedLink as t, RenderInput as u, SyncIn as v, render as w, channels as x, SyncOut as y, ProfileOption as z };
1070
+ export { SyncRoot as A, Filters as B, mirror as C, RootOverride as D, ProviderEvent as E, BoardError as F, ScheduleTiming as G, ProfileOption as H, ErrorOrigin as I, duration as J, UploadInput as K, EventsOptions as L, eventSchema as M, VercelDeployment as N, SyncOverrides as O, BoardClient as P, EventsState as R, into as S, EventBase as T, ReplyOptions as U, PostOptions as V, ScheduleOptions as W, SyncFn as _, ProviderOptions as a, SyncUnit as b, Receive as c, Renderer as d, ResolvedTarget as f, Sync as g, UnreadableError as h, ProviderFile as i, envelope as j, SyncResult as k, ReceivedEvent as l, SyncProvider as m, FileDelivery as n, ProviderPost as o, SyncContext as p, WaitOptions as q, ProviderDelivery as r, ProviderSender as s, FetchedLink as t, RenderInput as u, SyncIn as v, render as w, channels as x, SyncOut as y, ExplainPrincipal as z };
@@ -1,7 +1,6 @@
1
- import { g as DIRECT_UPLOAD_BYTES_MAX } from "./errors-DUzpDSrJ.mjs";
2
- import { b as storable, d as Labels, f as MESSAGE_TEXT_MAX, l as LabelKey, m as MessageText, o as ChannelPath, r as AttachmentId, s as Emoji, u as LabelValue, y as platformAvatar } from "./schemas-DAzSsgWk.mjs";
3
- import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DymyhUzl.mjs";
4
- import { a as SCHEMA_DESCRIPTION_MAX, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX } from "./blocks-CVoBC7ur.mjs";
1
+ import { v as DIRECT_UPLOAD_BYTES_MAX } from "./errors-ZazTZh-s.mjs";
2
+ import { S as storable, c as Emoji, d as LabelValue, f as Labels, h as MessageText, o as CHANNEL_PATTERN_MAX, p as MESSAGE_TEXT_MAX, r as AttachmentId, s as ChannelPath, u as LabelKey, v as SentText, x as platformAvatar } from "./schemas-BhZaystC.mjs";
3
+ import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DfhN7lKK.mjs";
5
4
  import { z } from "zod";
6
5
  //#region src/api/routes.ts
7
6
  /**
@@ -68,7 +67,7 @@ const PostBody = z.object({
68
67
  channel: ChannelPath.optional(),
69
68
  re: Ref.optional(),
70
69
  /** May be empty when the message has attachments. */
71
- text: z.string().max(MESSAGE_TEXT_MAX).default(""),
70
+ text: z.string().default(""),
72
71
  labels: Labels.optional(),
73
72
  noSync: z.boolean().optional(),
74
73
  /**
@@ -78,7 +77,7 @@ const PostBody = z.object({
78
77
  sync: z.array(z.union([z.string().min(3).max(300), ResolvedSyncTarget])).max(10).optional(),
79
78
  id: z.string().min(1).max(200).refine(storable, "id has a NUL character or a lone surrogate").optional(),
80
79
  /** IDs from `POST /attachments`. */
81
- attachments: z.array(AttachmentId).max(10).optional(),
80
+ attachments: z.array(AttachmentId).optional(),
82
81
  /**
83
82
  * A reply's precondition: a message in its thread, the newest as the caller read it. If another
84
83
  * has come after it, nothing is posted, and the board answers 409 `newer_message`.
@@ -103,10 +102,10 @@ const Instant = z.string().datetime({ offset: true });
103
102
  const ScheduleBody = z.object({
104
103
  channel: ChannelPath.optional(),
105
104
  re: Ref.optional(),
106
- text: z.string().max(MESSAGE_TEXT_MAX).default(""),
105
+ text: z.string().default(""),
107
106
  labels: Labels.optional(),
108
107
  noSync: z.boolean().optional(),
109
- attachments: z.array(AttachmentId).max(10).optional(),
108
+ attachments: z.array(AttachmentId).optional(),
110
109
  in: Duration.optional(),
111
110
  at: Instant.optional(),
112
111
  every: Duration.optional(),
@@ -176,7 +175,7 @@ const PrincipalInput = z.discriminatedUnion("kind", [
176
175
  z.strictObject({ kind: z.literal("everyone") })
177
176
  ]);
178
177
  /** What a grant lets its principals do: a map from channel pattern to `'all'` or a list, `[]` for none. Kept as written. */
179
- const GrantCan = z.record(z.string().min(1).max(300), CanGrant);
178
+ const GrantCan = z.record(z.string().min(1).max(CHANNEL_PATTERN_MAX), CanGrant);
180
179
  /** A grant: who it names, and one `can` for all of them. The same principals again are another grant. */
181
180
  const GrantBody = z.strictObject({
182
181
  principals: z.array(PrincipalInput).min(1).max(32),
@@ -219,9 +218,9 @@ const UpdateGrantBody = z.strictObject({
219
218
  * Strict, so a board that doesn't know a field refuses it: what it kept could never be changed.
220
219
  */
221
220
  const SchemaBody = z.strictObject({
222
- name: z.string().regex(SCHEMA_NAME, "a schema name is up to 80 lowercase letters, numbers, and ._-, starting with a letter"),
223
- version: z.number().int().min(1).max(SCHEMA_VERSION_MAX),
224
- description: z.string().min(1).max(SCHEMA_DESCRIPTION_MAX).refine(storable, "a description has a NUL character or a lone surrogate").optional(),
221
+ name: z.string().regex(/^[a-z][a-z0-9._-]*$/, "a schema name is lowercase letters, numbers, and ._-, starting with a letter"),
222
+ version: z.number().int().min(1),
223
+ description: z.string().min(1).refine(storable, "a description has a NUL character or a lone surrogate").optional(),
225
224
  schema: z.record(z.string(), z.unknown())
226
225
  });
227
226
  const SyncBody = z.object({ target: z.string().min(3).max(300) });
@@ -447,7 +446,7 @@ const UploadStartBody = z.object({
447
446
  sha256: z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "sha256 is the base64 SHA-256 of the bytes").optional()
448
447
  });
449
448
  const EditBody = z.object({
450
- text: MessageText,
449
+ text: SentText,
451
450
  revision: Revision.optional()
452
451
  });
453
452
  const DeleteBody = z.object({ revision: Revision.optional() }).optional();
@@ -1620,6 +1620,11 @@ type Discovery = {
1620
1620
  audience: string;
1621
1621
  team_id: string | null;
1622
1622
  project_id: string | null;
1623
+ /**
1624
+ * The board's name, where boards have one: a team's board in Vercel's API (`General`, the default's).
1625
+ * A handle on one says it, for a UI to show which board it's on; `GET /` on a board never does.
1626
+ */
1627
+ name?: string;
1623
1628
  /** The board's sync entries: `key` names its webhook and inbox, `platform` is e.g. `slack`. */
1624
1629
  sync: {
1625
1630
  key: string;
@@ -2672,4 +2677,4 @@ declare const routes: {
2672
2677
  };
2673
2678
  type RouteName = keyof typeof routes;
2674
2679
  //#endregion
2675
- export { ScheduleBody as $, parseCan as $t, LabelBody as A, ThreadsQueryInput as At, ParsedFilters as B, Can as Bt, InboxAckBody as C, SyncReceiptInput as Ct, InboxPushBody as D, ThreadView as Dt, InboxNextQuery as E, ThreadSummaryView as Et, Me as F, UploadStartBody as Ft, REGISTERED_WATCHERS_MAX as G, GrantChangeRefusal as Gt, PostInput as H, FULL_ACCESS as Ht, MessageView as I, UploadTicket as It, RegisterBody as J, Level as Jt, ReactBody as K, GrantShape as Kt, MessagesPage as L, routes as Lt, LinkedQuery as M, TypingResult as Mt, MatchView as N, UpdateGrantBody as Nt, InboxQuery as O, ThreadsPage as Ot, MatchesQuery as P, UpdateGrantInput as Pt, RouteName as Q, compileAccess as Qt, MessagesQuery as R, Access as Rt, INBOX_EVENT_ID_MAX as S, SyncReceiptBody as St, InboxItem as T, SyncedView as Tt, PrincipalInput as U, Grant as Ut, PostBody as V, ChannelPattern as Vt, PrincipalView as W, GrantChange as Wt, RegistrationView as X, WrittenCan as Xt, RegisterInput as Y, Permission as Yt, ResolvedSyncTarget as Z, checkGrantChange as Zt, FiltersInput as _, SyncFindInput as _t, BoardEventView as a, CAN_MAX as an, SchedulesQueryOutput as at, GrantInput as b, SyncImportBody as bt, CreateChannelBody as c, ExternalEvent as cn, SchemaView as ct, EditBody as d, Link as dn, SourceMessage as dt, union as en, ScheduleBodyOutput as et, EventsPage as f, SourceRead as ft, Explanation as g, SyncCopiesView as gt, ExplainQuery as h, SyncCopiesQuery as ht, BlockView as i, Author as in, SchedulesQueryInput as it, LinkView as j, TypingBody as jt, LABEL_CONDITIONS_MAX as k, ThreadsQuery as kt, DeleteBody as l, ExternalFile as ln, SourceJoin as lt, EventsQueryInput as m, SyncBody as mt, ActorView as n, ExternalCopy as nn, ScheduleView as nt, CanAt as o, Labels as on, SchemaBody as ot, EventsQuery as p, SourceReadQuery as pt, Ref as q, InvalidCan as qt, ApiError as r, Attachment as rn, SchedulesQuery as rt, ChannelView as s, ExternalAuthor as sn, SchemaInput as st, AckBody as t, Actor as tn, ScheduleInput as tt, Discovery as u, ExternalLink as un, SourceJoinBody as ut, GrantBody as v, SyncFindQuery as vt, InboxEntry as w, SyncThreadView as wt, GrantView as x, SyncImportInput as xt, GrantCan as y, SyncFindView as yt, MessagesQueryInput as z, AccessSummary as zt };
2680
+ export { ScheduleBody as $, compileAccess as $t, LabelBody as A, ThreadsQueryInput as At, ParsedFilters as B, Can as Bt, InboxAckBody as C, SyncReceiptInput as Ct, InboxPushBody as D, ThreadView as Dt, InboxNextQuery as E, ThreadSummaryView as Et, Me as F, UploadStartBody as Ft, REGISTERED_WATCHERS_MAX as G, GrantChangeRefusal as Gt, PostInput as H, FULL_ACCESS as Ht, MessageView as I, UploadTicket as It, RegisterBody as J, Level as Jt, ReactBody as K, GrantShape as Kt, MessagesPage as L, routes as Lt, LinkedQuery as M, TypingResult as Mt, MatchView as N, UpdateGrantBody as Nt, InboxQuery as O, ThreadsPage as Ot, MatchesQuery as P, UpdateGrantInput as Pt, RouteName as Q, checkGrantChange as Qt, MessagesQuery as R, Access as Rt, INBOX_EVENT_ID_MAX as S, SyncReceiptBody as St, InboxItem as T, SyncedView as Tt, PrincipalInput as U, Grant as Ut, PostBody as V, ChannelPattern as Vt, PrincipalView as W, GrantChange as Wt, RegistrationView as X, Permission as Xt, RegisterInput as Y, PERMISSIONS as Yt, ResolvedSyncTarget as Z, WrittenCan as Zt, FiltersInput as _, SyncFindInput as _t, BoardEventView as a, Author as an, SchedulesQueryOutput as at, GrantInput as b, SyncImportBody as bt, CreateChannelBody as c, ExternalAuthor as cn, SchemaView as ct, EditBody as d, ExternalLink as dn, SourceMessage as dt, parseCan as en, ScheduleBodyOutput as et, EventsPage as f, Link as fn, SourceRead as ft, Explanation as g, SyncCopiesView as gt, ExplainQuery as h, SyncCopiesQuery as ht, BlockView as i, Attachment as in, SchedulesQueryInput as it, LinkView as j, TypingBody as jt, LABEL_CONDITIONS_MAX as k, ThreadsQuery as kt, DeleteBody as l, ExternalEvent as ln, SourceJoin as lt, EventsQueryInput as m, SyncBody as mt, ActorView as n, Actor as nn, ScheduleView as nt, CanAt as o, CAN_MAX as on, SchemaBody as ot, EventsQuery as p, SourceReadQuery as pt, Ref as q, InvalidCan as qt, ApiError as r, ExternalCopy as rn, SchedulesQuery as rt, ChannelView as s, Labels as sn, SchemaInput as st, AckBody as t, union as tn, ScheduleInput as tt, Discovery as u, ExternalFile as un, SourceJoinBody as ut, GrantBody as v, SyncFindQuery as vt, InboxEntry as w, SyncThreadView as wt, GrantView as x, SyncImportInput as xt, GrantCan as y, SyncFindView as yt, MessagesQueryInput as z, AccessSummary as zt };
@@ -1,10 +1,14 @@
1
1
  import { z } from "zod";
2
+ //#region src/contract/schemas.ts
3
+ const CHANNEL_PATH_MAX = 2048;
4
+ /** A grant's channel pattern: a path, or a path and its subtree (`ops/`). */
5
+ const CHANNEL_PATTERN_MAX = 2049;
2
6
  const MESSAGE_TEXT_MAX = 1e4;
3
7
  /** The longest `x-board-can` header the board reads; a schedule keeps its creator's. */
4
8
  const CAN_MAX = 4e3;
5
9
  const segment = "[a-z0-9][a-z0-9_-]*";
6
10
  /** `errors-www`, `www/production`: lowercase segments joined by `/`. */
7
- const ChannelPath = z.string().max(80).regex(new RegExp(`^${segment}(?:/${segment})*$`), "invalid channel path");
11
+ const ChannelPath = z.string().max(CHANNEL_PATH_MAX).regex(new RegExp(`^${segment}(?:/${segment})*$`), "invalid channel path");
8
12
  /**
9
13
  * No board string holds a NUL, which Postgres can't store, or a lone surrogate,
10
14
  * which no store keeps as it was: requests with one are refused, and sync
@@ -13,6 +17,8 @@ const ChannelPath = z.string().max(80).regex(new RegExp(`^${segment}(?:/${segmen
13
17
  const storable = (value) => !value.includes("\0") && value.isWellFormed();
14
18
  /** `value` as the board keeps it, for what comes in from a platform: without NUL, and a lone surrogate as U+FFFD. */
15
19
  const toStorable = (value) => value.replaceAll("\0", "").toWellFormed();
20
+ /** A message's text as a request sends it: its length is the backend's to judge. */
21
+ const SentText = z.string().refine((text) => text.trim().length > 0, "message text is empty").refine(storable, "message text has a NUL character or a lone surrogate");
16
22
  const MessageText = z.string().max(MESSAGE_TEXT_MAX).refine((text) => text.trim().length > 0, "message text is empty").refine(storable, "message text has a NUL character or a lone surrogate");
17
23
  /** A message is named by the log index of its `message.posted` event. */
18
24
  const MessageId = z.number().int().positive();
@@ -74,4 +80,4 @@ const Attachment = z.object({
74
80
  /** A registered watcher's ID: a profile name, since its writes are by that profile. */
75
81
  const RemoteWatcherId = z.string().regex(/^[A-Za-z][A-Za-z0-9-]{0,31}$/, "ids start with a letter and use up to 32 letters, numbers, and hyphens");
76
82
  //#endregion
77
- export { actorKind as _, CAN_MAX as a, storable as b, Handle as c, Labels as d, MESSAGE_TEXT_MAX as f, SeenActorKind as g, RemoteWatcherId as h, Author as i, LabelKey as l, MessageText as m, Attachment as n, ChannelPath as o, MessageId as p, AttachmentId as r, Emoji as s, ActorId as t, LabelValue as u, authorView as v, toStorable as x, platformAvatar as y };
83
+ export { toStorable as C, storable as S, SeenActorKind as _, CAN_MAX as a, authorView as b, Emoji as c, LabelValue as d, Labels as f, RemoteWatcherId as g, MessageText as h, Author as i, Handle as l, MessageId as m, Attachment as n, CHANNEL_PATTERN_MAX as o, MESSAGE_TEXT_MAX as p, AttachmentId as r, ChannelPath as s, ActorId as t, LabelKey as u, SentText as v, platformAvatar as x, actorKind as y };
@@ -1,7 +1,7 @@
1
- import { u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
- import { d as localTokenFile, t as board } from "./server-FlDE6BDt.mjs";
3
- import { t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
4
- import { t as local } from "./local-CnGNTReZ.mjs";
1
+ import { d as BoardError } from "./errors-ZazTZh-s.mjs";
2
+ import { d as localTokenFile, t as board } from "./server-Bmz0zqYM.mjs";
3
+ import { t as oidcTokens } from "./tokens-BErYXuHZ.mjs";
4
+ import { t as local } from "./local-DE9vmanM.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,9 +1,9 @@
1
- import { d as createBoardClient, p as formatProfileHeader, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
- import "./schemas-DAzSsgWk.mjs";
3
- import { F as routes } from "./routes-DrByOCc1.mjs";
4
- import { g as keyId, p as DERIVED_ID } from "./middleware-0DUFrav-.mjs";
5
- import { a as compileWatcher, c as METHODS } from "./origin-D4ER_Tze.mjs";
6
- import { c as tailWatchers, i as createVercel, l as deployedOnVercel, o as PROTOCOL_ROUTES, s as withoutToken, t as createBoard } from "./exports-BNk4w-b2.mjs";
1
+ import { d as BoardError, f as createBoardClient, h as formatProfileHeader, t as HttpError } from "./errors-ZazTZh-s.mjs";
2
+ import "./schemas-BhZaystC.mjs";
3
+ import { F as routes } from "./routes-CkUetTO2.mjs";
4
+ import { g as keyId, p as DERIVED_ID } from "./middleware-BHHKHA9q.mjs";
5
+ import { a as compileWatcher, c as METHODS } from "./origin-BbwhnKrg.mjs";
6
+ import { c as tailWatchers, i as createVercel, l as deployedOnVercel, o as PROTOCOL_ROUTES, s as withoutToken, t as createBoard } from "./exports-DCxecX15.mjs";
7
7
  import { execFile } from "node:child_process";
8
8
  import { createHash } from "node:crypto";
9
9
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -989,8 +989,8 @@ function vercel(options = {}) {
989
989
  function board(options = {}) {
990
990
  return createBoard(options, {
991
991
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
992
- sync: () => import("./engine-D07DTYSi.mjs"),
993
- serving: () => import("./serving-hcxzaCCO.mjs"),
992
+ sync: () => import("./engine-XVBt02Bl.mjs"),
993
+ serving: () => import("./serving-BLVRrJ7P.mjs"),
994
994
  sandbox: (url, token) => sandboxHeaders(url, url, token)
995
995
  });
996
996
  }
@@ -1,2 +1,2 @@
1
- import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
1
+ import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-BErYXuHZ.mjs";
2
2
  export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
@@ -1,5 +1,5 @@
1
- import { _ as actorKind } from "./schemas-DAzSsgWk.mjs";
2
- import { c as externalMessageKey, l as isThreadTarget } from "./external-DymyhUzl.mjs";
1
+ import { y as actorKind } from "./schemas-BhZaystC.mjs";
2
+ import { c as externalMessageKey, l as isThreadTarget } from "./external-DfhN7lKK.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
  import { i as mentionTerms } from "./mentions-DfZGp3B-.mjs";
@@ -1,6 +1,6 @@
1
- import { r as sqlTables } from "./sql-P9g-rLIF.mjs";
1
+ import { r as sqlTables } from "./sql-CyVcjw8x.mjs";
2
2
  import { t as sqlite$1 } from "./store-sqlite-D6fIszST.mjs";
3
- import { t as sqliteDb } from "./sqlite-db-D0Fyju-4.mjs";
3
+ import { t as sqliteDb } from "./sqlite-db-BdzxtUOV.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-P9g-rLIF.mjs";
1
+ import { n as ddl } from "./sql-CyVcjw8x.mjs";
2
2
  import { mkdirSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  //#region src/store/sqlite-db.ts
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-CVI-DlWl.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-HQo68RWL.mjs";
1
+ import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-BC9mPYVh.mjs";
2
+ import { r as ChatTransport, t as ChatInput } from "./chat-provider-V2jnjVLq.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 { i as eventSchema, p as channels, r as envelope } from "./events-voButVQW.mjs";
2
- import { t as ChatSyncProvider } from "./chat-provider-DZ4DsAZ7.mjs";
1
+ import { i as eventSchema, p as channels, r as envelope } from "./events-D17RndlV.mjs";
2
+ import { t as ChatSyncProvider } from "./chat-provider-BvNqOQFL.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  //#region src/sync/chat-sdk.ts
5
5
  const schemaOf = (platform) => eventSchema(platform, "message");
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-CVI-DlWl.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-HQo68RWL.mjs";
1
+ import { _ as SyncFn, b as SyncUnit, p as SyncContext } from "./provider-BC9mPYVh.mjs";
2
+ import { n as ChatSyncProvider } from "./chat-provider-V2jnjVLq.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 { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-voButVQW.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-DZ4DsAZ7.mjs";
1
+ import { _ as withRoutes, i as eventSchema, m as into, r as envelope } from "./events-D17RndlV.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-BvNqOQFL.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 { ft as SourceRead } from "./routes-CErTwlSZ.mjs";
2
- import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-CVI-DlWl.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-HQo68RWL.mjs";
1
+ import { ft as SourceRead } from "./routes-zm4TXKCC.mjs";
2
+ import { _ as SyncFn, b as SyncUnit, f as ResolvedTarget, l as ReceivedEvent, o as ProviderPost, p as SyncContext, r as ProviderDelivery } from "./provider-BC9mPYVh.mjs";
3
+ import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-V2jnjVLq.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 { i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-voButVQW.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-DZ4DsAZ7.mjs";
1
+ import { i as eventSchema, l as UnreadableError, p as channels, r as envelope } from "./events-D17RndlV.mjs";
2
+ import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-BvNqOQFL.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";