@staix/agent-hub 0.46.1 → 0.47.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/CHANGELOG.md +79 -0
- package/README.md +8 -4
- package/docs/adding-an-ai-tool.md +20 -4
- package/docs/agent-notes/adapters.md +3 -3
- package/docs/agent-notes/benchmarks.md +7 -1
- package/docs/agent-notes/daemon.md +5 -4
- package/docs/agent-notes/tasks.md +4 -2
- package/docs/agent-notes/tests.md +3 -0
- package/docs/contracts/companion-cli-v1.json +3 -0
- package/docs/data-policy.md +9 -0
- package/docs/design/adapters.md +14 -0
- package/docs/design/cli-output-inventory.md +362 -0
- package/docs/design/cli-output.md +42 -1
- package/docs/design/execution-reference.md +5 -2
- package/docs/design/guidance-probes.md +2 -2
- package/docs/design/refusal-inventory.md +26 -0
- package/docs/design/roadmap.md +4 -0
- package/docs/design/task-board.md +17 -1
- package/docs/dogfood.md +26 -10
- package/docs/events.md +9 -0
- package/docs/friction.md +46 -0
- package/docs/memory.md +35 -3
- package/docs/operations.md +63 -15
- package/docs/profiles.md +1 -0
- package/docs/quickstart.md +8 -2
- package/docs/roles.md +6 -0
- package/docs/sdlc.md +44 -1
- package/docs/security.md +16 -7
- package/docs/specs/2026-09-19-agent-hub-design.md +17 -0
- package/docs/specs/2026-09-19-multi-project-design.md +7 -1
- package/docs/verification/2026-11-25-agy-1.5.16.md +31 -0
- package/docs/verification/2026-11-25-claude-implementer-2.1.332.md +47 -0
- package/docs/verification/2026-11-25-codex-0172-reviewer-isolation.md +47 -0
- package/docs/verification/2026-11-25-kimi-272-reviewer-compat.md +38 -0
- package/docs/verification/2026-11-25-kimi-tui-272.md +14 -0
- package/docs/verification/2026-11-25-pi-160-compat.md +40 -0
- package/docs/verification/2026-11-26-0.47.0.md +43 -0
- package/docs/verification/2026-11-26-codex-0172-reviewer-tool-call.md +29 -0
- package/docs/verification/dogfood/2026-11-24.md +2829 -0
- package/docs/verification/pi-160-model-free.ts +57 -0
- package/docs/verification/pi-160-native.mjs +21 -0
- package/docs/verified.json +43 -31
- package/package.json +2 -2
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +579 -126
- package/plugins/agent-hub/server.js +668 -138
- package/src/adapters/acp.ts +5 -0
- package/src/adapters/channel-peer.ts +7 -0
- package/src/adapters/claude-print-child.ts +27 -5
- package/src/adapters/codex-appserver.ts +9 -0
- package/src/adapters/compat.ts +12 -11
- package/src/adapters/configured-acp.ts +45 -2
- package/src/adapters/configured-print.ts +163 -0
- package/src/adapters/conformance/index.ts +1 -0
- package/src/adapters/conformance/print.ts +57 -0
- package/src/adapters/definitions/native-activity.ts +57 -0
- package/src/adapters/definitions/native-factories.ts +4 -2
- package/src/adapters/jcode.ts +10 -2
- package/src/adapters/local-worker.ts +2 -0
- package/src/adapters/registry-types.ts +5 -3
- package/src/adapters/role-eligibility.ts +5 -0
- package/src/cli/bench.ts +2 -1
- package/src/cli/broker.ts +2 -1
- package/src/cli/capabilities-output.ts +10 -14
- package/src/cli/configured-acp-entry.ts +10 -2
- package/src/cli/console-state.ts +25 -5
- package/src/cli/error-format.ts +2 -0
- package/src/cli/guidance.ts +1 -1
- package/src/cli/handoff-output.ts +20 -17
- package/src/cli/help.ts +78 -40
- package/src/cli/init-settings.ts +15 -0
- package/src/cli/intake-output.ts +13 -13
- package/src/cli/launch.ts +3 -2
- package/src/cli/learn-output.ts +40 -21
- package/src/cli/main.ts +148 -77
- package/src/cli/memory.ts +47 -2
- package/src/cli/output.ts +54 -31
- package/src/cli/roadmap.ts +2 -2
- package/src/cli/room-output.ts +71 -0
- package/src/cli/room.ts +19 -33
- package/src/cli/schedule-output.ts +20 -19
- package/src/cli/sdlc-output.ts +188 -170
- package/src/cli/source-output.ts +17 -14
- package/src/cli/specs.ts +13 -13
- package/src/cli/study-output.ts +66 -69
- package/src/cli/task-output.ts +106 -158
- package/src/cli/terminal-recovery.ts +2 -1
- package/src/cli/upgrade-runtime.ts +2 -1
- package/src/cli/warn-line.ts +18 -0
- package/src/cli/worktrees-output.ts +25 -23
- package/src/hub/audit-source.ts +45 -0
- package/src/hub/board.ts +141 -5
- package/src/hub/bus.ts +13 -2
- package/src/hub/config-apply.ts +14 -1
- package/src/hub/config-trust.ts +1 -0
- package/src/hub/control-client.ts +1 -1
- package/src/hub/daemon.ts +371 -45
- package/src/hub/handoff.ts +5 -1
- package/src/hub/hub-tools.ts +23 -5
- package/src/hub/instance-config.ts +3 -3
- package/src/hub/learn-followup.ts +103 -0
- package/src/hub/learning.ts +63 -1
- package/src/hub/manager.ts +15 -1
- package/src/hub/memory-policy.ts +2 -1
- package/src/hub/memory-review.ts +217 -0
- package/src/hub/peer-activity.ts +37 -0
- package/src/hub/peers.ts +3 -0
- package/src/hub/project-move.ts +258 -0
- package/src/hub/registry.ts +16 -5
- package/src/hub/restart.ts +7 -0
- package/src/hub/review-brief.ts +8 -4
- package/src/hub/review-checkout.ts +26 -0
- package/src/hub/review-findings.ts +6 -3
- package/src/hub/risk-tier.ts +129 -0
- package/src/hub/roadmap-check.ts +1 -0
- package/src/hub/routing.ts +3 -1
- package/src/hub/sdlc-merge.ts +9 -0
- package/src/hub/sdlc-metrics.ts +24 -1
- package/src/hub/sdlc-queue.ts +1 -1
- package/src/hub/sdlc.ts +15 -6
- package/src/hub/settings.ts +2 -0
- package/src/hub/spec-readback.ts +136 -0
- package/src/hub/specs.ts +1 -1
- package/src/hub/task-list-page.ts +1 -1
- package/src/hub/tasks.ts +558 -65
- package/src/hub/ui.ts +4 -2
- package/src/ui/index.html +26 -2
- package/src/ui/overview-model.ts +138 -0
- package/src/ui/plugin.ts +30 -4
- package/templates/roles/ops/project-manager.md +1 -1
package/src/cli/main.ts
CHANGED
|
@@ -77,6 +77,7 @@ import { factsHook } from "./facts-hook.ts";
|
|
|
77
77
|
import { parseInstructionHook } from "./instruction-hook.ts";
|
|
78
78
|
import { hubHome, projectContext, projectRoot, realPath } from "../hub/project.ts";
|
|
79
79
|
import { Registry, type Project } from "../hub/registry.ts";
|
|
80
|
+
import { applyProjectMove, previewProjectMove } from "../hub/project-move.ts";
|
|
80
81
|
import { datasetInputFor, exportResearchDataset, projectFamilyOf } from "../hub/research-dataset.ts";
|
|
81
82
|
import { readEvidence } from "../hub/research-record.ts";
|
|
82
83
|
import { inspectProject, startProject, stopProject, runProjectDaemon } from "../hub/lifecycle.ts";
|
|
@@ -142,6 +143,7 @@ import { recordCliAudit, recordDelegatedCliAudit } from "./identity-audit.ts";
|
|
|
142
143
|
import { runConsole } from "./console.ts";
|
|
143
144
|
import { installedVersions } from "./console-versions.ts";
|
|
144
145
|
import { errorLines, failureExitCode } from "./error-format.ts";
|
|
146
|
+
import { warnLine } from "./warn-line.ts";
|
|
145
147
|
import { asciiMarkers, paint, permissionBoundary, resolveColor, streamEnv, wrap, type Span } from "./console-state.ts";
|
|
146
148
|
import { queueResolveArgsValid } from "../hub/person-command.ts";
|
|
147
149
|
import { outputWidth, renderRuntimeModels, renderRoster, renderRoles, rolesView,renderStatus, renderStatusDefault, renderBoard, renderBacklog, renderBoardColumns, boardColumnModel, renderBudget, renderDoctor, renderProjects, renderQueue, renderTurns, renderOrphans, renderOrphanCleanup, renderQueueShow, renderModelsStatus, renderExecutionBudgetStatus, renderReport, renderUsage, renderLimits, renderTotal, type DoctorCheck } from "./output.ts";
|
|
@@ -222,7 +224,7 @@ function localDeclarations(): { scope: Pick<InstanceRoleConfig, "instances" | "c
|
|
|
222
224
|
catch (error) { return { scope: { catalog: createProjectAdapterCatalog() }, error: startupDiagnostic(error) }; }
|
|
223
225
|
}
|
|
224
226
|
const projectCatalog = peerConfig.catalog;
|
|
225
|
-
const configuredCommand = !definitionOf(given) && (projectCatalog.definitionOf(given)?.permission.genericAcp !== undefined || peerConfig.declaredExternalInstances?.some(row => row.kind === given) === true);
|
|
227
|
+
const configuredCommand = !definitionOf(given) && (projectCatalog.definitionOf(given)?.permission.genericAcp !== undefined || projectCatalog.definitionOf(given)?.start.daemonPort === "configured-print" || peerConfig.declaredExternalInstances?.some(row => row.kind === given) === true);
|
|
226
228
|
const unboundCaller = detectCliIdentity(process.env);
|
|
227
229
|
const markerNeedsDeclaration = unboundCaller.role === "invalid" && unboundCaller.reason === "AGENTHUB_PEER_ID conflicts with native agent marker"
|
|
228
230
|
&& process.env.AGENTHUB_PEER_ID !== undefined && !definitionOf(process.env.AGENTHUB_PEER_ID);
|
|
@@ -263,8 +265,8 @@ const requireNamedPeerFeature = (hub: ControlClient, peer: string | undefined) =
|
|
|
263
265
|
/** The project config, saying on stderr which machine-local fields it had to ignore (issue #17). */
|
|
264
266
|
const projectConfig = () => {
|
|
265
267
|
const config = loadConfig(cwd);
|
|
266
|
-
for (const line of config.ignored ?? [])
|
|
267
|
-
for (const line of config.releasePolicyNotices ?? [])
|
|
268
|
+
for (const line of config.ignored ?? []) warn(`${line}: only a config file nobody committed may set it`);
|
|
269
|
+
for (const line of config.releasePolicyNotices ?? []) warn(line);
|
|
268
270
|
return config;
|
|
269
271
|
};
|
|
270
272
|
const stateDir = selected.stateDir;
|
|
@@ -306,7 +308,7 @@ function audit(outcome: "run" | "refused" | "invalid"): void {
|
|
|
306
308
|
try { recordCliAudit(stateDir, caller.role === "tools" ? caller.peer : "unknown", commandLabel, outcome, cmd === "answer" && args.includes("--instructed")); }
|
|
307
309
|
catch {
|
|
308
310
|
if (delegatedPeer) fail("live-test delegation audit unavailable; nothing was executed");
|
|
309
|
-
|
|
311
|
+
warn("CLI audit could not be recorded: outbox unavailable or full");
|
|
310
312
|
}
|
|
311
313
|
}
|
|
312
314
|
if (identity.role === "invalid") { audit("invalid"); fail(`${identity.reason}; use ahub console or a terminal with no agent markers`); }
|
|
@@ -369,7 +371,7 @@ function outputOptions(source: readonly string[] = args) {
|
|
|
369
371
|
* presentation flag loses it: the documented cost of accepting the flag after the reason.
|
|
370
372
|
*/
|
|
371
373
|
function splitPresentation(argv: readonly string[], opts: { valueFlags?: readonly string[]; edges?: boolean } = {}): { operands: string[]; flags: string[] } {
|
|
372
|
-
const isFlag = (arg: string) => arg === "--json" || arg === "--full" || arg.startsWith("--color=");
|
|
374
|
+
const isFlag = (arg: string) => arg === "--json" || arg === "--full" || arg === "--ascii" || arg.startsWith("--color=");
|
|
373
375
|
const operands: string[] = [], flags: string[] = [], value = new Set(opts.valueFlags ?? []);
|
|
374
376
|
let lead = true;
|
|
375
377
|
const middle: string[] = [];
|
|
@@ -388,7 +390,7 @@ function splitPresentation(argv: readonly string[], opts: { valueFlags?: readonl
|
|
|
388
390
|
}
|
|
389
391
|
/** Remove only presentation flags from read-only command positional arguments. */
|
|
390
392
|
function outputArguments(): string[] {
|
|
391
|
-
return args.filter(arg => arg !== "--json" && arg !== "--full" && !arg.startsWith("--color="));
|
|
393
|
+
return args.filter(arg => arg !== "--json" && arg !== "--full" && arg !== "--ascii" && !arg.startsWith("--color="));
|
|
392
394
|
}
|
|
393
395
|
/** `sdlc` operands: the read subcommands that print for a person (#814) drop `--json`, `--full` and `--color=`; every other subcommand keeps its argv exactly. */
|
|
394
396
|
/** The daemon answers a missing task id with a JSON string (`"no task #N"`), a found task with an object: the sentence for a missing one, otherwise undefined. */
|
|
@@ -396,11 +398,11 @@ function missingTaskText(text: string): string | undefined {
|
|
|
396
398
|
try { const value: unknown = JSON.parse(text); return typeof value === "string" && /^no task #\d+$/.test(value) ? value : undefined; } catch { return undefined; }
|
|
397
399
|
}
|
|
398
400
|
/** A hub tool answers JSON text. Text that does not parse is printed as it came: a renderer never sees it, so it cannot read as an empty report. */
|
|
399
|
-
function showToolText(render: (data: any, columns?: number, now?: number) => Span[][], text: string, present: ReturnType<typeof outputOptions>): void {
|
|
401
|
+
function showToolText(render: (data: any, columns?: number, now?: number, ascii?: boolean) => Span[][], text: string, present: ReturnType<typeof outputOptions>): void {
|
|
400
402
|
let data: unknown;
|
|
401
403
|
try { data = JSON.parse(text); } catch { return console.log(text); }
|
|
402
404
|
if (present.json) return console.log(text);
|
|
403
|
-
printOutput(render(data, present.columns, Date.now()), present.color);
|
|
405
|
+
printOutput(render(data, present.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), present.color);
|
|
404
406
|
}
|
|
405
407
|
const SDLC_READ = ["status", "explain", "queue", "release", "metrics", "costs", "authorize-release", "audit", "configure", "survey"];
|
|
406
408
|
function sdlcOperands(): string[] { return SDLC_READ.includes(args[0] ?? "") ? outputArguments() : args; }
|
|
@@ -416,7 +418,7 @@ const connect = async (timeoutMs = 3000) => {
|
|
|
416
418
|
: { role: "console", projectRoot: cwd, ...(delegatedAuditHub ? { instanceId: delegatedAuditHub.instanceId } : {}) }, timeoutMs);
|
|
417
419
|
};
|
|
418
420
|
|
|
419
|
-
const connectLaunch = () => retryLaunchConnect(connect, () =>
|
|
421
|
+
const connectLaunch = () => retryLaunchConnect(connect, () => warn("hub busy: retrying"));
|
|
420
422
|
|
|
421
423
|
/** #1627 A: what init does for the hub-owned jcode home, read-only. */
|
|
422
424
|
function initJcodeHome() {
|
|
@@ -572,7 +574,7 @@ async function orphanDoctor(kill: boolean, options: ReturnType<typeof outputOpti
|
|
|
572
574
|
else printOutput(renderOrphans(orphans, options.columns, Date.now(), kill), options.color);
|
|
573
575
|
let failed = 0;
|
|
574
576
|
const diagnostic = (text: string) => options.json
|
|
575
|
-
?
|
|
577
|
+
? warn(text)
|
|
576
578
|
: printOutput(wrap(text, options.columns ?? Infinity).map(text => [{ text }]), options.color);
|
|
577
579
|
if (kill) for (const { project, pids } of orphans) for (const pid of pids) if (!(await killOrphan(pid, project.root, diagnostic))) failed++;
|
|
578
580
|
if (failed) fail(`${failed} orphaned hub process(es) could not be stopped`);
|
|
@@ -584,6 +586,8 @@ function startupDiagnostic(error: unknown): string {
|
|
|
584
586
|
return message.replace(/[\p{Cc}\p{Cf}]/gu, " ").replace(/\s+/g, " ").trim().slice(0, 512) || "invalid startup configuration";
|
|
585
587
|
}
|
|
586
588
|
|
|
589
|
+
/** A stderr warning that does not end the command (standard v1, Messages). */
|
|
590
|
+
function warn(message: string, next?: string): void { warnLine(message, next); }
|
|
587
591
|
/**
|
|
588
592
|
* CLI output standard v1, Messages: `ahub: <what failed>: <why>` on stderr; with a terminal on stderr it leads with the fail marker, and a piped line
|
|
589
593
|
* keeps the plain `ahub: ` form so a script or agent matching it still works. `next` is a complete, copyable command printed on a second line (ASCII
|
|
@@ -596,8 +600,8 @@ function fail(message: string, refusalAudited=false, authorityRefused?:boolean,
|
|
|
596
600
|
process.exit(failureExitCode(message));
|
|
597
601
|
}
|
|
598
602
|
function operationalIncomplete(result: {complete?:boolean;incompleteReason?:unknown;truncated?:boolean}, history: "log"|"event"): void {
|
|
599
|
-
if(result.complete===false)
|
|
600
|
-
else if(result.truncated)
|
|
603
|
+
if(result.complete===false)warn(`operational output is incomplete: ${typeof result.incompleteReason==="string"?terminalText(result.incompleteReason).replace(/[\r\n]+/g," ").slice(0,200):"public privacy or history coverage unavailable"}`);
|
|
604
|
+
else if(result.truncated)warn(`operational ${history} history is truncated`);
|
|
601
605
|
}
|
|
602
606
|
|
|
603
607
|
async function taskOp(op: string, a: Record<string, unknown>, throwOnError = false, connection?: ControlClient, timeoutMs?: number): Promise<string> {
|
|
@@ -613,7 +617,7 @@ async function taskOp(op: string, a: Record<string, unknown>, throwOnError = fal
|
|
|
613
617
|
if(operationalAuditReady ? res.authorityRefused!==false : res.authorityRefused===true)audit("refused"); // a domain error is not a refusal (#1547)
|
|
614
618
|
// #711: an agent shell refused something only the person may do is told why it counts as an agent. The refusal and the authority stay as they were.
|
|
615
619
|
const cause = agentShellCause(identity, String(res.error));
|
|
616
|
-
if (cause) console.error(
|
|
620
|
+
if (cause) console.error(errorLines(`${res.error}\n${cause}`, undefined, !!process.stderr.isTTY, asciiMarkers(process.env, process.argv.includes("--ascii"))).join("\n")), process.exit(1);
|
|
617
621
|
fail(res.error,res.refusalAudited===true,res.authorityRefused);
|
|
618
622
|
}
|
|
619
623
|
return res.text;
|
|
@@ -688,7 +692,7 @@ function spawnRecovery(operation: RecoveryOperation, quiet = false, presentation
|
|
|
688
692
|
const child = spawn(process.execPath, [join(operation.sourceRoot, "src/cli/main.js"), ...liveTestArgs, "recovery-run", operation.id], {
|
|
689
693
|
cwd, detached: true, stdio: "ignore", env: { ...process.env, AGENTHUB_RECOVERY_OPERATION: operation.id, ...(conductorPeer ? { AGENTHUB_PEER_ID: conductorPeer, AGENTHUB_RECOVERY_CONDUCTOR: conductorPeer } : {}) },
|
|
690
694
|
});
|
|
691
|
-
child.on("error", () =>
|
|
695
|
+
child.on("error", () => warn("runner launch failed", recoveryCommand(operation, "resume")));
|
|
692
696
|
child.unref();
|
|
693
697
|
// #215: the operation's own coordinator, which has every recovery command; the global ahub may be older mid-upgrade.
|
|
694
698
|
if (!quiet) {
|
|
@@ -854,13 +858,13 @@ async function upgrade(kind: "restart" | "upgrade"): Promise<void> {
|
|
|
854
858
|
process.on("SIGINT", () => {});
|
|
855
859
|
const code = await new Promise<number>((resolve) => {
|
|
856
860
|
const child = spawn(process.execPath, argv, { cwd, stdio: "inherit", env: { ...process.env, AGENTHUB_UPGRADE_HANDOVER: "1" } });
|
|
857
|
-
child.on("error", (error) => {
|
|
861
|
+
child.on("error", (error) => { warn(`cannot run bun x: ${error.message}`); resolve(1); });
|
|
858
862
|
child.on("close", (status) => resolve(status ?? 1));
|
|
859
863
|
});
|
|
860
864
|
process.exit(code);
|
|
861
865
|
}
|
|
862
866
|
if (kind === "upgrade" && await stoppedUpgrade(to!, allStopped, display, yes, dry)) return;
|
|
863
|
-
if (kind === "upgrade")
|
|
867
|
+
if (kind === "upgrade") warn("Kimi now defaults to its own TUI (pull-only) in projects without peers.kimi.start_mode; to keep ACP, run the next command", "ahub settings set peers.kimi.start_mode headless");
|
|
864
868
|
if (interactive) return onTerminal((io) => planScreen(upgradeHost(kind, to ?? VERSION), io), display.options);
|
|
865
869
|
const plan = await makeUpgradePlan(kind, to ?? VERSION, cwd, undefined, conductorPeer);
|
|
866
870
|
if (conductorPeer) await preflightConductorRecovery(plan, conductorPeer);
|
|
@@ -869,8 +873,8 @@ async function upgrade(kind: "restart" | "upgrade"): Promise<void> {
|
|
|
869
873
|
// fresh start in them. `--json` keeps the document and the stderr lines (#206) exactly as they were.
|
|
870
874
|
if (display.json) {
|
|
871
875
|
if (!jsonApply) console.log(JSON.stringify(plan, null, 2));
|
|
872
|
-
for (const p of plan.projects) for (const peer of p.reconnectOnly ?? [])
|
|
873
|
-
for (const p of plan.projects) for (const peer of p.freshStart ?? [])
|
|
876
|
+
for (const p of plan.projects) for (const peer of p.reconnectOnly ?? []) warn(`${p.project.id}: ${peer} is reconnect-only (unmanaged session): its plugin reattaches to the new hub; no terminal is closed or relaunched`);
|
|
877
|
+
for (const p of plan.projects) for (const peer of p.freshStart ?? []) warn(`${p.project.id}: ${peer} restarts as a new session: its thread has no rollout and the hub recorded no turn on it, so nothing is lost`);
|
|
874
878
|
} else printRecovery(renderUpgradePlan(plan, VERSION, display.options, yes && !dry));
|
|
875
879
|
const blockers = [...plan.blockers, ...plan.projects.flatMap((p) => p.blockers.map((b) => `${p.project.id}: ${b}`))];
|
|
876
880
|
if (display.json) for (const blocker of blockers) console.error(`ahub: blocker: ${blocker}`);
|
|
@@ -1012,7 +1016,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1012
1016
|
const formatting = recoveryFormatting(coordinator, display.options);
|
|
1013
1017
|
const code = await new Promise<number>(resolve => {
|
|
1014
1018
|
const child = spawn(process.execPath, [coordinator, "recovery", "reattach", selected.id, selected.peer, ...formatting], { cwd, stdio: display.json ? ["inherit", "ignore", "inherit"] : "inherit", env: process.env });
|
|
1015
|
-
child.on("error", () => {
|
|
1019
|
+
child.on("error", () => { warn("coordinator could not start", recoveryCommand(operation, "status")); resolve(1); });
|
|
1016
1020
|
child.on("close", status => resolve(status ?? 1));
|
|
1017
1021
|
});
|
|
1018
1022
|
process.exitCode = code;
|
|
@@ -1109,7 +1113,9 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1109
1113
|
help: () => {
|
|
1110
1114
|
const color = resolveColor(undefined, streamEnv(!!process.stdout.isTTY), "ahub") === true;
|
|
1111
1115
|
const topic = asksHelp(args[0]) ? undefined : args[0];
|
|
1112
|
-
const text = topic && !definitionOf(topic) && projectCatalog.definitionOf(topic)?.
|
|
1116
|
+
const text = topic && !definitionOf(topic) && projectCatalog.definitionOf(topic)?.start.daemonPort === "configured-print"
|
|
1117
|
+
? `ahub ${topic} [--mode headless] [--print-command | --dry-run]\nConfigured print runs one sandboxed process per public advisory request. Declare it in untracked .agenthub/config.local.json, restart the hub, then enable roster.${topic}.`
|
|
1118
|
+
: topic && !definitionOf(topic) && projectCatalog.definitionOf(topic)?.permission.genericAcp !== undefined
|
|
1113
1119
|
? configuredAcpHelp(topic) : renderHelp(process.stdout.columns ?? 80, color, topic, undefined, asciiMarkers(process.env, args.includes("--ascii")));
|
|
1114
1120
|
if (!text) fail(`unknown command "${topic}"; run ahub help`);
|
|
1115
1121
|
console.log(text);
|
|
@@ -1123,6 +1129,35 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1123
1129
|
version: () => console.log(VERSION),
|
|
1124
1130
|
|
|
1125
1131
|
projects: async () => {
|
|
1132
|
+
if (args[0] === "move") {
|
|
1133
|
+
if (caller.role !== "console" || liveTest) fail("moving a project is person-only; run ahub projects move from your terminal");
|
|
1134
|
+
const { one, rest } = takeFlags(args.slice(1), ["--state", "--confirm"], []);
|
|
1135
|
+
const [old, root] = rest;
|
|
1136
|
+
if (rest.length !== 2 || !old || !root || rest.some(arg => arg.startsWith("--")) ||
|
|
1137
|
+
Object.values(one).some(value => !value || value.startsWith("--")))
|
|
1138
|
+
fail("usage: ahub projects move <old-id|old-root> <new-root> [--state <dir>] [--confirm <fingerprint>]");
|
|
1139
|
+
const registry = new Registry();
|
|
1140
|
+
try {
|
|
1141
|
+
const confirm = one["--confirm"];
|
|
1142
|
+
const plan = confirm === undefined
|
|
1143
|
+
? previewProjectMove(registry, old, root, one["--state"])
|
|
1144
|
+
: applyProjectMove(registry, old, root, one["--state"], confirm);
|
|
1145
|
+
const lines = [`${plan.old.id} -> ${plan.next.id}`, `${plan.old.root} -> ${plan.next.root}`,
|
|
1146
|
+
`State: ${plan.next.stateDir}`, `Base port kept: ${plan.old.basePort}`];
|
|
1147
|
+
for (const store of plan.stores) {
|
|
1148
|
+
lines.push(`Database ${store.project.id}: ${store.file}`);
|
|
1149
|
+
for (const change of store.rewrites) lines.push(` ${change.table}.${change.column}: ${change.count}`);
|
|
1150
|
+
}
|
|
1151
|
+
for (const marker of plan.markers) lines.push(` ${basename(marker.file)}: 1 (${marker.after === undefined ? "archived" : "rebound"})`);
|
|
1152
|
+
lines.push("Autonomy consent is dropped. Run ahub autonomy on from the new root to grant it again.",
|
|
1153
|
+
"Memory project keys and recovery history are left at their original identities.",
|
|
1154
|
+
`Backup ${confirm === undefined ? "directory (on confirm)" : "saved at"}: ${plan.archive}`,
|
|
1155
|
+
"Undo: stop the affected hubs and follow the restore.json mapping in the backup. See Multiple projects and worktrees in the operations guide.");
|
|
1156
|
+
if (confirm === undefined) lines.push(`Confirm by repeating the command with --confirm ${plan.fingerprint}`);
|
|
1157
|
+
console.log(terminalText(lines.join("\n")));
|
|
1158
|
+
} finally { registry.close(); }
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1126
1161
|
if (args[0] === "remove") {
|
|
1127
1162
|
if (args.length !== 2) fail("usage: ahub projects remove <id>");
|
|
1128
1163
|
const registry = new Registry();
|
|
@@ -1158,7 +1193,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1158
1193
|
url = res.url;
|
|
1159
1194
|
} finally { hub.close(); }
|
|
1160
1195
|
}
|
|
1161
|
-
if (settings)
|
|
1196
|
+
if (settings) warn("Settings session: for 15 minutes this dashboard session may change permission modes, routing and start settings");
|
|
1162
1197
|
if (args.includes("--no-open")) return console.log(url);
|
|
1163
1198
|
const opener = process.platform === "darwin" ? "open" : "xdg-open";
|
|
1164
1199
|
const opened = spawnSync(opener, [url], { stdio: "ignore", timeout: 10_000 });
|
|
@@ -1277,21 +1312,21 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1277
1312
|
result = await runInitPrompt({ ask, print: line => console.log(terminalText(line)) },
|
|
1278
1313
|
{ ...(machine.startAgents ? { machineAgents: machine.startAgents } : {}), machineResearch: initResearchDefault(cwd, initMachine?.researchEnabled), installedPeers: installedPeers(), packs: [...loadPacks(cwd).packs.keys()], discoverChecks: async () => (await discoverInitChecks(cwd)).names, shadowAvailable: shadowOffered(repoOf(cwd)) }, preview);
|
|
1279
1314
|
} finally { rl.close(); }
|
|
1280
|
-
if (!result.ok) { console.error(`
|
|
1315
|
+
if (!result.ok) { if (result.reason === "refused") console.error(errorLines(`init: ${result.message}`, undefined, !!process.stderr.isTTY, asciiMarkers(process.env, process.argv.includes("--ascii"))).join("\n")); else warn(`init: ${result.reason === "interrupted" ? `interrupted: ${result.message}` : result.message}`); process.exitCode = result.reason === "refused" ? 1 : 0; return; }
|
|
1281
1316
|
requestedProfile = result.answers.profile; request = result.answers.request; asked = Object.keys(request.values).length > 0; shadow = result.answers.shadow; releaseGuard = result.answers.releaseGuard;
|
|
1282
1317
|
}
|
|
1283
1318
|
request = withInitResearch(cwd, request, initMachine?.researchEnabled);
|
|
1284
1319
|
try { request = await withInitChecks(cwd, request); } catch (error) { return fail((error as Error).message); }
|
|
1285
1320
|
// `--autonomy off` skips the machine inheritance on a new project; `inherit` is today's behaviour. Neither changes an existing project.
|
|
1286
1321
|
const inheritAutonomy = newProject && request.autonomy !== "off";
|
|
1287
|
-
if (!newProject && request.autonomy !== undefined)
|
|
1322
|
+
if (!newProject && request.autonomy !== undefined) warn("--autonomy applies to a new project only: this project already exists, so its autonomy settings are unchanged");
|
|
1288
1323
|
if (args.includes("--dry-run")) {
|
|
1289
1324
|
const plan = planInit(cwd, requestedProfile, shadow, releaseGuard, request);
|
|
1290
1325
|
const rows = initSettingRows(cwd, requestedProfile, shadow, releaseGuard, request);
|
|
1291
1326
|
const defaults = readAutonomyDefaults(hubHome(), [cwd]);
|
|
1292
1327
|
const inherit = inheritAutonomy ? autonomyInheritanceChange(cwd, defaults.enabled, request.autonomy) : undefined;
|
|
1293
1328
|
if (inherit) plan.push(inherit);
|
|
1294
|
-
if (defaults.notice)
|
|
1329
|
+
if (defaults.notice) warn(defaults.notice);
|
|
1295
1330
|
// #1627 A: the hub-owned jcode home is part of the plan, never written by a dry run.
|
|
1296
1331
|
const homePlan = args.includes("--no-jcode-home") ? undefined : initJcodeHome();
|
|
1297
1332
|
if (homePlan?.applicable) for (const line of homePlan.lines) plan.push({ action: homePlan.plan?.exists ? "modify" : "create", path: homePlan.plan!.home, reason: line.trim() });
|
|
@@ -1311,15 +1346,15 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1311
1346
|
const homeInit = initJcodeHome();
|
|
1312
1347
|
if (homeInit.applicable && homeInit.plan) {
|
|
1313
1348
|
for (const line of homeInit.lines) console.log(terminalText(line));
|
|
1314
|
-
if (homeInit.switchHome) { try { writeJcodeHomeConfig(cwd, homeInit.plan.home); console.log(`jcode_home now points at ${homeInit.plan.home}`); } catch (error) {
|
|
1349
|
+
if (homeInit.switchHome) { try { writeJcodeHomeConfig(cwd, homeInit.plan.home); console.log(`jcode_home now points at ${homeInit.plan.home}`); } catch (error) { warn((error as Error).message); process.exitCode = 1; } }
|
|
1315
1350
|
if (!homeInit.plan.exists) {
|
|
1316
|
-
if (jcodeHomeBlocked(homeInit.plan.home))
|
|
1351
|
+
if (jcodeHomeBlocked(homeInit.plan.home)) warn(`jcode home ${homeInit.plan.home} is not a plain directory: nothing was created there`);
|
|
1317
1352
|
else {
|
|
1318
1353
|
try {
|
|
1319
1354
|
applyJcodeHome(homeInit.plan);
|
|
1320
1355
|
const installed = installSkillsInJcodeHome(join(import.meta.dir, "..", "..", "plugins", "agent-hub", "skills"), homeInit.plan.home);
|
|
1321
1356
|
console.log(`wrote ${homeInit.plan.home}; hub skills: ${installed.filter(entry => entry.action === "install" || entry.action === "replace").length} installed`);
|
|
1322
|
-
} catch (error) {
|
|
1357
|
+
} catch (error) { warn(`jcode home was not fully set up: ${(error as Error).message}`); process.exitCode = 1; }
|
|
1323
1358
|
}
|
|
1324
1359
|
}
|
|
1325
1360
|
}
|
|
@@ -1362,9 +1397,9 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1362
1397
|
if (!args.includes("--no-agents") && !liveTest && caller.role === "console" && identity.role === "console" && !process.env.AGENTHUB_RECOVERY_OPERATION) {
|
|
1363
1398
|
try {
|
|
1364
1399
|
const chosen = effectiveStartAgents(cwd, loadConfig(cwd).start.agents, hubHome(), [cwd]);
|
|
1365
|
-
if (chosen.notice)
|
|
1400
|
+
if (chosen.notice) warn(chosen.notice);
|
|
1366
1401
|
for (const line of await startProjectAgents({ root: cwd, stateDir }, chosen.agents)) console.log(terminalText(line));
|
|
1367
|
-
} catch (error) {
|
|
1402
|
+
} catch (error) { warn(`default agents were not started: ${terminalText((error as Error).message)}`); }
|
|
1368
1403
|
}
|
|
1369
1404
|
if (process.stdin.isTTY && process.stdout.isTTY && !args.includes("--no-console")) await runConsole({ client: await connect(), cwd, stateDir, liveTest, installed: consoleInstalled() });
|
|
1370
1405
|
},
|
|
@@ -1595,7 +1630,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1595
1630
|
if (options.json) return console.log(JSON.stringify(result.deliveries, null, 2));
|
|
1596
1631
|
printOutput(renderQueue(result.deliveries, options.columns, Date.now()), options.color);
|
|
1597
1632
|
// #1096: rows a resolution already settled are history, hidden by default; say how many and how to see them, on stderr so a pipe of the table stays clean.
|
|
1598
|
-
if (result.hiddenSettled)
|
|
1633
|
+
if (result.hiddenSettled) warn(`${result.hiddenSettled} settled deliver${result.hiddenSettled === 1 ? "y" : "ies"} hidden (already resolved); ahub queue list --all shows them`);
|
|
1599
1634
|
return;
|
|
1600
1635
|
}
|
|
1601
1636
|
if (operation === "discard") {
|
|
@@ -1735,7 +1770,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1735
1770
|
const split = splitPresentation(args, { edges: true }), operands = split.operands;
|
|
1736
1771
|
const [sub, id, revision, value, ...reason] = operands;
|
|
1737
1772
|
const present = outputOptions(split.flags); // before any request: an invalid --color must refuse before a mutation is sent
|
|
1738
|
-
const shown = (render: (data: any, columns?: number, now?: number) => Span[][]) => async (text: Promise<string>) => showToolText(render, await text, present);
|
|
1773
|
+
const shown = (render: (data: any, columns?: number, now?: number, ascii?: boolean) => Span[][]) => async (text: Promise<string>) => showToolText(render, await text, present);
|
|
1739
1774
|
if (sub === "list" && outputArguments().length === 1) {
|
|
1740
1775
|
// #399: a table by default; --json prints the hub's listing unchanged, and a refusal is printed as it came.
|
|
1741
1776
|
const options = outputOptions(), raw = await taskOp("hub_backlog_list", {});
|
|
@@ -1750,24 +1785,24 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1750
1785
|
// #1177: `--reserved <peer>` / `--unreserve` edit the reservation atomically with the return (fields.reserved); with neither, the arguments are what they always were.
|
|
1751
1786
|
const returned = parseBacklogReturn(operands.slice(3));
|
|
1752
1787
|
if (!returned.ok) return fail(returned.error);
|
|
1753
|
-
return shown((data, columns, now) => renderBacklogResult("return-untouched", data, columns, now))(taskOp("hub_backlog_return_untouched", { id: Number(id), revision: Number(revision), reason: returned.value.reason, ...(returned.value.fields ? { fields: returned.value.fields } : {}) }));
|
|
1788
|
+
return shown((data, columns, now, ascii) => renderBacklogResult("return-untouched", data, columns, now, ascii))(taskOp("hub_backlog_return_untouched", { id: Number(id), revision: Number(revision), reason: returned.value.reason, ...(returned.value.fields ? { fields: returned.value.fields } : {}) }));
|
|
1754
1789
|
}
|
|
1755
1790
|
if (sub === "add" && args.length >= 3) return console.log(await taskOp("hub_task_propose", { class: id, title: args.slice(2).join(" "), backlog: true }));
|
|
1756
1791
|
if (!/^[1-9]\d*$/.test(id ?? "")) fail("usage: ahub backlog list|add <class> <title...>|pull|return <id>|plan|pin <id> <revision> <value> <reason...>|undo <id> <revision>");
|
|
1757
1792
|
if (["pull", "return"].includes(sub ?? "") && operands.length === 2) return console.log(await taskOp(sub === "pull" ? "backlog_pull" : "backlog_return", { id }));
|
|
1758
1793
|
if (!/^\d+$/.test(revision ?? "")) fail("planning revision is required");
|
|
1759
|
-
if (sub === "pull-ready" && operands.length >= 4) return shown((data, columns, now) => renderBacklogResult("pull-ready", data, columns, now))(taskOp("hub_backlog_pull", { id: Number(id), revision: Number(revision), reason: operands.slice(3).join(" ") }));
|
|
1794
|
+
if (sub === "pull-ready" && operands.length >= 4) return shown((data, columns, now, ascii) => renderBacklogResult("pull-ready", data, columns, now, ascii))(taskOp("hub_backlog_pull", { id: Number(id), revision: Number(revision), reason: operands.slice(3).join(" ") }));
|
|
1760
1795
|
if (sub === "split" && value && reason.length) {
|
|
1761
1796
|
let parts: unknown;try { parts=JSON.parse(value); } catch { return fail("split parts must be JSON"); }
|
|
1762
|
-
return shown((data, columns, now) => renderBacklogResult("split", data, columns, now))(taskOp("hub_backlog_split", { id: Number(id), revision: Number(revision), parts, reason: reason.join(" ") }));
|
|
1797
|
+
return shown((data, columns, now, ascii) => renderBacklogResult("split", data, columns, now, ascii))(taskOp("hub_backlog_split", { id: Number(id), revision: Number(revision), parts, reason: reason.join(" ") }));
|
|
1763
1798
|
}
|
|
1764
|
-
if (sub === "undo" && operands.length === 3) return shown((data, columns, now) => renderBacklogResult("undo", data, columns, now))(taskOp("hub_backlog_undo", { id: Number(id), revision: Number(revision) }));
|
|
1799
|
+
if (sub === "undo" && operands.length === 3) return shown((data, columns, now, ascii) => renderBacklogResult("undo", data, columns, now, ascii))(taskOp("hub_backlog_undo", { id: Number(id), revision: Number(revision) }));
|
|
1765
1800
|
if (!["plan", "pin", "person"].includes(sub ?? "") || !value || !reason.length) fail("planning needs fields and a reason");
|
|
1766
1801
|
let fields: unknown;
|
|
1767
1802
|
try { fields = sub === "pin" ? { pinned: value === "true" ? true : value === "false" ? false : undefined } : sub === "person" ? { needsPerson: value === "true" ? true : value === "false" ? false : undefined } : JSON.parse(value); }
|
|
1768
1803
|
catch { return fail("planning fields must be JSON"); }
|
|
1769
1804
|
if ((sub === "pin" || sub === "person") && value !== "true" && value !== "false") fail(`${sub} must be true or false`);
|
|
1770
|
-
return shown((data, columns, now) => renderBacklogResult(sub === "person" ? "plan" : sub as "plan" | "pin", data, columns, now))(taskOp("hub_backlog_plan", { id: Number(id), revision: Number(revision), fields, reason: reason.join(" ") }));
|
|
1805
|
+
return shown((data, columns, now, ascii) => renderBacklogResult(sub === "person" ? "plan" : sub as "plan" | "pin", data, columns, now, ascii))(taskOp("hub_backlog_plan", { id: Number(id), revision: Number(revision), fields, reason: reason.join(" ") }));
|
|
1771
1806
|
},
|
|
1772
1807
|
|
|
1773
1808
|
roadmap: async () => {
|
|
@@ -1788,7 +1823,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1788
1823
|
const split = splitPresentation(args, { edges: true }), operands = split.operands;
|
|
1789
1824
|
const [sub, name, revision, value] = operands;
|
|
1790
1825
|
const present = outputOptions(split.flags); // before any request: an invalid --color must refuse before a mutation is sent
|
|
1791
|
-
const shown = (render: (data: any, columns?: number, now?: number) => Span[][]) => async (text: Promise<string>) => showToolText(render, await text, present);
|
|
1826
|
+
const shown = (render: (data: any, columns?: number, now?: number, ascii?: boolean) => Span[][]) => async (text: Promise<string>) => showToolText(render, await text, present);
|
|
1792
1827
|
if (sub === "list" && operands.length === 1) return shown(renderReleaseList)(taskOp("hub_release_list", {}));
|
|
1793
1828
|
if (sub === "show" && name && operands.length === 2) return shown(renderReleaseShow)(taskOp("release_show", { name }));
|
|
1794
1829
|
if (sub === "new" && name && revision && operands.length === 4 && /^\d+$/.test(value ?? "")) return shown(renderReleaseNew)(taskOp("release_new", { name, goal: revision, order: Number(value) }));
|
|
@@ -1844,7 +1879,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1844
1879
|
if (liveTest && !["list", "status"].includes(args[0] ?? "")) fail(LIVE_TEST_PERSON_REFUSAL);
|
|
1845
1880
|
const { runRoomCommand, roomCommandError } = await import("./room.ts");
|
|
1846
1881
|
const hub = await connect();
|
|
1847
|
-
try { await runRoomCommand(args, message => hub.request(message)); }
|
|
1882
|
+
try { const look = outputOptions([]); await runRoomCommand(args, message => hub.request(message), undefined, { columns: look.columns, color: look.color, ascii: asciiMarkers(process.env, false) }); }
|
|
1848
1883
|
catch (error) { fail(roomCommandError(error)); }
|
|
1849
1884
|
finally { hub.close(); }
|
|
1850
1885
|
},
|
|
@@ -1865,7 +1900,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1865
1900
|
if (sub === "list" && rest.length === 0) {
|
|
1866
1901
|
const rows = registry.list();
|
|
1867
1902
|
if (options.json) return console.log(JSON.stringify(rows, null, 2));
|
|
1868
|
-
return printOutput(renderSourceList(rows, options.columns, Date.now()), options.color);
|
|
1903
|
+
return printOutput(renderSourceList(rows, options.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), options.color);
|
|
1869
1904
|
}
|
|
1870
1905
|
if (sub !== "add" || rest.length !== 1 || !rest[0]) return fail(SOURCE_USAGE);
|
|
1871
1906
|
const target = rest[0], config = projectConfig();
|
|
@@ -1889,7 +1924,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1889
1924
|
origin = absolute; kind = "file";
|
|
1890
1925
|
}
|
|
1891
1926
|
} catch (error) { return fail(`cannot register ${isUrl ? "that URL" : target}: ${(error as Error).message}`); }
|
|
1892
|
-
const projections = new TextProjections({ cwd, stateDir, config: config.text_projection ?? {}, deny: config.local.deny, readAllow: config.local.read_allow, log: line =>
|
|
1927
|
+
const projections = new TextProjections({ cwd, stateDir, config: config.text_projection ?? {}, deny: config.local.deny, readAllow: config.local.read_allow, log: line => warn(line) });
|
|
1893
1928
|
const extension = /\.[A-Za-z0-9]{1,16}$/.exec(isUrl ? new URL(origin).pathname : origin)?.[0] ?? "";
|
|
1894
1929
|
let converted: ProjectedText | undefined;
|
|
1895
1930
|
const verdict = screenRegistration({ bytes, kind, ...(absolute ? { path: absolute, typedPath: resolve(cwd, target) } : {}) }, {
|
|
@@ -1904,7 +1939,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1904
1939
|
if (!meta) return fail(`the record for ${added.id} cannot be read after it was registered; inspect ${join(stateDir, "sources")}`);
|
|
1905
1940
|
const result = { id: added.id, created: added.created, upgraded: added.upgraded, kind: meta.kind, origin: meta.origin, sha256: meta.sha256, bytes: meta.bytes, private: meta.private, text: added.text, reasons: verdict.reasons };
|
|
1906
1941
|
if (options.json) return console.log(JSON.stringify(result, null, 2));
|
|
1907
|
-
printOutput(renderSourceAdd(result, options.columns), options.color);
|
|
1942
|
+
printOutput(renderSourceAdd(result, options.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), options.color);
|
|
1908
1943
|
},
|
|
1909
1944
|
|
|
1910
1945
|
schedule: async () => {
|
|
@@ -1914,10 +1949,10 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1914
1949
|
const present = outputOptions(split.flags); // before any request: an invalid --color must refuse before a mutation is sent
|
|
1915
1950
|
const [sub, id, ...extra] = split.operands;
|
|
1916
1951
|
const usage = "usage: ahub schedule list | run <id> | pause <id> | resume <id> [--json] [--color=auto|always|never]";
|
|
1917
|
-
if (sub === "list" && id === undefined) return showToolText(data => renderScheduleList(data, present.columns,
|
|
1952
|
+
if (sub === "list" && id === undefined) return showToolText((data, _c, now, ascii) => renderScheduleList(data, present.columns, now, ascii), await taskOp("schedule_list", {}), present);
|
|
1918
1953
|
if (!["run", "pause", "resume"].includes(sub ?? "") || !id || extra.length) return fail(usage);
|
|
1919
|
-
if (sub === "run") return showToolText(data => renderScheduleRun(data, present.columns), await taskOp("schedule_run", { id }, false, undefined, 90_000), present);
|
|
1920
|
-
return showToolText(data => renderScheduleChange(sub as "pause" | "resume", data, present.columns,
|
|
1954
|
+
if (sub === "run") return showToolText((data, _c, now, ascii) => renderScheduleRun(data, present.columns, now, ascii), await taskOp("schedule_run", { id }, false, undefined, 90_000), present);
|
|
1955
|
+
return showToolText((data, _c, now, ascii) => renderScheduleChange(sub as "pause" | "resume", data, present.columns, now, ascii), await taskOp(sub === "pause" ? "schedule_pause" : "schedule_resume", { id }), present);
|
|
1921
1956
|
},
|
|
1922
1957
|
|
|
1923
1958
|
study: async () => {
|
|
@@ -1929,27 +1964,27 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1929
1964
|
const parsed = parseStudyArgs(split.operands);
|
|
1930
1965
|
if ("usage" in parsed) return fail(parsed.usage);
|
|
1931
1966
|
|
|
1932
|
-
if (parsed.op === "evidence") return showToolText(data => renderStudyEvidence(data, present.columns), await taskOp("hub_evidence_read", { id: parsed.id, ...(parsed.revision === undefined ? {} : { revision: parsed.revision }) }), present);
|
|
1933
|
-
if (parsed.op === "evidence_inventory") return showToolText(data => renderStudyEvidence(data, present.columns), await taskOp("study_evidence", { taskId: parsed.taskId }), present);
|
|
1967
|
+
if (parsed.op === "evidence") return showToolText((data, _c, now, ascii) => renderStudyEvidence(data, present.columns, now, ascii), await taskOp("hub_evidence_read", { id: parsed.id, ...(parsed.revision === undefined ? {} : { revision: parsed.revision }) }), present);
|
|
1968
|
+
if (parsed.op === "evidence_inventory") return showToolText((data, _c, now, ascii) => renderStudyEvidence(data, present.columns, now, ascii), await taskOp("study_evidence", { taskId: parsed.taskId }), present);
|
|
1934
1969
|
if (parsed.op === "check") {
|
|
1935
1970
|
const manifest = parseSynthesisManifest(contract(parsed.file, "manifest"));
|
|
1936
1971
|
if (manifest.taskId !== parsed.taskId) return fail("synthesis manifest names another task; refresh its task binding and retry");
|
|
1937
1972
|
const text = await taskOp("study_check", { taskId: parsed.taskId, manifest });
|
|
1938
|
-
showToolText(data => renderSynthesisReadiness(data, present.columns), text, present);
|
|
1973
|
+
showToolText((data, _c, now, ascii) => renderSynthesisReadiness(data, present.columns, now, ascii), text, present);
|
|
1939
1974
|
if (JSON.parse(text).status !== "ready") process.exitCode = 1;
|
|
1940
1975
|
return;
|
|
1941
1976
|
}
|
|
1942
1977
|
if (parsed.op === "experiments") {
|
|
1943
1978
|
// A read of the records Tasks keeps (hub_experiment_show): it runs no command and reads no file, and the hub blanks a private record itself.
|
|
1944
1979
|
const args = parsed.attempt ? { attemptId: parsed.attempt, ...(parsed.eventsAfter === undefined ? {} : { eventAfter: parsed.eventsAfter }) } : parsed.plan ? { planHash: parsed.plan, baselineAttemptId: parsed.baseline, variantAttemptId: parsed.variant } : { campaignId: parsed.campaign, ...(parsed.after === undefined ? {} : { after: parsed.after }) };
|
|
1945
|
-
return showToolText(data => renderExperiments(data, present.columns), await taskOp("hub_experiment_show", args), present);
|
|
1980
|
+
return showToolText((data, _c, now, ascii) => renderExperiments(data, present.columns, now, ascii), await taskOp("hub_experiment_show", args), present);
|
|
1946
1981
|
}
|
|
1947
|
-
if (parsed.op === "show") return showToolText(data => parsed.id ? renderStudyShow(data, present.columns) : renderStudyList(data, present.columns), await taskOp("hub_study_show", parsed.id ? { id: parsed.id } : parsed.after ? { after: parsed.after } : {}), present);
|
|
1982
|
+
if (parsed.op === "show") return showToolText((data, _c, now, ascii) => parsed.id ? renderStudyShow(data, present.columns, now, ascii) : renderStudyList(data, present.columns, now, ascii), await taskOp("hub_study_show", parsed.id ? { id: parsed.id } : parsed.after ? { after: parsed.after } : {}), present);
|
|
1948
1983
|
const request = parsed.op === "draft" ? { parentTaskId: parsed.parentTaskId, contract: contract(parsed.file) }
|
|
1949
1984
|
: parsed.op === "revise" ? { id: parsed.id, revision: parsed.revision, contract: contract(parsed.file) }
|
|
1950
1985
|
: parsed.op === "approve_protocol" ? { hash: parsed.hash }
|
|
1951
1986
|
: parsed.op === "approve" ? { id: parsed.id, revision: parsed.revision } : { id: parsed.id, revision: parsed.revision, reason: parsed.reason };
|
|
1952
|
-
return showToolText(data => renderStudyReceipt(parsed.op, data, present.columns), await taskOp(`study_${parsed.op}`, request, false, undefined, parsed.op === "approve" ? 90_000 : undefined), present);
|
|
1987
|
+
return showToolText((data, _c, now, ascii) => renderStudyReceipt(parsed.op, data, present.columns, now, ascii), await taskOp(`study_${parsed.op}`, request, false, undefined, parsed.op === "approve" ? 90_000 : undefined), present);
|
|
1953
1988
|
},
|
|
1954
1989
|
|
|
1955
1990
|
capabilities: async () => {
|
|
@@ -1957,7 +1992,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1957
1992
|
const split = splitPresentation(args);
|
|
1958
1993
|
const present = outputOptions(split.flags);
|
|
1959
1994
|
if (split.operands.length) return fail("usage: ahub capabilities [--json] [--color=auto|always|never]");
|
|
1960
|
-
return showToolText(data => renderCapabilities(data, present.columns), await taskOp("capabilities_list", {}), present);
|
|
1995
|
+
return showToolText((data, _c, now, ascii) => renderCapabilities(data, present.columns, now, ascii), await taskOp("capabilities_list", {}), present);
|
|
1961
1996
|
},
|
|
1962
1997
|
learn: async () => {
|
|
1963
1998
|
// #514b: the person's verdict on a recurring-criterion candidate (#514a). Person only, end to end: `learn` is a `console` command for an agent shell (classifyPeerCommand has no entry for it, so the
|
|
@@ -1965,15 +2000,17 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1965
2000
|
// config through the settings writer; nothing in a card's text is written.
|
|
1966
2001
|
const split = splitPresentation(args);
|
|
1967
2002
|
const present = outputOptions(split.flags); // before any request: an invalid --color must refuse before a mutation is sent
|
|
1968
|
-
const usage = "usage: ahub learn list [--all] | accept <id> | reject <id> [--json] [--color=auto|always|never]";
|
|
2003
|
+
const usage = "usage: ahub learn list [--all] [--accepted] | accept <id> | reject <id> [--json] [--color=auto|always|never]";
|
|
1969
2004
|
const [sub, ...rest] = split.operands;
|
|
1970
|
-
if (sub === "list" && rest.every(arg => arg === "--all")) {
|
|
1971
|
-
const all = rest.includes("--all");
|
|
1972
|
-
|
|
2005
|
+
if (sub === "list" && rest.every(arg => arg === "--all" || arg === "--accepted")) {
|
|
2006
|
+
const all = rest.includes("--all"), accepted = rest.includes("--accepted");
|
|
2007
|
+
// #1642 T2: `--accepted` is the outcome view of the lines already accepted, so --all (the decided candidates) has nothing to add there.
|
|
2008
|
+
if (all && accepted) return fail("usage: ahub learn list [--all] [--accepted] (pass one of them)");
|
|
2009
|
+
return showToolText((data, _c, _now, ascii) => renderLearnList(data, present.columns, all, accepted, ascii), await taskOp("learn_list", { ...(all ? { all: true } : {}), ...(accepted ? { accepted: true } : {}) }), present);
|
|
1973
2010
|
}
|
|
1974
2011
|
const [id, ...extra] = rest;
|
|
1975
2012
|
if ((sub !== "accept" && sub !== "reject") || !id || extra.length || !/^[1-9]\d*$/.test(id)) return fail(usage);
|
|
1976
|
-
return showToolText(data => renderLearnChange(sub, data, present.columns), await taskOp(sub === "accept" ? "learn_accept" : "learn_reject", { id: Number(id) }), present);
|
|
2013
|
+
return showToolText((data, _c, now, ascii) => renderLearnChange(sub, data, present.columns, now, ascii), await taskOp(sub === "accept" ? "learn_accept" : "learn_reject", { id: Number(id) }), present);
|
|
1977
2014
|
},
|
|
1978
2015
|
|
|
1979
2016
|
intake: async () => {
|
|
@@ -1990,10 +2027,10 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
1990
2027
|
const [sub, id] = words;
|
|
1991
2028
|
if ((sub === "approve" || sub === "discard") && words.length === 2 && !sources.length) {
|
|
1992
2029
|
if (!/^[1-9]\d*$/.test(id!)) return fail(usage);
|
|
1993
|
-
return showToolText(data => renderIntakeChange(sub, data, present.columns), await taskOp(sub === "approve" ? "intake_approve" : "intake_discard", { id: Number(id) }), present);
|
|
2030
|
+
return showToolText((data, _c, now, ascii) => renderIntakeChange(sub, data, present.columns, now, ascii), await taskOp(sub === "approve" ? "intake_approve" : "intake_discard", { id: Number(id) }), present);
|
|
1994
2031
|
}
|
|
1995
2032
|
if (words.length !== 1 || !words[0]!.trim()) return fail(usage);
|
|
1996
|
-
return showToolText(data => renderIntake(data, present.columns), await taskOp("intake", { text: words[0], ...(sources.length ? { sources } : {}) }, false, undefined, 90_000), present);
|
|
2033
|
+
return showToolText((data, _c, now, ascii) => renderIntake(data, present.columns, now, ascii), await taskOp("intake", { text: words[0], ...(sources.length ? { sources } : {}) }, false, undefined, 90_000), present);
|
|
1997
2034
|
},
|
|
1998
2035
|
|
|
1999
2036
|
deliverables: async () => {
|
|
@@ -2028,7 +2065,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2028
2065
|
if (args[0] === "--handoffs" || args.includes("--handoffs")) {
|
|
2029
2066
|
// #604: what this project handed to other projects and the last state each reported (read-only).
|
|
2030
2067
|
const options = outputOptions();
|
|
2031
|
-
return showToolText(data => renderHandoffs(data, options.columns), await taskOp("hub_task_handoffs", {}), options);
|
|
2068
|
+
return showToolText((data, _c, now, ascii) => renderHandoffs(data, options.columns, now, ascii), await taskOp("hub_task_handoffs", {}), options);
|
|
2032
2069
|
}
|
|
2033
2070
|
const options = outputOptions();
|
|
2034
2071
|
const { one, rest } = takeFlags(args, ["--release", "--release-id"], []);
|
|
@@ -2050,7 +2087,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2050
2087
|
catch (error) {
|
|
2051
2088
|
if (byColumn) fail("board column dependency context unavailable; retry with a complete snapshot");
|
|
2052
2089
|
allTasks = null;
|
|
2053
|
-
|
|
2090
|
+
warn(`dependency stages unavailable; showing filtered rows without stages: ${String((error as Error).message).replace(/[\n\t]/g, " ")}`);
|
|
2054
2091
|
}
|
|
2055
2092
|
}
|
|
2056
2093
|
if (byColumn) {
|
|
@@ -2062,7 +2099,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2062
2099
|
sdlc: async () => {
|
|
2063
2100
|
const args = sdlcOperands(), present = SDLC_READ.includes(args[0] ?? "") ? outputOptions() : undefined;
|
|
2064
2101
|
/** The human form (#814). Each site keeps its own `if (present.json) console.log(JSON.stringify(...))`, so the JSON branch stays visible to the guard test. */
|
|
2065
|
-
const human = (render: (data: any, columns?: number, now?: number) => Span[][], data: unknown) => printOutput(render(data, present!.columns, Date.now()), present!.color);
|
|
2102
|
+
const human = (render: (data: any, columns?: number, now?: number, ascii?: boolean) => Span[][], data: unknown) => printOutput(render(data, present!.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), present!.color);
|
|
2066
2103
|
const sub = args[0], id = args[1] === undefined ? undefined : Number(args[1]);
|
|
2067
2104
|
if (sub === "configure") {
|
|
2068
2105
|
const parsed = takeFlags(args.slice(1), ["--mode", "--required-checks"], []);
|
|
@@ -2207,13 +2244,13 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2207
2244
|
if (sub === "costs") {
|
|
2208
2245
|
if (args.length > 2) fail("usage: ahub sdlc costs [owner/repository]");
|
|
2209
2246
|
const text = await taskOp("hub_sdlc_costs", { ...(args[1] ? { repo: args[1] } : {}) });
|
|
2210
|
-
return showToolText(renderSdlcCosts, text, present!);
|
|
2247
|
+
return showToolText((data, columns, now) => renderSdlcCosts(data, columns, now, asciiMarkers(process.env, process.argv.includes("--ascii"))), text, present!);
|
|
2211
2248
|
}
|
|
2212
2249
|
if (sub === "metrics") {
|
|
2213
2250
|
const flags = takeFlags(args.slice(1), ["--since"], []);
|
|
2214
2251
|
if (flags.rest.length) fail("usage: ahub sdlc metrics [--since <YYYY-MM-DD|ISO time>]");
|
|
2215
2252
|
const text = await taskOp("hub_sdlc_metrics", { ...(flags.one["--since"] !== undefined ? { since: flags.one["--since"] } : {}) });
|
|
2216
|
-
return showToolText(renderSdlcMetrics, text, present!);
|
|
2253
|
+
return showToolText((data, columns, now) => renderSdlcMetrics(data, columns, now, asciiMarkers(process.env, process.argv.includes("--ascii"))), text, present!);
|
|
2217
2254
|
}
|
|
2218
2255
|
if (sub === "plan-review") {
|
|
2219
2256
|
const revision = Number(args[2]);
|
|
@@ -2263,11 +2300,43 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2263
2300
|
if (!reply.ok) fail(reply.error);
|
|
2264
2301
|
const view = { task: reply.task, mode: reply.mode, ran: reply.ran, decision: reply.decision, ...(reply.argv ? { argv: reply.argv } : {}), ...(reply.refused ? { refused: reply.refused } : {}), ...(reply.result ? { result: reply.result } : {}) };
|
|
2265
2302
|
if (display.json) console.log(JSON.stringify(view, null, 2));
|
|
2266
|
-
else printOutput(renderSdlcMerge(view, display.columns, Date.now()), display.color);
|
|
2303
|
+
else printOutput(renderSdlcMerge(view, display.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), display.color);
|
|
2267
2304
|
if (reply.decision === "refused" || reply.ran && reply.result?.state !== "merged") process.exitCode = 1;
|
|
2268
2305
|
} finally { hub.close(); }
|
|
2269
2306
|
return;
|
|
2270
2307
|
}
|
|
2308
|
+
if (sub === "readback") {
|
|
2309
|
+
// #1658: a read-back is a report for the person, started and read by the person or the current conductor.
|
|
2310
|
+
const options = outputOptions(), words = outputArguments(), op = words[1], target = words[2];
|
|
2311
|
+
if (!["start", "show"].includes(op ?? "") || words.length !== 3) fail("usage: ahub sdlc readback start <task> [--json] | ahub sdlc readback show <task> [--json]");
|
|
2312
|
+
const task = Number(target);
|
|
2313
|
+
if (!Number.isSafeInteger(task) || task <= 0) fail("usage: ahub sdlc readback start <task> [--json] | ahub sdlc readback show <task> [--json]");
|
|
2314
|
+
const hub = await connect();
|
|
2315
|
+
try {
|
|
2316
|
+
const reply = await hub.request({ t: "sdlc", op: op === "start" ? "readback-start" : "readback-show", id: task }, 30_000);
|
|
2317
|
+
if (!reply.ok) fail(reply.error, false, undefined, `check ahub sdlc status ${task} for the task's lifecycle receipt, then retry`);
|
|
2318
|
+
const view = reply.readback;
|
|
2319
|
+
if (options.json) return console.log(JSON.stringify(op === "start" ? reply : view ?? null, null, 2));
|
|
2320
|
+
if (op === "start") {
|
|
2321
|
+
const state = String(reply.state ?? "");
|
|
2322
|
+
console.log(state === "requested" || state === "reported"
|
|
2323
|
+
? `task #${task}: spec read-back ${reply.readback} ${state === "reported" ? "already reported" : "requested"}${state === "requested" ? ` from ${reply.reader}` : ""} (${reply.repo}#${reply.issue})`
|
|
2324
|
+
: `task #${task}: spec read-back unavailable: ${reply.reason ?? "no eligible reader"}`);
|
|
2325
|
+
return;
|
|
2326
|
+
}
|
|
2327
|
+
if (!view || view.status === "none") return console.log(`task #${task}: no spec read-back; start one with ahub sdlc readback start ${task}`);
|
|
2328
|
+
if (view.status === "private") return console.log(`task #${task}: read-back ${view.readback} belongs to a private task; its report is not printed here`);
|
|
2329
|
+
if (view.status === "requested") return console.log(`task #${task}: read-back ${view.readback} requested from ${view.reader}; the reader has not reported yet`);
|
|
2330
|
+
console.log(`task #${task}: read-back ${view.readback} of ${view.repo}#${view.issue} by ${view.reader}`);
|
|
2331
|
+
if (view.report.cannot_paraphrase) console.log(`cannot paraphrase: ${view.report.cannot_paraphrase}`);
|
|
2332
|
+
else { console.log(`proposes: ${view.report.proposes}`); console.log(`existing: ${view.report.existing}`); }
|
|
2333
|
+
for (const item of view.report.undefined ?? []) console.log(`undefined: ${item.term} (${item.where})`);
|
|
2334
|
+
for (const item of view.report.open_decisions ?? []) console.log(`open decision: ${item.decision} (${item.where})`);
|
|
2335
|
+
for (const path of view.report.refs ?? []) console.log(`ref: ${path}`);
|
|
2336
|
+
for (const path of view.missing_refs ?? []) console.log(`missing ref: ${path}`);
|
|
2337
|
+
} finally { hub.close(); }
|
|
2338
|
+
return;
|
|
2339
|
+
}
|
|
2271
2340
|
if (sub === "accept") {
|
|
2272
2341
|
// #481 S1: the person accepts the task's spec issue at its current body; agent shells are refused before this runs.
|
|
2273
2342
|
const flags = takeFlags(args.slice(2), ["--issue", "--repo"], []);
|
|
@@ -2277,6 +2346,8 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2277
2346
|
try {
|
|
2278
2347
|
const reply = await hub.request({ t: "sdlc", op: "accept", id, issue, ...(repo ? { repo } : {}) }, 30_000);
|
|
2279
2348
|
if (!reply.ok) fail(reply.error);
|
|
2349
|
+
// #1658 AC6: the line names the read-back state read before the acceptance; the acceptance proceeds in every state.
|
|
2350
|
+
if (reply.readback) console.log(reply.readback);
|
|
2280
2351
|
console.log(`task #${id}: spec issue #${issue} accepted at body edit ${reply.acceptance?.lastEditedAt ?? "never"}`);
|
|
2281
2352
|
} finally { hub.close(); }
|
|
2282
2353
|
return;
|
|
@@ -2300,7 +2371,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2300
2371
|
|
|
2301
2372
|
task: async () => {
|
|
2302
2373
|
const presentation = splitPresentation(args, { valueFlags: ["--reason", "--superseded-by", "--revision"], edges: true });
|
|
2303
|
-
const shownTask = (render: (data: any, columns?: number, now?: number) => Span[][]) => async (text: Promise<string>) => showToolText(render, await text, outputOptions(presentation.flags));
|
|
2374
|
+
const shownTask = (render: (data: any, columns?: number, now?: number, ascii?: boolean) => Span[][]) => async (text: Promise<string>) => showToolText(render, await text, outputOptions(presentation.flags));
|
|
2304
2375
|
// task show and task cancel read their presentation options before the request goes out (a refusal after a cancel would invite a retry of work already done)
|
|
2305
2376
|
if (["show", "cancel"].includes(args[0] ?? "")) outputOptions(presentation.flags);
|
|
2306
2377
|
const [sub, ...rest] = ["show", "cancel"].includes(args[0] ?? "") ? presentation.operands : args;
|
|
@@ -2376,9 +2447,9 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2376
2447
|
const parsed = parseHandoffArgs(splitPresentation(rest, { valueFlags: ["--project", "--path", "--issue", "--task", "--detail", "--duplicate-ok", "--key"], edges: true }).operands);
|
|
2377
2448
|
if ("usage" in parsed) return fail(parsed.usage);
|
|
2378
2449
|
// #734: the person's list (age and reachability of each target) and sync (ask the targets now); both read the same rows `ahub board --handoffs` shows.
|
|
2379
|
-
if ("view" in parsed) return showToolText(data => renderHandoffs(data, present.columns), await taskOp(parsed.view === "sync" ? "hub_task_handoff_sync" : "hub_task_handoffs", {}), present);
|
|
2450
|
+
if ("view" in parsed) return showToolText((data, _c, now, ascii) => renderHandoffs(data, present.columns, now, ascii), await taskOp(parsed.view === "sync" ? "hub_task_handoff_sync" : "hub_task_handoffs", {}), present);
|
|
2380
2451
|
const text = await taskOp("hub_task_handoff", { ...parsed });
|
|
2381
|
-
return showToolText(data => renderHandoffReceipt(data, present.columns), text, present);
|
|
2452
|
+
return showToolText((data, _c, now, ascii) => renderHandoffReceipt(data, present.columns, now, ascii), text, present);
|
|
2382
2453
|
}
|
|
2383
2454
|
if (sub !== "propose" || rest.length < 1) fail("usage: ahub task propose [<class>] <title...> | show <id> | assign <id> <peer> | unassign <id> | cancel <id> --reason <text> | escalate <id> | handoff --project <root|id> <title...>");
|
|
2384
2455
|
// `--class` is the explicit form. A first word that is a class name is still taken as the class (the documented
|
|
@@ -2392,7 +2463,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2392
2463
|
const textWords = withoutSeparator(flags.rest);
|
|
2393
2464
|
const cls = flags.one["--class"] ?? (positional ? textWords[0] : undefined);
|
|
2394
2465
|
const title = (positional ? textWords.slice(1) : textWords).join(" ");
|
|
2395
|
-
if (positional)
|
|
2466
|
+
if (positional) warn(`"${cls}" was taken as the class and left out of the title`, "use --class <c> when the title itself starts with that word");
|
|
2396
2467
|
console.log(await taskOp("hub_task_propose", { ...(cls ? { class: cls } : {}), title, owner: flags.one["--owner"], detail: flags.one["--detail"], ...(flags.many["--path"]?.length ? { refs: { paths: flags.many["--path"] } } : {}), ...(flags.many["--after"]?.length ? { after: flags.many["--after"].map(Number) } : {}), ...(urgent ? { urgent: true } : {}), ...(needsNetwork ? { needs_network: true } : {}), ...(needsWorktree ? { needs_worktree: true } : {}), ...(backlog ? { backlog: true } : {}) }));
|
|
2397
2468
|
},
|
|
2398
2469
|
|
|
@@ -2508,7 +2579,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2508
2579
|
if (positional.length > 2 || positional.some(arg => arg.startsWith("--")) || (mode !== undefined && !isPermissionMode(mode))) fail("usage: ahub permission [<peer> [ask|ask-when-needed|never-ask]] [--yes]");
|
|
2509
2580
|
if (mode === "never-ask" && !args.includes("--yes")) fail("never-ask requires --yes; nothing was changed");
|
|
2510
2581
|
const { scope: permissionScope, error: permissionScopeError } = localDeclarations();
|
|
2511
|
-
if (mode === "never-ask" && peer)
|
|
2582
|
+
if (mode === "never-ask" && peer) warn(`never-ask: ${permissionBoundary(peer, permissionScope.instances, permissionScope.catalog)}: approval prompts are disabled${permissionScopeError ? ` (project config unreadable: ${permissionScopeError})` : ""}`);
|
|
2512
2583
|
const hub = await connect();
|
|
2513
2584
|
try {
|
|
2514
2585
|
const reply = await hub.request({ t: "permission", ...(peer ? { peer } : {}), ...(mode ? { mode, confirmed: args.includes("--yes") } : {}) }, 35_000);
|
|
@@ -2666,7 +2737,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2666
2737
|
const peer = def?.group === "Permissions" || def?.group === "Roster" ? def.path.at(-1)! : undefined;
|
|
2667
2738
|
if (sub === "set" && value === "never-ask" && !flags.includes("--preview")) {
|
|
2668
2739
|
if (!flags.includes("--yes")) fail("never-ask requires --yes; nothing was changed");
|
|
2669
|
-
|
|
2740
|
+
warn(`never-ask: ${permissionBoundary(peer!, settingScope.instances, settingScope.catalog)}: approval prompts are disabled`);
|
|
2670
2741
|
}
|
|
2671
2742
|
const hub = await connect();
|
|
2672
2743
|
try {
|
|
@@ -2889,7 +2960,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
2889
2960
|
const quota = await hub.request({ t: "budget" });
|
|
2890
2961
|
// CLI output standard v1: the default view answers "is it OK, and what do I do next"; every detail the older view printed stays behind --verbose (and --full, which adds the long ids).
|
|
2891
2962
|
const data = { ...status, budget: quota.budget ?? {} };
|
|
2892
|
-
printOutput(options.verbose || options.full ? renderStatus(data, options.columns, Date.now(), options.full) : renderStatusDefault(data, options.columns, Date.now(), asciiMarkers(process.env, args.includes("--ascii"))), options.color);
|
|
2963
|
+
printOutput(options.verbose || options.full ? renderStatus(data, options.columns, Date.now(), options.full, asciiMarkers(process.env, args.includes("--ascii"))) : renderStatusDefault(data, options.columns, Date.now(), asciiMarkers(process.env, args.includes("--ascii"))), options.color);
|
|
2893
2964
|
if (status.needs) { const pet = loadPetConfig(cwd); if (pet.enabled) console.log(renderPet(petView(status), false, pet.character)); }
|
|
2894
2965
|
// #258: open long-term tasks and who holds them, as of this machine's last memory sync.
|
|
2895
2966
|
if (status.memoryProfile ? status.memoryProfile.state === "ready" : memoryIndexExists(join(hubHome(), "memory"))) {
|
|
@@ -3058,7 +3129,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3058
3129
|
const events = readEvents(join(stateDir, "events.jsonl"), since());
|
|
3059
3130
|
const data = by >= 0 ? summarizeByTask(events) : summarize(events);
|
|
3060
3131
|
if (options.json) return console.log(JSON.stringify(data, null, 2));
|
|
3061
|
-
printOutput(renderReport(data, options.columns, Date.now(), by >= 0), options.color);
|
|
3132
|
+
printOutput(renderReport(data, options.columns, Date.now(), by >= 0, asciiMarkers(process.env, args.includes("--ascii"))), options.color);
|
|
3062
3133
|
},
|
|
3063
3134
|
specs: async () => {
|
|
3064
3135
|
if (args[0] !== "stamp") { process.exitCode = runSpecs(args, cwd, loadConfig(cwd).specs); return; }
|
|
@@ -3083,15 +3154,15 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3083
3154
|
const reply = await hub.request({ t: "worktrees" }, 20_000);
|
|
3084
3155
|
hub.close();
|
|
3085
3156
|
if (!reply.ok) return fail(String(reply.error ?? "the worktree shelf is unavailable"));
|
|
3086
|
-
if (!sub) return options.json ? console.log(JSON.stringify({ live: reply.live, settled: reply.settled, complete: reply.complete }, null, 2)) : printOutput(renderWorktrees(reply, options.columns, Date.now()), options.color);
|
|
3157
|
+
if (!sub) return options.json ? console.log(JSON.stringify({ live: reply.live, settled: reply.settled, complete: reply.complete }, null, 2)) : printOutput(renderWorktrees(reply, options.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), options.color);
|
|
3087
3158
|
// tidy: read-only git in this process to decide what is safe; the daemon only said which rows are settled.
|
|
3088
3159
|
const git: TidyGit = realTidyGit((argv, dir) => { const run = hubGitSync(argv, { cwd: dir, encoding: "utf8", timeout: 20_000, maxBuffer: 4 * 1024 * 1024, env: hubGitEnv(process.env, { repositoryIsolation: true }) }); return run.error ? undefined : { status: run.status, stdout: String(run.stdout ?? "") }; });
|
|
3089
3160
|
const plan = planTidy(rowsFromReply(reply.settled ?? [], cwd, git), cwd, git);
|
|
3090
|
-
if (at < 0) return options.json ? console.log(JSON.stringify({ entries: plan.entries, removable: plan.removable, fingerprint: plan.fingerprint }, null, 2)) : printOutput(renderTidyPreview(plan, options.columns), options.color);
|
|
3161
|
+
if (at < 0) return options.json ? console.log(JSON.stringify({ entries: plan.entries, removable: plan.removable, fingerprint: plan.fingerprint }, null, 2)) : printOutput(renderTidyPreview(plan, options.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), options.color);
|
|
3091
3162
|
const result = confirmTidy(plan, fingerprint!, cwd, git);
|
|
3092
3163
|
if (!result.ok) return fail(result.error);
|
|
3093
3164
|
if (options.json) return console.log(JSON.stringify({ outcomes: result.outcomes }, null, 2));
|
|
3094
|
-
printOutput(renderTidyResult(result.outcomes, options.columns), options.color);
|
|
3165
|
+
printOutput(renderTidyResult(result.outcomes, options.columns, Date.now(), asciiMarkers(process.env, process.argv.includes("--ascii"))), options.color);
|
|
3095
3166
|
},
|
|
3096
3167
|
usage: async () => {
|
|
3097
3168
|
const options = outputOptions();
|
|
@@ -3252,7 +3323,7 @@ const commands: Record<string, () => Promise<void> | void> = {
|
|
|
3252
3323
|
// "changed no files" is true of the files the hub observes and false of the turn: with a submodule dirty it says what it can and cannot see instead.
|
|
3253
3324
|
console.log((first.restore.length ? `turn ${id} changed:\n ${first.restore.join("\n ")}` : unobserved.length ? `turn ${id} changed no files the hub can restore` : `turn ${id} changed no files`) + unobservedNote);
|
|
3254
3325
|
console.log("(every change made in the project during the turn counts as its own, including any by Claude or by you)");
|
|
3255
|
-
const projections = new TextProjections({ cwd: undoCwd, stateDir, config: undoConfig.text_projection ?? {}, deny: undoConfig.local.deny, readAllow: undoConfig.local.read_allow, log: line =>
|
|
3326
|
+
const projections = new TextProjections({ cwd: undoCwd, stateDir, config: undoConfig.text_projection ?? {}, deny: undoConfig.local.deny, readAllow: undoConfig.local.read_allow, log: line => warn(line) });
|
|
3256
3327
|
const preview = projectedDiff({ repo, from: endTree, to: startTree, paths: first.restore, projections, deny: undoConfig.local.deny, privatePath: path => matchesPolicy(undoCwd, join(repo.top, path), undoConfig.pii?.paths ?? []) });
|
|
3257
3328
|
if (preview) console.log(terminalText("Undo preview (end snapshot to start snapshot):\n" + preview));
|
|
3258
3329
|
|
|
@@ -3701,7 +3772,7 @@ async function runConductorCommand(): Promise<void> {
|
|
|
3701
3772
|
const external = selection.peer !== cmd && (peerConfig.declaredExternalInstances?.some(row => row.id === selection.peer && row.kind === cmd)
|
|
3702
3773
|
|| projectCatalog.externalDefinitions.some(definition => definition.kind === cmd));
|
|
3703
3774
|
if (external) fail("external module instances require an explicit person start");
|
|
3704
|
-
await requireActiveConfiguredAcp(hub, cmd, selection.peer, text =>
|
|
3775
|
+
await requireActiveConfiguredAcp(hub, cmd, selection.peer, text => warn(text));
|
|
3705
3776
|
console.log(await taskOp("hub_peer_start", { peer: selection.peer, mode: "headless" }, false, hub, 70_000));
|
|
3706
3777
|
} finally { hub.close(); }
|
|
3707
3778
|
return;
|