@vercel/board 0.57.0 → 0.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/{access-CIj7v_Dr.mjs → access-CZ419Vho.mjs} +1 -1
  3. package/dist/access.mjs +4 -4
  4. package/dist/{actors-DVDTqjm7.mjs → actors-CXMWplob.mjs} +2 -2
  5. package/dist/{auth-BDWGvFWl.mjs → auth-AwZJQpCO.mjs} +2 -2
  6. package/dist/backend-local.mjs +1 -1
  7. package/dist/backend-postgres.mjs +3 -3
  8. package/dist/cli-commands.d.mts +1 -1
  9. package/dist/cli-commands.mjs +1 -1
  10. package/dist/cli-embedded.mjs +2 -2
  11. package/dist/cli.mjs +6 -6
  12. package/dist/{commands-DLPIX7Jw.d.mts → commands-Dcm4_pc1.d.mts} +3 -3
  13. package/dist/{commands-7FY_8p92.mjs → commands-DeYAQUcP.mjs} +10 -5
  14. package/dist/{conformance-FiQ68adg.mjs → conformance-EtEq22w1.mjs} +2 -2
  15. package/dist/conformance.mjs +1 -1
  16. package/dist/{engine-B_CjnE3G.mjs → engine-CfVTyEeo.mjs} +2 -2
  17. package/dist/{errors-BfMR39F0.mjs → errors-DjatfYjl.mjs} +161 -2
  18. package/dist/{exports-x-ioAfbp.mjs → exports-B_UGnrnN.mjs} +171 -55
  19. package/dist/index.mjs +4 -4
  20. package/dist/index.node.mjs +4 -4
  21. package/dist/inspect/app.js +126 -146
  22. package/dist/inspect/engine.js +3 -3
  23. package/dist/inspect/sheet-presentation.js +1 -0
  24. package/dist/{inspect-BFnDSdsq.mjs → inspect-DfJzHFiE.mjs} +2 -2
  25. package/dist/inspect-H1MISWwN.mjs +2 -0
  26. package/dist/inspect.mjs +1 -1
  27. package/dist/{local-Gp8pqHSu.mjs → local-BiG1WJk0.mjs} +5 -5
  28. package/dist/{local-Bt1-jA9A.mjs → local-D2i5sxuY.mjs} +19 -8
  29. package/dist/{main-Du-mKQZn.mjs → main-Bbqg3Unf.mjs} +82 -33
  30. package/dist/{memory-74hyK6eH.mjs → memory-BmsyKyHu.mjs} +1 -1
  31. package/dist/{middleware-bIABV895.mjs → middleware-D2AGrGj7.mjs} +2 -32
  32. package/dist/{serve-xOoxwq7T.mjs → serve-D06-DMej.mjs} +6 -6
  33. package/dist/{server-BSexF7Bk.mjs → server-BXbcS-n9.mjs} +25 -10
  34. package/dist/{serving-ByD4TOOU.mjs → serving-B2BNr4PR.mjs} +1 -1
  35. package/dist/{shell-0nWQEqh3.mjs → shell-C8EowDEz.mjs} +11 -7
  36. package/dist/{sqlite-DtfrT_EP.mjs → sqlite-B9ZLSDUT.mjs} +1 -1
  37. package/dist/{sqlite-db-DSVlzQjv.mjs → sqlite-db-DawFxCk6.mjs} +20 -5
  38. package/dist/{task-batch-DgyfK9qx.mjs → task-batch-YMVr_c5R.mjs} +4 -4
  39. package/dist/{tokens-_1X8JNLT.mjs → tokens-CaEPmiG1.mjs} +2 -2
  40. package/dist/{version-CZT5WmZs.mjs → version-BRR9FkLa.mjs} +1 -1
  41. package/docs/01-board/01-mounting.md +9 -0
  42. package/docs/01-board/05-reading.md +2 -1
  43. package/docs/01-board/09-access.md +8 -4
  44. package/docs/01-board/11-tasks.md +1 -1
  45. package/docs/01-board/12-postgres.md +3 -3
  46. package/docs/03-guides/02-inspector.md +1 -1
  47. package/docs/04-reference/01-cli.md +1 -1
  48. package/docs/04-reference/03-http.md +1 -0
  49. package/package.json +2 -2
  50. package/dist/inspect-BuNsu2z6.mjs +0 -2
