@vercel/board 0.41.0 → 0.42.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.
- 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-embedded.d.mts +9 -4
- package/dist/cli-embedded.mjs +7 -5
- package/dist/cli.mjs +4 -4
- 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-CKC0Rmy1.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-B6udRV_E.mjs → exports-BfNXPHN_.mjs} +133 -36
- package/dist/exports-Bw_OYNRl.d.mts +4 -0
- 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-DPRoC_Gg.mjs → inspect-CniRRiJ2.mjs} +4 -4
- package/dist/inspect-HlHh7OXa.mjs +2 -0
- package/dist/{local-B9y4p6N7.mjs → local-CWLPYoiY.mjs} +23 -7
- package/dist/{main-S0A-c_kP.mjs → main-aVEEoc60.mjs} +45 -8
- package/dist/{middleware-DHdrxmoc.mjs → middleware-0DUFrav-.mjs} +1 -1
- package/dist/{origin-B3m2lnZC.mjs → origin-DAyYeDuW.mjs} +3 -3
- package/dist/{page-2jjHZmIW.mjs → page-BD6ygU49.mjs} +2 -2
- package/dist/page-BiJVe-7R.mjs +2 -0
- package/dist/{serve-B15I2Ibf.mjs → serve-BnBqi0sw.mjs} +4 -4
- package/dist/{server-DgpRZ4Nu.mjs → server-Bcpkt6TS.mjs} +14 -13
- 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 -3
- package/docs/04-reference/02-board.md +18 -1
- 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-aVEEoc60.mjs";
|
|
4
|
+
import { t as page } from "./page-BD6ygU49.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-BiJVe-7R.mjs")).page();
|
|
424
424
|
const shell = (token) => `<!doctype html>
|
|
425
425
|
<html lang="en">
|
|
426
426
|
<head>
|
|
@@ -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-DAyYeDuW.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-DAyYeDuW.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 {
|
|
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-BfNXPHN_.mjs";
|
|
9
9
|
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-QRD0U9AQ.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-
|
|
11
|
-
import { t as conformance } from "./conformance-
|
|
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-Bcpkt6TS.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";
|
|
@@ -1644,6 +1644,10 @@ function failureOf(error) {
|
|
|
1644
1644
|
instruction: "See the schemas this board has",
|
|
1645
1645
|
argv: [...cli(), "schemas"]
|
|
1646
1646
|
}]);
|
|
1647
|
+
if (status === 400 && code === "text_too_long") return {
|
|
1648
|
+
...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" }]),
|
|
1649
|
+
details: []
|
|
1650
|
+
};
|
|
1647
1651
|
if (status === 400) return theirs("usage", specific("invalid_arguments"), `Can't ${doing()}.`);
|
|
1648
1652
|
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
1653
|
instruction: "Log in again",
|
|
@@ -2529,7 +2533,7 @@ async function run(command, args) {
|
|
|
2529
2533
|
}
|
|
2530
2534
|
return 0;
|
|
2531
2535
|
}
|
|
2532
|
-
case "inspect": return (await import("./inspect-
|
|
2536
|
+
case "inspect": return (await import("./inspect-HlHh7OXa.mjs")).inspect(context());
|
|
2533
2537
|
default: {
|
|
2534
2538
|
const own = app.commands[command];
|
|
2535
2539
|
if (own) return own.run(args, context());
|
|
@@ -2881,10 +2885,43 @@ async function runOnce(argv, options) {
|
|
|
2881
2885
|
}
|
|
2882
2886
|
return await run(command, args);
|
|
2883
2887
|
} catch (error) {
|
|
2888
|
+
if (io.signal?.aborted) {
|
|
2889
|
+
if (current.command === "tail" || current.command === "wait") return 0;
|
|
2890
|
+
error = stopped(io.signal.reason);
|
|
2891
|
+
}
|
|
2884
2892
|
const json = flags.json ?? argv.slice(0, argv.includes("--") ? argv.indexOf("--") : void 0).includes("--json");
|
|
2885
2893
|
return report(failureOf(error), json);
|
|
2886
2894
|
}
|
|
2887
2895
|
}
|
|
2896
|
+
/** The commands that change the board, whatever their arguments. */
|
|
2897
|
+
const WRITES = /* @__PURE__ */ new Set([
|
|
2898
|
+
"post",
|
|
2899
|
+
"reply",
|
|
2900
|
+
"edit",
|
|
2901
|
+
"delete",
|
|
2902
|
+
"label",
|
|
2903
|
+
"react",
|
|
2904
|
+
"schedule",
|
|
2905
|
+
"sync"
|
|
2906
|
+
]);
|
|
2907
|
+
/** What a run its caller's signal stopped says: a write it was making may have landed. */
|
|
2908
|
+
function stopped(reason) {
|
|
2909
|
+
const timedOut = reason instanceof Error && reason.name === "TimeoutError";
|
|
2910
|
+
const sub = current.command === "sources" ? current.args[1] : current.args[0];
|
|
2911
|
+
const writes = WRITES.has(current.command ?? "") || [
|
|
2912
|
+
"create",
|
|
2913
|
+
"update",
|
|
2914
|
+
"revoke",
|
|
2915
|
+
"cancel",
|
|
2916
|
+
"join"
|
|
2917
|
+
].includes(sub ?? "");
|
|
2918
|
+
return new Failed({
|
|
2919
|
+
class: timedOut ? "timeout" : "canceled",
|
|
2920
|
+
reason: timedOut ? "timeout" : "canceled",
|
|
2921
|
+
message: `${timedOut ? "Timed out" : "Stopped"} before it could ${doing()}.`,
|
|
2922
|
+
...writes ? { next: [{ instruction: "It may have happened anyway: read before you run it again." }] } : {}
|
|
2923
|
+
});
|
|
2924
|
+
}
|
|
2888
2925
|
/** The commands about the machine the CLI runs on, not the board: none of them run in-process. */
|
|
2889
2926
|
const MACHINE = /* @__PURE__ */ new Set([
|
|
2890
2927
|
"whoami",
|
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
5
|
+
import { i as afterRetry } from "./middleware-0DUFrav-.mjs";
|
|
6
6
|
import { o as options } from "./commands-QRD0U9AQ.mjs";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/api/routes.ts
|
|
@@ -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.0";
|
|
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-CKC0Rmy1.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") === "f50caced754723432e972aafa252cdb3cb49676ceedc21c762987ed418dac0f6") 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-Bcpkt6TS.mjs";
|
|
3
|
+
import { t as oidcTokens } from "./tokens-BSMpTPEe.mjs";
|
|
4
|
+
import { t as local } from "./local-CWLPYoiY.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-DAyYeDuW.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-BfNXPHN_.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";
|
|
@@ -702,10 +702,11 @@ function createHttp(url, options, environment) {
|
|
|
702
702
|
* The SDK against the remote, as this deployment with `profile`, or the environment's for
|
|
703
703
|
* `undefined`. Who the token's holder is, `fetch` says.
|
|
704
704
|
*/
|
|
705
|
-
const sdk = (profile) => createBoardClient({
|
|
705
|
+
const sdk = (profile, can) => createBoardClient({
|
|
706
706
|
url: remote,
|
|
707
707
|
fetch: doFetch,
|
|
708
|
-
profile: profile !== void 0 ? profile : () => environment?.profile() ?? null
|
|
708
|
+
profile: profile !== void 0 ? profile : () => environment?.profile() ?? null,
|
|
709
|
+
...can !== void 0 ? { headers: { "x-board-can": can } } : {}
|
|
709
710
|
});
|
|
710
711
|
const own = sdk(null);
|
|
711
712
|
const profiles = /* @__PURE__ */ new Map();
|
|
@@ -717,11 +718,11 @@ function createHttp(url, options, environment) {
|
|
|
717
718
|
return client;
|
|
718
719
|
}
|
|
719
720
|
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"));
|
|
721
|
+
/** The token's holder, with `profile` (`undefined`: the environment's), narrowed to `can` when a handle is. */
|
|
722
|
+
function holder(profile, can) {
|
|
723
|
+
const key = JSON.stringify([profile ?? (profile === null ? null : "\0"), can ?? null]);
|
|
723
724
|
let client = holders.get(key);
|
|
724
|
-
if (!client) holders.set(key, client = sdk(profile));
|
|
725
|
+
if (!client) holders.set(key, client = sdk(profile, can));
|
|
725
726
|
return client;
|
|
726
727
|
}
|
|
727
728
|
/**
|
|
@@ -733,7 +734,7 @@ function createHttp(url, options, environment) {
|
|
|
733
734
|
if (caller.origin.via?.kind === "engine") return own;
|
|
734
735
|
if (caller.origin.via?.kind === "client") {
|
|
735
736
|
if (caller.self !== null) asProfile(caller.self);
|
|
736
|
-
return holder("profile" in caller ? caller.profile : caller.self ?? void 0);
|
|
737
|
+
return holder("profile" in caller ? caller.profile : caller.self ?? void 0, caller.can);
|
|
737
738
|
}
|
|
738
739
|
return asProfile(caller.self ?? "client");
|
|
739
740
|
}
|
|
@@ -988,8 +989,8 @@ function vercel(options = {}) {
|
|
|
988
989
|
function board(options = {}) {
|
|
989
990
|
return createBoard(options, {
|
|
990
991
|
backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
|
|
991
|
-
sync: () => import("./engine-
|
|
992
|
-
serving: () => import("./serving-
|
|
992
|
+
sync: () => import("./engine-BVHSH2Kn.mjs"),
|
|
993
|
+
serving: () => import("./serving-hcxzaCCO.mjs"),
|
|
993
994
|
sandbox: (url, token) => sandboxHeaders(url, url, token)
|
|
994
995
|
});
|
|
995
996
|
}
|
|
@@ -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
|
|
|
@@ -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`.
|
package/package.json
CHANGED
package/dist/digest-Dna1CGa_.mjs
DELETED
package/dist/page-CAUe4GmQ.mjs
DELETED