@vercel/board 0.39.0 → 0.41.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 (100) hide show
  1. package/README.md +6 -4
  2. package/dist/{access-CVkjSfxj.mjs → access-C5HaO42b.mjs} +2 -2
  3. package/dist/access.d.mts +6 -6
  4. package/dist/access.mjs +5 -5
  5. package/dist/actors-nrOf7Y7z.mjs +160 -0
  6. package/dist/{auth-BXLCkeB0.d.mts → auth-Bn8J_1F2.d.mts} +14 -29
  7. package/dist/{auth-B3bBYOqf.mjs → auth-DAlYi6TN.mjs} +9 -19
  8. package/dist/{backend-HcCCGPG4.d.mts → backend-CYsTLxtP.d.mts} +139 -43
  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-1WKsLEnM.mjs → chat-provider-CPZg2MQb.mjs} +2 -2
  14. package/dist/{chat-provider-DyNy5xdC.d.mts → chat-provider-Cgkh9xJw.d.mts} +2 -2
  15. package/dist/cli-commands.d.mts +1 -1
  16. package/dist/cli-commands.mjs +1 -1
  17. package/dist/cli-embedded.d.mts +3 -3
  18. package/dist/cli-embedded.mjs +4 -4
  19. package/dist/cli.mjs +8 -13
  20. package/dist/{commands-B5d-lmNN.d.mts → commands-CrEVjASe.d.mts} +14 -26
  21. package/dist/{commands-BLS7erNu.mjs → commands-QRD0U9AQ.mjs} +114 -105
  22. package/dist/{conformance-D59Py2m2.mjs → conformance-ClxEEZ9C.mjs} +378 -101
  23. package/dist/conformance.d.mts +11 -9
  24. package/dist/conformance.mjs +1 -1
  25. package/dist/data-values-C-Cq80hz.mjs +176 -0
  26. package/dist/digest-Dna1CGa_.mjs +4 -0
  27. package/dist/{engine-eUgO5jTM.mjs → engine-8BcNeckB.mjs} +197 -84
  28. package/dist/{errors-rYDxZEuN.mjs → errors-DcQf5WeM.mjs} +123 -42
  29. package/dist/{events-C6HwB046.mjs → events-BT8y_81j.mjs} +2 -2
  30. package/dist/{exports-M5o4PTfO.mjs → exports-B6udRV_E.mjs} +961 -383
  31. package/dist/exports-C8zsIL1A.d.mts +4 -0
  32. package/dist/{external-CHDxWIVf.mjs → external-DymyhUzl.mjs} +1 -1
  33. package/dist/{index-rNqqgkyu.d.mts → index-fcpEFCTR.d.mts} +2 -2
  34. package/dist/index.d.mts +7 -6
  35. package/dist/index.mjs +8 -6
  36. package/dist/index.node.d.mts +7 -6
  37. package/dist/index.node.mjs +5 -4
  38. package/dist/inspect/app.js +110 -109
  39. package/dist/inspect/engine.js +5 -5
  40. package/dist/inspect-BsF3mYMY.mjs +2 -0
  41. package/dist/{inspect-BkXxR2uB.mjs → inspect-DPRoC_Gg.mjs} +6 -6
  42. package/dist/{local-DvkOWf4U.mjs → local-B9y4p6N7.mjs} +463 -512
  43. package/dist/{main-DtV_Po9i.mjs → main-S0A-c_kP.mjs} +549 -178
  44. package/dist/{memory-DkoqhxIH.mjs → memory-DhduVbUu.mjs} +2 -2
  45. package/dist/{mentions-CB6ShY4R.mjs → mentions-DfZGp3B-.mjs} +18 -4
  46. package/dist/{middleware-CPqAuRtp.mjs → middleware-DHdrxmoc.mjs} +71 -3
  47. package/dist/{targets-C1mT3M1N.mjs → origin-B3m2lnZC.mjs} +43 -64
  48. package/dist/{page-64IwoGRu.mjs → page-2jjHZmIW.mjs} +2 -2
  49. package/dist/page-CAUe4GmQ.mjs +2 -0
  50. package/dist/{provider-D5yVFisj.d.mts → provider-dY54GFNz.d.mts} +20 -34
  51. package/dist/{routes-BffuaoTX.d.mts → routes-By9lmvUD.d.mts} +91 -77
  52. package/dist/{schemas-AZkxk06N.mjs → schemas-DAzSsgWk.mjs} +8 -3
  53. package/dist/schemas.d.mts +37 -0
  54. package/dist/schemas.mjs +3 -0
  55. package/dist/{serve-CX1rqDF_.mjs → serve-B15I2Ibf.mjs} +5 -5
  56. package/dist/{server-DkYkyarg.mjs → server-DgpRZ4Nu.mjs} +74 -127
  57. package/dist/{serving-DJMcG0dT.mjs → serving-CALKWs9K.mjs} +1 -1
  58. package/dist/{sql-l3ysn4O5.mjs → sql-P9g-rLIF.mjs} +75 -12
  59. package/dist/{sqlite-CAwNHbQD.mjs → sqlite-B3rCcIof.mjs} +2 -2
  60. package/dist/{sqlite-db-cm5yhrD-.mjs → sqlite-db-D0Fyju-4.mjs} +1 -1
  61. package/dist/sync-chat-sdk.d.mts +2 -2
  62. package/dist/sync-chat-sdk.mjs +2 -2
  63. package/dist/sync-github.d.mts +2 -2
  64. package/dist/sync-github.mjs +2 -2
  65. package/dist/sync-linear.d.mts +3 -3
  66. package/dist/sync-linear.mjs +2 -2
  67. package/dist/sync-slack.d.mts +14 -8
  68. package/dist/sync-slack.mjs +46 -19
  69. package/dist/sync.d.mts +2 -2
  70. package/dist/sync.mjs +2 -2
  71. package/dist/{tokens-DA9ipsZ-.mjs → tokens-D7_ZIWpX.mjs} +4 -4
  72. package/docs/01-board/01-mounting.md +13 -16
  73. package/docs/01-board/03-identity.md +112 -74
  74. package/docs/01-board/04-messages.md +61 -2
  75. package/docs/01-board/05-reading.md +11 -5
  76. package/docs/01-board/06-watchers.md +17 -13
  77. package/docs/01-board/07-schedules.md +8 -6
  78. package/docs/01-board/08-middleware.md +1 -1
  79. package/docs/01-board/09-access.md +80 -132
  80. package/docs/02-sync/01-overview.md +75 -4
  81. package/docs/02-sync/02-functions.md +11 -6
  82. package/docs/02-sync/03-slack.md +43 -19
  83. package/docs/02-sync/06-providers.md +9 -4
  84. package/docs/03-guides/01-coding-agents.md +18 -22
  85. package/docs/03-guides/02-inspector.md +4 -5
  86. package/docs/03-guides/03-ci.md +7 -26
  87. package/docs/03-guides/04-triage.md +2 -2
  88. package/docs/03-guides/05-agent-factory.md +7 -9
  89. package/docs/03-guides/06-sandboxed-agents.md +149 -0
  90. package/docs/04-reference/01-cli.md +161 -104
  91. package/docs/04-reference/02-board.md +89 -37
  92. package/docs/04-reference/03-http.md +176 -71
  93. package/docs/04-reference/05-conformance.md +47 -21
  94. package/docs/index.md +5 -5
  95. package/package.json +5 -1
  96. package/dist/actors-kfMejhaw.mjs +0 -156
  97. package/dist/digest-krhjNAt4.mjs +0 -4
  98. package/dist/exports-vLQ2Y2Nd.d.mts +0 -4
  99. package/dist/inspect-lnv1sLXM.mjs +0 -2
  100. package/dist/page-BUj8_UZv.mjs +0 -2
