@vercel/board 0.54.0 → 0.54.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.
@@ -1,7 +1,7 @@
1
1
  import { i as ATTACHMENT_BYTES_MAX, r as parseProfileHeader, t as InvalidProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { t as Failed, u as who } from "./main-B_gzTjBR.mjs";
4
- import { n as relative, r as shell, t as CSP } from "./shell-Cqn38XUs.mjs";
3
+ import { t as Failed, u as who } from "./main-Dicvkp6D.mjs";
4
+ import { n as relative, r as shell, t as CSP } from "./shell-DsDyOFd1.mjs";
5
5
  import { t as page } from "./page-7KWSGxyC.mjs";
6
6
  import { randomBytes, timingSafeEqual } from "node:crypto";
7
7
  import { createServer } from "node:http";
@@ -0,0 +1,2 @@
1
+ import { n as inspect } from "./inspect-Cb1Sj8QV.mjs";
2
+ export { inspect };
package/dist/inspect.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as ATTACHMENT_BYTES_MAX, r as parseProfileHeader, t as InvalidProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
- import { n as relative, r as shell, t as CSP } from "./shell-Cqn38XUs.mjs";
3
+ import { n as relative, r as shell, t as CSP } from "./shell-DsDyOFd1.mjs";
4
4
  import { t as page } from "./page-7KWSGxyC.mjs";
5
5
  //#region src/inspect/handler.ts
6
6
  /**
@@ -5,9 +5,9 @@ import { a as duplicateId, c as notFound, f as BoardError, i as batchTooLarge, l
5
5
  import { a as waitUntil, c as platformProfile, d as userIdOf, h as isKeyIdOf, l as shownName, m as derivedId, n as MIDDLEWARE_ACTOR, o as actorParts, s as importedHandle, t as DroppedError } from "./middleware-BY4qqIh3.mjs";
6
6
  import { a as SCHEMA_DESCRIPTION_MAX, c as canonical, d as parseSchemaId, f as schemaId, i as BUILT_IN_SCHEMAS, l as checkDefinition, n as blocksIn, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX, u as isBuiltInName } from "./blocks-CVoBC7ur.mjs";
7
7
  import { a as replaceMentions, i as mentionTerms, n as isEmail, r as mentionTerm, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
8
- import { t as VERSION } from "./version-DBaKHEZS.mjs";
8
+ import { t as VERSION } from "./version-1isUFDyU.mjs";
9
9
  import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-HzqFpgL_.mjs";
10
- import { _ as SYNC, a as runMatch, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-CVamHB-W.mjs";
10
+ import { _ as SYNC, a as runMatch, g as uploadName, h as carried, i as canonicalWatchers, l as METHODS, n as SYNC_ACTOR, o as compileWatcher, r as syncTarget, s as hasCriteria, t as batchPlan } from "./task-batch-BviIruES.mjs";
11
11
  import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
12
12
  import { E as wroteAs, T as workflowPath, b as removes, c as checkCan, g as joined, h as issuerName, l as checkGrant, n as GITHUB_ISSUER, p as grantIssuers, s as authenticates, u as checkPrincipal } from "./auth-D9ycDQK0.mjs";
13
13
  import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-D-u6bitG.mjs";
@@ -5,13 +5,13 @@ import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
5
5
  import { l as shownName } from "./middleware-BY4qqIh3.mjs";
6
6
  import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
7
7
  import { a as replaceMentions, n as isEmail, t as extractMentions } from "./mentions-CnWt9Z5b.mjs";
8
- import { t as VERSION } from "./version-DBaKHEZS.mjs";
8
+ import { t as VERSION } from "./version-1isUFDyU.mjs";
9
9
  import { r as PERMISSIONS } from "./access-HzqFpgL_.mjs";
10
- import { c as withMentions } from "./task-batch-CVamHB-W.mjs";
11
- import { a as isBoardName, c as isApiMessageId, n as createTasksInChunks, t as TasksInChunksError } from "./exports-JUhj5Bl3.mjs";
12
- import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-B5SXeo4W.mjs";
13
- import { _ as vercelProjectFile, a as vercel, c as boardUrl, d as environmentProfile, f as handFetch, i as handTeam, l as configDir, m as handToken, n as credentialSource, o as http, p as handLogin, r as credentialed, t as board, u as connect } from "./server-CdBXNUxf.mjs";
14
- import { n as everyChannel, t as conformance } from "./conformance-CyQG0jky.mjs";
10
+ import { c as withMentions } from "./task-batch-BviIruES.mjs";
11
+ import { a as isBoardName, l as isApiMessageId, n as createTasksInChunks, s as apiThreadRoot, t as TasksInChunksError } from "./exports-D6Q99t_O.mjs";
12
+ import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-D8HctFGJ.mjs";
13
+ import { _ as vercelProjectFile, a as vercel, c as boardUrl, d as environmentProfile, f as handFetch, i as handTeam, l as configDir, m as handToken, n as credentialSource, o as http, p as handLogin, r as credentialed, t as board, u as connect } from "./server--J1DfQjI.mjs";
14
+ import { n as everyChannel, t as conformance } from "./conformance-BNiLcKra.mjs";
15
15
  import { n as displayText, t as byVercelBot } from "./bots-CqPYxkqK.mjs";
16
16
  import { spawn } from "node:child_process";
17
17
  import { createHash, randomUUID } from "node:crypto";
@@ -1226,6 +1226,21 @@ function closest(word, known) {
1226
1226
  }
1227
1227
  return best !== void 0 && distance > 0 && distance <= (word.length >= 6 ? 2 : 1) ? best : void 0;
1228
1228
  }
1229
+ /**
1230
+ * The channel a name that's no channel's likely means: one close to it, or the one whose path ends in it, like
1231
+ * `factory/v0/v0-errors` for `v0-errors`, a channel's last part that leaves out the path it's under. Several that
1232
+ * end in it are each named.
1233
+ */
1234
+ function closestChannel(name, channels) {
1235
+ const close = closest(name, channels);
1236
+ if (close) return close;
1237
+ const tail = `/${name.replace(/^\/+|\/+$/g, "")}`;
1238
+ if (tail === "/") return void 0;
1239
+ const ending = channels.filter((path) => path.endsWith(tail) || path.endsWith(`${tail}/`));
1240
+ if (!ending.length) return void 0;
1241
+ if (ending.length <= 3) return ending.join(" or ");
1242
+ return `${ending.slice(0, 3).join(", ")}, or ${ending.length - 3} more`;
1243
+ }
1229
1244
  /** How many edits turn `a` into `b`, a swap of neighbors counting as one. */
1230
1245
  function edits(a, b) {
1231
1246
  const d = Array.from({ length: a.length + 1 }, (_, i) => Array.from({ length: b.length + 1 }, (_, j) => i === 0 ? j : j === 0 ? i : 0));
@@ -1422,6 +1437,8 @@ let typed = [];
1422
1437
  let warnings = [];
1423
1438
  /** The board this run reached by its URL, for a failure to name. */
1424
1439
  let reached = null;
1440
+ /** The team whose default board this run reached, nothing naming one of its boards: `--scope`'s, or the one the environment finds. */
1441
+ let teamDefault = null;
1425
1442
  /** Where the credential this run sent came from, as `whoami` says it, for a refusal to say which to replace. */
1426
1443
  let sent = () => null;
1427
1444
  /** How long the message text this run sends is, for a backend's refusal of it to say what to do instead. */
@@ -1651,7 +1668,7 @@ function messageId(value, what = "message ID") {
1651
1668
  const id = value?.replace(/^#/, "") ?? "";
1652
1669
  if (value === void 0) throw usage(`Missing the ${what}.`, { reason: "missing_arguments" });
1653
1670
  if (!/^[^\s/]+$/.test(id)) throw usage(`${value} isn't a ${what}.`);
1654
- return id;
1671
+ return apiThreadRoot(id) ?? id;
1655
1672
  }
1656
1673
  /** Characters that change how a name reads without showing: invisible formatting (bidi overrides, zero-width), and line and paragraph separators. */
1657
1674
  const INVISIBLE = /[\p{Cf}\u2028\u2029]/gu;
@@ -1674,8 +1691,17 @@ const tooLarge = (path) => new Failed({
1674
1691
  reason: "payload_too_large",
1675
1692
  message: `Can't attach ${path}. It's over ${DIRECT_UPLOAD_BYTES_MAX / 1024 / 1024} MB, the most an attachment can be.`
1676
1693
  });
1677
- /** Whether an ID goes in and out bare: a number, or one Vercel's API hands out (`msg_…`), a message even where a channel has its name. */
1678
- const bareId = (value) => /^\d+$/.test(value) || isApiMessageId(value);
1694
+ /** Whether an ID goes in and out bare: a number, or one Vercel's API hands out (`msg_…`, or a thread's `thr_…`), a message even where a channel has its name. */
1695
+ const bareId = (value) => /^\d+$/.test(value) || isApiMessageId(value) || apiThreadRoot(value) !== null;
1696
+ /**
1697
+ * What a value that starts like Vercel's message or thread ID but isn't a whole one (a copy cut short) would be
1698
+ * whole: its thread's root, when the thread's part is all there, or only that it's cut short.
1699
+ */
1700
+ const partialApiId = (value) => {
1701
+ if (!/^(?:msg|thr)_[0-9a-f-]/.test(value) || bareId(value)) return null;
1702
+ const thread = /^(?:msg|thr)_([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})_?$/.exec(value);
1703
+ return { root: thread ? `msg_${thread[1]}_1` : null };
1704
+ };
1679
1705
  /** Whether an argument names a message rather than a channel: `#<id>`, or an ID that goes bare. */
1680
1706
  const isMessageRef = (value) => /^#[^\s/]+$/.test(value) || bareId(value);
1681
1707
  /** A message's ID as it's passed back: bare when it goes bare, `#<id>` when it could be a channel's name. */
@@ -1740,6 +1766,7 @@ function oneText(command, target, extra) {
1740
1766
  first
1741
1767
  ]
1742
1768
  }] });
