@vercel/board 0.43.1 → 0.44.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 (62) hide show
  1. package/dist/access.d.mts +2 -2
  2. package/dist/{auth-Bn8J_1F2.d.mts → auth-C8jxty0C.d.mts} +1 -1
  3. package/dist/{backend-DMrK55mU.d.mts → backend-_3W_5g6y.d.mts} +3 -3
  4. package/dist/backend-local.d.mts +1 -1
  5. package/dist/backend-local.mjs +1 -1
  6. package/dist/{bots-CGkO76qH.mjs → bots-CLKKMgYf.mjs} +6 -1
  7. package/dist/{chat-provider-CPZg2MQb.mjs → chat-provider-DZ4DsAZ7.mjs} +6 -4
  8. package/dist/{chat-provider-Cgkh9xJw.d.mts → chat-provider-HQo68RWL.d.mts} +4 -4
  9. package/dist/cli-commands.d.mts +1 -1
  10. package/dist/cli-commands.mjs +1 -1
  11. package/dist/cli-embedded.d.mts +2 -2
  12. package/dist/cli-embedded.mjs +2 -2
  13. package/dist/cli.mjs +6 -6
  14. package/dist/{commands-C4fR0md0.mjs → commands-B75pBXIV.mjs} +1 -1
  15. package/dist/{commands-BlM-ckFS.d.mts → commands-DHGZWeSZ.d.mts} +1 -1
  16. package/dist/{conformance-BORt5nky.mjs → conformance-CHqXZoGe.mjs} +66 -0
  17. package/dist/conformance.d.mts +1 -1
  18. package/dist/conformance.mjs +1 -1
  19. package/dist/{data-values-C-Cq80hz.mjs → data-values-CoTP0SQG.mjs} +43 -54
  20. package/dist/{engine-BVHSH2Kn.mjs → engine-D07DTYSi.mjs} +16 -9
  21. package/dist/{events-BT8y_81j.mjs → events-voButVQW.mjs} +3 -1
  22. package/dist/{exports-BVgUNVsP.mjs → exports-BNk4w-b2.mjs} +3 -2
  23. package/dist/exports-DFwXKst5.d.mts +4 -0
  24. package/dist/{index-CydxnBND.d.mts → index-CwOOIT0e.d.mts} +2 -2
  25. package/dist/index.d.mts +6 -6
  26. package/dist/index.mjs +2 -2
  27. package/dist/index.node.d.mts +6 -6
  28. package/dist/index.node.mjs +1 -1
  29. package/dist/inspect/app.js +29 -29
  30. package/dist/inspect/engine.js +5 -5
  31. package/dist/inspect-DBLdh9NM.mjs +2 -0
  32. package/dist/{inspect-ZGkTJl3f.mjs → inspect-dtQlHBcq.mjs} +1 -1
  33. package/dist/{local-yB2DFcRi.mjs → local-CnGNTReZ.mjs} +3 -1
  34. package/dist/{main-DjEJPCgo.mjs → main-CpsAmpEy.mjs} +22 -7
  35. package/dist/origin-D4ER_Tze.mjs +428 -0
  36. package/dist/{provider-dY54GFNz.d.mts → provider-CVI-DlWl.d.mts} +27 -2
  37. package/dist/{routes-By9lmvUD.d.mts → routes-CErTwlSZ.d.mts} +3 -1
  38. package/dist/{origin-9Ch-Zonv.mjs → routes-DrByOCc1.mjs} +4 -426
  39. package/dist/schemas.mjs +1 -1
  40. package/dist/{serve-Cnb4TpaJ.mjs → serve-BQT5quKD.mjs} +2 -2
  41. package/dist/{server-BHpUqip5.mjs → server-FlDE6BDt.mjs} +4 -3
  42. package/dist/sync-chat-sdk.d.mts +2 -2
  43. package/dist/sync-chat-sdk.mjs +2 -2
  44. package/dist/sync-github.d.mts +2 -2
  45. package/dist/sync-github.mjs +2 -2
  46. package/dist/sync-linear.d.mts +3 -3
  47. package/dist/sync-linear.mjs +3 -3
  48. package/dist/sync-slack.d.mts +27 -4
  49. package/dist/sync-slack.mjs +206 -10
  50. package/dist/sync.d.mts +3 -3
  51. package/dist/sync.mjs +1 -1
  52. package/docs/02-sync/02-functions.md +4 -1
  53. package/docs/02-sync/03-slack.md +24 -1
  54. package/docs/02-sync/04-github.md +5 -2
  55. package/docs/02-sync/06-providers.md +1 -1
  56. package/docs/04-reference/01-cli.md +1 -1
  57. package/docs/04-reference/02-board.md +1 -1
  58. package/docs/04-reference/03-http.md +6 -0
  59. package/docs/04-reference/05-conformance.md +1 -1
  60. package/package.json +3 -1
  61. package/dist/exports-Bw_OYNRl.d.mts +0 -4
  62. package/dist/inspect-DRPRCOaV.mjs +0 -2
