@actant/cli 0.2.1 → 0.2.2

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.
@@ -19,7 +19,7 @@ if (process.argv.includes("--__actant-daemon")) {
19
19
  process.exit(1);
20
20
  }
21
21
  } else {
22
- const { run } = await import("../program-RB2YXKPH.js");
22
+ const { run } = await import("../program-P3CKUZHR.js");
23
23
  run();
24
24
  }
25
25
  //# sourceMappingURL=actant.js.map
@@ -831,6 +831,11 @@ function createAgentDestroyCommand(client, printer = defaultPrinter) {
831
831
  await client.call("agent.destroy", { name });
832
832
  printer.log(`${chalk12.green("Destroyed")} ${name}`);
833
833
  } catch (err) {
834
+ const isNotFound = err?.code === -32003 || err?.data?.code === -32003;
835
+ if (opts.force && isNotFound) {
836
+ printer.log(`${chalk12.green("Destroyed")} ${name} (already absent)`);
837
+ return;
838
+ }
834
839
  presentError(err, printer);
835
840
  process.exitCode = 1;
836
841
  }
@@ -880,11 +885,22 @@ import { spawn } from "child_process";
880
885
  import { Command as Command15 } from "commander";
881
886
  import chalk14 from "chalk";
882
887
  function createAgentOpenCommand(client, printer = defaultPrinter) {
883
- return new Command15("open").description("Open an agent's native TUI/UI (e.g. Cursor IDE)").argument("<name>", "Agent name").action(async (name) => {
888
+ return new Command15("open").description("Open an agent's native TUI/UI (e.g. Cursor IDE, Claude Code)").argument("<name>", "Agent name").action(async (name) => {
884
889
  try {
885
890
  const result = await client.call("agent.open", { name });
886
- printer.log(`${chalk14.green("Opening")} ${name} \u2192 ${result.command} ${result.args.join(" ")}`);
887
- spawn(result.command, result.args, { detached: true, stdio: "ignore" }).unref();
891
+ printer.log(`${chalk14.green("Opening")} ${name} \u2192 ${[result.command, ...result.args].join(" ")}`);
892
+ const opts = result.openSpawnOptions ?? {};
893
+ const child = spawn(result.command, result.args, { cwd: result.cwd, ...opts });
894
+ child.on("error", (err) => {
895
+ printer.error(`Failed to open ${name}: ${err.message}`);
896
+ process.exitCode = 1;
897
+ });
898
+ if (opts.detached !== false) {
899
+ child.unref();
900
+ } else {
901
+ const code = await new Promise((r) => child.on("close", r));
902
+ if (code) process.exitCode = code;
903
+ }
888
904
  } catch (err) {
889
905
  presentError(err, printer);
890
906
  process.exitCode = 1;
@@ -1090,7 +1106,7 @@ async function runDirectBridgeChat(client, name, opts, printer) {
1090
1106
  };
1091
1107
  try {
1092
1108
  try {
1093
- await conn.spawn(resolved.command, resolved.args, resolved.workspaceDir);
1109
+ await conn.spawn(resolved.command, resolved.args, resolved.workspaceDir, resolved.resolvePackage);
1094
1110
  } catch (spawnErr) {
1095
1111
  const msg = spawnErr instanceof Error ? spawnErr.message : String(spawnErr);
1096
1112
  if (/ENOENT|EINVAL|is not recognized|not found/i.test(msg)) {
@@ -1109,7 +1125,23 @@ async function runDirectBridgeChat(client, name, opts, printer) {
1109
1125
  metadata: { proxyMode: "direct-bridge-chat" }
1110
1126
  });
1111
1127
  attached = true;
1112
- const initResult = await conn.initialize();
1128
+ let initResult;
1129
+ try {
1130
+ initResult = await conn.initialize();
1131
+ } catch (initErr) {
1132
+ const msg = initErr instanceof Error ? initErr.message : String(initErr);
1133
+ if (/exited unexpectedly|ABORT_ERR|premature close/i.test(msg)) {
1134
+ const hint = resolved.backendType === "claude-code" ? `
1135
+ Install ACP bridge: npm install -g @zed-industries/claude-agent-acp` : `
1136
+ Ensure the backend CLI is installed and supports ACP protocol.`;
1137
+ throw new Error(
1138
+ `Failed to initialize ACP connection with "${resolved.command}". The agent process exited before completing the handshake.${hint}
1139
+ Detail: ${msg}`,
1140
+ { cause: initErr }
1141
+ );
1142
+ }
1143
+ throw initErr;
1144
+ }
1113
1145
  const agentName = initResult.agentInfo?.name ?? name;
1114
1146
  session = await conn.newSession(resolved.workspaceDir);
1115
1147
  printer.log(
@@ -1306,7 +1338,7 @@ import chalk17 from "chalk";
1306
1338
  // package.json
1307
1339
  var package_default = {
1308
1340
  name: "@actant/cli",
1309
- version: "0.2.1",
1341
+ version: "0.2.2",
1310
1342
  description: "CLI for the Actant AI agent platform \u2014 build, manage, and compose AI agents",
1311
1343
  type: "module",
1312
1344
  license: "MIT",
@@ -3572,7 +3604,7 @@ async function run(argv) {
3572
3604
  if (!versionRequested && !helpRequested) {
3573
3605
  const sock = defaultSocketPath();
3574
3606
  const client = new RpcClient(sock);
3575
- const { startRepl } = await import("./repl-3E2HUEX6.js");
3607
+ const { startRepl } = await import("./repl-G44PJKXP.js");
3576
3608
  await startRepl(client, sock);
3577
3609
  return;
3578
3610
  }
@@ -3601,4 +3633,4 @@ export {
3601
3633
  createProgram,
3602
3634
  run
3603
3635
  };
3604
- //# sourceMappingURL=chunk-6OQTL4PN.js.map
3636
+ //# sourceMappingURL=chunk-FB4IUVWU.js.map