@@ -0,0 +1,402 @@
1
+ //#region src/contract/data-schemas.ts
2
+ /** How big a definition gets: its JSON, its nodes (each `enum` and `const` value counts), its subschemas, and its depth. */
3
+ const SCHEMA_BYTES_MAX = 32768;
4
+ const SCHEMA_DESCRIPTION_MAX = 2e3;
5
+ const SCHEMA_VERSION_MAX = 99999;
6
+ const NAME = `[a-z][a-z0-9._-]{0,79}`;
7
+ /** A schema's name: lowercase letters, numbers, and `._-`, starting with a letter. */
8
+ const SCHEMA_NAME = new RegExp(`^${NAME}$`);
9
+ const SCHEMA_ID = new RegExp(`^(${NAME})@([1-9][0-9]{0,4})$`);
10
+ /** `sandbox` and 1 as `sandbox@1`: what names a schema version everywhere. */
11
+ const schemaId = (name, version) => `${name}@${version}`;
12
+ /** `sandbox@1` as its name and version, or null for anything else. */
13
+ function parseSchemaId(id) {
14
+ const found = SCHEMA_ID.exec(id);
15
+ return found ? {
16
+ name: found[1],
17
+ version: Number(found[2])
18
+ } : null;
19
+ }
20
+ const commitSha = {
21
+ type: "string",
22
+ pattern: "^(?:[0-9a-f]{40}|[0-9a-f]{64})$",
23
+ description: "Full lowercase commit SHA"
24
+ };
25
+ /**
26
+ * The schemas every board has, as Vercel's API has them: their names are reserved, so no one
27
+ * registers a version of one. They may use what a registered schema can't (`pattern`): they're the
28
+ * board's own, and never change.
29
+ */
30
+ const BUILT_IN_SCHEMAS = [{
31
+ name: "git-commit",
32
+ version: 1,
33
+ description: "A Git commit, by its full SHA and the first line of its message.",
34
+ schema: {
35
+ type: "object",
36
+ additionalProperties: false,
37
+ required: ["sha", "title"],
38
+ properties: {
39
+ sha: commitSha,
40
+ title: {
41
+ type: "string",
42
+ minLength: 1,
43
+ maxLength: 1024
44
+ }
45
+ }
46
+ }
47
+ }, {
48
+ name: "vercel-deployment",
49
+ version: 1,
50
+ description: "A Vercel deployment, by its URL and optionally the commit it was built from.",
51
+ schema: {
52
+ type: "object",
53
+ additionalProperties: false,
54
+ required: ["url"],
55
+ properties: {
56
+ url: {
57
+ type: "string",
58
+ format: "uri",
59
+ pattern: "^https://",
60
+ maxLength: 2048
61
+ },
62
+ gitSha: commitSha
63
+ }
64
+ }
65
+ }];
66
+ /** Whether `name` is a built-in schema's: no one registers a version of it. */
67
+ const isBuiltInName = (name) => BUILT_IN_SCHEMAS.some((schema) => schema.name === name);
68
+ const TYPES = /* @__PURE__ */ new Set([
69
+ "object",
70
+ "array",
71
+ "string",
72
+ "number",
73
+ "integer",
74
+ "boolean",
75
+ "null"
76
+ ]);
77
+ /** The formats a string can name. */
78
+ const SCHEMA_FORMATS = [
79
+ "date-time",
80
+ "date",
81
+ "time",
82
+ "email",
83
+ "uri",
84
+ "uuid",
85
+ "hostname",
86
+ "ipv4",
87
+ "ipv6"
88
+ ];
89
+ const FORMATS = new Set(SCHEMA_FORMATS);
90
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
91
+ /** A schema inside a schema: an object of keywords, or `true` or `false`. */
92
+ const isSubschema = (value) => isObject(value) || typeof value === "boolean";
93
+ const count = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
94
+ const finite = (value) => typeof value === "number" && Number.isFinite(value);
95
+ const text = (value) => typeof value === "string";
96
+ const distinct = (values) => new Set(values).size === values.length;
97
+ /**
98
+ * Every keyword a definition may use, and what its value has to be: structural ones only. No `$ref`,
99
+ * `pattern`, or anything else that runs code or follows a reference, and no `uniqueItems`, which
100
+ * compares every pair of items.
101
+ */
102
+ const KEYWORDS = {
103
+ $schema: {
104
+ takes: "a string",
105
+ ok: text
106
+ },
107
+ title: {
108
+ takes: "a string",
109
+ ok: text
110
+ },
111
+ description: {
112
+ takes: "a string",
113
+ ok: text
114
+ },
115
+ type: {
116
+ takes: "object, array, string, number, integer, boolean, or null, or a list of them",
117
+ ok: (value) => TYPES.has(value) || Array.isArray(value) && value.length > 0 && value.every((one) => TYPES.has(one)) && distinct(value)
118
+ },
119
+ properties: {
120
+ takes: "an object of schemas, by property",
121
+ ok: (value) => isObject(value) && Object.values(value).every(isSubschema)
122
+ },
123
+ required: {
124
+ takes: "a list of property names, each once",
125
+ ok: (value) => Array.isArray(value) && value.every(text) && distinct(value)
126
+ },
127
+ additionalProperties: {
128
+ takes: "a schema, or true or false",
129
+ ok: isSubschema
130
+ },
131
+ items: {
132
+ takes: "one schema for every item",
133
+ ok: isSubschema
134
+ },
135
+ minItems: {
136
+ takes: "a whole number, 0 or more",
137
+ ok: count
138
+ },
139
+ maxItems: {
140
+ takes: "a whole number, 0 or more",
141
+ ok: count
142
+ },
143
+ minLength: {
144
+ takes: "a whole number, 0 or more",
145
+ ok: count
146
+ },
147
+ maxLength: {
148
+ takes: "a whole number, 0 or more",
149
+ ok: count
150
+ },
151
+ minimum: {
152
+ takes: "a number",
153
+ ok: finite
154
+ },
155
+ maximum: {
156
+ takes: "a number",
157
+ ok: finite
158
+ },
159
+ exclusiveMinimum: {
160
+ takes: "a number",
161
+ ok: finite
162
+ },
163
+ exclusiveMaximum: {
164
+ takes: "a number",
165
+ ok: finite
166
+ },
167
+ multipleOf: {
168
+ takes: "a number above 0",
169
+ ok: (value) => finite(value) && value > 0
170
+ },
171
+ enum: {
172
+ takes: "a list of at least one value",
173
+ ok: (value) => Array.isArray(value) && value.length > 0
174
+ },
175
+ const: {
176
+ takes: "any value",
177
+ ok: () => true
178
+ },
179
+ oneOf: {
180
+ takes: "a list of at least one schema",
181
+ ok: (value) => Array.isArray(value) && value.length > 0 && value.every(isSubschema)
182
+ },
183
+ anyOf: {
184
+ takes: "a list of at least one schema",
185
+ ok: (value) => Array.isArray(value) && value.length > 0 && value.every(isSubschema)
186
+ },
187
+ allOf: {
188
+ takes: "a list of at least one schema",
189
+ ok: (value) => Array.isArray(value) && value.length > 0 && value.every(isSubschema)
190
+ },
191
+ not: {
192
+ takes: "a schema",
193
+ ok: isSubschema
194
+ },
195
+ format: {
196
+ takes: `one of ${SCHEMA_FORMATS.join(", ")}`,
197
+ ok: (value) => FORMATS.has(value)
198
+ }
199
+ };
200
+ /** Whether the board can keep `value`: text with no NUL character and no lone surrogate. */
201
+ const keepable = (value) => !value.includes("\0") && value.isWellFormed();
202
+ var Problem = class extends Error {};
203
+ /**
204
+ * Why `schema` can't be registered, or null when it can: it describes an object, stays small, and
205
+ * uses only the structural keywords, each with a value that means something. Checking a value
206
+ * against one then costs the value's size times the schema's, and both are bounded.
207
+ */
208
+ function checkDefinition(schema) {
209
+ if (!isObject(schema) || schema.type !== "object") return "a schema describes a JSON object: give it \"type\": \"object\"";
210
+ if (new TextEncoder().encode(JSON.stringify(schema)).length > 32768) return `a schema is at most ${SCHEMA_BYTES_MAX} bytes of JSON`;
211
+ let nodes = 0;
212
+ let subschemas = 0;
213
+ const counted = (depth) => {
214
+ if (++nodes > 512 || depth > 16) throw new Problem(`a schema has at most 512 nodes and 16 levels`);
215
+ };
216
+ const kept = (value) => {
217
+ if (typeof value === "string" && !keepable(value)) throw new Problem("a schema has a NUL character or a lone surrogate in its text");
218
+ };
219
+ const data = (value, depth) => {
220
+ counted(depth);
221
+ kept(value);
222
+ if (typeof value !== "object" || value === null) return;
223
+ for (const [key, child] of Object.entries(value)) {
224
+ kept(key);
225
+ data(child, depth + 1);
226
+ }
227
+ };
228
+ const visit = (value, depth, at, properties) => {
229
+ counted(depth);
230
+ kept(value);
231
+ if (typeof value !== "object" || value === null) return;
232
+ if (Array.isArray(value)) {
233
+ value.forEach((item, index) => visit(item, depth + 1, `${at}/${index}`, false));
234
+ return;
235
+ }
236
+ if (properties) {
237
+ for (const [name, child] of Object.entries(value)) {
238
+ kept(name);
239
+ visit(child, depth + 1, `${at}/${name}`, false);
240
+ }
241
+ return;
242
+ }
243
+ if (++subschemas > 64) throw new Problem(`a schema has at most 64 subschemas`);
244
+ for (const [keyword, child] of Object.entries(value)) {
245
+ const rule = Object.hasOwn(KEYWORDS, keyword) ? KEYWORDS[keyword] : void 0;
246
+ if (!rule) throw new Problem(`schemas don't take "${keyword}"${at ? ` (at ${at})` : ""}: no references, patterns, uniqueItems, or keywords of your own`);
247
+ if (!rule.ok(child)) throw new Problem(`"${keyword}"${at ? ` at ${at}` : ""} takes ${rule.takes}`);
248
+ if (keyword === "enum" || keyword === "const") data(child, depth + 1);
249
+ else visit(child, depth + 1, `${at}/${keyword}`, keyword === "properties");
250
+ }
251
+ };
252
+ try {
253
+ visit(schema, 0, "", false);
254
+ } catch (error) {
255
+ if (error instanceof Problem) return error.message;
256
+ throw error;
257
+ }
258
+ return null;
259
+ }
260
+ /** `value` as JSON with every object's keys in order: two definitions that say the same are the same text. */
261
+ function canonical(value) {
262
+ return JSON.stringify(value, (_key, child) => isObject(child) ? Object.fromEntries(Object.entries(child).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) : child);
263
+ }
264
+ //#endregion
265
+ //#region src/contract/blocks.ts
266
+ const OPENING = /^( {0,3})(`{3,}|~{3,})(.*)$/;
267
+ const BLOCK_INFO = /^json#(\S*)/;
268
+ const QUOTED = /^ {0,3}>[ \t]?/;
269
+ const ITEM = /^ {0,3}(?:[-*+]|\d{1,9}[.)])(?: {1,4}|\t|$)/;
270
+ const INTERRUPTS = /^ {0,3}(?:#{1,6}(?:[ \t]|$)|([-*_])(?:[ \t]*\1){2,}[ \t]*$|<)/;
271
+ /** The fence `line` opens, if it opens one. A backtick fence's info string has no backtick in it: that's inline code. */
272
+ function opens(line) {
273
+ const found = OPENING.exec(line);
274
+ return found && !(found[2][0] === "`" && found[3].includes("`")) ? {
275
+ fence: found[2],
276
+ info: found[3].trim()
277
+ } : null;
278
+ }
279
+ /** Whether `line` closes `open`: the same character, at least as many, and nothing after but spaces. */
280
+ function closes(line, open) {
281
+ const found = /^ {0,3}(`{3,}|~{3,})[ \t]*$/.exec(line);
282
+ return found !== null && found[1][0] === open.fence[0] && found[1].length >= open.fence.length;
283
+ }
284
+ /** What a block's source holds: its data, or why it has none. */
285
+ function read(id, source) {
286
+ const named = parseSchemaId(id);
287
+ if (!named) return { problem: `${id || "json#"} names no schema: one is name@version, like sandbox@1` };
288
+ let parsed;
289
+ try {
290
+ parsed = JSON.parse(source);
291
+ } catch {
292
+ return {
293
+ ...named,
294
+ problem: `the ${id} block isn't JSON`
295
+ };
296
+ }
297
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return {
298
+ ...named,
299
+ problem: `the ${id} block isn't a JSON object`
300
+ };
301
+ return {
302
+ ...named,
303
+ data: parsed
304
+ };
305
+ }
306
+ /**
307
+ * The blocks in `text`, in order: each code fence at the top level whose info string is
308
+ * `json#<name>@<version>`. A fence inside another fence is that fence's text, and one in a quote or
309
+ * a list item is its container's and ends with it, so a message can show a block, or quote one,
310
+ * without posting it again, and none of them hides a block that follows. One with a `problem` has
311
+ * no `data`.
312
+ */
313
+ function findBlocks(text) {
314
+ const blocks = [];
315
+ let open = null;
316
+ let container = null;
317
+ let item = 0;
318
+ let nested = null;
319
+ let paragraph = false;
320
+ let at = 0;
321
+ const emit = (to, sourceEnd, end, unclosed = false) => {
322
+ const id = BLOCK_INFO.exec(to.info)?.[1];
323
+ if (id === void 0) return;
324
+ const source = text.slice(to.content, Math.max(to.content, sourceEnd));
325
+ blocks.push({
326
+ id,
327
+ source,
328
+ ...unclosed ? {
329
+ ...parseSchemaId(id) ?? {},
330
+ problem: `the ${id} block's fence never closes`
331
+ } : read(id, source),
332
+ start: to.start,
333
+ end
334
+ });
335
+ };
336
+ /** Whether `line` is plain text: what a paragraph is made of, and what continues one. */
337
+ const plain = (line) => line.trim() !== "" && opens(line) === null && !QUOTED.test(line) && !ITEM.test(line) && !INTERRUPTS.test(line);
338
+ /** `line` as the container it's in sees it, or null for a line at the top level. */
339
+ const within = (line) => {
340
+ const quoted = QUOTED.exec(line);
341
+ if (quoted) {
342
+ if (container !== "quote") nested = null;
343
+ container = "quote";
344
+ return line.slice(quoted[0].length);
345
+ }
346
+ if (container === "item" && (line.trim() === "" || line.length - line.trimStart().length >= item)) return line.slice(Math.min(item, line.length));
347
+ if (container !== null && paragraph && nested === null && plain(line)) return line;
348
+ const started = ITEM.exec(line);
349
+ nested = null;
350
+ container = started ? "item" : null;
351
+ if (!started) return null;
352
+ item = started[0].length === line.length ? line.length + 1 : started[0].length;
353
+ return line.slice(item);
354
+ };
355
+ while (at <= text.length) {
356
+ const newline = text.indexOf("\n", at);
357
+ const end = newline === -1 ? text.length : newline;
358
+ const line = text.slice(at, end).replace(/\r$/, "");
359
+ if (open) {
360
+ if (closes(line, open)) {
361
+ emit(open, at - 1, at + line.length);
362
+ open = null;
363
+ }
364
+ } else {
365
+ const inner = within(line);
366
+ if (inner === null) {
367
+ const found = opens(line);
368
+ if (found) open = {
369
+ ...found,
370
+ start: at,
371
+ content: Math.min(text.length, end + 1)
372
+ };
373
+ } else if (nested) {
374
+ if (closes(inner, nested)) nested = null;
375
+ } else nested = opens(inner);
376
+ paragraph = inner !== null && nested === null && plain(inner);
377
+ }
378
+ if (newline === -1) break;
379
+ at = newline + 1;
380
+ }
381
+ if (open) emit(open, text.length, text.length, true);
382
+ return blocks;
383
+ }
384
+ /** The blocks `text` holds, as a view lists them: each fence that names a schema and holds a JSON object. */
385
+ function blocksIn(text) {
386
+ if (!text.includes("json#")) return [];
387
+ return findBlocks(text).flatMap(({ name, version, data }) => name !== void 0 && version !== void 0 && data !== void 0 ? [{
388
+ schema: name,
389
+ version,
390
+ data
391
+ }] : []);
392
+ }
393
+ /**
394
+ * A block as text: `data` in a fence that names schema `id`. Alone, it's a message that is only
395
+ * its data; among prose, a message that says something and carries data.
396
+ */
397
+ function block(id, data) {
398
+ if (!parseSchemaId(id)) throw new TypeError(`${id} names no schema: one is name@version, like sandbox@1`);
399
+ return `\`\`\`json#${id}\n${JSON.stringify(data, null, 2)}\n\`\`\``;
400
+ }
401
+ //#endregion
402
+ export { SCHEMA_DESCRIPTION_MAX as a, canonical as c, parseSchemaId as d, schemaId as f, BUILT_IN_SCHEMAS as i, checkDefinition as l, blocksIn as n, SCHEMA_NAME as o, findBlocks as r, SCHEMA_VERSION_MAX as s, block as t, isBuiltInName as u };
@@ -0,0 +1,33 @@
1
+ //#region src/contract/blocks.d.ts
2
+ /** A fence in a message's text that names a schema, and what it holds. */
3
+ type FoundBlock = {
4
+ /** The schema as its fence names it: `sandbox@1`, or whatever follows `json#` when that names none. */
5
+ id: string;
6
+ /** Its name and version, when `id` is one. */
7
+ name?: string;
8
+ version?: number;
9
+ /** What's between its fences, as written. */
10
+ source: string;
11
+ /** Its data, when the source is a JSON object. */
12
+ data?: Record<string, unknown>;
13
+ /** Why it has no data: its ID names no schema, its JSON doesn't parse or isn't an object, or its fence never closes. */
14
+ problem?: string;
15
+ /** Where it is in the text: from the start of its opening fence's line to the end of its closing fence. */
16
+ start: number;
17
+ end: number;
18
+ };
19
+ /**
20
+ * The blocks in `text`, in order: each code fence at the top level whose info string is
21
+ * `json#<name>@<version>`. A fence inside another fence is that fence's text, and one in a quote or
22
+ * a list item is its container's and ends with it, so a message can show a block, or quote one,
23
+ * without posting it again, and none of them hides a block that follows. One with a `problem` has
24
+ * no `data`.
25
+ */
26
+ declare function findBlocks(text: string): FoundBlock[];
27
+ /**
28
+ * A block as text: `data` in a fence that names schema `id`. Alone, it's a message that is only
29
+ * its data; among prose, a message that says something and carries data.
30
+ */
31
+ declare function block(id: string, data: Record<string, unknown>): string;
32
+ //#endregion
33
+ export { block as n, findBlocks as r, FoundBlock as t };
@@ -1,5 +1,5 @@
1
- import "./external-CHDxWIVf.mjs";
2
- import { c as SyncProvider, s as ResolvedTarget } from "./events-C6HwB046.mjs";
1
+ import "./external-DymyhUzl.mjs";
2
+ import { c as SyncProvider, s as ResolvedTarget } from "./events-BT8y_81j.mjs";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { Chat, stringifyMarkdown } from "chat";
5
5
  //#region src/sync/chat.ts
