@actant/cli 0.1.2 → 0.2.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/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  RpcCallError,
4
4
  RpcClient,
5
5
  createProgram
6
- } from "./chunk-2FKBVXMH.js";
6
+ } from "./chunk-664FYMDI.js";
7
7
  export {
8
8
  ConnectionError,
9
9
  RpcCallError,
@@ -2,10 +2,10 @@ import {
2
2
  createProgram,
3
3
  defaultSocketPath,
4
4
  run
5
- } from "./chunk-2FKBVXMH.js";
5
+ } from "./chunk-664FYMDI.js";
6
6
  export {
7
7
  createProgram,
8
8
  defaultSocketPath,
9
9
  run
10
10
  };
11
- //# sourceMappingURL=program-3Y3ULHTY.js.map
11
+ //# sourceMappingURL=program-5GYDDKP6.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createProgram,
3
3
  defaultPrinter
4
- } from "./chunk-2FKBVXMH.js";
4
+ } from "./chunk-664FYMDI.js";
5
5
 
6
6
  // src/repl/repl.ts
7
7
  import { createInterface } from "readline";
@@ -100,4 +100,4 @@ export {
100
100
  parseArgs,
101
101
  startRepl
102
102
  };
103
- //# sourceMappingURL=repl-JIMJ2V2Y.js.map
103
+ //# sourceMappingURL=repl-ZVBJSFT5.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actant/cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "CLI for the Actant AI agent platform — build, manage, and compose AI agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,17 +25,27 @@
25
25
  "dist",
26
26
  "scripts/postinstall.mjs"
27
27
  ],
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "import": "./dist/index.js",
33
+ "types": "./dist/index.d.ts"
34
+ }
35
+ },
28
36
  "bin": {
29
37
  "actant": "./dist/bin/actant.js"
30
38
  },
31
39
  "dependencies": {
40
+ "@inquirer/prompts": "^8.3.0",
32
41
  "chalk": "^5.6.2",
33
42
  "cli-table3": "^0.6.5",
34
43
  "commander": "^14.0.3",
35
- "@actant/acp": "0.1.2",
36
- "@actant/core": "0.1.2",
37
- "@actant/shared": "0.1.2",
38
- "@actant/api": "0.1.2"
44
+ "@actant/acp": "0.2.0",
45
+ "@actant/core": "0.2.0",
46
+ "@actant/api": "0.2.0",
47
+ "@actant/shared": "0.2.0",
48
+ "@actant/pi": "0.2.0"
39
49
  },