@@ -1,4 +1,4 @@
1
- import { C as InboxEntry, Ct as SyncThreadView, Dt as ThreadsPage, Et as ThreadView, F as MessageView, I as MessagesPage, J as RegisterInput, M as MatchView, Nt as UpdateGrantInput, P as Me, R as MessagesQueryInput, St as SyncReceiptInput, Y as RegistrationView, _ as FiltersInput, a as BoardEventView, b as GrantInput, bt as SyncImportInput, cn as ExternalFile, ct as SourceJoin, dt as SourceRead, en as Actor, f as EventsPage, g as Explanation, gt as SyncFindInput, kt as ThreadsQueryInput, ln as ExternalLink, n as ActorView, nn as Attachment, on as ExternalAuthor, ot as SchemaInput, rt as SchedulesQueryInput, s as ChannelView, sn as ExternalEvent, st as SchemaView, tn as ExternalCopy, tt as ScheduleView, u as Discovery, un as Link, vt as SyncFindView, w as InboxItem, wt as SyncedView, x as GrantView } from "./routes-By9lmvUD.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 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";
2
2
  import { z } from "zod";
3
3
  //#region src/client/client.d.ts
4
4
  /**
@@ -368,6 +368,25 @@ declare function createBoardClient(options: ClientOptions): {
368
368
  }, opts?: WaitOptions): Promise<BoardEventView | null>;
369
369
  };
370
370
  //#endregion
371
+ //#region src/contract/bots.d.ts
372
+ /**
373
+ * Known bot messages, shown in a form people can read. The board keeps what the
374
+ * bot wrote (`--json` and the API return it as is); `displayText` is what a
375
+ * person sees in `vb read`, inspect, and the copies on other platforms.
376
+ */
377
+ type VercelDeployment = {
378
+ project: string;
379
+ projectUrl: string | null;
380
+ status: string;
381
+ deploymentUrl: string | null;
382
+ previewUrl: string | null;
383
+ /** As Vercel wrote it, e.g. `Oct 6, 2026 8:30pm UTC`. */
384
+ updated: string | null;
385
+ /** The same as a time, e.g. `2026-10-06T20:30:32.400Z`, when Vercel's comment carries one. */
386
+ updatedAt: string | null;
387
+ skipped: boolean;
388
+ };
389
+ //#endregion
371
390
  //#region src/sync/events.d.ts
372
391
  declare const EventBase: z.ZodObject<{
373
392
  channel: z.ZodString;
@@ -826,10 +845,16 @@ type ProviderSender = {
826
845
  avatar: string | null;
827
846
  attribution?: string;
828
847
  };
848
+ /**
849
+ * What a platform is asked to post or edit: markdown, which it converts to its own format.
850
+ * `deployments` comes with Vercel's deployment comment, whose markdown lists them a line each,
851
+ * for a platform that lays them out itself (Slack's table).
852
+ */
829
853
  type ProviderPost = {
830
854
  markdown: string;
831
855
  files?: ProviderFile[];
832
856
  as?: ProviderSender;
857
+ deployments?: VercelDeployment[];
833
858
  };
834
859
  type ProviderDelivery = {
835
860
  thread: string;
@@ -1034,4 +1059,4 @@ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
1034
1059
  render(input: RenderInput): string;
1035
1060
  }
1036
1061
  //#endregion
1037
- export { SyncRoot as A, ScheduleOptions as B, mirror as C, RootOverride as D, ProviderEvent as E, ErrorOrigin as F, UploadInput as H, Filters as I, PostOptions as L, eventSchema as M, BoardClient as N, SyncOverrides as O, BoardError as P, ProfileOption as R, into as S, EventBase as T, WaitOptions as U, ScheduleTiming as V, duration 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, ReplyOptions as z };
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 };
@@ -1206,6 +1206,8 @@ declare const SyncCopiesQuery: z.ZodObject<{
1206
1206
  message: z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodString>>;
1207
1207
  }, z.core.$strip>;
1208
1208
  /** Platform events for a sync key's inbox, each with the platform's own ID for it, which dedupes it. */
