@vercel/board 0.38.0 → 0.40.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 (85) hide show
  1. package/README.md +5 -3
  2. package/dist/{access-CVkjSfxj.mjs → access-Bl_k_Hpa.mjs} +1 -1
  3. package/dist/access.d.mts +2 -2
  4. package/dist/access.mjs +4 -4
  5. package/dist/{actors-kfMejhaw.mjs → actors-yBRWTpt5.mjs} +38 -53
  6. package/dist/{auth-B3bBYOqf.mjs → auth-C8URZHLx.mjs} +2 -2
  7. package/dist/{auth-BXLCkeB0.d.mts → auth-DtmZzlHm.d.mts} +5 -2
  8. package/dist/{backend-BkQlF1LQ.d.mts → backend-BW5NbBsp.d.mts} +37 -11
  9. package/dist/backend-local.d.mts +1 -1
  10. package/dist/backend-local.mjs +1 -1
  11. package/dist/blocks-CVoBC7ur.mjs +402 -0
  12. package/dist/blocks-DGvh2alZ.d.mts +33 -0
  13. package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Bbb9JguG.d.mts} +2 -2
  14. package/dist/cli-commands.d.mts +1 -1
  15. package/dist/cli-commands.mjs +1 -1
  16. package/dist/cli-embedded.d.mts +2 -2
  17. package/dist/cli-embedded.mjs +3 -3
  18. package/dist/cli.mjs +5 -5
  19. package/dist/{commands-B5d-lmNN.d.mts → commands-BJLocuXj.d.mts} +10 -0
  20. package/dist/{commands-BLS7erNu.mjs → commands-D6VWegVY.mjs} +88 -8
  21. package/dist/{conformance-qJF96jZI.mjs → conformance-BWhZ0k8T.mjs} +256 -13
  22. package/dist/conformance.d.mts +4 -3
  23. package/dist/conformance.mjs +1 -1
  24. package/dist/data-values-C-Cq80hz.mjs +176 -0
  25. package/dist/digest-D32GV_mX.mjs +4 -0
  26. package/dist/{engine-eUgO5jTM.mjs → engine-Djif8XVk.mjs} +191 -77
  27. package/dist/{errors-rYDxZEuN.mjs → errors-CNRJqUuL.mjs} +16 -14
  28. package/dist/{exports-BsfcChdp.mjs → exports-C2OWIbLU.mjs} +639 -258
  29. package/dist/exports-FyRBIAMs.d.mts +4 -0
  30. package/dist/{index-DpVyZa9b.d.mts → index-Cuxbz_E0.d.mts} +2 -2
  31. package/dist/index.d.mts +7 -6
  32. package/dist/index.mjs +6 -5
  33. package/dist/index.node.d.mts +7 -6
  34. package/dist/index.node.mjs +5 -4
  35. package/dist/inspect/app.js +110 -109
  36. package/dist/inspect/engine.js +5 -5
  37. package/dist/inspect-CLy6FrOZ.mjs +2 -0
  38. package/dist/{inspect-DtCbBtOW.mjs → inspect-cGcP8ZO9.mjs} +4 -4
  39. package/dist/{local-Bo3XzEKB.mjs → local-CsleYuyM.mjs} +664 -752
  40. package/dist/{main-0nvLgajF.mjs → main-D97xuqWZ.mjs} +177 -59
  41. package/dist/{memory-DkoqhxIH.mjs → memory-BvVoglGv.mjs} +2 -2
  42. package/dist/{mentions-CB6ShY4R.mjs → mentions-CT2bN5eP.mjs} +17 -3
  43. package/dist/{middleware-CPqAuRtp.mjs → middleware-BF9vnPPS.mjs} +70 -2
  44. package/dist/{targets-B4Uikw0J.mjs → origin-DLCmrwmE.mjs} +47 -39
  45. package/dist/{page-UsfvSIWc.mjs → page-6BTCZWGY.mjs} +2 -2
  46. package/dist/page-BnY8FhPn.mjs +2 -0
  47. package/dist/{provider-D5yVFisj.d.mts → provider-YqkF1E2k.d.mts} +23 -13
  48. package/dist/{routes-BffuaoTX.d.mts → routes-CAjd5ARa.d.mts} +101 -25
  49. package/dist/schemas.d.mts +37 -0
  50. package/dist/schemas.mjs +3 -0
  51. package/dist/{serve-D7I3KisQ.mjs → serve-Cs-e0Jke.mjs} +4 -4
  52. package/dist/{server-Cc3nYq3H.mjs → server-CIfMdIt3.mjs} +43 -98
  53. package/dist/{serving-DJMcG0dT.mjs → serving-B4l0nLng.mjs} +1 -1
  54. package/dist/{sql-l3ysn4O5.mjs → sql-Bv-RQu8n.mjs} +73 -10
  55. package/dist/{sqlite-CAwNHbQD.mjs → sqlite-D4mkYihG.mjs} +2 -2
  56. package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-BraLvHtf.mjs} +1 -1
  57. package/dist/sync-chat-sdk.d.mts +2 -2
  58. package/dist/sync-github.d.mts +2 -2
  59. package/dist/sync-linear.d.mts +3 -3
  60. package/dist/sync-slack.d.mts +14 -8
  61. package/dist/sync-slack.mjs +42 -15
  62. package/dist/sync.d.mts +2 -2
  63. package/dist/{tokens-DA9ipsZ-.mjs → tokens-CrrXAVGz.mjs} +2 -2
  64. package/docs/01-board/01-mounting.md +7 -5
  65. package/docs/01-board/03-identity.md +71 -39
  66. package/docs/01-board/04-messages.md +58 -1
  67. package/docs/01-board/05-reading.md +3 -3
  68. package/docs/01-board/06-watchers.md +10 -14
  69. package/docs/01-board/07-schedules.md +2 -4
  70. package/docs/01-board/08-middleware.md +1 -1
  71. package/docs/01-board/09-access.md +25 -22
  72. package/docs/02-sync/01-overview.md +72 -7
  73. package/docs/02-sync/02-functions.md +11 -6
  74. package/docs/02-sync/03-slack.md +40 -16
  75. package/docs/02-sync/06-providers.md +9 -4
  76. package/docs/04-reference/01-cli.md +110 -18
  77. package/docs/04-reference/02-board.md +63 -10
  78. package/docs/04-reference/03-http.md +157 -31
  79. package/docs/04-reference/05-conformance.md +13 -6
  80. package/docs/index.md +1 -1
  81. package/package.json +5 -1
  82. package/dist/digest-DAxy9Ula.mjs +0 -4
  83. package/dist/exports-BJ3wmEMY.d.mts +0 -4
  84. package/dist/inspect-5mkjJYMS.mjs +0 -2
  85. package/dist/page-R0RoE_gM.mjs +0 -2