40
50
  "scripts": {
41
51
  "build": "tsup",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/program.ts","../src/client/rpc-client.ts","../src/commands/template/index.ts","../src/commands/template/list.ts","../src/output/formatter.ts","../src/output/error-presenter.ts","../src/output/printer.ts","../src/output/stream-renderer.ts","../src/commands/template/show.ts","../src/commands/template/validate.ts","../src/commands/template/load.ts","../src/commands/template/install.ts","../src/commands/agent/index.ts","../src/commands/agent/create.ts","../src/commands/agent/start.ts","../src/commands/agent/stop.ts","../src/commands/agent/status.ts","../src/commands/agent/list.ts","../src/commands/agent/adopt.ts","../src/commands/agent/destroy.ts","../src/commands/agent/resolve.ts","../src/commands/agent/attach.ts","../src/commands/agent/detach.ts","../src/commands/agent/run.ts","../src/commands/agent/prompt.ts","../src/commands/agent/chat.ts","../src/commands/agent/dispatch.ts","../src/commands/agent/tasks.ts","../src/commands/agent/logs.ts","../src/commands/help.ts","../package.json","../src/commands/skill/index.ts","../src/commands/skill/list.ts","../src/commands/skill/show.ts","../src/commands/skill/add.ts","../src/commands/skill/remove.ts","../src/commands/skill/export.ts","../src/commands/prompt/index.ts","../src/commands/prompt/list.ts","../src/commands/prompt/show.ts","../src/commands/prompt/add.ts","../src/commands/prompt/remove.ts","../src/commands/prompt/export.ts","../src/commands/mcp/index.ts","../src/commands/mcp/list.ts","../src/commands/mcp/show.ts","../src/commands/mcp/add.ts","../src/commands/mcp/remove.ts","../src/commands/mcp/export.ts","../src/commands/workflow/index.ts","../src/commands/workflow/list.ts","../src/commands/workflow/show.ts","../src/commands/workflow/add.ts","../src/commands/workflow/remove.ts","../src/commands/workflow/export.ts","../src/commands/plugin/index.ts","../src/commands/plugin/list.ts","../src/commands/plugin/show.ts","../src/commands/plugin/add.ts","../src/commands/plugin/remove.ts","../src/commands/plugin/export.ts","../src/commands/source/index.ts","../src/commands/source/list.ts","../src/commands/source/add.ts","../src/commands/source/remove.ts","../src/commands/source/sync.ts","../src/commands/preset/index.ts","../src/commands/preset/list.ts","../src/commands/preset/show.ts","../src/commands/preset/apply.ts","../src/commands/schedule/index.ts","../src/commands/schedule/list.ts","../src/commands/daemon/index.ts","../src/commands/daemon/start.ts","../src/commands/daemon/stop.ts","../src/commands/daemon/status.ts","../src/commands/proxy.ts","../src/commands/self-update.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { getDefaultIpcPath } from \"@actant/shared\";\nimport { RpcClient } from \"./client/rpc-client\";\nimport {\n createTemplateCommand,\n createAgentCommand,\n createSkillCommand,\n createPromptCommand,\n createMcpCommand,\n createWorkflowCommand,\n createPluginCommand,\n createSourceCommand,\n createPresetCommand,\n createScheduleCommand,\n createDaemonCommand,\n createProxyCommand,\n createHelpCommand,\n createSelfUpdateCommand,\n} from \"./commands/index\";\nimport { presentError, type CliPrinter } from \"./output/index\";\n\nexport function defaultSocketPath(): string {\n return process.env[\"ACTANT_SOCKET\"] ?? getDefaultIpcPath();\n}\n\nexport function createProgram(socketPath?: string, printer?: CliPrinter): Command {\n const sock = socketPath ?? defaultSocketPath();\n const client = new RpcClient(sock);\n\n const program = new Command(\"actant\")\n .version(\"0.1.0\")\n .description(\"Actant — Build, manage, and compose AI agents\");\n\n program.addCommand(createTemplateCommand(client, printer));\n program.addCommand(createAgentCommand(client, printer));\n program.addCommand(createSkillCommand(client, printer));\n program.addCommand(createPromptCommand(client, printer));\n program.addCommand(createMcpCommand(client, printer));\n program.addCommand(createWorkflowCommand(client, printer));\n program.addCommand(createPluginCommand(client, printer));\n program.addCommand(createSourceCommand(client, printer));\n program.addCommand(createPresetCommand(client, printer));\n program.addCommand(createScheduleCommand(client, printer));\n program.addCommand(createDaemonCommand(printer));\n program.addCommand(createProxyCommand(printer));\n program.addCommand(createHelpCommand());\n program.addCommand(createSelfUpdateCommand());\n\n program.exitOverride();\n\n return program;\n}\n\nexport async function run(argv?: string[]): Promise<void> {\n const args = argv ?? process.argv;\n\n const hasSubcommand = args.length > 2 && !args[2]?.startsWith(\"-\");\n\n if (!hasSubcommand) {\n const versionRequested = args.includes(\"-V\") || args.includes(\"--version\");\n const helpRequested = args.includes(\"-h\") || args.includes(\"--help\");\n\n if (!versionRequested && !helpRequested) {\n const sock = defaultSocketPath();\n const client = new RpcClient(sock);\n const { startRepl } = await import(\"./repl/repl\");\n await startRepl(client, sock);\n return;\n }\n }\n\n const program = createProgram();\n try {\n await program.parseAsync(args);\n } catch (err) {\n if (err instanceof Error && \"code\" in err) {\n const code = (err as { code: string }).code;\n if (code === \"commander.helpDisplayed\" || code === \"commander.version\") {\n return;\n }\n }\n presentError(err);\n process.exitCode = 1;\n }\n}\n","import { createConnection } from \"node:net\";\nimport type { RpcRequest, RpcResponse, RpcMethodMap, RpcMethod } from \"@actant/shared\";\n\nlet requestId = 0;\n\nexport class RpcClient {\n constructor(private readonly socketPath: string) {}\n\n async call<M extends RpcMethod>(\n method: M,\n params: RpcMethodMap[M][\"params\"],\n options?: { timeoutMs?: number },\n ): Promise<RpcMethodMap[M][\"result\"]> {\n const id = ++requestId;\n const request: RpcRequest = {\n jsonrpc: \"2.0\",\n id,\n method,\n params: params as Record<string, unknown>,\n };\n\n const response = await this.send(request, options?.timeoutMs);\n\n if (response.error) {\n const err = new RpcCallError(response.error.message, response.error.code, response.error.data);\n throw err;\n }\n\n return response.result as RpcMethodMap[M][\"result\"];\n }\n\n async ping(): Promise<boolean> {\n try {\n await this.call(\"daemon.ping\", {});\n return true;\n } catch {\n return false;\n }\n }\n\n private send(request: RpcRequest, timeoutMs?: number): Promise<RpcResponse> {\n const effectiveTimeout = timeoutMs\n ?? (process.env[\"ACTANT_RPC_TIMEOUT_MS\"] ? Number(process.env[\"ACTANT_RPC_TIMEOUT_MS\"]) : 10_000);\n\n return new Promise((resolve, reject) => {\n const socket = createConnection(this.socketPath, () => {\n socket.write(JSON.stringify(request) + \"\\n\");\n });\n\n let buffer = \"\";\n\n socket.on(\"data\", (chunk) => {\n buffer += chunk.toString();\n const lines = buffer.split(\"\\n\");\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n try {\n const response = JSON.parse(trimmed) as RpcResponse;\n socket.end();\n resolve(response);\n return;\n } catch {\n // partial data, continue\n }\n }\n });\n\n socket.on(\"error\", (err) => {\n reject(new ConnectionError(this.socketPath, err));\n });\n\n socket.setTimeout(effectiveTimeout, () => {\n socket.destroy();\n reject(new Error(`RPC call timed out after ${effectiveTimeout}ms`));\n });\n });\n }\n}\n\nexport class RpcCallError extends Error {\n constructor(\n message: string,\n readonly code: number,\n readonly data?: unknown,\n ) {\n super(message);\n this.name = \"RpcCallError\";\n }\n}\n\nexport class ConnectionError extends Error {\n constructor(\n readonly socketPath: string,\n readonly cause: Error,\n ) {\n super(`Cannot connect to daemon at ${socketPath}. Is it running? Start with: actant daemon start`);\n this.name = \"ConnectionError\";\n }\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createTemplateListCommand } from \"./list\";\nimport { createTemplateShowCommand } from \"./show\";\nimport { createTemplateValidateCommand } from \"./validate\";\nimport { createTemplateLoadCommand } from \"./load\";\nimport { createTemplateInstallCommand } from \"./install\";\n\nexport function createTemplateCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"template\")\n .alias(\"tpl\")\n .description(\"Manage agent templates\");\n\n cmd.addCommand(createTemplateListCommand(client, printer));\n cmd.addCommand(createTemplateShowCommand(client, printer));\n cmd.addCommand(createTemplateValidateCommand(client, printer));\n cmd.addCommand(createTemplateLoadCommand(client, printer));\n cmd.addCommand(createTemplateInstallCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatTemplateList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createTemplateListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all registered templates\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const templates = await client.call(\"template.list\", {});\n printer.log(formatTemplateList(templates, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import Table from \"cli-table3\";\nimport chalk from \"chalk\";\nimport type { AgentTemplate, AgentInstanceMeta, SkillDefinition, PromptDefinition, McpServerDefinition, WorkflowDefinition, PluginDefinition } from \"@actant/shared\";\n\nexport type OutputFormat = \"table\" | \"json\" | \"quiet\";\n\nexport function formatTemplateList(\n templates: AgentTemplate[],\n format: OutputFormat,\n): string {\n if (format === \"json\") {\n return JSON.stringify(templates, null, 2);\n }\n\n if (format === \"quiet\") {\n return templates.map((t) => t.name).join(\"\\n\");\n }\n\n if (templates.length === 0) {\n return chalk.dim(\"No templates registered.\");\n }\n\n const table = new Table({\n head: [\n chalk.cyan(\"Name\"),\n chalk.cyan(\"Version\"),\n chalk.cyan(\"Backend\"),\n chalk.cyan(\"Provider\"),\n chalk.cyan(\"Description\"),\n ],\n });\n\n for (const t of templates) {\n table.push([\n t.name,\n t.version,\n t.backend.type,\n t.provider.type,\n t.description ?? chalk.dim(\"—\"),\n ]);\n }\n\n return table.toString();\n}\n\nexport function formatTemplateDetail(\n template: AgentTemplate,\n format: OutputFormat,\n): string {\n if (format === \"json\") {\n return JSON.stringify(template, null, 2);\n }\n\n if (format === \"quiet\") {\n return template.name;\n }\n\n const ctx = template.domainContext;\n const lines = [\n `${chalk.bold(\"Template:\")} ${template.name}`,\n `${chalk.bold(\"Version:\")} ${template.version}`,\n `${chalk.bold(\"Backend:\")} ${template.backend.type}`,\n `${chalk.bold(\"Provider:\")} ${template.provider.type}`,\n ];\n\n if (template.description) {\n lines.push(`${chalk.bold(\"Desc:\")} ${template.description}`);\n }\n\n lines.push(\"\");\n lines.push(chalk.bold(\"Domain Context:\"));\n lines.push(` Skills: ${ctx.skills?.length ?? 0} ref(s) ${(ctx.skills ?? []).join(\", \") || chalk.dim(\"none\")}`);\n lines.push(` Prompts: ${ctx.prompts?.length ?? 0} ref(s) ${(ctx.prompts ?? []).join(\", \") || chalk.dim(\"none\")}`);\n lines.push(` MCP Servers: ${ctx.mcpServers?.length ?? 0} ref(s) ${(ctx.mcpServers ?? []).map((s) => s.name).join(\", \") || chalk.dim(\"none\")}`);\n lines.push(` Plugins: ${ctx.plugins?.length ?? 0} ref(s) ${(ctx.plugins ?? []).join(\", \") || chalk.dim(\"none\")}`);\n lines.push(` Workflow: ${ctx.workflow ?? chalk.dim(\"none\")}`);\n lines.push(` SubAgents: ${(ctx.subAgents ?? []).join(\", \") || chalk.dim(\"none\")}`);\n\n if (template.metadata && Object.keys(template.metadata).length > 0) {\n lines.push(\"\");\n lines.push(chalk.bold(\"Metadata:\"));\n for (const [k, v] of Object.entries(template.metadata)) {\n lines.push(` ${k}: ${v}`);\n }\n }\n\n return lines.join(\"\\n\");\n}\n\nconst STATUS_COLORS: Record<string, (text: string) => string> = {\n created: chalk.blue,\n starting: chalk.yellow,\n running: chalk.green,\n stopping: chalk.yellow,\n stopped: chalk.gray,\n error: chalk.red,\n};\n\nfunction colorStatus(status: string): string {\n const fn = STATUS_COLORS[status] ?? chalk.white;\n return fn(status);\n}\n\nexport function formatAgentList(\n agents: AgentInstanceMeta[],\n format: OutputFormat,\n): string {\n if (format === \"json\") {\n return JSON.stringify(agents, null, 2);\n }\n\n if (format === \"quiet\") {\n return agents.map((a) => a.name).join(\"\\n\");\n }\n\n if (agents.length === 0) {\n return chalk.dim(\"No agents found.\");\n }\n\n const table = new Table({\n head: [\n chalk.cyan(\"Name\"),\n chalk.cyan(\"Template\"),\n chalk.cyan(\"Status\"),\n chalk.cyan(\"Launch Mode\"),\n chalk.cyan(\"PID\"),\n chalk.cyan(\"Created\"),\n ],\n });\n\n for (const a of agents) {\n table.push([\n a.name,\n `${a.templateName}@${a.templateVersion}`,\n colorStatus(a.status),\n a.launchMode,\n a.pid?.toString() ?? chalk.dim(\"—\"),\n a.createdAt.slice(0, 19).replace(\"T\", \" \"),\n ]);\n }\n\n return table.toString();\n}\n\nexport function formatAgentDetail(\n agent: AgentInstanceMeta,\n format: OutputFormat,\n): string {\n if (format === \"json\") {\n return JSON.stringify(agent, null, 2);\n }\n\n if (format === \"quiet\") {\n return agent.name;\n }\n\n const lines = [\n `${chalk.bold(\"Agent:\")} ${agent.name}`,\n `${chalk.bold(\"ID:\")} ${agent.id}`,\n `${chalk.bold(\"Template:\")} ${agent.templateName}@${agent.templateVersion}`,\n `${chalk.bold(\"Status:\")} ${colorStatus(agent.status)}`,\n `${chalk.bold(\"Launch:\")} ${agent.launchMode}`,\n `${chalk.bold(\"PID:\")} ${agent.pid ?? chalk.dim(\"—\")}`,\n `${chalk.bold(\"Created:\")} ${agent.createdAt}`,\n `${chalk.bold(\"Updated:\")} ${agent.updatedAt}`,\n ];\n\n if (agent.metadata && Object.keys(agent.metadata).length > 0) {\n lines.push(\"\");\n lines.push(chalk.bold(\"Metadata:\"));\n for (const [k, v] of Object.entries(agent.metadata)) {\n lines.push(` ${k}: ${v}`);\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Domain component formatters\n// ---------------------------------------------------------------------------\n\nexport function formatSkillList(\n skills: SkillDefinition[],\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(skills, null, 2);\n if (format === \"quiet\") return skills.map((s) => s.name).join(\"\\n\");\n if (skills.length === 0) return chalk.dim(\"No skills loaded.\");\n\n const table = new Table({\n head: [chalk.cyan(\"Name\"), chalk.cyan(\"Tags\"), chalk.cyan(\"Description\")],\n });\n\n for (const s of skills) {\n table.push([\n s.name,\n s.tags?.join(\", \") ?? chalk.dim(\"—\"),\n s.description ?? chalk.dim(\"—\"),\n ]);\n }\n\n return table.toString();\n}\n\nexport function formatSkillDetail(\n skill: SkillDefinition,\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(skill, null, 2);\n if (format === \"quiet\") return skill.name;\n\n const lines = [\n `${chalk.bold(\"Skill:\")} ${skill.name}`,\n ...(skill.description ? [`${chalk.bold(\"Description:\")} ${skill.description}`] : []),\n ...(skill.tags?.length ? [`${chalk.bold(\"Tags:\")} ${skill.tags.join(\", \")}`] : []),\n \"\",\n chalk.bold(\"Content:\"),\n skill.content,\n ];\n return lines.join(\"\\n\");\n}\n\nexport function formatPromptList(\n prompts: PromptDefinition[],\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(prompts, null, 2);\n if (format === \"quiet\") return prompts.map((p) => p.name).join(\"\\n\");\n if (prompts.length === 0) return chalk.dim(\"No prompts loaded.\");\n\n const table = new Table({\n head: [chalk.cyan(\"Name\"), chalk.cyan(\"Variables\"), chalk.cyan(\"Description\")],\n });\n\n for (const p of prompts) {\n table.push([\n p.name,\n p.variables?.join(\", \") ?? chalk.dim(\"—\"),\n p.description ?? chalk.dim(\"—\"),\n ]);\n }\n\n return table.toString();\n}\n\nexport function formatPromptDetail(\n prompt: PromptDefinition,\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(prompt, null, 2);\n if (format === \"quiet\") return prompt.name;\n\n const lines = [\n `${chalk.bold(\"Prompt:\")} ${prompt.name}`,\n ...(prompt.description ? [`${chalk.bold(\"Description:\")} ${prompt.description}`] : []),\n ...(prompt.variables?.length ? [`${chalk.bold(\"Variables:\")} ${prompt.variables.join(\", \")}`] : []),\n \"\",\n chalk.bold(\"Content:\"),\n prompt.content,\n ];\n return lines.join(\"\\n\");\n}\n\nexport function formatMcpList(\n servers: McpServerDefinition[],\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(servers, null, 2);\n if (format === \"quiet\") return servers.map((s) => s.name).join(\"\\n\");\n if (servers.length === 0) return chalk.dim(\"No MCP servers loaded.\");\n\n const table = new Table({\n head: [chalk.cyan(\"Name\"), chalk.cyan(\"Command\"), chalk.cyan(\"Description\")],\n });\n\n for (const s of servers) {\n const cmd = [s.command, ...(s.args ?? [])].join(\" \");\n table.push([\n s.name,\n cmd,\n s.description ?? chalk.dim(\"—\"),\n ]);\n }\n\n return table.toString();\n}\n\nexport function formatMcpDetail(\n server: McpServerDefinition,\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(server, null, 2);\n if (format === \"quiet\") return server.name;\n\n const lines = [\n `${chalk.bold(\"MCP Server:\")} ${server.name}`,\n ...(server.description ? [`${chalk.bold(\"Description:\")} ${server.description}`] : []),\n `${chalk.bold(\"Command:\")} ${server.command}`,\n ...(server.args?.length ? [`${chalk.bold(\"Args:\")} ${server.args.join(\" \")}`] : []),\n ];\n\n if (server.env && Object.keys(server.env).length > 0) {\n lines.push(\"\");\n lines.push(chalk.bold(\"Environment:\"));\n for (const [k, v] of Object.entries(server.env)) {\n lines.push(` ${k}=${v}`);\n }\n }\n\n return lines.join(\"\\n\");\n}\n\nexport function formatWorkflowList(\n workflows: WorkflowDefinition[],\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(workflows, null, 2);\n if (format === \"quiet\") return workflows.map((w) => w.name).join(\"\\n\");\n if (workflows.length === 0) return chalk.dim(\"No workflows loaded.\");\n\n const table = new Table({\n head: [chalk.cyan(\"Name\"), chalk.cyan(\"Description\")],\n });\n\n for (const w of workflows) {\n table.push([w.name, w.description ?? chalk.dim(\"—\")]);\n }\n\n return table.toString();\n}\n\nexport function formatWorkflowDetail(\n workflow: WorkflowDefinition,\n format: OutputFormat,\n): string {\n if (format === \"json\") return JSON.stringify(workflow, null, 2);\n if (format === \"quiet\") return workflow.name;\n\n const lines = [\n `${chalk.bold(\"Workflow:\")} ${workflow.name}`,\n ...(workflow.description ? [`${chalk.bold(\"Description:\")} ${workflow.description}`] : []),\n \"\",\n chalk.bold(\"Content:\"),\n workflow.content,\n ];\n return lines.join(\"\\n\");\n}\n\nexport function formatPluginList(plugins: PluginDefinition[], format: OutputFormat): string {\n if (format === \"json\") return JSON.stringify(plugins, null, 2);\n if (format === \"quiet\") return plugins.map((p) => p.name).join(\"\\n\");\n if (plugins.length === 0) return chalk.dim(\"No plugins loaded.\");\n\n const table = new Table({\n head: [chalk.cyan(\"Name\"), chalk.cyan(\"Type\"), chalk.cyan(\"Source\"), chalk.cyan(\"Enabled\"), chalk.cyan(\"Description\")],\n });\n\n for (const p of plugins) {\n table.push([\n p.name,\n p.type,\n p.source ?? chalk.dim(\"—\"),\n p.enabled !== false ? chalk.green(\"yes\") : chalk.red(\"no\"),\n p.description ?? chalk.dim(\"—\"),\n ]);\n }\n\n return table.toString();\n}\n\nexport function formatPluginDetail(plugin: PluginDefinition, format: OutputFormat): string {\n if (format === \"json\") return JSON.stringify(plugin, null, 2);\n if (format === \"quiet\") return plugin.name;\n\n const lines = [\n `${chalk.bold(\"Plugin:\")} ${plugin.name}`,\n ...(plugin.description ? [`${chalk.bold(\"Description:\")} ${plugin.description}`] : []),\n `${chalk.bold(\"Type:\")} ${plugin.type}`,\n ...(plugin.source ? [`${chalk.bold(\"Source:\")} ${plugin.source}`] : []),\n `${chalk.bold(\"Enabled:\")} ${plugin.enabled !== false ? chalk.green(\"yes\") : chalk.red(\"no\")}`,\n ];\n\n if (plugin.config && Object.keys(plugin.config).length > 0) {\n lines.push(\"\");\n lines.push(chalk.bold(\"Config:\"));\n for (const [k, v] of Object.entries(plugin.config)) {\n lines.push(` ${k}: ${JSON.stringify(v)}`);\n }\n }\n\n return lines.join(\"\\n\");\n}\n","import chalk from \"chalk\";\nimport { ActantError } from \"@actant/shared\";\nimport { RpcCallError, ConnectionError } from \"../client/rpc-client\";\nimport { type CliPrinter, defaultPrinter } from \"./printer\";\n\nexport function presentError(err: unknown, printer: CliPrinter = defaultPrinter): void {\n if (err instanceof ConnectionError) {\n printer.errorStyled(\"Cannot connect to daemon.\");\n printer.errorDim(\"Start with: actant daemon start\");\n return;\n }\n\n if (err instanceof RpcCallError) {\n printer.error(`${chalk.red(`[RPC ${err.code}]`)} ${err.message}`);\n if (err.data && typeof err.data === \"object\") {\n const data = err.data as Record<string, unknown>;\n if (data.context) {\n printer.error(`${chalk.dim(\" Context:\")} ${JSON.stringify(data.context)}`);\n }\n }\n return;\n }\n\n if (err instanceof ActantError) {\n printer.error(`${chalk.red(`[${err.code}]`)} ${err.message}`);\n if (err.context && Object.keys(err.context).length > 0) {\n printer.error(`${chalk.dim(\" Context:\")} ${JSON.stringify(err.context)}`);\n }\n return;\n }\n\n if (err instanceof Error) {\n printer.error(`${chalk.red(\"Error:\")} ${err.message}`);\n } else {\n printer.error(`${chalk.red(\"Error:\")} ${String(err)}`);\n }\n}\n","import chalk from \"chalk\";\n\n/**\n * Abstraction for CLI terminal output, replacing direct console.log/error usage.\n * Inject a custom CliOutput for testing or format switching.\n */\nexport interface CliOutput {\n log(message: string): void;\n error(message: string): void;\n}\n\nconst consoleOutput: CliOutput = {\n log: (msg: string) => {\n console.log(msg);\n },\n error: (msg: string) => {\n console.error(msg);\n },\n};\n\nexport class CliPrinter {\n private readonly out: CliOutput;\n\n constructor(output?: CliOutput) {\n this.out = output ?? consoleOutput;\n }\n\n log(text: string): void {\n this.out.log(text);\n }\n\n error(text: string): void {\n this.out.error(text);\n }\n\n success(text: string): void {\n this.out.log(chalk.green(text));\n }\n\n warn(text: string): void {\n this.out.log(chalk.yellow(text));\n }\n\n dim(text: string): void {\n this.out.log(chalk.dim(text));\n }\n\n errorStyled(text: string): void {\n this.out.error(chalk.red(text));\n }\n\n errorDim(text: string): void {\n this.out.error(chalk.dim(text));\n }\n}\n\nexport const defaultPrinter = new CliPrinter();\n","import chalk from \"chalk\";\nimport type { StreamChunk } from \"@actant/core\";\n\nexport interface StreamRendererOptions {\n output?: NodeJS.WritableStream;\n /** Prefix printed before the first chunk of a response. */\n agentLabel?: string;\n /** Show tool use indicators. Default: true */\n showTools?: boolean;\n}\n\n/**\n * Renders an async stream of {@link StreamChunk} objects to the terminal\n * in real-time, one chunk at a time.\n *\n * Returns the concatenated text once the stream is exhausted.\n */\nexport async function renderStream(\n stream: AsyncIterable<StreamChunk>,\n options?: StreamRendererOptions,\n): Promise<string> {\n const output = options?.output ?? process.stdout;\n const showTools = options?.showTools ?? true;\n const label = options?.agentLabel ?? \"agent\";\n\n let started = false;\n let collectedText = \"\";\n\n for await (const chunk of stream) {\n if (!started) {\n output.write(chalk.cyan(`${label}> `));\n started = true;\n }\n\n switch (chunk.type) {\n case \"text\":\n output.write(chunk.content);\n collectedText += chunk.content;\n break;\n\n case \"tool_use\":\n if (showTools) {\n output.write(chalk.dim(`\\n ${chunk.content}\\n`));\n }\n break;\n\n case \"result\":\n output.write(chunk.content);\n collectedText += chunk.content;\n break;\n\n case \"error\":\n output.write(chalk.red(`\\n[Error] ${chunk.content}\\n`));\n break;\n }\n }\n\n if (started) {\n output.write(\"\\n\\n\");\n }\n\n return collectedText;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatTemplateDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createTemplateShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show template details\")\n .argument(\"<name>\", \"Template name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { format: OutputFormat }) => {\n try {\n const template = await client.call(\"template.get\", { name });\n printer.log(formatTemplateDetail(template, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createTemplateValidateCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"validate\")\n .description(\"Validate a template JSON file\")\n .argument(\"<file>\", \"Path to template JSON file\")\n .action(async (file: string) => {\n try {\n const result = await client.call(\"template.validate\", { filePath: resolve(file) });\n if (result.valid && result.template) {\n printer.log(`${chalk.green(\"Valid\")} — ${result.template.name}@${result.template.version}`);\n if (result.warnings?.length) {\n printer.log(chalk.yellow(` ${result.warnings.length} warning(s):`));\n for (const w of result.warnings) {\n printer.log(chalk.yellow(` - ${w.path}: ${w.message}`));\n }\n }\n } else {\n printer.error(chalk.red(\"Invalid template\"));\n if (result.errors) {\n for (const e of result.errors) {\n printer.errorDim(` - ${e.path}: ${e.message}`);\n }\n }\n process.exitCode = 1;\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createTemplateLoadCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"load\")\n .description(\"Load a template from a JSON file into the registry\")\n .argument(\"<file>\", \"Path to template JSON file\")\n .action(async (file: string) => {\n try {\n const template = await client.call(\"template.load\", { filePath: resolve(file) });\n printer.log(`${chalk.green(\"Loaded\")} ${template.name}@${template.version}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createTemplateInstallCommand(\n _client: RpcClient,\n printer: CliPrinter = defaultPrinter,\n): Command {\n return new Command(\"install\")\n .description(\"Install a template from a source (source@name)\")\n .argument(\"<spec>\", \"Source and template name, e.g. my-source@my-template\")\n .action(async (spec: string) => {\n try {\n const at = spec.indexOf(\"@\");\n if (at < 0) {\n printer.error(\"Expected format: <source>@<name>\");\n process.exitCode = 1;\n return;\n }\n const source = spec.slice(0, at);\n printer.log(\n `Template install not yet implemented via RPC - use \"actant source sync ${source}\" to sync templates from the source.`,\n );\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createAgentCreateCommand } from \"./create\";\nimport { createAgentStartCommand } from \"./start\";\nimport { createAgentStopCommand } from \"./stop\";\nimport { createAgentStatusCommand } from \"./status\";\nimport { createAgentListCommand } from \"./list\";\nimport { createAgentAdoptCommand } from \"./adopt\";\nimport { createAgentDestroyCommand } from \"./destroy\";\nimport { createAgentResolveCommand } from \"./resolve\";\nimport { createAgentAttachCommand } from \"./attach\";\nimport { createAgentDetachCommand } from \"./detach\";\nimport { createAgentRunCommand } from \"./run\";\nimport { createAgentPromptCommand } from \"./prompt\";\nimport { createAgentChatCommand } from \"./chat\";\nimport { createAgentDispatchCommand } from \"./dispatch\";\nimport { createAgentTasksCommand } from \"./tasks\";\nimport { createAgentLogsCommand } from \"./logs\";\n\nexport function createAgentCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"agent\")\n .description(\"Manage agent instances\");\n\n cmd.addCommand(createAgentCreateCommand(client, printer));\n cmd.addCommand(createAgentStartCommand(client, printer));\n cmd.addCommand(createAgentStopCommand(client, printer));\n cmd.addCommand(createAgentStatusCommand(client, printer));\n cmd.addCommand(createAgentListCommand(client, printer));\n cmd.addCommand(createAgentAdoptCommand(client, printer));\n cmd.addCommand(createAgentDestroyCommand(client, printer));\n cmd.addCommand(createAgentResolveCommand(client, printer));\n cmd.addCommand(createAgentAttachCommand(client, printer));\n cmd.addCommand(createAgentDetachCommand(client, printer));\n cmd.addCommand(createAgentRunCommand(client, printer));\n cmd.addCommand(createAgentPromptCommand(client, printer));\n cmd.addCommand(createAgentChatCommand(client, printer));\n cmd.addCommand(createAgentDispatchCommand(client, printer));\n cmd.addCommand(createAgentTasksCommand(client, printer));\n cmd.addCommand(createAgentLogsCommand(client, printer));\n\n return cmd;\n}\n","import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { createInterface } from \"node:readline\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { LaunchMode, WorkDirConflict } from \"@actant/shared\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatAgentDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nconst VALID_LAUNCH_MODES = new Set([\"direct\", \"acp-background\", \"acp-service\", \"one-shot\"]);\n\nfunction askQuestion(question: string): Promise<string> {\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n return new Promise((res) => {\n rl.question(question, (answer) => {\n rl.close();\n res(answer.trim().toLowerCase());\n });\n });\n}\n\nexport function createAgentCreateCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"create\")\n .description(\"Create a new agent from a template\")\n .argument(\"<name>\", \"Agent instance name\")\n .requiredOption(\"-t, --template <template>\", \"Template name to use\")\n .option(\"--launch-mode <mode>\", \"Launch mode: direct, acp-background, acp-service, one-shot\")\n .option(\"--work-dir <path>\", \"Custom workspace directory (absolute or relative path)\")\n .option(\"--workspace <path>\", \"Same as --work-dir: create instance at external path instead of builtin location\")\n .option(\"--overwrite\", \"If work-dir exists, remove it and recreate\")\n .option(\"--append\", \"If work-dir exists, add agent files into it\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: {\n template: string;\n launchMode?: string;\n workDir?: string;\n workspace?: string;\n overwrite?: boolean;\n append?: boolean;\n format: OutputFormat;\n }) => {\n try {\n if (opts.launchMode && !VALID_LAUNCH_MODES.has(opts.launchMode)) {\n printer.error(`${chalk.red(`Invalid launch mode: ${opts.launchMode}`)}`);\n process.exitCode = 1;\n return;\n }\n\n if (opts.overwrite && opts.append) {\n printer.error(`${chalk.red(\"Cannot use both --overwrite and --append\")}`);\n process.exitCode = 1;\n return;\n }\n\n let workDirConflict: WorkDirConflict | undefined;\n const workDirPath = opts.workspace ?? opts.workDir;\n const workDir = workDirPath ? resolve(workDirPath) : undefined;\n\n if (workDir && existsSync(workDir)) {\n if (opts.overwrite) {\n workDirConflict = \"overwrite\";\n } else if (opts.append) {\n workDirConflict = \"append\";\n } else {\n printer.warn(`Directory already exists: ${workDir}`);\n const answer = await askQuestion(\n ` ${chalk.yellow(\"(o)\")}verwrite / ${chalk.cyan(\"(a)\")}ppend / ${chalk.dim(\"(c)\")}ancel? `,\n );\n if (answer === \"o\" || answer === \"overwrite\") {\n workDirConflict = \"overwrite\";\n } else if (answer === \"a\" || answer === \"append\") {\n workDirConflict = \"append\";\n } else {\n printer.log(\"Cancelled.\");\n return;\n }\n }\n }\n\n const overrides: Record<string, unknown> = {};\n if (opts.launchMode) overrides.launchMode = opts.launchMode as LaunchMode;\n if (workDir) overrides.workDir = workDir;\n if (workDirConflict) overrides.workDirConflict = workDirConflict;\n\n const meta = await client.call(\"agent.create\", {\n name,\n template: opts.template,\n overrides: Object.keys(overrides).length > 0 ? overrides : undefined,\n });\n printer.log(`${chalk.green(\"Agent created successfully.\")}\\n`);\n printer.log(formatAgentDetail(meta, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentStartCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"start\")\n .description(\"Start an agent\")\n .argument(\"<name>\", \"Agent name\")\n .action(async (name: string) => {\n try {\n await client.call(\"agent.start\", { name });\n printer.log(`${chalk.green(\"Started\")} ${name}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentStopCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"stop\")\n .description(\"Stop a running agent\")\n .argument(\"<name>\", \"Agent name\")\n .action(async (name: string) => {\n try {\n await client.call(\"agent.stop\", { name });\n printer.log(`${chalk.green(\"Stopped\")} ${name}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatAgentDetail, formatAgentList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentStatusCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"status\")\n .description(\"Show agent status (all agents if no name given)\")\n .argument(\"[name]\", \"Agent name (optional)\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string | undefined, opts: { format: OutputFormat }) => {\n try {\n if (name) {\n const agent = await client.call(\"agent.status\", { name });\n printer.log(formatAgentDetail(agent, opts.format));\n } else {\n const agents = await client.call(\"agent.list\", {});\n printer.log(formatAgentList(agents, opts.format));\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatAgentList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all agents\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const agents = await client.call(\"agent.list\", {});\n printer.log(formatAgentList(agents, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport type { AgentAdoptResult } from \"@actant/shared\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nfunction formatAdoptResult(result: AgentAdoptResult, format: OutputFormat): string {\n if (format === \"json\") {\n return JSON.stringify(result, null, 2);\n }\n\n if (format === \"quiet\") {\n return result.name;\n }\n\n const lines = [\n chalk.green(\"Agent adopted successfully.\"),\n \"\",\n `${chalk.bold(\"Name:\")} ${result.name}`,\n `${chalk.bold(\"Template:\")} ${result.template}`,\n `${chalk.bold(\"Workspace:\")} ${result.workspacePath}`,\n `${chalk.bold(\"Location:\")} ${result.location}`,\n `${chalk.bold(\"Status:\")} ${result.status}`,\n `${chalk.bold(\"Created:\")} ${result.createdAt}`,\n ];\n return lines.join(\"\\n\");\n}\n\nexport function createAgentAdoptCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"adopt\")\n .description(\"Adopt an existing agent workspace into the instance registry\")\n .argument(\"<path>\", \"Path to the agent workspace directory (contains .actant.json)\")\n .option(\"--rename <name>\", \"Register with a different name than in .actant.json\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (path: string, opts: { rename?: string; format: OutputFormat }) => {\n try {\n const result = await client.call(\"agent.adopt\", {\n path,\n rename: opts.rename,\n }) as AgentAdoptResult;\n printer.log(formatAdoptResult(result, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentDestroyCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"destroy\")\n .alias(\"rm\")\n .description(\"Destroy an agent (removes workspace directory)\")\n .argument(\"<name>\", \"Agent name\")\n .option(\"--force\", \"Skip confirmation\", false)\n .action(async (name: string, opts: { force: boolean }) => {\n if (!opts.force) {\n printer.warn(`Destroying agent \"${name}\" will remove its entire workspace.`);\n printer.warn(\"Use --force to skip this warning.\");\n process.exitCode = 1;\n return;\n }\n\n try {\n await client.call(\"agent.destroy\", { name });\n printer.log(`${chalk.green(\"Destroyed\")} ${name}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentResolveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"resolve\")\n .description(\"Resolve spawn info for an agent (external spawn support)\")\n .argument(\"<name>\", \"Agent instance name\")\n .option(\"-t, --template <template>\", \"Template name (auto-creates instance if not found)\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { template?: string; format: OutputFormat }) => {\n try {\n const result = await client.call(\"agent.resolve\", {\n name,\n template: opts.template,\n });\n\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(result, null, 2));\n } else if (opts.format === \"quiet\") {\n printer.log([result.command, ...result.args].join(\" \"));\n } else {\n if (result.created) {\n printer.log(`${chalk.green(\"Instance created.\")}\\n`);\n }\n printer.log(`${chalk.bold(\"Instance:\")} ${result.instanceName}`);\n printer.log(`${chalk.bold(\"Backend:\")} ${result.backendType}`);\n printer.log(`${chalk.bold(\"Workspace:\")} ${result.workspaceDir}`);\n printer.log(`${chalk.bold(\"Command:\")} ${result.command}`);\n printer.log(`${chalk.bold(\"Args:\")} ${result.args.join(\" \")}`);\n if (result.env && Object.keys(result.env).length > 0) {\n printer.log(chalk.bold(\"Env:\"));\n for (const [k, v] of Object.entries(result.env)) {\n printer.log(` ${k}=${v}`);\n }\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatAgentDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentAttachCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"attach\")\n .description(\"Attach an externally-spawned process to an agent\")\n .argument(\"<name>\", \"Agent instance name\")\n .requiredOption(\"--pid <pid>\", \"Process ID of the externally-spawned agent\")\n .option(\"--metadata <json>\", \"Additional metadata as JSON object\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { pid: string; metadata?: string; format: OutputFormat }) => {\n try {\n const pid = parseInt(opts.pid, 10);\n if (isNaN(pid) || pid <= 0) {\n printer.error(chalk.red(\"Invalid PID: must be a positive integer\"));\n process.exitCode = 1;\n return;\n }\n\n let metadata: Record<string, string> | undefined;\n if (opts.metadata) {\n try {\n metadata = JSON.parse(opts.metadata) as Record<string, string>;\n } catch {\n printer.error(chalk.red(\"Invalid --metadata: must be valid JSON\"));\n process.exitCode = 1;\n return;\n }\n }\n\n const meta = await client.call(\"agent.attach\", { name, pid, metadata });\n printer.log(`${chalk.green(\"Process attached.\")}\\n`);\n printer.log(formatAgentDetail(meta, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentDetachCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"detach\")\n .description(\"Detach an externally-managed process from an agent\")\n .argument(\"<name>\", \"Agent instance name\")\n .option(\"--cleanup\", \"Clean up ephemeral workspace after detach\")\n .action(async (name: string, opts: { cleanup?: boolean }) => {\n try {\n const result = await client.call(\"agent.detach\", {\n name,\n cleanup: opts.cleanup,\n });\n printer.success(\"Process detached.\");\n if (result.workspaceCleaned) {\n printer.dim(\"Ephemeral workspace cleaned up.\");\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentRunCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"run\")\n .description(\"Send a prompt to an agent and get the response\")\n .argument(\"<name>\", \"Agent name\")\n .requiredOption(\"--prompt <prompt>\", \"The prompt to send\")\n .option(\"--model <model>\", \"Model to use (e.g. sonnet, opus)\")\n .option(\"--max-turns <turns>\", \"Maximum agentic turns\", parseInt)\n .option(\"--timeout <ms>\", \"Timeout in milliseconds\", parseInt)\n .option(\"--session-id <id>\", \"Resume a specific session\")\n .option(\"-f, --format <format>\", \"Output format: text, json\", \"text\")\n .action(async (name: string, opts: {\n prompt: string;\n model?: string;\n maxTurns?: number;\n timeout?: number;\n sessionId?: string;\n format: string;\n }) => {\n try {\n const rpcTimeout = (opts.timeout ?? 300_000) + 5_000;\n const result = await client.call(\"agent.run\", {\n name,\n prompt: opts.prompt,\n options: {\n model: opts.model,\n maxTurns: opts.maxTurns,\n timeoutMs: opts.timeout,\n sessionId: opts.sessionId,\n },\n }, { timeoutMs: rpcTimeout });\n\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(result, null, 2));\n } else {\n printer.log(result.text);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentPromptCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"prompt\")\n .description(\"Send a message to a running agent's ACP session\")\n .argument(\"<name>\", \"Agent name (must be started with `agent start`)\")\n .requiredOption(\"-m, --message <message>\", \"The message to send\")\n .option(\"--session-id <id>\", \"Specific ACP session ID (uses primary session if omitted)\")\n .option(\"-f, --format <format>\", \"Output format: text, json\", \"text\")\n .action(async (name: string, opts: {\n message: string;\n sessionId?: string;\n format: string;\n }) => {\n try {\n const result = await client.call(\"agent.prompt\", {\n name,\n message: opts.message,\n sessionId: opts.sessionId,\n });\n\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(result, null, 2));\n } else {\n printer.log(result.response);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { createInterface, type Interface } from \"node:readline\";\nimport { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, renderStream, type CliPrinter, defaultPrinter } from \"../../output/index\";\nimport { AcpConnection, type AcpSessionInfo, type SessionNotification } from \"@actant/acp\";\nimport type { StreamChunk } from \"@actant/core\";\n\nexport function createAgentChatCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"chat\")\n .description(\"Start an interactive chat session with an agent\")\n .argument(\"<name>\", \"Agent name\")\n .option(\"-t, --template <template>\", \"Template name (auto-creates instance if not found)\")\n .action(async (name: string, opts: { template?: string }) => {\n try {\n await runChat(client, name, opts, printer);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n\nasync function runChat(\n client: RpcClient,\n name: string,\n opts: { template?: string },\n printer: CliPrinter,\n): Promise<void> {\n const alive = await client.ping();\n if (!alive) {\n printer.error(\"Daemon is not running. Start it with: actant daemon start\");\n process.exitCode = 1;\n return;\n }\n\n // Check if the agent is already running (Daemon-managed)\n let daemonManaged = false;\n try {\n const status = await client.call(\"agent.status\", { name });\n if (status.status === \"running\") {\n daemonManaged = true;\n }\n } catch {\n // Not found or not running — will use Direct Bridge\n }\n\n if (daemonManaged) {\n await runDaemonChat(client, name, printer);\n } else {\n await runDirectBridgeChat(client, name, opts, printer);\n }\n}\n\n/**\n * Daemon-managed path: Agent is already running via `agent start`.\n * Uses agent.prompt RPC (synchronous for now; Phase 3 will add Session Lease streaming).\n */\nasync function runDaemonChat(\n client: RpcClient,\n name: string,\n printer: CliPrinter,\n): Promise<void> {\n const meta = await client.call(\"agent.status\", { name });\n printer.log(\n chalk.bold(`Chat with ${meta.name}`) +\n chalk.dim(` (${meta.templateName}@${meta.templateVersion}) [daemon-managed]`),\n );\n printer.log(chalk.dim('Type your message and press Enter. Use \"exit\" or Ctrl+C to quit.\\n'));\n\n const rl = createReadline();\n rl.prompt();\n\n let sessionId: string | undefined;\n\n rl.on(\"line\", async (line: string) => {\n const trimmed = line.trim();\n if (!trimmed) { rl.prompt(); return; }\n if (trimmed === \"exit\" || trimmed === \"quit\") { rl.close(); return; }\n\n try {\n process.stdout.write(chalk.cyan(\"agent> \"));\n const result = await client.call(\"agent.prompt\", {\n name,\n message: trimmed,\n sessionId,\n }, { timeoutMs: 305_000 });\n process.stdout.write(result.response + \"\\n\\n\");\n sessionId = result.sessionId;\n } catch (err) {\n presentError(err, printer);\n }\n rl.prompt();\n });\n\n rl.on(\"close\", () => {\n process.stdout.write(chalk.dim(\"\\nChat ended.\\n\"));\n });\n\n return new Promise((resolve) => {\n rl.on(\"close\", resolve);\n });\n}\n\n/**\n * Direct Bridge path: Proxy spawns Agent via AcpConnection, owns the process.\n * Uses streamPrompt for real-time streaming output.\n */\nasync function runDirectBridgeChat(\n client: RpcClient,\n name: string,\n opts: { template?: string },\n printer: CliPrinter,\n): Promise<void> {\n const resolved = await client.call(\"agent.resolve\", {\n name,\n template: opts.template,\n });\n\n const conn = new AcpConnection({ autoApprove: true });\n let session: AcpSessionInfo | null = null;\n let attached = false;\n\n const cleanup = async () => {\n await conn.close();\n if (attached) {\n try {\n await client.call(\"agent.detach\", { name: resolved.instanceName, cleanup: false });\n } catch {\n // Daemon may be down\n }\n }\n };\n\n try {\n await conn.spawn(resolved.command, resolved.args, resolved.workspaceDir);\n\n await client.call(\"agent.attach\", {\n name: resolved.instanceName,\n pid: process.pid, // register for lifecycle tracking\n metadata: { proxyMode: \"direct-bridge-chat\" },\n });\n attached = true;\n\n const initResult = await conn.initialize();\n const agentName = initResult.agentInfo?.name ?? name;\n\n session = await conn.newSession(resolved.workspaceDir);\n\n printer.log(\n chalk.bold(`Chat with ${agentName}`) +\n chalk.dim(` (direct bridge, session ${session.sessionId.slice(0, 8)}...)`),\n );\n printer.log(chalk.dim('Type your message and press Enter. Use \"exit\" or Ctrl+C to quit.\\n'));\n\n const rl = createReadline();\n\n process.on(\"SIGINT\", () => {\n if (session) {\n conn.cancel(session.sessionId).catch(() => {});\n }\n rl.close();\n });\n\n rl.prompt();\n\n const activeSession = session;\n\n rl.on(\"line\", async (line: string) => {\n const trimmed = line.trim();\n if (!trimmed) { rl.prompt(); return; }\n if (trimmed === \"exit\" || trimmed === \"quit\") { rl.close(); return; }\n\n try {\n const chunkStream = mapNotificationsToChunks(\n conn.streamPrompt(activeSession.sessionId, trimmed),\n );\n await renderStream(chunkStream, { agentLabel: agentName });\n } catch (err) {\n presentError(err, printer);\n }\n rl.prompt();\n });\n\n rl.on(\"close\", () => {\n process.stdout.write(chalk.dim(\"\\nChat ended.\\n\"));\n });\n\n await new Promise<void>((resolve) => {\n rl.on(\"close\", resolve);\n });\n } finally {\n await cleanup();\n }\n}\n\nfunction createReadline(): Interface {\n return createInterface({\n input: process.stdin,\n output: process.stdout,\n prompt: chalk.green(\"you> \"),\n terminal: process.stdin.isTTY ?? false,\n });\n}\n\nasync function* mapNotificationsToChunks(\n notifications: AsyncIterable<SessionNotification>,\n): AsyncIterable<StreamChunk> {\n for await (const notification of notifications) {\n const chunk = notificationToChunk(notification);\n if (chunk) yield chunk;\n }\n}\n\nfunction notificationToChunk(notification: SessionNotification): StreamChunk | null {\n const update = notification.update;\n\n switch (update.sessionUpdate) {\n case \"agent_message_chunk\":\n if (update.content.type === \"text\") {\n return { type: \"text\", content: update.content.text };\n }\n return null;\n\n case \"tool_call\":\n return {\n type: \"tool_use\",\n content: `[Tool: ${update.title ?? \"unknown\"}] ${update.toolCallId}`,\n };\n\n case \"tool_call_update\":\n if (update.status === \"completed\" && update.content) {\n const textParts: string[] = [];\n for (const item of update.content) {\n if (item.type === \"content\" && item.content.type === \"text\") {\n textParts.push(item.content.text);\n }\n }\n if (textParts.length > 0) {\n return { type: \"text\", content: textParts.join(\"\") };\n }\n }\n return null;\n\n default:\n return null;\n }\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentDispatchCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"dispatch\")\n .description(\"Queue a one-off task for an agent's scheduler\")\n .argument(\"<name>\", \"Agent name\")\n .requiredOption(\"-m, --message <message>\", \"The prompt/message to dispatch\")\n .option(\"-p, --priority <priority>\", \"Task priority: low, normal, high, critical\", \"normal\")\n .action(async (name: string, opts: { message: string; priority: string }) => {\n try {\n const result = await client.call(\"agent.dispatch\", {\n name,\n prompt: opts.message,\n priority: opts.priority,\n });\n if (result.queued) {\n printer.log(\"Task queued.\");\n } else {\n printer.dim(`No scheduler for agent \"${name}\". Task not queued.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentTasksCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"tasks\")\n .description(\"List queued tasks for an agent's scheduler\")\n .argument(\"<name>\", \"Agent name\")\n .option(\"-f, --format <format>\", \"Output format: table, json\", \"table\")\n .action(async (name: string, opts: { format: string }) => {\n try {\n const result = await client.call(\"agent.tasks\", { name });\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(result, null, 2));\n } else {\n printer.log(`Queued: ${result.queued} Processing: ${result.processing}`);\n if (result.tasks.length > 0) {\n for (const t of result.tasks as Array<{ id: string; prompt: string; priority: string; source: string }>) {\n const promptPreview = (t.prompt ?? \"\").length > 40 ? `${(t.prompt ?? \"\").slice(0, 40)}...` : (t.prompt ?? \"\");\n printer.log(` ${t.id?.slice(0, 8) ?? \"?\"} ${t.priority} ${t.source} ${promptPreview}`);\n }\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createAgentLogsCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"logs\")\n .description(\"Show execution logs for an agent's scheduler\")\n .argument(\"<name>\", \"Agent name\")\n .option(\"--limit <n>\", \"Maximum number of records to show\", parseInt, 20)\n .option(\"-f, --format <format>\", \"Output format: table, json\", \"table\")\n .action(async (name: string, opts: { limit: number; format: string }) => {\n try {\n const result = await client.call(\"agent.logs\", { name, limit: opts.limit });\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(result, null, 2));\n } else {\n const records = result as Array<{ taskId: string; status: string; source: string; startedAt: string; durationMs?: number; error?: string }>;\n if (records.length === 0) {\n printer.dim(\"No execution logs.\");\n } else {\n for (const r of records) {\n const dur = r.durationMs != null ? ` ${r.durationMs}ms` : \"\";\n const err = r.error ? ` error: ${r.error}` : \"\";\n printer.log(` ${r.taskId?.slice(0, 8) ?? \"?\"} ${r.status} ${r.source} ${r.startedAt}${dur}${err}`);\n }\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport pkg from \"../../package.json\";\n\nfunction showOverview(): void {\n const version = (pkg as { version?: string }).version ?? \"0.1.0\";\n\n const lines = [\n \"\",\n chalk.bold(\" Actant — Build, manage, and compose AI agents\"),\n chalk.gray(` v${version}`),\n \"\",\n chalk.bold(\" Quick Start:\"),\n ` ${chalk.cyan(\"actant daemon start\")} Start the daemon`,\n ` ${chalk.cyan(\"actant agent create my-agent\")} Create an Agent`,\n ` ${chalk.cyan(\"actant agent start my-agent\")} Start an Agent`,\n ` ${chalk.cyan(\"actant agent chat my-agent\")} Chat with an Agent`,\n \"\",\n chalk.bold(\" Agent Management:\"),\n ` ${chalk.cyan(\"agent\")} create|start|stop|list|chat|run Agent lifecycle`,\n ` ${chalk.cyan(\"agent adopt\")} <path> Adopt existing workspace`,\n ` ${chalk.cyan(\"template\")} list|show Agent templates`,\n ` ${chalk.cyan(\"proxy\")} <name> ACP proxy forwarding`,\n \"\",\n chalk.bold(\" Component Management:\"),\n ` ${chalk.cyan(\"skill\")} list|add|remove|show Manage skills`,\n ` ${chalk.cyan(\"prompt\")} list|add|remove|show Manage prompts`,\n ` ${chalk.cyan(\"mcp\")} list|show Manage MCP server configs`,\n ` ${chalk.cyan(\"workflow\")} list|show Manage workflows`,\n ` ${chalk.cyan(\"plugin\")} list|add|remove|show Manage plugins`,\n \"\",\n chalk.bold(\" Ecosystem:\"),\n ` ${chalk.cyan(\"source\")} list|add|remove|sync Manage component sources`,\n ` ${chalk.cyan(\"preset\")} list|apply Manage preset packs`,\n \"\",\n chalk.bold(\" Scheduling:\"),\n ` ${chalk.cyan(\"schedule\")} list Manage employee agent scheduling`,\n \"\",\n chalk.bold(\" System:\"),\n ` ${chalk.cyan(\"daemon\")} start|stop|status Daemon management`,\n ` ${chalk.cyan(\"help\")} [command] Show help`,\n ` ${chalk.cyan(\"--version\")} Show version`,\n \"\",\n chalk.bold(\" Tips:\"),\n chalk.gray(\" Use 'actant help <command>' for detailed help on a command\"),\n \"\",\n ];\n\n process.stdout.write(lines.join(\"\\n\"));\n}\n\nfunction showCommandHelp(program: Command, commandName: string): void {\n const subcmd = program.commands.find((c) => c.name() === commandName);\n if (subcmd) {\n subcmd.outputHelp();\n } else {\n process.stdout.write(\n chalk.red(`Unknown command: ${commandName}\\n`) +\n chalk.gray(\"Run 'actant help' to see available commands.\\n\"),\n );\n }\n}\n\nexport function createHelpCommand(): Command {\n return new Command(\"help\")\n .argument(\"[command]\", \"Command to get help for\")\n .description(\"Show help information\")\n .action(function (command?: string) {\n const program = this.parent as Command;\n if (command) {\n showCommandHelp(program, command);\n } else {\n showOverview();\n }\n });\n}\n","{\n \"name\": \"@actant/cli\",\n \"version\": \"0.1.2\",\n \"description\": \"CLI for the Actant AI agent platform — build, manage, and compose AI agents\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"blackplume <blackplume233@gmail.com>\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/blackplume233/Actant.git\",\n \"directory\": \"packages/cli\"\n },\n \"homepage\": \"https://github.com/blackplume233/Actant#readme\",\n \"bugs\": \"https://github.com/blackplume233/Actant/issues\",\n \"keywords\": [\"actant\", \"ai-agent\", \"cli\", \"agent-platform\"],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"files\": [\"dist\", \"scripts/postinstall.mjs\"],\n \"bin\": {\n \"actant\": \"./dist/bin/actant.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsx src/index.ts\",\n \"type-check\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"clean\": \"rimraf dist\",\n \"postinstall\": \"node scripts/postinstall.mjs\",\n \"prepublishOnly\": \"tsup\"\n },\n \"dependencies\": {\n \"@actant/acp\": \"workspace:*\",\n \"@actant/api\": \"workspace:*\",\n \"@actant/core\": \"workspace:*\",\n \"@actant/shared\": \"workspace:*\",\n \"chalk\": \"^5.6.2\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^14.0.3\"\n }\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createSkillListCommand } from \"./list\";\nimport { createSkillShowCommand } from \"./show\";\nimport { createSkillAddCommand } from \"./add\";\nimport { createSkillRemoveCommand } from \"./remove\";\nimport { createSkillExportCommand } from \"./export\";\n\nexport function createSkillCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"skill\")\n .description(\"Manage loaded skills\");\n\n cmd.addCommand(createSkillListCommand(client, printer));\n cmd.addCommand(createSkillShowCommand(client, printer));\n cmd.addCommand(createSkillAddCommand(client, printer));\n cmd.addCommand(createSkillRemoveCommand(client, printer));\n cmd.addCommand(createSkillExportCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatSkillList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSkillListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all loaded skills\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const skills = await client.call(\"skill.list\", {});\n printer.log(formatSkillList(skills, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatSkillDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSkillShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show skill details\")\n .argument(\"<name>\", \"Skill name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { format: OutputFormat }) => {\n try {\n const skill = await client.call(\"skill.get\", { name });\n printer.log(formatSkillDetail(skill, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSkillAddCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"add\")\n .description(\"Add a skill from a JSON file\")\n .argument(\"<file>\", \"Path to skill definition JSON file\")\n .action(async (file: string) => {\n try {\n const raw = await readFile(resolve(file), \"utf-8\");\n const component = JSON.parse(raw);\n const result = await client.call(\"skill.add\", { component });\n printer.success(`Skill \"${result.name}\" added successfully.`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSkillRemoveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"remove\")\n .alias(\"rm\")\n .description(\"Remove a loaded skill\")\n .argument(\"<name>\", \"Skill name\")\n .action(async (name: string) => {\n try {\n const result = await client.call(\"skill.remove\", { name });\n if (result.success) {\n printer.success(`Skill \"${name}\" removed.`);\n } else {\n printer.warn(`Skill \"${name}\" not found.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSkillExportCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"export\")\n .description(\"Export a skill to a JSON file\")\n .argument(\"<name>\", \"Skill name\")\n .option(\"-o, --out <file>\", \"Output file path\", \"./{name}.json\")\n .action(async (name: string, opts: { out: string }) => {\n try {\n const outPath = opts.out.replace(\"{name}\", name);\n await client.call(\"skill.export\", { name, filePath: outPath });\n printer.success(`Skill \"${name}\" exported to ${outPath}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createPromptListCommand } from \"./list\";\nimport { createPromptShowCommand } from \"./show\";\nimport { createPromptAddCommand } from \"./add\";\nimport { createPromptRemoveCommand } from \"./remove\";\nimport { createPromptExportCommand } from \"./export\";\n\nexport function createPromptCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"prompt\")\n .description(\"Manage loaded prompts\");\n\n cmd.addCommand(createPromptListCommand(client, printer));\n cmd.addCommand(createPromptShowCommand(client, printer));\n cmd.addCommand(createPromptAddCommand(client, printer));\n cmd.addCommand(createPromptRemoveCommand(client, printer));\n cmd.addCommand(createPromptExportCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatPromptList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPromptListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all loaded prompts\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const prompts = await client.call(\"prompt.list\", {});\n printer.log(formatPromptList(prompts, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatPromptDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPromptShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show prompt details\")\n .argument(\"<name>\", \"Prompt name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { format: OutputFormat }) => {\n try {\n const prompt = await client.call(\"prompt.get\", { name });\n printer.log(formatPromptDetail(prompt, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPromptAddCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"add\")\n .description(\"Add a prompt from a JSON file\")\n .argument(\"<file>\", \"Path to prompt definition JSON file\")\n .action(async (file: string) => {\n try {\n const raw = await readFile(resolve(file), \"utf-8\");\n const component = JSON.parse(raw);\n const result = await client.call(\"prompt.add\", { component });\n printer.success(`Prompt \"${result.name}\" added successfully.`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPromptRemoveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"remove\")\n .alias(\"rm\")\n .description(\"Remove a loaded prompt\")\n .argument(\"<name>\", \"Prompt name\")\n .action(async (name: string) => {\n try {\n const result = await client.call(\"prompt.remove\", { name });\n if (result.success) {\n printer.success(`Prompt \"${name}\" removed.`);\n } else {\n printer.warn(`Prompt \"${name}\" not found.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPromptExportCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"export\")\n .description(\"Export a prompt to a JSON file\")\n .argument(\"<name>\", \"Prompt name\")\n .option(\"-o, --out <file>\", \"Output file path\", \"./{name}.json\")\n .action(async (name: string, opts: { out: string }) => {\n try {\n const outPath = opts.out.replace(\"{name}\", name);\n await client.call(\"prompt.export\", { name, filePath: outPath });\n printer.success(`Prompt \"${name}\" exported to ${outPath}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createMcpListCommand } from \"./list\";\nimport { createMcpShowCommand } from \"./show\";\nimport { createMcpAddCommand } from \"./add\";\nimport { createMcpRemoveCommand } from \"./remove\";\nimport { createMcpExportCommand } from \"./export\";\n\nexport function createMcpCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"mcp\")\n .description(\"Manage loaded MCP server configs\");\n\n cmd.addCommand(createMcpListCommand(client, printer));\n cmd.addCommand(createMcpShowCommand(client, printer));\n cmd.addCommand(createMcpAddCommand(client, printer));\n cmd.addCommand(createMcpRemoveCommand(client, printer));\n cmd.addCommand(createMcpExportCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatMcpList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createMcpListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all loaded MCP server configs\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const servers = await client.call(\"mcp.list\", {});\n printer.log(formatMcpList(servers, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatMcpDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createMcpShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show MCP server config details\")\n .argument(\"<name>\", \"MCP server name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { format: OutputFormat }) => {\n try {\n const server = await client.call(\"mcp.get\", { name });\n printer.log(formatMcpDetail(server, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createMcpAddCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"add\")\n .description(\"Add an MCP server config from a JSON file\")\n .argument(\"<file>\", \"Path to MCP server definition JSON file\")\n .action(async (file: string) => {\n try {\n const raw = await readFile(resolve(file), \"utf-8\");\n const component = JSON.parse(raw);\n const result = await client.call(\"mcp.add\", { component });\n printer.success(`MCP \"${result.name}\" added successfully.`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createMcpRemoveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"remove\")\n .alias(\"rm\")\n .description(\"Remove a loaded MCP server config\")\n .argument(\"<name>\", \"MCP server name\")\n .action(async (name: string) => {\n try {\n const result = await client.call(\"mcp.remove\", { name });\n if (result.success) {\n printer.success(`MCP \"${name}\" removed.`);\n } else {\n printer.warn(`MCP \"${name}\" not found.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createMcpExportCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"export\")\n .description(\"Export an MCP server config to a JSON file\")\n .argument(\"<name>\", \"MCP server name\")\n .option(\"-o, --out <file>\", \"Output file path\", \"./{name}.json\")\n .action(async (name: string, opts: { out: string }) => {\n try {\n const outPath = opts.out.replace(\"{name}\", name);\n await client.call(\"mcp.export\", { name, filePath: outPath });\n printer.success(`MCP \"${name}\" exported to ${outPath}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createWorkflowListCommand } from \"./list\";\nimport { createWorkflowShowCommand } from \"./show\";\nimport { createWorkflowAddCommand } from \"./add\";\nimport { createWorkflowRemoveCommand } from \"./remove\";\nimport { createWorkflowExportCommand } from \"./export\";\n\nexport function createWorkflowCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"workflow\")\n .description(\"Manage loaded workflows\");\n\n cmd.addCommand(createWorkflowListCommand(client, printer));\n cmd.addCommand(createWorkflowShowCommand(client, printer));\n cmd.addCommand(createWorkflowAddCommand(client, printer));\n cmd.addCommand(createWorkflowRemoveCommand(client, printer));\n cmd.addCommand(createWorkflowExportCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatWorkflowList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createWorkflowListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all loaded workflows\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const workflows = await client.call(\"workflow.list\", {});\n printer.log(formatWorkflowList(workflows, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatWorkflowDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createWorkflowShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show workflow details\")\n .argument(\"<name>\", \"Workflow name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { format: OutputFormat }) => {\n try {\n const workflow = await client.call(\"workflow.get\", { name });\n printer.log(formatWorkflowDetail(workflow, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createWorkflowAddCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"add\")\n .description(\"Add a workflow from a JSON file\")\n .argument(\"<file>\", \"Path to workflow definition JSON file\")\n .action(async (file: string) => {\n try {\n const raw = await readFile(resolve(file), \"utf-8\");\n const component = JSON.parse(raw);\n const result = await client.call(\"workflow.add\", { component });\n printer.success(`Workflow \"${result.name}\" added successfully.`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createWorkflowRemoveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"remove\")\n .alias(\"rm\")\n .description(\"Remove a loaded workflow\")\n .argument(\"<name>\", \"Workflow name\")\n .action(async (name: string) => {\n try {\n const result = await client.call(\"workflow.remove\", { name });\n if (result.success) {\n printer.success(`Workflow \"${name}\" removed.`);\n } else {\n printer.warn(`Workflow \"${name}\" not found.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createWorkflowExportCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"export\")\n .description(\"Export a workflow to a JSON file\")\n .argument(\"<name>\", \"Workflow name\")\n .option(\"-o, --out <file>\", \"Output file path\", \"./{name}.json\")\n .action(async (name: string, opts: { out: string }) => {\n try {\n const outPath = opts.out.replace(\"{name}\", name);\n await client.call(\"workflow.export\", { name, filePath: outPath });\n printer.success(`Workflow \"${name}\" exported to ${outPath}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createPluginListCommand } from \"./list\";\nimport { createPluginShowCommand } from \"./show\";\nimport { createPluginAddCommand } from \"./add\";\nimport { createPluginRemoveCommand } from \"./remove\";\nimport { createPluginExportCommand } from \"./export\";\n\nexport function createPluginCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"plugin\")\n .description(\"Manage loaded plugins\");\n\n cmd.addCommand(createPluginListCommand(client, printer));\n cmd.addCommand(createPluginShowCommand(client, printer));\n cmd.addCommand(createPluginAddCommand(client, printer));\n cmd.addCommand(createPluginRemoveCommand(client, printer));\n cmd.addCommand(createPluginExportCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatPluginList, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPluginListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List all plugins\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const plugins = await client.call(\"plugin.list\", {});\n printer.log(formatPluginList(plugins, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, formatPluginDetail, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPluginShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show plugin details\")\n .argument(\"<name>\", \"Plugin name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (name: string, opts: { format: OutputFormat }) => {\n try {\n const plugin = await client.call(\"plugin.get\", { name });\n printer.log(formatPluginDetail(plugin, opts.format));\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPluginAddCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"add\")\n .description(\"Add a plugin from a JSON file\")\n .argument(\"<file>\", \"Path to plugin definition JSON file\")\n .action(async (file: string) => {\n try {\n const raw = await readFile(resolve(file), \"utf-8\");\n const component = JSON.parse(raw);\n const result = await client.call(\"plugin.add\", { component });\n printer.success(`Plugin \"${result.name}\" added successfully.`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPluginRemoveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"remove\")\n .alias(\"rm\")\n .description(\"Remove a loaded plugin\")\n .argument(\"<name>\", \"Plugin name\")\n .action(async (name: string) => {\n try {\n const result = await client.call(\"plugin.remove\", { name });\n if (result.success) {\n printer.success(`Plugin \"${name}\" removed.`);\n } else {\n printer.warn(`Plugin \"${name}\" not found.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPluginExportCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"export\")\n .description(\"Export a plugin to a JSON file\")\n .argument(\"<name>\", \"Plugin name\")\n .option(\"-o, --out <file>\", \"Output file path\", \"./{name}.json\")\n .action(async (name: string, opts: { out: string }) => {\n try {\n const outPath = opts.out.replace(\"{name}\", name);\n await client.call(\"plugin.export\", { name, filePath: outPath });\n printer.success(`Plugin \"${name}\" exported to ${outPath}`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createSourceListCommand } from \"./list\";\nimport { createSourceAddCommand } from \"./add\";\nimport { createSourceRemoveCommand } from \"./remove\";\nimport { createSourceSyncCommand } from \"./sync\";\n\nexport function createSourceCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"source\")\n .description(\"Manage component sources (GitHub repos, local dirs)\");\n\n cmd.addCommand(createSourceListCommand(client, printer));\n cmd.addCommand(createSourceAddCommand(client, printer));\n cmd.addCommand(createSourceRemoveCommand(client, printer));\n cmd.addCommand(createSourceSyncCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\nimport type { SourceEntry } from \"@actant/shared\";\n\nexport function createSourceListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List registered component sources\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n try {\n const sources: SourceEntry[] = await client.call(\"source.list\", {});\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(sources, null, 2));\n } else if (opts.format === \"quiet\") {\n printer.log(sources.map((s) => s.name).join(\"\\n\"));\n } else {\n if (sources.length === 0) {\n printer.dim(\"No sources registered.\");\n } else {\n for (const s of sources) {\n const cfg = s.config;\n const detail = cfg.type === \"github\" ? cfg.url : cfg.type === \"local\" ? cfg.path : \"unknown\";\n printer.log(` ${s.name} (${cfg.type}) ${detail}`);\n }\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSourceAddCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"add\")\n .description(\"Register a component source\")\n .argument(\"<url-or-path>\", \"GitHub URL or local directory path\")\n .requiredOption(\"--name <name>\", \"Package name (namespace prefix)\")\n .option(\"--type <type>\", \"Source type: github, local\", \"github\")\n .option(\"--branch <branch>\", \"Git branch (for github type)\", \"main\")\n .action(async (urlOrPath: string, opts: { name: string; type: string; branch: string }) => {\n try {\n const config = opts.type === \"local\"\n ? { type: \"local\" as const, path: urlOrPath }\n : { type: \"github\" as const, url: urlOrPath, branch: opts.branch };\n const result = await client.call(\"source.add\", { name: opts.name, config });\n const c = result.components;\n printer.success(\n `Source \"${opts.name}\" added. Components: ${c.skills} skills, ${c.prompts} prompts, ${c.mcp} mcp, ${c.workflows} workflows, ${c.presets} presets`,\n );\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSourceRemoveCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"remove\")\n .alias(\"rm\")\n .description(\"Remove a registered source\")\n .argument(\"<name>\", \"Source name\")\n .action(async (name: string) => {\n try {\n const result = await client.call(\"source.remove\", { name });\n if (result.success) {\n printer.success(`Source \"${name}\" removed.`);\n } else {\n printer.warn(`Source \"${name}\" not found.`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createSourceSyncCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"sync\")\n .description(\"Sync component source(s)\")\n .argument(\"[name]\", \"Source name (syncs all if omitted)\")\n .action(async (name?: string) => {\n try {\n const result = await client.call(\"source.sync\", { name });\n printer.success(`Synced: ${result.synced.join(\", \")}`);\n\n const report = result.report;\n if (report) {\n const parts: string[] = [];\n if (report.addedCount > 0) parts.push(chalk.green(`+${report.addedCount} added`));\n if (report.updatedCount > 0) parts.push(chalk.yellow(`${report.updatedCount} updated`));\n if (report.removedCount > 0) parts.push(chalk.red(`-${report.removedCount} removed`));\n if (parts.length > 0) {\n printer.log(` ${parts.join(\", \")}`);\n }\n if (report.hasBreakingChanges) {\n printer.warn(\" ⚠ Breaking changes detected (major version bump). Review updated components.\");\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createPresetListCommand } from \"./list\";\nimport { createPresetShowCommand } from \"./show\";\nimport { createPresetApplyCommand } from \"./apply\";\n\nexport function createPresetCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"preset\")\n .description(\"Manage component presets (bundled compositions)\");\n\n cmd.addCommand(createPresetListCommand(client, printer));\n cmd.addCommand(createPresetShowCommand(client, printer));\n cmd.addCommand(createPresetApplyCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\nimport type { PresetDefinition } from \"@actant/shared\";\n\nexport function createPresetListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List available presets from registered sources\")\n .argument(\"[package]\", \"Filter by source package name\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (packageName: string | undefined, opts: { format: OutputFormat }) => {\n try {\n const presets: PresetDefinition[] = await client.call(\"preset.list\", { packageName });\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(presets, null, 2));\n } else if (opts.format === \"quiet\") {\n printer.log(presets.map((p) => p.name).join(\"\\n\"));\n } else {\n if (presets.length === 0) {\n printer.dim(\"No presets available.\");\n } else {\n for (const p of presets) {\n const desc = p.description ? ` — ${p.description}` : \"\";\n printer.log(` ${p.name}${desc}`);\n }\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type OutputFormat, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPresetShowCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"show\")\n .description(\"Show preset details\")\n .argument(\"<qualified-name>\", \"Preset qualified name (package@preset)\")\n .option(\"-f, --format <format>\", \"Output format: table, json\", \"table\")\n .action(async (qualifiedName: string, opts: { format: OutputFormat }) => {\n try {\n const preset = await client.call(\"preset.show\", { qualifiedName });\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(preset, null, 2));\n } else {\n printer.log(`Preset: ${preset.name}`);\n if (preset.description) printer.log(`Description: ${preset.description}`);\n if (preset.skills?.length) printer.log(`Skills: ${preset.skills.join(\", \")}`);\n if (preset.prompts?.length) printer.log(`Prompts: ${preset.prompts.join(\", \")}`);\n if (preset.mcpServers?.length) printer.log(`MCP Servers: ${preset.mcpServers.join(\", \")}`);\n if (preset.workflows?.length) printer.log(`Workflows: ${preset.workflows.join(\", \")}`);\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createPresetApplyCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"apply\")\n .description(\"Apply a preset to a template (adds all preset components)\")\n .argument(\"<qualified-name>\", \"Preset qualified name (package@preset)\")\n .argument(\"<template>\", \"Template name to apply to\")\n .action(async (qualifiedName: string, templateName: string) => {\n try {\n const result = await client.call(\"preset.apply\", { qualifiedName, templateName });\n printer.success(`Preset \"${qualifiedName}\" applied to template \"${result.name}\".`);\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createScheduleListCommand } from \"./list\";\n\nexport function createScheduleCommand(client: RpcClient, printer?: CliPrinter): Command {\n const cmd = new Command(\"schedule\")\n .description(\"Manage agent schedules (heartbeat, cron, hooks)\");\n\n cmd.addCommand(createScheduleListCommand(client, printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport type { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\n\nexport function createScheduleListCommand(client: RpcClient, printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"list\")\n .alias(\"ls\")\n .description(\"List schedule sources for an agent\")\n .argument(\"<name>\", \"Agent name\")\n .option(\"-f, --format <format>\", \"Output format: table, json\", \"table\")\n .action(async (name: string, opts: { format: string }) => {\n try {\n const result = await client.call(\"schedule.list\", { name });\n if (opts.format === \"json\") {\n printer.log(JSON.stringify(result, null, 2));\n } else {\n if (result.sources.length === 0 && !result.running) {\n printer.dim(`No scheduler for agent \"${name}\".`);\n } else {\n printer.log(`Scheduler: ${result.running ? \"running\" : \"stopped\"}`);\n for (const s of result.sources) {\n printer.log(` ${s.id} (${s.type}) ${s.active ? \"active\" : \"inactive\"}`);\n }\n }\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport type { CliPrinter } from \"../../output/index\";\nimport { createDaemonStartCommand } from \"./start\";\nimport { createDaemonStopCommand } from \"./stop\";\nimport { createDaemonStatusCommand } from \"./status\";\n\nexport function createDaemonCommand(printer?: CliPrinter): Command {\n const cmd = new Command(\"daemon\")\n .description(\"Manage the Actant daemon\");\n\n cmd.addCommand(createDaemonStartCommand(printer));\n cmd.addCommand(createDaemonStopCommand(printer));\n cmd.addCommand(createDaemonStatusCommand(printer));\n\n return cmd;\n}\n","import { Command } from \"commander\";\nimport { join } from \"node:path\";\nimport { fork, spawn } from \"node:child_process\";\nimport chalk from \"chalk\";\nimport { onShutdownSignal, isWindows, isSingleExecutable } from \"@actant/shared\";\nimport { RpcClient } from \"../../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../../output/index\";\nimport { defaultSocketPath } from \"../../program\";\n\n/**\n * Internal flag used by SEA binary to re-exec itself in daemon mode.\n * When the binary is a single executable, there's no separate daemon-entry.js\n * to fork — instead we spawn ourselves with this flag.\n */\nexport const SEA_DAEMON_FLAG = \"--__actant-daemon\";\n\nfunction spawnDaemonChild() {\n if (isSingleExecutable()) {\n return spawn(process.execPath, [SEA_DAEMON_FLAG], {\n detached: true,\n stdio: [\"ignore\", \"ignore\", \"pipe\"],\n env: process.env,\n });\n }\n\n const daemonScript = join(import.meta.dirname, \"daemon-entry.js\");\n\n // Windows: fork() + detached doesn't truly detach due to IPC channel\n // keeping parent-child bound together (Node.js #36808).\n return isWindows()\n ? spawn(process.execPath, [daemonScript], {\n detached: true,\n stdio: [\"ignore\", \"ignore\", \"pipe\"],\n env: process.env,\n })\n : fork(daemonScript, [], {\n detached: true,\n stdio: [\"ignore\", \"ignore\", \"pipe\", \"ipc\"],\n env: process.env,\n });\n}\n\nexport function createDaemonStartCommand(printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"start\")\n .description(\"Start the Actant daemon\")\n .option(\"--foreground\", \"Run in foreground (don't daemonize)\", false)\n .action(async (opts: { foreground: boolean }) => {\n const client = new RpcClient(defaultSocketPath());\n\n const alive = await client.ping();\n if (alive) {\n printer.warn(\"Daemon is already running.\");\n return;\n }\n\n if (opts.foreground) {\n try {\n const { Daemon } = await import(\"@actant/api\");\n const daemon = new Daemon();\n\n onShutdownSignal(async () => {\n await daemon.stop();\n process.exit(0);\n });\n\n await daemon.start();\n printer.log(`${chalk.green(\"Daemon started (foreground).\")} PID: ${process.pid}`);\n printer.dim(\"Press Ctrl+C to stop.\");\n\n await new Promise(() => {});\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n }\n } else {\n const child = spawnDaemonChild();\n\n const stderrChunks: Buffer[] = [];\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n stderrChunks.push(chunk);\n });\n\n let earlyExit = false;\n let earlyExitCode: number | null = null;\n child.on(\"exit\", (code) => {\n earlyExit = true;\n earlyExitCode = code;\n });\n\n await new Promise((resolve) => setTimeout(resolve, 2000));\n\n if (earlyExit) {\n const stderr = Buffer.concat(stderrChunks).toString().trim();\n printer.error(`Daemon process exited unexpectedly (code: ${earlyExitCode}).`);\n if (stderr) printer.error(stderr);\n process.exitCode = 1;\n return;\n }\n\n let healthy = false;\n for (let i = 0; i < 3; i++) {\n healthy = await client.ping();\n if (healthy) break;\n await new Promise((resolve) => setTimeout(resolve, 500));\n }\n\n child.stderr?.destroy();\n if (\"connected\" in child && child.connected) child.disconnect();\n child.unref();\n\n if (healthy) {\n printer.log(`${chalk.green(\"Daemon started.\")} PID: ${child.pid}`);\n } else {\n const stderr = Buffer.concat(stderrChunks).toString().trim();\n printer.error(\"Daemon process started but is not responding.\");\n if (stderr) printer.error(stderr);\n process.exitCode = 1;\n }\n }\n });\n}\n","import { Command } from \"commander\";\nimport { RpcClient } from \"../../client/rpc-client\";\nimport { type CliPrinter, defaultPrinter } from \"../../output/index\";\nimport { defaultSocketPath } from \"../../program\";\n\nexport function createDaemonStopCommand(\n printer: CliPrinter = defaultPrinter,\n client?: RpcClient,\n): Command {\n return new Command(\"stop\")\n .description(\"Stop the Actant daemon\")\n .action(async () => {\n const rpc = client ?? new RpcClient(defaultSocketPath());\n\n try {\n await rpc.call(\"daemon.shutdown\", {});\n printer.success(\"Daemon stopping...\");\n } catch {\n printer.warn(\"Daemon is not running.\");\n }\n });\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { RpcClient } from \"../../client/rpc-client\";\nimport { type CliPrinter, defaultPrinter, type OutputFormat } from \"../../output/index\";\nimport { defaultSocketPath } from \"../../program\";\n\nexport function createDaemonStatusCommand(printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"status\")\n .description(\"Check if the daemon is running\")\n .option(\"-f, --format <format>\", \"Output format: table, json, quiet\", \"table\")\n .action(async (opts: { format: OutputFormat }) => {\n const client = new RpcClient(defaultSocketPath());\n\n try {\n const result = await client.call(\"daemon.ping\", {});\n\n if (opts.format === \"json\") {\n printer.log(JSON.stringify({ running: true, ...result }, null, 2));\n } else if (opts.format === \"quiet\") {\n printer.log(\"running\");\n } else {\n printer.success(\"Daemon is running.\");\n printer.log(` Version: ${result.version}`);\n printer.log(` Uptime: ${result.uptime}s`);\n printer.log(` Agents: ${result.agents}`);\n }\n } catch {\n if (opts.format === \"json\") {\n printer.log(JSON.stringify({ running: false }, null, 2));\n } else if (opts.format === \"quiet\") {\n printer.log(\"stopped\");\n } else {\n printer.log(chalk.red(\"Daemon is not running.\"));\n printer.dim(\"Start with: actant daemon start\");\n }\n process.exitCode = 1;\n }\n });\n}\n","import { Command } from \"commander\";\nimport { spawn, type ChildProcess } from \"node:child_process\";\nimport { createInterface } from \"node:readline\";\nimport { RpcClient } from \"../client/rpc-client\";\nimport { presentError, type CliPrinter, defaultPrinter } from \"../output/index\";\nimport { defaultSocketPath } from \"../program\";\n\n/**\n * `actant proxy <name>` — acts as a transparent ACP bridge on stdin/stdout.\n *\n * **Direct Bridge (default):** Proxy spawns the Agent subprocess directly,\n * pipes IDE stdio ↔ Agent stdio, registers lifecycle with Daemon via\n * resolve/attach/detach. No ACP message parsing — pure byte stream.\n *\n * **Session Lease (`--lease`):** Proxy connects to a Daemon-managed Agent,\n * translates ACP protocol messages from IDE into session.* RPC calls.\n */\nexport function createProxyCommand(printer: CliPrinter = defaultPrinter): Command {\n return new Command(\"proxy\")\n .description(\"Run an ACP proxy for an agent (stdin/stdout ACP protocol)\")\n .argument(\"<name>\", \"Agent name to proxy\")\n .option(\"--lease\", \"Use Session Lease mode (requires running agent)\", false)\n .option(\"-t, --template <template>\", \"Template name (auto-creates instance if not found)\")\n .action(async (name: string, opts: { lease: boolean; template?: string }) => {\n if (opts.lease) {\n await runSessionLease(name, printer);\n } else {\n await runDirectBridge(name, opts, printer);\n }\n });\n}\n\nasync function runDirectBridge(\n name: string,\n opts: { template?: string },\n printer: CliPrinter,\n): Promise<void> {\n const client = new RpcClient(defaultSocketPath());\n let child: ChildProcess | null = null;\n let instanceName: string = name;\n let attached = false;\n let cleaning = false;\n\n const cleanup = async () => {\n if (cleaning) return;\n cleaning = true;\n\n if (child && !child.killed) {\n child.kill(\"SIGTERM\");\n await new Promise<void>((resolve) => {\n const timer = setTimeout(() => {\n child?.kill(\"SIGKILL\");\n resolve();\n }, 3000);\n child?.once(\"exit\", () => {\n clearTimeout(timer);\n resolve();\n });\n });\n }\n\n if (attached) {\n try {\n await client.call(\"agent.detach\", { name: instanceName, cleanup: true });\n } catch {\n // Daemon may already be down\n }\n attached = false;\n }\n };\n\n try {\n const alive = await client.ping();\n if (!alive) {\n printer.error(\"Daemon is not running. Start it with: actant daemon start\");\n process.exitCode = 1;\n return;\n }\n\n const resolved = await client.call(\"agent.resolve\", {\n name,\n template: opts.template,\n });\n\n instanceName = resolved.instanceName;\n\n // Check if instance is already occupied → auto-instantiate ephemeral copy\n const targetInstance = await resolveAvailableInstance(\n client,\n instanceName,\n resolved,\n printer,\n );\n if (!targetInstance) {\n process.exitCode = 1;\n return;\n }\n instanceName = targetInstance.instanceName;\n const workspaceDir = targetInstance.workspaceDir;\n const command = targetInstance.command;\n const args = targetInstance.args;\n const env = { ...process.env, ...targetInstance.env };\n\n child = spawn(command, args, {\n cwd: workspaceDir,\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n env,\n });\n\n if (!child.stdin || !child.stdout || child.pid == null) {\n throw new Error(\"Failed to create stdio pipes for agent subprocess\");\n }\n\n const childPid = child.pid;\n const childProc = child;\n\n await client.call(\"agent.attach\", {\n name: instanceName,\n pid: childPid,\n metadata: { proxyMode: \"direct-bridge\" },\n });\n attached = true;\n\n process.on(\"SIGINT\", () => { void cleanup().then(() => process.exit(0)); });\n process.on(\"SIGTERM\", () => { void cleanup().then(() => process.exit(0)); });\n\n // Transparent byte-stream bridge: IDE ↔ Proxy ↔ Agent\n process.stdin.pipe(child.stdin);\n child.stdout.pipe(process.stdout);\n child.stderr?.pipe(process.stderr);\n\n const exitCode = await new Promise<number>((resolve) => {\n childProc.on(\"exit\", (code) => resolve(code ?? 1));\n childProc.on(\"error\", (err) => {\n printer.error(`Agent process error: ${err.message}`);\n resolve(1);\n });\n });\n\n if (attached) {\n try {\n await client.call(\"agent.detach\", { name: instanceName, cleanup: true });\n } catch {\n // ignore\n }\n attached = false;\n }\n\n process.exitCode = exitCode;\n } catch (err) {\n await cleanup();\n presentError(err, printer);\n process.exitCode = 1;\n }\n}\n\ninterface AvailableInstance {\n instanceName: string;\n workspaceDir: string;\n command: string;\n args: string[];\n env?: Record<string, string>;\n}\n\n/**\n * If the target instance is already running (occupied), attempt to create\n * an ephemeral instance from the same template. Returns null when the\n * instance is occupied but cannot be auto-instantiated.\n */\nasync function resolveAvailableInstance(\n client: RpcClient,\n instanceName: string,\n resolved: {\n workspaceDir: string;\n command: string;\n args: string[];\n env?: Record<string, string>;\n instanceName: string;\n },\n printer: CliPrinter,\n): Promise<AvailableInstance | null> {\n try {\n const status = await client.call(\"agent.status\", { name: instanceName });\n if (status.status === \"running\" && status.pid != null) {\n // Instance is occupied — try auto-instantiation from the same template\n const templateName = status.templateName;\n if (!templateName) {\n printer.error(\n `Agent \"${instanceName}\" is already running (pid ${status.pid}) and has no template for auto-instantiation.`,\n );\n return null;\n }\n\n const ephemeralName = `${instanceName}-proxy-${Date.now()}`;\n const ephemeral = await client.call(\"agent.resolve\", {\n name: ephemeralName,\n template: templateName,\n overrides: { workspacePolicy: \"ephemeral\" },\n });\n\n printer.dim(\n `Instance \"${instanceName}\" occupied → created ephemeral \"${ephemeralName}\"`,\n );\n\n return {\n instanceName: ephemeral.instanceName,\n workspaceDir: ephemeral.workspaceDir,\n command: ephemeral.command,\n args: ephemeral.args,\n env: ephemeral.env,\n };\n }\n } catch {\n // agent.status throws when instance was just created via resolve — that's fine\n }\n\n return {\n instanceName: resolved.instanceName,\n workspaceDir: resolved.workspaceDir,\n command: resolved.command,\n args: resolved.args,\n env: resolved.env,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Session Lease mode — ACP pipe via Gateway (with legacy fallback)\n// ---------------------------------------------------------------------------\n\n/**\n * Session Lease Proxy: thin ACP pipe between IDE (stdio) and Daemon (socket).\n *\n * The proxy does NOT parse ACP messages. It connects a Unix socket to the\n * Daemon's ACP Gateway and bridges IDE stdio <-> socket byte-for-byte.\n * All ACP intelligence (forwarding, impersonation) lives in the Daemon's Gateway.\n *\n * Falls back to legacy RPC translation when Daemon doesn't support gateway.lease.\n */\nasync function runSessionLease(\n agentName: string,\n printer: CliPrinter,\n): Promise<void> {\n const rpcClient = new RpcClient(defaultSocketPath());\n\n try {\n const alive = await rpcClient.ping();\n if (!alive) {\n printer.error(\"Daemon is not running. Start it with: actant daemon start\");\n process.exitCode = 1;\n return;\n }\n\n const meta = await rpcClient.call(\"agent.status\", { name: agentName });\n if (meta.status !== \"running\") {\n printer.error(\n `Agent \"${agentName}\" is not running (status: ${meta.status}). ` +\n `Session Lease requires a running agent. Start with: actant agent start ${agentName}`,\n );\n process.exitCode = 1;\n return;\n }\n } catch (err) {\n presentError(err, printer);\n process.exitCode = 1;\n return;\n }\n\n // Try Gateway pipe first, fall back to legacy RPC translation\n let gatewaySocketPath: string | null = null;\n try {\n const result = await rpcClient.call(\"gateway.lease\", { agentName });\n gatewaySocketPath = (result as { socketPath: string }).socketPath;\n } catch {\n // gateway.lease not implemented yet — use legacy mode\n }\n\n if (gatewaySocketPath) {\n await runGatewayPipe(gatewaySocketPath, printer);\n } else {\n printer.dim(\"Gateway lease not available, using legacy session lease mode\");\n await runLegacySessionLease(agentName, rpcClient, printer);\n }\n}\n\nasync function runGatewayPipe(\n gatewaySocketPath: string,\n _printer: CliPrinter,\n): Promise<void> {\n const net = await import(\"node:net\");\n const socket = net.createConnection(gatewaySocketPath);\n\n let cleaning = false;\n const cleanup = () => {\n if (cleaning) return;\n cleaning = true;\n socket.destroy();\n };\n\n process.on(\"SIGINT\", () => { cleanup(); process.exit(0); });\n process.on(\"SIGTERM\", () => { cleanup(); process.exit(0); });\n\n socket.on(\"connect\", () => {\n process.stdin.pipe(socket);\n socket.pipe(process.stdout);\n });\n\n socket.on(\"error\", (err) => {\n _printer.error(`Gateway connection error: ${err.message}`);\n cleanup();\n process.exitCode = 1;\n });\n\n socket.on(\"close\", () => { cleanup(); process.exit(0); });\n\n await new Promise<void>(() => {});\n}\n\n/**\n * Legacy Session Lease: RPC-based protocol translation.\n * Kept for backward compat until gateway.lease is fully rolled out.\n */\nasync function runLegacySessionLease(\n agentName: string,\n client: RpcClient,\n _printer: CliPrinter,\n): Promise<void> {\n const clientId = `proxy-${Date.now()}`;\n let sessionId: string | null = null;\n let closed = false;\n\n const cleanup = async () => {\n if (closed) return;\n closed = true;\n if (sessionId) {\n try { await client.call(\"session.close\", { sessionId }); } catch { /* ignore */ }\n }\n };\n\n process.on(\"SIGINT\", () => { void cleanup().then(() => process.exit(0)); });\n process.on(\"SIGTERM\", () => { void cleanup().then(() => process.exit(0)); });\n\n const rl = createInterface({ input: process.stdin });\n\n rl.on(\"line\", (line) => {\n if (closed) return;\n void handleLegacyMessage(line, agentName, clientId, client, {\n getSessionId: () => sessionId,\n setSessionId: (id) => { sessionId = id; },\n }).catch((err) => {\n writeAcpError(null, -32603, err instanceof Error ? err.message : String(err));\n });\n });\n\n rl.on(\"close\", () => {\n void cleanup().then(() => process.exit(0));\n });\n}\n\ninterface SessionContext {\n getSessionId(): string | null;\n setSessionId(id: string): void;\n}\n\ninterface AcpMessage {\n jsonrpc: string;\n id?: unknown;\n method?: string;\n params?: Record<string, unknown>;\n}\n\nasync function handleLegacyMessage(\n line: string,\n agentName: string,\n clientId: string,\n client: RpcClient,\n ctx: SessionContext,\n): Promise<void> {\n let msg: AcpMessage;\n try { msg = JSON.parse(line); } catch { return; }\n if (!msg.method) return;\n\n const params = msg.params ?? {};\n\n switch (msg.method) {\n case \"initialize\":\n writeAcpResponse(msg.id, {\n protocolVersion: 1,\n agentInfo: { name: \"actant-proxy\", title: `Actant Proxy: ${agentName} (lease)`, version: \"0.1.0\" },\n agentCapabilities: {},\n });\n break;\n\n case \"session/new\":\n try {\n const result = await client.call(\"session.create\", { agentName, clientId });\n ctx.setSessionId(result.sessionId);\n writeAcpResponse(msg.id, { sessionId: result.sessionId, modes: {} });\n } catch (err) {\n writeAcpError(msg.id, -32603, err instanceof Error ? err.message : String(err));\n }\n break;\n\n case \"session/prompt\": {\n const sid = (params[\"sessionId\"] as string) ?? ctx.getSessionId();\n if (!sid) { writeAcpError(msg.id, -32602, \"No session. Call session/new first.\"); break; }\n try {\n const prompt = params[\"prompt\"] as Array<{ type: string; text?: string }> | undefined;\n const text = prompt?.find((p) => p.type === \"text\")?.text ?? \"\";\n const result = await client.call(\"session.prompt\", { sessionId: sid, text }, { timeoutMs: 305_000 });\n writeAcpResponse(msg.id, { stopReason: result.stopReason });\n } catch (err) {\n writeAcpError(msg.id, -32603, err instanceof Error ? err.message : String(err));\n }\n break;\n }\n\n case \"session/cancel\": {\n const sid = (params[\"sessionId\"] as string) ?? ctx.getSessionId();\n if (sid) { try { await client.call(\"session.cancel\", { sessionId: sid }); } catch { /* best-effort */ } }\n if (msg.id != null) writeAcpResponse(msg.id, { ok: true });\n break;\n }\n\n default:\n if (msg.id != null) writeAcpError(msg.id, -32601, `Unsupported method: ${msg.method}`);\n }\n}\n\nfunction writeAcpResponse(id: unknown, result: unknown): void {\n process.stdout.write(JSON.stringify({ jsonrpc: \"2.0\", id: id ?? null, result }) + \"\\n\");\n}\n\nfunction writeAcpError(id: unknown, code: number, message: string): void {\n process.stdout.write(JSON.stringify({ jsonrpc: \"2.0\", id: id ?? null, error: { code, message } }) + \"\\n\");\n}\n","import { Command } from \"commander\";\nimport { spawn } from \"child_process\";\nimport { writeFileSync, mkdirSync, readFileSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport chalk from \"chalk\";\n\nexport function createSelfUpdateCommand(): Command {\n return new Command(\"self-update\")\n .description(\"Update Actant from local source\")\n .option(\"--source <path>\", \"Source directory path\")\n .option(\"--check\", \"Only check for updates, don't apply\")\n .option(\"--force\", \"Skip active session warnings\")\n .option(\"--dry-run\", \"Show what would be done without doing it\")\n .option(\"--no-agent\", \"Skip agent supervisor, run script directly\")\n .option(\"--skip-build\", \"Skip build step (use pre-built dist)\")\n .action(async (opts) => {\n const actantHome = process.env.ACTANT_HOME || join(homedir(), \".actant\");\n\n // Read config for devSourcePath\n let devSourcePath = opts.source;\n if (!devSourcePath) {\n const configPath = join(actantHome, \"config.json\");\n try {\n const config = JSON.parse(readFileSync(configPath, \"utf-8\"));\n devSourcePath = config.devSourcePath;\n } catch {\n /* ignore */\n }\n }\n\n if (!devSourcePath) {\n console.error(\n chalk.red(\n \"No source path specified. Use --source <path> or set devSourcePath in ~/.actant/config.json\",\n ),\n );\n process.exit(1);\n }\n\n if (opts.check) {\n // Show version comparison\n showVersionCheck(devSourcePath, actantHome);\n return;\n }\n\n // Read installed version from CLI package\n let installedVersion = \"0.1.0\";\n const cliPkgPath = join(devSourcePath, \"packages\", \"cli\", \"package.json\");\n if (existsSync(cliPkgPath)) {\n try {\n const cliPkg = JSON.parse(readFileSync(cliPkgPath, \"utf-8\"));\n installedVersion = cliPkg.version ?? installedVersion;\n } catch {\n /* ignore */\n }\n }\n\n // Write update manifest\n const updateId = `upd-${new Date().toISOString().replace(/[-:T.]/g, \"\").slice(0, 15)}`;\n const manifestPath = join(actantHome, \"update-manifest.json\");\n const manifest = {\n updateId,\n createdAt: new Date().toISOString(),\n sourcePath: devSourcePath,\n installedVersion: { version: installedVersion },\n backupPath: join(actantHome, \"backups\", updateId),\n runningAgents: [],\n daemonSocketPath: join(actantHome, \"daemon.sock\"),\n rollbackOnFailure: true,\n phase: \"pending\",\n useAgent: !opts.noAgent,\n };\n\n mkdirSync(actantHome, { recursive: true });\n writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));\n\n console.log(chalk.cyan(\"=== Actant Self-Update ===\"));\n console.log(`Update ID: ${updateId}`);\n console.log(`Source: ${devSourcePath}`);\n\n // Spawn the update script\n const scriptPath = join(devSourcePath, \"scripts\", \"self-update.js\");\n const scriptArgs = [\"--manifest\", manifestPath];\n if (opts.dryRun) scriptArgs.push(\"--dry-run\");\n if (opts.skipBuild) scriptArgs.push(\"--skip-build\");\n\n console.log(chalk.gray(`Spawning: node ${scriptPath} ${scriptArgs.join(\" \")}`));\n\n const child = spawn(\"node\", [scriptPath, ...scriptArgs], {\n detached: !opts.noAgent,\n stdio: opts.noAgent ? \"inherit\" : \"ignore\",\n });\n\n if (!opts.noAgent) {\n child.unref();\n console.log(chalk.green(\"Update script spawned in background. Check logs at:\"));\n console.log(chalk.gray(` ${join(actantHome, \"logs\", `update-${updateId}.log`)}`));\n } else {\n child.on(\"exit\", (code) => {\n if (code === 0) {\n console.log(chalk.green(\"\\nUpdate completed successfully!\"));\n } else if (code === 1) {\n console.log(chalk.yellow(\"\\nUpdate failed, rolled back to previous version.\"));\n } else {\n console.log(chalk.red(\"\\nSevere failure — manual intervention may be needed.\"));\n }\n });\n }\n });\n}\n\nfunction showVersionCheck(sourcePath: string, actantHome: string): void {\n console.log(chalk.cyan(\"=== Version Check ===\"));\n\n try {\n const pkg = JSON.parse(readFileSync(join(sourcePath, \"package.json\"), \"utf-8\"));\n console.log(`Source version: ${pkg.version || \"unknown\"}`);\n } catch {\n console.log(\"Source version: unknown\");\n }\n\n // Check for last update\n const manifestPath = join(actantHome, \"update-manifest.json\");\n try {\n const manifest = JSON.parse(readFileSync(manifestPath, \"utf-8\"));\n console.log(`Last update: ${manifest.updateId} (phase: ${manifest.phase})`);\n } catch {\n console.log(\"Last update: none\");\n }\n}\n"],"mappings":";AAAA,SAAS,WAAAA,iBAAe;AACxB,SAAS,yBAAyB;;;ACDlC,SAAS,wBAAwB;AAGjC,IAAI,YAAY;AAET,IAAM,YAAN,MAAgB;AAAA,EACrB,YAA6B,YAAoB;AAApB;AAAA,EAAqB;AAAA,EAElD,MAAM,KACJ,QACA,QACA,SACoC;AACpC,UAAM,KAAK,EAAE;AACb,UAAM,UAAsB;AAAA,MAC1B,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,UAAM,WAAW,MAAM,KAAK,KAAK,SAAS,SAAS,SAAS;AAE5D,QAAI,SAAS,OAAO;AAClB,YAAM,MAAM,IAAI,aAAa,SAAS,MAAM,SAAS,SAAS,MAAM,MAAM,SAAS,MAAM,IAAI;AAC7F,YAAM;AAAA,IACR;AAEA,WAAO,SAAS;AAAA,EAClB;AAAA,EAEA,MAAM,OAAyB;AAC7B,QAAI;AACF,YAAM,KAAK,KAAK,eAAe,CAAC,CAAC;AACjC,aAAO;AAAA,IACT,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEQ,KAAK,SAAqB,WAA0C;AAC1E,UAAM,mBAAmB,cACnB,QAAQ,IAAI,uBAAuB,IAAI,OAAO,QAAQ,IAAI,uBAAuB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AAW,oBAAoB,OAAO,CAAC;AAC/C,UAAQ,WAAW,mBAAmB,OAAO,CAAC;AAC9C,UAAQ,WAAW,kBAAkB,CAAC;AACtC,UAAQ,WAAW,wBAAwB,CAAC;AAE5C,UAAQ,aAAa;AAErB,SAAO;AACT;AAEA,eAAsB,IAAI,MAAgC;AACxD,QAAM,OAAO,QAAQ,QAAQ;AAE7B,QAAM,gBAAgB,KAAK,SAAS,KAAK,CAAC,KAAK,CAAC,GAAG,WAAW,GAAG;AAEjE,MAAI,CAAC,eAAe;AAClB,UAAM,mBAAmB,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,WAAW;AACzE,UAAM,gBAAgB,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,QAAQ;AAEnE,QAAI,CAAC,oBAAoB,CAAC,eAAe;AACvC,YAAM,OAAO,kBAAkB;AAC/B,YAAM,SAAS,IAAI,UAAU,IAAI;AACjC,YAAM,EAAE,UAAU,IAAI,MAAM,OAAO,oBAAa;AAChD,YAAM,UAAU,QAAQ,IAAI;AAC5B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,cAAc;AAC9B,MAAI;AACF,UAAM,QAAQ,WAAW,IAAI;AAAA,EAC/B,SAAS,KAAK;AACZ,QAAI,eAAe,SAAS,UAAU,KAAK;AACzC,YAAM,OAAQ,IAAyB;AACvC,UAAI,SAAS,6BAA6B,SAAS,qBAAqB;AACtE;AAAA,MACF;AAAA,IACF;AACA,iBAAa,GAAG;AAChB,YAAQ,WAAW;AAAA,EACrB;AACF;","names":["Command","resolve","Command","chalk","chalk","chalk","chalk","Command","Command","Command","chalk","Command","chalk","resolve","Command","chalk","Command","resolve","chalk","Command","Command","Command","Command","resolve","Command","chalk","Command","chalk","resolve","Command","chalk","Command","chalk","Command","chalk","Command","chalk","Command","Command","Command","Command","chalk","Command","chalk","Command","Command","chalk","Command","chalk","Command","chalk","Command","chalk","Command","chalk","Command","chalk","Command","Command","Command","Command","Command","Command","createInterface","Command","chalk","Command","chalk","resolve","createInterface","Command","Command","Command","Command","Command","Command","Command","Command","chalk","chalk","Command","Command","Command","Command","Command","Command","resolve","Command","Command","resolve","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","readFile","resolve","Command","Command","readFile","resolve","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","readFile","resolve","Command","Command","readFile","resolve","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","readFile","resolve","Command","Command","readFile","resolve","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","readFile","resolve","Command","Command","readFile","resolve","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","Command","Command","chalk","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","Command","chalk","Command","chalk","resolve","Command","Command","Command","chalk","Command","chalk","Command","Command","spawn","createInterface","Command","resolve","spawn","createInterface","Command","spawn","existsSync","join","chalk","Command"]}