@openmuster/muster 0.3.1-alpha.3 → 0.3.1-alpha.4
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/README.md +7 -5
- package/dist/{args-DX9QSK1f.js → args-9ZZDcPxa.js} +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.js +2 -2
- package/dist/inspect/app.js +45 -40
- package/dist/{main-CdVlnWHy.js → main-D5aX7Jaj.js} +4 -4
- package/dist/{main-DgrIMbeA.js → main-Doit2DDY.js} +242 -21
- package/dist/mcp-Cm96TIb3.js +6 -0
- package/dist/{module-CxoN1MOe.js → module-D8qcE3e7.js} +1 -1
- package/dist/{module-C-HJjWWo.js → module-DjDMSEKu.js} +2 -2
- package/dist/{steps-DtzUdcBE.js → steps-BUPRIOe3.js} +1 -1
- package/docs/01-quickstart.md +4 -1
- package/docs/03-guides/04-inspector.md +19 -0
- package/docs/04-reference/01-cli.md +1 -0
- package/docs/index.md +21 -0
- package/package.json +1 -1
- package/dist/mcp-NueWYyQs.js +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./steps-
|
|
3
|
-
import { a as main, i as attend, n as agentPrompt, o as meantCommand, r as agentToken, s as repoUrl, t as SPECS } from "./main-
|
|
4
|
-
import "./module-
|
|
1
|
+
import { D as VERSION } from "./args-9ZZDcPxa.js";
|
|
2
|
+
import "./steps-BUPRIOe3.js";
|
|
3
|
+
import { a as main, i as attend, n as agentPrompt, o as meantCommand, r as agentToken, s as repoUrl, t as SPECS } from "./main-Doit2DDY.js";
|
|
4
|
+
import "./module-D8qcE3e7.js";
|
|
5
5
|
|
|
6
6
|
export { SPECS, VERSION, agentPrompt, agentToken, attend, main, meantCommand, repoUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { E as KEEP_LOGS_MS, F as conformance, M as generic, N as isSessionId, O as runLocal, P as http, T as installationToken, _ as BUNDLE_MAX, b as openPullRequest, c as runWorkflows, d as workflowsPath, f as e2b, g as BUNDLE, h as vercel, i as pushesTask, k as AGENTS, l as spawnWorker, m as cloudflare, n as fillResults, p as SANDBOX_ENV, r as pullTitle, s as openRuns, t as FillRefused, u as loadWorkflows, v as branchState, w as githubApp, x as pushBundle, y as githubRepo } from "./steps-
|
|
3
|
-
import { C as begin, D as reset, E as readGuard, O as retryAt, S as STEADY_AFTER, T as guardPath, b as RESTART_LIMIT, c as chooseModule, d as invokedAs, f as launchGuard, k as steady, l as defaultModule, m as loadsModule, p as loadBoard, s as SERVE_SPEC, t as DAEMON_SPEC, u as endLaunch, v as refusal, w as ended, x as RESTART_WINDOW, y as self } from "./module-
|
|
1
|
+
import { A as boardPath, C as listen, D as VERSION, E as RELEASE_HOSTS, F as configDir, I as dropClaim, L as heldClaim, M as boardKey, O as releaseTarball, Q as actorId, R as keepClaim, S as isLoopback, _ as ping, a as list, at as misuse, c as parse, d as ROOT, f as board, g as armHooks, h as HOOKS_LEASE, i as id, it as Failure, j as file, k as loadOidc, l as str, m as DROPPED, n as cursor, nt as labelFilter, o as on, p as syncLoop, q as processStart, r as duration, rt as profileName, s as pairs, t as GLOBAL, v as why, w as ROUTES, y as holdLease } from "./args-9ZZDcPxa.js";
|
|
2
|
+
import { E as KEEP_LOGS_MS, F as conformance, M as generic, N as isSessionId, O as runLocal, P as http, T as installationToken, _ as BUNDLE_MAX, b as openPullRequest, c as runWorkflows, d as workflowsPath, f as e2b, g as BUNDLE, h as vercel, i as pushesTask, k as AGENTS, l as spawnWorker, m as cloudflare, n as fillResults, p as SANDBOX_ENV, r as pullTitle, s as openRuns, t as FillRefused, u as loadWorkflows, v as branchState, w as githubApp, x as pushBundle, y as githubRepo } from "./steps-BUPRIOe3.js";
|
|
3
|
+
import { C as begin, D as reset, E as readGuard, O as retryAt, S as STEADY_AFTER, T as guardPath, b as RESTART_LIMIT, c as chooseModule, d as invokedAs, f as launchGuard, k as steady, l as defaultModule, m as loadsModule, p as loadBoard, s as SERVE_SPEC, t as DAEMON_SPEC, u as endLaunch, v as refusal, w as ended, x as RESTART_WINDOW, y as self } from "./module-D8qcE3e7.js";
|
|
4
4
|
import { chmodSync, cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir, tmpdir } from "node:os";
|
|
6
6
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -10,6 +10,90 @@ import { createServer } from "node:http";
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { createInterface } from "node:readline";
|
|
12
12
|
|
|
13
|
+
//#region src/cli/update.ts
|
|
14
|
+
/**
|
|
15
|
+
* Says when a newer muster is out, for whoever asked to be told: off unless `MUSTER_UPDATE_CHECK=1`.
|
|
16
|
+
* muster makes no request of its own otherwise. Asked for, it asks npm's registry (or the one
|
|
17
|
+
* `npm_config_registry` names) for the version tagged latest, at most once a day, from a process of
|
|
18
|
+
* its own that no command waits for, and sends nothing but that request. What it learned is kept in
|
|
19
|
+
* the config folder, and the next command in a terminal says so in one line on stderr.
|
|
20
|
+
*/
|
|
21
|
+
const PACKAGE = "@openmuster/muster";
|
|
22
|
+
/** A release number and nothing else: what the registry or the kept file says is printed only if it is one. */
|
|
23
|
+
const RELEASE = /^\d{1,6}\.\d{1,6}\.\d{1,6}(-[0-9A-Za-z]{1,20}(\.[0-9A-Za-z]{1,20}){0,3})?$/;
|
|
24
|
+
const DAY = 1440 * 60 * 1e3;
|
|
25
|
+
/** Release numbers in order: 0.3.1-alpha.2 < 0.3.1-alpha.10 < 0.3.1-beta.1 < 0.3.1. Negative when a is older. */
|
|
26
|
+
function compareVersions(a, b) {
|
|
27
|
+
const split = (version) => {
|
|
28
|
+
const [core, pre] = version.split(/-(.*)/s, 2);
|
|
29
|
+
return {
|
|
30
|
+
core: core.split(".").map(Number),
|
|
31
|
+
pre: pre === void 0 ? null : pre.split(".")
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const x = split(a);
|
|
35
|
+
const y = split(b);
|
|
36
|
+
for (let i = 0; i < 3; i++) if ((x.core[i] ?? 0) !== (y.core[i] ?? 0)) return (x.core[i] ?? 0) - (y.core[i] ?? 0);
|
|
37
|
+
if (x.pre === null || y.pre === null) return x.pre === y.pre ? 0 : x.pre === null ? 1 : -1;
|
|
38
|
+
for (let i = 0; i < Math.max(x.pre.length, y.pre.length); i++) {
|
|
39
|
+
const p = x.pre[i];
|
|
40
|
+
const q = y.pre[i];
|
|
41
|
+
if (p === void 0 || q === void 0) return p === void 0 ? -1 : 1;
|
|
42
|
+
if (p === q) continue;
|
|
43
|
+
return /^\d+$/.test(p) && /^\d+$/.test(q) ? Number(p) - Number(q) : p < q ? -1 : 1;
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
const checkPath = (env) => join(env.MUSTER_CONFIG ?? join(env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "muster"), "update-check.json");
|
|
48
|
+
const registryOf = (env) => (env.npm_config_registry || "https://registry.npmjs.org").replace(/\/+$/, "");
|
|
49
|
+
/** Whether to say anything, and whether to ask again: only for someone who opted in, at a terminal. */
|
|
50
|
+
function updateNotice(input) {
|
|
51
|
+
const { version, env, tty, json, now, checked } = input;
|
|
52
|
+
if (env.MUSTER_UPDATE_CHECK !== "1" || !tty || json || env.CI || version === "0.0.0") return {
|
|
53
|
+
notice: null,
|
|
54
|
+
ask: false
|
|
55
|
+
};
|
|
56
|
+
const newer = typeof checked?.latest === "string" && RELEASE.test(checked.latest) && compareVersions(checked.latest, version) > 0 ? checked.latest : null;
|
|
57
|
+
return {
|
|
58
|
+
notice: newer ? `muster ${newer} is out; this is ${version}. npm install -g ${PACKAGE}` : null,
|
|
59
|
+
ask: checked === null || !(now - checked.checked < DAY)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function readChecked(path) {
|
|
63
|
+
try {
|
|
64
|
+
const found = JSON.parse(readFileSync(path, "utf8"));
|
|
65
|
+
return typeof found.checked === "number" ? found : null;
|
|
66
|
+
} catch {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const ASK = `
|
|
71
|
+
const [path, url, before] = process.argv.slice(1)
|
|
72
|
+
const fs = require('node:fs')
|
|
73
|
+
const write = (latest) => { try { fs.mkdirSync(require('node:path').dirname(path), { recursive: true }); fs.writeFileSync(path, JSON.stringify({ checked: Date.now(), latest })) } catch {} }
|
|
74
|
+
fetch(url, { signal: AbortSignal.timeout(5000), headers: { accept: 'application/json' } })
|
|
75
|
+
.then((response) => (response.ok ? response.json() : null))
|
|
76
|
+
.then((tags) => write(tags && typeof tags.latest === 'string' ? tags.latest : before || null), () => write(before || null))
|
|
77
|
+
`;
|
|
78
|
+
/** Starts the check and leaves it: the command that started it ends when it would have. */
|
|
79
|
+
function ask(env, checked) {
|
|
80
|
+
const url = `${registryOf(env)}/-/package/${PACKAGE.replace("/", "%2f")}/dist-tags`;
|
|
81
|
+
try {
|
|
82
|
+
spawn(process.execPath, [
|
|
83
|
+
"-e",
|
|
84
|
+
ASK,
|
|
85
|
+
checkPath(env),
|
|
86
|
+
url,
|
|
87
|
+
checked?.latest ?? ""
|
|
88
|
+
], {
|
|
89
|
+
detached: true,
|
|
90
|
+
stdio: "ignore",
|
|
91
|
+
env
|
|
92
|
+
}).unref();
|
|
93
|
+
} catch {}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
13
97
|
//#region src/cli/format.ts
|
|
14
98
|
/** How long ago, or how long until, in a word: `11s`, `5m`, `3h`, `2d`. */
|
|
15
99
|
function span(ms) {
|
|
@@ -734,7 +818,8 @@ serve
|
|
|
734
818
|
MUSTER_INSECURE_HTTP=1: for a network that is private some other way.
|
|
735
819
|
|
|
736
820
|
states: waiting, ready, claimed, blocked, completed, failed, canceled
|
|
737
|
-
exit: 0 ok, 1 failed or timed out, 2 misuse, 130 interrupted, 143 terminated
|
|
821
|
+
exit: 0 ok, 1 failed or timed out, 2 misuse, 130 interrupted, 143 terminated
|
|
822
|
+
update: MUSTER_UPDATE_CHECK=1 says, once a day, when a newer muster is out`;
|
|
738
823
|
const GLOBAL_LINE = "global: [--as <profile>] [--board <name>] [--dir <path>] [--url <board url>] [--json]";
|
|
739
824
|
/**
|
|
740
825
|
* One command's part of the help: its lines as the whole help has them, under the section they are in,
|
|
@@ -860,6 +945,7 @@ function inspect(options) {
|
|
|
860
945
|
if (req.method !== "POST") throw new Failure("not_found", "No such route.");
|
|
861
946
|
if (req.headers.origin !== origin) throw new Failure("forbidden", "Writes come from the inspector page.");
|
|
862
947
|
const route = url.pathname.slice(7);
|
|
948
|
+
if (route === "whoami") return send(res, 200, { ok: actorId(await options.backend.self(null)) });
|
|
863
949
|
const answering = route === "joinList" || route === "joinApprove" || route === "joinDeny";
|
|
864
950
|
if (!ALLOWED.has(route) && !answering) throw new Failure("not_found", "No such route.");
|
|
865
951
|
const chunks = [];
|
|
@@ -1100,6 +1186,33 @@ async function checkWatcher(run, parsed, mode, guardAt) {
|
|
|
1100
1186
|
}
|
|
1101
1187
|
}
|
|
1102
1188
|
const stopCode = (signal) => signal.reason === "SIGTERM" ? 143 : 130;
|
|
1189
|
+
/**
|
|
1190
|
+
* Rides out a board that is out of reach for now, for a command that waits: a gateway's 502 or a dropped
|
|
1191
|
+
* connection isn't an answer, so the poll goes again after a pause that doubles, as the daemon's does.
|
|
1192
|
+
* Only once the command has reached the board (`ok`): a board out of reach from the start is said at
|
|
1193
|
+
* once, as any command says it. `failed` rethrows what isn't an outage, and an outage whose next try
|
|
1194
|
+
* would come after the deadline, so the command says what went wrong rather than that nothing came.
|
|
1195
|
+
* With no deadline it waits for as long as the command runs. A stop ends the pause at once, and
|
|
1196
|
+
* `failed` returns: the caller checks the stop and exits as stopped.
|
|
1197
|
+
*/
|
|
1198
|
+
function outages(run, deadline) {
|
|
1199
|
+
let failing = 0;
|
|
1200
|
+
let reached = false;
|
|
1201
|
+
return {
|
|
1202
|
+
ok() {
|
|
1203
|
+
reached = true;
|
|
1204
|
+
failing = 0;
|
|
1205
|
+
},
|
|
1206
|
+
async failed(error$1) {
|
|
1207
|
+
if (run.io.stop.aborted) return;
|
|
1208
|
+
if (!reached || !(error$1 instanceof Failure) || !UNREACHABLE.has(error$1.reason)) throw error$1;
|
|
1209
|
+
const pause = Math.min(FAILING_PAUSE, 500 * 2 ** failing++);
|
|
1210
|
+
if (deadline !== void 0 && Date.now() + pause >= deadline) throw error$1;
|
|
1211
|
+
if (!run.json && (failing & failing - 1) === 0) run.io.err(`error ${error$1.message} Trying again.${failing > 1 ? ` (${failing} tries in a row)` : ""}`);
|
|
1212
|
+
await sleep(pause, run.io.stop);
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
}
|
|
1103
1216
|
/** An argument as a shell takes it, quoted only when it has to be. */
|
|
1104
1217
|
const shell = (arg) => /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
|
|
1105
1218
|
function textOf(parsed, at, io) {
|
|
@@ -1337,13 +1450,24 @@ const commands = {
|
|
|
1337
1450
|
if (limit !== void 0 && !/^[1-9][0-9]*$/.test(limit)) throw misuse("invalid_limit", "--limit takes a whole number of at least 1.");
|
|
1338
1451
|
const deadline = wait === void 0 ? 0 : Date.now() + duration(wait, "wait") * 1e3;
|
|
1339
1452
|
let after = await run.team.cursorGet("inbox") ?? 0;
|
|
1453
|
+
const outage = wait === void 0 ? null : outages(run, deadline);
|
|
1454
|
+
outage?.ok();
|
|
1340
1455
|
let pause = 100;
|
|
1341
1456
|
for (;;) {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1457
|
+
let page;
|
|
1458
|
+
try {
|
|
1459
|
+
page = await run.team.events({
|
|
1460
|
+
after,
|
|
1461
|
+
filter: { for: mine },
|
|
1462
|
+
limit: limit === void 0 ? 50 : Number(limit)
|
|
1463
|
+
});
|
|
1464
|
+
outage?.ok();
|
|
1465
|
+
} catch (error$1) {
|
|
1466
|
+
if (outage === null) throw error$1;
|
|
1467
|
+
await outage.failed(error$1);
|
|
1468
|
+
if (run.io.stop.aborted) return stopCode(run.io.stop);
|
|
1469
|
+
continue;
|
|
1470
|
+
}
|
|
1347
1471
|
after = page.cursor;
|
|
1348
1472
|
if (page.events.length > 0 || Date.now() >= deadline || run.io.stop.aborted) {
|
|
1349
1473
|
if (!peek) await run.team.cursorSet("inbox", page.cursor);
|
|
@@ -1636,16 +1760,26 @@ const commands = {
|
|
|
1636
1760
|
async run(run, parsed) {
|
|
1637
1761
|
const filter = filterOf(parsed, 0);
|
|
1638
1762
|
const given = str(parsed.flags, "after");
|
|
1639
|
-
let after = given !== void 0 ? cursor(given, "after") : await run.team.head();
|
|
1640
1763
|
const timeout = duration(str(parsed.flags, "timeout") ?? "30m", "timeout") * 1e3;
|
|
1641
1764
|
const deadline = Date.now() + timeout;
|
|
1765
|
+
const outage = outages(run, deadline);
|
|
1766
|
+
let after = given !== void 0 ? cursor(given, "after") : await run.team.head();
|
|
1767
|
+
if (given === void 0) outage.ok();
|
|
1642
1768
|
let pause = 100;
|
|
1643
1769
|
for (;;) {
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1770
|
+
let page;
|
|
1771
|
+
try {
|
|
1772
|
+
page = await run.team.events({
|
|
1773
|
+
after,
|
|
1774
|
+
filter,
|
|
1775
|
+
limit: 1
|
|
1776
|
+
});
|
|
1777
|
+
outage.ok();
|
|
1778
|
+
} catch (error$1) {
|
|
1779
|
+
await outage.failed(error$1);
|
|
1780
|
+
if (run.io.stop.aborted) return stopCode(run.io.stop);
|
|
1781
|
+
continue;
|
|
1782
|
+
}
|
|
1649
1783
|
after = page.cursor;
|
|
1650
1784
|
const event = page.events[0];
|
|
1651
1785
|
if (event) {
|
|
@@ -1684,12 +1818,21 @@ const commands = {
|
|
|
1684
1818
|
});
|
|
1685
1819
|
for (const event of all.events.slice(-count)) run.io.out(run.json ? JSON.stringify(event) : eventLine(event, run.now()));
|
|
1686
1820
|
}
|
|
1821
|
+
const outage = outages(run);
|
|
1822
|
+
if (given === void 0) outage.ok();
|
|
1687
1823
|
let pause = 100;
|
|
1688
1824
|
while (!run.io.stop.aborted) {
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1825
|
+
let page;
|
|
1826
|
+
try {
|
|
1827
|
+
page = await run.team.events({
|
|
1828
|
+
after,
|
|
1829
|
+
filter
|
|
1830
|
+
});
|
|
1831
|
+
outage.ok();
|
|
1832
|
+
} catch (error$1) {
|
|
1833
|
+
await outage.failed(error$1);
|
|
1834
|
+
continue;
|
|
1835
|
+
}
|
|
1693
1836
|
after = page.cursor;
|
|
1694
1837
|
for (const event of page.events) run.io.out(run.json ? JSON.stringify(event) : eventLine(event, run.now()));
|
|
1695
1838
|
pause = page.events.length ? 100 : Math.min(pause * 2, 1e3);
|
|
@@ -2426,6 +2569,60 @@ const TASK_VERBS = [
|
|
|
2426
2569
|
"needs",
|
|
2427
2570
|
"run"
|
|
2428
2571
|
];
|
|
2572
|
+
/**
|
|
2573
|
+
* The flags each verb takes. `tasks` parses the flags of all of them, so without this a flag only another
|
|
2574
|
+
* verb reads was taken and dropped: `tasks complete 5 --file report.md` completed with no result.
|
|
2575
|
+
*/
|
|
2576
|
+
const CLAIM_FLAGS = [
|
|
2577
|
+
"ready",
|
|
2578
|
+
"label",
|
|
2579
|
+
"from",
|
|
2580
|
+
"by",
|
|
2581
|
+
"lease",
|
|
2582
|
+
"wait"
|
|
2583
|
+
];
|
|
2584
|
+
const TASK_FLAGS = {
|
|
2585
|
+
list: [
|
|
2586
|
+
"state",
|
|
2587
|
+
"limit",
|
|
2588
|
+
"label",
|
|
2589
|
+
"latest"
|
|
2590
|
+
],
|
|
2591
|
+
create: [
|
|
2592
|
+
"label",
|
|
2593
|
+
"needs",
|
|
2594
|
+
"for",
|
|
2595
|
+
"claim",
|
|
2596
|
+
"lease",
|
|
2597
|
+
"hold",
|
|
2598
|
+
"reason",
|
|
2599
|
+
"file",
|
|
2600
|
+
"idempotency-key",
|
|
2601
|
+
"no-sync"
|
|
2602
|
+
],
|
|
2603
|
+
claim: CLAIM_FLAGS,
|
|
2604
|
+
renew: ["lease"],
|
|
2605
|
+
release: [],
|
|
2606
|
+
complete: ["result"],
|
|
2607
|
+
fail: ["reason", "no-count"],
|
|
2608
|
+
block: ["reason", "kind"],
|
|
2609
|
+
unblock: [],
|
|
2610
|
+
reopen: ["round"],
|
|
2611
|
+
cancel: [],
|
|
2612
|
+
assign: ["for", "pool"],
|
|
2613
|
+
needs: ["none"],
|
|
2614
|
+
run: [...CLAIM_FLAGS, "result"]
|
|
2615
|
+
};
|
|
2616
|
+
function refuseOtherVerbsFlags(verb, flags) {
|
|
2617
|
+
const takes = TASK_FLAGS[verb];
|
|
2618
|
+
const global = new Set([...GLOBAL.value, ...GLOBAL.bool]);
|
|
2619
|
+
const other = Object.keys(flags).find((name) => !global.has(name) && !takes.includes(name));
|
|
2620
|
+
if (other === void 0) return;
|
|
2621
|
+
const command = verb === "list" ? "mu tasks" : `mu tasks ${verb}`;
|
|
2622
|
+
const what = takes.length ? `${command} takes ${takes.map((name) => `--${name}`).join(", ")}.` : `${command} takes no flags of its own.`;
|
|
2623
|
+
const report = (verb === "complete" || verb === "fail" || verb === "block") && other === "file" ? " A long report goes in a reply: mu reply <thread> --file <path>." : "";
|
|
2624
|
+
throw misuse("unknown_flag", `--${other} isn't a flag of ${command}.`, what + report);
|
|
2625
|
+
}
|
|
2429
2626
|
const lease = (flags) => {
|
|
2430
2627
|
const value = str(flags, "lease");
|
|
2431
2628
|
return value === void 0 ? {} : { lease: duration(value, "lease") };
|
|
@@ -2469,6 +2666,8 @@ async function claimWith(run, parsed, target, me, pid) {
|
|
|
2469
2666
|
};
|
|
2470
2667
|
const wait = str(parsed.flags, "wait");
|
|
2471
2668
|
const deadline = wait === void 0 ? 0 : Date.now() + duration(wait, "wait") * 1e3;
|
|
2669
|
+
const outage = ready !== void 0 && wait !== void 0 ? outages(run, deadline) : null;
|
|
2670
|
+
outage?.ok();
|
|
2472
2671
|
let pause = 100;
|
|
2473
2672
|
for (;;) try {
|
|
2474
2673
|
const claimed = await run.team.taskClaim(request);
|
|
@@ -2478,6 +2677,11 @@ async function claimWith(run, parsed, target, me, pid) {
|
|
|
2478
2677
|
});
|
|
2479
2678
|
return claimed;
|
|
2480
2679
|
} catch (error$1) {
|
|
2680
|
+
if (outage !== null && error$1 instanceof Failure && UNREACHABLE.has(error$1.reason)) {
|
|
2681
|
+
await outage.failed(error$1);
|
|
2682
|
+
if (run.io.stop.aborted) throw error$1;
|
|
2683
|
+
continue;
|
|
2684
|
+
}
|
|
2481
2685
|
if (!(error$1 instanceof Failure) || error$1.reason !== "nothing_ready" || ready === void 0 || wait === void 0) throw error$1;
|
|
2482
2686
|
if (run.io.stop.aborted) throw error$1;
|
|
2483
2687
|
if (Date.now() >= deadline) throw new Failure("timeout", `Nothing was ready in ${ready} within ${wait}.`, { hint: "That isn't a failure of the work: there is nothing to take." });
|
|
@@ -2488,6 +2692,7 @@ async function claimWith(run, parsed, target, me, pid) {
|
|
|
2488
2692
|
async function tasks(run, parsed) {
|
|
2489
2693
|
const verb = parsed.positionals[0];
|
|
2490
2694
|
const now = () => run.now();
|
|
2695
|
+
refuseOtherVerbsFlags(verb !== void 0 && TASK_VERBS.includes(verb) ? verb : "list", parsed.flags);
|
|
2491
2696
|
if (verb === void 0 || !TASK_VERBS.includes(verb)) {
|
|
2492
2697
|
const state = str(parsed.flags, "state");
|
|
2493
2698
|
const labels = list(parsed.flags, "label");
|
|
@@ -3731,12 +3936,28 @@ async function main(argv, io) {
|
|
|
3731
3936
|
const command = commands[name];
|
|
3732
3937
|
try {
|
|
3733
3938
|
const parsed = parse(argv.slice(1), command.spec);
|
|
3734
|
-
|
|
3735
|
-
|
|
3939
|
+
const code = name === "daemon" && parsed.positionals[0] === "run" && !runsModule(parsed.flags, io.env) ? await counted(guardOf(parsed.flags, io.env).path, io, () => dispatch(name, command, parsed, io, json)) : await dispatch(name, command, parsed, io, json);
|
|
3940
|
+
newerRelease(io, json);
|
|
3941
|
+
return code;
|
|
3736
3942
|
} catch (error$1) {
|
|
3737
3943
|
return fail(io, json, error$1);
|
|
3738
3944
|
}
|
|
3739
3945
|
}
|
|
3946
|
+
/** For whoever opted in with MUSTER_UPDATE_CHECK=1: one line when a newer release is out (update.ts). */
|
|
3947
|
+
function newerRelease(io, json) {
|
|
3948
|
+
if (io.env.MUSTER_UPDATE_CHECK !== "1") return;
|
|
3949
|
+
const checked = readChecked(checkPath(io.env));
|
|
3950
|
+
const { notice, ask: again } = updateNotice({
|
|
3951
|
+
version: VERSION,
|
|
3952
|
+
env: io.env,
|
|
3953
|
+
tty: io.tty === true,
|
|
3954
|
+
json,
|
|
3955
|
+
now: Date.now(),
|
|
3956
|
+
checked
|
|
3957
|
+
});
|
|
3958
|
+
if (notice) io.err(notice);
|
|
3959
|
+
if (again) ask(io.env, checked);
|
|
3960
|
+
}
|
|
3740
3961
|
/** How often a stopped daemon reads its record again, to see whether it may start. */
|
|
3741
3962
|
const GUARD_POLL = 2e3;
|
|
3742
3963
|
/** Whether this command line runs a board module. A choice that is misuse is dispatch's to say. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as VERSION, F as configDir, at as misuse, c as parse, it as Failure, u as COPY } from "./args-9ZZDcPxa.js";
|
|
2
2
|
import { registerHooks } from "node:module";
|
|
3
3
|
import { chmodSync, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { constants } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./args-
|
|
2
|
-
import { _ as prepare, a as REEXEC_DEPTH, c as chooseModule, d as invokedAs, f as launchGuard, g as plan, h as musterFor, i as REEXEC, l as defaultModule, m as loadsModule, n as LAUNCH, o as REEXEC_FROM, p as loadBoard, r as MODULE_PROTOCOL, s as SERVE_SPEC, t as DAEMON_SPEC, u as endLaunch, v as refusal, y as self } from "./module-
|
|
1
|
+
import "./args-9ZZDcPxa.js";
|
|
2
|
+
import { _ as prepare, a as REEXEC_DEPTH, c as chooseModule, d as invokedAs, f as launchGuard, g as plan, h as musterFor, i as REEXEC, l as defaultModule, m as loadsModule, n as LAUNCH, o as REEXEC_FROM, p as loadBoard, r as MODULE_PROTOCOL, s as SERVE_SPEC, t as DAEMON_SPEC, u as endLaunch, v as refusal, y as self } from "./module-D8qcE3e7.js";
|
|
3
3
|
|
|
4
4
|
export { DAEMON_SPEC, LAUNCH, MODULE_PROTOCOL, REEXEC, REEXEC_DEPTH, REEXEC_FROM, SERVE_SPEC, chooseModule, defaultModule, endLaunch, invokedAs, launchGuard, loadBoard, loadsModule, musterFor, plan, prepare, refusal, self };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as configDir, J as OPEN_STATES, Q as actorId, T as SANDBOX_ROUTES, X as PROGRESS, Y as LIMITS, Z as WORKFLOWS_PROFILE, b as MOUNT, et as channelScope, it as Failure, r as duration, tt as inScope, w as ROUTES } from "./args-9ZZDcPxa.js";
|
|
2
2
|
import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, rmSync, statSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
package/docs/01-quickstart.md
CHANGED
|
@@ -13,7 +13,10 @@ Older ones bundle a SQLite it refuses to run on. It is on npm as
|
|
|
13
13
|
npm install -g @openmuster/muster
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
That is the latest release; run it again to upgrade. To be told when there
|
|
17
|
+
is a newer one, set `MUSTER_UPDATE_CHECK=1`: once a day, a command run in a
|
|
18
|
+
terminal says so in one line. To pin a version, name it:
|
|
19
|
+
`npm install -g @openmuster/muster@0.3.1-alpha.4`.
|
|
17
20
|
Every release is also a tarball on GitHub, which npm installs from its URL:
|
|
18
21
|
`https://github.com/openmuster/muster/releases/latest/download/muster.tgz`.
|
|
19
22
|
|
|
@@ -37,6 +37,19 @@ tab when you ask for one. Enter opens a row too. On a phone the sidebar is
|
|
|
37
37
|
behind the menu button and a thread takes the whole screen; on a tablet a
|
|
38
38
|
thread lies over the list.
|
|
39
39
|
|
|
40
|
+
## Notifications
|
|
41
|
+
|
|
42
|
+
Press **notify me of mentions** in the sidebar and allow it, and the page
|
|
43
|
+
shows a notification for each new message that mentions you, while it is
|
|
44
|
+
open, in a background tab too. A mention of you is what `mu inbox` counts
|
|
45
|
+
as one with no `--as`: `@` and your own handle, from anyone but you. A
|
|
46
|
+
mention of a profile, such as the one in the "as" field, isn't one. What
|
|
47
|
+
you write from the page, as any profile, never notifies you. Click a
|
|
48
|
+
notification to open its thread.
|
|
49
|
+
|
|
50
|
+
The button is only there until you answer. To change your answer later, use
|
|
51
|
+
the site settings of your browser for the page's address.
|
|
52
|
+
|
|
40
53
|
## Whose access it has
|
|
41
54
|
|
|
42
55
|
The page acts as you, so its server trusts nothing but its own page:
|
|
@@ -67,3 +80,9 @@ reply in a mirrored thread reaches people.
|
|
|
67
80
|
`mu inspect`: each run makes a new one. Open the link it printed this time.
|
|
68
81
|
- **`The inspector doesn't answer for "<host>"`.** The page was reached
|
|
69
82
|
under another host name. Use the printed address.
|
|
83
|
+
- **No notifications, though the page asked and you allowed them.** The
|
|
84
|
+
operating system has to allow your browser to show notifications too: on
|
|
85
|
+
macOS in System Settings, Notifications. Chrome on Android shows none from
|
|
86
|
+
a page like this one.
|
|
87
|
+
- **A notification comes a minute late.** A browser slows a tab it hasn't
|
|
88
|
+
shown for a while; the page reads the board less often until you look.
|
|
@@ -140,6 +140,7 @@ serve
|
|
|
140
140
|
|
|
141
141
|
states: waiting, ready, claimed, blocked, completed, failed, canceled
|
|
142
142
|
exit: 0 ok, 1 failed or timed out, 2 misuse, 130 interrupted, 143 terminated
|
|
143
|
+
update: MUSTER_UPDATE_CHECK=1 says, once a day, when a newer muster is out
|
|
143
144
|
```
|
|
144
145
|
|
|
145
146
|
## One command's help
|
package/docs/index.md
CHANGED
|
@@ -18,6 +18,27 @@ mu run --ready db/ --agent claude --as worker-1
|
|
|
18
18
|
mu inspect
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## Several agents, one queue
|
|
22
|
+
|
|
23
|
+
Agents never share a task. Several agents take work from the same queue, and
|
|
24
|
+
the board makes sure each task is held by one of them at a time: a claim
|
|
25
|
+
comes with a lease, the holder renews it while it works, and nobody else can
|
|
26
|
+
claim the task meanwhile. If the agent dies or stalls, the lease runs out, the
|
|
27
|
+
task is ready again, and the next free agent takes it.
|
|
28
|
+
|
|
29
|
+
You run several agents when there is more than one thing to do:
|
|
30
|
+
|
|
31
|
+
- **In parallel.** Split a feature into tasks that touch different files,
|
|
32
|
+
and start a few workers that each take one: [A swarm](./03-guides/02-swarm.md).
|
|
33
|
+
- **One builds, one checks.** A second agent reviews in a fresh session once
|
|
34
|
+
the first completes: [Two agents](./03-guides/10-two-agents.md).
|
|
35
|
+
- **Work that arrives.** Issues from Linear, GitHub or Slack land on the
|
|
36
|
+
board, and whoever is free takes the next one:
|
|
37
|
+
[Building from Linear](./03-guides/22-building-from-linear.md).
|
|
38
|
+
- **While you are away.** Leave a queue with a budget, and workers take the
|
|
39
|
+
tasks one after another until it is empty:
|
|
40
|
+
[Running unattended](./03-guides/12-unattended.md).
|
|
41
|
+
|
|
21
42
|
## What a board gives you
|
|
22
43
|
|
|
23
44
|
- **Work that can't be taken twice.** A task is claimed under a lease, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmuster/muster",
|
|
3
|
-
"version": "0.3.1-alpha.
|
|
3
|
+
"version": "0.3.1-alpha.4",
|
|
4
4
|
"description": "A local-first work queue for coding agents, with the threads people read: leased tasks, one log, wait and tail, schedules and watchers.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|