@@ -1,9 +1,9 @@
1
- import { m as DIRECT_UPLOAD_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-rYDxZEuN.mjs";
1
+ import { m as DIRECT_UPLOAD_BYTES_MAX, p as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-CNRJqUuL.mjs";
2
2
  import { 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, v as platformAvatar, y as storable } from "./schemas-AZkxk06N.mjs";
3
3
  import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-CHDxWIVf.mjs";
4
- import { i as afterRetry } from "./middleware-CPqAuRtp.mjs";
5
- import { o as options } from "./commands-BLS7erNu.mjs";
6
- import { n as replaceMentions, t as extractMentions } from "./mentions-CB6ShY4R.mjs";
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-BF9vnPPS.mjs";
6
+ import { o as options } from "./commands-D6VWegVY.mjs";
7
7
  import { z } from "zod";
8
8
  //#region src/api/routes.ts
9
9
  /**
@@ -43,8 +43,11 @@ const Filters = z.object({
43
43
  by: z.string().optional(),
44
44
  mentions: z.string().optional(),
45
45
  label: repeated.pipe(z.array(LabelFilter)).optional(),
46
- /** Where messages came from: a sync key such as `slack`, or `board` for the board itself. */
47
- from: z.string().min(1).max(64).optional(),
46
+ /**
47
+ * Where messages came from: a sync key such as `slack`, or `board` for the board itself. On Vercel's board, another
48
+ * project's key is `<project>/<key>`, by its name (up to 100 characters) or its ID.
49
+ */
50
+ from: z.string().min(1).max(165).optional(),
48
51
  /** Case-insensitive words the text contains. */
49
52
  text: z.string().min(1).max(200).optional()
50
53
  });
@@ -224,6 +227,17 @@ const TokenBody = z.object({
224
227
  /** How long it lives: `30d` by default, at most `90d`, and on Vercel's board `1d` by default, at most `7d`. */
225
228
  expires: Duration.optional()
226
229
  });
230
+ /**
231
+ * A schema version to register, for good: `name` and `version` are its ID (`sandbox@1`), and
232
+ * `schema` is a JSON Schema for an object, in structural keywords only, which the board checks.
233
+ * Strict, so a board that doesn't know a field refuses it: what it kept could never be changed.
234
+ */
235
+ const SchemaBody = z.strictObject({
236
+ name: z.string().regex(SCHEMA_NAME, "a schema name is up to 80 lowercase letters, numbers, and ._-, starting with a letter"),
237
+ version: z.number().int().min(1).max(SCHEMA_VERSION_MAX),
238
+ description: z.string().min(1).max(SCHEMA_DESCRIPTION_MAX).refine(storable, "a description has a NUL character or a lone surrogate").optional(),
239
+ schema: z.record(z.string(), z.unknown())
240
+ });
227
241
  const SyncBody = z.object({ target: z.string().min(3).max(300) });
