@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
@@ -1,13 +1,14 @@
1
- import { d as Board } from "./backend-HcCCGPG4.mjs";
1
+ import { d as Board } from "./backend-CYsTLxtP.mjs";
2
2
  //#region src/conformance/index.d.ts
3
3
  /**
4
4
  * Checks that a board speaks the protocol, through a handle on it (`conformance(board())`), as
5
5
  * `vb` and agents use it: every board answers all of it. A board may keep no schedules or files,
6
6
  * and says so with a 501, which the kit reports as not kept here. It writes to one channel
7
- * (`conformance` by default), keeps every post on the board, and deletes what it posted.
7
+ * (`conformance` by default), keeps every post on the board, and deletes what it posted. The one
8
+ * schema it registers, `conformance@1`, stays: a schema version is never removed.
8
9
  */
9
10
  /** What a check is about, for the report's headings. */
10
- export type CheckGroup = 'core' | 'schedules' | 'grants' | 'tokens' | 'attachments' | 'watchers' | 'sync';
11
+ export type CheckGroup = 'core' | 'schedules' | 'grants' | 'schemas' | 'attachments' | 'watchers' | 'sync';
11
12
  export type CheckResult = {
12
13
  group: CheckGroup;
13
14
  name: string;
@@ -24,18 +25,19 @@ export type ConformanceReport = {
24
25
  export type ConformanceOptions = {
25
26
  /** Where it posts. Default `conformance`. */
26
27
  channel?: string;
27
- /**
28
- * The same board, with a board token's secret as the credential (as `BOARD_TOKEN` sends it):
29
- * the tokens check calls it so to see that a token does only what its `can` says. Without it,
30
- * that check is skipped.
31
- */
32
- withToken?: (secret: string) => Board;
33
28
  /**
34
29
  * The same board, with this run's credential and an `x-board-can` header that narrows it to
35
30
  * `can` (`conformance=read`), as a proxy holding the credential sends it: the checks of a
36
31
  * narrowed caller call it so. Without it, they're skipped.
37
32
  */
38
33
  withCan?: (can: string) => Board;
34
+ /**
35
+ * The same board, with this run's credential and `headers` on every request, as a client or a proxy
36
+ * holding the credential sends them: the checks of who writes call it so, with an
37
+ * `x-board-profile` that carries an avatar and the headers that one replaced. Without it, they're
38
+ * skipped, and it stands in for `withCan` when that's left out.
39
+ */
40
+ withHeaders?: (headers: Record<string, string>) => Board;
39
41
  /**
40
42
  * Whom the grants checks name. A board that verifies tokens itself (`vb serve`) takes the made-up
41
43
  * IDs they use without it; one that looks names up, as Vercel's API does, needs real ones on its
@@ -1,2 +1,2 @@
1
- import { t as conformance } from "./conformance-D59Py2m2.mjs";
1
+ import { t as conformance } from "./conformance-ClxEEZ9C.mjs";
2
2
  export { conformance };
@@ -0,0 +1,176 @@
1
+ //#region src/contract/data-values.ts
2
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3
+ /** What JSON Schema calls a value's type: an integer is a number too. */
4
+ function typeOf(value) {
5
+ if (value === null) return "null";
6
+ if (Array.isArray(value)) return "array";
7
+ if (typeof value === "number") return Number.isInteger(value) ? "integer" : "number";
8
+ return typeof value;
9
+ }
10
+ const isType = (value, type) => {
11
+ const actual = typeOf(value);
12
+ return actual === type || type === "number" && actual === "integer";
13
+ };
14
+ /** Two JSON values that say the same: objects whatever order their keys come in. */
15
+ function same(a, b) {
16
+ if (a === b) return true;
17
+ if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((item, index) => same(item, b[index]));
18
+ if (!isObject(a) || !isObject(b)) return false;
19
+ const keys = Object.keys(a);
20
+ return keys.length === Object.keys(b).length && keys.every((key) => Object.hasOwn(b, key) && same(a[key], b[key]));
21
+ }
22
+ const DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
23
+ const TIME = /^(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:z|[+-](\d{2})(?::?(\d{2}))?)?$/i;
24
+ const LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
25
+ const EMAIL_NAME = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/i;
26
+ function isDate(text) {
27
+ const found = DATE.exec(text);
28
+ if (!found) return false;
29
+ const [year, month, day] = [
30
+ Number(found[1]),
31
+ Number(found[2]),
32
+ Number(found[3])
33
+ ];
34
+ const days = [
35
+ 31,
36
+ year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28,
37
+ 31,
38
+ 30,
39
+ 31,
40
+ 30,
41
+ 31,
42
+ 31,
43
+ 30,
44
+ 31,
45
+ 30,
46
+ 31
47
+ ][month - 1];
48
+ return days !== void 0 && day >= 1 && day <= days;
49
+ }
50
+ function isTime(text) {
51
+ const found = TIME.exec(text);
52
+ if (!found) return false;
53
+ return Number(found[1]) <= 23 && Number(found[2]) <= 59 && Number(found[3]) <= 60 && Number(found[4] ?? 0) <= 23 && Number(found[5] ?? 0) <= 59;
54
+ }
55
+ /** A hostname's labels, with or without the dot that ends a full one. */
56
+ const isHostname = (text) => text.length <= 253 && text.replace(/\.$/, "").split(".").every((label) => LABEL.test(label));
57
+ const isIpv4 = (text) => {
58
+ const parts = text.split(".");
59
+ return parts.length === 4 && parts.every((part) => /^(?:0|[1-9]\d{0,2})$/.test(part) && Number(part) <= 255);
60
+ };
61
+ function isIpv6(text) {
62
+ let groups = text;
63
+ if (text.includes(".")) {
64
+ const tail = text.lastIndexOf(":");
65
+ if (tail === -1 || !isIpv4(text.slice(tail + 1))) return false;
66
+ groups = `${text.slice(0, tail + 1)}0:0`;
67
+ }
68
+ const halves = groups.split("::");
69
+ if (halves.length > 2) return false;
70
+ const parts = halves.flatMap((half) => half === "" ? [] : half.split(":"));
71
+ if (!parts.every((part) => /^[0-9a-f]{1,4}$/i.test(part))) return false;
72
+ return halves.length === 2 ? parts.length <= 7 : parts.length === 8;
73
+ }
74
+ /** What each format takes, each in time linear in the text. */
75
+ const FORMATS = {
76
+ date: isDate,
77
+ time: isTime,
78
+ "date-time": (text) => {
79
+ const at = text.search(/[t ]/i);
80
+ return at !== -1 && isDate(text.slice(0, at)) && isTime(text.slice(at + 1));
81
+ },
82
+ email: (text) => {
83
+ const at = text.lastIndexOf("@");
84
+ const domain = text.slice(at + 1);
85
+ return at > 0 && EMAIL_NAME.test(text.slice(0, at)) && domain.includes(".") && !domain.endsWith(".") && isHostname(domain);
86
+ },
87
+ uri: (text) => /^[a-z][a-z0-9+.-]*:[^\s]+$/i.test(text),
88
+ uuid: (text) => /^(?:urn:uuid:)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(text),
89
+ hostname: isHostname,
90
+ ipv4: isIpv4,
91
+ ipv6: isIpv6
92
+ };
93
+ /** A value as a refusal shows it: its JSON, cut short. */
94
+ const shown = (value) => {
95
+ const text = JSON.stringify(value) ?? String(value);
96
+ return text.length > 40 ? `${text.slice(0, 39)}…` : text;
97
+ };
98
+ /** `a`, `a or b`, `a, b, or c`: a few values, as a sentence lists them. */
99
+ function oneOf(values) {
100
+ const listed = values.slice(0, 6).map(shown);
101
+ if (values.length > 6) return `one of ${listed.join(", ")}, …`;
102
+ if (listed.length <= 2) return listed.join(" or ");
103
+ return `${listed.slice(0, -1).join(", ")}, or ${listed.at(-1)}`;
104
+ }
105
+ /** A type, or several, as a sentence names them: `a string`, `an object or null`. */
106
+ const named = (type) => (Array.isArray(type) ? type : [type]).map((one) => one === "null" ? "null" : `${/^[aeio]/.test(String(one)) ? "an" : "a"} ${one}`).join(" or ");
107
+ /**
108
+ * Why `value` doesn't match `schema`, or null when it does: the first thing wrong, said of the
109
+ * field it's wrong in (`action must be "started" or "stopped"`, `config.vcpus must be an integer`).
110
+ */
111
+ function checkValue(schema, value) {
112
+ return problemIn(schema, value, "");
113
+ }
114
+ function problemIn(schema, value, at) {
115
+ const it = at || "it";
116
+ if (schema === true) return null;
117
+ if (schema === false) return `${it} isn't allowed`;
118
+ if (!isObject(schema)) return null;
119
+ const within = (key) => typeof key === "number" ? `${at}[${key}]` : at ? `${at}.${key}` : key;
120
+ const { type } = schema;
121
+ if (type !== void 0 && !(Array.isArray(type) ? type : [type]).some((one) => isType(value, one))) return `${it} must be ${named(type)}`;
122
+ if ("const" in schema && !same(value, schema.const)) return `${it} must be ${shown(schema.const)}`;
123
+ if (Array.isArray(schema.enum) && !schema.enum.some((one) => same(value, one))) return `${it} must be ${oneOf(schema.enum)}`;
124
+ if (typeof value === "string") {
125
+ const length = [...value].length;
126
+ if (typeof schema.minLength === "number" && length < schema.minLength) return `${it} must be at least ${schema.minLength} characters`;
127
+ if (typeof schema.maxLength === "number" && length > schema.maxLength) return `${it} must be at most ${schema.maxLength} characters`;
128
+ if (typeof schema.format === "string" && FORMATS[schema.format]?.(value) === false) return `${it} must be ${/^[aeiu]/.test(schema.format) ? "an" : "a"} ${schema.format}`;
129
+ if (typeof schema.pattern === "string" && !new RegExp(schema.pattern, "u").test(value)) return `${it} must match ${schema.pattern}`;
130
+ }
131
+ if (typeof value === "number") {
132
+ if (typeof schema.minimum === "number" && value < schema.minimum) return `${it} must be at least ${schema.minimum}`;
133
+ if (typeof schema.maximum === "number" && value > schema.maximum) return `${it} must be at most ${schema.maximum}`;
134
+ if (typeof schema.exclusiveMinimum === "number" && value <= schema.exclusiveMinimum) return `${it} must be above ${schema.exclusiveMinimum}`;
135
+ if (typeof schema.exclusiveMaximum === "number" && value >= schema.exclusiveMaximum) return `${it} must be below ${schema.exclusiveMaximum}`;
136
+ if (typeof schema.multipleOf === "number" && !Number.isInteger(value / schema.multipleOf)) return `${it} must be a multiple of ${schema.multipleOf}`;
137
+ }
138
+ if (Array.isArray(value)) {
139
+ if (typeof schema.minItems === "number" && value.length < schema.minItems) return `${it} must have at least ${schema.minItems} items`;
140
+ if (typeof schema.maxItems === "number" && value.length > schema.maxItems) return `${it} must have at most ${schema.maxItems} items`;
141
+ if (schema.items !== void 0) for (let index = 0; index < value.length; index++) {
142
+ const problem = problemIn(schema.items, value[index], within(index));
143
+ if (problem !== null) return problem;
144
+ }
145
+ }
146
+ if (isObject(value)) {
147
+ const properties = isObject(schema.properties) ? schema.properties : {};
148
+ if (Array.isArray(schema.required)) {
149
+ for (const name of schema.required) if (typeof name === "string" && !Object.hasOwn(value, name)) return `${within(name)} is missing`;
150
+ }
151
+ for (const [name, child] of Object.entries(value)) if (Object.hasOwn(properties, name)) {
152
+ const problem = problemIn(properties[name], child, within(name));
153
+ if (problem !== null) return problem;
154
+ } else if (schema.additionalProperties !== void 0) {
155
+ if (schema.additionalProperties === false) return `${within(name)} isn't one of its fields`;
156
+ const problem = problemIn(schema.additionalProperties, child, within(name));
157
+ if (problem !== null) return problem;
158
+ }
159
+ }
160
+ if (Array.isArray(schema.allOf)) for (const one of schema.allOf) {
161
+ const problem = problemIn(one, value, at);
162
+ if (problem !== null) return problem;
163
+ }
164
+ for (const keyword of ["anyOf", "oneOf"]) {
165
+ const options = schema[keyword];
166
+ if (!Array.isArray(options)) continue;
167
+ const problems = options.map((one) => problemIn(one, value, at));
168
+ const matched = problems.filter((problem) => problem === null).length;
169
+ if (matched === 0) return problems.length === 1 ? problems[0] : `${it} matches none of the ${problems.length} it can be: ${[...new Set(problems)].slice(0, 4).join("; ")}`;
170
+ if (keyword === "oneOf" && matched > 1) return `${it} matches ${matched} of the ${problems.length} it can be, and must match one`;
171
+ }
172
+ if (schema.not !== void 0 && problemIn(schema.not, value, at) === null) return `${it} matches what it must not`;
173
+ return null;
174
+ }
175
+ //#endregion
176
+ export { checkValue as t };
@@ -0,0 +1,4 @@
1
+ //#region src/inspect/digest.ts
2
+ const PAGE_SHA256 = "bffecbb88c0932a155d138369038fe92de8d4f8b6e40c651f6471358ac237c0a";
3
+ //#endregion
4
+ export { PAGE_SHA256 as t };