@@ -1,5 +1,5 @@
1
- import { $t as Actor, an as ExternalAuthor, cn as ExternalLink, it as SourceJoin, sn as ExternalFile, st as SourceRead } from "./routes-BffuaoTX.mjs";
2
- import { T as ProviderEvent, a as ProviderOptions, c as ReceivedEvent, d as ResolvedTarget, g as SyncFn, i as ProviderFile, k as SyncRoot, n as FileDelivery, o as ProviderPost, p as SyncProvider, r as ProviderDelivery, s as Receive, t as FetchedLink } from "./provider-D5yVFisj.mjs";
1
+ import { cn as ExternalFile, ct as SourceJoin, dt as SourceRead, en as Actor, ln as ExternalLink, on as ExternalAuthor } from "./routes-By9lmvUD.mjs";
2
+ import { A as SyncRoot, E as ProviderEvent, _ as SyncFn, a as ProviderOptions, c as Receive, f as ResolvedTarget, i as ProviderFile, l as ReceivedEvent, m as SyncProvider, n as FileDelivery, o as ProviderPost, r as ProviderDelivery, t as FetchedLink } from "./provider-dY54GFNz.mjs";
3
3
  import { Adapter, Author, FileUpload, Message, ReactionEvent, StateAdapter } from "chat";