228
242
  const InboxQuery = z.object({
229
243
  channel: z.string().optional(),
@@ -300,16 +314,11 @@ const ImportOrigin = z.object({
300
314
  /** A link as an import carries it: a board message it names is a ref. */
301
315
  const ImportLink = Link.extend({ message: Ref.nullable() });
302
316
  /**
303
- * A platform user, as sync names them to the board. Their avatar shows wherever they do, so one
304
- * that isn't an https URL is dropped, never refused: the write lands without it.
305
- */
306
- const PlatformUser = ExternalAuthor.extend({ avatar: z.string().nullable().transform(platformAvatar) });
307
- /**
308
317
  * Who wrote it on the platform, and the sync key it came through: null for a write a sync callback
309
318
  * makes as that user, which syncs out to every platform like one written on the board.
310
319
  */
311
320
  const Imported = {
312
- author: PlatformUser,
321
+ author: ExternalAuthor.extend({ avatar: z.string().nullable().transform(platformAvatar) }),
313
322
  from: SyncKey.nullable()
314
323
  };
315
324
  /**
@@ -384,10 +393,6 @@ const SyncImportBody = z.discriminatedUnion("op", [
384
393
  ...Imported,
385
394
  ...Changed,
386
395
  links: z.array(ImportLink).max(10)
387
- }),
388
- z.object({
389
- op: z.literal("seen"),
390
- author: PlatformUser
391
396
  })
392
397
  ]);
393
398
  const PlatformFiles = z.array(z.string().min(1).max(300)).max(10).nullable();
@@ -625,6 +630,22 @@ const routes = {
625
630
  method: "POST",
626
631
  path: "/tokens/:id/revoke"
627
632
  },
633
+ /** Every schema: the built-ins, then the board's own. Anyone the board lets in reads them. */
634
+ schemas: {
635
+ method: "GET",
636
+ path: "/schemas"
637
+ },
638
+ /** One schema version, by `name@version`. */
639
+ schema: {
640
+ method: "GET",
641
+ path: "/schemas/:id"
642
+ },
643
+ /** Registers a version, which never changes after: needs manage at `*`. The same definition again is a no-op. */
644
+ createSchema: {
645
+ method: "POST",
646
+ path: "/schemas",
647
+ body: SchemaBody
648
+ },
628
649
  /** The caller's own post with the client ID it gave: what `POST /messages` answered, for telling a retry before posting. */
629
650
  posted: {
630
651
  method: "GET",
@@ -762,7 +783,7 @@ const routes = {
762
783
  };
763
784
  //#endregion
764
785
  //#region src/version.ts
765
- const VERSION = "0.38.0";
786
+ const VERSION = "0.40.0";
766
787
  //#endregion
767
788
  //#region src/server/backend.ts
768
789
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -803,6 +824,9 @@ const METHODS = [
803
824
  "tokens",
804
825
  "createToken",
805
826
  "revokeToken",
827
+ "schemas",
828
+ "schema",
829
+ "createSchema",
806
830
  "upload",
807
831
  "attachment",
808
832
  "uploadStart",
@@ -1172,28 +1196,12 @@ const syncTarget = (target) => typeof target === "string" ? {
1172
1196
  target,
1173
1197
  kind: isThreadTarget(target) ? "thread" : "channel"
1174
1198
  } : target;
1175
- /** Whether `text` mentions anyone by email, `@[ada@vercel.com]`, which sync looks up. */
1176
- const mentionsEmails = (text) => extractMentions(text).some((token) => token.kind === "actor" && token.actor.includes("@"));
1199
+ //#endregion
1200
+ //#region src/server/origin.ts
1177
1201
  /**
1178
- * `@[ada@vercel.com]`: each email `find` knows (a synced platform's user) becomes that user's
1179
- * exact mention, `@[slack:user:U0456]`, so it reads natively there; the rest stay plain text.
1202
+ * Sync in board() itself, on a board whose log is in this deployment (`local()`): it checked each
1203
+ * platform event itself, so what it imports is by the platform user, not a profile of anyone.
1180
1204
  */
1181
- async function withEmailMentions(text, find) {
1182
- const emails = extractMentions(text).flatMap((token) => token.kind === "actor" && token.actor.includes("@") ? [token.actor] : []);
1183
- if (emails.length === 0) return {
1184
- text,
1185
- found: []
1186
- };
1187
- const byEmail = /* @__PURE__ */ new Map();
1188
- for (const email of emails) byEmail.set(email, await find?.(email).catch(() => null) ?? null);
1189
- return {
1190
- text: replaceMentions(text, (token) => {
1191
- if (token.kind !== "actor" || !byEmail.has(token.actor)) return null;
1192
- const actor = byEmail.get(token.actor);
1193
- return actor ? `@[${actor.id}]` : token.actor;
1194
- }),
1195
- found: [...byEmail.values()].filter((actor) => actor !== null)
1196
- };
1197
- }
1205
+ const SYNC_ACTOR = "board:sync";
1198
1206
  //#endregion
1199
- export { MatchesQuery as A, SyncBody as B, GrantBody as C, InboxQuery as D, InboxPushBody as E, RegisterBody as F, ThreadsQuery as G, SyncFindQuery as H, ScheduleBody as I, UpdateGrantBody as J, TokenBody as K, SchedulesQuery as L, PostBody as M, ReactBody as N, LabelBody as O, Ref as P, SourceJoinBody as R, ExplainQuery as S, InboxNextQuery as T, SyncImportBody as U, SyncCopiesQuery as V, SyncReceiptBody as W, routes as X, UploadStartBody as Y, AckBody as _, runMatch as a, EditBody as b, withMentions as c, openapi as d, queryObject as f, VERSION as g, SYNC as h, canonicalWatchers as i, MessagesQuery as j, LinkedQuery as k, METHODS as l, readJson as m, syncTarget as n, compileWatcher as o, readCapped as p, TypingBody as q, withEmailMentions as r, hasCriteria as s, mentionsEmails as t, createRouter as u, CreateChannelBody as v, InboxAckBody as w, EventsQuery as x, DeleteBody as y, SourceReadQuery as z };
1207
+ 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, UpdateGrantBody as J, TokenBody 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 X, UploadStartBody 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, TypingBody 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 };
@@ -1,4 +1,4 @@
1
- import "./digest-DAxy9Ula.mjs";
1
+ import "./digest-D32GV_mX.mjs";
2
2
  import { createHash } from "node:crypto";
3
3
  import { readFile } from "node:fs/promises";
4
4
  //#region src/inspect/page.ts
@@ -22,7 +22,7 @@ function files() {
22
22
  async function page() {
23
23
  for (const file of files()) {
24
24
  const script = await readFile(file, "utf8").catch(() => null);
25
- if (script !== null && createHash("sha256").update(script).digest("hex") === "474e5b11011a75d090694373a67a3bc8e7c9ec162c44786ed0f44c9fc90261b4") return script;
25
+ if (script !== null && createHash("sha256").update(script).digest("hex") === "19a7d8abea48e87e5804d4546ba51b787a26aba0fce87dfb11acb4859822d116") return script;
26
26
  }
27
27
  return null;
28
28
  }
@@ -0,0 +1,2 @@
1
+ import { t as page } from "./page-6BTCZWGY.mjs";
2
+ export { page };
@@ -1,4 +1,4 @@
1
- import { $t as Actor, C as InboxItem, Ct as ThreadsPage, Dt as TokenInput, F as MessagesPage, J as RegistrationView, L as MessagesQueryInput, Mt as UpdateGrantInput, N as Me, Ot as TokenView, P as MessageView, S as InboxEntry, St as ThreadView, Tt as ThreadsQueryInput, an as ExternalAuthor, b as GrantView, bt as SyncedView, cn as ExternalLink, d as EventsPage, en as ExternalCopy, et as ScheduleView, ft as SyncFindInput, g as FiltersInput, gt as SyncImportInput, h as Explanation, i as BoardEventView, it as SourceJoin, j as MatchView, l as Discovery, ln as Link, mt as SyncFindView, nt as SchedulesQueryInput, o as ChannelView, on as ExternalEvent, q as RegisterInput, sn as ExternalFile, st as SourceRead, tn as Attachment, vt as SyncReceiptInput, y as GrantInput, yt as SyncThreadView } from "./routes-BffuaoTX.mjs";
1
+ import { C as InboxEntry, Ct as SyncThreadView, Dt as ThreadsPage, Et as ThreadView, F as MessageView, I as MessagesPage, It as UpdateGrantInput, J as RegisterInput, M as MatchView, Mt as TokenView, P as Me, R as MessagesQueryInput, St as SyncReceiptInput, Y as RegistrationView, _ as FiltersInput, a as BoardEventView, an as Attachment, b as GrantInput, bt as SyncImportInput, ct as SourceJoin, dn as ExternalFile, dt as SourceRead, f as EventsPage, fn as ExternalLink, g as Explanation, gt as SyncFindInput, in as ExternalCopy, jt as TokenInput, kt as ThreadsQueryInput, ln as ExternalAuthor, n as ActorView, ot as SchemaInput, pn as Link, rn as Actor, rt as SchedulesQueryInput, s as ChannelView, st as SchemaView, tt as ScheduleView, u as Discovery, un as ExternalEvent, vt as SyncFindView, w as InboxItem, wt as SyncedView, x as GrantView } from "./routes-CAjd5ARa.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/client/client.d.ts
4
4
  /**
@@ -119,10 +119,6 @@ type ExplainPrincipal = {
119
119
  /** An app on the team, by its slug or client ID. */
120
120
  app?: string;
121
121
  };
122
- /** What a write returns, with the handles in it that matched nobody and stayed plain text. */
123
- type Written<T> = T & {
124
- unknownMentions?: string[];
125
- };
126
122
  declare function createBoardClient(options: ClientOptions): {
127
123
  url: string;
128
124
  /**
@@ -166,16 +162,15 @@ declare function createBoardClient(options: ClientOptions): {
166
162
  created: boolean;
167
163
  grants?: GrantView[];
168
164
  }>;
169
- actors: () => Promise<Actor[]>;
165
+ actors: () => Promise<(Actor & Pick<ActorView, "verified">)[]>;
170
166
  messages: (query?: Filters & Omit<MessagesQueryInput, keyof FiltersInput>) => Promise<MessagesPage>;
171
167
  thread: (id: string) => Promise<ThreadView>;
172
168
  /** Your own post with the client ID you gave it, as posting it answered: 404 `post_not_found` when there's none. */
173
169
  posted: (id: string) => Promise<MessageView>;
174
170
  /** Threads with a matching message, one summary each (root, reply count, latest reply), by latest activity. `limit` counts threads. */
175
171
  threads: (query?: Filters & Omit<ThreadsQueryInput, keyof FiltersInput>) => Promise<ThreadsPage>;
176
- /** `unknownMentions` lists the handles that matched nobody: they posted as plain text. */
177
- post(channel: string, input: string | PostOptions): Promise<Written<MessageView>>;
178
- reply(id: string, input: string | ReplyOptions): Promise<Written<MessageView>>;
172
+ post(channel: string, input: string | PostOptions): Promise<MessageView>;
173
+ reply(id: string, input: string | ReplyOptions): Promise<MessageView>;
179
174
  /**
180
175
  * Posts later, as you: a new thread when `target` is a channel, a reply when it's
181
176
  * `{ re }`, any message's ID in the thread. Each message it posts carries
@@ -183,7 +178,7 @@ declare function createBoardClient(options: ClientOptions): {
183
178
  */
184
179
  schedule(target: string | {
185
180
  re: string;
186
- }, input: ScheduleOptions): Promise<Written<ScheduleView>>;
181
+ }, input: ScheduleOptions): Promise<ScheduleView>;
187
182
  /** Pending schedules (`all` for done and canceled too), oldest first. `re` is any message in a thread. */
188
183
  schedules: (query?: Omit<SchedulesQueryInput, 'all'> & {
189
184
  all?: boolean;
@@ -233,6 +228,19 @@ declare function createBoardClient(options: ClientOptions): {
233
228
  revokeToken: (id: string) => Promise<{
234
229
  revoked: boolean;
235
230
  }>;
231
+ /** Every schema: the built-ins, then the board's own, by name and version. */
232
+ schemas: () => Promise<SchemaView[]>;
233
+ /** One schema version, by its ID: `sandbox@1`. */
234
+ schema: (id: string) => Promise<SchemaView>;
235
+ /**
236
+ * Registers a schema version, for good: `schema` is a JSON Schema for an object, in structural
237
+ * keywords only. Needs manage at `*`. `created` is false for one that's there with the same
238
+ * definition; another definition is refused, since a version never changes.
239
+ */
240
+ createSchema: (input: SchemaInput) => Promise<{
241
+ schema: SchemaView;
242
+ created: boolean;
243
+ }>;
236
244
  /**
237
245
  * Stores a file on the board, for a post or reply's `attachments`. Up to 4 MB goes in one
238
246
  * request; bigger, up to 100 MB, goes straight to the board's blob store on a URL the board
@@ -251,7 +259,6 @@ declare function createBoardClient(options: ClientOptions): {
251
259
  revision?: number;
252
260
  }) => Promise<{
253
261
  ok: true;
254
- unknownMentions?: string[];
255
262
  }>;
256
263
  delete: (id: string, opts?: {
257
264
  revision?: number;
@@ -834,11 +841,14 @@ type ProviderFile = {
834
841
  };
835
842
  /**
836
843
  * Who a post is from, for a platform that can show it as the sender (Slack's per-message
837
- * username and icon): `name` is the label the text opens with (`**name**: …`).
844
+ * username and icon): `name` is the label the text opens with (`**name**: …`), and `attribution`
845
+ * the end of it that says whose word it is (` via support (preview) (slack)`), empty for a
846
+ * person as themselves, which a platform that cuts names short keeps whole.
838
847
  */
839
848
  type ProviderSender = {
840
849
  name: string;
841
850
  avatar: string | null;
851
+ attribution?: string;
842
852
  };
843
853
  type ProviderPost = {
844
854
  markdown: string;
@@ -1048,4 +1058,4 @@ declare abstract class SyncProvider<E extends ProviderEvent = ProviderEvent> {
1048
1058
  render(input: RenderInput): string;
1049
1059
  }
1050
1060
  //#endregion
1051
- export { envelope as A, ScheduleTiming as B, render as C, SyncOverrides as D, RootOverride as E, Filters as F, WaitOptions as H, PostOptions as I, ProfileOption as L, BoardClient as M, BoardError as N, SyncResult as O, ErrorOrigin as P, ReplyOptions as R, mirror as S, ProviderEvent as T, Written as U, UploadInput as V, duration as W, SyncIn as _, ProviderOptions as a, channels as b, ReceivedEvent as c, ResolvedTarget as d, SyncContext as f, SyncFn as g, Sync as h, ProviderFile as i, eventSchema as j, SyncRoot as k, RenderInput as l, UnreadableError as m, FileDelivery as n, ProviderPost as o, SyncProvider as p, ProviderDelivery as r, Receive as s, FetchedLink as t, Renderer as u, SyncOut as v, EventBase as w, into as x, SyncUnit as y, ScheduleOptions as z };
1061
+ 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 };
@@ -203,7 +203,6 @@ declare const boardEvents: {
203
203
  thread: z.ZodString;
204
204
  labels: z.ZodRecord<z.ZodString, z.ZodString>;
205
205
  noSync: z.ZodBoolean;
206
- mentions: z.ZodArray<z.ZodString>;
207
206
  by: z.ZodObject<{
208
207
  actor: z.ZodString;
209
208
  principal: z.ZodString;
@@ -288,7 +287,6 @@ declare const boardEvents: {
288
287
  id: z.ZodNumber;
289
288
  thread: z.ZodString;
290
289
  text: z.ZodString;
291
- mentions: z.ZodArray<z.ZodString>;
292
290
  by: z.ZodObject<{
293
291
  actor: z.ZodString;
294
292
  principal: z.ZodString;
@@ -405,7 +403,13 @@ declare const boardEvents: {
405
403
  handle: z.ZodString;
406
404
  name: z.ZodString;
407
405
  avatar: z.ZodNullable<z.ZodString>;
406
+ via: z.ZodOptional<z.ZodObject<{
407
+ name: z.ZodString;
408
+ environment: z.ZodNullable<z.ZodString>;
409
+ }, z.core.$strip>>;
410
+ platform: z.ZodOptional<z.ZodString>;
408
411
  host: z.ZodOptional<z.ZodLiteral<true>>;
412
+ verified: z.ZodOptional<z.ZodLiteral<true>>;
409
413
  }, z.core.$strip>;
410
414
  };
411
415
  type BoardEvents = typeof boardEvents;
@@ -449,6 +453,13 @@ type ActorKind = z.infer<typeof ActorKind>;
449
453
  type Author = z.infer<typeof Author>;
450
454
  type Attachment = z.infer<typeof Attachment>;
451
455
  //#endregion
456
+ //#region src/contract/profiles.d.ts
457
+ /** Who an actor with a profile acts through: its principal's name, and a deployment's environment. */
458
+ type Via = {
459
+ name: string;
460
+ environment: string | null;
461
+ };
462
+ //#endregion
452
463
  //#region src/contract/folds.d.ts
453
464
  type Message = {
454
465
  id: number;
@@ -460,7 +471,6 @@ type Message = {
460
471
  thread: string;
461
472
  labels: Labels;
462
473
  reactions: Record<string, string[]>;
463
- mentions: string[];
464
474
  by: Author;
465
475
  noSync: boolean;
466
476
  /** Where it came from on a platform, if it did. */
@@ -485,6 +495,11 @@ type Message = {
485
495
  * it's theirs to edit and delete only then. Its event's payload says so too.
486
496
  */
487
497
  blind?: true;
498
+ /**
499
+ * Set while its text is a platform's though it was written on the board: its last edit is one a
500
+ * sync brought in, which the board can't refuse or check. An edit made on the board clears it.
501
+ */
502
+ platformText?: true;
488
503
  /** The index of the last event that changed it. Folds from before it existed leave it out. */
489
504
  version?: number;
490
505
  /** The index of its post, or of its last edit or delete. Folds from before it existed leave it out. */
@@ -502,8 +517,14 @@ type Actor = {
502
517
  handle: string;
503
518
  name: string;
504
519
  avatar: string | null;
520
+ /** Who an actor with a profile (an agent, or a platform user a sync speaks for) acts through. */
521
+ via?: Via;
522
+ /** A platform user's platform (`slack`), as their sync key was registered with: for display. */
523
+ platform?: string;
505
524
  /** A host's principal, or one of its profiles: once it's seen as one, it stays one. Views leave it out. */
506
525
  host?: true;
526
+ /** Its last `actor.seen` was by a write whose credential named it as shown. Each write says it anew. */
527
+ verified?: true;
507
528
  };
508
529
  /** A copy of a board message on a platform. */
509
530
  /** `files`: the platform's IDs for the message's files, or null when it refused them; unset until they're sent. */
@@ -932,6 +953,17 @@ declare const TokenBody: z.ZodObject<{
932
953
  session: z.ZodOptional<z.ZodString>;
933
954
  expires: z.ZodOptional<z.ZodString>;
934
955
  }, z.core.$strip>;
956
+ /**
957
+ * A schema version to register, for good: `name` and `version` are its ID (`sandbox@1`), and
958
+ * `schema` is a JSON Schema for an object, in structural keywords only, which the board checks.
959
+ * Strict, so a board that doesn't know a field refuses it: what it kept could never be changed.
960
+ */
961
+ declare const SchemaBody: z.ZodObject<{
962
+ name: z.ZodString;
963
+ version: z.ZodNumber;
964
+ description: z.ZodOptional<z.ZodString>;
965
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
966
+ }, z.core.$strict>;
935
967
  declare const SyncBody: z.ZodObject<{
936
968
  target: z.ZodString;
937
969
  }, z.core.$strip>;
@@ -1149,15 +1181,6 @@ declare const SyncImportBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
1149
1181
  unavailable: z.ZodNullable<z.ZodString>;
1150
1182
  message: z.ZodNullable<z.ZodString>;
1151
1183
  }, z.core.$strip>>;
1152
- }, z.core.$strip>, z.ZodObject<{
1153
- op: z.ZodLiteral<"seen">;
1154
- author: z.ZodObject<{
1155
- id: z.ZodString;
1156
- handle: z.ZodString;
1157
- name: z.ZodString;
1158
- isBot: z.ZodBoolean;
1159
- avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
1160
- }, z.core.$strip>;
1161
1184
  }, z.core.$strip>], "op">;
1162
1185
  /** What sync did on a platform, about a board message: it landed, its files did, it gave up, or its thread syncs with a target. */
1163
1186
  declare const SyncReceiptBody: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -1414,6 +1437,8 @@ type UpdateGrantInput = {
1414
1437
  type TokenInput = Omit<z.input<typeof TokenBody>, 'can'> & {
1415
1438
  can?: Can | GrantCan;
1416
1439
  };
1440
+ /** What `createSchema` takes: a version's name, its number, and its JSON Schema. */
1441
+ type SchemaInput = z.input<typeof SchemaBody>;
1417
1442
  type SchedulesQueryOutput = z.output<typeof SchedulesQuery>;
1418
1443
  /** A scheduled message. It posts as `by`, its creator; each message it posts carries `schedule: { id, n }`. */
1419
1444
  type ScheduleView = {
@@ -1540,10 +1565,34 @@ type TokenView = {
1540
1565
  /** The token it was minted with, which it stops with. */
1541
1566
  parent: string | null;
1542
1567
  };
1543
- /** `kind` says who wrote it: a `person` or a platform user (`external`), an agent (`profile`), or a deployment or workflow. */
1544
- type ActorView = Pick<Actor, 'kind' | 'handle' | 'name' | 'avatar'>;
1568
+ /** A schema version, as the board keeps it: it never changes. */
1569
+ type SchemaView = {
1570
+ /** `name@version`: what names it everywhere. */
1571
+ id: string;
1572
+ name: string;
1573
+ version: number;
1574
+ description: string | null;
1575
+ /** The JSON Schema its data matches. */
1576
+ schema: Record<string, unknown>;
1577
+ /** One every board has: no one registers a version under its name. */
1578
+ builtIn: boolean;
1579
+ /** The actor that registered it, and when: null for a built-in. */
1580
+ by: string | null;
1581
+ at: string | null;
1582
+ };
1583
+ /**
1584
+ * `kind` says who wrote it: a `person` or a platform user (`external`), an agent (`profile`), or a deployment or workflow.
1585
+ * `via` is who one with a profile acts through: an agent's person or project, or the principal whose sync speaks for a
1586
+ * platform user (`Malte via www (preview)`). `platform` is a platform user's platform (`slack`), for display: their ID
1587
+ * names the sync key they came through. `verified` says the board checked who they are rather than taking their name
1588
+ * from what they sent: everyone on Vercel's board, and on a local one, whoever shows under the handle a credential it
1589
+ * checked gave them, as itself or after `via`.
1590
+ */
1591
+ type ActorView = Pick<Actor, 'kind' | 'handle' | 'name' | 'avatar' | 'via' | 'platform'> & {
1592
+ verified?: true;
1593
+ };
1545
1594
  /** A message as clients see it: its IDs are refs, and `version` says which of two views of it is newer. */
1546
- type MessageView = Omit<Message, 'id' | 're' | 'replyTo' | 'links' | 'schedule' | 'version' | 'revision'> & {
1595
+ type MessageView = Omit<Message, 'id' | 're' | 'replyTo' | 'links' | 'schedule' | 'version' | 'revision' | 'platformText'> & {
1547
1596
  id: string;
1548
1597
  /** The thread's root, or null for a root. */
1549
1598
  re: string | null;
@@ -1563,6 +1612,19 @@ type MessageView = Omit<Message, 'id' | 're' | 'replyTo' | 'links' | 'schedule'
1563
1612
  n: number;
1564
1613
  };
1565
1614
  author: ActorView | null;
1615
+ /**
1616
+ * The data its text carries, in order: each fence that names a schema (```json#sandbox@1), which
1617
+ * the board checked against that schema when the message was written. A message a sync brought
1618
+ * in has none, whatever its text says: a platform's text is never checked.
1619
+ */
1620
+ blocks: BlockView[];
1621
+ };
1622
+ /** A block: the schema it names, and its data, a JSON object that matches it. */
1623
+ type BlockView = {
1624
+ /** The schema's name and version: `sandbox`, 1. */
1625
+ schema: string;
1626
+ version: number;
1627
+ data: Record<string, unknown>;
1566
1628
  };
1567
1629
  /** A link in a message: a board message it names is a ref. */
1568
1630
  type LinkView = Omit<Link, 'message'> & {
@@ -1657,6 +1719,8 @@ type Me = {
1657
1719
  name: string;
1658
1720
  avatar: string | null;
1659
1721
  profile: string | null;
1722
+ /** Who you act through, writing with a profile: `claude via julian`. */
1723
+ via?: Via;
1660
1724
  session: string | null;
1661
1725
  expiresAt: string | null;
1662
1726
  /** What you may do in each channel pattern, implications included: `{ '*': [...every permission] }` is full access. */
@@ -2143,6 +2207,27 @@ declare const routes: {
2143
2207
  readonly method: 'POST';
2144
2208
  readonly path: '/tokens/:id/revoke';
2145
2209
  };
2210
+ /** Every schema: the built-ins, then the board's own. Anyone the board lets in reads them. */
2211
+ readonly schemas: {
2212
+ readonly method: 'GET';
2213
+ readonly path: '/schemas';
2214
+ };
2215
+ /** One schema version, by `name@version`. */
2216
+ readonly schema: {
2217
+ readonly method: 'GET';
2218
+ readonly path: '/schemas/:id';
2219
+ };
2220
+ /** Registers a version, which never changes after: needs manage at `*`. The same definition again is a no-op. */
2221
+ readonly createSchema: {
2222
+ readonly method: 'POST';
2223
+ readonly path: '/schemas';
2224
+ readonly body: z.ZodObject<{
2225
+ name: z.ZodString;
2226
+ version: z.ZodNumber;
2227
+ description: z.ZodOptional<z.ZodString>;
2228
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2229
+ }, z.core.$strict>;
2230
+ };
2146
2231
  /** The caller's own post with the client ID it gave: what `POST /messages` answered, for telling a retry before posting. */
2147
2232
  readonly posted: {
2148
2233
  readonly method: 'GET';
@@ -2450,15 +2535,6 @@ declare const routes: {
2450
2535
  unavailable: z.ZodNullable<z.ZodString>;
2451
2536
  message: z.ZodNullable<z.ZodString>;
2452
2537
  }, z.core.$strip>>;
2453
- }, z.core.$strip>, z.ZodObject<{
2454
- op: z.ZodLiteral<"seen">;
2455
- author: z.ZodObject<{
2456
- id: z.ZodString;
2457
- handle: z.ZodString;
2458
- name: z.ZodString;
2459
- isBot: z.ZodBoolean;
2460
- avatar: z.ZodPipe<z.ZodNullable<z.ZodString>, z.ZodTransform<string | null, string | null>>;
2461
- }, z.core.$strip>;
2462
2538
  }, z.core.$strip>], "op">;
2463
2539
  };
2464
2540
  /** What sync did on a platform: a delivery, its files, a failure, or a thread's new target. */
@@ -2656,4 +2732,4 @@ declare const routes: {
2656
2732
  };
2657
2733
  type RouteName = keyof typeof routes;
2658
2734
  //#endregion
2659
- export { ScheduleInput as $, Actor as $t, LinkedQuery as A, TypingResult as At, PostInput as B, FULL_ACCESS as Bt, InboxItem as C, ThreadsPage as Ct, LABEL_CONDITIONS_MAX as D, TokenInput as Dt, InboxQuery as E, TokenBody as Et, MessagesPage as F, routes as Ft, Ref as G, InvalidCan as Gt, PrincipalView as H, GrantChange as Ht, MessagesQuery as I, Access as It, RegistrationView as J, WrittenCan as Jt, RegisterBody as K, Level as Kt, MessagesQueryInput as L, AccessSummary as Lt, MatchesQuery as M, UpdateGrantInput as Mt, Me as N, UploadStartBody as Nt, LabelBody as O, TokenView as Ot, MessageView as P, UploadTicket as Pt, ScheduleBodyOutput as Q, union as Qt, ParsedFilters as R, Can as Rt, InboxEntry as S, ThreadView as St, InboxPushBody as T, ThreadsQueryInput as Tt, REGISTERED_WATCHERS_MAX as U, GrantChangeRefusal as Ut, PrincipalInput as V, Grant as Vt, ReactBody as W, GrantShape as Wt, RouteName as X, compileAccess as Xt, ResolvedSyncTarget as Y, checkGrantChange as Yt, ScheduleBody as Z, parseCan as Zt, GrantBody as _, SyncReceiptBody as _t, CanAt as a, ExternalAuthor as an, SourceJoinBody as at, GrantView as b, SyncedView as bt, DeleteBody as c, ExternalLink as cn, SourceReadQuery as ct, EventsPage as d, SyncCopiesView as dt, ExternalCopy as en, ScheduleView as et, EventsQuery as f, SyncFindInput as ft, FiltersInput as g, SyncImportInput as gt, Explanation as h, SyncImportBody as ht, BoardEventView as i, Labels as in, SourceJoin as it, MatchView as j, UpdateGrantBody as jt, LinkView as k, TypingBody as kt, Discovery as l, Link as ln, SyncBody as lt, ExplainQuery as m, SyncFindView as mt, ActorView as n, Author as nn, SchedulesQueryInput as nt, ChannelView as o, ExternalEvent as on, SourceMessage as ot, EventsQueryInput as p, SyncFindQuery as pt, RegisterInput as q, Permission as qt, ApiError as r, CAN_MAX as rn, SchedulesQueryOutput as rt, CreateChannelBody as s, ExternalFile as sn, SourceRead as st, AckBody as t, Attachment as tn, SchedulesQuery as tt, EditBody as u, SyncCopiesQuery as ut, GrantCan as v, SyncReceiptInput as vt, InboxNextQuery as w, ThreadsQuery as wt, InboxAckBody as x, ThreadSummaryView as xt, GrantInput as y, SyncThreadView as yt, PostBody as z, ChannelPattern as zt };
2735
+ export { ScheduleBodyOutput as $, checkGrantChange as $t, LinkView as A, TokenBody as At, PostBody as B, Access as Bt, InboxEntry as C, SyncThreadView as Ct, InboxQuery as D, ThreadsPage as Dt, InboxPushBody as E, ThreadView as Et, MessageView as F, UpdateGrantBody as Ft, ReactBody as G, Grant as Gt, PrincipalInput as H, Can as Ht, MessagesPage as I, UpdateGrantInput as It, RegisterInput as J, GrantShape as Jt, Ref as K, GrantChange as Kt, MessagesQuery as L, UploadStartBody as Lt, MatchView as M, TokenView as Mt, MatchesQuery as N, TypingBody as Nt, LABEL_CONDITIONS_MAX as O, ThreadsQuery as Ot, Me as P, TypingResult as Pt, ScheduleBody as Q, WrittenCan as Qt, MessagesQueryInput as R, UploadTicket as Rt, InboxAckBody as S, SyncReceiptInput as St, InboxNextQuery as T, ThreadSummaryView as Tt, PrincipalView as U, ChannelPattern as Ut, PostInput as V, AccessSummary as Vt, REGISTERED_WATCHERS_MAX as W, FULL_ACCESS as Wt, ResolvedSyncTarget as X, Level as Xt, RegistrationView as Y, InvalidCan as Yt, RouteName as Z, Permission as Zt, FiltersInput as _, SyncFindQuery as _t, BoardEventView as a, Attachment as an, SchemaBody as at, GrantInput as b, SyncImportInput as bt, CreateChannelBody as c, Labels as cn, SourceJoin as ct, EditBody as d, ExternalFile as dn, SourceRead as dt, compileAccess as en, ScheduleInput as et, EventsPage as f, ExternalLink as fn, SourceReadQuery as ft, Explanation as g, SyncFindInput as gt, ExplainQuery as h, SyncCopiesView as ht, BlockView as i, ExternalCopy as in, SchedulesQueryOutput as it, LinkedQuery as j, TokenInput as jt, LabelBody as k, ThreadsQueryInput as kt, DeleteBody as l, ExternalAuthor as ln, SourceJoinBody as lt, EventsQueryInput as m, SyncCopiesQuery as mt, ActorView as n, union as nn, SchedulesQuery as nt, CanAt as o, Author as on, SchemaInput as ot, EventsQuery as p, Link as pn, SyncBody as pt, RegisterBody as q, GrantChangeRefusal as qt, ApiError as r, Actor as rn, SchedulesQueryInput as rt, ChannelView as s, CAN_MAX as sn, SchemaView as st, AckBody as t, parseCan as tn, ScheduleView as tt, Discovery as u, ExternalEvent 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, routes as zt };
@@ -0,0 +1,37 @@
1
+ import { n as block, r as findBlocks, t as FoundBlock } from "./blocks-DGvh2alZ.mjs";
2
+ //#region src/contract/data-schemas.d.ts
3
+ /** A schema's definition: a JSON Schema for an object, in structural keywords only. */
4
+ type SchemaDefinition = Record<string, unknown>;
5
+ /** `sandbox@1` as its name and version, or null for anything else. */
6
+ export declare function parseSchemaId(id: string): {
7
+ name: string;
8
+ version: number;
9
+ } | null;
10
+ /**
11
+ * The schemas every board has, as Vercel's API has them: their names are reserved, so no one
12
+ * registers a version of one. They may use what a registered schema can't (`pattern`): they're the
13
+ * board's own, and never change.
14
+ */
15
+ export declare const BUILT_IN_SCHEMAS: readonly {
16
+ name: string;
17
+ version: number;
18
+ description: string;
19
+ schema: SchemaDefinition;
20
+ }[];
21
+ /**
22
+ * Why `schema` can't be registered, or null when it can: it describes an object, stays small, and
23
+ * uses only the structural keywords, each with a value that means something. Checking a value
24
+ * against one then costs the value's size times the schema's, and both are bounded.
25
+ */
26
+ export declare function checkDefinition(schema: unknown): string | null;
27
+ /** `value` as JSON with every object's keys in order: two definitions that say the same are the same text. */
28
+ export declare function canonical(value: unknown): string;
29
+ //#endregion
30
+ //#region src/contract/data-values.d.ts
31
+ /**
32
+ * Why `value` doesn't match `schema`, or null when it does: the first thing wrong, said of the
33
+ * field it's wrong in (`action must be "started" or "stopped"`, `config.vcpus must be an integer`).
34
+ */
35
+ export declare function checkValue(schema: SchemaDefinition | boolean, value: unknown): string | null;
36
+ //#endregion
37
+ export { type FoundBlock, type SchemaDefinition, block, findBlocks };
@@ -0,0 +1,3 @@
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";
3
+ export { BUILT_IN_SCHEMAS, block, canonical, checkDefinition, checkValue, findBlocks, parseSchemaId };
@@ -1,7 +1,7 @@
1
- import { u as BoardError } from "./errors-rYDxZEuN.mjs";
2
- import { d as localTokenFile, t as board } from "./server-Cc3nYq3H.mjs";
3
- import { t as oidcTokens } from "./tokens-DA9ipsZ-.mjs";
4
- import { t as local } from "./local-Bo3XzEKB.mjs";
1
+ import { u as BoardError } from "./errors-CNRJqUuL.mjs";
2
+ import { d as localTokenFile, t as board } from "./server-CIfMdIt3.mjs";
3
+ import { t as oidcTokens } from "./tokens-CrrXAVGz.mjs";
4
+ import { t as local } from "./local-CsleYuyM.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";