crewbus 10.0.8 → 10.0.9
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/CHANGELOG.md +12 -0
- package/README.md +41 -8
- package/bin/crewbus.js +249 -23
- package/bin/lib/identity.js +1 -1
- package/bin/lib/mail.js +14 -2
- package/bin/lib/spawn.js +202 -10
- package/bin/lib/store.js +5 -3
- package/bin/lib/workbench.js +188 -0
- package/docs/SPLIT.md +5 -4
- package/docs/VERSION_SKEW.md +1 -1
- package/documentation.html +365 -361
- package/index.html +4 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 10.0.9 (2026-10-17)
|
|
4
|
+
|
|
5
|
+
MINOR RELEASE: Workbench compound-memory layer (artifacts, lessons, needs-by) + opencode respawn capture fix. No board-schema change (`board.json` stays v2); the additive `artifacts/` and `lessons/` directories appear on first write — old boards pick them up lazily, nothing to migrate.
|
|
6
|
+
|
|
7
|
+
- **Artifacts with adoption (L2)**: `crewbus artifact publish|list|show|adopt|verify`. Spent outputs compound instead of dissipating: `publish --path <path-or-url> [--summary ...] [--deps <art-id,art-id>]` records the reference on the board (deps must exist — publish the dependency first); `adopt`/`verify` stamp the artifact object itself (`adoptedBy`/`verifiedBy` entries with ≤200-char notes), so records move *with the thing* as it gets reused across crews and tasks. Dependency records form feed-forward edges (a message consumed by someone other than the producer), so listing artifacts shows what shipped and what downstream crews actually picked up. `verify` rides the existing `ack --verify` execution ground truth — `works` incidents are inadmissible without output.
|
|
8
|
+
- **Lessons paid forward (L3)**: `crewbus lesson post --scope <group-or-task> --text "..."` (≤800 chars; scope missing = `global`) stores one-liners in `lessons/`; later spawn briefs auto-select matching lessons (this board's groups + global, freshest first, ≤8) into a **Workbench block** alongside recent artifacts. A lesson learned once need not be learned again. Selecting, not caching: nothing rides a cache TTL, and lessons can expire by budget, never by staleness (a strong lesson is more load-bearing than a big one).
|
|
9
|
+
- **Handoff deadlines (L4)**: `send`/`spawn` `--needs-by 30m` stamps a handoff deadline on the DM (positive duration) — *if* an unclaimed brief still matters, deadline math makes it a filter rather than a feeling. `crewbus inbox --overdue` lists still-open briefs past deadline (paired shape `--overdue --unacked` = retry-able work; overdue `--checkpoint` progress notes are skipped — they never need ack). `inbox` shows a `needs-by:` line; digests tag late items with `[OVERDUE]`. Workers triage unacknowledged handoffs on awaken instead of re-polling.
|
|
10
|
+
- **Exact-recipient pinning in spawn briefs**: briefs now say "send to EXACTLY `--to <lead>`" — never invent a recipient name like `<worker>-lead` or `lead` — killing the hallucinated-reply-lane failure mode in auto-named crews.
|
|
11
|
+
- **Gather workbench metrics**: the reduce footer adds workbench counters (`-- workbench: 3 artifact(s) referenced, 4 feed-forward edge(s), 1 adopted, 1 verified --`), and JSON includes a `workbench` metric; an empty board prints a unique "no artifacts referenced" additive line so replayed gathers never wrong-foot a reducer.
|
|
12
|
+
- **Respawn session-capture fix (L1 repair)**: opencode spawn boots the real exe with argv verbatim (no `cmd /c` shim — the session id capture line is no longer swallowed by shell buffering); when the log ends up empty, the spawn record falls back to reading the opencode SQLite session DB (`~/.local/share/opencode/opencode.db`, read-only). `crewbus doctor --harness opencode` now checks opencode drift (binary present, `--format json` supported, session DB readable), so `respawn` reliably lands its catch-up brief in the same conversation.
|
|
13
|
+
- New tests: `test/crewbus.workbench.mjs` (33 checks) + `test/crewbus.opencode-respawn.mjs`.
|
|
14
|
+
|
|
3
15
|
## 10.0.8 (2026-10-16)
|
|
4
16
|
|
|
5
17
|
PATCH RELEASE: Launch composer UI refinements & desktop companion. No board-schema change (`board.json` stays v2).
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# crewbus v10.0.
|
|
1
|
+
# crewbus v10.0.9 — DM bus
|
|
2
2
|
|
|
3
3
|
[](https://github.com/eamonpluto/crewbus/actions/workflows/ci.yml)
|
|
4
4
|
|
|
@@ -55,7 +55,7 @@ env overrides below.)
|
|
|
55
55
|
Layout: `board.json`, `agents/<name>.json`, `dm/<recipient>/<id>.json`,
|
|
56
56
|
`delivered/<recipient>/<id>.json` (push markers, written by the plugin).
|
|
57
57
|
|
|
58
|
-
Versions: `package.json` (currently 10.0.
|
|
58
|
+
Versions: `package.json` (currently 10.0.9) is the source of truth for the
|
|
59
59
|
release version. `board.json`'s `version: 2` is the **board schema version**
|
|
60
60
|
(a different number on purpose — do not "align" them). New to the project?
|
|
61
61
|
Start with `docs/QUICKSTART.md` (5 minutes).
|
|
@@ -138,7 +138,9 @@ reply across inboxes — feed it to a reducer agent or aggregate it yourself.
|
|
|
138
138
|
Group management is CLI-only; agents address groups via `--to-group`
|
|
139
139
|
(CLI/spawn), `to_group` (MCP, `dm-send` tool). Unknown groups fail loudly so
|
|
140
140
|
a typo never half-sends. `gather` also prints a telemetry footer
|
|
141
|
-
(msgs, ~tokens as chars/4, contributing groups)
|
|
141
|
+
(msgs, ~tokens as chars/4, contributing groups) plus **workbench
|
|
142
|
+
metrics** — artifacts referenced, feed-forward edges, adopted, verified
|
|
143
|
+
(`--json` adds a `workbench` object).
|
|
142
144
|
|
|
143
145
|
Outcomes are native (replaces the old one-group-per-approach +
|
|
144
146
|
`RESULT:`-subject + verifier-agent + `gather --json` script workaround):
|
|
@@ -312,11 +314,38 @@ it. Leads ack workers' replies, and `spawn status` reports the ack state:
|
|
|
312
314
|
crewbus ack --from ui-lead --id msg-260924-081159-dedcc7 # handled it
|
|
313
315
|
crewbus ack --from ui-lead --all # inbox zero
|
|
314
316
|
crewbus ack --from ui-lead --id <reply> --verify "node test/check.mjs" # verifier hook: exit 0 acks+stores verified:true, else no ack (docs/VERIFIER.md)
|
|
315
|
-
crewbus send --from w1 --to ui-lead --reply <brief> --artifact out/w1.json --body "done" #
|
|
316
|
-
crewbus inbox --from ui-lead --unacked
|
|
317
|
+
crewbus send --from w1 --to ui-lead --reply <brief> --artifact out/w1.json --needs-by 2h --body "done" # artifact + handoff deadline
|
|
318
|
+
crewbus inbox --from ui-lead --unacked --overdue # still-open briefs past --needs-by ([OVERDUE] in digests)
|
|
317
319
|
crewbus thread --id msg-260924-081159-dedcc7 # brief + all replies, across inboxes
|
|
318
320
|
```
|
|
319
321
|
|
|
322
|
+
## Workbench (output that compounds)
|
|
323
|
+
|
|
324
|
+
`artifact publish|list|show|adopt|verify` keeps spent output load-bearing
|
|
325
|
+
for teammates: artifacts are board objects (a `--path` reference + summary
|
|
326
|
+
+ deps edges, never inline data) with adoption and verification recorded
|
|
327
|
+
*on the object*, so the next crew starts where this one ended. `lesson
|
|
328
|
+
post|list` stores scoped one-liners that later spawn briefs auto-select
|
|
329
|
+
into a **Workbench block** (this board's groups + global scope, freshest
|
|
330
|
+
first, both bounded) — a lesson learned once need not be learned again:
|
|
331
|
+
|
|
332
|
+
```powershell
|
|
333
|
+
crewbus artifact publish --from alice --path out/parser.md --summary "40ms parse table" --deps <art-id> # deps must exist; publish upstream first
|
|
334
|
+
crewbus artifact list --from bob # what exists, with adoption/verification state
|
|
335
|
+
crewbus artifact adopt --from bob --id <art-id> --note "wired into prefetch" # records move with the thing
|
|
336
|
+
crewbus lesson post --from alice --scope ui-crew --text "Windows spawns need a real workdir root, not a drive-relative path."
|
|
337
|
+
crewbus gather --batch <batch-id> # footer adds: N artifact(s) referenced, N feed-forward edge(s), N adopted, N verified
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
`verify` pairs with the verifier hook — checker-verified claims only; a
|
|
341
|
+
bare "works" incident with no captured output is inadmissible (see
|
|
342
|
+
`docs/VERIFIER.md`). Feed-forward edges (a downstream agent consumed an
|
|
343
|
+
artifact its producer did not post) make cross-crew reuse auditable.
|
|
344
|
+
Handoff deadlines (`send`/`spawn --needs-by 30m`) turn stale unclaimed
|
|
345
|
+
briefs into a filter instead of a feeling: `inbox --overdue` (often
|
|
346
|
+
paired with `--unacked`) lists the retry-able set, `needs-by:` shows on
|
|
347
|
+
message reads, and digests tag late items `[OVERDUE]`.
|
|
348
|
+
|
|
320
349
|
## Fanning work out (the DM *is* the task)
|
|
321
350
|
|
|
322
351
|
There is deliberately no task object. To "assign N agents", broadcast one
|
|
@@ -389,7 +418,11 @@ counted — `--max-spawn N` overrides it when you have the compute.
|
|
|
389
418
|
|
|
390
419
|
Caps at 20 workers/call by default (`--max-spawn N` overrides — a whole harness each, so budget it like compute); bigger crews
|
|
391
420
|
get a broadcast DM for live agents to pick up. `--to @all` is refused
|
|
392
|
-
(membership is dynamic).
|
|
421
|
+
(membership is dynamic). Every spawned brief carries a **Workbench block**
|
|
422
|
+
(board lessons matching the crew's scopes + recent artifacts, both
|
|
423
|
+
bounded) and pins the reply lane to the literal `--to <lead>` so
|
|
424
|
+
auto-named workers never invent recipient names. Children run with your
|
|
425
|
+
user privileges — same trust
|
|
393
426
|
boundary as hooks. Detached children can't answer permission prompts, hence
|
|
394
427
|
the defaults above; `--auto` means each harness's fully-unattended mode
|
|
395
428
|
(dangerous — isolated runners only).
|
|
@@ -657,7 +690,7 @@ primaries by weight (`serve --weight`, `crew survey`, `crew dispatch`
|
|
|
657
690
|
## Publishing (maintainer)
|
|
658
691
|
|
|
659
692
|
```powershell
|
|
660
|
-
npm test #
|
|
693
|
+
npm test # 24 suites (smoke + harness + opencode-respawn + compact + tokenfile + digest + workbench + control-plane + launch + pair-api + web-launch + web-panel + web-approot + client-runtime + runtime-wiring + desktop-sidecar + mobile-client + holds-quotas + grok-hooks + approval-protocol + approvals-init + approvals-web + fault-injection + integration), all must pass
|
|
661
694
|
npm publish # ships bin/ + opencode/ + docs (see "files" in package.json)
|
|
662
695
|
```
|
|
663
696
|
|
|
@@ -668,7 +701,7 @@ and verify with `npm test`. `init` prefers the repo files when run from a
|
|
|
668
701
|
checkout, so the embed only matters for `npm i -g` installs.
|
|
669
702
|
|
|
670
703
|
Code layout: `bin/crewbus.js` is a dispatcher + `cmd*` wrappers; domain
|
|
671
|
-
logic lives in `bin/lib/` (
|
|
704
|
+
logic lives in `bin/lib/` (13 modules). See `docs/SPLIT.md` for the module
|
|
672
705
|
map, dependency rules, and how to add a command.
|
|
673
706
|
|
|
674
707
|
After publishing, projects can skip the checkout entirely:
|
package/bin/crewbus.js
CHANGED
|
@@ -46,10 +46,11 @@ import { VALID_ROLES, agentTokenMatches, assertMintWon, authorize, authorizeChec
|
|
|
46
46
|
import { saveTokenFile } from "./lib/tokenfile.js";
|
|
47
47
|
import { CLIENT_TLS, SYNC_LWW, cleanSyncRel, clientInsecureFromArgs, crewSurvey, httpJson, readPemFlag, readSyncState, readTombstones, relayAuthEntries, relayCredFor, relayCredHeaders, setupClientTls, splitByWeight, syncRound, syncWalk, warnInsecureOnce, writeSyncState, writeTombstone, SYNC_SUBS, SYNC_UNION, RELAY_CAPS, SUB_CAP, SUB_CAP_NOTE, tombstoneIdForRel, readSyncDoc } from "./lib/sync.js";
|
|
48
48
|
import { devicePath, isLoopbackHost, newDeviceCred, newPairToken, pairingPath, parseDeviceCred, readDevice, readRelayState, relaySecretFromArgs, remoteSpawn, requireRelayClientCert, requireRelaySecret, requireScope, tryAcquireFence, verifyOidcJwt, writeRelayState, relayStatePath, bearerFromReq, getOidcConfig, getOidcJwks, b64urlDecode, b64urlJson, jwsRawToDer, oidcGetJson, OIDC_SKEW_SEC, OIDC_JWKS_TTL_MS, OIDC_ALG_HASH, OIDC_EC_SIZE, deviceFromReq } from "./lib/relay.js";
|
|
49
|
-
import { assertGitCheckout, bootRespawnedWorker, bootWorker, buildCrewContext, buildRespawnBrief, buildRespawnTarget, buildSpawnPrompt, buildSpawnTarget, formatSpawnCmd, isPidStale, killWorkers, maybeIsolate, parseAllowEnv, pidAlive, provisionBranch, provisionWorktree, readWorkerSession, requireAutoConfirm, sandboxPresent, scrubChildEnv, syncWorkerSession, workerStatus, worktreeStamp, defaultMaxTurnsFor, ensureBoardCliShim, installCliToUserPath } from "./lib/spawn.js";
|
|
49
|
+
import { assertGitCheckout, bootRespawnedWorker, bootWorker, buildCrewContext, buildRespawnBrief, buildRespawnTarget, buildSpawnPrompt, buildSpawnTarget, formatSpawnCmd, isPidStale, killWorkers, maybeIsolate, opencodeStorageStatus, parseAllowEnv, pidAlive, provisionBranch, provisionWorktree, readWorkerSession, requireAutoConfirm, resolveOpencodeExe, sandboxPresent, scrubChildEnv, syncWorkerSession, workerStatus, worktreeStamp, defaultMaxTurnsFor, ensureBoardCliShim, installCliToUserPath } from "./lib/spawn.js";
|
|
50
50
|
import { appendChainRecord, auditHmacKey, boardTotalBytes, chainFilePath, countChannels, dirSize, doExportToFile, enforceAgentQuota, enforceBytesQuota, enforceChannelQuota, holdActive, holdDocPath, holdRefusal, parseQuotaBytes, parseQuotaCount, readBackupInner, readBoardQuotas, readChainRecords, readHold, readSnapshotSchedule, resolveBackupKeyMaterial, setAuditForward, snapshotStamp, startAuditForwarder, verifyChainRecords, collectBoardFiles, encryptBackupPayload, decryptBackupPayload, rawKeyFromMaterial, deriveBackupKey, toAuditExport, spoolAuditEvent, postAuditEvent, auditSpoolDir, drainAuditSpool, enqueueAuditForward, signAuditRecord, chainRecordHash, AUDIT_FORWARD_URL, AUDIT_FORWARD_KEY } from "./lib/export.js";
|
|
51
51
|
import { ackedIds, checkSendRateLimit, deliverDMs, enforceMaxChars, filterDigest, findDuplicateSend, findMessageById, heartbeat, isVerified, loadManifest, manifestPath, msgTimeMs, parseRecipients, printDigest, printMsg, readDMs, readVisible, recordBroadcastManifest, requireFanoutConfirm, resolveFwdDepth, runVerifier, verifyMessageSig, isHigh, signMessage, untrustedEnvelope, relTime, rateFilePath, broadcastTargets, readBroadcastsFor, formatTo, msgHeader, readAckMarker, splitCommand, readRecipientsFile } from "./lib/mail.js";
|
|
52
52
|
import { batchReplyIds, collectBatch, contributingGroups, expandGroups, expandGroupsOrFail, gatherTelemetry, groupTelemetryData, heuristicSenderType, readGroup, ensureGroupCreatedAt, readResultRecord, writeResultRecord, findFirstVerifiedReply } from "./lib/groups.js";
|
|
53
|
+
import { publishArtifact, adoptArtifact, verifyArtifact, readArtifactById, listArtifacts, listLessons, postLesson, selectLessons, renderWorkbenchBlock, workbenchMetrics, cleanArtifactId, cleanLessonScope, parseArtifactDeps } from "./lib/workbench.js";
|
|
53
54
|
import { appendChannelPost, channelLogPath, groupChannelName, lockAlive, lockPath, mergeChannelText, mirrorToGroupChannels, printChannelPost, readChannelPosts, readLock, summarizePosts, writeChannelCursor, SUMMARY_STOP, channelCursorPath, readChannelCursor, lockHash, acquireLockDoc, releaseLockDoc, tailChannelPosts, listLocks, parseChannelText } from "./lib/channels.js";
|
|
54
55
|
import { boardSnapshot, cmdWeb, escapeHtml, fleetSnapshot, channelsSnapshot, resultsSnapshot, auditSnapshot, handleApiAck, renderBoardHtml, handleApiKill, handleApiLaunch, handleWebDashboardRoute } from "./lib/web.js";
|
|
55
56
|
import { LAUNCH_DRIVER_FALLBACK, PAIR_SCOPES, advertiseEnv, buildPairUrl, detectHarnessBinaries, formatHarnessMenu, isBodyFileRef, launchDrivers, parseCountChoice, parseHarnessChoice, parsePermissionChoice, parseYesNo, probeBinary, validateLaunchPlan, HARNESS_MODELS, getDiscoveredModels, refreshDiscoveredModels } from "./lib/launch.js";
|
|
@@ -2720,6 +2721,15 @@ function cmdSend(args) {
|
|
|
2720
2721
|
const priority = cleanPriority(getFlag(args, "--priority"));
|
|
2721
2722
|
const checkpoint = args.includes("--checkpoint");
|
|
2722
2723
|
const alsoChannel = args.includes("--also-channel");
|
|
2724
|
+
// Needs-by (L4 handoff): a deadline the sender stamps on the DM, so a
|
|
2725
|
+
// blocked peer can triage with inbox --overdue instead of re-polling.
|
|
2726
|
+
const needsByRaw = getFlag(args, "--needs-by");
|
|
2727
|
+
let needsBy;
|
|
2728
|
+
if (needsByRaw !== undefined) {
|
|
2729
|
+
const ms = parseDuration(needsByRaw);
|
|
2730
|
+
if (!(ms > 0)) fail("--needs-by must be a positive duration (e.g. 30m, 2h)");
|
|
2731
|
+
needsBy = new Date(Date.now() + ms).toISOString();
|
|
2732
|
+
}
|
|
2723
2733
|
const toGroupRaw = getFlag(args, "--to-group");
|
|
2724
2734
|
if (alsoChannel && (!toGroupRaw || !String(toGroupRaw).trim())) fail("--also-channel needs --to-group <g,...> (it mirrors the brief into each group's channel)");
|
|
2725
2735
|
const groupNames = String(toGroupRaw || "").split(",").map((s) => String(s).trim().toLowerCase().replace(/[^a-z0-9_.-]/g, "-").slice(0, 40)).filter(Boolean);
|
|
@@ -2752,7 +2762,7 @@ function cmdSend(args) {
|
|
|
2752
2762
|
const rev = gitRevForBoard(root);
|
|
2753
2763
|
const at = new Date().toISOString();
|
|
2754
2764
|
const forceBroadcast = args.includes("--broadcast");
|
|
2755
|
-
const res = deliverDMs(d, { from, recipients, body: body.trim(), subject, replyTo, artifact, priority, checkpoint, senderType, fwd, rev, at, forceBroadcast });
|
|
2765
|
+
const res = deliverDMs(d, { from, recipients, body: body.trim(), subject, replyTo, artifact, priority, checkpoint, senderType, fwd, rev, at, forceBroadcast, needsBy });
|
|
2756
2766
|
appendChainRecord(d, from, "send", { to: recipients.slice(0, 20), count: recipients.length, batch: res.batch });
|
|
2757
2767
|
const mirrored = alsoChannel
|
|
2758
2768
|
? mirrorToGroupChannels(d, { groups: groupNames, from, body: body.trim(), subject, replyTo, batch: res.batch || (res.items[0] && res.items[0].id), priority, rev, at })
|
|
@@ -2921,6 +2931,24 @@ function cmdSpawn(args) {
|
|
|
2921
2931
|
if (!(ms > 0)) fail("--timeout must be a positive duration (e.g. 10m)");
|
|
2922
2932
|
deadlineAt = new Date(Date.now() + ms).toISOString();
|
|
2923
2933
|
}
|
|
2934
|
+
// Needs-by (L4 handoff): deadline stamped on the brief DMs, so leads can
|
|
2935
|
+
// spot unclaimed/overdue briefs with inbox --overdue --unacked.
|
|
2936
|
+
const needsByRaw = getFlag(args, "--needs-by");
|
|
2937
|
+
let needsBy;
|
|
2938
|
+
if (needsByRaw !== undefined) {
|
|
2939
|
+
const ms = parseDuration(needsByRaw);
|
|
2940
|
+
if (!(ms > 0)) fail("--needs-by must be a positive duration (e.g. 30m, 2h)");
|
|
2941
|
+
needsBy = new Date(Date.now() + ms).toISOString();
|
|
2942
|
+
}
|
|
2943
|
+
// Workbench (L2/L3): lessons scoped to this spawn's groups (+global) and
|
|
2944
|
+
// the newest board artifacts, rendered once per worker so the brief
|
|
2945
|
+
// carries prior output instead of re-deriving it.
|
|
2946
|
+
const wbFor = (to) =>
|
|
2947
|
+
renderWorkbenchBlock({
|
|
2948
|
+
lessons: selectLessons(d, { scopes: groupNames, limit: 8 }),
|
|
2949
|
+
artifacts: listArtifacts(d, { limit: 6 }),
|
|
2950
|
+
me: to,
|
|
2951
|
+
});
|
|
2924
2952
|
const isolateInfo = maybeIsolate(args, d.root);
|
|
2925
2953
|
if ((worktreePrefix !== undefined || branchPrefix !== undefined) && !dry) assertGitCheckout(cwd);
|
|
2926
2954
|
const minted = ensureSender(d, from, resolveToken(args));
|
|
@@ -2939,17 +2967,17 @@ function cmdSpawn(args) {
|
|
|
2939
2967
|
const driver = harnesses[i % harnesses.length];
|
|
2940
2968
|
const itemMaxTurns = maxTurnsNum !== undefined ? maxTurnsNum : ((driver === "claude" || driver === "grok") ? 50 : undefined);
|
|
2941
2969
|
const itemSpawnOpts = { ...spawnOpts, harness: driver, maxTurns: itemMaxTurns, allowTools: driver === "claude" ? allowTools : undefined };
|
|
2942
|
-
const previewPrompt = buildSpawnPrompt({ name: to, from, subject, body: body.trim(), replyId: previewBatch || "msg-<id>", rev, cwd, root, crew: crewFor(to) });
|
|
2970
|
+
const previewPrompt = buildSpawnPrompt({ name: to, from, subject, body: body.trim(), replyId: previewBatch || "msg-<id>", rev, cwd, root, crew: crewFor(to), workbench: wbFor(to) });
|
|
2943
2971
|
const t = buildSpawnTarget({ ...itemSpawnOpts, name: to, promptPath: `<logs>/${to}-<stamp>.prompt.md`, prompt: previewPrompt });
|
|
2944
2972
|
const wtNote = worktreePrefix !== undefined ? ` worktree ../${to}-<stamp> (branch ${worktreePrefix}/${to}-<stamp>)` : branchPrefix !== undefined ? ` branch ${branchPrefix}/${to}-<stamp>` : "";
|
|
2945
2973
|
console.log(`would spawn ${to} [${driver}] (${lifetime}) cwd ${cwd}${wtNote} cmd: ${formatSpawnCmd(t)} [board ${d.root}]`);
|
|
2946
2974
|
});
|
|
2947
|
-
console.log(`--- prompt (first worker) ---\n${buildSpawnPrompt({ name: recipients[0], from, subject, body: body.trim(), replyId: previewBatch || "msg-<id>", rev, cwd, root, crew: crewFor(recipients[0]) })}`);
|
|
2975
|
+
console.log(`--- prompt (first worker) ---\n${buildSpawnPrompt({ name: recipients[0], from, subject, body: body.trim(), replyId: previewBatch || "msg-<id>", rev, cwd, root, crew: crewFor(recipients[0]), workbench: wbFor(recipients[0]) })}`);
|
|
2948
2976
|
return;
|
|
2949
2977
|
}
|
|
2950
2978
|
// Direct (N-copy) path is forced here (every worker needs its own message
|
|
2951
2979
|
// id to thread the reply against) — --broadcast is not accepted by spawn.
|
|
2952
|
-
const res = deliverDMs(d, { from, recipients, body: body.trim(), subject, replyTo, priority, senderType, fwd, rev, at, forceBroadcast: false, forceDirect: true });
|
|
2980
|
+
const res = deliverDMs(d, { from, recipients, body: body.trim(), subject, replyTo, priority, senderType, fwd, rev, at, forceBroadcast: false, forceDirect: true, needsBy });
|
|
2953
2981
|
if (res.mode !== "direct") fail("spawn: internal error — expected direct delivery");
|
|
2954
2982
|
appendChainRecord(d, from, "spawn", { to: recipients.slice(), harness, harnesses, auto, cwd, isolate: isolateInfo.isolated || false, budgetTokens, budgetMinutes, deadlineAt });
|
|
2955
2983
|
if (alsoChannel) {
|
|
@@ -2978,7 +3006,7 @@ function cmdSpawn(args) {
|
|
|
2978
3006
|
} else if (branchPrefix !== undefined) {
|
|
2979
3007
|
workerBranch = provisionBranch(cwd, branchPrefix, to).branch;
|
|
2980
3008
|
}
|
|
2981
|
-
const r = bootWorker(d, { ...itemSpawnOpts, cwd: workerCwd }, { to, id, from, subject, body: body.trim(), rev, logDir, budgetTokens, budgetMinutes, deadlineAt, spawnedWorktree: workerWorktree, spawnedBranch: workerBranch, spawnedLifetime: lifetime, crew: crewFor(to) });
|
|
3009
|
+
const r = bootWorker(d, { ...itemSpawnOpts, cwd: workerCwd }, { to, id, from, subject, body: body.trim(), rev, logDir, budgetTokens, budgetMinutes, deadlineAt, spawnedWorktree: workerWorktree, spawnedBranch: workerBranch, spawnedLifetime: lifetime, crew: crewFor(to), workbench: wbFor(to) });
|
|
2982
3010
|
const where = workerWorktree ? ` worktree ${workerWorktree}` : workerBranch ? ` branch ${workerBranch}` : "";
|
|
2983
3011
|
console.log(`spawned ${to} pid ${r.pid} [${driver}] (${lifetime}) log ${r.logPath} reply ${id}${where} [board ${d.root}]`);
|
|
2984
3012
|
} catch (e) {
|
|
@@ -3302,6 +3330,10 @@ async function cmdRespawn(args) {
|
|
|
3302
3330
|
const name = names[0];
|
|
3303
3331
|
const force = args.includes("--force");
|
|
3304
3332
|
const dry = args.includes("--dry-run");
|
|
3333
|
+
// --fresh: when the harness session id was never captured (opencode kills
|
|
3334
|
+
// its buffered output before the log scan can read it), skip the resume
|
|
3335
|
+
// requirement and boot the catch-up brief fresh — same as the generic path.
|
|
3336
|
+
const fresh = args.includes("--fresh");
|
|
3305
3337
|
const extraBody = getFlag(args, "--body");
|
|
3306
3338
|
if (extraBody !== undefined && String(extraBody).length > MAX_BODY_CHARS) fail(`message body too large (max ${MAX_BODY_CHARS} chars)`);
|
|
3307
3339
|
const minted = ensureSender(d, from, resolveToken(args));
|
|
@@ -3317,7 +3349,7 @@ async function cmdRespawn(args) {
|
|
|
3317
3349
|
const harness = prev.harness;
|
|
3318
3350
|
if (!harness) fail(`no harness recorded for "${name}" (spawned before session capture — re-boot fresh with spawn --to ${name})`);
|
|
3319
3351
|
const sessionId = prev.harnessSessionId;
|
|
3320
|
-
if (!sessionId && harness !== "generic") fail(`no harness session id recorded for "${name}"${prev.idSource ? ` (source: ${prev.idSource})` : ""} — its conversation can't be resumed; re-brief with send --reply ${prev.briefId || "<brief-id>"} or spawn a fresh worker`);
|
|
3352
|
+
if (!sessionId && harness !== "generic" && !fresh) fail(`no harness session id recorded for "${name}"${prev.idSource ? ` (source: ${prev.idSource})` : ""} — its conversation can't be resumed; re-brief with send --reply ${prev.briefId || "<brief-id>"}, respawn with --fresh to reboot it without the old conversation, or spawn a fresh worker`);
|
|
3321
3353
|
if ((prev.auto || false) && !args.includes("--auto")) fail(`worker "${name}" was spawned --auto (fully-unattended) — pass --auto to confirm the respawn carries the same danger (see docs/ISOLATION.md)`);
|
|
3322
3354
|
if (args.includes("--auto")) requireAutoConfirm(args);
|
|
3323
3355
|
if (!prev.promptPath) fail(`no original prompt on record for "${name}" (spawned before prompt capture — re-boot fresh with spawn --to ${name})`);
|
|
@@ -3501,13 +3533,136 @@ function cmdGather(args) {
|
|
|
3501
3533
|
if (!res) fail(`unknown batch "${batch}" (check send echoes / inbox batch lines)`);
|
|
3502
3534
|
const groups = contributingGroups(d, res.items);
|
|
3503
3535
|
const tele = gatherTelemetry(res.items);
|
|
3536
|
+
// Workbench metrics: did any downstream message consume an upstream
|
|
3537
|
+
// artifact (feed-forward edge), and how much of it held up (adopted/
|
|
3538
|
+
// verified). This is the multiplicative-discovery measure — additive
|
|
3539
|
+
// crews score 0 across the board.
|
|
3540
|
+
const wb = workbenchMetrics(res.items, (id) => readArtifactById(d, id));
|
|
3504
3541
|
if (json) {
|
|
3505
|
-
console.log(JSON.stringify({ ...res, contributingGroups: groups, telemetry: tele }, null, 2));
|
|
3542
|
+
console.log(JSON.stringify({ ...res, contributingGroups: groups, telemetry: tele, workbench: wb }, null, 2));
|
|
3506
3543
|
return;
|
|
3507
3544
|
}
|
|
3508
3545
|
console.log(`batch ${batch}: ${res.briefs} brief(s), ${res.replies} replies [board ${d.root}]\n`);
|
|
3509
3546
|
for (const m of res.items) printMsg(m, true, false);
|
|
3510
3547
|
console.log(`-- telemetry: ${tele.messages} msgs, ~${tele.tokensEst} tokens (chars/4), contributing groups: ${groups.join(",") || "none"} --`);
|
|
3548
|
+
if (wb.artifactRefs > 0) {
|
|
3549
|
+
console.log(`-- workbench: ${wb.artifactRefs} artifact(s) referenced, ${wb.feedForward} feed-forward edge(s), ${wb.adopted} adopted, ${wb.verified} verified --`);
|
|
3550
|
+
} else {
|
|
3551
|
+
console.log(`-- workbench: no artifacts referenced (additive shape; publish with: crewbus artifact publish --path <p>) --`);
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
// artifact: board objects for worker output that should outlive the DM
|
|
3556
|
+
// thread (L2). publish|list|show|adopt|verify — adoption + verification
|
|
3557
|
+
// land ON the object, so a later crew can see what was reused and what
|
|
3558
|
+
// held up instead of re-deriving it from prose.
|
|
3559
|
+
function cmdArtifact(args) {
|
|
3560
|
+
const root = boardDir(args);
|
|
3561
|
+
refuseDriveRootBoard(root, args);
|
|
3562
|
+
const d = requireBoard(root);
|
|
3563
|
+
const json = args.includes("--json");
|
|
3564
|
+
const sub = String(args[0] || "").toLowerCase();
|
|
3565
|
+
const rest = args.slice(1);
|
|
3566
|
+
const token = resolveToken(rest);
|
|
3567
|
+
const ensureWriter = () => {
|
|
3568
|
+
const from = resolveAgent(rest, "sender");
|
|
3569
|
+
ensureSender(d, from, token);
|
|
3570
|
+
authorize(d, from, "artifact-write", {});
|
|
3571
|
+
return from;
|
|
3572
|
+
};
|
|
3573
|
+
if (sub === "publish") {
|
|
3574
|
+
const from = ensureWriter();
|
|
3575
|
+
const deps = parseArtifactDeps(getFlag(rest, "--deps"));
|
|
3576
|
+
const doc = publishArtifact(d, { from, ref: getFlag(rest, "--path"), summary: getFlag(rest, "--summary"), deps, at: new Date().toISOString() });
|
|
3577
|
+
appendChainRecord(d, from, "artifact-publish", { id: doc.id });
|
|
3578
|
+
console.log(`published artifact ${doc.id} (${doc.path})${doc.deps.length ? ` deps: ${doc.deps.join(",")}` : ""} [board ${d.root}]`);
|
|
3579
|
+
return;
|
|
3580
|
+
}
|
|
3581
|
+
if (sub === "adopt" || sub === "verify") {
|
|
3582
|
+
const from = ensureWriter();
|
|
3583
|
+
const id = cleanArtifactId(getFlag(rest, "--id"));
|
|
3584
|
+
const at = new Date().toISOString();
|
|
3585
|
+
const note = getFlag(rest, "--note");
|
|
3586
|
+
const doc = sub === "adopt" ? adoptArtifact(d, { id, from, at, note }) : verifyArtifact(d, { id, from, at, note });
|
|
3587
|
+
appendChainRecord(d, from, sub === "adopt" ? "artifact-adopt" : "artifact-verify", { id });
|
|
3588
|
+
const n = sub === "adopt" ? doc.adoptedBy.length : doc.verifiedBy.length;
|
|
3589
|
+
console.log(`${sub === "adopt" ? "adopted" : "verified"} ${id} by ${from} (${n} total) [board ${d.root}]`);
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
if (sub === "show") {
|
|
3593
|
+
const id = cleanArtifactId(getFlag(rest, "--id"));
|
|
3594
|
+
const a = readArtifactById(d, id);
|
|
3595
|
+
if (!a) fail(`unknown artifact ${id} [board ${d.root}]`);
|
|
3596
|
+
if (json) {
|
|
3597
|
+
console.log(JSON.stringify(a, null, 2));
|
|
3598
|
+
return;
|
|
3599
|
+
}
|
|
3600
|
+
console.log(`artifact ${a.id}`);
|
|
3601
|
+
console.log(` path: ${a.path}`);
|
|
3602
|
+
if (a.summary) console.log(` summary: ${a.summary}`);
|
|
3603
|
+
console.log(` producer: ${a.from} @ ${a.at}`);
|
|
3604
|
+
if (a.deps.length) console.log(` deps: ${a.deps.join(", ")}`);
|
|
3605
|
+
console.log(` adopted by: ${a.adoptedBy.map((e) => e.by).join(", ") || "(nobody)"}`);
|
|
3606
|
+
console.log(` verified by: ${a.verifiedBy.map((e) => e.by).join(", ") || "(nobody)"}`);
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
if (sub === "list" || sub === "") {
|
|
3610
|
+
const all = listArtifacts(d);
|
|
3611
|
+
if (json) {
|
|
3612
|
+
console.log(JSON.stringify(all, null, 2));
|
|
3613
|
+
return;
|
|
3614
|
+
}
|
|
3615
|
+
if (all.length === 0) {
|
|
3616
|
+
console.log(`no artifacts [board ${d.root}]`);
|
|
3617
|
+
return;
|
|
3618
|
+
}
|
|
3619
|
+
for (const a of all) {
|
|
3620
|
+
const state = [];
|
|
3621
|
+
if (a.adoptedBy.length) state.push(`adopted x${a.adoptedBy.length}`);
|
|
3622
|
+
if (a.verifiedBy.length) state.push("verified");
|
|
3623
|
+
console.log(`${a.id} ${a.path}${state.length ? ` (${state.join(", ")})` : ""}`);
|
|
3624
|
+
}
|
|
3625
|
+
return;
|
|
3626
|
+
}
|
|
3627
|
+
fail(`unknown artifact subcommand "${sub}" (want publish|list|show|adopt|verify)`);
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
// lesson: one-or-two-line learnings scoped to a group/task; post|list.
|
|
3631
|
+
// New spawn briefs with a matching scope (or global) auto-inject the
|
|
3632
|
+
// latest lessons, so a lesson learned once is paid forward (L3).
|
|
3633
|
+
function cmdLesson(args) {
|
|
3634
|
+
const root = boardDir(args);
|
|
3635
|
+
refuseDriveRootBoard(root, args);
|
|
3636
|
+
const d = requireBoard(root);
|
|
3637
|
+
const json = args.includes("--json");
|
|
3638
|
+
const sub = String(args[0] || "").toLowerCase();
|
|
3639
|
+
const rest = args.slice(1);
|
|
3640
|
+
const token = resolveToken(rest);
|
|
3641
|
+
if (sub === "post") {
|
|
3642
|
+
const from = resolveAgent(rest, "sender");
|
|
3643
|
+
ensureSender(d, from, token);
|
|
3644
|
+
authorize(d, from, "lesson-write", {});
|
|
3645
|
+
const doc = postLesson(d, { from, scope: getFlag(rest, "--scope"), text: getFlag(rest, "--text"), at: new Date().toISOString() });
|
|
3646
|
+
appendChainRecord(d, from, "lesson-post", { id: doc.id, scope: doc.scope });
|
|
3647
|
+
console.log(`lesson ${doc.id} [${doc.scope}] (later spawns in scope ${doc.scope} get it injected) [board ${d.root}]`);
|
|
3648
|
+
return;
|
|
3649
|
+
}
|
|
3650
|
+
if (sub === "list" || sub === "") {
|
|
3651
|
+
const scopeRaw = getFlag(args, "--scope");
|
|
3652
|
+
const scope = scopeRaw !== undefined ? cleanLessonScope(scopeRaw) : undefined;
|
|
3653
|
+
const items = listLessons(d, { scope });
|
|
3654
|
+
if (json) {
|
|
3655
|
+
console.log(JSON.stringify(items, null, 2));
|
|
3656
|
+
return;
|
|
3657
|
+
}
|
|
3658
|
+
if (items.length === 0) {
|
|
3659
|
+
console.log(`no lessons${scope ? ` scoped ${scope}` : ""} [board ${d.root}]`);
|
|
3660
|
+
return;
|
|
3661
|
+
}
|
|
3662
|
+
for (const l of items) console.log(`${l.id} [${l.scope}] ${l.text}`);
|
|
3663
|
+
return;
|
|
3664
|
+
}
|
|
3665
|
+
fail(`unknown lesson subcommand "${sub}" (want post|list)`);
|
|
3511
3666
|
}
|
|
3512
3667
|
|
|
3513
3668
|
function cmdInbox(args) {
|
|
@@ -3520,6 +3675,7 @@ function cmdInbox(args) {
|
|
|
3520
3675
|
const json = args.includes("--json");
|
|
3521
3676
|
let items;
|
|
3522
3677
|
let showTo = false;
|
|
3678
|
+
let acked = null;
|
|
3523
3679
|
if (showAll) {
|
|
3524
3680
|
items = [];
|
|
3525
3681
|
let subs = [];
|
|
@@ -3554,7 +3710,7 @@ function cmdInbox(args) {
|
|
|
3554
3710
|
authorize(d, agent, "inbox"); // reads allow all roles (auditor read-ok)
|
|
3555
3711
|
heartbeat(d, agent, 0); // reading your mail proves you're alive
|
|
3556
3712
|
items = readVisible(d, agent);
|
|
3557
|
-
|
|
3713
|
+
acked = ackedIds(d, agent);
|
|
3558
3714
|
if (json) {
|
|
3559
3715
|
items = items.map((m) => (acked.has(m.id) ? { ...m, acked: true } : m));
|
|
3560
3716
|
}
|
|
@@ -3563,6 +3719,12 @@ function cmdInbox(args) {
|
|
|
3563
3719
|
items = items.filter((m) => !acked.has(m.id) && m.checkpoint !== true);
|
|
3564
3720
|
}
|
|
3565
3721
|
}
|
|
3722
|
+
// Overdue triage (L4): messages whose --needs-by deadline passed and that
|
|
3723
|
+
// are still open work (not acked, not checkpoints). In --all mode there is
|
|
3724
|
+
// no ack state to consult — deadline alone decides.
|
|
3725
|
+
if (args.includes("--overdue")) {
|
|
3726
|
+
items = items.filter((m) => m.checkpoint !== true && (m.needsBy && !Number.isNaN(Date.parse(m.needsBy)) && Date.parse(m.needsBy) < Date.now()) && (showAll || !acked.has(m.id)));
|
|
3727
|
+
}
|
|
3566
3728
|
if (after) {
|
|
3567
3729
|
const idx = items.findIndex((m) => m.id === after);
|
|
3568
3730
|
if (idx !== -1) items = items.slice(idx + 1);
|
|
@@ -4331,6 +4493,7 @@ function cmdDoctor(args) {
|
|
|
4331
4493
|
console.log(`FAIL ${label}${hint ? ` — ${hint}` : ""}`);
|
|
4332
4494
|
};
|
|
4333
4495
|
const info = (label) => console.log(`info ${label}`);
|
|
4496
|
+
const warn = (label) => console.log(`warn ${label}`);
|
|
4334
4497
|
|
|
4335
4498
|
const nodeMajor = Number(String(process.version).replace(/^v/, "").split(".")[0]);
|
|
4336
4499
|
if (nodeMajor >= 18) ok(`node ${process.version} (>= 18)`);
|
|
@@ -4424,6 +4587,41 @@ function cmdDoctor(args) {
|
|
|
4424
4587
|
else no("opencode tool .opencode/tools/dm-send.js", "run: crewbus init --harness opencode (then restart opencode)");
|
|
4425
4588
|
if (fs.existsSync(path.join(cwd, ".opencode", "plugins", "dm-watch.js"))) ok("opencode plugin .opencode/plugins/dm-watch.js");
|
|
4426
4589
|
else no("opencode plugin .opencode/plugins/dm-watch.js", "run: crewbus init --harness opencode (then restart opencode)");
|
|
4590
|
+
// Binary + schema sanity for the respawn capture path (only when the
|
|
4591
|
+
// harness is actually installed): the log stream the session-id
|
|
4592
|
+
// capture reads (--format json events) and the storage-fallback DB.
|
|
4593
|
+
// --help is captured through a file descriptor, not a pipe —
|
|
4594
|
+
// opencode drops output onto some piped stdios (first-byte quirk).
|
|
4595
|
+
{
|
|
4596
|
+
const exe = resolveOpencodeExe();
|
|
4597
|
+
if (exe) {
|
|
4598
|
+
info(`opencode binary ${exe} (direct spawn, no shim)`);
|
|
4599
|
+
try {
|
|
4600
|
+
const helpFile = path.join(os.tmpdir(), `crewbus-oc-help-${process.pid}.txt`);
|
|
4601
|
+
let fd;
|
|
4602
|
+
try {
|
|
4603
|
+
fd = fs.openSync(helpFile, "w");
|
|
4604
|
+
execFileSync(exe, ["run", "--help"], { stdio: ["ignore", fd, fd], timeout: 15000 });
|
|
4605
|
+
} finally {
|
|
4606
|
+
try { fs.closeSync(fd); } catch {}
|
|
4607
|
+
}
|
|
4608
|
+
let h = "";
|
|
4609
|
+
try { h = fs.readFileSync(helpFile, "utf8"); } catch {}
|
|
4610
|
+
try { fs.rmSync(helpFile, { force: true }); } catch {}
|
|
4611
|
+
if (h.includes("--format") && /\bjson\b/.test(h)) ok("opencode run --help exposes --format json (capture flag present)");
|
|
4612
|
+
else no("opencode run --help flags", `--format json not offered by this opencode build — schema drift; session-id capture may not work (bin ${exe})`);
|
|
4613
|
+
} catch (e) {
|
|
4614
|
+
const detail = String((e && (e.message || e.stderr)) || e).slice(0, 120);
|
|
4615
|
+
no("opencode run --help", `could not run the resolved binary ${exe}: ${detail}`);
|
|
4616
|
+
}
|
|
4617
|
+
const st = opencodeStorageStatus();
|
|
4618
|
+
if (st.status === "ok") ok(`opencode storage DB session table readable ${st.dbPath}`);
|
|
4619
|
+
else if (st.status === "no-db") warn(`opencode storage DB not found (${st.dbPath}) — respawn capture limited to log scan`);
|
|
4620
|
+
else if (st.status === "no-sqlite") warn(`node:sqlite unavailable (needs Node >= 22) — respawn capture limited to log scan`);
|
|
4621
|
+
else if (st.status === "drift") no(`opencode storage DB session table ${st.dbPath}`, "schema drift — storage fallback cannot read session rows; update crewbus");
|
|
4622
|
+
else warn(`opencode storage DB unreadable (${st.detail || "transient lock"}) — respawn capture falls back to log scan`);
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4427
4625
|
break;
|
|
4428
4626
|
case "claude": {
|
|
4429
4627
|
if (hasHookRef(path.join(cwd, ".claude", "settings.json"), ["SessionStart", "Stop"])) ok("claude hooks .claude/settings.json");
|
|
@@ -6350,7 +6548,7 @@ Identity (first claim wins, token after that):
|
|
|
6350
6548
|
the CLI, not local file tampering — separate boards per trust zone.)
|
|
6351
6549
|
|
|
6352
6550
|
Messaging (primitive — just a tool call, whenever you want):
|
|
6353
|
-
crewbus send --from <you> --to <peer> --body "..." [--subject "..."] [--reply <msg-id>] [--artifact <path-or-url>] [--priority high|normal] [--checkpoint] [--session <id>] [--to-file <path>] [--broadcast] [--also-channel] [--sender-type human|lead|peer] [--fwd <n>] [--yes] [--no-rate-limit]
|
|
6551
|
+
crewbus send --from <you> --to <peer> --body "..." [--subject "..."] [--reply <msg-id>] [--artifact <path-or-url>] [--priority high|normal] [--checkpoint] [--needs-by 30m] [--session <id>] [--to-file <path>] [--broadcast] [--also-channel] [--sender-type human|lead|peer] [--fwd <n>] [--yes] [--no-rate-limit]
|
|
6354
6552
|
(--to accepts a comma list for broadcast: --to alice,bob,carol — one DM
|
|
6355
6553
|
each, same brief, shared batch id, up to 10000 recipients; --to-file reads
|
|
6356
6554
|
the list from a file for large fan-outs; --to @all reaches every
|
|
@@ -6360,6 +6558,8 @@ Messaging (primitive — just a tool call, whenever you want):
|
|
|
6360
6558
|
addresses named groups (same thing in spawn); unknown groups fail loudly.
|
|
6361
6559
|
--priority high flags urgent mail (inbox --priority filters it).
|
|
6362
6560
|
--checkpoint marks a progress note on a thread (labeled in transcripts, skipped by --unacked and spawn-status reply detection — never needs ack).
|
|
6561
|
+
--needs-by stamps a handoff deadline on the DM (inbox --overdue lists
|
|
6562
|
+
it once the deadline passes, so open work is never silently stale).
|
|
6363
6563
|
--also-channel (with --to-group) also appends the brief to each group's
|
|
6364
6564
|
channel, stamped with the DM batch id so gather picks it up.)
|
|
6365
6565
|
crewbus channel create|post|tail|search|summarize|list <name> [--body "..."] [--from <you>] [--limit 20] [--cursor <msg-id>] [--grep <pattern>] [--priority high|normal] [--max-chars <n>] [--digest] [--json]
|
|
@@ -6402,13 +6602,29 @@ Messaging (primitive — just a tool call, whenever you want):
|
|
|
6402
6602
|
crewbus gather --batch <batch-id> [--json]
|
|
6403
6603
|
(the reduce step: the brief(s) plus every reply, across inboxes, oldest
|
|
6404
6604
|
first — one transcript to aggregate, summarize, or feed a reducer agent.
|
|
6405
|
-
Footer shows telemetry + contributing groups
|
|
6605
|
+
Footer shows telemetry + contributing groups, plus workbench metrics
|
|
6606
|
+
(artifacts referenced, feed-forward edges, adopted/verified counts) —
|
|
6607
|
+
additive crews score 0, feed-forward crews score >0.
|
|
6406
6608
|
Group-channel mirrors (send --also-channel) carrying the batch join as briefs.)
|
|
6407
|
-
crewbus
|
|
6609
|
+
crewbus artifact publish|list|show|adopt|verify [--path <path-or-url>] [--summary "..."] [--deps <id,id>] [--id <artifact-id>] [--note "..."] [--from <you>] [--json]
|
|
6610
|
+
(board objects for worker output that should outlive the DM thread:
|
|
6611
|
+
publish a path/url + one-line summary, chain pieces with --deps,
|
|
6612
|
+
adopt when you reuse one, verify when you checked it holds up.
|
|
6613
|
+
adoption/verification record ON the object; later spawn briefs list
|
|
6614
|
+
the newest artifacts, so prior output compounds instead of being
|
|
6615
|
+
re-derived. publish/adopt/verify need your token; reads are open.)
|
|
6616
|
+
crewbus lesson post|list [--scope <group-or-task>] [--text "..."] [--from <you>] [--json]
|
|
6617
|
+
(scoped one-or-two-line learnings: what happened + what to do
|
|
6618
|
+
differently. Later spawn briefs whose groups (or --scope-less/global)
|
|
6619
|
+
match auto-inject the latest lessons, so a lesson learned once is
|
|
6620
|
+
paid forward. post needs your token; list is open.)
|
|
6621
|
+
crewbus inbox --from <you> [--limit 20] [--after <msg-id>] [--all] [--unacked] [--overdue] [--older-than 10m] [--grep <pattern>] [--priority high|normal] [--max-chars <n>] [--digest] [--verify] [--json]
|
|
6408
6622
|
(--older-than keeps only messages older than the window: inbox --unacked
|
|
6409
6623
|
--older-than 10m lists briefs nobody picked up (retry via redeliver or
|
|
6410
|
-
re-send). --
|
|
6411
|
-
--
|
|
6624
|
+
re-send). --overdue lists still-open briefs whose --needs-by deadline
|
|
6625
|
+
passed (skip in --all mode where ack state doesn't apply). --grep
|
|
6626
|
+
filters subject+body, --priority filters urgency, --max-chars
|
|
6627
|
+
fair-share truncates bodies with [truncated], --digest prints
|
|
6412
6628
|
one line per message.)
|
|
6413
6629
|
crewbus ack --from <you> (--id <msg-id> | --all) [--verify "<command>"] [--timeout <dur>]
|
|
6414
6630
|
("handled it" — orthogonal to delivery; leads ack workers' replies;
|
|
@@ -6427,7 +6643,7 @@ Messaging (primitive — just a tool call, whenever you want):
|
|
|
6427
6643
|
(recover mail a dead watcher consumed: clears delivered markers and
|
|
6428
6644
|
rewinds the cursor so the next poll/push treats it as fresh;
|
|
6429
6645
|
use after re-registering with the live session)
|
|
6430
|
-
crewbus spawn --from <you> (--to <workers> | --count <n> [--prefix <p>]) --body "..." [--subject "..."] [--priority high|normal] [--harness opencode|claude|codex|grok|antigravity|cursor|generic] [--cmd "..."] [--cwd <dir>] [--worktree <branch-prefix> | --branch <branch-prefix>] [--oneshot | --persistent] [--model <m>] [--max-turns <n>] [--allow-tools "..."] [--max-spawn <n>] [--auto --i-understand-danger] [--isolate] [--budget-tokens N] [--budget-minutes M] [--timeout 10m] [--keep-env] [--allow-env ANTHROPIC_,GITHUB_] [--workdir-root <dir>] [--sender-type human|lead|peer] [--dry-run]
|
|
6646
|
+
crewbus spawn --from <you> (--to <workers> | --count <n> [--prefix <p>]) --body "..." [--subject "..."] [--priority high|normal] [--needs-by 30m] [--harness opencode|claude|codex|grok|antigravity|cursor|generic] [--cmd "..."] [--cwd <dir>] [--worktree <branch-prefix> | --branch <branch-prefix>] [--oneshot | --persistent] [--model <m>] [--max-turns <n>] [--allow-tools "..."] [--max-spawn <n>] [--auto --i-understand-danger] [--isolate] [--budget-tokens N] [--budget-minutes M] [--timeout 10m] [--keep-env] [--allow-env ANTHROPIC_,GITHUB_] [--workdir-root <dir>] [--sender-type human|lead|peer] [--dry-run]
|
|
6431
6647
|
(workers boot with cloud/AI credential vars scrubbed from their environment by default (lead's keys never leak into briefs); pass --keep-env to inherit everything or --allow-env <prefix,...> to keep listed names. CREWBUS_TOKEN is never inherited — workers claim their own identity.)
|
|
6432
6648
|
(brief N workers AND boot them detached: the DM lands first so the brief
|
|
6433
6649
|
waits even if a launch fails. opencode: \`run\` + brief via --file;
|
|
@@ -6435,6 +6651,9 @@ Messaging (primitive — just a tool call, whenever you want):
|
|
|
6435
6651
|
file; grok: headless via --prompt-file; antigravity: \`--print\` with the
|
|
6436
6652
|
brief inline; cursor: headless via \`-p --force --trust\` pointing at the
|
|
6437
6653
|
brief file; generic: --cmd with CREWBUS_DIR + CREWBUS_AGENT set.
|
|
6654
|
+
Briefs auto-inject the latest scoped lessons + newest board artifacts
|
|
6655
|
+
(the Workbench block) so prior output compounds; --needs-by stamps a
|
|
6656
|
+
handoff deadline on the brief DMs.
|
|
6438
6657
|
Logs to .crewbus/logs/<name>.log, pid recorded on the agent. Caps at
|
|
6439
6658
|
20/call by default (--max-spawn overrides, needs the compute) — bigger
|
|
6440
6659
|
crews get a broadcast DM. --worktree is recommended for write tasks (one
|
|
@@ -6454,13 +6673,16 @@ Messaging (primitive — just a tool call, whenever you want):
|
|
|
6454
6673
|
crewbus spawn-kill --from <you> (--to <worker,...> | --all)
|
|
6455
6674
|
(the kill switch: closing the terminal does NOT stop detached workers.
|
|
6456
6675
|
Terminates by recorded pid, confirms death, reports. Needs your token.)
|
|
6457
|
-
crewbus respawn --from <you> --to <worker> [--body "..."] [--force] [--cwd <dir>] [--cmd "..."] [--keep-env] [--allow-env ...] [--dry-run]
|
|
6676
|
+
crewbus respawn --from <you> --to <worker> [--body "..."] [--force] [--fresh] [--cwd <dir>] [--cmd "..."] [--keep-env] [--allow-env ...] [--dry-run]
|
|
6458
6677
|
(reboot one DEAD worker in its SAME harness conversation: needs the
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6678
|
+
captured session id (spawn-status shows it; generic re-boots fresh).
|
|
6679
|
+
--fresh skips the resume requirement when the id can't be captured
|
|
6680
|
+
(e.g. an opencode worker died before its log revealed anything) and
|
|
6681
|
+
re-boots the catch-up brief as a fresh session.
|
|
6682
|
+
Refuses live workers unless --force (kills first, own crew only).
|
|
6683
|
+
The catch-up brief points at the original prompt file and threads the
|
|
6684
|
+
same reply id; --body appends lead instructions. Attempt counted on
|
|
6685
|
+
the worker-session record. Lead/admin only.)
|
|
6464
6686
|
crewbus stop --all --from <you>
|
|
6465
6687
|
(global stop: kills every spawned worker truly (whole process tree).)
|
|
6466
6688
|
crewbus token rotate --from <you> [--expires-in <dur>]
|
|
@@ -7103,14 +7325,15 @@ async function cmdPool(args) {
|
|
|
7103
7325
|
state.active[name] = r.pid;
|
|
7104
7326
|
state.launched++;
|
|
7105
7327
|
state.results.push({ to: name, id: idByName.get(name), pid: r.pid, log: r.logPath, promptPath: r.promptPath });
|
|
7328
|
+
saveState();
|
|
7106
7329
|
console.log(`pool ${poolId}: spawned ${name} pid ${r.pid} [board ${d.root}]`);
|
|
7107
7330
|
} catch (e) {
|
|
7108
7331
|
delete state.active[name];
|
|
7109
7332
|
state.done++;
|
|
7110
7333
|
state.results.push({ to: name, id: idByName.get(name), error: (e && e.message) || String(e) });
|
|
7334
|
+
saveState();
|
|
7111
7335
|
console.log(`pool ${poolId}: spawn FAILED ${name}: ${(e && e.message) || e} (brief still waits on the board)`);
|
|
7112
7336
|
}
|
|
7113
|
-
saveState();
|
|
7114
7337
|
};
|
|
7115
7338
|
const initial = Math.min(poolSize, queue.length);
|
|
7116
7339
|
for (; state.cursor < initial; state.cursor++) launchOne(queue[state.cursor]);
|
|
@@ -7221,14 +7444,15 @@ async function cmdPoolResume(args) {
|
|
|
7221
7444
|
state.active[name] = r.pid;
|
|
7222
7445
|
state.launched++;
|
|
7223
7446
|
state.results.push({ to: name, id: state.idByName[name], pid: r.pid, log: r.logPath, promptPath: r.promptPath, resumed: true });
|
|
7447
|
+
saveState();
|
|
7224
7448
|
console.log(`pool ${state.id}: spawned ${name} pid ${r.pid} [board ${d.root}]`);
|
|
7225
7449
|
} catch (e) {
|
|
7226
7450
|
delete state.active[name];
|
|
7227
7451
|
state.done++;
|
|
7228
7452
|
state.results.push({ to: name, id: state.idByName[name], error: (e && e.message) || String(e) });
|
|
7453
|
+
saveState();
|
|
7229
7454
|
console.log(`pool ${state.id}: spawn FAILED ${name}: ${(e && e.message) || e} (brief still waits on the board)`);
|
|
7230
7455
|
}
|
|
7231
|
-
saveState();
|
|
7232
7456
|
};
|
|
7233
7457
|
const finish = (completed) => {
|
|
7234
7458
|
if (completed) state.finishedAt = new Date().toISOString();
|
|
@@ -7462,6 +7686,8 @@ async function main() {
|
|
|
7462
7686
|
case "agents": return cmdAgents(rest);
|
|
7463
7687
|
case "send": return cmdSend(rest);
|
|
7464
7688
|
case "channel": return cmdChannel(rest);
|
|
7689
|
+
case "artifact": return cmdArtifact(rest);
|
|
7690
|
+
case "lesson": return cmdLesson(rest);
|
|
7465
7691
|
case "lock": return cmdLock(rest);
|
|
7466
7692
|
case "group": return cmdGroup(rest);
|
|
7467
7693
|
case "gather": return cmdGather(rest);
|
package/bin/lib/identity.js
CHANGED
|
@@ -330,7 +330,7 @@ export function authorizeCheck(d, agent, action, scope) { // line 537
|
|
|
330
330
|
const act = String(action || "");
|
|
331
331
|
const ADMIN_ONLY = new Set(["prune", "acl-set", "role-grant", "offboard", "group-restrict", "serve-remote", "import", "snapshot-schedule", "quota-set", "hold-place", "hold-lift", "pairing"]);
|
|
332
332
|
const LEAD_PLUS = new Set(["spawn", "respawn", "pool", "group-manage", "channel-post", "result-record", "race-close"]);
|
|
333
|
-
const WORKER_WRITES = new Set(["send", "ack", "redeliver", "lock"]);
|
|
333
|
+
const WORKER_WRITES = new Set(["send", "ack", "redeliver", "lock", "artifact-write", "lesson-write"]);
|
|
334
334
|
const EXPORT_ROLES = new Set(["admin", "auditor"]);
|
|
335
335
|
if (act === "export") {
|
|
336
336
|
if (!EXPORT_ROLES.has(role)) return { ok: false, reason: `role "${role}" cannot export (need admin|auditor)` };
|