1209
+ /** The longest inbox event ID a board takes: Vercel's API refuses a longer one. */
1210
+ declare const INBOX_EVENT_ID_MAX = 300;
1209
1211
  declare const InboxPushBody: z.ZodObject<{
1210
1212
  events: z.ZodArray<z.ZodObject<{
1211
1213
  id: z.ZodString;
@@ -2670,4 +2672,4 @@ declare const routes: {
2670
2672
  };
2671
2673
  type RouteName = keyof typeof routes;
2672
2674
  //#endregion
2673
- export { ScheduleBodyOutput as $, union as $t, LinkView as A, TypingBody as At, PostBody as B, ChannelPattern as Bt, InboxEntry as C, SyncThreadView as Ct, InboxQuery as D, ThreadsPage as Dt, InboxPushBody as E, ThreadView as Et, MessageView as F, UploadTicket as Ft, ReactBody as G, GrantShape as Gt, PrincipalInput as H, Grant as Ht, MessagesPage as I, routes as It, RegisterInput as J, Permission as Jt, Ref as K, InvalidCan as Kt, MessagesQuery as L, Access as Lt, MatchView as M, UpdateGrantBody as Mt, MatchesQuery as N, UpdateGrantInput as Nt, LABEL_CONDITIONS_MAX as O, ThreadsQuery as Ot, Me as P, UploadStartBody as Pt, ScheduleBody as Q, parseCan as Qt, MessagesQueryInput as R, AccessSummary as Rt, InboxAckBody as S, SyncReceiptInput as St, InboxNextQuery as T, ThreadSummaryView as Tt, PrincipalView as U, GrantChange as Ut, PostInput as V, FULL_ACCESS as Vt, REGISTERED_WATCHERS_MAX as W, GrantChangeRefusal as Wt, ResolvedSyncTarget as X, checkGrantChange as Xt, RegistrationView as Y, WrittenCan as Yt, RouteName as Z, compileAccess as Zt, FiltersInput as _, SyncFindQuery as _t, BoardEventView as a, Labels as an, SchemaBody as at, GrantInput as b, SyncImportInput as bt, CreateChannelBody as c, ExternalFile as cn, SourceJoin as ct, EditBody as d, SourceRead as dt, Actor as en, ScheduleInput as et, EventsPage as f, SourceReadQuery as ft, Explanation as g, SyncFindInput as gt, ExplainQuery as h, SyncCopiesView as ht, BlockView as i, CAN_MAX as in, SchedulesQueryOutput as it, LinkedQuery as j, TypingResult as jt, LabelBody as k, ThreadsQueryInput as kt, DeleteBody as l, ExternalLink as ln, SourceJoinBody as lt, EventsQueryInput as m, SyncCopiesQuery as mt, ActorView as n, Attachment as nn, SchedulesQuery as nt, CanAt as o, ExternalAuthor as on, SchemaInput as ot, EventsQuery as p, SyncBody as pt, RegisterBody as q, Level as qt, ApiError as r, Author as rn, SchedulesQueryInput as rt, ChannelView as s, ExternalEvent as sn, SchemaView as st, AckBody as t, ExternalCopy as tn, ScheduleView as tt, Discovery as u, Link as un, SourceMessage as ut, GrantBody as v, SyncFindView as vt, InboxItem as w, SyncedView as wt, GrantView as x, SyncReceiptBody as xt, GrantCan as y, SyncImportBody as yt, ParsedFilters as z, Can as zt };
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 };
@@ -1,9 +1,7 @@
1
- import { g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-DUzpDSrJ.mjs";
1
+ import { g as DIRECT_UPLOAD_BYTES_MAX } from "./errors-DUzpDSrJ.mjs";
2
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, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DymyhUzl.mjs";
3
+ import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DymyhUzl.mjs";
4
4
  import { a as SCHEMA_DESCRIPTION_MAX, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX } from "./blocks-CVoBC7ur.mjs";
5
- import { i as afterRetry } from "./middleware-0DUFrav-.mjs";
6
- import { o as options } from "./commands-C4fR0md0.mjs";
7
5
  import { z } from "zod";
8
6
  //#region src/api/routes.ts
9
7
  /**
@@ -428,7 +426,6 @@ const SyncFindQuery = z.object({
428
426
  message: z.string().min(1).max(300).optional()
429
427
  });
430
428
  const SyncCopiesQuery = z.object({ message: repeated.pipe(z.array(Ref).min(1).max(100)) });
431
- /** Platform events for a sync key's inbox, each with the platform's own ID for it, which dedupes it. */
432
429
  const InboxPushBody = z.object({ events: z.array(z.object({
433
430
  id: z.string().min(1).max(300),
434
431
  event: ExternalEvent,
@@ -455,7 +452,7 @@ const EditBody = z.object({
455
452
  });
456
453
  const DeleteBody = z.object({ revision: Revision.optional() }).optional();
457
454
  /** `status`: what Slack shows in place of "Typing…" (other platforms ignore it). */
458
- const TypingBody = z.object({ status: z.string().trim().min(1).max(100).optional() }).optional();
455
+ const TypingBody = z.object({ status: z.string().trim().min(1).max(50).optional() }).optional();
459
456
  const ReactBody = z.object({
460
457
  emoji: Emoji,
461
458
  remove: z.boolean().optional()
@@ -756,423 +753,4 @@ const routes = {
756
753
  }
757
754
  };
758
755
  //#endregion
759
- //#region src/version.ts
760
- const VERSION = "0.43.1";
761
- //#endregion
762
- //#region src/server/backend.ts
763
- /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
764
- const SYNC = "@sync";
765
- //#endregion
766
- //#region src/server/routing.ts
767
- /** board()'s own routes: the files it serves, and sync's, which run where board() does. */
768
- const BOARD_ROUTES = [
769
- "avatar",
770
- "openapi",
771
- "webhook",
772
- "sync"
773
- ];
774
- /** Every protocol method, by the route it's served at. */
775
- const METHODS = [
776
- "discovery",
777
- "me",
778
- "channels",
779
- "createChannel",
780
- "actors",
781
- "messages",
782
- "threads",
783
- "message",
784
- "post",
785
- "posted",
786
- "edit",
787
- "delete",
788
- "react",
789
- "label",
790
- "schedule",
791
- "schedules",
792
- "cancelSchedule",
793
- "grants",
794
- "createGrant",
795
- "updateGrant",
796
- "explain",
797
- "revokeGrant",
798
- "schemas",
799
- "schema",
800
- "createSchema",
801
- "upload",
802
- "attachment",
803
- "uploadStart",
804
- "uploadFinish",
805
- "watchers",
806
- "register",
807
- "matches",
808
- "ack",
809
- "events",
810
- "syncImport",
811
- "syncReceipt",
812
- "syncThread",
813
- "syncFind",
814
- "syncCopies",
815
- "inboxPush",
816
- "inboxNext",
817
- "inboxAck",
818
- "inbox",
819
- "typing",
820
- "readSource",
821
- "joinSource",
822
- "synced",
823
- "linked"
824
- ];
825
- const escape = (literal) => literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
826
- function compile(method, path, target, own) {
827
- const parts = path.split("/").filter(Boolean);
828
- const source = parts.map((part) => part.startsWith(":") ? "/([^/]+)" : `/${escape(part)}`).join("");
829
- return {
830
- method,
831
- pattern: new RegExp(`${source}$`),
832
- names: parts.filter((part) => part.startsWith(":")).map((part) => part.slice(1)),
833
- target,
834
- segments: parts.length,
835
- literals: parts.filter((part) => !part.startsWith(":")).length,
836
- own
837
- };
838
- }
839
- /**
840
- * The routes a board answers, most specific first: each is matched as a suffix of the request's
841
- * path, so `/api/board/messages/12` is `GET /messages/:id` under `/api/board`. A backend's own
842
- * route at a protocol path takes its place. Discovery is the mount itself.
843
- */
844
- function createRouter(backendRoutes, basePath) {
845
- const patterns = [
846
- ...BOARD_ROUTES.map((name) => compile(routes[name].method, routes[name].path, {
847
- kind: "board",
848
- name
849
- }, false)),
850
- ...METHODS.filter((name) => name !== "discovery").map((name) => compile(routes[name].method, routes[name].path, {
851
- kind: "protocol",
852
- name
853
- }, false)),
854
- ...backendRoutes.map((route) => compile(route.method, route.path, {
855
- kind: "backend",
856
- route
857
- }, true))
858
- ].sort((a, b) => b.segments - a.segments || b.literals - a.literals || Number(b.own) - Number(a.own));
859
- /** A segment that isn't URI-encoded names nothing: no route. */
860
- const found = (candidate, base, values) => {
861
- const params = {};
862
- try {
863
- candidate.names.forEach((name, i) => params[name] = decodeURIComponent(values[i]));
864
- } catch {
865
- return null;
866
- }
867
- const first = candidate.names[0];
868
- return {
869
- target: candidate.target,
870
- base,
871
- param: first === void 0 ? null : params[first],
872
- params
873
- };
874
- };
875
- const discovery = (base) => ({
876
- target: {
877
- kind: "protocol",
878
- name: "discovery"
879
- },
880
- base,
881
- param: null,
882
- params: {},
883
- root: true
884
- });
885
- return function route(method, pathname) {
886
- const path = pathname.length > 1 ? pathname.replace(/\/+$/, "") : pathname;
887
- if (basePath !== void 0) {
888
- const base = basePath.replace(/\/+$/, "");
889
- if (path !== base && !path.startsWith(`${base}/`)) return null;
890
- const rest = path.slice(base.length) || "/";
891
- if (rest === "/") return method === "GET" ? discovery(base) : null;
892
- for (const candidate of patterns) {
893
- const hit = candidate.method === method ? rest.match(new RegExp(`^${candidate.pattern.source}`)) : null;
894
- if (hit) return found(candidate, base, hit.slice(1));
895
- }
896
- return null;
897
- }
898
- for (const candidate of patterns) {
899
- if (candidate.method !== method) continue;
900
- const hit = path.match(candidate.pattern);
901
- if (hit) return found(candidate, path.slice(0, hit.index), hit.slice(1));
902
- }
903
- return method === "GET" ? discovery(path === "/" ? "" : path) : null;
904
- };
905
- }
906
- function queryObject(url) {
907
- const out = {};
908
- for (const key of new Set(url.searchParams.keys())) {
909
- const values = url.searchParams.getAll(key);
910
- out[key] = values.length > 1 ? values : values[0];
911
- }
912
- return out;
913
- }
914
- async function readJson(request) {
915
- const text = await request.text();
916
- if (text.trim() === "") return void 0;
917
- try {
918
- return JSON.parse(text);
919
- } catch {
920
- throw badRequest("request body is not valid JSON");
921
- }
922
- }
923
- const tooLarge = () => new HttpError(413, "too_large", `attachments are at most ${ATTACHMENT_BYTES_MAX / 1024 / 1024} MB`);
924
- /** The body, refused as soon as it's past `max`: with or without a `content-length`, it never reads more. */
925
- async function readCapped(request, max) {
926
- if (Number(request.headers.get("content-length") ?? 0) > max) throw tooLarge();
927
- const chunks = [];
928
- let size = 0;
929
- for await (const chunk of request.body ?? []) {
930
- size += chunk.byteLength;
931
- if (size > max) throw tooLarge();
932
- chunks.push(chunk);
933
- }
934
- const body = new Uint8Array(size);
935
- let at = 0;
936
- for (const chunk of chunks) {
937
- body.set(chunk, at);
938
- at += chunk.byteLength;
939
- }
940
- return body;
941
- }
942
- function openapi() {
943
- const paths = {};
944
- for (const [name, definition] of Object.entries(routes)) {
945
- const path = definition.path.replace(/:(\w+)/g, "{$1}");
946
- const operation = { operationId: name };
947
- if ("query" in definition) operation["x-query-schema"] = z.toJSONSchema(definition.query, { io: "input" });
948
- if ("body" in definition) operation.requestBody = { content: { "application/json": { schema: z.toJSONSchema(definition.body, { io: "input" }) } } };
949
- (paths[path] ??= {})[definition.method.toLowerCase()] = operation;
950
- }
951
- return {
952
- openapi: "3.1.0",
953
- info: {
954
- title: "board",
955
- version: VERSION
956
- },
957
- paths
958
- };
959
- }
960
- //#endregion
961
- //#region src/api/tail.ts
962
- /** The filter flags `read`, `tail`, and `wait` share, and that a watcher's `tail` accepts. */
963
- const FILTER_FLAGS = {
964
- re: options.re,
965
- by: options.by,
966
- mentions: options.mentions,
967
- label: options.label,
968
- source: options.source,
969
- text: options.text
970
- };
971
- /**
972
- * What `--mentions` takes as its value when it's the next word: `@ada`, `ada@vercel.com`, or `me`.
973
- * A channel never has an `@`, and a flag (`--text=a@b`) is never the value.
974
- */
975
- const mentionValue = (word) => word !== void 0 && !word.startsWith("-") && (word === "me" || word.includes("@"));
976
- /**
977
- * `--mentions` alone means mentions of me; `--mentions @ada`, mentions of ada; `--mentions
978
- * ada@vercel.com`, of the user with that email. Nothing after `--` is a flag.
979
- */
980
- function withMentions(args) {
981
- const out = [];
982
- for (let i = 0; i < args.length; i++) {
983
- const arg = args[i];
984
- if (arg === "--") {
985
- out.push(...args.slice(i));
986
- break;
987
- }
988
- if (arg !== "--mentions") out.push(arg);
989
- else if (mentionValue(args[i + 1])) out.push(`--mentions=${args[++i]}`);
990
- else out.push("--mentions=me");
991
- }
992
- return out;
993
- }
994
- /** Splits an expression the way a shell would: whitespace separates, quotes group, `\` escapes. */
995
- function words(expression) {
996
- const out = [];
997
- let word = null;
998
- let quote = null;
999
- for (let i = 0; i < expression.length; i++) {
1000
- const char = expression[i];
1001
- if (quote) {
1002
- if (char === quote) quote = null;
1003
- else if (char === "\\" && quote === "\"" && i + 1 < expression.length) word += expression[++i];
1004
- else word += char;
1005
- } else if (/\s/.test(char)) {
1006
- if (word !== null) out.push(word);
1007
- word = null;
1008
- } else if (char === "\"" || char === "'") {
1009
- quote = char;
1010
- word ??= "";
1011
- } else if (char === "\\" && i + 1 < expression.length) word = (word ?? "") + expression[++i];
1012
- else word = (word ?? "") + char;
1013
- }
1014
- if (quote) throw new Error(`unterminated ${quote}`);
1015
- if (word !== null) out.push(word);
1016
- return out;
1017
- }
1018
- /** A watcher's tail takes the filters and `--all`, which shows receipts as it does in `vb tail`. */
1019
- const TAIL_FLAGS = {
1020
- ...FILTER_FLAGS,
1021
- all: { type: "boolean" }
1022
- };
1023
- /**
1024
- * Parses filter flags as the CLI's parser does (Node's `parseArgs`, strict), written out so a tail
1025
- * parses wherever board() runs, a browser included.
1026
- */
1027
- function parseFilterFlags(args) {
1028
- const values = {};
1029
- const positionals = [];
1030
- for (let i = 0; i < args.length; i++) {
1031
- const arg = args[i];
1032
- if (arg === "--") {
1033
- positionals.push(...args.slice(i + 1));
1034
- break;
1035
- }
1036
- if (!arg.startsWith("-") || arg === "-") {
1037
- positionals.push(arg);
1038
- continue;
1039
- }
1040
- const eq = arg.indexOf("=");
1041
- const name = arg.startsWith("--") ? arg.slice(2, eq === -1 ? void 0 : eq) : null;
1042
- const spec = name !== null && Object.hasOwn(TAIL_FLAGS, name) ? TAIL_FLAGS[name] : null;
1043
- if (!spec) throw new Error(`${name !== null ? `--${name}` : arg.slice(0, 2)} isn't a filter`);
1044
- if (spec.type === "boolean") {
1045
- if (eq !== -1) throw new Error(`--${name} takes no value`);
1046
- values[name] = true;
1047
- continue;
1048
- }
1049
- let value;
1050
- if (eq !== -1) value = arg.slice(eq + 1);
1051
- else {
1052
- const next = args[i + 1];
1053
- if (next === void 0 || next.length > 1 && next.startsWith("-")) throw new Error(`--${name} needs a value`);
1054
- value = next;
1055
- i++;
1056
- }
1057
- if ("multiple" in spec) values[name] = [...values[name] ?? [], value];
1058
- else values[name] = value;
1059
- }
1060
- return {
1061
- values,
1062
- positionals
1063
- };
1064
- }
1065
- /** A watcher's `tail`: its filters, and whether `--all` shows it receipts too. */
1066
- function parseWatchTail(expression) {
1067
- const { values, positionals } = parseFilterFlags(withMentions(words(expression)));
1068
- if (positionals.length > 1) throw new Error(`expected one channel, got: ${positionals.join(" ")}`);
1069
- const channel = positionals[0];
1070
- const parsed = Filters.safeParse({
1071
- ...channel ? { channel } : {},
1072
- ...values.re ? { re: values.re.replace(/^#/, "") } : {},
1073
- ...values.by ? { by: values.by.replace(/^@/, "") } : {},
1074
- ...values.mentions ? { mentions: values.mentions.replace(/^@/, "") } : {},
1075
- ...values.label?.length ? { label: values.label } : {},
1076
- ...values.source ? { from: values.source } : {},
1077
- ...values.text ? { text: values.text } : {}
1078
- });
1079
- if (!parsed.success) {
1080
- const issue = parsed.error.issues[0];
1081
- throw new Error(`${issue?.path.length ? `--${String(issue.path[0])}: ` : ""}${issue?.message ?? "invalid filters"}`);
1082
- }
1083
- return {
1084
- filters: parsed.data,
1085
- all: values.all === true
1086
- };
1087
- }
1088
- //#endregion
1089
- //#region src/server/watch-spec.ts
1090
- /** Whether filters narrow anything: a view a message can enter. */
1091
- const hasCriteria = (filters) => filters.channel !== void 0 || filters.re !== void 0 || filters.by !== void 0 || filters.mentions !== void 0 || filters.from !== void 0 || filters.text !== void 0 || (filters.label?.length ?? 0) > 0;
1092
- /** A watcher's tail, checked the way a boot checks it: errors name the watcher. */
1093
- function compileWatcher(id, spec) {
1094
- let filters;
1095
- let all;
1096
- try {
1097
- ({filters, all} = parseWatchTail(spec.tail));
1098
- } catch (error) {
1099
- throw new Error(`watch ${id}: ${error.message}`);
1100
- }
1101
- if (filters.mentions === "me") throw new Error(`watch ${id}: a watcher has no "me": use --mentions @handle`);
1102
- return {
1103
- filters,
1104
- criteria: hasCriteria(filters),
1105
- all
1106
- };
1107
- }
1108
- //#endregion
1109
- //#region src/server/watch-run.ts
1110
- /**
1111
- * A2 dead-letters an event after 10 failures, and a dead letter stops its
1112
- * lane, which is the thread's: the watcher would never run on that thread
1113
- * again. So `run` gets a few tries, then the failure is recorded and the
1114
- * thread moves on.
1115
- */
1116
- const RUN_ATTEMPTS = 5;
1117
- /**
1118
- * A run that's killed (a timeout, out of memory) never throws. A2 counts it
1119
- * toward the 10 failures when the next attempt takes over, and dead-letters
1120
- * the event at that takeover instead of running it: the 10th attempt is the
1121
- * last one a watcher sees. Throws give up at RUN_ATTEMPTS, so getting this far
1122
- * means runs keep dying, and the 10th records the failure without running.
1123
- */
1124
- const KILLED_ATTEMPTS = 10;
1125
- const describe = (error) => ((error instanceof Error ? error.message : String(error)) || "unknown error").slice(0, 500);
1126
- /**
1127
- * One match, on its thread's lane: `run`, retried while it fails (by A2 on a local board, by the
1128
- * tail on a person's Vercel board), then given up on and recorded so the thread's next event runs.
1129
- */
1130
- async function runMatch(input) {
1131
- const { watcher, match, attempt } = input;
1132
- const event = match.payload.event;
1133
- const giveUp = async (error) => {
1134
- console.error(`[board] watcher ${watcher.id} gave up on event #${event.cursor} after ${attempt} tries:`, error);
1135
- await input.record({
1136
- matched: match.id,
1137
- thread: match.payload.thread,
1138
- error
1139
- });
1140
- };
1141
- const early = !afterRetry(attempt);
1142
- if (early && attempt >= KILLED_ATTEMPTS) return giveUp(`its run was cut short ${attempt - 1} times (a timeout, or out of memory)`);
1143
- try {
1144
- await watcher.run(event);
1145
- } catch (error) {
1146
- if (!early || attempt < RUN_ATTEMPTS) throw error;
1147
- await giveUp(describe(error));
1148
- }
1149
- }
1150
- //#endregion
1151
- //#region src/server/watchers-hash.ts
1152
- /** By UTF-16 code unit, as `sort()` orders strings: the same in every locale and runtime. */
1153
- const byCodeUnit = (a, b) => a < b ? -1 : a > b ? 1 : 0;
1154
- /**
1155
- * What `watchersHash` hashes, the same on both ends: a board on `http()` hashes its watchers, and
1156
- * whether its sync subscribes, and the board it uses hashes what it holds.
1157
- */
1158
- function canonicalWatchers(watch, sync = []) {
1159
- const canonical = Object.keys(watch).sort(byCodeUnit).map((id) => [id, watch[id].tail]);
1160
- if (sync.length > 0) canonical.push(["sync", [...sync].sort((a, b) => byCodeUnit(a.key, b.key)).map((entry) => [entry.key, entry.platform])]);
1161
- return JSON.stringify(canonical);
1162
- }
1163
- //#endregion
1164
- //#region src/server/targets.ts
1165
- /** A target as a post or a receipt names it, resolved: a plain one's kind goes by its shape. */
1166
- const syncTarget = (target) => typeof target === "string" ? {
1167
- target,
1168
- kind: isThreadTarget(target) ? "thread" : "channel"
1169
- } : target;
1170
- //#endregion
1171
- //#region src/server/origin.ts
1172
- /**
1173
- * Sync in board() itself, on a board whose log is in this deployment (`local()`): it checked each
1174
- * platform event itself, so what it imports is by the platform user, not a profile of anyone.
1175
- */
1176
- const SYNC_ACTOR = "board:sync";
1177
- //#endregion
1178
- export { MessagesQuery as A, SyncBody as B, InboxAckBody as C, LabelBody as D, InboxQuery as E, ScheduleBody as F, ThreadsQuery as G, SyncFindQuery as H, SchedulesQuery as I, UploadStartBody as J, TypingBody as K, SchemaBody as L, ReactBody as M, Ref as N, LinkedQuery as O, RegisterBody as P, SourceJoinBody as R, GrantBody as S, InboxPushBody as T, SyncImportBody as U, SyncCopiesQuery as V, SyncReceiptBody as W, routes as Y, CreateChannelBody as _, compileWatcher as a, EventsQuery as b, METHODS as c, queryObject as d, readCapped as f, AckBody as g, VERSION as h, runMatch as i, PostBody as j, MatchesQuery as k, createRouter as l, SYNC as m, syncTarget as n, hasCriteria as o, readJson as p, UpdateGrantBody as q, canonicalWatchers as r, withMentions as s, SYNC_ACTOR as t, openapi as u, DeleteBody as v, InboxNextQuery as w, ExplainQuery as x, EditBody as y, SourceReadQuery as z };
756
+ export { SyncReceiptBody as A, SchemaBody as C, SyncCopiesQuery as D, SyncBody as E, routes as F, TypingBody as M, UpdateGrantBody as N, SyncFindQuery as O, UploadStartBody as P, SchedulesQuery as S, SourceReadQuery as T, PostBody as _, EventsQuery as a, RegisterBody as b, GrantBody as c, InboxPushBody as d, InboxQuery as f, MessagesQuery as g, MatchesQuery as h, EditBody as i, ThreadsQuery as j, SyncImportBody as k, InboxAckBody as l, LinkedQuery as m, CreateChannelBody as n, ExplainQuery as o, LabelBody as p, DeleteBody as r, Filters as s, AckBody as t, InboxNextQuery as u, ReactBody as v, SourceJoinBody as w, ScheduleBody as x, Ref as y };
package/dist/schemas.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { c as canonical, d as parseSchemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
2
- import { t as checkValue } from "./data-values-C-Cq80hz.mjs";
2
+ import { t as checkValue } from "./data-values-CoTP0SQG.mjs";
3
3
  export { BUILT_IN_SCHEMAS, block, canonical, checkDefinition, checkValue, findBlocks, parseSchemaId };
@@ -1,7 +1,7 @@
1
1
  import { u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
- import { d as localTokenFile, t as board } from "./server-BHpUqip5.mjs";
2
+ import { d as localTokenFile, t as board } from "./server-FlDE6BDt.mjs";
3
3
  import { t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
4
- import { t as local } from "./local-yB2DFcRi.mjs";
4
+ import { t as local } from "./local-CnGNTReZ.mjs";
5
5
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
6
6
  import { userInfo } from "node:os";
7
7
  import { dirname, join, resolve } from "node:path";
@@ -1,8 +1,9 @@
1
1
  import { d as createBoardClient, p as formatProfileHeader, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
2
  import "./schemas-DAzSsgWk.mjs";
3
- import { Y as routes, a as compileWatcher, c as METHODS } from "./origin-9Ch-Zonv.mjs";
3
+ import { F as routes } from "./routes-DrByOCc1.mjs";
4
4
  import { g as keyId, p as DERIVED_ID } from "./middleware-0DUFrav-.mjs";
5
- import { c as tailWatchers, i as createVercel, l as deployedOnVercel, o as PROTOCOL_ROUTES, s as withoutToken, t as createBoard } from "./exports-BVgUNVsP.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";
6
7
  import { execFile } from "node:child_process";
7
8
  import { createHash } from "node:crypto";
8
9
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -988,7 +989,7 @@ function vercel(options = {}) {
988
989
  function board(options = {}) {
989
990
  return createBoard(options, {
990
991
  backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
991
- sync: () => import("./engine-BVHSH2Kn.mjs"),
992
+ sync: () => import("./engine-D07DTYSi.mjs"),
992
993
  serving: () => import("./serving-hcxzaCCO.mjs"),
993
994
  sandbox: (url, token) => sandboxHeaders(url, url, token)
994
995
  });
@@ -1,5 +1,5 @@
1
- import { _ as SyncFn, m as SyncProvider, x as channels } from "./provider-dY54GFNz.mjs";
2
- import { r as ChatTransport, t as ChatInput } from "./chat-provider-Cgkh9xJw.mjs";
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";
3
3
  import { z } from "zod";
4
4
  import { ReactionEvent } from "chat";
5
5
  //#region src/sync/chat-sdk.d.ts
@@ -1,5 +1,5 @@
1
- import { f as channels, i as eventSchema, r as envelope } from "./events-BT8y_81j.mjs";
2
- import { t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
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";
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-dY54GFNz.mjs";
2
- import { n as ChatSyncProvider } from "./chat-provider-Cgkh9xJw.mjs";
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";
3
3
  import { z } from "zod";
4
4
  import { Adapter } from "chat";
5
5
  //#region src/sync/github.d.ts
@@ -1,5 +1,5 @@
1
- import { g as withRoutes, i as eventSchema, p as into, r as envelope } from "./events-BT8y_81j.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
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";
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 { dt as SourceRead } from "./routes-By9lmvUD.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-dY54GFNz.mjs";
3
- import { n as ChatSyncProvider, t as ChatInput } from "./chat-provider-Cgkh9xJw.mjs";
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";
4
4
  import { z } from "zod";
5
5
  import { Adapter } from "chat";
6
6
  //#region src/sync/linear.d.ts
@@ -1,5 +1,5 @@
1
- import { f as channels, i as eventSchema, l as UnreadableError, r as envelope } from "./events-BT8y_81j.mjs";
2
- import { n as markdownOf, t as ChatSyncProvider } from "./chat-provider-CPZg2MQb.mjs";
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";
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";
@@ -84,7 +84,7 @@ function parseThread(thread) {
84
84
  }
85
85
  /** A board message's first line, as an issue title: Linear titles are plain text. */
86
86
  function titleOf(markdown) {
87
- return (markdown.split("\n").map((text) => text.trim()).find(Boolean) ?? "").replace(/^\*\*[^*\n]+\*\*:\s*/, "").replace(/\*\*|__|`/g, "").replace(/^[#>\s]+/, "").replace(/\s+/g, " ").trim().slice(0, 255) || "Untitled";
87
+ return (markdown.replace(/^\*\*[^*\n]+\*\*:\s*/, "").split("\n").map((text) => text.trim()).find(Boolean) ?? "").replace(/\*\*|__|`/g, "").replace(/^[#>\s]+/, "").replace(/\s+/g, " ").trim().slice(0, 255) || "Untitled";
88
88
  }
89
89
  function stateOf(state) {
90
90
  return state?.type ?? state?.name?.toLowerCase() ?? null;