feat: 添加 autonomy 自主模式命令系统

- 新增 autonomy CLI handler 和交互式面板
- 新增 autonomyCommandSpec 命令规范定义
- 新增 autonomyAuthority 权限控制
- 新增 autonomyStatus 状态管理
- 注册 CLI 子命令 (claude autonomy status/runs/flows/flow)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
unraid
2026-04-22 22:38:09 +08:00
parent 31b2fdd97a
commit c4775fff58
10 changed files with 1152 additions and 163 deletions

View File

@@ -6429,6 +6429,68 @@ async function run(): Promise<CommanderCommand> {
}
}
// claude autonomy — CLI subcommands mirroring /autonomy slash command
{
const autonomyCmd = program
.command("autonomy")
.description("Inspect and manage automatic autonomy runs and flows");
autonomyCmd
.command("status")
.description("Print autonomy run, flow, team, pipe, and remote-control status")
.option("--deep", "Include teams, pipes, daemon, and remote-control sections")
.action(async (options: { deep?: boolean }) => {
const { autonomyStatusHandler } = await import("./cli/handlers/autonomy.js");
await autonomyStatusHandler(options);
process.exit(0);
});
autonomyCmd
.command("runs [limit]")
.description("List recent autonomy runs")
.action(async (limit?: string) => {
const { autonomyRunsHandler } = await import("./cli/handlers/autonomy.js");
await autonomyRunsHandler(limit);
process.exit(0);
});
autonomyCmd
.command("flows [limit]")
.description("List recent autonomy flows")
.action(async (limit?: string) => {
const { autonomyFlowsHandler } = await import("./cli/handlers/autonomy.js");
await autonomyFlowsHandler(limit);
process.exit(0);
});
const flowCmd = autonomyCmd
.command("flow <flowId>")
.description("Inspect a single autonomy flow")
.action(async (flowId: string) => {
const { autonomyFlowHandler } = await import("./cli/handlers/autonomy.js");
await autonomyFlowHandler(flowId);
process.exit(0);
});
flowCmd
.command("cancel <flowId>")
.description("Cancel a queued, waiting, or running autonomy flow")
.action(async (flowId: string) => {
const { autonomyFlowCancelHandler } = await import("./cli/handlers/autonomy.js");
await autonomyFlowCancelHandler(flowId);
process.exit(0);
});
flowCmd
.command("resume <flowId>")
.description("Resume a waiting autonomy flow")
.action(async (flowId: string) => {
const { autonomyFlowResumeHandler } = await import("./cli/handlers/autonomy.js");
await autonomyFlowResumeHandler(flowId);
process.exit(0);
});
}
// Remote Control command — connect local environment to claude.ai/code.
// The actual command is intercepted by the fast-path in cli.tsx before
// Commander.js runs, so this registration exists only for help output.