1769
+ if (flags.schema !== void 0 && first !== "-") throw usage(`With --schema, the text is ${flags.schema}'s JSON alone, and ${first.length > 40 ? `${first.slice(0, 40)}…` : first} is one too many. To say something with the data, leave out --schema and put the JSON in the text in a \`\`\`json#${flags.schema} fence.`);
1743
1770
  throw usage(first === "-" ? `${command} takes one text, and - (stdin) is a second. For a long message, pass - alone as the text: it has no title.` : `${command} takes one text, and ${first.length > 40 ? `${first.slice(0, 40)}…` : first} is one too many. Quote the whole message as one argument: it has no title.`);
1744
1771
  }
1745
1772
  /**
@@ -2177,7 +2204,17 @@ function failureOf(error) {
2177
2204
  message: `Can't ${doing()}. ${sentence(message)}`
2178
2205
  };
2179
2206
  case "no_team": return {
2180
- ...own("platform", "api_error"),
2207
+ ...own("platform", "api_error", [
2208
+ ...fix,
2209
+ {
2210
+ instruction: "Use a team's board",
2211
+ argv: rerun("--scope", "<TEAM>")
2212
+ },
2213
+ {
2214
+ instruction: "Or a board at a URL (or set BOARD_URL)",
2215
+ argv: rerun("--url", "<URL>")
2216
+ }
2217
+ ]),
2181
2218
  message: "Couldn't tell which team's board to use.",
2182
2219
  details: [message]
2183
2220
  };
@@ -2448,6 +2485,7 @@ function connection(url = flags.url, options = {}) {
2448
2485
  const name = boardNameFlag(url, team);
2449
2486
  const configured = url ?? (team === void 0 && name === void 0 ? configuredUrl() : null);
2450
2487
  if (configured === null) {
2488
+ if (name === void 0) teamDefault = { team };
2451
2489
  const board$1 = board({
2452
2490
  backend: vercel({
2453
2491
  ...team !== void 0 ? { team } : {},
@@ -2822,16 +2860,28 @@ async function run(command, args) {
2822
2860
  if (!page.threads.length && target && !scanned) {
2823
2861
  const channels = (await everyChannel(board)).map((c) => c.path);
2824
2862
  if (!channels.some((path) => path === target || path.startsWith(target.replace(/\/?$/, "/")))) {
2825
- const guess = closest(target, channels);
2863
+ const partial = partialApiId(target);
2864
+ const guess = partial ? partial.root : closestChannel(target, channels);
2826
2865
  throw new Failed({
2827
2866
  class: "not_found",
2828
2867
  reason: "channel_not_found",
2829
2868
  message: `Couldn't find channel ${target}.${guess ? ` Did you mean ${guess}?` : ""}`,
2830
- details: ["A channel appears with its first post: one nobody has posted in yet is not there to read."],
2869
+ details: [
2870
+ ...partial ? [`It looks like a message ID cut short: a whole one is msg_<thread>_<n>, ending in the message's number. Check the full ID.`] : [],
2871
+ "A channel appears with its first post: one nobody has posted in yet is not there to read.",
2872
+ ...teamDefault ? [`This is ${teamDefault.team ?? "the team"}'s default board: --name reads another of its boards.`] : []
2873
+ ],
2831
2874
  next: [{
2832
2875
  instruction: "See its channels",
2833
- argv: [...cli(), "channels"]
2834
- }]
2876
+ argv: [
2877
+ ...cli(),
2878
+ "channels",
2879
+ ...teamDefault?.team !== void 0 ? ["--scope", teamDefault.team] : []
2880
+ ]
2881
+ }, ...teamDefault ? [{
2882
+ instruction: "Read it on another of the team's boards",
2883
+ argv: rerun("--name", "<BOARD>")
2884
+ }] : []]
2835
2885
  });
2836
2886
  }
2837
2887
  }
@@ -3880,7 +3930,7 @@ async function tasks(args) {
3880
3930
  if (!channels.some((path) => path === name || path.startsWith(`${name}/`))) {
3881
3931
  const meant = closest(verb, TASK_VERBS);
3882
3932
  if (meant) throw usage(`Unknown command ${verb} for ${named()} tasks. Did you mean ${meant}?`, { reason: "unknown_command" });
3883
- const guess = closest(verb, channels);
3933
+ const guess = closestChannel(verb, channels);
3884
3934
  throw new Failed({
3885
3935
  class: "not_found",
3886
3936
  reason: "channel_not_found",
@@ -4659,6 +4709,7 @@ async function runOnce(argv, options) {
4659
4709
  positionals = [];
4660
4710
  warnings = [];
4661
4711
  reached = null;
4712
+ teamDefault = null;
4662
4713
  sent = () => null;
4663
4714
  sentLength = 0;
4664
4715
  self = null;
@@ -1,9 +1,9 @@
1
1
  import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-DDfXnZ2b.mjs";
2
- import { i as hostCheckedBy } from "./exports-JUhj5Bl3.mjs";
2
+ import { i as hostCheckedBy } from "./exports-D6Q99t_O.mjs";
3
3
  import { i as LOGINS, r as LOGIN } from "./auth-D9ycDQK0.mjs";
4
- import { h as localTokenFile, t as board } from "./server-CdBXNUxf.mjs";
4
+ import { h as localTokenFile, t as board } from "./server--J1DfQjI.mjs";
5
5
  import { t as oidcTokens } from "./tokens-B3gXkQCs.mjs";
6
- import { t as local } from "./local-RoMUU6QX.mjs";
6
+ import { t as local } from "./local-BtzF9fRs.mjs";
7
7
  import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
8
8
  import { userInfo } from "node:os";
9
9
  import { dirname, join, resolve } from "node:path";
@@ -2,8 +2,8 @@ import { n as formatProfileHeader } from "./profile-header-O8wC8yk8.mjs";
2
2
  import "./schemas-CUSTEFIy.mjs";
3
3
  import { f as BoardError, ht as routes, p as createBoardClient, t as HttpError } from "./errors-DDfXnZ2b.mjs";
4
4
  import { g as keyId, p as DERIVED_ID } from "./middleware-BY4qqIh3.mjs";
5
- import { l as METHODS, o as compileWatcher } from "./task-batch-CVamHB-W.mjs";
6
- import { d as tailWatchers, f as deployedOnVercel, l as PROTOCOL_ROUTES, r as createBoard, s as createVercel, u as withoutToken } from "./exports-JUhj5Bl3.mjs";
5
+ import { l as METHODS, o as compileWatcher } from "./task-batch-BviIruES.mjs";
6
+ import { c as createVercel, d as withoutToken, f as tailWatchers, p as deployedOnVercel, r as createBoard, u as PROTOCOL_ROUTES } from "./exports-D6Q99t_O.mjs";
7
7
  import { execFile } from "node:child_process";
8
8
  import { createHash } from "node:crypto";
9
9
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { t as VERSION } from "./version-DBaKHEZS.mjs";
1
+ import { t as VERSION } from "./version-1isUFDyU.mjs";
2
2
  //#region src/inspect/style.ts
3
3
  /**
4
4
  * Just Chat's look: mono, quiet, one accent, hairlines only under headers.
@@ -3,9 +3,9 @@ import "./schemas-CUSTEFIy.mjs";
3
3
  import { l as isThreadTarget } from "./external-DkWafjn-.mjs";
4
4
  import { I as Filters, ht as routes, r as badRequest, t as HttpError } from "./errors-DDfXnZ2b.mjs";
5
5
  import { i as afterRetry } from "./middleware-BY4qqIh3.mjs";
6
- import { t as VERSION } from "./version-DBaKHEZS.mjs";
6
+ import { t as VERSION } from "./version-1isUFDyU.mjs";
7
7
  import { t as own } from "./own-OwgPWdmh.mjs";
8
- import { o as options } from "./commands-B5SXeo4W.mjs";
8
+ import { o as options } from "./commands-D8HctFGJ.mjs";
9
9
  import { z } from "zod";
10
10
  //#region src/server/backend.ts
11
11
  /** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
@@ -1,5 +1,5 @@
1
1
  //#endregion
2
2
  //#region src/version.ts
3
- const VERSION = "0.54.0";
3
+ const VERSION = "0.54.1";
4
4
  //#endregion
5
5
  export { VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/board",
3
- "version": "0.54.0",
3
+ "version": "0.54.1",
4
4
  "description": "Your Vercel team's message board, for people and agents: one durable log, verified authors, live tail, and two-way sync.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,2 +0,0 @@
1
- import { n as inspect } from "./inspect-CrVs-iEi.mjs";
2
- export { inspect };