package/README.md CHANGED
@@ -6,7 +6,7 @@ threads, a live tail, watchers, and two-way sync with Slack, GitHub, and Linear.
6
6
  accounts: people are who their `vercel login` says they are, and deployments and CI runs are
7
7
  who their platform's OIDC token says.
8
8
 
9
- **[Docs](https://vercel.com/docs/board)** · **[Getting started prompt](https://vercel.com/message-board-onboarding.md)**, to hand your coding agent
9
+ **[Docs](https://vercel.com/docs/board)** · **[Getting started prompt](https://vercel.com/board-getting-started.md)**, to hand your coding agent
10
10
 
11
11
  ```bash
12
12
  npm i @vercel/board
@@ -1,5 +1,5 @@
1
1
  import { a as CAN_MAX, s as ChannelPath } from "./schemas-CUSTEFIy.mjs";
2
- import { o as forbidden } from "./errors-BfMR39F0.mjs";
2
+ import { o as forbidden } from "./errors-DjatfYjl.mjs";
3
3
  //#region src/server/access.ts
4
4
  /**
5
5
  * What a principal may do in a channel. `read` covers messages, threads,
package/dist/access.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as CAN_MAX } from "./schemas-CUSTEFIy.mjs";
2
- import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-CIj7v_Dr.mjs";
3
- import { D as explainGrants, O as grantAccess, k as subPrefix, t as DEFAULT_CAN } from "./auth-BDWGvFWl.mjs";
4
- import { a as resolveActor } from "./actors-DVDTqjm7.mjs";
5
- import { t as oidcTokens } from "./tokens-_1X8JNLT.mjs";
2
+ import { c as compileAccess, f as union, n as InvalidCan, o as checkGrantChange, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-CZ419Vho.mjs";
3
+ import { D as explainGrants, O as grantAccess, k as subPrefix, t as DEFAULT_CAN } from "./auth-AwZJQpCO.mjs";
4
+ import { a as resolveActor } from "./actors-CXMWplob.mjs";
5
+ import { t as oidcTokens } from "./tokens-CaEPmiG1.mjs";
6
6
  export { CAN_MAX, DEFAULT_CAN, FULL_ACCESS, InvalidCan, PERMISSIONS, checkGrantChange, compileAccess, explainGrants, grantAccess, oidcTokens, parseCan, resolveActor, subPrefix, union };
@@ -1,7 +1,7 @@
1
1
  import { r as parseProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { P as toStorable } from "./schemas-CUSTEFIy.mjs";
3
- import { r as badRequest } from "./errors-BfMR39F0.mjs";
4
- import { u as parseCan } from "./access-CIj7v_Dr.mjs";
3
+ import { r as badRequest } from "./errors-DjatfYjl.mjs";
4
+ import { u as parseCan } from "./access-CZ419Vho.mjs";
5
5
  import { t as own } from "./own-OwgPWdmh.mjs";
6
6
  //#region src/server/actors.ts
7
7
  /** Agents whose marks the board serves at `/avatars/<name>`, for a caller to pass as an avatar. */
@@ -1,5 +1,5 @@
1
- import { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-BfMR39F0.mjs";
2
- import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-CIj7v_Dr.mjs";
1
+ import { d as unauthorized, o as forbidden, r as badRequest, t as HttpError } from "./errors-DjatfYjl.mjs";
2
+ import { c as compileAccess, l as decide, p as writtenCan, s as combine, t as FULL_ACCESS, u as parseCan } from "./access-CZ419Vho.mjs";
3
3
  //#region src/server/grants.ts
4
4
  /**
5
5
  * How close `principal` is to the caller, or null when it doesn't name it: `principal` for its own
@@ -1,2 +1,2 @@
1
- import { t as local } from "./local-Gp8pqHSu.mjs";
1
+ import { t as local } from "./local-BiG1WJk0.mjs";
2
2
  export { local };
@@ -1,8 +1,8 @@
1
- import { t as HttpError } from "./errors-BfMR39F0.mjs";
2
- import { u as METHODS } from "./task-batch-DgyfK9qx.mjs";
1
+ import { t as HttpError } from "./errors-DjatfYjl.mjs";
2
+ import { u as METHODS } from "./task-batch-YMVr_c5R.mjs";
3
3
  import { C as duplicateBatchError, D as supersededAttemptError, E as sessionClearedError, T as lastIndexMismatchError, b as CLEAR_EVENT_TYPE, m as nullProtoRecord, n as NOTIFY_TIMINGS, r as POLL_TIMINGS, y as A2Error } from "./internal-CvsrprnU-DhZF6sZK.mjs";
4
4
  import { a as retryableLazy, o as platformWaitUntil } from "./server-DX7mM6nm-Cq1xPyqJ.mjs";
5
- import { n as a2, t as localScheduler } from "./local-Bt1-jA9A.mjs";
5
+ import { n as a2, t as localScheduler } from "./local-D2i5sxuY.mjs";
6
6
  import { n as defaultSleep, r as pollingStream } from "./store-polling-BZt2Rf3D-nlZUQLz2.mjs";
7
7
  import { r as sqlTables } from "./sql-CvBbb5Ui.mjs";
8
8
  import { n as SYSTEM_CLOCK, t as RANDOM_IDS } from "./store-N8PXxDAS-DWWgv-Vz.mjs";
@@ -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-DLPIX7Jw.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-Dcm4_pc1.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-7FY_8p92.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-DeYAQUcP.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -1,5 +1,5 @@
1
- import { o as stoppedBy } from "./exports-x-ioAfbp.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-Du-mKQZn.mjs";
1
+ import { o as stoppedBy } from "./exports-B_UGnrnN.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-Bbqg3Unf.mjs";
3
3
  //#region src/cli/embedded.ts
4
4
  /**
5
5
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as option } from "./commands-7FY_8p92.mjs";
3
- import { g as projectDir } from "./server-BSexF7Bk.mjs";
4
- import { r as main } from "./main-Du-mKQZn.mjs";
5
- import { i as createInspector, r as stopped, t as allowedHosts } from "./inspect-BFnDSdsq.mjs";
2
+ import { a as option } from "./commands-DeYAQUcP.mjs";
3
+ import { _ as projectDir } from "./server-BXbcS-n9.mjs";
4
+ import { r as main } from "./main-Bbqg3Unf.mjs";
5
+ import { i as createInspector, r as stopped, t as allowedHosts } from "./inspect-DfJzHFiE.mjs";
6
6
  import { appendFile, readFile } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
8
  //#region src/cli/local.ts
@@ -37,7 +37,7 @@ const local = {
37
37
  },
38
38
  async run(args, context) {
39
39
  if (args.length > 0) throw context.usage("inspect takes no arguments: pass its port with --port.");
40
- return (await import("./inspect-BuNsu2z6.mjs")).inspect(context);
40
+ return (await import("./inspect-H1MISWwN.mjs")).inspect(context);
41
41
  }
42
42
  },
43
43
  serve: {
@@ -81,7 +81,7 @@ const local = {
81
81
  }, "tailscale");
82
82
  if (tailscale.length > 0 && hosts.length > 0) throw usage("--tailscale takes Tailscale's word for who's calling, which another proxy in front could forge: it doesn't go with --allow-host.");
83
83
  const root = projectDir();
84
- const { serveLocal } = await import("./serve-xOoxwq7T.mjs");
84
+ const { serveLocal } = await import("./serve-D06-DMej.mjs");
85
85
  const local = await serveLocal({
86
86
  dir: flags.dir ?? join(root, ".board"),
87
87
  hosts,
@@ -301,7 +301,7 @@ declare const options: {
301
301
  readonly github: {
302
302
  readonly type: 'string';
303
303
  readonly multiple: true;
304
- readonly value: 'owner/repo';
304
+ readonly value: 'owner/repo|id';
305
305
  readonly description: "GitHub Actions' runs in a repository";
306
306
  };
307
307
  readonly oidc: {
@@ -378,7 +378,7 @@ declare const options: {
378
378
  readonly 'add-github': {
379
379
  readonly type: 'string';
380
380
  readonly multiple: true;
381
- readonly value: 'owner/repo';
381
+ readonly value: 'owner/repo|id';
382
382
  readonly description: "add a repository's runs";
383
383
  };
384
384
  readonly 'add-oidc': {
@@ -424,7 +424,7 @@ declare const options: {
424
424
  readonly 'remove-github': {
425
425
  readonly type: 'string';
426
426
  readonly multiple: true;
427
- readonly value: 'owner/repo';
427
+ readonly value: 'owner/repo|id';
428
428
  readonly description: "remove a repository's runs";
429
429
  };
430
430
  readonly 'remove-oidc': {
@@ -249,7 +249,7 @@ const options = {
249
249
  github: {
250
250
  type: "string",
251
251
  multiple: true,
252
- value: "owner/repo",
252
+ value: "owner/repo|id",
253
253
  description: "GitHub Actions' runs in a repository"
254
254
  },
255
255
  oidc: {
@@ -326,7 +326,7 @@ const options = {
326
326
  "add-github": {
327
327
  type: "string",
328
328
  multiple: true,
329
- value: "owner/repo",
329
+ value: "owner/repo|id",
330
330
  description: "add a repository's runs"
331
331
  },
332
332
  "add-oidc": {
@@ -372,7 +372,7 @@ const options = {
372
372
  "remove-github": {
373
373
  type: "string",
374
374
  multiple: true,
375
- value: "owner/repo",
375
+ value: "owner/repo|id",
376
376
  description: "remove a repository's runs"
377
377
  },
378
378
  "remove-oidc": {
@@ -746,7 +746,7 @@ const commands = [
746
746
  {
747
747
  group: "the board",
748
748
  name: "channels",
749
- description: "channels, a page at a time, grouped by path prefix: a first post makes one, and so does create",
749
+ description: "channels, a page at a time, grouped by path prefix: a first post makes one, and so does channels create",
750
750
  arguments: [{
751
751
  name: "prefix",
752
752
  required: false,
@@ -1289,8 +1289,9 @@ const commands = [
1289
1289
  option("for", "only this profile of yours claims it", "profile"),
1290
1290
  claimNow,
1291
1291
  option("lease", "with --claim: how long to hold it"),
1292
+ option("attach"),
1292
1293
  option("file", "a plan, from a JSON file (- reads stdin): an array of tasks, each { key?, text, labels?, needs?, for?, noSync?, attachments? }, all made, in as many writes as it takes. needs takes a key of the plan (\"fix\" or {\"key\": \"fix\"}) or a task that's there by its ID (\"812\" or {\"id\": \"812\"})"),
1293
- option("no-sync"),
1294
+ option("no-sync", "keep it on the board: sync it nowhere. With --file, each task that sets no noSync of its own"),
1294
1295
  option("idempotency-key", "sending the same one again makes it once")
1295
1296
  ],
1296
1297
  examples: [
@@ -1302,6 +1303,10 @@ const commands = [
1302
1303
  name: "a review that waits for it",
1303
1304
  value: "tasks create work \"review the fix for CVE-123\" --label step=review --needs 812"
1304
1305
  },
1306
+ {
1307
+ name: "hand over a job with its file",
1308
+ value: "tasks create work \"build it\" --attach job.json"
1309
+ },
1305
1310
  {
1306
1311
  name: "make a task of a thread that is there",
1307
1312
  value: "tasks create 812"
@@ -1,6 +1,6 @@
1
- import { f as BoardError } from "./errors-BfMR39F0.mjs";
1
+ import { f as BoardError } from "./errors-DjatfYjl.mjs";
2
2
  import { c as canonical, t as block } from "./blocks-CVoBC7ur.mjs";
3
- import { a as canText, c as compileAccess } from "./access-CIj7v_Dr.mjs";
3
+ import { a as canText, c as compileAccess } from "./access-CZ419Vho.mjs";
4
4
  //#region src/client/channels.ts
5
5
  /** Every channel of a board, or every one whose path starts with `prefix`, a page at a time: for what needs them all. */
6
6
  async function everyChannel(board, prefix) {
@@ -1,2 +1,2 @@
1
- import { t as conformance } from "./conformance-FiQ68adg.mjs";
1
+ import { t as conformance } from "./conformance-EtEq22w1.mjs";
2
2
  export { conformance };
@@ -1,10 +1,10 @@
1
1
  import { f as typeOf, i as ATTACHMENT_BYTES_MAX, l as fileSize, o as IMPORT_BYTES_MAX, u as importedFileName } from "./profile-header-O8wC8yk8.mjs";
2
2
  import { P as toStorable, m as MESSAGE_TEXT_MAX, s as ChannelPath } from "./schemas-CUSTEFIy.mjs";
3
3
  import { l as isThreadTarget, s as channelOf } from "./external-DkWafjn-.mjs";
4
- import { c as notFound, r as badRequest, t as HttpError } from "./errors-BfMR39F0.mjs";
4
+ import { c as notFound, r as badRequest, t as HttpError, v as derivedId } from "./errors-DjatfYjl.mjs";
5
5
  import { t as canonicalEmoji } from "./emoji-CTLpvH-A.mjs";
6
- import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, m as derivedId, o as actorParts, t as DroppedError } from "./middleware-bIABV895.mjs";
7
6
  import { n as isEmail, s as replaceMentions, t as extractMentions } from "./mentions-DBGmqkr2.mjs";
7
+ import { a as waitUntil, c as platformProfile, f as viaText, i as afterRetry, l as shownName, o as actorParts, t as DroppedError } from "./middleware-D2AGrGj7.mjs";
8
8
  import { a as immutable, d as opensBlock, f as routesFor, l as UnreadableError, n as SyncOverrides, o as ReceivedEvent, s as ResolvedTarget, u as channelMissing } from "./events-mWKc1uvZ.mjs";
9
9
  import { i as vercelDeployments, n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
10
10
  //#region src/sync/engine.ts
@@ -1126,6 +1126,162 @@ async function* parseSse(body, signal) {
1126
1126
  }
1127
1127
  }
1128
1128
  //#endregion
1129
+ //#region src/client/ids.ts
1130
+ const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
1131
+ const K = new Uint32Array([
1132
+ 1116352408,
1133
+ 1899447441,
1134
+ 3049323471,
1135
+ 3921009573,
1136
+ 961987163,
1137
+ 1508970993,
1138
+ 2453635748,
1139
+ 2870763221,
1140
+ 3624381080,
1141
+ 310598401,
1142
+ 607225278,
1143
+ 1426881987,
1144
+ 1925078388,
1145
+ 2162078206,
1146
+ 2614888103,
1147
+ 3248222580,
1148
+ 3835390401,
1149
+ 4022224774,
1150
+ 264347078,
1151
+ 604807628,
1152
+ 770255983,
1153
+ 1249150122,
1154
+ 1555081692,
1155
+ 1996064986,
1156
+ 2554220882,
1157
+ 2821834349,
1158
+ 2952996808,
1159
+ 3210313671,
1160
+ 3336571891,
1161
+ 3584528711,
1162
+ 113926993,
1163
+ 338241895,
1164
+ 666307205,
1165
+ 773529912,
1166
+ 1294757372,
1167
+ 1396182291,
1168
+ 1695183700,
1169
+ 1986661051,
1170
+ 2177026350,
1171
+ 2456956037,
1172
+ 2730485921,
1173
+ 2820302411,
1174
+ 3259730800,
1175
+ 3345764771,
1176
+ 3516065817,
1177
+ 3600352804,
1178
+ 4094571909,
1179
+ 275423344,
1180
+ 430227734,
1181
+ 506948616,
1182
+ 659060556,
1183
+ 883997877,
1184
+ 958139571,
1185
+ 1322822218,
1186
+ 1537002063,
1187
+ 1747873779,
1188
+ 1955562222,
1189
+ 2024104815,
1190
+ 2227730452,
1191
+ 2361852424,
1192
+ 2428436474,
1193
+ 2756734187,
1194
+ 3204031479,
1195
+ 3329325298
1196
+ ]);
1197
+ /** SHA-256 in plain JavaScript, for a page WebCrypto's digest isn't on: one served over plain http to another host. */
1198
+ function sha256Bytes(data) {
1199
+ const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
1200
+ padded.set(data);
1201
+ padded[data.length] = 128;
1202
+ const view = new DataView(padded.buffer);
1203
+ view.setUint32(padded.length - 8, Math.floor(data.length / 536870912));
1204
+ view.setUint32(padded.length - 4, data.length * 8);
1205
+ const h = new Uint32Array([
1206
+ 1779033703,
1207
+ 3144134277,
1208
+ 1013904242,
1209
+ 2773480762,
1210
+ 1359893119,
1211
+ 2600822924,
1212
+ 528734635,
1213
+ 1541459225
1214
+ ]);
1215
+ const w = /* @__PURE__ */ new Uint32Array(64);
1216
+ const rotr = (x, n) => x >>> n | x << 32 - n;
1217
+ for (let at = 0; at < padded.length; at += 64) {
1218
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(at + i * 4);
1219
+ for (let i = 16; i < 64; i++) {
1220
+ const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
1221
+ const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ w[i - 2] >>> 10;
1222
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1;
1223
+ }
1224
+ let [a, b, c, d, e, f, g, k] = h;
1225
+ for (let i = 0; i < 64; i++) {
1226
+ const t1 = k + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + (e & f ^ ~e & g) + K[i] + w[i] >>> 0;
1227
+ const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
1228
+ k = g;
1229
+ g = f;
1230
+ f = e;
1231
+ e = d + t1 >>> 0;
1232
+ d = c;
1233
+ c = b;
1234
+ b = a;
1235
+ a = t1 + t2 >>> 0;
1236
+ }
1237
+ h[0] += a;
1238
+ h[1] += b;
1239
+ h[2] += c;
1240
+ h[3] += d;
1241
+ h[4] += e;
1242
+ h[5] += f;
1243
+ h[6] += g;
1244
+ h[7] += k;
1245
+ }
1246
+ const out = /* @__PURE__ */ new Uint8Array(32);
1247
+ const result = new DataView(out.buffer);
1248
+ h.forEach((word, i) => result.setUint32(i * 4, word));
1249
+ return out;
1250
+ }
1251
+ /** SHA-256 of `data`: WebCrypto's where the page has it, plain JavaScript where it doesn't. */
1252
+ async function digest(data) {
1253
+ const bytes = Uint8Array.from(data instanceof ArrayBuffer ? new Uint8Array(data) : data);
1254
+ if (globalThis.crypto?.subtle) return new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
1255
+ return sha256Bytes(bytes);
1256
+ }
1257
+ /** SHA-256 of `text`, in hex. */
1258
+ async function sha256(text) {
1259
+ return hex(await digest(new TextEncoder().encode(text)));
1260
+ }
1261
+ /**
1262
+ * A UUIDv8 from `parts`, exactly as A2's `idempotentId` makes one: the IDs a board derives for the
1263
+ * writes its own code makes, which no request may post with.
1264
+ */
1265
+ async function derivedId(...parts) {
1266
+ const bytes = (await digest(new TextEncoder().encode(JSON.stringify(parts)))).slice(0, 16);
1267
+ bytes[6] = bytes[6] & 15 | 128;
1268
+ bytes[8] = bytes[8] & 63 | 128;
1269
+ const text = hex(bytes);
1270
+ return `${text.slice(0, 8)}-${text.slice(8, 12)}-${text.slice(12, 16)}-${text.slice(16, 20)}-${text.slice(20, 32)}`;
1271
+ }
1272
+ /** A derived ID's shape. */
1273
+ const DERIVED_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-8[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
1274
+ /**
1275
+ * A post's ID, from one derived for it, under `principal`: a board takes a `key:<principal>:` ID
1276
+ * only from that principal, so no one else can post with it first.
1277
+ */
1278
+ const keyId = async (principal, derived) => `key:${principal}:${(await sha256(`board-key\u001f${derived}`)).slice(0, 32)}`;
1279
+ /**
1280
+ * Whether `id` is exactly the shape `keyId` makes for `principal`. A prefix check isn't enough:
1281
+ * a principal's ID can be the start of another's (`oidc:gitlab.com:acme` and `oidc:gitlab.com:acme:ci`).
1282
+ */
1283
+ const isKeyIdOf = (id, principal) => id.startsWith(`key:${principal}:`) && /^[0-9a-f]{32}$/.test(id.slice(`key:${principal}:`.length));
1284
+ //#endregion
1129
1285
  //#region src/client/client.ts
1130
1286
  /**
1131
1287
  * What went wrong: `message` says what and why, `code` is what to branch on, `hint`, when there's
@@ -1692,7 +1848,7 @@ function createBoardClient(options) {
1692
1848
  if (size > 4194304) {
1693
1849
  if (size > 104857600) throw new BoardError("too_large", `Attachments are at most ${DIRECT_UPLOAD_BYTES_MAX / 1024 / 1024} MB.`, 413);
1694
1850
  const bytes = input.data instanceof Blob ? await input.data.arrayBuffer() : input.data;
1695
- const sha256 = btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))));
1851
+ const sha256 = btoa(String.fromCharCode(...await digest(bytes)));
1696
1852
  const ticket = await call("POST", "/attachments/uploads", { body: {
1697
1853
  name: input.name,
1698
1854
  type,
@@ -1883,9 +2039,12 @@ function createBoardClient(options) {
1883
2039
  /**
1884
2040
  * The code of a refusal, as a board or Vercel's API answered it. Vercel's API refuses a team whose SAML
1885
2041
  * session has lapsed with a 403 marked `saml`: `reauthentication_required`, which a new login fixes and a grant doesn't.
2042
+ * It refuses a token that expired or was revoked with a 403 marked `invalidToken`: `invalid_token`, which a
2043
+ * refreshed or new login fixes, and a grant doesn't either.
1886
2044
  */
1887
2045
  function refusalCode(status, error) {
1888
2046
  if (status === 403 && error?.saml === true) return "reauthentication_required";
2047
+ if (status === 403 && error?.invalidToken === true) return "invalid_token";
1889
2048
  return error?.code;
1890
2049
  }
1891
2050
  async function toError(response) {
@@ -1998,4 +2157,4 @@ function toErrorResponse(error) {
1998
2157
  } }, 500);
1999
2158
  }
2000
2159
  //#endregion
2001
- export { ScheduleBody as $, CreateTasksBody as A, InboxNextQuery as B, ChannelsQuery as C, CreateChannelBody as D, CompleteTaskBody as E, ExplainQuery as F, MatchesQuery as G, InboxQuery as H, FailTaskBody as I, Ref as J, PostBody as K, Filters as L, DeleteBody as M, EditBody as N, CreateGrantsBody as O, EventsQuery as P, RevokeGrantBody as Q, GrantBody as R, ChannelMessagesQuery as S, ClaimTaskBody as T, LabelBody as U, InboxPushBody as V, LinkedQuery as W, ReleaseTaskBody as X, RegisterBody as Y, RenewTaskBody as Z, AckBody as _, duplicateId as a, SyncCopiesQuery as at, BlockTaskBody as b, notFound as c, SyncReceiptBody as ct, unauthorized as d, ThreadQuery as dt, SchedulesQuery as et, BoardError as f, ThreadsQuery as ft, refusalCode as g, routes as gt, eventsState as h, UploadStartBody as ht, batchTooLarge as i, SyncBody as it, CreatedTasksQuery as j, CreateTaskBody as k, textTooLong as l, TaskNeedsBody as lt, duration as m, UpdateGrantBody as mt, RejectedError as n, SourceJoinBody as nt, forbidden as o, SyncFindQuery as ot, createBoardClient as p, TypingBody as pt, ReactBody as q, badRequest as r, SourceReadQuery as rt, json as s, SyncImportBody as st, HttpError as t, SchemaBody as tt, toErrorResponse as u, TasksQuery as ut, ActorsQuery as v, ClaimReadyTaskBody as w, CancelTaskBody as x, AssignTaskBody as y, InboxAckBody as z };
2160
+ export { Ref as $, ClaimTaskBody as A, ExplainQuery as B, ActorsQuery as C, ChannelMessagesQuery as D, CancelTaskBody as E, CreateTasksBody as F, InboxNextQuery as G, Filters as H, CreatedTasksQuery as I, LabelBody as J, InboxPushBody as K, DeleteBody as L, CreateChannelBody as M, CreateGrantsBody as N, ChannelsQuery as O, CreateTaskBody as P, ReactBody as Q, EditBody as R, AckBody as S, BlockTaskBody as T, GrantBody as U, FailTaskBody as V, InboxAckBody as W, MatchesQuery as X, LinkedQuery as Y, PostBody as Z, DERIVED_ID as _, ThreadsQuery as _t, duplicateId as a, SchedulesQuery as at, keyId as b, UploadStartBody as bt, notFound as c, SourceReadQuery as ct, unauthorized as d, SyncFindQuery as dt, RegisterBody as et, BoardError as f, SyncImportBody as ft, refusalCode as g, ThreadQuery as gt, eventsState as h, TasksQuery as ht, batchTooLarge as i, ScheduleBody as it, CompleteTaskBody as j, ClaimReadyTaskBody as k, textTooLong as l, SyncBody as lt, duration as m, TaskNeedsBody as mt, RejectedError as n, RenewTaskBody as nt, forbidden as o, SchemaBody as ot, createBoardClient as p, SyncReceiptBody as pt, InboxQuery as q, badRequest as r, RevokeGrantBody as rt, json as s, SourceJoinBody as st, HttpError as t, ReleaseTaskBody as tt, toErrorResponse as u, SyncCopiesQuery as ut, derivedId as v, TypingBody as vt, AssignTaskBody as w, sha256 as x, routes as xt, isKeyIdOf as y, UpdateGrantBody as yt, EventsQuery as z };