4
4
  //#region src/sync/chat-provider.d.ts
5
5
  type ChatInput = {
@@ -1,2 +1,2 @@
1
- import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-B5d-lmNN.mjs";
1
+ import { a as OptionName, c as globalOptions, d as options, f as usage, i as CliOption, l as groups, n as CliCommand, o as commands, r as CliExample, s as filters, t as CliArgument, u as option } from "./commands-CrEVjASe.mjs";
2
2
  export { CliArgument, CliCommand, CliExample, CliOption, OptionName, commands, filters, globalOptions, groups, option, options, usage };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-BLS7erNu.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-QRD0U9AQ.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,5 +1,5 @@
1
- import { d as Board } from "./backend-HcCCGPG4.mjs";
2
- import "./index-rNqqgkyu.mjs";
1
+ import { d as Board } from "./backend-CYsTLxtP.mjs";
2
+ import "./index-fcpEFCTR.mjs";
3
3
  //#region src/cli/failure.d.ts
4
4
  /**
5
5
  * What kind of failure it is, which fixes the exit code: 2 for `usage` and `missing_input`, 130
@@ -115,7 +115,7 @@ export type VbResult = {
115
115
  /**
116
116
  * Runs the vb command `argv` (`['read', '42']`, `['reply', '42', 'on it']`) on `board`, in this
117
117
  * process, and returns what the CLI would print. `board` already says which board and who, so
118
- * `--url` and `--handle` don't apply, and the commands about your machine (`whoami`, `identity`,
118
+ * `--url` doesn't apply, and the commands about your machine (`whoami`, `identity`,
119
119
  * `hooks`, `serve`, `inspect`) answer 2. Calls run one at a time, in order, so
120
120
  * `tail` and `wait`, which hold the rest until they end, need `options.signal`.
121
121
  */
@@ -1,6 +1,6 @@
1
- import { g as VERSION } from "./targets-C1mT3M1N.mjs";
2
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-DtV_Po9i.mjs";
3
- import { t as PAGE_SHA256 } from "./digest-krhjNAt4.mjs";
1
+ import { h as VERSION } from "./origin-B3m2lnZC.mjs";
2
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-S0A-c_kP.mjs";
3
+ import { t as PAGE_SHA256 } from "./digest-Dna1CGa_.mjs";
4
4
  //#region src/cli/embedded.ts
5
5
  /**
6
6
  * The inspector's page as this version of board's npm package has it, for an app that bundles
@@ -65,7 +65,7 @@ let queue = Promise.resolve();
65
65
  /**
66
66
  * Runs the vb command `argv` (`['read', '42']`, `['reply', '42', 'on it']`) on `board`, in this
67
67
  * process, and returns what the CLI would print. `board` already says which board and who, so
68
- * `--url` and `--handle` don't apply, and the commands about your machine (`whoami`, `identity`,
68
+ * `--url` doesn't apply, and the commands about your machine (`whoami`, `identity`,
69
69
  * `hooks`, `serve`, `inspect`) answer 2. Calls run one at a time, in order, so
70
70
  * `tail` and `wait`, which hold the rest until they end, need `options.signal`.
71
71
  */
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as option } from "./commands-BLS7erNu.mjs";
3
- import { f as projectDir } from "./server-DkYkyarg.mjs";
4
- import { r as main } from "./main-DtV_Po9i.mjs";
5
- import { n as stopped, r as startInspector } from "./inspect-BkXxR2uB.mjs";
2
+ import { a as option } from "./commands-QRD0U9AQ.mjs";
3
+ import { f as projectDir } from "./server-DgpRZ4Nu.mjs";
4
+ import { r as main } from "./main-S0A-c_kP.mjs";
5
+ import { n as stopped, r as startInspector } from "./inspect-DPRoC_Gg.mjs";
6
6
  import { appendFile, readFile } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
