@openmuster/muster 0.3.1-alpha.4 → 0.3.1-alpha.5
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 +10 -6
- package/dist/{args-9ZZDcPxa.js → args-CaFBa2IP.js} +305 -23
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +67 -18
- package/dist/index.js +106 -41
- package/dist/inspect/app.js +49 -26
- package/dist/{main-Doit2DDY.js → main-BeEB08iI.js} +158 -8
- package/dist/main-CLzQkYeG.js +6 -0
- package/dist/mcp-CAAZRJgv.js +6 -0
- package/dist/{module-DjDMSEKu.js → module-BX2IjSiv.js} +2 -2
- package/dist/{module-D8qcE3e7.js → module-D9KdbEpS.js} +1 -1
- package/dist/skills/board/SKILL.md +5 -0
- package/dist/{steps-BUPRIOe3.js → steps-FNDWY1P_.js} +16 -4
- package/docs/01-concepts/09-watchers.md +4 -32
- package/docs/01-concepts/10-schedules.md +1 -1
- package/docs/01-concepts/11-access.md +19 -3
- package/docs/01-concepts/13-budgets.md +66 -3
- package/docs/01-concepts/15-outgoing-webhooks.md +6 -19
- package/docs/01-concepts/16-workflows.md +22 -2
- package/docs/01-quickstart.md +74 -45
- package/docs/02-sync/01-overview.md +34 -2
- package/docs/02-sync/02-github.md +40 -19
- package/docs/02-sync/03-linear.md +103 -85
- package/docs/02-sync/04-slack.md +116 -111
- package/docs/02-sync/05-notion.md +46 -25
- package/docs/03-guides/01-coding-agents.md +51 -33
- package/docs/03-guides/02-swarm.md +30 -15
- package/docs/03-guides/03-factory.md +193 -80
- package/docs/03-guides/04-inspector.md +73 -42
- package/docs/03-guides/05-running-agents.md +62 -35
- package/docs/03-guides/06-sandboxed-agents.md +488 -305
- package/docs/03-guides/07-build-a-ui.md +86 -31
- package/docs/03-guides/08-ci.md +59 -36
- package/docs/03-guides/09-daemon.md +121 -53
- package/docs/03-guides/10-two-agents.md +31 -22
- package/docs/03-guides/11-person-in-the-loop.md +47 -34
- package/docs/03-guides/12-unattended.md +46 -27
- package/docs/03-guides/13-terminals.md +51 -39
- package/docs/03-guides/14-no-cloud.md +31 -19
- package/docs/03-guides/15-several-boards.md +61 -27
- package/docs/03-guides/16-non-code.md +29 -18
- package/docs/03-guides/17-mcp.md +37 -30
- package/docs/03-guides/18-a-board-on-a-server.md +66 -43
- package/docs/03-guides/19-a-card-queue.md +210 -121
- package/docs/03-guides/20-a-feedback-loop.md +298 -134
- package/docs/03-guides/21-running-the-loop.md +94 -64
- package/docs/03-guides/22-building-from-linear.md +81 -57
- package/docs/04-reference/01-cli.md +7 -0
- package/docs/04-reference/02-handle.md +10 -15
- package/docs/04-reference/03-http.md +1 -1
- package/docs/04-reference/04-events.md +2 -1
- package/docs/04-reference/05-errors.md +3 -0
- package/docs/04-reference/08-files.md +49 -0
- package/docs/index.md +1 -0
- package/package.json +1 -1
- package/dist/main-D5aX7Jaj.js +0 -6
- package/dist/mcp-Cm96TIb3.js +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as boardPath, C as listen, D as VERSION, E as RELEASE_HOSTS, F 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, B as heldClaim, C as listen, D as VERSION, E as RELEASE_HOSTS, F as retiredKeys, I as rotateKey, M as boardKey, N as dropRetiredKeys, O as releaseTarball, R as configDir, S as isLoopback, V as keepClaim, X as processStart, _ as ping, a as list, at as labelFilter, c as parse, ct as cursorAhead, d as ROOT, f as board, g as armHooks, h as HOOKS_LEASE, i as id, j as file, k as loadOidc, l as str, lt as misuse, m as DROPPED, n as cursor, o as on, ot as profileName, p as syncLoop, r as duration, s as pairs, st as Failure, t as GLOBAL, tt as actorId, v as why, w as ROUTES, y as holdLease, z as dropClaim } from "./args-CaFBa2IP.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-FNDWY1P_.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-D9KdbEpS.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";
|
|
@@ -173,6 +173,36 @@ function eventLine(event, now) {
|
|
|
173
173
|
else if (event.type === "task.failed" || event.type === "task.blocked") detail = firstLine([data.kind, data.reason].filter(Boolean).join(": "), 70);
|
|
174
174
|
return detail ? `${head}\n${indent(detail)}` : head;
|
|
175
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* A report as columns: one table by agent and, when any task had one, one by workflow. A cost is shown
|
|
178
|
+
* only where an agent reported one; a task no agent was recorded for is `(none)`. A long name is never
|
|
179
|
+
* cut, so two names alike are two rows: its row runs wider instead.
|
|
180
|
+
*/
|
|
181
|
+
function reportText(report) {
|
|
182
|
+
const day = report.since.slice(0, 10);
|
|
183
|
+
const where = report.channel === null ? "" : ` in #${report.channel}`;
|
|
184
|
+
if (report.agents.length === 0) return `no tasks${where} since ${day}`;
|
|
185
|
+
const usd = (n) => n === null ? "-" : `$${n.toFixed(2)}`;
|
|
186
|
+
const head = (first) => `${first.padEnd(10)} tasks 1st round rounds failed failing input cost per task`;
|
|
187
|
+
const row = (r) => [
|
|
188
|
+
(r.key ?? "(none)").padEnd(10),
|
|
189
|
+
String(r.tasks).padStart(5),
|
|
190
|
+
`${r.firstRound} ${Math.round(100 * r.firstRound / r.tasks)}%`.padStart(9),
|
|
191
|
+
r.rounds.toFixed(2).padStart(6),
|
|
192
|
+
String(r.failed).padStart(6),
|
|
193
|
+
String(r.failing).padStart(7),
|
|
194
|
+
String(r.needsInput).padStart(5),
|
|
195
|
+
(r.costed ? usd(r.cost) : "-").padEnd(8),
|
|
196
|
+
r.costed ? usd(r.perTask) : "-"
|
|
197
|
+
].join(" ");
|
|
198
|
+
const lines = [
|
|
199
|
+
`since ${day}${where}`,
|
|
200
|
+
head("agent"),
|
|
201
|
+
...report.agents.map(row)
|
|
202
|
+
];
|
|
203
|
+
if (report.workflows.length) lines.push(head("workflow"), ...report.workflows.map(row));
|
|
204
|
+
return lines.join("\n");
|
|
205
|
+
}
|
|
176
206
|
|
|
177
207
|
//#endregion
|
|
178
208
|
//#region src/daemon/daemon.ts
|
|
@@ -260,6 +290,7 @@ async function runDaemon(options) {
|
|
|
260
290
|
for (const id$1 of did.schedules.canceled) options.log(`canceled schedule ${id$1} its token was revoked`);
|
|
261
291
|
if (did.workflows?.started.length) options.log(`started workflow ${did.workflows.started.join(" ")}`);
|
|
262
292
|
if (did.workflows?.refused.length) options.log(`refused workflow ${did.workflows.refused.join(" ")}`);
|
|
293
|
+
if (did.workflows?.suggested?.length) options.log(`suggested workflow ${did.workflows.suggested.join(" ")}`);
|
|
263
294
|
if (did.workflows?.reported?.length) options.log(`reported workflow ${did.workflows.reported.join(" ")}`);
|
|
264
295
|
if (did.workflows?.updated?.length) options.log(`updated workflow ${did.workflows.updated.join(" ")}`);
|
|
265
296
|
if (did.workflows?.why) options.log(`failed workflow ${did.workflows.why}`);
|
|
@@ -742,6 +773,8 @@ tasks
|
|
|
742
773
|
tasks needs <id> <id>... | --none
|
|
743
774
|
budget [<channel> <usd> | <channel> --none]
|
|
744
775
|
what a channel's tasks may cost in all
|
|
776
|
+
report [<channel>] [--since 30d]
|
|
777
|
+
how tasks went and cost, by agent and workflow
|
|
745
778
|
workflow list what this machine's workflows.json registers
|
|
746
779
|
workflow run <name> --on <id> [--arg k=v]...
|
|
747
780
|
ask for one to be run on a thread
|
|
@@ -754,6 +787,7 @@ agents
|
|
|
754
787
|
--agent claude|codex (or a command after --) [--cwd <dir>]
|
|
755
788
|
[--worktree <repo> --branch <name>] [--model <m>] [--timeout 30m]
|
|
756
789
|
[--env K=V]... [--bypass-permissions] [--loop] [--budget <usd>]
|
|
790
|
+
[--estimate] say what the ready tasks may cost; start none
|
|
757
791
|
An agent that worked the task before resumes its session; --fresh won't.
|
|
758
792
|
To pick one up by its ID: --resume <session>.
|
|
759
793
|
Claude Code starts lean (a shell and files); --full loads your whole setup.
|
|
@@ -762,6 +796,7 @@ agents
|
|
|
762
796
|
[--safe] keep the agent's permission prompts on there
|
|
763
797
|
[--detach] return once started, not when it ends
|
|
764
798
|
[--no-install] with --repo: don't install its dependencies
|
|
799
|
+
[--template <name>] e2b: in place of MUSTER_E2B_TEMPLATE
|
|
765
800
|
[--push] push what it changed and open a pull request
|
|
766
801
|
The agent is told where its task is, not what it says.
|
|
767
802
|
It settles the task itself; one left unsettled is failed or released.
|
|
@@ -809,6 +844,9 @@ serve
|
|
|
809
844
|
token list | token revoke <id>
|
|
810
845
|
token exchange [-] a CI job's own OIDC token for a board token:
|
|
811
846
|
on stdin with -, or in MUSTER_OIDC_TOKEN
|
|
847
|
+
token rotate-key sign new tokens with a new key; tokens the
|
|
848
|
+
old one signed still work
|
|
849
|
+
token drop-old-keys stop every token an old key signed
|
|
812
850
|
join <board url> --as <name> ask a served board for a token, and wait
|
|
813
851
|
[--note <text>] [--timeout 10m]
|
|
814
852
|
join list | join deny <code>
|
|
@@ -1195,6 +1233,15 @@ const stopCode = (signal) => signal.reason === "SIGTERM" ? 143 : 130;
|
|
|
1195
1233
|
* With no deadline it waits for as long as the command runs. A stop ends the pause at once, and
|
|
1196
1234
|
* `failed` returns: the caller checks the stop and exits as stopped.
|
|
1197
1235
|
*/
|
|
1236
|
+
/**
|
|
1237
|
+
* Refuses a cursor past the board's last event: one this board never gave out, most likely because it was
|
|
1238
|
+
* restored from a backup since. Read on from it, and everything written until the board caught up would be
|
|
1239
|
+
* skipped without a word.
|
|
1240
|
+
*/
|
|
1241
|
+
async function notAhead(team, after) {
|
|
1242
|
+
const head = await team.head();
|
|
1243
|
+
if (after > head) throw cursorAhead(after, head);
|
|
1244
|
+
}
|
|
1198
1245
|
function outages(run, deadline) {
|
|
1199
1246
|
let failing = 0;
|
|
1200
1247
|
let reached = false;
|
|
@@ -1584,7 +1631,7 @@ const commands = {
|
|
|
1584
1631
|
const verb = parsed.positionals[0];
|
|
1585
1632
|
if (verb === "list") {
|
|
1586
1633
|
const workflows = loadWorkflows();
|
|
1587
|
-
return print(run, { workflows }, () => workflows.length === 0 ? `no workflows in ${workflowsPath()}` : workflows.map((workflow) => `${workflow.name.padEnd(20)} ${workflow.description} who: ${workflow.who.join(", ")} channels: ${workflow.channels.join(", ")}`).join("\n"));
|
|
1634
|
+
return print(run, { workflows }, () => workflows.length === 0 ? `no workflows in ${workflowsPath()}` : workflows.map((workflow) => `${workflow.name.padEnd(20)} ${workflow.description} who: ${workflow.who.join(", ")} channels: ${workflow.channels.join(", ")}${workflow.mode === "suggest" ? " suggest only" : ""}`).join("\n"));
|
|
1588
1635
|
}
|
|
1589
1636
|
if (verb === "run") {
|
|
1590
1637
|
const name = parsed.positionals[1];
|
|
@@ -1675,6 +1722,18 @@ const commands = {
|
|
|
1675
1722
|
print(run, set, () => set.usd === null ? `no budget #${set.channel}` : `budget #${set.channel} $${set.spent.toFixed(2)} of $${set.usd.toFixed(2)}`);
|
|
1676
1723
|
}
|
|
1677
1724
|
},
|
|
1725
|
+
report: {
|
|
1726
|
+
spec: { value: ["since"] },
|
|
1727
|
+
async run(run, parsed) {
|
|
1728
|
+
const channel = parsed.positionals[0];
|
|
1729
|
+
const since = (/* @__PURE__ */ new Date(Date.now() - duration(str(parsed.flags, "since") ?? "30d", "since") * 1e3)).toISOString();
|
|
1730
|
+
const found = await run.team.taskReport({
|
|
1731
|
+
...channel !== void 0 ? { channel } : {},
|
|
1732
|
+
since
|
|
1733
|
+
});
|
|
1734
|
+
print(run, found, () => reportText(found));
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1678
1737
|
schemas: {
|
|
1679
1738
|
spec: { value: ["file"] },
|
|
1680
1739
|
async run(run, parsed) {
|
|
@@ -1765,10 +1824,13 @@ const commands = {
|
|
|
1765
1824
|
const outage = outages(run, deadline);
|
|
1766
1825
|
let after = given !== void 0 ? cursor(given, "after") : await run.team.head();
|
|
1767
1826
|
if (given === void 0) outage.ok();
|
|
1827
|
+
let checked = false;
|
|
1768
1828
|
let pause = 100;
|
|
1769
1829
|
for (;;) {
|
|
1770
1830
|
let page;
|
|
1771
1831
|
try {
|
|
1832
|
+
if (given !== void 0 && !checked) await notAhead(run.team, after);
|
|
1833
|
+
checked = true;
|
|
1772
1834
|
page = await run.team.events({
|
|
1773
1835
|
after,
|
|
1774
1836
|
filter,
|
|
@@ -1820,10 +1882,13 @@ const commands = {
|
|
|
1820
1882
|
}
|
|
1821
1883
|
const outage = outages(run);
|
|
1822
1884
|
if (given === void 0) outage.ok();
|
|
1885
|
+
let checked = false;
|
|
1823
1886
|
let pause = 100;
|
|
1824
1887
|
while (!run.io.stop.aborted) {
|
|
1825
1888
|
let page;
|
|
1826
1889
|
try {
|
|
1890
|
+
if (given !== void 0 && !checked) await notAhead(run.team, after);
|
|
1891
|
+
checked = true;
|
|
1827
1892
|
page = await run.team.events({
|
|
1828
1893
|
after,
|
|
1829
1894
|
filter
|
|
@@ -1892,7 +1957,8 @@ const commands = {
|
|
|
1892
1957
|
"budget",
|
|
1893
1958
|
"runner",
|
|
1894
1959
|
"repo",
|
|
1895
|
-
"by"
|
|
1960
|
+
"by",
|
|
1961
|
+
"template"
|
|
1896
1962
|
],
|
|
1897
1963
|
many: [
|
|
1898
1964
|
"label",
|
|
@@ -1907,11 +1973,24 @@ const commands = {
|
|
|
1907
1973
|
"full",
|
|
1908
1974
|
"detach",
|
|
1909
1975
|
"no-install",
|
|
1910
|
-
"push"
|
|
1976
|
+
"push",
|
|
1977
|
+
"estimate"
|
|
1911
1978
|
]
|
|
1912
1979
|
},
|
|
1913
1980
|
async run(run, parsed) {
|
|
1914
1981
|
refuseByWithoutReady(parsed);
|
|
1982
|
+
if (on(parsed.flags, "estimate")) {
|
|
1983
|
+
if (str(parsed.flags, "ready") === void 0) throw misuse("nothing_to_claim", "--estimate says what the ready tasks may cost: pass --ready <channel>.");
|
|
1984
|
+
const found = await estimate(run, parsed);
|
|
1985
|
+
return print(run, found, () => estimateLine(found));
|
|
1986
|
+
}
|
|
1987
|
+
if (on(parsed.flags, "loop") && str(parsed.flags, "ready") !== void 0 && !run.json) {
|
|
1988
|
+
const found = await estimate(run, parsed).catch((error$1) => {
|
|
1989
|
+
if (error$1 instanceof Failure && error$1.exit === 2) throw error$1;
|
|
1990
|
+
return null;
|
|
1991
|
+
});
|
|
1992
|
+
if (found) run.io.out(estimateLine(found));
|
|
1993
|
+
}
|
|
1915
1994
|
if (!on(parsed.flags, "loop")) return runAgent(run, parsed);
|
|
1916
1995
|
if (str(parsed.flags, "ready") === void 0) throw misuse("nothing_to_claim", "--loop takes the next ready task each time: pass --ready <channel>.");
|
|
1917
1996
|
const runner = str(parsed.flags, "runner");
|
|
@@ -2133,7 +2212,17 @@ const commands = {
|
|
|
2133
2212
|
}, () => made$1.token);
|
|
2134
2213
|
return;
|
|
2135
2214
|
}
|
|
2136
|
-
if (verb
|
|
2215
|
+
if (verb === "rotate-key" || verb === "drop-old-keys") {
|
|
2216
|
+
const me$1 = await run.team.whoami();
|
|
2217
|
+
if (me$1.mode !== "file") throw new Failure("forbidden", `mu token ${verb} changes the keys of a board on this machine.`);
|
|
2218
|
+
if (verb === "rotate-key") {
|
|
2219
|
+
const done$1 = rotateKey(me$1.where, new Date(run.now()));
|
|
2220
|
+
return print(run, done$1, () => `rotated new tokens are signed with a new key; ${done$1.retired} old ${done$1.retired === 1 ? "key keeps its" : "keys keep their"} tokens good. Restart mu serve to use it.\nnext: mu token drop-old-keys, to stop every token an old key signed`);
|
|
2221
|
+
}
|
|
2222
|
+
const done = dropRetiredKeys(me$1.where);
|
|
2223
|
+
return print(run, done, () => `dropped ${done.dropped} old ${done.dropped === 1 ? "key" : "keys"}: every token ${done.dropped === 1 ? "it" : "they"} signed stops once mu serve restarts`);
|
|
2224
|
+
}
|
|
2225
|
+
if (verb !== "create") throw misuse("unknown_command", "Use: mu token create [--as <profile>] --can <channel>=<permissions>... | --all [--ttl 30d], mu token list, mu token revoke <id>, mu token exchange, mu token rotate-key, or mu token drop-old-keys.");
|
|
2137
2226
|
const can = {};
|
|
2138
2227
|
for (const [pattern, permissions] of Object.entries(pairs(list(parsed.flags, "can"), "can"))) can[pattern] = permissions.split(",").filter(Boolean);
|
|
2139
2228
|
const all = on(parsed.flags, "all");
|
|
@@ -2262,6 +2351,7 @@ const commands = {
|
|
|
2262
2351
|
serving = await listen({
|
|
2263
2352
|
backend: run.team.backend,
|
|
2264
2353
|
key: key$1,
|
|
2354
|
+
retired: retiredKeys(me.where),
|
|
2265
2355
|
port,
|
|
2266
2356
|
host,
|
|
2267
2357
|
hosts: allowed,
|
|
@@ -3087,6 +3177,51 @@ async function filled(run, task, owner, token, team = run.team) {
|
|
|
3087
3177
|
return reason;
|
|
3088
3178
|
}
|
|
3089
3179
|
}
|
|
3180
|
+
/** How far back an estimate looks for what a task cost. */
|
|
3181
|
+
const ESTIMATE_SINCE = "30d";
|
|
3182
|
+
/**
|
|
3183
|
+
* What a worker would start on, and what that may cost: the tasks ready in its channel that it may take
|
|
3184
|
+
* (its owners, `--by`, `--label`, assigned to it or to nobody), times what a task under that channel
|
|
3185
|
+
* cost this agent on average over the last 30 days. With no cost on record it says so, never a guess.
|
|
3186
|
+
*/
|
|
3187
|
+
async function estimate(run, parsed) {
|
|
3188
|
+
const channel = str(parsed.flags, "ready");
|
|
3189
|
+
const me = await run.team.whoami();
|
|
3190
|
+
const owners = new Set([me.principal, ...list(parsed.flags, "from")]);
|
|
3191
|
+
const by = str(parsed.flags, "by");
|
|
3192
|
+
const labels = list(parsed.flags, "label");
|
|
3193
|
+
const found = await run.team.taskList({
|
|
3194
|
+
channel,
|
|
3195
|
+
state: "ready",
|
|
3196
|
+
limit: 1e3,
|
|
3197
|
+
...labels.length ? { labels } : {}
|
|
3198
|
+
});
|
|
3199
|
+
const ready = found.tasks.filter((task) => owners.has(task.owner.principal) && (by === void 0 || actorId(task.owner) === by) && (task.for === null || task.for === me.profile)).length;
|
|
3200
|
+
const agent = str(parsed.flags, "agent") ?? (parsed.rest.length ? generic(parsed.rest[0], parsed.rest.slice(1)).name : null);
|
|
3201
|
+
const since = (/* @__PURE__ */ new Date(Date.now() - duration(ESTIMATE_SINCE, "since") * 1e3)).toISOString();
|
|
3202
|
+
const history = await run.team.taskReport({
|
|
3203
|
+
channel: channel.replace(/^#/, "").replace(/\/$/, ""),
|
|
3204
|
+
since
|
|
3205
|
+
});
|
|
3206
|
+
const rows = agent === null ? history.agents : history.agents.filter((row) => row.key === agent);
|
|
3207
|
+
const costed = rows.reduce((sum, row) => sum + row.costed, 0);
|
|
3208
|
+
const perTask = costed ? Math.round(rows.reduce((sum, row) => sum + row.cost, 0) / costed * 1e4) / 1e4 : null;
|
|
3209
|
+
return {
|
|
3210
|
+
channel,
|
|
3211
|
+
ready,
|
|
3212
|
+
more: found.more,
|
|
3213
|
+
agent,
|
|
3214
|
+
perTask,
|
|
3215
|
+
usd: perTask === null ? null : Math.round(perTask * ready * 100) / 100,
|
|
3216
|
+
since
|
|
3217
|
+
};
|
|
3218
|
+
}
|
|
3219
|
+
const estimateLine = (e) => {
|
|
3220
|
+
const ready = `${e.ready}${e.more ? "+" : ""} ready`;
|
|
3221
|
+
if (e.ready === 0) return `${ready} in #${e.channel.replace(/^#/, "")}`;
|
|
3222
|
+
if (e.perTask === null) return `${ready}, no cost history${e.agent ? ` for ${e.agent}` : ""} in #${e.channel.replace(/^#/, "")}`;
|
|
3223
|
+
return `${ready}, about $${e.usd.toFixed(2)} at $${e.perTask.toFixed(2)} a task`;
|
|
3224
|
+
};
|
|
3090
3225
|
/** What the board says when it couldn't answer, rather than answering no: a task claimed meanwhile is given back, not failed. */
|
|
3091
3226
|
const RELEASE_ON = new Set([
|
|
3092
3227
|
"network_error",
|
|
@@ -3104,10 +3239,11 @@ async function runAgent(run, parsed, onKind, onCost) {
|
|
|
3104
3239
|
if (where !== "local") return runInCloud(run, parsed, where, agent);
|
|
3105
3240
|
const cloudOnly = [
|
|
3106
3241
|
"repo",
|
|
3242
|
+
"template",
|
|
3107
3243
|
"push",
|
|
3108
3244
|
"detach",
|
|
3109
3245
|
"no-install"
|
|
3110
|
-
].find((flag) => flag === "repo" ? str(parsed.flags, flag) !== void 0 : on(parsed.flags, flag));
|
|
3246
|
+
].find((flag) => flag === "repo" || flag === "template" ? str(parsed.flags, flag) !== void 0 : on(parsed.flags, flag));
|
|
3111
3247
|
if (cloudOnly) throw misuse(cloudOnly === "push" ? "push_unsupported" : "unknown_flag", `--${cloudOnly} is for a cloud runner, and this run is on this machine.`, "Add --runner vercel, --runner cloudflare or --runner e2b, or leave it out.");
|
|
3112
3248
|
const me = await run.team.whoami();
|
|
3113
3249
|
const cwd = resolve(str(parsed.flags, "cwd") ?? process.cwd());
|
|
@@ -3280,6 +3416,20 @@ function repoUrl(value) {
|
|
|
3280
3416
|
* itself, through the board at MUSTER_URL, which the sandbox must be able to reach.
|
|
3281
3417
|
*/
|
|
3282
3418
|
async function runInCloud(run, parsed, where, agent) {
|
|
3419
|
+
const template = str(parsed.flags, "template");
|
|
3420
|
+
if (template !== void 0) {
|
|
3421
|
+
if (where !== "e2b") throw misuse("unknown_flag", `--template names an E2B template, and this run is on ${where}.`, "Use it with --runner e2b, or leave it out.");
|
|
3422
|
+
run = {
|
|
3423
|
+
...run,
|
|
3424
|
+
io: {
|
|
3425
|
+
...run.io,
|
|
3426
|
+
env: {
|
|
3427
|
+
...run.io.env,
|
|
3428
|
+
MUSTER_E2B_TEMPLATE: template
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
};
|
|
3432
|
+
}
|
|
3283
3433
|
if (str(parsed.flags, "ready") !== void 0 && on(parsed.flags, "loop")) return cloudWorker(run, parsed, where, agent);
|
|
3284
3434
|
return cloudTask(run, parsed, where, agent);
|
|
3285
3435
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { D as VERSION } from "./args-CaFBa2IP.js";
|
|
2
|
+
import "./steps-FNDWY1P_.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-BeEB08iI.js";
|
|
4
|
+
import "./module-D9KdbEpS.js";
|
|
5
|
+
|
|
6
|
+
export { SPECS, VERSION, agentPrompt, agentToken, attend, main, meantCommand, repoUrl };
|
|
@@ -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-CaFBa2IP.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-D9KdbEpS.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 { D as VERSION,
|
|
1
|
+
import { D as VERSION, R as configDir, c as parse, lt as misuse, st as Failure, u as COPY } from "./args-CaFBa2IP.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";
|
|
@@ -11,6 +11,11 @@ that one agent at a time can hold. The command is `mu` (`muster` is the same
|
|
|
11
11
|
program). `mu help` lists everything it does, and `mu <command> --help` one
|
|
12
12
|
command's options.
|
|
13
13
|
|
|
14
|
+
If `mu` isn't on the path, it is installed with
|
|
15
|
+
`npm install -g @openmuster/muster`, or run once as
|
|
16
|
+
`npx @openmuster/muster <command>`. Not `npx mu`: `mu` on npm is another
|
|
17
|
+
package.
|
|
18
|
+
|
|
14
19
|
## Before anything else: where, and as whom
|
|
15
20
|
|
|
16
21
|
```bash
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as PROGRESS, Q as LIMITS, R as configDir, T as SANDBOX_ROUTES, Z as OPEN_STATES, b as MOUNT, et as WORKFLOWS_PROFILE, it as inScope, r as duration, rt as channelScope, st as Failure, tt as actorId, w as ROUTES } from "./args-CaFBa2IP.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";
|
|
@@ -2086,7 +2086,11 @@ function loadWorkflows(path = workflowsPath()) {
|
|
|
2086
2086
|
if (w.push !== void 0 && typeof w.push !== "boolean") fail("has a \"workers.push\" that isn't true or false.");
|
|
2087
2087
|
if ((w.push === true || steps.some((step) => step.push === true)) && !(cloud && typeof w.repo === "string" && githubRepo(w.repo))) fail("can only \"push\" with \"runner\": \"vercel\", \"cloudflare\" or \"e2b\" and a github.com https \"repo\".");
|
|
2088
2088
|
if (w.timeout !== void 0) checkDuration(w.timeout, "workers.timeout");
|
|
2089
|
+
if (w.template !== void 0 && (typeof w.template !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,127}$/.test(w.template))) fail("has a \"workers.template\" that isn't an E2B template name.");
|
|
2090
|
+
if (w.template !== void 0 && w.runner !== "e2b") fail("has a \"workers.template\", which is for \"e2b\" workers: no other runner makes a sandbox from a template you name.");
|
|
2091
|
+
if (w.model !== void 0 && (typeof w.model !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:/-]{0,127}$/.test(w.model))) fail("has a \"workers.model\" that isn't a model name.");
|
|
2089
2092
|
if (entryObject.timeout !== void 0) checkDuration(entryObject.timeout, "timeout");
|
|
2093
|
+
if (entryObject.mode !== void 0 && entryObject.mode !== "run" && entryObject.mode !== "suggest") fail("has a \"mode\" that isn't \"run\" or \"suggest\".");
|
|
2090
2094
|
const workers = {
|
|
2091
2095
|
count: w.count,
|
|
2092
2096
|
agent: w.agent,
|
|
@@ -2095,7 +2099,9 @@ function loadWorkflows(path = workflowsPath()) {
|
|
|
2095
2099
|
...w.repo !== void 0 ? { repo: w.repo } : {},
|
|
2096
2100
|
...w.push !== void 0 ? { push: w.push } : {},
|
|
2097
2101
|
...w.cwd !== void 0 ? { cwd: w.cwd } : {},
|
|
2098
|
-
...w.timeout !== void 0 ? { timeout: w.timeout } : {}
|
|
2102
|
+
...w.timeout !== void 0 ? { timeout: w.timeout } : {},
|
|
2103
|
+
...w.template !== void 0 ? { template: w.template } : {},
|
|
2104
|
+
...w.model !== void 0 ? { model: w.model } : {}
|
|
2099
2105
|
};
|
|
2100
2106
|
return {
|
|
2101
2107
|
name,
|
|
@@ -2104,7 +2110,8 @@ function loadWorkflows(path = workflowsPath()) {
|
|
|
2104
2110
|
channels: entryObject.channels,
|
|
2105
2111
|
steps,
|
|
2106
2112
|
workers,
|
|
2107
|
-
...entryObject.timeout !== void 0 ? { timeout: entryObject.timeout } : {}
|
|
2113
|
+
...entryObject.timeout !== void 0 ? { timeout: entryObject.timeout } : {},
|
|
2114
|
+
...entryObject.mode !== void 0 ? { mode: entryObject.mode } : {}
|
|
2108
2115
|
};
|
|
2109
2116
|
});
|
|
2110
2117
|
}
|
|
@@ -2137,7 +2144,7 @@ function missingSettings(workers, env) {
|
|
|
2137
2144
|
for (const name of ["MUSTER_CF_WORKER", "MUSTER_CF_SECRET"]) if (!env[name]) missing.push(name);
|
|
2138
2145
|
}
|
|
2139
2146
|
if (workers.runner === "e2b") {
|
|
2140
|
-
for (const name of ["E2B_API_KEY", "MUSTER_E2B_TEMPLATE"]) if (!env[name]) missing.push(name);
|
|
2147
|
+
for (const name of ["E2B_API_KEY", ...workers.template ? [] : ["MUSTER_E2B_TEMPLATE"]]) if (!env[name]) missing.push(name);
|
|
2141
2148
|
}
|
|
2142
2149
|
if (workers.runner === "vercel") {
|
|
2143
2150
|
const set = [
|
|
@@ -2229,6 +2236,8 @@ function workerArgv(workflow, run$1, seq, i, owner) {
|
|
|
2229
2236
|
...workers.repo ? ["--repo", workers.repo] : [],
|
|
2230
2237
|
...pushes(workflow) ? ["--push"] : [],
|
|
2231
2238
|
...workers.timeout ? ["--timeout", workers.timeout] : [],
|
|
2239
|
+
...workers.template ? ["--template", workers.template] : [],
|
|
2240
|
+
...workers.model ? ["--model", workers.model] : [],
|
|
2232
2241
|
"--by",
|
|
2233
2242
|
`${owner}+${WORKFLOWS_PROFILE}`,
|
|
2234
2243
|
"--label",
|
|
@@ -2336,6 +2345,9 @@ async function runWorkflows(team, workflows, deps) {
|
|
|
2336
2345
|
if (refusal !== null || !workflow) {
|
|
2337
2346
|
await say(event.seq, thread, refusal);
|
|
2338
2347
|
out.refused.push(event.seq);
|
|
2348
|
+
} else if (workflow.mode === "suggest") {
|
|
2349
|
+
await say(event.seq, thread, `would start ${name}: ${workflow.steps.length} ${workflow.steps.length === 1 ? "task" : "tasks"}, ${workflow.workers.count} ${workflow.workers.count === 1 ? "worker" : "workers"}; suggest only, nothing started`);
|
|
2350
|
+
(out.suggested ??= []).push(event.seq);
|
|
2339
2351
|
} else {
|
|
2340
2352
|
const result = await start(team, writer, workflow, {
|
|
2341
2353
|
seq: event.seq,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Watchers and the daemon
|
|
3
|
-
description: A watcher runs your command when a matching event lands on the board, such as a blocked task or a mention. How the daemon hosts watchers, what the command receives, retries
|
|
3
|
+
description: A watcher runs your command when a matching event lands on the board, such as a blocked task or a mention. How the daemon hosts watchers, what the command receives, retries and gates.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## The daemon
|
|
@@ -95,7 +95,9 @@ export default board({
|
|
|
95
95
|
A reminder the profile scheduled for itself wakes it too.
|
|
96
96
|
|
|
97
97
|
Try the filter by hand first: `mu tail work/ --type task.completed --json`.
|
|
98
|
-
The event a watcher gets is what that prints, one at a time.
|
|
98
|
+
The event a watcher gets is what that prints, one at a time. To check the
|
|
99
|
+
whole path, from the filter to an answer, see
|
|
100
|
+
[Check that a watcher wakes something](../03-guides/09-daemon.md#check-that-a-watcher-wakes-something).
|
|
99
101
|
|
|
100
102
|
## What a wake carries
|
|
101
103
|
|
|
@@ -113,36 +115,6 @@ The event a watcher gets is what that prints, one at a time.
|
|
|
113
115
|
agent through `command()`, not through a function that pastes it into a
|
|
114
116
|
prompt.
|
|
115
117
|
|
|
116
|
-
## Check that it wakes something
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
mu daemon check lead
|
|
120
|
-
mu daemon check triage --in work/checks --timeout 10m
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
`check` writes a message the watcher's filter matches, then waits for a reply
|
|
124
|
-
in its thread. A reply proves the whole path: a host runs the watcher, the
|
|
125
|
-
filter matches, the gate lets it through, and the command wakes something
|
|
126
|
-
that answers. It prints who answered and how long it took.
|
|
127
|
-
|
|
128
|
-
- **Its message is built from the filter:** the watcher's channel, its labels,
|
|
129
|
-
a mention or words it asks for. A watcher on a subtree needs `--in` to say
|
|
130
|
-
which channel under it. It stays on the board, never synced.
|
|
131
|
-
- **It fails fast when nothing runs the watcher** (`watcher_not_running`),
|
|
132
|
-
before writing anything: no host holds its lease. If the daemon stopped
|
|
133
|
-
restarting, it says that instead (`daemon_stopped`).
|
|
134
|
-
- **A run that keeps failing is `wake_failed`,** after the five tries an
|
|
135
|
-
event gets, which take a few minutes. A command that runs but wakes nothing
|
|
136
|
-
that replies is `timeout`, with the thread to read.
|
|
137
|
-
- **Some watchers can't be checked with a message:** one that listens only
|
|
138
|
-
for task events, or only to a platform's users. Write what it listens for
|
|
139
|
-
by hand instead.
|
|
140
|
-
|
|
141
|
-
Whatever the command wakes has to reply. The agents in
|
|
142
|
-
[A software factory](../03-guides/03-factory.md) and
|
|
143
|
-
[With your terminal](../03-guides/13-terminals.md) read the thread and answer
|
|
144
|
-
it like any other.
|
|
145
|
-
|
|
146
118
|
## What it promises
|
|
147
119
|
|
|
148
120
|
- **It starts from now.** What was on the board before a watcher first ran
|
|
@@ -3,7 +3,7 @@ title: Schedules
|
|
|
3
3
|
description: Schedule a message to post in a thread or channel later, once or on a period. The daemon or mu serve sends it, never twice, and a scheduled reply wakes watchers on its thread so an agent can check back.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## A message for later
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
mu schedule 12 "is the PR still open?" --in 2h
|
|
@@ -92,9 +92,25 @@ record of is refused, so restoring a board from an old backup stops the
|
|
|
92
92
|
tokens made since.
|
|
93
93
|
|
|
94
94
|
A token made before 0.2.0 may have no ID. Such a token can't be revoked and
|
|
95
|
-
stops when it runs out. To stop one sooner,
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
stops when it runs out. To stop one sooner, rotate the key and drop the old
|
|
96
|
+
one, as below.
|
|
97
|
+
|
|
98
|
+
## Rotate the signing key
|
|
99
|
+
|
|
100
|
+
Rotate the key when you think it was copied: anyone with it can make tokens
|
|
101
|
+
the board accepts. Rotate in three steps, so tokens you still want keep
|
|
102
|
+
working until you replace them:
|
|
103
|
+
|
|
104
|
+
1. `mu token rotate-key` puts a new key in place. Tokens made from now on are
|
|
105
|
+
signed with it. The old key is kept as retired, and tokens it signed still
|
|
106
|
+
work. Restart `mu serve` to use the new key.
|
|
107
|
+
2. Make new tokens for the agents and machines you still trust, with
|
|
108
|
+
`mu token create`.
|
|
109
|
+
3. `mu token drop-old-keys` deletes every retired key, which stops every token
|
|
110
|
+
they signed once `mu serve` restarts.
|
|
111
|
+
|
|
112
|
+
If the key was copied, run both commands at once and make new tokens after:
|
|
113
|
+
waiting leaves whoever has the old key able to make tokens.
|
|
98
114
|
|
|
99
115
|
The signing key is made once and kept in `~/.config/muster/keys/`, so tokens
|
|
100
116
|
survive a restart of `mu serve`.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Budgets
|
|
3
|
-
description: A budget caps what the tasks under a channel may cost in dollars. Once it is spent, the board refuses new claims there with over_budget. Agents that report no cost, such as Codex, need a time limit instead.
|
|
3
|
+
description: A budget caps what the tasks under a channel may cost in dollars. Once it is spent, the board refuses new claims there with over_budget. Agents that report no cost, such as Codex, need a time limit instead. mu report shows how work went and what it cost, by agent and workflow.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## A budget is on a channel
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
9
|
mu budget work 25
|
|
@@ -12,7 +12,9 @@ mu budget work --none
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
A budget is on a channel and covers every task under it. `mu budget` with no
|
|
15
|
-
argument lists them with what each has spent.
|
|
15
|
+
argument lists them with what each has spent, and `--none` lifts one. To
|
|
16
|
+
set one before agents work through a queue overnight, see
|
|
17
|
+
[Running unattended](../03-guides/12-unattended.md#set-a-limit-before-you-leave).
|
|
16
18
|
|
|
17
19
|
## What it counts, and what it stops
|
|
18
20
|
|
|
@@ -29,6 +31,67 @@ A looping worker (`mu run --ready work/ --loop`) stops when the board says the
|
|
|
29
31
|
money is spent. `--budget <usd>` on the worker is a limit of its own, on what
|
|
30
32
|
that one worker has spent.
|
|
31
33
|
|
|
34
|
+
## Know the cost before a worker starts
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mu run --ready work --estimate --agent claude
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
A looping worker (`mu run --ready work --loop`) prints one line before it
|
|
41
|
+
takes its first task, and `--estimate` prints only that line and starts
|
|
42
|
+
nothing:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
3 ready, about $0.90 at $0.30 a task
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The count is the ready tasks this worker may take, read as `--ready` reads
|
|
49
|
+
the channel (`work` is that channel, `work/` every channel under it): its
|
|
50
|
+
owners, `--from`, `--by`, `--label`, and tasks assigned to it or to nobody.
|
|
51
|
+
The price is what a task in that channel or under it cost that agent on
|
|
52
|
+
average over the last 30 days, from the `cost` labels below. With no cost
|
|
53
|
+
on record, as for Codex, it says `no cost history` and gives no figure.
|
|
54
|
+
An estimate changes nothing about a budget: the board still refuses claims
|
|
55
|
+
once the money is spent.
|
|
56
|
+
|
|
57
|
+
## See how work went
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mu report work
|
|
61
|
+
mu report --since 7d --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`mu report` reads the tasks under a channel (every channel when you name
|
|
65
|
+
none) that changed in the last 30 days, or in `--since`. It groups them by
|
|
66
|
+
the `agent` label `mu run` writes, and again by the `workflow` label a
|
|
67
|
+
[workflow](./16-workflows.md)'s tasks have. It changes nothing.
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
since 2026-10-29 in #work
|
|
71
|
+
agent tasks 1st round rounds failed failing input cost per task
|
|
72
|
+
claude 2 1 50% 1.00 0 0 1 $0.60 $0.30
|
|
73
|
+
codex 1 0 0% 1.00 1 0 0 - -
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Column | Meaning |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `tasks` | Tasks in the group |
|
|
79
|
+
| `1st round` | Completed and never sent back with `tasks reopen --round`, and their share |
|
|
80
|
+
| `rounds` | Rounds on average: 1, and 1 more for each `--round` |
|
|
81
|
+
| `failed` | Tasks in the state `failed` now |
|
|
82
|
+
| `failing` | Tasks the board held as `failing` at least once |
|
|
83
|
+
| `input` | Times a task was held with kind `needs_input` |
|
|
84
|
+
| `cost`, `per task` | The sum of `cost` labels, and that sum over the tasks that have one |
|
|
85
|
+
|
|
86
|
+
What it can't say:
|
|
87
|
+
|
|
88
|
+
- **No model.** `mu run` records the agent, not the model it ran, so the
|
|
89
|
+
report has no model column.
|
|
90
|
+
- **The last run's cost.** Each run of a task writes its `cost` label
|
|
91
|
+
again, so a task sent back shows what its latest round cost.
|
|
92
|
+
- **No agent, no row of its own.** `mu run` writes `agent` only when it
|
|
93
|
+
read a session from the agent. Tasks without it are `(none)`.
|
|
94
|
+
|
|
32
95
|
## What it can't count
|
|
33
96
|
|
|
34
97
|
An agent that reports no cost, as Codex does, adds nothing to the sum. Hold
|
|
@@ -89,9 +89,10 @@ Three headers come with it.
|
|
|
89
89
|
| `muster-timestamp` | When this request was sent, in seconds since 1970 |
|
|
90
90
|
| `muster-signature` | `v1=` and an HMAC-SHA256, in hex, of `<delivery>.<timestamp>.<body>` under your secret |
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
### How a receiver checks the signature
|
|
93
93
|
|
|
94
|
-
A receiver that skips this accepts requests from anyone who learns its
|
|
94
|
+
A receiver that skips this check accepts requests from anyone who learns its
|
|
95
|
+
URL. This is the check in Node.js:
|
|
95
96
|
|
|
96
97
|
```js
|
|
97
98
|
import { createHmac, timingSafeEqual } from 'node:crypto'
|
|
@@ -135,22 +136,6 @@ function fromMuster(headers, raw, secret) {
|
|
|
135
136
|
`mu daemon run` from starting, and it says which variable. `mu serve` says
|
|
136
137
|
the same on its error output and serves the board without the module.
|
|
137
138
|
|
|
138
|
-
## Check that it arrives
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
mu daemon check phone
|
|
142
|
-
mu daemon status
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
`check` sends a signed ping to the hook's URL from this terminal and prints
|
|
146
|
-
what the receiver answered. Its event has the type `ping` and is not on the
|
|
147
|
-
board. The secret has to be set where you run it.
|
|
148
|
-
|
|
149
|
-
- **`hook_failed`** when nothing answered, or the receiver refused it. A
|
|
150
|
-
`401` or `403` usually means the two sides hold different secrets.
|
|
151
|
-
- **It proves the URL and the secret, not the host.** Whether a host sends the
|
|
152
|
-
hooks is `mu daemon status`, and its log says what each hook sent.
|
|
153
|
-
|
|
154
139
|
## When not to use one
|
|
155
140
|
|
|
156
141
|
- **To wake an agent on this machine,** use a
|
|
@@ -163,7 +148,9 @@ board. The secret has to be set where you run it.
|
|
|
163
148
|
## What goes wrong
|
|
164
149
|
|
|
165
150
|
- **Nothing arrives.** `mu daemon status` lists the hook, and
|
|
166
|
-
`mu daemon check <name>` tries the URL
|
|
151
|
+
`mu daemon check <name>` tries the URL: see
|
|
152
|
+
[Check that an outgoing webhook arrives](../03-guides/09-daemon.md#check-that-an-outgoing-webhook-arrives).
|
|
153
|
+
Then read the daemon's log in
|
|
167
154
|
`~/.config/muster/logs/`: `failed hook phone at 41 HTTP 500` names the event
|
|
168
155
|
and the answer. `mu serve` prints the same line on its error output.
|
|
169
156
|
- **The daemon won't start.** A secret isn't set, or a hook shares its name
|