crewbus 10.0.12 → 11.3.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/AGENTS.template.md +4 -4
- package/CHANGELOG.md +135 -0
- package/README.md +69 -44
- package/TEAM.template.md +1 -1
- package/bin/crewbus-hook.js +22 -5
- package/bin/crewbus-mcp.js +56 -48
- package/bin/crewbus.js +459 -238
- package/bin/lib/channels.js +1 -1
- package/bin/lib/export.js +1 -1
- package/bin/lib/groups.js +1 -5
- package/bin/lib/identity.js +90 -128
- package/bin/lib/launch.js +63 -8
- package/bin/lib/relay.js +25 -42
- package/bin/lib/spawn.js +155 -162
- package/bin/lib/store.js +2 -2
- package/bin/lib/web.js +49 -46
- package/claude-plugin/skills/crewbus/SKILL.md +1 -1
- package/docs/APPROVALS.md +8 -8
- package/docs/AUDIT_EXPORT.md +7 -7
- package/docs/CERT_READINESS.md +5 -5
- package/docs/COMPATIBILITY.md +6 -2
- package/docs/CONSOLIDATOR.md +6 -6
- package/docs/CONTROL_PLANE_SPEC.md +3 -3
- package/docs/CREWS.md +58 -55
- package/docs/DELIVERY.md +11 -8
- package/docs/GROUPS.md +8 -8
- package/docs/IDENTITY.md +6 -6
- package/docs/LEAD_ASSIGN.md +2 -73
- package/docs/LONG_RUNS.md +3 -3
- package/docs/M1_CLI_DRAFT.md +7 -7
- package/docs/ORCHESTRATOR.md +87 -0
- package/docs/PAIRING.md +7 -7
- package/docs/QUICKSTART.md +81 -70
- package/docs/RBAC.md +84 -73
- package/docs/TENANCY.md +10 -10
- package/docs/THREAT_MODEL.md +3 -3
- package/docs/VERIFIER.md +10 -10
- package/docs/VERSION_SKEW.md +1 -1
- package/documentation.html +33 -24
- package/examples/hermes-pairing.md +3 -3
- package/examples/t3-pairing.md +1 -1
- package/index.html +6 -6
- package/opencode/plugins/dm-watch.js +1 -1
- package/opencode/tools/dm-send.js +1 -1
- package/package.json +27 -2
- package/packages/contracts/harness.json +15 -1
- package/packages/contracts/launch.json +2 -3
- package/packages/contracts/pairing.json +3 -3
package/bin/lib/web.js
CHANGED
|
@@ -18,9 +18,10 @@ import path from "node:path";
|
|
|
18
18
|
import http from "node:http";
|
|
19
19
|
import { fileURLToPath } from "node:url";
|
|
20
20
|
import { boardDir, requireBoard, getFlag, fail, writeJson, listJson, cleanWebName, readJson, readBoardMeta, writeBoardMeta, gitRevForBoard, newId, MAX_SPAWN, MAX_BODY_CHARS } from "./store.js";
|
|
21
|
-
import { readAgent, agentTokenMatches, authorizeCheck,
|
|
21
|
+
import { readAgent, agentTokenMatches, authorizeCheck, ensureOrchestrator, mintToken, newSalt, hashToken, touchAgent } from "./identity.js";
|
|
22
22
|
import { readDMs, readVisible, ackedIds, ackedIdSet, findMessageById, deliverDMs, parseRecipients } from "./mail.js";
|
|
23
|
-
import { workerStatus, pidAlive, killWorkers, bootWorker, buildSpawnPrompt, buildSpawnTarget, formatSpawnCmd, installCliToUserPath, ensureBoardCliShim,
|
|
23
|
+
import { workerStatus, pidAlive, killWorkers, bootWorker, buildSpawnPrompt, buildSpawnTarget, formatSpawnCmd, installCliToUserPath, ensureBoardCliShim, buildOrchestratorPrompt, provisionOrchestrator,
|
|
24
|
+
ORCHESTRATOR_NAME, isPidStale, parseModelList, modelForIndex } from "./spawn.js";
|
|
24
25
|
import { groupTelemetryData, collectBatch, gatherTelemetry, listBatches } from "./groups.js";
|
|
25
26
|
import { httpJson } from "./sync.js";
|
|
26
27
|
import { readChainRecords, verifyChainRecords, appendChainRecord, readHold, readBoardQuotas } from "./export.js";
|
|
@@ -784,9 +785,9 @@ details.tech-details summary{cursor:pointer;font-weight:500;user-select:none}
|
|
|
784
785
|
<button type="button" data-perm="auto">auto</button>
|
|
785
786
|
<button type="button" data-perm="full">full</button>
|
|
786
787
|
</span>
|
|
787
|
-
<span class="dim" style="margin-left:8px">
|
|
788
|
-
<select id="launch-lead" style="background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:3px 8px;font-size:12px" title="
|
|
789
|
-
<option value="auto">auto (
|
|
788
|
+
<span class="dim" style="margin-left:8px">Orchestrator:</span>
|
|
789
|
+
<select id="launch-lead" style="background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:4px;padding:3px 8px;font-size:12px" title="The board orchestrator: auto-provisions a persistent background coordinator to triage workers and report">
|
|
790
|
+
<option value="auto">auto (board orchestrator)</option>
|
|
790
791
|
</select>
|
|
791
792
|
<label class="dim" style="cursor:pointer;margin-left:6px"><input id="launch-dry" type="checkbox" checked> Dry-run</label>
|
|
792
793
|
</div>
|
|
@@ -807,7 +808,7 @@ details.tech-details summary{cursor:pointer;font-weight:500;user-select:none}
|
|
|
807
808
|
|
|
808
809
|
<div class="composer-bottom">
|
|
809
810
|
<div class="launch-identity" title="Desktop launches as the board owner (auto-provisioned) — no token step needed">
|
|
810
|
-
<span class="dim">launching as <b id="launch-as">
|
|
811
|
+
<span class="dim">launching as <b id="launch-as">orchestrator</b> (auto)</span>
|
|
811
812
|
<input id="launch-from" type="hidden" value="">
|
|
812
813
|
<input id="launch-token" type="password" style="display:none" value="">
|
|
813
814
|
</div>
|
|
@@ -1015,7 +1016,7 @@ function markIdent(){
|
|
|
1015
1016
|
try{
|
|
1016
1017
|
var man=document.getElementById('launch-from-manual');
|
|
1017
1018
|
var lbl=document.getElementById('launch-as');
|
|
1018
|
-
if(lbl)lbl.textContent=(man&&man.value.trim())||lf.value.trim()||c.from||'
|
|
1019
|
+
if(lbl)lbl.textContent=(man&&man.value.trim())||lf.value.trim()||c.from||'orchestrator';
|
|
1019
1020
|
}catch(_){}
|
|
1020
1021
|
}
|
|
1021
1022
|
async function autoLoadOperatorCreds(){
|
|
@@ -1211,9 +1212,9 @@ async function refresh(){
|
|
|
1211
1212
|
return '<tr><td>'+esc(m.id)+'</td><td>'+esc(m.from)+'</td><td>'+(m.subject?'<b>'+esc(m.subject)+'</b><br>':'')+esc(m.head)+'</td><td><button data-ack="'+esc(m.id)+'">ack</button></td></tr>';
|
|
1212
1213
|
}).join('')||'<tr><td colspan="4" class="dim">inbox zero for '+esc(c.from)+'</td></tr>';
|
|
1213
1214
|
var ap=(tj.items||[]).filter(function(m){return m.subject&&m.subject.indexOf('approval: ')===0;});
|
|
1214
|
-
if(c.from!=='
|
|
1215
|
+
if(c.from!=='orchestrator'){
|
|
1215
1216
|
try{
|
|
1216
|
-
var lr=await fetch('/api/inbox?agent=
|
|
1217
|
+
var lr=await fetch('/api/inbox?agent=orchestrator&unacked=1&limit=50',{cache:'no-store'});
|
|
1217
1218
|
if(lr.ok){
|
|
1218
1219
|
var lj=await lr.json();
|
|
1219
1220
|
var lap=(lj.items||[]).filter(function(m){return m.subject&&m.subject.indexOf('approval: ')===0;});
|
|
@@ -1225,7 +1226,7 @@ async function refresh(){
|
|
|
1225
1226
|
}catch(_){}
|
|
1226
1227
|
}
|
|
1227
1228
|
document.getElementById('approvals').innerHTML=ap.map(function(m){
|
|
1228
|
-
var tag=m._forLead?' <span class="badge" style="font-size:10px;background:var(--panel);border:1px solid var(--line);padding:1px 4px;border-radius:3px">to
|
|
1229
|
+
var tag=m._forLead?' <span class="badge" style="font-size:10px;background:var(--panel);border:1px solid var(--line);padding:1px 4px;border-radius:3px">to orchestrator</span>':'';
|
|
1229
1230
|
return '<tr><td>'+esc(m.id)+tag+'</td><td>'+esc(m.from)+'</td><td>'+(m.subject?'<b>'+esc(m.subject)+'</b><br>':'')+esc(m.head)+'</td><td><input data-reason="'+esc(m.id)+'" maxlength="500" size="18" placeholder="optional reason"></td><td><button data-approve="'+esc(m.id)+'">approve</button> <button class="danger" data-deny="'+esc(m.id)+'">deny</button></td></tr>';
|
|
1230
1231
|
}).join('')||'<tr><td colspan="5" class="dim">no approval requests for '+esc(c.from)+'</td></tr>';
|
|
1231
1232
|
}else{
|
|
@@ -1512,19 +1513,19 @@ async function doLaunch(dry){
|
|
|
1512
1513
|
if(j.dryRun){
|
|
1513
1514
|
var warn=(j.warnings||[]).length?('warnings: '+j.warnings.join('; ')+'\\n'):'';
|
|
1514
1515
|
var cwdNotice=j.cwd?('target directory (cwd): '+j.cwd+'\\n'):'';
|
|
1515
|
-
var coordNotice=j.coordinator?('\\ncoordinator ('+j.coordinator.name+'): '+(j.coordinator.action==='reused'?('reused standing pid '+j.coordinator.pid):(j.coordinator.action==='
|
|
1516
|
+
var coordNotice=j.coordinator?('\\ncoordinator ('+j.coordinator.name+'): '+(j.coordinator.action==='reused'?('reused standing pid '+j.coordinator.pid):(j.coordinator.action==='created'?'would auto-provision':'skipped ('+(j.coordinator.reason||'')+')'))):'';
|
|
1516
1517
|
try{renderLaunchDiff(j);}catch(_){}out.textContent=warn+cwdNotice+(j.commands||[]).map(function(c){return c.to+' ['+(c.harness||'')+']: '+c.command;}).join('\\n')+coordNotice+'\\n(dry-run — booted nothing)';
|
|
1517
1518
|
}else{
|
|
1518
1519
|
try{showUndoToast((j.workers||[]).map(function(w){return w.name;}));}catch(_){}
|
|
1519
1520
|
var cwdNotice=j.cwd?(' [cwd: '+j.cwd+']'):'';
|
|
1520
1521
|
var coordNotice='';
|
|
1521
1522
|
if(j.coordinator){
|
|
1522
|
-
if(j.coordinator.action==='
|
|
1523
|
-
coordNotice=' ·
|
|
1523
|
+
if(j.coordinator.action==='created'&&j.coordinator.pid){
|
|
1524
|
+
coordNotice=' · orchestrator: pid '+j.coordinator.pid;
|
|
1524
1525
|
}else if(j.coordinator.action==='reused'){
|
|
1525
|
-
coordNotice=' ·
|
|
1526
|
+
coordNotice=' · orchestrator: reused'+(j.coordinator.pid?' pid '+j.coordinator.pid:'');
|
|
1526
1527
|
}else if(j.coordinator.reason){
|
|
1527
|
-
coordNotice=' ·
|
|
1528
|
+
coordNotice=' · orchestrator: skipped ('+j.coordinator.reason+')';
|
|
1528
1529
|
}
|
|
1529
1530
|
}
|
|
1530
1531
|
out.textContent='launched: '+(j.workers||[]).map(function(w){return w.name+' ['+(w.driver||'')+']'+(w.pid?(' (pid '+w.pid+')'):'')+(w.error?(' ERROR '+w.error):'');}).join(', ')+coordNotice+cwdNotice;
|
|
@@ -2463,7 +2464,7 @@ export async function handleWebDashboardRoute(req, res, url, d) {
|
|
|
2463
2464
|
res.end(JSON.stringify({ error: "loopback only" }));
|
|
2464
2465
|
return true;
|
|
2465
2466
|
}
|
|
2466
|
-
for (const name of [
|
|
2467
|
+
for (const name of [ORCHESTRATOR_NAME]) {
|
|
2467
2468
|
const tokenFile = path.join(d.root, "logs", `${name}.token`);
|
|
2468
2469
|
let tok = "";
|
|
2469
2470
|
try { tok = fs.readFileSync(tokenFile, "utf8").trim(); } catch {}
|
|
@@ -2566,12 +2567,12 @@ export async function handleWebDashboardRoute(req, res, url, d) {
|
|
|
2566
2567
|
const ttlMs = 10 * 60 * 1000;
|
|
2567
2568
|
const doc = {
|
|
2568
2569
|
tokenHash: hashToken(token, salt), salt, label: "dashboard-oneclick",
|
|
2569
|
-
createdBy:
|
|
2570
|
+
createdBy: ORCHESTRATOR_NAME, createdAt: new Date(now).toISOString(),
|
|
2570
2571
|
expiresAt: new Date(now + ttlMs).toISOString(),
|
|
2571
2572
|
};
|
|
2572
2573
|
fs.mkdirSync(path.join(d.root, "pairing"), { recursive: true });
|
|
2573
2574
|
writeJson(pairingPath(d, doc.tokenHash), doc);
|
|
2574
|
-
try { appendChainRecord(d,
|
|
2575
|
+
try { appendChainRecord(d, ORCHESTRATOR_NAME, "pair", { label: "dashboard-oneclick", expiresAt: doc.expiresAt }); } catch {}
|
|
2575
2576
|
const envId = (readRelayState(d) && readRelayState(d).envId) || ("board:" + path.basename(d.root));
|
|
2576
2577
|
const pairUrl = buildPairUrl({ envId, routes: [], caps: ["hlc", "tombstones", "channels", "revoked", "holds", "launch"], pairToken: token });
|
|
2577
2578
|
res.writeHead(200, { "content-type": "application/json; charset=utf-8", "cache-control": "no-store" });
|
|
@@ -2591,9 +2592,9 @@ export async function cmdWeb(args) {
|
|
|
2591
2592
|
ensureBoardCliShim(d);
|
|
2592
2593
|
const host = getFlag(args, "--host") || "127.0.0.1";
|
|
2593
2594
|
const port = Number(getFlag(args, "--port") || 0);
|
|
2594
|
-
//
|
|
2595
|
-
//
|
|
2596
|
-
try {
|
|
2595
|
+
// Same local auto-provision as `serve`: the board's single orchestrator is
|
|
2596
|
+
// ensured on boot (minted on first use, token at logs/orchestrator.token).
|
|
2597
|
+
try { ensureOrchestrator(d); } catch {}
|
|
2597
2598
|
if (!(port >= 0 && port < 65536)) fail("--port must be 0-65535 (0 = random)");
|
|
2598
2599
|
if (host !== "127.0.0.1" && host !== "localhost" && host !== "::1") {
|
|
2599
2600
|
process.stderr.write(`crewbus: warning: binding non-local ${host} — the dashboard has no auth, anyone who can reach it can read the board\n`);
|
|
@@ -2771,11 +2772,13 @@ export async function handleApiKill(d, body) {
|
|
|
2771
2772
|
// CLI); dryRun previews exact commands without booting; live delivers the
|
|
2772
2773
|
// brief + boots via bootWorker (same core as CLI spawn/remoteSpawn).
|
|
2773
2774
|
export async function handleApiLaunch(d, body) {
|
|
2774
|
-
const from =
|
|
2775
|
+
const from = ORCHESTRATOR_NAME;
|
|
2775
2776
|
const token = body && body.token !== undefined && body.token !== null && String(body.token) !== "" ? String(body.token) : undefined;
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2777
|
+
ensureOrchestrator(d);
|
|
2778
|
+
if (token) {
|
|
2779
|
+
const rec = readAgent(d, from);
|
|
2780
|
+
if (!rec || !(rec.tokenHash || rec.token) || !agentTokenMatches(rec, token)) return { status: 403, payload: { error: "bad token" } };
|
|
2781
|
+
}
|
|
2779
2782
|
{
|
|
2780
2783
|
const r = authorizeCheck(d, from, "spawn");
|
|
2781
2784
|
if (!r.ok) return { status: 403, payload: { error: r.reason } };
|
|
@@ -2784,11 +2787,11 @@ export async function handleApiLaunch(d, body) {
|
|
|
2784
2787
|
if (!v.ok) return { status: 400, payload: { error: "launch plan invalid", errors: v.errors, warnings: v.warnings } };
|
|
2785
2788
|
const p = v.plan;
|
|
2786
2789
|
const harnesses = Array.isArray(p.harnesses) && p.harnesses.length > 0 ? p.harnesses : [p.harness || "opencode"];
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
const
|
|
2790
|
+
const models = Array.isArray(p.models) ? p.models : parseModelList(p.model);
|
|
2791
|
+
const coordModel = p.orchestratorModel !== undefined && p.orchestratorModel !== null && String(p.orchestratorModel).trim() !== ""
|
|
2792
|
+
? String(p.orchestratorModel).trim() : modelForIndex(models, 0);
|
|
2793
|
+
const orchestratorMode = "auto";
|
|
2794
|
+
const orchestratorTarget = ORCHESTRATOR_NAME;
|
|
2792
2795
|
const names = p.to ? String(p.to).split(",").map((s) => cleanWebName(s)).filter(Boolean)
|
|
2793
2796
|
: Array.from({ length: p.count }, (_, i) => `${cleanWebName(p.prefix || "w") || "w"}-${i + 1}`);
|
|
2794
2797
|
if (names.length === 0) return { status: 400, payload: { error: "no worker names (pass to or count)" } };
|
|
@@ -2801,9 +2804,9 @@ export async function handleApiLaunch(d, body) {
|
|
|
2801
2804
|
const previewBatch = names.length > 1 ? newId("batch") : undefined;
|
|
2802
2805
|
const rows = names.map((to, i) => {
|
|
2803
2806
|
const driver = harnesses[i % harnesses.length];
|
|
2804
|
-
const previewPrompt = buildSpawnPrompt({ name: to,
|
|
2807
|
+
const previewPrompt = buildSpawnPrompt({ name: to, orchestrator: orchestratorTarget, subject: p.subject, body: p.body.trim(), replyId: previewBatch ? `${previewBatch}-${i + 1}` : "msg-<id>", rev, cwd, root: d.root });
|
|
2805
2808
|
const t = buildSpawnTarget({
|
|
2806
|
-
harness: driver, model:
|
|
2809
|
+
harness: driver, model: modelForIndex(models, i),
|
|
2807
2810
|
auto: p.permission === "auto" || p.permission === "full" ? true : undefined,
|
|
2808
2811
|
maxTurns: p.maxTurns, allowTools: p.allowTools, cwd,
|
|
2809
2812
|
name: to, promptPath: path.join("<board>", "logs", `${to}-<stamp>.prompt.md`), prompt: previewPrompt,
|
|
@@ -2811,24 +2814,24 @@ export async function handleApiLaunch(d, body) {
|
|
|
2811
2814
|
return { to, harness: driver, command: formatSpawnCmd(t) };
|
|
2812
2815
|
});
|
|
2813
2816
|
let coordinator = undefined;
|
|
2814
|
-
if (
|
|
2815
|
-
const existingLead = readAgent(d,
|
|
2817
|
+
if (orchestratorMode === "auto") {
|
|
2818
|
+
const existingLead = readAgent(d, ORCHESTRATOR_NAME);
|
|
2816
2819
|
// Stale-pid guard (C2): reuse only a live, non-stale coordinator; a
|
|
2817
2820
|
// pid-recycled after reboot record gets the fresh-provision branch.
|
|
2818
2821
|
const standing = existingLead && typeof existingLead.spawnedPid === "number" && pidAlive(existingLead.spawnedPid) && !isPidStale(existingLead.spawnedPid, existingLead.spawnedAt);
|
|
2819
2822
|
if (standing) {
|
|
2820
|
-
coordinator = { name:
|
|
2823
|
+
coordinator = { name: ORCHESTRATOR_NAME, action: "reused", pid: existingLead.spawnedPid, note: "live coordinator already running" };
|
|
2821
2824
|
} else if (existingLead && existingLead.offboarded) {
|
|
2822
|
-
coordinator = { name:
|
|
2825
|
+
coordinator = { name: ORCHESTRATOR_NAME, action: "skipped", reason: "lane is offboarded" };
|
|
2823
2826
|
} else {
|
|
2824
2827
|
const coordDriver = harnesses[0] || "opencode";
|
|
2825
|
-
const previewCoordPrompt =
|
|
2826
|
-
name:
|
|
2828
|
+
const previewCoordPrompt = buildOrchestratorPrompt({
|
|
2829
|
+
name: ORCHESTRATOR_NAME, subject: p.subject, body: p.body.trim(), batch: previewBatch,
|
|
2827
2830
|
workers: names.map((name, i) => ({ name, id: previewBatch ? `${previewBatch}-${i + 1}` : "msg-<id>", harness: harnesses[i % harnesses.length] })),
|
|
2828
2831
|
cwd, root: d.root, auto: p.permission === "auto" || p.permission === "full",
|
|
2829
2832
|
});
|
|
2830
2833
|
coordinator = {
|
|
2831
|
-
name:
|
|
2834
|
+
name: ORCHESTRATOR_NAME, action: "created", harness: coordDriver, model: coordModel, wouldProvision: true,
|
|
2832
2835
|
promptPreview: previewCoordPrompt.slice(0, 400),
|
|
2833
2836
|
};
|
|
2834
2837
|
}
|
|
@@ -2850,27 +2853,27 @@ export async function handleApiLaunch(d, body) {
|
|
|
2850
2853
|
for (let i = 0; i < res.items.length; i++) {
|
|
2851
2854
|
const { to, id } = res.items[i];
|
|
2852
2855
|
const driver = harnesses[i % harnesses.length];
|
|
2853
|
-
const spawnOpts = { harness: driver, cmd: body && body.cmd ? String(body.cmd) : undefined, model:
|
|
2856
|
+
const spawnOpts = { harness: driver, cmd: body && body.cmd ? String(body.cmd) : undefined, model: modelForIndex(models, i), auto, maxTurns: p.maxTurns, allowTools: p.allowTools, cwd, root: d.root, prompt: null };
|
|
2854
2857
|
try {
|
|
2855
|
-
const r = bootWorker(d, spawnOpts, { to, id, from,
|
|
2858
|
+
const r = bootWorker(d, spawnOpts, { to, id, from, orchestrator: orchestratorTarget, subject: p.subject, body: p.body.trim(), rev, logDir });
|
|
2856
2859
|
workers.push({ name: to, pid: r.pid, replyId: id, log: r.logPath, driver });
|
|
2857
2860
|
} catch (e) {
|
|
2858
2861
|
workers.push({ name: to, replyId: id, driver, error: String((e && e.message) || e) });
|
|
2859
2862
|
}
|
|
2860
2863
|
}
|
|
2861
2864
|
let coordinator = undefined;
|
|
2862
|
-
if (
|
|
2865
|
+
if (orchestratorMode === "auto") {
|
|
2863
2866
|
const coordHarness = harnesses[0] || "opencode";
|
|
2864
|
-
const coordSpawnOpts = { harness: coordHarness, cmd: body && body.cmd ? String(body.cmd) : undefined, model:
|
|
2867
|
+
const coordSpawnOpts = { harness: coordHarness, cmd: body && body.cmd ? String(body.cmd) : undefined, model: coordModel, auto, cwd, root: d.root, prompt: null };
|
|
2865
2868
|
try {
|
|
2866
|
-
coordinator =
|
|
2869
|
+
coordinator = provisionOrchestrator(d, {
|
|
2867
2870
|
spawnOpts: coordSpawnOpts,
|
|
2868
|
-
|
|
2871
|
+
subject: p.subject, body: p.body.trim(), rev, logDir,
|
|
2869
2872
|
workers: res.items.map((it, i) => ({ name: it.to, id: it.id, harness: harnesses[i % harnesses.length] })),
|
|
2870
2873
|
batch: res.batch, auto,
|
|
2871
2874
|
});
|
|
2872
2875
|
} catch (e) {
|
|
2873
|
-
coordinator = { action: "skipped", reason: `coordinator boot error: ${String((e && e.message) || e)}`,
|
|
2876
|
+
coordinator = { action: "skipped", reason: `coordinator boot error: ${String((e && e.message) || e)}`, orchestratorName: ORCHESTRATOR_NAME };
|
|
2874
2877
|
}
|
|
2875
2878
|
}
|
|
2876
2879
|
return { status: 200, payload: { ok: true, cwd, workers, coordinator, warnings: v.warnings } };
|
|
@@ -27,7 +27,7 @@ Digest-first on long runs: `dm_inbox({ agent: "<you>", unacked: true, digest: tr
|
|
|
27
27
|
|
|
28
28
|
## Long tasks: checkpoint
|
|
29
29
|
|
|
30
|
-
Every few steps, or before anything risky, post progress on your thread: `dm_send({ from, to:
|
|
30
|
+
Every few steps, or before anything risky, post progress on your thread: `dm_send({ from, to: orchestrator, replyTo: briefId, checkpoint: true, body: "done X / next Y" })`. Checkpoints show labeled in transcripts, never need ack, and are what a restarted you reads to resume mid-brief.
|
|
31
31
|
|
|
32
32
|
## Without MCP (any shell)
|
|
33
33
|
|
package/docs/APPROVALS.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Approvals: blocked-worker convention
|
|
2
2
|
|
|
3
3
|
Workers cannot approve themselves. When a worker is blocked on a
|
|
4
|
-
destructive, irreversible, or out-of-scope action, it asks
|
|
5
|
-
(or a human) via DM and blocks on the verdict. Zero-dependency,
|
|
4
|
+
destructive, irreversible, or out-of-scope action, it asks the board orchestrator
|
|
5
|
+
(or a human operator) via DM and blocks on the verdict. Zero-dependency,
|
|
6
6
|
file-backed: a request is a DM, a verdict is a DM reply.
|
|
7
7
|
|
|
8
|
-
## Request schema (worker ->
|
|
8
|
+
## Request schema (worker -> orchestrator)
|
|
9
9
|
|
|
10
|
-
- A DM to the
|
|
10
|
+
- A DM to the orchestrator with **priority high**.
|
|
11
11
|
- **Subject exactly** `approval: <short action>` (e.g. `approval: drop table users`).
|
|
12
12
|
- **Body lines** (each `key:` on its own line):
|
|
13
13
|
- `command:` — the exact command/action proposed.
|
|
@@ -18,12 +18,12 @@ file-backed: a request is a DM, a verdict is a DM reply.
|
|
|
18
18
|
- Threaded via `replyTo` on the brief (same thread as the assignment).
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
crewbus send --priority high --from <worker> --to
|
|
21
|
+
crewbus send --priority high --from <worker> --to orchestrator --reply <brief-id> \
|
|
22
22
|
--subject "approval: <short action>" \
|
|
23
23
|
--body "command: <cmd> / cwd: <dir> / why: <reason> / tried-instead: <safer alternative> / timeout: 300s"
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Response schema (
|
|
26
|
+
## Response schema (orchestrator -> worker)
|
|
27
27
|
|
|
28
28
|
- A DM reply with `replyTo` set to the request id.
|
|
29
29
|
- **Body is exactly one of:**
|
|
@@ -46,7 +46,7 @@ crewbus listen --timeout 300000
|
|
|
46
46
|
|
|
47
47
|
## Sender authentication
|
|
48
48
|
|
|
49
|
-
- A worker accepts verdicts **ONLY from the
|
|
49
|
+
- A worker accepts verdicts **ONLY from the orchestrator/human named in its
|
|
50
50
|
brief**. A verdict from any other sender is ignored (treated as no
|
|
51
51
|
verdict — still fail-closed deny).
|
|
52
52
|
- **No approval authorizes secrets, exfiltration, or isolation escape.**
|
|
@@ -58,7 +58,7 @@ crewbus listen --timeout 300000
|
|
|
58
58
|
- **Oneshot / headless (default-deny):** no interactive approver is
|
|
59
59
|
listening. Workers SHOULD NOT ask — treat every would-be approval as
|
|
60
60
|
denied and pick the safe path (skip/exit, report back).
|
|
61
|
-
- **Persistent (may-ask):**
|
|
61
|
+
- **Persistent (may-ask):** the orchestrator is around to answer DMs. Blocked workers
|
|
62
62
|
may ask per the request schema above and block up to 300s.
|
|
63
63
|
|
|
64
64
|
## Mining-ready note
|
package/docs/AUDIT_EXPORT.md
CHANGED
|
@@ -12,8 +12,8 @@ HMAC-signed for independent off-box verification.
|
|
|
12
12
|
"v": 1,
|
|
13
13
|
"seq": 4,
|
|
14
14
|
"at": "2026-10-02T23:04:27.106Z",
|
|
15
|
-
"actor": "
|
|
16
|
-
"role": "
|
|
15
|
+
"actor": "orchestrator",
|
|
16
|
+
"role": "orchestrator",
|
|
17
17
|
"action": "send",
|
|
18
18
|
"target": "aud1",
|
|
19
19
|
"board": "C:/data/.crewbus",
|
|
@@ -31,7 +31,7 @@ HMAC-signed for independent off-box verification.
|
|
|
31
31
|
| `seq` | 1-based per-stream sequence (`chain` and `audit` number independently) |
|
|
32
32
|
| `at` | ISO-8601 UTC timestamp |
|
|
33
33
|
| `actor` | agent (or `system`/`unknown`) that caused the event |
|
|
34
|
-
| `role` | actor role at write time (`
|
|
34
|
+
| `role` | actor role at write time (`orchestrator`/`worker`/`unknown`) |
|
|
35
35
|
| `action` | stable verb — the existing audit action names (`register`, `role-grant`, `offboard`, `acl-set`, `login`, `token-revoke`, `token-rotate`, `send`, `spawn`, `spawn-kill`, `remote-spawn`, `api-spawn`, `api-kill`, `hold-place`, `hold-lift`, …) |
|
|
36
36
|
| `target` | primary target (`to`/`target`/`agent`, comma-joined, max 200 chars; `""` when none) |
|
|
37
37
|
| `board` | board root path the event was written on |
|
|
@@ -90,13 +90,13 @@ Env equivalents: `CREWBUS_AUDIT_FORWARD`,
|
|
|
90
90
|
## Legal hold
|
|
91
91
|
|
|
92
92
|
```sh
|
|
93
|
-
crewbus hold place --from
|
|
94
|
-
crewbus hold lift --from
|
|
93
|
+
crewbus hold place --from orchestrator [--reason "..."]
|
|
94
|
+
crewbus hold lift --from orchestrator
|
|
95
95
|
crewbus hold status [--from <you>] [--json]
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
- `place`/`lift` are
|
|
99
|
-
- `status` is a read — any role, including
|
|
98
|
+
- `place`/`lift` are orchestrator-only (token-checked + authorized).
|
|
99
|
+
- `status` is a read — any role, including workers, may call it
|
|
100
100
|
(with `--from` it is token-checked; without, it is an operator read).
|
|
101
101
|
- While a hold is active, `prune` (dm/broadcast + logs) is **refused**
|
|
102
102
|
loudly and names the hold:
|
package/docs/CERT_READINESS.md
CHANGED
|
@@ -19,7 +19,7 @@ item. Statuses: **done** (in the tree, covered by `npm test`), **manual**
|
|
|
19
19
|
See `docs/HA.md`.
|
|
20
20
|
- [manual] **Access-review cadence (quarterly stub):** run `agents --json`,
|
|
21
21
|
confirm each identity still needs its role, `offboard` leavers
|
|
22
|
-
(`register --offboard <name> --from
|
|
22
|
+
(`register --offboard <name> --from orchestrator` preserves inbox for audit),
|
|
23
23
|
record the review date + reviewer. Evidence: the signed `role-grant` /
|
|
24
24
|
`offboard` events in the log.
|
|
25
25
|
|
|
@@ -69,7 +69,7 @@ item. Statuses: **done** (in the tree, covered by `npm test`), **manual**
|
|
|
69
69
|
[--audit-forward-key <bearer>]` POSTs off-box with an `audit-spool/`
|
|
70
70
|
at-least-once retry queue that drains (never blocks the relay path).
|
|
71
71
|
See `docs/AUDIT_EXPORT.md`.
|
|
72
|
-
- [done] Legal holds: `hold place --from
|
|
72
|
+
- [done] Legal holds: `hold place --from orchestrator [--reason]` /
|
|
73
73
|
`hold lift` / `hold status`; `prune` (and `import` over a held board)
|
|
74
74
|
refuse while held; hold record syncs to peers.
|
|
75
75
|
- [manual] **Log-review + retention (stub):** forward to your SIEM, alert
|
|
@@ -80,14 +80,14 @@ item. Statuses: **done** (in the tree, covered by `npm test`), **manual**
|
|
|
80
80
|
|
|
81
81
|
## 5. Backup
|
|
82
82
|
|
|
83
|
-
- [done] Portable encrypted backups (`board export --from
|
|
83
|
+
- [done] Portable encrypted backups (`board export --from orchestrator
|
|
84
84
|
--out <file>`), safe restore (`board import --force` semantics + hold
|
|
85
|
-
interaction), declarative schedules (`snapshot schedule --from
|
|
85
|
+
interaction), declarative schedules (`snapshot schedule --from orchestrator
|
|
86
86
|
--every 24h --keep 7 --out-dir <dir>`), `snapshot run` for cron/systemd/
|
|
87
87
|
Task Scheduler, quotas/tenancy (`quota set/show`, `storage`, separate
|
|
88
88
|
boards per tenant). See `docs/TENANCY.md`.
|
|
89
89
|
- [manual] **Restore-drill runbook (quarterly stub):**
|
|
90
|
-
1. `board export --from
|
|
90
|
+
1. `board export --from orchestrator --out /offsite/drill-<date>.abbackup.json`
|
|
91
91
|
2. `board import --in /offsite/drill-<date>.abbackup.json --into <fresh-dir> --force`
|
|
92
92
|
3. `gather`/inbox spot-checks + `log --verify` on the restored board
|
|
93
93
|
4. Record date, operator, result. Evidence: the drill log + restored-board
|
package/docs/COMPATIBILITY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Compatibility matrix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Seven adapters depend on fast-changing vendor surfaces (hooks, MCP behavior,
|
|
4
4
|
CLI flags). This table records what crewbus expects and when it was last
|
|
5
5
|
verified. When a harness ships a new release, re-verify its row and update
|
|
6
6
|
the date; `crewbus doctor` checks wiring presence on your machine (see
|
|
@@ -43,11 +43,12 @@ Status per harness (re-check the "no" rows when vendors change flags):
|
|
|
43
43
|
accepted by `exec resume <id>`).
|
|
44
44
|
- cursor: no — id lives in `stream-json`, spawn uses plain print mode.
|
|
45
45
|
- agy: no — `--print` emits answer text, not the conversation id.
|
|
46
|
+
- qwen: yes, pre-assigned (`--session-id <uuid>` minted at boot, plus `--output-format json` corroboration; mid-run kill leaves resumable id on record).
|
|
46
47
|
|
|
47
48
|
## Resume commands (used by `respawn`)
|
|
48
49
|
|
|
49
50
|
Honesty authority: `packages/contracts/harness.json` (`version: 1`,
|
|
50
|
-
frozen-M0). `resume:true` for opencode / claude / codex / grok
|
|
51
|
+
frozen-M0). `resume:true` for opencode / claude / codex / grok / qwen
|
|
51
52
|
(`harness.json:15,29,43,57`); `resume:false` for antigravity / cursor /
|
|
52
53
|
UIs render resume unsupported for those
|
|
53
54
|
three and never fake continuity. Flags below mirror
|
|
@@ -61,6 +62,7 @@ three and never fake continuity. Flags below mirror
|
|
|
61
62
|
- codex: `exec <parent opts> resume <id> "<catch-up>"` (parent options
|
|
62
63
|
precede the subcommand; prompt inline — `exec` has no `--file`).
|
|
63
64
|
- grok: `--prompt-file <catch-up> -r <id>`.
|
|
65
|
+
- qwen: `--resume <id>` (or `-r <id>`).
|
|
64
66
|
- agy: `-p "<catch-up>" --conversation <id>` — HONESTLY UNSUPPORTED
|
|
65
67
|
(`resume:false`): no stable conversation id on stdout, so there is
|
|
66
68
|
rarely an id to pass; the flag is what `respawn` would use IF one were
|
|
@@ -165,6 +167,7 @@ automatically via `experimental.session.compacting`.
|
|
|
165
167
|
| codex (Codex CLI) | `PreCompact` / `PostCompact` in hooks config, matcher on `trigger` = `manual`/`auto` (plain stdout ignored; JSON common-output fields) | 2026-10-05 (vendor docs: developers.openai.com/codex/hooks, codex-rs hooks source) |
|
|
166
168
|
| cursor (`cursor-agent`) | `preCompact` (lowercase c) in `.cursor/hooks.json` — observational only (`user_message` output; cannot block or follow up). Claude-format `PreCompact` also maps via third-party hooks | 2026-10-05 (vendor docs: cursor.com/docs/hooks, third-party-hooks) |
|
|
167
169
|
| grok-build (`grok`) | `PostCompact` in `.grok/hooks/crewbus.json` (`crewbus-hook compact` rehydration, same invocation shape as claude/codex; project hooks need folder trust — `/hooks-trust` or launch with `--trust`). Fallback for older grok builds: run `crewbus-hook compact --from <you>` as the first post-compaction step, or surface it via the `monitor` stream | 2026-10-07 (vendor docs: docs.x.ai/build/features/hooks — `PreCompact`/`PostCompact` lifecycle events, hook JSON in `~/.grok/hooks/*.json` or `<project>/.grok/hooks/*.json`, event JSON on stdin (`hookEventName`, `sessionId`, `cwd`, `workspaceRoot`) + `GROK_*` env vars, `type` `command`/`http`, project hooks require trust) |
|
|
170
|
+
| qwen (Qwen Code) | `PostCompact` in `.qwen/settings.json` (`crewbus-hook compact` rehydration, same invocation shape as claude/codex) | 2026-10-25 (vendor docs: features/hooks.md) |
|
|
168
171
|
|
|
169
172
|
## Permission pre-approvals
|
|
170
173
|
|
|
@@ -181,6 +184,7 @@ or unrelated commands/tools.
|
|
|
181
184
|
| claude (Claude Code) | `.claude/settings.json` `permissions.allow` | `mcp__crewbus__*`, `Bash(node *crewbus* *)`, `Bash(crewbus* *)`, `Read(./.crewbus/**)` | everything else (edits, network, other Bash/Read) | verified 2026-10-05 (vendor docs: code.claude.com permissions) |
|
|
182
185
|
| opencode 1.18.x (v1 line) | `opencode.json` project `permission` object | `dm-send: allow`, `bash: {"*crewbus*": allow}`, `read: {"**/.crewbus/**": allow}` (absent keys/patterns only; shorthand strings left alone) | `edit`, `write`, other tools; v2 `permissions` array format not written | verified 2026-10-05 (vendor docs: opencode.ai permissions) |
|
|
183
186
|
| cursor (`cursor-agent`) | `.cursor/permissions.json` | `mcpAllowlist: ["crewbus:*"]`, `terminalAllowlist: ["node:*crewbus*", "crewbus"]` | `autoRun` classifier, in-app terminal allowlist beyond bus commands | verified 2026-10-05 (vendor docs: cursor.com permissions reference) |
|
|
187
|
+
| qwen (Qwen Code) | `.qwen/settings.json` `permissions.allow` | `mcp__crewbus__*`, `Bash(node *crewbus* *)`, `Bash(crewbus* *)`, `Read(./.crewbus/**)` | everything else (edits, network, other Bash/Read) | verified 2026-10-25 (vendor docs: configuration/settings.md) |
|
|
184
188
|
| codex (Codex CLI) | none (project-local) — skipped | nothing (code comment in `applyHarness`) | `approval_policy`, `mcp_servers.*.approval_mode` (TOML user config; project `.codex/config.toml` needs folder trust first). Note: `spawn` injects `-c approval_policy="never"`, `--dangerously-bypass-hook-trust`, and dynamic ephemeral MCP configuration via `-c mcp_servers.crewbus.*` at runtime | verified 2026-10-21 against live Codex CLI 0.163.0 |
|
|
185
189
|
| grok-build (`grok`) | none (project-local JSON) — skipped | nothing (code comment in `applyHarness`) | `[permission]` rules in `.grok/config.toml` (TOML — no zero-dep-safe merge); note grok reads Claude-compat `.claude/settings.json`, covered under `--harness claude` | unverified (vendor docs: docs.x.ai permissions; community config reference) |
|
|
186
190
|
| antigravity (`agy`) | none (project-local) — skipped | nothing (code comment in `applyHarness`) | `permissions.allow` with `mcp(server/*)`, `command(...)` lives in GLOBAL `~/.gemini/antigravity-cli/settings.json`, which init never touches | unverified for project-local (vendor docs: antigravity.google permissions) |
|
package/docs/CONSOLIDATOR.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
One group rarely finishes the job. The consolidator is a reference worker
|
|
4
4
|
that **summarizes one group's findings and hands them to the next group**
|
|
5
|
-
(or the
|
|
5
|
+
(or the orchestrator): a small crew solves the easy slice first, its summary
|
|
6
6
|
seeds the main crews' briefs.
|
|
7
7
|
|
|
8
8
|
## Quick use
|
|
@@ -11,11 +11,11 @@ seeds the main crews' briefs.
|
|
|
11
11
|
# group A works a batch; its replies land threaded on the brief
|
|
12
12
|
batch="<batch-id from the send echo>"
|
|
13
13
|
|
|
14
|
-
# summarize A's transcript, DM it to the
|
|
15
|
-
node examples/consolidator.mjs --from gateway --to
|
|
14
|
+
# summarize A's transcript, DM it to the orchestrator, mirror to the group channel
|
|
15
|
+
node examples/consolidator.mjs --from gateway --to orchestrator --batch "$batch" --group team-a
|
|
16
16
|
|
|
17
|
-
#
|
|
18
|
-
crewbus send --from
|
|
17
|
+
# the orchestrator briefs group B with A's findings attached
|
|
18
|
+
crewbus send --from orchestrator --to-group team-b --subject "variant: build on team-a" --body "<paste summary>"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
What the script does (all via the CLI, token-checked like any agent):
|
|
@@ -24,7 +24,7 @@ What the script does (all via the CLI, token-checked like any agent):
|
|
|
24
24
|
reply, oldest first.
|
|
25
25
|
2. Builds an extractive summary: brief count, reply count, first line of
|
|
26
26
|
each reply, artifact references (`send --artifact`), per-sender counts.
|
|
27
|
-
3. `send --from gateway --to
|
|
27
|
+
3. `send --from gateway --to orchestrator --reply <first-brief> --subject "RESULT: <batch>"`
|
|
28
28
|
— the handoff, threaded so `thread --id` shows the full chain.
|
|
29
29
|
4. `channel post grp-team-a` — mirrors the summary to the group-scoped
|
|
30
30
|
channel, so late joiners and sibling groups can `channel tail` it.
|
|
@@ -107,8 +107,8 @@ Missing: launch wizard, harness picker, pairing UI, route management.
|
|
|
107
107
|
First claim wins (`writeExclusiveJson`); salted `tokenHash+salt`, never
|
|
108
108
|
plaintext; `expiresAt/rotatedAt/service/offboarded`; `revoked/` union
|
|
109
109
|
(copy-if-missing, never undone). Secrets stripped on sync/push/serve/JSON
|
|
110
|
-
output; local secrets always win merges. Roles `{
|
|
111
|
-
(
|
|
110
|
+
output; local secrets always win merges. Roles `{orchestrator, worker}`
|
|
111
|
+
(the board bootstraps one orchestrator; self-registrations are workers); `checkToken()` THEN
|
|
112
112
|
`authorize()` — never merged, never reordered. Leads kill own crew only;
|
|
113
113
|
auditors read-only; `acl {defaultRole, frozen}` per board; `group restrict`
|
|
114
114
|
for private crews.
|
|
@@ -240,7 +240,7 @@ back to loopback silently.
|
|
|
240
240
|
|
|
241
241
|
### 3.4 Pairing (`pairing.json`)
|
|
242
242
|
|
|
243
|
-
`POST /api/pair/issue` (
|
|
243
|
+
`POST /api/pair/issue` (orchestrator) → one-time
|
|
244
244
|
`crewbus://pair?env=<id>&routes=<json>&caps=<…>#<abp-…>` (secret in
|
|
245
245
|
FRAGMENT; QR renders the same). `POST /api/pair/exchange` swaps once for
|
|
246
246
|
`abd-…` with requested scopes ⊆ granted (narrow-only). Devices relay-local,
|
package/docs/CREWS.md
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
# Weighted remote crews
|
|
2
|
-
|
|
3
|
-
One
|
|
4
|
-
worker count in `/healthz`; `crew survey` shows the fleet and
|
|
5
|
-
splits an elastic crew across reachable primaries by weight
|
|
6
|
-
remainder). Standbys and unreachable relays skip loudly — they never
|
|
7
|
-
absorb workers.
|
|
8
|
-
|
|
9
|
-
## Survey the fleet
|
|
10
|
-
|
|
11
|
-
```sh
|
|
12
|
-
crewbus crew survey --relays http://r1:8471,http://r2:8471 [--json]
|
|
13
|
-
# http://r1:8471 role=primary weight=3 workers=2 lagMs=- uptimeSec=400
|
|
14
|
-
# http://r2:8471 role=primary weight=1 workers=0 lagMs=- uptimeSec=390
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Dispatch
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
crewbus crew dispatch --from
|
|
21
|
-
--relays http://r1:8471,http://r2:8471 --weights 3,1 \
|
|
22
|
-
--count 4 --prefix w --harness opencode \
|
|
23
|
-
--body "Triage batch 7…" --secret s3 [--dry-run]
|
|
24
|
-
# dispatched 3/3 to http://r1:8471 [weight 3]
|
|
25
|
-
# w-1 pid 7436 reply msg-…
|
|
26
|
-
# dispatched 1/1 to http://r2:8471 [weight 1]
|
|
27
|
-
# w-4 pid 4668 reply msg-…
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Flags mirror `spawn` (`--harness/--cmd/--cwd/--model/--max-turns/
|
|
31
|
-
--allow-tools/--auto/--subject/--priority/--sender-type/--keep-env/
|
|
32
|
-
--allow-env`, budgets stay local-only). `--
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(`
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- **
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
# Weighted remote crews
|
|
2
|
+
|
|
3
|
+
One orchestrator, many relays. Relays advertise a `--weight` (default 100)
|
|
4
|
+
plus live worker count in `/healthz`; `crew survey` shows the fleet and
|
|
5
|
+
`crew dispatch` splits an elastic crew across reachable primaries by weight
|
|
6
|
+
(largest remainder). Standbys and unreachable relays skip loudly — they never
|
|
7
|
+
silently absorb workers.
|
|
8
|
+
|
|
9
|
+
## Survey the fleet
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
crewbus crew survey --relays http://r1:8471,http://r2:8471 [--json]
|
|
13
|
+
# http://r1:8471 role=primary weight=3 workers=2 lagMs=- uptimeSec=400
|
|
14
|
+
# http://r2:8471 role=primary weight=1 workers=0 lagMs=- uptimeSec=390
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Dispatch
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
crewbus crew dispatch --from orchestrator \
|
|
21
|
+
--relays http://r1:8471,http://r2:8471 --weights 3,1 \
|
|
22
|
+
--count 4 --prefix w --harness opencode \
|
|
23
|
+
--body "Triage batch 7…" --secret s3 [--dry-run]
|
|
24
|
+
# dispatched 3/3 to http://r1:8471 [weight 3]
|
|
25
|
+
# w-1 pid 7436 reply msg-…
|
|
26
|
+
# dispatched 1/1 to http://r2:8471 [weight 1]
|
|
27
|
+
# w-4 pid 4668 reply msg-…
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Flags mirror `spawn` (`--harness/--cmd/--cwd/--model/--max-turns/
|
|
31
|
+
--allow-tools/--auto/--subject/--priority/--sender-type/--keep-env/
|
|
32
|
+
--allow-env`, budgets stay local-only). `--model` also takes a comma list
|
|
33
|
+
(`a,b,c`) cycled in worker order. `--dry-run` prints the shares
|
|
34
|
+
without booting.
|
|
35
|
+
|
|
36
|
+
Remote boots run as each relay board's orchestrator. The relay secret or a
|
|
37
|
+
device credential with `launch:spawn` is the auth boundary; replies land on
|
|
38
|
+
each relay's board — `sync` them back or `gather` per relay.
|
|
39
|
+
|
|
40
|
+
## Credentials per relay
|
|
41
|
+
|
|
42
|
+
Repeat `--relay-auth <url-prefix>=<cred>` for relays that don't share one
|
|
43
|
+
secret (`abd-…` values go out as device credentials, anything else as the
|
|
44
|
+
shared secret; longest prefix wins). Bare `--secret` / `--device` /
|
|
45
|
+
`CREWBUS_*` apply to every relay. Pair each relay first
|
|
46
|
+
(`relay pair`, see `docs/PAIRING.md`) and you never share a secret at all.
|
|
47
|
+
|
|
48
|
+
## Properties
|
|
49
|
+
|
|
50
|
+
- **Weights are preferences, not quotas.** A relay that goes unreachable or
|
|
51
|
+
standby mid-dispatch is skipped; its share is *not* re-dealt (no double
|
|
52
|
+
boot) — the summary shows what landed where, and you re-dispatch the rest.
|
|
53
|
+
- **Standbys never boot.** They refuse writes with 503; dispatch skips them
|
|
54
|
+
loudly rather than queueing into a replica.
|
|
55
|
+
- **Deterministic shares.** Same weights + count always split the same way,
|
|
56
|
+
so `--dry-run` predicts the real run and tests can assert distributions.
|
|
57
|
+
- **Audited both ends.** The caller's board records `crew-dispatch` (relays,
|
|
58
|
+
count, shares); each relay records its own `remote-spawn` audit trail.
|