@vercel/board 0.41.0 → 0.42.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.
- package/dist/{access-C5HaO42b.mjs → access-BgBiaCyx.mjs} +1 -1
- package/dist/access.mjs +4 -4
- package/dist/{actors-nrOf7Y7z.mjs → actors-DkZsnMgA.mjs} +2 -2
- package/dist/{auth-DAlYi6TN.mjs → auth-Ft4AJptx.mjs} +2 -2
- package/dist/{backend-CYsTLxtP.d.mts → backend-DMrK55mU.d.mts} +22 -3
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/cli-commands.d.mts +1 -1
- package/dist/cli-commands.mjs +1 -1
- package/dist/cli-embedded.d.mts +9 -4
- package/dist/cli-embedded.mjs +7 -5
- package/dist/cli.mjs +5 -5
- package/dist/{commands-CrEVjASe.d.mts → commands-BlM-ckFS.d.mts} +3 -3
- package/dist/{commands-QRD0U9AQ.mjs → commands-DeEJJw3i.mjs} +3 -3
- package/dist/{conformance-ClxEEZ9C.mjs → conformance-BORt5nky.mjs} +2 -2
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/digest-dm54M2k8.mjs +4 -0
- package/dist/{engine-8BcNeckB.mjs → engine-BVHSH2Kn.mjs} +2 -2
- package/dist/{errors-DcQf5WeM.mjs → errors-DUzpDSrJ.mjs} +3 -0
- package/dist/exports-Bw_OYNRl.d.mts +4 -0
- package/dist/{exports-B6udRV_E.mjs → exports-kDMIgZVu.mjs} +133 -36
- package/dist/{index-fcpEFCTR.d.mts → index-CydxnBND.d.mts} +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +3 -3
- package/dist/index.node.mjs +3 -3
- package/dist/inspect/app.js +40 -40
- package/dist/inspect-CNW1rLWB.mjs +2 -0
- package/dist/{inspect-DPRoC_Gg.mjs → inspect-CqCXjtPI.mjs} +6 -6
- package/dist/{local-B9y4p6N7.mjs → local-DsJ14yqg.mjs} +23 -7
- package/dist/{main-S0A-c_kP.mjs → main-C4HVA8cc.mjs} +82 -13
- package/dist/{middleware-DHdrxmoc.mjs → middleware-0DUFrav-.mjs} +1 -1
- package/dist/{origin-B3m2lnZC.mjs → origin-Cuu8lW8n.mjs} +4 -4
- package/dist/page-BPTzCBeW.mjs +2 -0
- package/dist/{page-2jjHZmIW.mjs → page-CnjVt5w2.mjs} +2 -2
- package/dist/{serve-B15I2Ibf.mjs → serve-BmabgHV-.mjs} +4 -4
- package/dist/{server-DgpRZ4Nu.mjs → server-CKbE7eMT.mjs} +14 -14
- package/dist/{serving-CALKWs9K.mjs → serving-hcxzaCCO.mjs} +1 -1
- package/dist/{tokens-D7_ZIWpX.mjs → tokens-BSMpTPEe.mjs} +2 -2
- package/docs/01-board/09-access.md +4 -1
- package/docs/04-reference/01-cli.md +7 -5
- package/docs/04-reference/02-board.md +18 -2
- package/package.json +1 -1
- package/dist/digest-Dna1CGa_.mjs +0 -4
- package/dist/exports-C8zsIL1A.d.mts +0 -4
- package/dist/inspect-BsF3mYMY.mjs +0 -2
- package/dist/page-CAUe4GmQ.mjs +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { h as ATTACHMENT_BYTES_MAX } from "./errors-
|
|
1
|
+
import { h as ATTACHMENT_BYTES_MAX } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import "./schemas-DAzSsgWk.mjs";
|
|
3
|
-
import { t as Failed, u as who } from "./main-
|
|
4
|
-
import { t as page } from "./page-
|
|
3
|
+
import { t as Failed, u as who } from "./main-C4HVA8cc.mjs";
|
|
4
|
+
import { t as page } from "./page-CnjVt5w2.mjs";
|
|
5
5
|
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
6
6
|
import { createServer } from "node:http";
|
|
7
7
|
//#region src/inspect/style.ts
|
|
@@ -420,7 +420,7 @@ button.file:hover { background: var(--shade-hover); color: var(--bright); }
|
|
|
420
420
|
.toast { max-width: 420px; padding: 8px 12px; border: 1px solid var(--dim); background: var(--bg); color: var(--bright); }
|
|
421
421
|
`;
|
|
422
422
|
/** The prebuilt UI where board is installed, read only when an inspector starts without one. */
|
|
423
|
-
const bundle = async () => (await import("./page-
|
|
423
|
+
const bundle = async () => (await import("./page-BPTzCBeW.mjs")).page();
|
|
424
424
|
const shell = (token) => `<!doctype html>
|
|
425
425
|
<html lang="en">
|
|
426
426
|
<head>
|
|
@@ -620,8 +620,8 @@ async function pageOf(provided) {
|
|
|
620
620
|
if (found === null) throw new Failed({
|
|
621
621
|
class: "unknown",
|
|
622
622
|
reason: "no_inspector_page",
|
|
623
|
-
message: "The inspector's page isn't
|
|
624
|
-
next: [{ instruction: "
|
|
623
|
+
message: "The inspector's page isn't installed with this CLI.",
|
|
624
|
+
next: [{ instruction: "Reinstall or update the CLI" }]
|
|
625
625
|
});
|
|
626
626
|
return found;
|
|
627
627
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _ as IMPORT_BYTES_MAX, a as forbidden$1, b as mediaType, c as toErrorResponse, f as duration, g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, i as duplicateId, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-
|
|
1
|
+
import { _ as IMPORT_BYTES_MAX, a as forbidden$1, b as mediaType, c as toErrorResponse, f as duration, g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, i as duplicateId, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { _ as actorKind, a as CAN_MAX, b as storable, c as Handle, d as Labels, g as SeenActorKind, h as RemoteWatcherId, i as Author, l as LabelKey, m as MessageText, n as Attachment, o as ChannelPath, p as MessageId, s as Emoji, t as ActorId, v as authorView, y as platformAvatar } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { a as Link, i as ExternalTarget, n as ExternalEvent, o as Origin } from "./external-DymyhUzl.mjs";
|
|
4
4
|
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";
|
|
5
|
-
import { a as compileWatcher, c as METHODS, h as VERSION, i as runMatch, m as SYNC, n as syncTarget, o as hasCriteria, r as canonicalWatchers, t as SYNC_ACTOR } from "./origin-
|
|
6
|
-
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-
|
|
7
|
-
import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-
|
|
8
|
-
import { S as wroteAs, _ as removes, a as authenticates, c as checkPrincipal, d as grantIssuers, m as joined, n as GITHUB_ISSUER, o as checkCan, p as issuerName, s as checkGrant, x as workflowPath } from "./auth-
|
|
5
|
+
import { a as compileWatcher, c as METHODS, h as VERSION, i as runMatch, m as SYNC, n as syncTarget, o as hasCriteria, r as canonicalWatchers, t as SYNC_ACTOR } from "./origin-Cuu8lW8n.mjs";
|
|
6
|
+
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-0DUFrav-.mjs";
|
|
7
|
+
import { c as compileAccess, i as authorize, o as checkGrantChange, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
|
|
8
|
+
import { S as wroteAs, _ as removes, a as authenticates, c as checkPrincipal, d as grantIssuers, m as joined, n as GITHUB_ISSUER, o as checkCan, p as issuerName, s as checkGrant, x as workflowPath } from "./auth-Ft4AJptx.mjs";
|
|
9
9
|
import { n as setOwn, t as own } from "./own-OwgPWdmh.mjs";
|
|
10
|
-
import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-
|
|
10
|
+
import { i as ownedActor, n as actorSeen, o as viaOf } from "./actors-DkZsnMgA.mjs";
|
|
11
11
|
import { C as sessionClearedError, a as SOCKET_TIMINGS, c as drainSettledHooks, d as nullProtoRecord, f as runtimeConsumerFactory, g as A2Error, h as stateTailReaders, i as RESERVED_PARTICIPANT_IDS, l as failedPreviousAttempt, m as serverInternals, n as POLL_TIMINGS, o as STATE_CACHE, p as runtimeConsumers, r as PRESENCE_TIMINGS, s as STREAM_TIMINGS, t as DRAIN_TIMINGS, u as markSchedulerSendFailure, v as NonRetriableError, x as isSessionCleared, y as asStoreUnavailable } from "./internal-CvsrprnU-CEPOUpAv.mjs";
|
|
12
12
|
import { i as streamActivities, n as defaultSleep, t as createStreamActivity } from "./store-polling-BZt2Rf3D-oh3aU_An.mjs";
|
|
13
13
|
import { a as foldActors, i as concernedMessageId, o as foldMessages, s as iso, t as TABLES_CONSUMER } from "./sql-P9g-rLIF.mjs";
|
|
@@ -7384,6 +7384,20 @@ const OWN = {
|
|
|
7384
7384
|
* and sync.
|
|
7385
7385
|
*/
|
|
7386
7386
|
function selfIdentity(caller) {
|
|
7387
|
+
const identity = ownIdentity(caller);
|
|
7388
|
+
if (caller.can === void 0) return identity;
|
|
7389
|
+
const { principal } = identity;
|
|
7390
|
+
return {
|
|
7391
|
+
...identity,
|
|
7392
|
+
principal: {
|
|
7393
|
+
...principal,
|
|
7394
|
+
scope: caller.can,
|
|
7395
|
+
access: principal.access.narrow(parseCan(caller.can))
|
|
7396
|
+
}
|
|
7397
|
+
};
|
|
7398
|
+
}
|
|
7399
|
+
/** Who this deployment's own code is, before a handle's `can` narrows it. */
|
|
7400
|
+
function ownIdentity(caller) {
|
|
7387
7401
|
const { self, origin } = caller;
|
|
7388
7402
|
if (origin.via?.kind === "watcher") return deploymentIdentity(`board:watch:${self}`, self ?? "watch");
|
|
7389
7403
|
if (origin.via?.kind === "middleware") return deploymentIdentity(MIDDLEWARE_ACTOR, "middleware");
|
|
@@ -8040,12 +8054,14 @@ function build(options, binding) {
|
|
|
8040
8054
|
if (!binding.sync.some((entry) => entry.key === key)) throw notFound(`this board doesn't run sync entry ${key}: read it where its sync runs`, "not_synced_here");
|
|
8041
8055
|
const { principal } = await identityOf(caller);
|
|
8042
8056
|
if (!principal.access.everywhere("manage")) throw forbidden$1("this token can't read a source: it needs manage in every channel");
|
|
8057
|
+
unnarrowed(principal, "read a source");
|
|
8043
8058
|
return binding.readSource(key, target, limit ?? 50, after ?? null);
|
|
8044
8059
|
},
|
|
8045
8060
|
async joinSource(caller, { key, target }) {
|
|
8046
8061
|
if (!binding.sync.some((entry) => entry.key === key)) throw notFound(`this board doesn't run sync entry ${key}: join it where its sync runs`, "not_synced_here");
|
|
8047
8062
|
const { principal } = await identityOf(caller);
|
|
8048
8063
|
if (!principal.access.everywhere("manage")) throw forbidden$1("this token can't join a source: it needs manage in every channel");
|
|
8064
|
+
unnarrowed(principal, "join a source");
|
|
8049
8065
|
return binding.joinSource(key, target);
|
|
8050
8066
|
},
|
|
8051
8067
|
async synced(caller, { id }, signal) {
|
|
@@ -8395,7 +8411,7 @@ function build(options, binding) {
|
|
|
8395
8411
|
return { ok: true };
|
|
8396
8412
|
},
|
|
8397
8413
|
async inbox(caller, { key, channel, limit }) {
|
|
8398
|
-
const { principal } = await needSync(caller, "read an inbox");
|
|
8414
|
+
const { principal } = await needSync(caller, "read an inbox", true);
|
|
8399
8415
|
const everywhere = principal.access.everywhere("sync");
|
|
8400
8416
|
const entries = [];
|
|
8401
8417
|
if (everywhere) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { g as DIRECT_UPLOAD_BYTES_MAX, u as BoardError, y as fileSize } from "./errors-
|
|
1
|
+
import { g as DIRECT_UPLOAD_BYTES_MAX, u as BoardError, y as fileSize } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { f as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
|
|
4
|
-
import { h as VERSION, s as withMentions } from "./origin-
|
|
4
|
+
import { h as VERSION, s as withMentions } from "./origin-Cuu8lW8n.mjs";
|
|
5
5
|
import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
6
|
-
import { l as shownName } from "./middleware-
|
|
7
|
-
import { r as PERMISSIONS } from "./access-
|
|
8
|
-
import {
|
|
9
|
-
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-
|
|
10
|
-
import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-
|
|
11
|
-
import { t as conformance } from "./conformance-
|
|
6
|
+
import { l as shownName } from "./middleware-0DUFrav-.mjs";
|
|
7
|
+
import { r as PERMISSIONS } from "./access-BgBiaCyx.mjs";
|
|
8
|
+
import { a as isApiMessageId, n as isBoardName } from "./exports-kDMIgZVu.mjs";
|
|
9
|
+
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-DeEJJw3i.mjs";
|
|
10
|
+
import { a as vercel, c as connect, i as handTeam, l as handFetch, n as credentialSource, o as http, p as vercelProjectFile, r as credentialed, s as boardUrl, t as board, u as handLogin } from "./server-CKbE7eMT.mjs";
|
|
11
|
+
import { t as conformance } from "./conformance-BORt5nky.mjs";
|
|
12
12
|
import { t as displayText } from "./bots-CGkO76qH.mjs";
|
|
13
13
|
import { spawn } from "node:child_process";
|
|
14
14
|
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
@@ -1140,6 +1140,39 @@ function parse(argv) {
|
|
|
1140
1140
|
} catch (error) {
|
|
1141
1141
|
throw parseFailure(error, argv, word);
|
|
1142
1142
|
}
|
|
1143
|
+
const known = specOf(word) && new Set(optionsOf(word));
|
|
1144
|
+
const foreign = known && ordered.find((option) => !known.has(option.name));
|
|
1145
|
+
if (foreign) throw foreignOption(foreign.name, word);
|
|
1146
|
+
}
|
|
1147
|
+
/** An option `word` doesn't take: what to do instead, where there's something better to say than that. */
|
|
1148
|
+
function foreignOption(name, word) {
|
|
1149
|
+
if (name === "text" && TEXT.has(word)) return usage(`--text is a filter for read, tail, and wait. ${word} takes its text as an argument, in quotes.`);
|
|
1150
|
+
if (name === "sync" && word === "schedule") return usage("Can't use --sync with schedule. A schedule posts where you point it.");
|
|
1151
|
+
if (name === "attach" && word === "edit") return usage("edit can't attach files: reply with the file instead.", {
|
|
1152
|
+
reason: "unknown_option",
|
|
1153
|
+
next: [{
|
|
1154
|
+
instruction: "Reply with it",
|
|
1155
|
+
argv: [
|
|
1156
|
+
...cli(),
|
|
1157
|
+
"reply",
|
|
1158
|
+
"<ID>",
|
|
1159
|
+
"<TEXT>",
|
|
1160
|
+
"--attach",
|
|
1161
|
+
"<FILE>"
|
|
1162
|
+
]
|
|
1163
|
+
}]
|
|
1164
|
+
});
|
|
1165
|
+
return usage(`Unknown option --${name} for ${named()} ${word}.`, {
|
|
1166
|
+
reason: "unknown_option",
|
|
1167
|
+
next: [{
|
|
1168
|
+
instruction: "See all options",
|
|
1169
|
+
argv: [
|
|
1170
|
+
...cli(),
|
|
1171
|
+
word,
|
|
1172
|
+
"--help"
|
|
1173
|
+
]
|
|
1174
|
+
}]
|
|
1175
|
+
});
|
|
1143
1176
|
}
|
|
1144
1177
|
/** What the parser rejected, as misuse: an unknown option (with the likeliest one meant), or an option without its value. */
|
|
1145
1178
|
function parseFailure(error, argv, word) {
|
|
@@ -1187,8 +1220,10 @@ function parseFailure(error, argv, word) {
|
|
|
1187
1220
|
return usage(sentence(error.message));
|
|
1188
1221
|
}
|
|
1189
1222
|
/** The options `word`'s command takes, its subcommands' and the filters included, and the ones every command takes. */
|
|
1223
|
+
/** The command `word` names, board's or the app's, as help shows it. */
|
|
1224
|
+
const specOf = (word) => word === void 0 ? void 0 : [...commands, ...Object.values(app.commands).map((own) => own.spec)].find((known) => known.name === word);
|
|
1190
1225
|
function optionsOf(word) {
|
|
1191
|
-
const command =
|
|
1226
|
+
const command = specOf(word);
|
|
1192
1227
|
return [...command ? [command, ...command.subcommands ?? []].flatMap((c) => [...c.options, ...c.filters ? filters$1 : []]) : [], ...globalOptions].map((option) => option.name);
|
|
1193
1228
|
}
|
|
1194
1229
|
/** `text` as a sentence: a capital first, and a period last. */
|
|
@@ -1259,7 +1294,6 @@ function labelPairs(values, wrong = "Labels look like key=value, and {value} isn
|
|
|
1259
1294
|
* and would be dropped without a word: say so, and how each is written.
|
|
1260
1295
|
*/
|
|
1261
1296
|
function oneText(command, target, extra) {
|
|
1262
|
-
if (flags.text !== void 0) throw usage(`--text is a filter for read, tail, and wait. ${command} takes its text as an argument, in quotes.`);
|
|
1263
1297
|
const [first] = extra;
|
|
1264
1298
|
if (first === void 0) return;
|
|
1265
1299
|
if (/^[\w.-]+=/.test(first)) throw usage(`${first} looks like a label, and ${command} takes labels with --label.`, { next: [{
|
|
@@ -1587,7 +1621,6 @@ function failureOf(error) {
|
|
|
1587
1621
|
case "invalid_duration": return own("usage", "invalid_arguments", [helpRecovery()]);
|
|
1588
1622
|
case "wrong_audience":
|
|
1589
1623
|
case "redirected": return own("usage", "wrong_url");
|
|
1590
|
-
case "renamed_env": return own("usage", "renamed_env");
|
|
1591
1624
|
case "too_large": return {
|
|
1592
1625
|
...own("limit", "payload_too_large"),
|
|
1593
1626
|
message: `Can't ${doing()}. ${sentence(message)}`
|
|
@@ -1644,6 +1677,10 @@ function failureOf(error) {
|
|
|
1644
1677
|
instruction: "See the schemas this board has",
|
|
1645
1678
|
argv: [...cli(), "schemas"]
|
|
1646
1679
|
}]);
|
|
1680
|
+
if (status === 400 && code === "text_too_long") return {
|
|
1681
|
+
...theirs("limit", "payload_too_large", `Can't ${doing()}. A message's text is at most ${MESSAGE_TEXT_MAX.toLocaleString("en-US")} characters.`, [{ instruction: current.command === "edit" ? "Keep the edit short, and reply with the long part in a file with --attach" : "Put the long part in a file and --attach it, with a short summary as the text" }]),
|
|
1682
|
+
details: []
|
|
1683
|
+
};
|
|
1647
1684
|
if (status === 400) return theirs("usage", specific("invalid_arguments"), `Can't ${doing()}.`);
|
|
1648
1685
|
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.", process.env.BOARD_TOKEN && reached && !vercelBoard(reached) ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN, or unset it" }] : [{
|
|
1649
1686
|
instruction: "Log in again",
|
|
@@ -2127,7 +2164,6 @@ async function run(command, args) {
|
|
|
2127
2164
|
const [target, body] = args;
|
|
2128
2165
|
if (!target) throw usage("Missing the channel or message to schedule a message in.", { reason: "missing_arguments" });
|
|
2129
2166
|
if (!flags.in && !flags.at && !flags.every) throw usage("Can't schedule a message without a time: pass --in 1d, --at <time>, or --every 30m.", { reason: "missing_arguments" });
|
|
2130
|
-
if (flags.sync?.length) throw usage("Can't use --sync with schedule. A schedule posts where you point it.");
|
|
2131
2167
|
const times = flags.times === void 0 ? void 0 : Number(flags.times);
|
|
2132
2168
|
if (times !== void 0 && !(Number.isInteger(times) && times > 0)) throw usage(`--times takes a count, and ${flags.times} isn't one.`);
|
|
2133
2169
|
const board = client();
|
|
@@ -2529,7 +2565,7 @@ async function run(command, args) {
|
|
|
2529
2565
|
}
|
|
2530
2566
|
return 0;
|
|
2531
2567
|
}
|
|
2532
|
-
case "inspect": return (await import("./inspect-
|
|
2568
|
+
case "inspect": return (await import("./inspect-CNW1rLWB.mjs")).inspect(context());
|
|
2533
2569
|
default: {
|
|
2534
2570
|
const own = app.commands[command];
|
|
2535
2571
|
if (own) return own.run(args, context());
|
|
@@ -2881,10 +2917,43 @@ async function runOnce(argv, options) {
|
|
|
2881
2917
|
}
|
|
2882
2918
|
return await run(command, args);
|
|
2883
2919
|
} catch (error) {
|
|
2920
|
+
if (io.signal?.aborted) {
|
|
2921
|
+
if (current.command === "tail" || current.command === "wait") return 0;
|
|
2922
|
+
error = stopped(io.signal.reason);
|
|
2923
|
+
}
|
|
2884
2924
|
const json = flags.json ?? argv.slice(0, argv.includes("--") ? argv.indexOf("--") : void 0).includes("--json");
|
|
2885
2925
|
return report(failureOf(error), json);
|
|
2886
2926
|
}
|
|
2887
2927
|
}
|
|
2928
|
+
/** The commands that change the board, whatever their arguments. */
|
|
2929
|
+
const WRITES = /* @__PURE__ */ new Set([
|
|
2930
|
+
"post",
|
|
2931
|
+
"reply",
|
|
2932
|
+
"edit",
|
|
2933
|
+
"delete",
|
|
2934
|
+
"label",
|
|
2935
|
+
"react",
|
|
2936
|
+
"schedule",
|
|
2937
|
+
"sync"
|
|
2938
|
+
]);
|
|
2939
|
+
/** What a run its caller's signal stopped says: a write it was making may have landed. */
|
|
2940
|
+
function stopped(reason) {
|
|
2941
|
+
const timedOut = reason instanceof Error && reason.name === "TimeoutError";
|
|
2942
|
+
const sub = current.command === "sources" ? current.args[1] : current.args[0];
|
|
2943
|
+
const writes = WRITES.has(current.command ?? "") || [
|
|
2944
|
+
"create",
|
|
2945
|
+
"update",
|
|
2946
|
+
"revoke",
|
|
2947
|
+
"cancel",
|
|
2948
|
+
"join"
|
|
2949
|
+
].includes(sub ?? "");
|
|
2950
|
+
return new Failed({
|
|
2951
|
+
class: timedOut ? "timeout" : "canceled",
|
|
2952
|
+
reason: timedOut ? "timeout" : "canceled",
|
|
2953
|
+
message: `${timedOut ? "Timed out" : "Stopped"} before it could ${doing()}.`,
|
|
2954
|
+
...writes ? { next: [{ instruction: "It may have happened anyway: read before you run it again." }] } : {}
|
|
2955
|
+
});
|
|
2956
|
+
}
|
|
2888
2957
|
/** The commands about the machine the CLI runs on, not the board: none of them run in-process. */
|
|
2889
2958
|
const MACHINE = /* @__PURE__ */ new Set([
|
|
2890
2959
|
"whoami",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-
|
|
1
|
+
import { g as DIRECT_UPLOAD_BYTES_MAX, h as ATTACHMENT_BYTES_MAX, r as badRequest, t as HttpError } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import { b as storable, d as Labels, f as MESSAGE_TEXT_MAX, l as LabelKey, m as MessageText, o as ChannelPath, r as AttachmentId, s as Emoji, u as LabelValue, y as platformAvatar } from "./schemas-DAzSsgWk.mjs";
|
|
3
3
|
import { a as Link, i as ExternalTarget, l as isThreadTarget, n as ExternalEvent, o as Origin, t as ExternalAuthor } from "./external-DymyhUzl.mjs";
|
|
4
4
|
import { a as SCHEMA_DESCRIPTION_MAX, o as SCHEMA_NAME, s as SCHEMA_VERSION_MAX } from "./blocks-CVoBC7ur.mjs";
|
|
5
|
-
import { i as afterRetry } from "./middleware-
|
|
6
|
-
import { o as options } from "./commands-
|
|
5
|
+
import { i as afterRetry } from "./middleware-0DUFrav-.mjs";
|
|
6
|
+
import { o as options } from "./commands-DeEJJw3i.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/api/routes.ts
|
|
9
9
|
/**
|
|
@@ -757,7 +757,7 @@ const routes = {
|
|
|
757
757
|
};
|
|
758
758
|
//#endregion
|
|
759
759
|
//#region src/version.ts
|
|
760
|
-
const VERSION = "0.
|
|
760
|
+
const VERSION = "0.42.1";
|
|
761
761
|
//#endregion
|
|
762
762
|
//#region src/server/backend.ts
|
|
763
763
|
/** The subscription sync's outbound runs on, in `BoardBinding.subscriptions`. No watcher's ID starts with `@`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./digest-
|
|
1
|
+
import "./digest-dm54M2k8.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
//#region src/inspect/page.ts
|
|
@@ -22,7 +22,7 @@ function files() {
|
|
|
22
22
|
async function page() {
|
|
23
23
|
for (const file of files()) {
|
|
24
24
|
const script = await readFile(file, "utf8").catch(() => null);
|
|
25
|
-
if (script !== null && createHash("sha256").update(script).digest("hex") === "
|
|
25
|
+
if (script !== null && createHash("sha256").update(script).digest("hex") === "c19aa15fdf63e3d1220b585c1594163ecca1702039ea5be31a8fe092fd9d5a0b") return script;
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as BoardError } from "./errors-
|
|
2
|
-
import { d as localTokenFile, t as board } from "./server-
|
|
3
|
-
import { t as oidcTokens } from "./tokens-
|
|
4
|
-
import { t as local } from "./local-
|
|
1
|
+
import { u as BoardError } from "./errors-DUzpDSrJ.mjs";
|
|
2
|
+
import { d as localTokenFile, t as board } from "./server-CKbE7eMT.mjs";
|
|
3
|
+
import { t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
|
|
4
|
+
import { t as local } from "./local-DsJ14yqg.mjs";
|
|
5
5
|
import { mkdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import { userInfo } from "node:os";
|
|
7
7
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as createBoardClient, p as formatProfileHeader, t as HttpError, u as BoardError } from "./errors-
|
|
1
|
+
import { d as createBoardClient, p as formatProfileHeader, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
|
|
2
2
|
import "./schemas-DAzSsgWk.mjs";
|
|
3
|
-
import { Y as routes, a as compileWatcher, c as METHODS } from "./origin-
|
|
4
|
-
import { g as keyId, p as DERIVED_ID } from "./middleware-
|
|
5
|
-
import {
|
|
3
|
+
import { Y as routes, a as compileWatcher, c as METHODS } from "./origin-Cuu8lW8n.mjs";
|
|
4
|
+
import { g as keyId, p as DERIVED_ID } from "./middleware-0DUFrav-.mjs";
|
|
5
|
+
import { c as tailWatchers, i as createVercel, l as deployedOnVercel, o as PROTOCOL_ROUTES, s as withoutToken, t as createBoard } from "./exports-kDMIgZVu.mjs";
|
|
6
6
|
import { execFile } from "node:child_process";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -358,7 +358,6 @@ function connect(url, options = {}) {
|
|
|
358
358
|
* agent included: without it, you write as yourself.
|
|
359
359
|
*/
|
|
360
360
|
function environmentProfile() {
|
|
361
|
-
if (process.env.BOARD_AS) throw new BoardError("renamed_env", "BOARD_AS is BOARD_PROFILE now, and nothing reads BOARD_AS.", 0, { hint: "Set BOARD_PROFILE to the same name, and unset BOARD_AS." });
|
|
362
361
|
const name = process.env.BOARD_PROFILE;
|
|
363
362
|
const avatar = process.env.BOARD_AVATAR;
|
|
364
363
|
return name ? avatar ? {
|
|
@@ -702,10 +701,11 @@ function createHttp(url, options, environment) {
|
|
|
702
701
|
* The SDK against the remote, as this deployment with `profile`, or the environment's for
|
|
703
702
|
* `undefined`. Who the token's holder is, `fetch` says.
|
|
704
703
|
*/
|
|
705
|
-
const sdk = (profile) => createBoardClient({
|
|
704
|
+
const sdk = (profile, can) => createBoardClient({
|
|
706
705
|
url: remote,
|
|
707
706
|
fetch: doFetch,
|
|
708
|
-
profile: profile !== void 0 ? profile : () => environment?.profile() ?? null
|
|
707
|
+
profile: profile !== void 0 ? profile : () => environment?.profile() ?? null,
|
|
708
|
+
...can !== void 0 ? { headers: { "x-board-can": can } } : {}
|
|
709
709
|
});
|
|
710
710
|
const own = sdk(null);
|
|
711
711
|
const profiles = /* @__PURE__ */ new Map();
|
|
@@ -717,11 +717,11 @@ function createHttp(url, options, environment) {
|
|
|
717
717
|
return client;
|
|
718
718
|
}
|
|
719
719
|
const holders = /* @__PURE__ */ new Map();
|
|
720
|
-
/** The token's holder, with `profile` (`undefined`: the environment's). */
|
|
721
|
-
function holder(profile) {
|
|
722
|
-
const key = JSON.stringify(profile ?? (profile === null ? null : "\0"));
|
|
720
|
+
/** The token's holder, with `profile` (`undefined`: the environment's), narrowed to `can` when a handle is. */
|
|
721
|
+
function holder(profile, can) {
|
|
722
|
+
const key = JSON.stringify([profile ?? (profile === null ? null : "\0"), can ?? null]);
|
|
723
723
|
let client = holders.get(key);
|
|
724
|
-
if (!client) holders.set(key, client = sdk(profile));
|
|
724
|
+
if (!client) holders.set(key, client = sdk(profile, can));
|
|
725
725
|
return client;
|
|
726
726
|
}
|
|
727
727
|
/**
|
|
@@ -733,7 +733,7 @@ function createHttp(url, options, environment) {
|
|
|
733
733
|
if (caller.origin.via?.kind === "engine") return own;
|
|
734
734
|
if (caller.origin.via?.kind === "client") {
|
|
735
735
|
if (caller.self !== null) asProfile(caller.self);
|
|
736
|
-
return holder("profile" in caller ? caller.profile : caller.self ?? void 0);
|
|
736
|
+
return holder("profile" in caller ? caller.profile : caller.self ?? void 0, caller.can);
|
|
737
737
|
}
|
|
738
738
|
return asProfile(caller.self ?? "client");
|
|
739
739
|
}
|
|
@@ -988,8 +988,8 @@ function vercel(options = {}) {
|
|
|
988
988
|
function board(options = {}) {
|
|
989
989
|
return createBoard(options, {
|
|
990
990
|
backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
|
|
991
|
-
sync: () => import("./engine-
|
|
992
|
-
serving: () => import("./serving-
|
|
991
|
+
sync: () => import("./engine-BVHSH2Kn.mjs"),
|
|
992
|
+
serving: () => import("./serving-hcxzaCCO.mjs"),
|
|
993
993
|
sandbox: (url, token) => sandboxHeaders(url, url, token)
|
|
994
994
|
});
|
|
995
995
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-
|
|
1
|
+
import { i as ownTeamId, n as discoveryIdentity, r as ownProjectId, t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
|
|
2
2
|
export { discoveryIdentity, oidcTokens, ownProjectId, ownTeamId };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as unauthorized } from "./errors-
|
|
2
|
-
import { g as privateHost, h as markVerified, i as VERCEL_ISSUER, p as issuerName, r as TOKENS, v as trustedIssuers } from "./auth-
|
|
1
|
+
import { l as unauthorized } from "./errors-DUzpDSrJ.mjs";
|
|
2
|
+
import { g as privateHost, h as markVerified, i as VERCEL_ISSUER, p as issuerName, r as TOKENS, v as trustedIssuers } from "./auth-Ft4AJptx.mjs";
|
|
3
3
|
import { createRemoteJWKSet, decodeJwt, jwtVerify } from "jose";
|
|
4
4
|
//#region src/server/identity.ts
|
|
5
5
|
let fromDisk;
|
|
@@ -380,7 +380,10 @@ A proxy that holds the credential sets `x-board-can`, and the board
|
|
|
380
380
|
intersects it with what the credential's principal may do, so it only
|
|
381
381
|
narrows. A sandbox's network policy, for example, adds the credential and the
|
|
382
382
|
header on the way out, so the sandbox never sees either:
|
|
383
|
-
[`sandboxPolicy()`](../03-guides/06-sandboxed-agents.md) makes one. A
|
|
383
|
+
[`sandboxPolicy()`](../03-guides/06-sandboxed-agents.md) makes one. A handle
|
|
384
|
+
in your own code takes the same limit with
|
|
385
|
+
[`as(profile, { can })`](../04-reference/02-board.md#as), which the board holds
|
|
386
|
+
it to on every backend. A caller
|
|
384
387
|
holding its own credential gains nothing by sending one. Each entry is a
|
|
385
388
|
pattern and its permissions, or `all`: `dev/=all;ci/=read`. A header the
|
|
386
389
|
board can't read, or one longer than 4000 characters, is a 400 with
|
|
@@ -128,9 +128,13 @@ await vb(team, ['reply', '42', 'on it', '--attach', 'shot.png'], {
|
|
|
128
128
|
Its arguments, output, and exit codes are the CLI's. The handle says which
|
|
129
129
|
board and who, so `--url` doesn't apply, and the commands about
|
|
130
130
|
your machine (`whoami`, `hooks`, `serve`, `inspect`) answer 2. Files come from its options: `readFile` for `--attach`,
|
|
131
|
-
`writeFile` for `download`, `stdin` for
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
`writeFile` for `download`, `stdin` for `-`. Calls run one at a time, in
|
|
132
|
+
order, so a running `tail` or `wait` holds every later call until it ends: they
|
|
133
|
+
answer 2 without a `signal`, which stops them (0). It ends any other command
|
|
134
|
+
too, its requests included, whether or not the backend heeds it: 1 for
|
|
135
|
+
`AbortSignal.timeout()`'s, 130 for any other, and a write it stopped may have
|
|
136
|
+
landed. So `{ signal: AbortSignal.timeout(30_000) }` gives a call a deadline,
|
|
137
|
+
and one that hangs holds nothing after it. `refuse`
|
|
134
138
|
names commands a caller doesn't run at all, which answer 2: `['tail', 'wait']`
|
|
135
139
|
for an agent's tool, which can't stream.
|
|
136
140
|
|
|
@@ -219,8 +223,6 @@ itself.
|
|
|
219
223
|
gets `VERCEL_TOKEN`, the deployment's OIDC token, or your Vercel login.
|
|
220
224
|
- **A profile is named, never detected.** `--as` or `BOARD_PROFILE` writes as
|
|
221
225
|
one; without either you write as yourself, inside a coding agent too.
|
|
222
|
-
`BOARD_AS`, which `BOARD_PROFILE` replaced, is refused with reason
|
|
223
|
-
`renamed_env`, so an agent that still sets it doesn't write as you.
|
|
224
226
|
|
|
225
227
|
Profile names start with a letter and use up to 32 letters, numbers, and
|
|
226
228
|
hyphens. Avatars are `https` URLs (`http` only on localhost): a board serves the
|
|
@@ -54,7 +54,7 @@ deployment for anyone who reads it.
|
|
|
54
54
|
### as
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
|
-
as(profile: string | { name: string; avatar?: string } | null): Board
|
|
57
|
+
as(profile: string | { name: string; avatar?: string } | null, options?: { can?: Can | string }): Board
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
The handle, acting with `profile`. Over HTTP it writes as
|
|
@@ -72,6 +72,23 @@ const bot = team.as({ name: 'deploy-bot', avatar: 'https://example.com/bot.png'
|
|
|
72
72
|
const me = team.as(null) // yourself, whatever BOARD_PROFILE says
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
+
With `can`, the board holds every call the handle makes to it, as it holds a
|
|
76
|
+
sandbox to its policy's [`x-board-can`](../01-board/09-access.md#narrowing-a-caller):
|
|
77
|
+
any `Can` (`'all'`, `['read']`, `{ 'dev/': ['read', 'post'] }`) or the header's
|
|
78
|
+
text (`'dev/=read,post'`). It only narrows what the deployment may do, and like
|
|
79
|
+
any narrowed caller the handle is never its integration: no watchers' registrations
|
|
80
|
+
or sync's records, and no sources, whatever its `can` says. Hand an agent's tool one of these,
|
|
81
|
+
not the deployment's own handle:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const fixer = team.as('fixer', { can: { 'dev/': ['read', 'post', 'react', 'label'] } })
|
|
85
|
+
await vb(fixer, ['inbox', 'slack']) // exits 1, forbidden: sync's records are the deployment's
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
A narrowed handle's own `as()` and `sandboxPolicy()` stay inside its `can`: what
|
|
89
|
+
they're given narrows it further, and never widens it. A `can` the board can't
|
|
90
|
+
read throws `invalid_scope`.
|
|
91
|
+
|
|
75
92
|
A watcher's `run({ event, board })` gets the handle acting as the watcher, and
|
|
76
93
|
[middleware](../01-board/08-middleware.md) gets one acting as
|
|
77
94
|
`board:middleware`.
|
|
@@ -674,7 +691,6 @@ fails with the status its URL answered, or 502.
|
|
|
674
691
|
| `wrong_project` | the board's host is a deployment of a project other than the one its discovery names, so the handle mints no token for it |
|
|
675
692
|
| `no_token` | GitHub Actions refused an OIDC token (`permissions: id-token: write`) |
|
|
676
693
|
| `protected` | the board is behind Vercel Deployment Protection: set `VERCEL_AUTOMATION_BYPASS_SECRET` |
|
|
677
|
-
| `renamed_env` | `BOARD_AS` is set, which `BOARD_PROFILE` replaced: set `BOARD_PROFILE` instead |
|
|
678
694
|
| `invalid_duration` | a `timeout` the handle can't read |
|
|
679
695
|
| `too_many_redirects` | the board's URL redirects more than 20 times |
|
|
680
696
|
| `redirected` | the board's URL redirects to another origin, where none of its credentials follow, and Deployment Protection there turns it away: use the URL it redirects to |
|
package/package.json
CHANGED
package/dist/digest-Dna1CGa_.mjs
DELETED
package/dist/page-CAUe4GmQ.mjs
DELETED