@vercel/board 0.56.1 → 0.57.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-HzqFpgL_.mjs → access-CIj7v_Dr.mjs} +1 -1
- package/dist/access.d.mts +2 -2
- package/dist/access.mjs +4 -4
- package/dist/{actors-D-u6bitG.mjs → actors-DVDTqjm7.mjs} +2 -2
- package/dist/{auth-D9ycDQK0.mjs → auth-BDWGvFWl.mjs} +2 -2
- package/dist/{auth-ULldUvir.d.mts → auth-C0Mla9OU.d.mts} +1 -1
- package/dist/{backend-BHN6GTjB.d.mts → backend-BuqwQbb4.d.mts} +6 -22
- package/dist/backend-local.d.mts +1 -1
- package/dist/backend-local.mjs +1 -1
- package/dist/backend-postgres/blob-vercel.d.mts +8 -0
- package/dist/backend-postgres/blob-vercel.mjs +81 -0
- package/dist/backend-postgres/scheduler-vercel.d.mts +2 -0
- package/dist/backend-postgres/scheduler-vercel.mjs +2 -0
- package/dist/backend-postgres.d.mts +74 -0
- package/dist/backend-postgres.mjs +3229 -0
- package/dist/blob-DjS53D1A.d.mts +35 -0
- package/dist/{chat-provider-F7UqWVZK.d.mts → chat-provider-CpYdXEpI.d.mts} +2 -2
- package/dist/cli-embedded.d.mts +2 -2
- package/dist/cli-embedded.mjs +2 -2
- package/dist/cli.mjs +5 -5
- package/dist/{client-CFHunEFn.d.mts → client-B0DGOt7P.d.mts} +1 -1
- package/dist/{conformance-BNiLcKra.mjs → conformance-FiQ68adg.mjs} +2 -2
- package/dist/conformance.d.mts +1 -1
- package/dist/conformance.mjs +1 -1
- package/dist/{engine-C8wCzkw-.mjs → engine-B_CjnE3G.mjs} +3 -3
- package/dist/{errors-DDfXnZ2b.mjs → errors-BfMR39F0.mjs} +60 -17
- package/dist/errors-DBZtbfph.d.mts +19 -0
- package/dist/{exports-BBmjHyCB.d.mts → exports-BvJTIorX.d.mts} +5 -4
- package/dist/{exports-DSX-CI5c.mjs → exports-x-ioAfbp.mjs} +23 -14
- package/dist/{index-Ce3SDZ3Y.d.mts → index-DuibwQf9.d.mts} +2 -2
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +4 -4
- package/dist/index.node.d.mts +7 -6
- package/dist/index.node.mjs +4 -4
- package/dist/inspect/app.js +35 -35
- package/dist/{inspect-C-vDnB_n.mjs → inspect-BFnDSdsq.mjs} +2 -2
- package/dist/inspect-BuNsu2z6.mjs +2 -0
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +1 -1
- package/dist/{internal-CvsrprnU-CEPOUpAv.mjs → internal-CvsrprnU-DhZF6sZK.mjs} +43 -1
- package/dist/{local-B5aZcAwj.mjs → local-Bt1-jA9A.mjs} +129 -3956
- package/dist/local-Gp8pqHSu.mjs +98 -0
- package/dist/{main-DSlpMoBN.mjs → main-Du-mKQZn.mjs} +93 -13
- package/dist/{memory-wmUDblhm.mjs → memory-74hyK6eH.mjs} +3 -3
- package/dist/{mentions-CnWt9Z5b.mjs → mentions-DBGmqkr2.mjs} +5 -1
- package/dist/{middleware-BY4qqIh3.mjs → middleware-bIABV895.mjs} +1 -1
- package/dist/{provider-DgGp4Zej.d.mts → provider-BNVyVKtH.d.mts} +2 -2
- package/dist/{routes-DNmQSOvQ.d.mts → routes-CSnxZyyb.d.mts} +2 -2
- package/dist/{serve-CI3kvpx_.mjs → serve-xOoxwq7T.mjs} +6 -6
- package/dist/{server-55vryxAl.mjs → server-BSexF7Bk.mjs} +8 -8
- package/dist/server-DX7mM6nm-Cq1xPyqJ.mjs +3769 -0
- package/dist/{serving-C1mhZQqH.mjs → serving-ByD4TOOU.mjs} +1 -1
- package/dist/{shell-7nGyF--f.mjs → shell-0nWQEqh3.mjs} +5 -1
- package/dist/{sql-D0MqINA6.mjs → sql-CvBbb5Ui.mjs} +33 -22
- package/dist/{sqlite-Dj2ZEtgy.mjs → sqlite-DtfrT_EP.mjs} +3 -3
- package/dist/{sqlite-db-DjbTlUwN.mjs → sqlite-db-DSVlzQjv.mjs} +2 -2
- package/dist/store-N8PXxDAS-DWWgv-Vz.mjs +5 -0
- package/dist/{store-N8PXxDAS-BdL4Sq-f.mjs → store-codec-pAG2oPgQ-DbEYfF5Y.mjs} +2 -6
- package/dist/{store-memory-CKQVEzXN.mjs → store-memory-DOMraCLN.mjs} +3 -2
- package/dist/store-memory-XNDFHASI.mjs +2 -0
- package/dist/{store-polling-BZt2Rf3D-oh3aU_An.mjs → store-polling-BZt2Rf3D-nlZUQLz2.mjs} +1 -1
- package/dist/store-sqlite-Cs8dH9EX.mjs +2 -0
- package/dist/{store-sqlite-D6fIszST.mjs → store-sqlite-DUdQnX_6.mjs} +4 -3
- package/dist/sync-chat-sdk.d.mts +2 -2
- package/dist/sync-github.d.mts +2 -2
- package/dist/sync-linear.d.mts +3 -3
- package/dist/sync-slack.d.mts +3 -3
- package/dist/sync-slack.mjs +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/{task-batch-iecHMssy.mjs → task-batch-DgyfK9qx.mjs} +3 -3
- package/dist/{tokens-B3gXkQCs.mjs → tokens-_1X8JNLT.mjs} +2 -2
- package/dist/vercel-B5FM4uS8.d.mts +21 -0
- package/dist/vercel-BUb8II-P.mjs +305 -0
- package/dist/{version-gbihG3ui.mjs → version-CZT5WmZs.mjs} +1 -1
- package/docs/01-board/01-mounting.md +1 -0
- package/docs/01-board/12-postgres.md +222 -0
- package/docs/03-guides/02-inspector.md +33 -0
- package/docs/03-guides/07-build-a-ui.md +8 -4
- package/docs/04-reference/03-http.md +1 -1
- package/docs/index.md +4 -1
- package/package.json +31 -2
- package/sql/postgres/schema.sql +389 -0
- package/dist/inspect-CJ8osLQ-.mjs +0 -2
- package/dist/store-memory-OdGsc-t_.mjs +0 -2
- package/dist/store-sqlite-CTxAVCcz.mjs +0 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { t as HttpError } from "./errors-BfMR39F0.mjs";
|
|
2
|
+
import { u as METHODS } from "./task-batch-DgyfK9qx.mjs";
|
|
3
|
+
import { i as memoryBlob, n as a2, r as fsBlob, t as localScheduler } from "./local-Bt1-jA9A.mjs";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
6
|
+
//#region src/server/local.ts
|
|
7
|
+
/** A board's name that is its own file's: lowercase letters, digits, `_`, and `-`, and no device name Windows keeps. */
|
|
8
|
+
const PLAIN = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
9
|
+
const RESERVED = /^(con|prn|aux|nul|com\d|lpt\d)$/;
|
|
10
|
+
/**
|
|
11
|
+
* The file a board keeps, without its extension, from its name alone: `local` for the default
|
|
12
|
+
* board, a plain name as it is (whatever its case: names match that way), and any other name,
|
|
13
|
+
* `Security Team` say, as letters and dashes, a `.`, and a hash of it. No plain name has a `.`,
|
|
14
|
+
* and the hash is long enough that no one finds two names that share it, so no two names
|
|
15
|
+
* share a file, and none is `local`'s.
|
|
16
|
+
*/
|
|
17
|
+
function localFile(name) {
|
|
18
|
+
if (name === null) return "local";
|
|
19
|
+
const lower = name.toLowerCase();
|
|
20
|
+
if (PLAIN.test(lower) && lower !== "local" && !RESERVED.test(lower)) return lower;
|
|
21
|
+
return `${lower.replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48) || "board"}.${createHash("sha256").update(lower).digest("hex").slice(0, 32)}`;
|
|
22
|
+
}
|
|
23
|
+
/** Why a file couldn't be opened, in a few words. */
|
|
24
|
+
function unwritable(error) {
|
|
25
|
+
const { code, message } = error;
|
|
26
|
+
if (code === "EROFS" || code === "EACCES" || code === "EPERM" || /unable to open database|readonly database/i.test(String(message))) return "this filesystem isn't writable here";
|
|
27
|
+
return String(message ?? error).split("\n")[0];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A board kept in this process: in SQLite under `.board/` (or `dir`), one file per board's name
|
|
31
|
+
* (whatever `board({ team })` says: there's one team here),
|
|
32
|
+
* its attachments next to it, and a scheduler whose timers run here, so schedules send, and
|
|
33
|
+
* watchers and sync retry, while the process runs. `memory` keeps it all in memory, for tests.
|
|
34
|
+
* A restart drops pending timers, so it's for development, `vb serve`, tests, and working offline,
|
|
35
|
+
* never serverless functions.
|
|
36
|
+
*/
|
|
37
|
+
function local(options = {}) {
|
|
38
|
+
const dir = resolve(options.dir ?? ".board");
|
|
39
|
+
let binding = null;
|
|
40
|
+
let opening = null;
|
|
41
|
+
/** The board, opened on its first use: binding does no I/O. One that didn't open is tried again on the next call. */
|
|
42
|
+
function open() {
|
|
43
|
+
if (!binding) throw new Error("local: this backend isn't serving a board yet: pass it to board({ backend })");
|
|
44
|
+
const bound = binding;
|
|
45
|
+
opening ??= (async () => {
|
|
46
|
+
const file = localFile(bound.name);
|
|
47
|
+
let store;
|
|
48
|
+
if (options.memory) store = (await import("./memory-74hyK6eH.mjs")).memory();
|
|
49
|
+
else {
|
|
50
|
+
const { mkdir } = await import("node:fs/promises");
|
|
51
|
+
const { sqlite } = await import("./sqlite-DtfrT_EP.mjs");
|
|
52
|
+
const path = join(dir, `${file}.db`);
|
|
53
|
+
try {
|
|
54
|
+
await mkdir(dir, {
|
|
55
|
+
recursive: true,
|
|
56
|
+
mode: 448
|
|
57
|
+
});
|
|
58
|
+
store = sqlite({ path });
|
|
59
|
+
} catch (error) {
|
|
60
|
+
throw new HttpError(500, "no_store", `can't open the board at ${path}: ${unwritable(error)}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const scheduler = localScheduler();
|
|
64
|
+
const backend = a2({
|
|
65
|
+
store,
|
|
66
|
+
scheduler,
|
|
67
|
+
blob: options.memory ? memoryBlob() : fsBlob(join(dir, file))
|
|
68
|
+
});
|
|
69
|
+
backend.bind(bound);
|
|
70
|
+
return {
|
|
71
|
+
backend,
|
|
72
|
+
store,
|
|
73
|
+
scheduler
|
|
74
|
+
};
|
|
75
|
+
})();
|
|
76
|
+
opening.catch(() => opening = null);
|
|
77
|
+
return opening;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
...Object.fromEntries(METHODS.map((name) => [name, async (caller, input, signal) => (await open()).backend[name](caller, input, signal)])),
|
|
81
|
+
routes: [],
|
|
82
|
+
keeps: true,
|
|
83
|
+
trust: { grants: async () => (await open()).backend.trust.grants() },
|
|
84
|
+
bind(given) {
|
|
85
|
+
if (binding) throw new Error("local: this backend already serves a board: create one local() per board()");
|
|
86
|
+
binding = given;
|
|
87
|
+
},
|
|
88
|
+
async close() {
|
|
89
|
+
const opened = opening;
|
|
90
|
+
opening = null;
|
|
91
|
+
const board = opened && await opened.catch(() => null);
|
|
92
|
+
board?.scheduler.stop();
|
|
93
|
+
await board?.store.close();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { local as t };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { a as DIRECT_UPLOAD_BYTES_MAX, l as fileSize } from "./profile-header-O8wC8yk8.mjs";
|
|
2
2
|
import { m as MESSAGE_TEXT_MAX, r as AttachmentId } from "./schemas-CUSTEFIy.mjs";
|
|
3
|
-
import { f as BoardError } from "./errors-
|
|
3
|
+
import { f as BoardError } from "./errors-BfMR39F0.mjs";
|
|
4
4
|
import { n as displayEmoji, r as normalizeEmoji } from "./emoji-CTLpvH-A.mjs";
|
|
5
|
-
import { l as shownName } from "./middleware-
|
|
5
|
+
import { l as shownName } from "./middleware-bIABV895.mjs";
|
|
6
6
|
import { d as parseSchemaId, r as findBlocks, t as block } from "./blocks-CVoBC7ur.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { t as VERSION } from "./version-
|
|
9
|
-
import { r as PERMISSIONS } from "./access-
|
|
10
|
-
import { c as mentionValue, l as withMentions } from "./task-batch-
|
|
11
|
-
import { a as isBoardName, l as isApiMessageId, n as createTasksInChunks, s as apiThreadRoot, t as TasksInChunksError } from "./exports-
|
|
7
|
+
import { n as isEmail, s as replaceMentions, t as extractMentions } from "./mentions-DBGmqkr2.mjs";
|
|
8
|
+
import { t as VERSION } from "./version-CZT5WmZs.mjs";
|
|
9
|
+
import { r as PERMISSIONS } from "./access-CIj7v_Dr.mjs";
|
|
10
|
+
import { c as mentionValue, l as withMentions } from "./task-batch-DgyfK9qx.mjs";
|
|
11
|
+
import { a as isBoardName, l as isApiMessageId, n as createTasksInChunks, s as apiThreadRoot, t as TasksInChunksError } from "./exports-x-ioAfbp.mjs";
|
|
12
12
|
import { i as groups, n as filters$1, o as options, r as globalOptions, s as usage$1, t as commands } from "./commands-7FY_8p92.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-
|
|
14
|
-
import { n as everyChannel, t as conformance } from "./conformance-
|
|
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-BSexF7Bk.mjs";
|
|
14
|
+
import { n as everyChannel, t as conformance } from "./conformance-FiQ68adg.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";
|
|
@@ -1439,6 +1439,8 @@ let warnings = [];
|
|
|
1439
1439
|
let bareMentions;
|
|
1440
1440
|
/** The board this run reached by its URL, for a failure to name. */
|
|
1441
1441
|
let reached = null;
|
|
1442
|
+
/** The task `tasks run` holds, once it's claimed one: with --ready, the command line names only its channel. */
|
|
1443
|
+
let runTask;
|
|
1442
1444
|
/** The team whose default board this run reached, nothing naming one of its boards: `--scope`'s, or the one the environment finds. */
|
|
1443
1445
|
let teamDefault = null;
|
|
1444
1446
|
/** Where the credential this run sent came from, as `whoami` says it, for a refusal to say which to replace. */
|
|
@@ -1514,6 +1516,25 @@ function parse(argv) {
|
|
|
1514
1516
|
const known = specOf(word) && new Set(optionsOf(word));
|
|
1515
1517
|
const foreign = known && ordered.find((option) => !known.has(option.name));
|
|
1516
1518
|
if (foreign) throw foreignOption(foreign.name, word);
|
|
1519
|
+
const sub = word === "tasks" ? subcommandOf(word) : void 0;
|
|
1520
|
+
const theirs = sub && new Set([
|
|
1521
|
+
...sub.options,
|
|
1522
|
+
...sub.filters ? filters$1 : [],
|
|
1523
|
+
...globalOptions
|
|
1524
|
+
].map((option) => option.name));
|
|
1525
|
+
const elsewhere = theirs && ordered.find((option) => !theirs.has(option.name));
|
|
1526
|
+
if (elsewhere) throw usage(`Unknown option --${elsewhere.name} for ${named()} ${word} ${sub.name}.`, {
|
|
1527
|
+
reason: "unknown_option",
|
|
1528
|
+
next: [{
|
|
1529
|
+
instruction: "See all options",
|
|
1530
|
+
argv: [
|
|
1531
|
+
...cli(),
|
|
1532
|
+
word,
|
|
1533
|
+
sub.name,
|
|
1534
|
+
"--help"
|
|
1535
|
+
]
|
|
1536
|
+
}]
|
|
1537
|
+
});
|
|
1517
1538
|
if (canonical(positionals[0]) !== word) throw misplaced(args, word);
|
|
1518
1539
|
}
|
|
1519
1540
|
/**
|
|
@@ -1646,6 +1667,13 @@ function parseFailure(error, argv, word) {
|
|
|
1646
1667
|
/** The options `word`'s command takes, its subcommands' and the filters included, and the ones every command takes. */
|
|
1647
1668
|
/** The command `word` names, board's or the app's, as help shows it. */
|
|
1648
1669
|
const specOf = (word) => word === void 0 ? void 0 : [...commands, ...Object.values(app.commands).map((own) => own.spec)].find((known) => known.name === word);
|
|
1670
|
+
/** The subcommand of `word`'s command this run names, right after the command, by its name or an alias. */
|
|
1671
|
+
function subcommandOf(word) {
|
|
1672
|
+
const command = specOf(word);
|
|
1673
|
+
if (!command?.subcommands || command.argumentsBeforeSubcommand) return void 0;
|
|
1674
|
+
const named = positionals[1];
|
|
1675
|
+
return command.subcommands.find((sub) => sub.name === named || (sub.aliases ?? []).includes(named ?? ""));
|
|
1676
|
+
}
|
|
1649
1677
|
function optionsOf(word) {
|
|
1650
1678
|
const command = specOf(word);
|
|
1651
1679
|
return [...command ? [command, ...command.subcommands ?? []].flatMap((c) => [...c.options, ...c.filters ? filters$1 : []]) : [], ...globalOptions].map((option) => option.name);
|
|
@@ -2289,6 +2317,8 @@ function failureOf(error) {
|
|
|
2289
2317
|
...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" : current.command === "tasks" ? "Keep it short, and reply to the task 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" }]),
|
|
2290
2318
|
details: []
|
|
2291
2319
|
};
|
|
2320
|
+
const note = status === 400 ? taskNoteTooLong(message) : null;
|
|
2321
|
+
if (note) return { ...theirs("limit", "payload_too_large", `Can't ${doing()}. Its ${note} is too long for the board.`, note === "result" ? noteRecovery("report") : noteRecovery("detail")) };
|
|
2292
2322
|
if (code === "too_many_boards") return theirs("limit", code, `Can't ${doing()}. The team has all the boards it can.`, current.command === "conformance" ? [{
|
|
2293
2323
|
instruction: "Check a board by its URL, such as one from vb serve",
|
|
2294
2324
|
argv: [
|
|
@@ -2311,11 +2341,10 @@ function failureOf(error) {
|
|
|
2311
2341
|
argv: rerunWithout([]).filter((arg) => arg !== "--ensure")
|
|
2312
2342
|
}] : []);
|
|
2313
2343
|
if (code === "private_boards_unavailable") return theirs("limit", code, `Can't ${doing()}. This team's plan has no private boards.`, [{ instruction: "Keep the board open to the whole team, or move the team to a plan with private boards" }]);
|
|
2344
|
+
if (status === 400 && code === "invalid_profile") return theirs("usage", code, `Can't ${doing()}. The board doesn't take that profile.`);
|
|
2314
2345
|
if (status === 400) return theirs("usage", specific("invalid_arguments"), `Can't ${doing()}.`);
|
|
2315
|
-
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.",
|
|
2316
|
-
|
|
2317
|
-
argv: ["vercel", "login"]
|
|
2318
|
-
}]);
|
|
2346
|
+
if (status === 401) return theirs("auth", "login_required", "The board didn't accept your credentials.", loginRecoveries());
|
|
2347
|
+
if (status === 403 && code === "reauthentication_required") return theirs("auth", "login_required", "Your team needs you to log in again.", loginRecoveries());
|
|
2319
2348
|
if (status === 403) return theirs("permission", "permission_denied", `You can't ${doing()}.`, refusedRecoveries());
|
|
2320
2349
|
if (status === 404) {
|
|
2321
2350
|
const thing = missing();
|
|
@@ -2379,6 +2408,14 @@ const onThisBoard = () => [
|
|
|
2379
2408
|
...flags.name !== void 0 ? ["--name", flags.name] : [],
|
|
2380
2409
|
...flags.as ? ["--as", flags.as] : []
|
|
2381
2410
|
];
|
|
2411
|
+
/**
|
|
2412
|
+
* Where to go when the board won't take the credential sent: a token you passed is yours to replace, and so is
|
|
2413
|
+
* BOARD_TOKEN: logging in changes nothing while either is the one sent, or a workflow's own, where there's no login.
|
|
2414
|
+
*/
|
|
2415
|
+
const loginRecoveries = () => sent() === "the token you passed" ? [{ instruction: "Pass a token it accepts" }] : sent() === "BOARD_TOKEN" ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN, or unset it" }] : sent() === "GitHub Actions OIDC" ? [{ instruction: "Pass a token it accepts in BOARD_TOKEN" }] : [{
|
|
2416
|
+
instruction: "Log in again",
|
|
2417
|
+
argv: ["vercel", "login"]
|
|
2418
|
+
}];
|
|
2382
2419
|
/** Where to go from a 403: what you may do on this board, and who can let you do more. */
|
|
2383
2420
|
const refusedRecoveries = () => [{
|
|
2384
2421
|
instruction: "See what you can do on this board",
|
|
@@ -4113,6 +4150,7 @@ async function tasks(args) {
|
|
|
4113
4150
|
const claim = await claimFor(board, claims, before[0], "run");
|
|
4114
4151
|
if (typeof claim === "number") return claim;
|
|
4115
4152
|
const id = claim.task.id;
|
|
4153
|
+
runTask = id;
|
|
4116
4154
|
const lease = seconds("lease");
|
|
4117
4155
|
const ran = await runCommand(command, {
|
|
4118
4156
|
env: {
|
|
@@ -4280,6 +4318,47 @@ async function tasks(args) {
|
|
|
4280
4318
|
}
|
|
4281
4319
|
}
|
|
4282
4320
|
}
|
|
4321
|
+
/** Which note a board refused as too long, from its words: `result: a task's result is at most 1,000 characters` here, `result should NOT be longer than 1000 characters` on Vercel's. Null for anything else, and off a task's settling. */
|
|
4322
|
+
function taskNoteTooLong(said) {
|
|
4323
|
+
const { command, args } = current;
|
|
4324
|
+
if (command !== "tasks" || ![
|
|
4325
|
+
"run",
|
|
4326
|
+
"complete",
|
|
4327
|
+
"fail",
|
|
4328
|
+
"block",
|
|
4329
|
+
"cancel"
|
|
4330
|
+
].includes(args[0] ?? "")) return null;
|
|
4331
|
+
const what = /^\s*(result|reason)\b/i.exec(said)?.[1]?.toLowerCase();
|
|
4332
|
+
if (what !== "result" && what !== "reason" || !/(at most|longer than|too long)/i.test(said)) return null;
|
|
4333
|
+
return what;
|
|
4334
|
+
}
|
|
4335
|
+
/** Where a too-long task note goes: the whole of it in a reply in the task's thread, then the settling again with a line or two. */
|
|
4336
|
+
function noteRecovery(whole) {
|
|
4337
|
+
const { args } = current;
|
|
4338
|
+
const named = args[1] !== void 0 && isMessageRef(args[1]) ? messageId(args[1]) : "<ID>";
|
|
4339
|
+
const id = args[0] === "run" ? runTask ?? named : named;
|
|
4340
|
+
const verb = args[0] === "run" ? "complete" : args[0];
|
|
4341
|
+
return [{
|
|
4342
|
+
instruction: `Reply the full ${whole} in the task's thread`,
|
|
4343
|
+
argv: [
|
|
4344
|
+
...cli(),
|
|
4345
|
+
"reply",
|
|
4346
|
+
id,
|
|
4347
|
+
"-",
|
|
4348
|
+
...onThisBoard()
|
|
4349
|
+
]
|
|
4350
|
+
}, {
|
|
4351
|
+
instruction: `Then ${verb} it with a line or two`,
|
|
4352
|
+
argv: [
|
|
4353
|
+
...cli(),
|
|
4354
|
+
"tasks",
|
|
4355
|
+
verb,
|
|
4356
|
+
id,
|
|
4357
|
+
"<A LINE OR TWO>",
|
|
4358
|
+
...onThisBoard()
|
|
4359
|
+
]
|
|
4360
|
+
}];
|
|
4361
|
+
}
|
|
4283
4362
|
/** How a board's own word about a task reads from here: the headline, and the way on. Null for any other code. */
|
|
4284
4363
|
function taskFailure(code, status) {
|
|
4285
4364
|
const { command, args } = current;
|
|
@@ -4770,6 +4849,7 @@ async function runOnce(argv, options) {
|
|
|
4770
4849
|
teamDefault = null;
|
|
4771
4850
|
sent = () => null;
|
|
4772
4851
|
sentLength = 0;
|
|
4852
|
+
runTask = void 0;
|
|
4773
4853
|
self = null;
|
|
4774
4854
|
try {
|
|
4775
4855
|
parse(argv);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as sqlTables } from "./sql-
|
|
2
|
-
import { t as memory$1 } from "./store-memory-
|
|
3
|
-
import { t as sqliteDb } from "./sqlite-db-
|
|
1
|
+
import { r as sqlTables } from "./sql-CvBbb5Ui.mjs";
|
|
2
|
+
import { t as memory$1 } from "./store-memory-DOMraCLN.mjs";
|
|
3
|
+
import { t as sqliteDb } from "./sqlite-db-DSVlzQjv.mjs";
|
|
4
4
|
//#region src/store/memory.ts
|
|
5
5
|
/**
|
|
6
6
|
* A board that lives in memory, for tests: its log in A2's memory store, its
|
|
@@ -49,6 +49,10 @@ const isEmail = (value) => /^[^\s@:]+@[^\s@:]+$/.test(value);
|
|
|
49
49
|
const mentionTerm = (name) => name.includes(":") ? name : name.toLowerCase();
|
|
50
50
|
/** What `text` mentions, as filters match it: each `@handle` and `@[…]`, as `mentionTerm` has it. */
|
|
51
51
|
const mentionTerms = (text) => [...new Set(extractMentions(text).map((token) => mentionTerm(token.kind === "handle" ? token.handle : token.actor)))];
|
|
52
|
+
/** What `--mentions me` matches: the caller's actor ID and handle, where it has one, and none of their profiles. */
|
|
53
|
+
const meTerms = (me) => [me.id, ...me.handle ? [mentionTerm(me.handle)] : []];
|
|
54
|
+
/** Whether `text` mentions what a `--mentions` filter matches. */
|
|
55
|
+
const mentionsIn = (text, match) => mentionTerms(text).some((term) => match.terms.includes(term) || match.prefixes.some((prefix) => term.startsWith(prefix)));
|
|
52
56
|
/**
|
|
53
57
|
* Rewrites each mention in prose with `replace`, which also gets the mention as
|
|
54
58
|
* written; one it returns null for stays as written.
|
|
@@ -116,4 +120,4 @@ function settleMentions(text, actors, prefer = () => null) {
|
|
|
116
120
|
};
|
|
117
121
|
}
|
|
118
122
|
//#endregion
|
|
119
|
-
export {
|
|
123
|
+
export { mentionTerms as a, settleMentions as c, mentionTerm as i, isEmail as n, mentionsIn as o, meTerms as r, replaceMentions as s, extractMentions as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as NewLabels, m as MESSAGE_TEXT_MAX } from "./schemas-CUSTEFIy.mjs";
|
|
2
|
-
import { t as HttpError } from "./errors-
|
|
2
|
+
import { t as HttpError } from "./errors-BfMR39F0.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/client/ids.ts
|
|
5
5
|
const hex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Jn as ExternalEvent, Rt as SourceJoin, Vn as Actor, Vt as SourceRead, Xn as ExternalLink, Yn as ExternalFile, Zn as Link, qn as ExternalAuthor, u as BoardEventView, ut as MessageView } from "./routes-
|
|
2
|
-
import { t as BoardClient } from "./client-
|
|
1
|
+
import { Jn as ExternalEvent, Rt as SourceJoin, Vn as Actor, Vt as SourceRead, Xn as ExternalLink, Yn as ExternalFile, Zn as Link, qn as ExternalAuthor, u as BoardEventView, ut as MessageView } from "./routes-CSnxZyyb.mjs";
|
|
2
|
+
import { t as BoardClient } from "./client-B0DGOt7P.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/contract/bots.d.ts
|
|
5
5
|
/**
|
|
@@ -2829,8 +2829,8 @@ declare const routes: {
|
|
|
2829
2829
|
}, z.core.$strict>;
|
|
2830
2830
|
};
|
|
2831
2831
|
readonly updateGrant: {
|
|
2832
|
-
readonly method: '
|
|
2833
|
-
readonly path: '/grants/:id';
|
|
2832
|
+
readonly method: 'POST';
|
|
2833
|
+
readonly path: '/grants/:id/update';
|
|
2834
2834
|
readonly body: z.ZodObject<{
|
|
2835
2835
|
add: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2836
2836
|
kind: z.ZodLiteral<"user">;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-
|
|
2
|
-
import { i as hostCheckedBy } from "./exports-
|
|
3
|
-
import { i as LOGINS, r as LOGIN } from "./auth-
|
|
4
|
-
import { h as localTokenFile, t as board } from "./server-
|
|
5
|
-
import { t as oidcTokens } from "./tokens-
|
|
6
|
-
import { t as local } from "./local-
|
|
1
|
+
import { f as BoardError, p as createBoardClient, t as HttpError } from "./errors-BfMR39F0.mjs";
|
|
2
|
+
import { i as hostCheckedBy } from "./exports-x-ioAfbp.mjs";
|
|
3
|
+
import { i as LOGINS, r as LOGIN } from "./auth-BDWGvFWl.mjs";
|
|
4
|
+
import { h as localTokenFile, t as board } from "./server-BSexF7Bk.mjs";
|
|
5
|
+
import { t as oidcTokens } from "./tokens-_1X8JNLT.mjs";
|
|
6
|
+
import { t as local } from "./local-Gp8pqHSu.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";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as formatProfileHeader } from "./profile-header-O8wC8yk8.mjs";
|
|
2
2
|
import "./schemas-CUSTEFIy.mjs";
|
|
3
|
-
import { f as BoardError,
|
|
4
|
-
import { g as keyId, p as DERIVED_ID } from "./middleware-
|
|
5
|
-
import { o as compileWatcher, u as METHODS } from "./task-batch-
|
|
6
|
-
import { c as createVercel, d as withoutToken, f as tailWatchers, p as deployedOnVercel, r as createBoard, u as PROTOCOL_ROUTES } from "./exports-
|
|
3
|
+
import { f as BoardError, g as refusalCode, gt as routes, p as createBoardClient, t as HttpError } from "./errors-BfMR39F0.mjs";
|
|
4
|
+
import { g as keyId, p as DERIVED_ID } from "./middleware-bIABV895.mjs";
|
|
5
|
+
import { o as compileWatcher, u as METHODS } from "./task-batch-DgyfK9qx.mjs";
|
|
6
|
+
import { c as createVercel, d as withoutToken, f as tailWatchers, p as deployedOnVercel, r as createBoard, u as PROTOCOL_ROUTES } from "./exports-x-ioAfbp.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";
|
|
@@ -770,7 +770,7 @@ function createHttp(url, options, environment) {
|
|
|
770
770
|
const profiles = /* @__PURE__ */ new Map();
|
|
771
771
|
/** This deployment as `profile`: a watcher's ID, or the middleware. */
|
|
772
772
|
function asProfile(profile) {
|
|
773
|
-
if (!PROFILE.test(profile)) throw new HttpError(400, "
|
|
773
|
+
if (!PROFILE.test(profile)) throw new HttpError(400, "invalid_profile", `as: ${profile}: profiles start with a letter and use up to 32 letters, numbers, and hyphens`);
|
|
774
774
|
let client = profiles.get(profile);
|
|
775
775
|
if (!client) profiles.set(profile, client = sdk(profile));
|
|
776
776
|
return client;
|
|
@@ -855,7 +855,7 @@ function createHttp(url, options, environment) {
|
|
|
855
855
|
if (response.ok) return response;
|
|
856
856
|
try {
|
|
857
857
|
const body = await response.json();
|
|
858
|
-
if (body.error?.message) throw new HttpError(response.status, body.error
|
|
858
|
+
if (body.error?.message) throw new HttpError(response.status, refusalCode(response.status, body.error) ?? "error", body.error.message, typeof body.error.hint === "string" ? { hint: body.error.hint } : {});
|
|
859
859
|
} catch (error) {
|
|
860
860
|
if (error instanceof HttpError) throw error;
|
|
861
861
|
}
|
|
@@ -1114,8 +1114,8 @@ function vercel(options = {}) {
|
|
|
1114
1114
|
function board(options = {}) {
|
|
1115
1115
|
return createBoard(options, {
|
|
1116
1116
|
backend: (fetch) => process.env.BOARD_URL?.trim() ? http() : vercel(fetch ? { fetch } : {}),
|
|
1117
|
-
sync: () => import("./engine-
|
|
1118
|
-
serving: () => import("./serving-
|
|
1117
|
+
sync: () => import("./engine-B_CjnE3G.mjs"),
|
|
1118
|
+
serving: () => import("./serving-ByD4TOOU.mjs"),
|
|
1119
1119
|
sandbox: (url, token) => sandboxHeaders(url, url, token)
|
|
1120
1120
|
});
|
|
1121
1121
|
}
|