8
  //#region src/cli/local.ts
@@ -19,7 +19,7 @@ async function ignoreLog(root) {
19
19
  const local = { serve: {
20
20
  spec: {
21
21
  name: "serve",
22
- description: "run a board on this machine (127.0.0.1:4100, no sync) and open the inspector: other commands reach it with --url or BOARD_URL. Its log lives in .board/, and you're local:user:<your OS user> (or --handle)",
22
+ description: "run a board on this machine (127.0.0.1:4100, no sync) and open the inspector: other commands reach it with --url or BOARD_URL. Its log lives in .board/, and you're local:user:<your OS user>",
23
23
  arguments: [],
24
24
  options: [
25
25
  option("port", "the port to listen on (default: 4100)"),
@@ -36,12 +36,10 @@ const local = { serve: {
36
36
  if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
37
37
  const port = portFlag();
38
38
  const root = projectDir();
39
- const { localHandle, serveLocal } = await import("./serve-CX1rqDF_.mjs");
40
- const handle = flags.handle ?? process.env.BOARD_HANDLE;
39
+ const { serveLocal } = await import("./serve-B15I2Ibf.mjs");
41
40
  const local = await serveLocal({
42
41
  dir: flags.dir ?? join(root, ".board"),
43
- ...port !== void 0 ? { port } : {},
44
- ...handle ? { handle: localHandle(handle) } : {}
42
+ ...port !== void 0 ? { port } : {}
45
43
  });
46
44
  let inspector = null;
47
45
  try {
@@ -49,10 +47,7 @@ const local = { serve: {
49
47
  out(`serving a local board at ${local.url} as ${local.principal}, its log in ${local.dir} (Ctrl-C to stop)`);
50
48
  out(`reach it with --url ${local.url}, or BOARD_URL=${local.url}`);
51
49
  if (!flags["no-inspect"]) {
52
- const { board } = connection(local.url, {
53
- token: local.token,
54
- handle: local.handle
55
- });
50
+ const { board } = connection(local.url, { token: local.token });
56
51
  inspector = await startInspector({ client: board.as(null) });
57
52
  out(`inspector at ${inspector.url}`);
58
53
  if (!flags["no-open"]) openBrowser(inspector.url);
@@ -31,6 +31,8 @@ type CliCommand = {
31
31
  /** Other names it runs by: `rm` for `delete`. */
32
32
  readonly aliases?: readonly string[];
33
33
  readonly description: string;
34
+ /** The options most runs of it take, written after its usage in the list of commands: what a reader of that list alone would otherwise not know it has. */
35
+ readonly brief?: string;
34
36
  readonly arguments: readonly CliArgument[];
35
37
  /** Its own options: the filters (with `filters`) and the global options apply too. */
36
38
  readonly options: readonly CliOption[];
@@ -79,12 +81,12 @@ declare const options: {
79
81
  readonly text: {
80
82
  readonly type: 'string';
81
83
  readonly value: 'words';
82
- readonly description: 'containing these words';
84
+ readonly description: 'containing this text, as one phrase (a substring, not word search)';
83
85
  };
84
86
  readonly after: {
85
87
  readonly type: 'string';
86
88
  readonly value: 'id';
87
- readonly description: 'after a message or a cursor';
89
+ readonly description: 'only what came after a message or a cursor (read and wait print one)';
88
90
  };
89
91
  readonly url: {
90
92
  readonly type: 'string';
@@ -121,15 +123,6 @@ declare const options: {
121
123
  readonly value: 'url';
122
124
  readonly description: "the profile's avatar, with --as";
123
125
  };
124
- readonly human: {
125
- readonly type: 'boolean';
126
- readonly description: 'write as yourself, with no profile or session';
127
- };
128
- readonly handle: {
129
- readonly type: 'string';
130
- readonly value: 'h';
131
- readonly description: 'your handle (default: your Vercel username)';
132
- };
133
126
  readonly json: {
134
127
  readonly type: 'boolean';
135
128
  readonly description: 'JSON, for programs';
@@ -216,7 +209,7 @@ declare const options: {
216
209
  readonly timeout: {
217
210
  readonly type: 'string';
218
211
  readonly value: 'duration';
219
- readonly description: 'how long to wait (default: 30m)';
212
+ readonly description: 'how long to wait: 30s, 10m, or a bare number of seconds (default: 30m)';
220
213
  };
221
214
  readonly 'no-open': {
222
215
  readonly type: 'boolean';
@@ -225,7 +218,7 @@ declare const options: {
225
218
  readonly in: {
226
219
  readonly type: 'string';
227
220
  readonly value: 'duration';
228
- readonly description: 'once, this long from now, e.g. 1d';
221
+ readonly description: 'once, this long from now, e.g. 90s, 5m, 1d';
229
222
  };
230
223
  readonly at: {
231
224
  readonly type: 'string';
@@ -256,8 +249,8 @@ declare const options: {
256
249
  readonly can: {
257
250
  readonly type: 'string';
258
251
  readonly multiple: true;
259
- readonly value: 'scope';
260
- readonly description: 'what it may do (default: *=read,post,react,label)';
252
+ readonly value: 'pattern=perms';
253
+ readonly description: 'what they may do, repeated: perms, all, or none';
261
254
  };
262
255
  readonly user: {
263
256
  readonly type: 'string';
@@ -433,20 +426,15 @@ declare const options: {
433
426
  readonly type: 'boolean';
434
427
  readonly description: 'closed to everyone but you, in the same write';
435
428
  };
436
- readonly profile: {
429
+ readonly schema: {
437
430
  readonly type: 'string';
438
- readonly value: 'name';
439
- readonly description: 'the profile every request with it writes as';
431
+ readonly value: 'json|@file';
432
+ readonly description: 'its JSON Schema: inline, @<file>, or - for stdin';
440
433
  };
441
- readonly session: {
434
+ readonly description: {
442
435
  readonly type: 'string';
443
- readonly value: 'id';
444
- readonly description: 'the session every request with it writes from';
445
- };
446
- readonly expires: {
447
- readonly type: 'string';
448
- readonly value: 'duration';
449
- readonly description: 'how long it lives (default: 30d, at most 90d; 1d and 7d on Vercel\'s board)';
436
+ readonly value: 'text';
437
+ readonly description: 'what it holds, in a sentence';
450
438
  };
451
439
  readonly port: {
452
440
  readonly type: 'string';