@integrity-labs/agt-cli 0.8.4 → 0.8.5

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/bin/agt.js CHANGED
@@ -3411,7 +3411,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
3411
3411
  import { execSync } from "child_process";
3412
3412
  import chalk19 from "chalk";
3413
3413
  import ora15 from "ora";
3414
- var cliVersion = true ? "0.8.4" : "dev";
3414
+ var cliVersion = true ? "0.8.5" : "dev";
3415
3415
  async function fetchLatestVersion() {
3416
3416
  const host2 = AGT_HOST;
3417
3417
  if (!host2) return null;
@@ -3527,7 +3527,7 @@ async function checkForUpdateOnStartup() {
3527
3527
  }
3528
3528
 
3529
3529
  // src/bin/agt.ts
3530
- var cliVersion2 = true ? "0.8.4" : "dev";
3530
+ var cliVersion2 = true ? "0.8.5" : "dev";
3531
3531
  var program = new Command();
3532
3532
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
3533
3533
  program.hook("preAction", (thisCommand) => {
@@ -351,14 +351,16 @@ var _acpxBin = null;
351
351
  function getAcpxBin() {
352
352
  if (_acpxBin) return _acpxBin;
353
353
  const moduleDir = dirname(fileURLToPath(import.meta.url));
354
- for (const candidate of [
355
- join(moduleDir, "..", "..", "node_modules", ".bin", "acpx"),
356
- join(moduleDir, "..", "..", "..", "..", "node_modules", ".bin", "acpx")
357
- ]) {
354
+ let dir = moduleDir;
355
+ for (let i = 0; i < 6; i++) {
356
+ const candidate = join(dir, "node_modules", ".bin", "acpx");
358
357
  if (existsSync(candidate)) {
359
358
  _acpxBin = candidate;
360
359
  return _acpxBin;
361
360
  }
361
+ const parent = dirname(dir);
362
+ if (parent === dir) break;
363
+ dir = parent;
362
364
  }
363
365
  try {
364
366
  execSync("which acpx", { stdio: "ignore" });
@@ -539,22 +541,32 @@ async function injectMessage(codeName, type, content, meta, log2) {
539
541
  mkdirSync(tmpDir, { recursive: true });
540
542
  const tmpFile = join(tmpDir, ".agt-inject-prompt.txt");
541
543
  writeFileSync2(tmpFile, text);
542
- _log(`[inject] acpx prompt --no-wait: cwd=${projectDir}, file=${tmpFile}, bin=${acpx}`);
543
- execFileSync(acpx, [
544
- "claude",
545
- "prompt",
546
- "--no-wait",
547
- "-f",
548
- tmpFile
549
- ], {
550
- cwd: projectDir,
551
- timeout: 3e4,
552
- // 30s should return almost instantly with --no-wait
553
- stdio: "ignore"
544
+ _log(`[inject] acpx exec: cwd=${projectDir}, file=${tmpFile}, bin=${acpx}`);
545
+ const ok = await new Promise((resolve) => {
546
+ const child = spawn(acpx, ["claude", "exec", "-f", tmpFile], {
547
+ cwd: projectDir,
548
+ stdio: ["ignore", "pipe", "pipe"]
549
+ });
550
+ let stderr = "";
551
+ child.stderr?.on("data", (d) => {
552
+ stderr += d.toString();
553
+ });
554
+ child.on("error", (err) => {
555
+ _log(`[inject] acpx spawn error for '${codeName}': ${err.message}`);
556
+ resolve(false);
557
+ });
558
+ child.on("close", (code) => {
559
+ if (code === 0) {
560
+ resolve(true);
561
+ } else {
562
+ _log(`[inject] acpx exec exited ${code} for '${codeName}': ${stderr.trim()}`);
563
+ resolve(false);
564
+ }
565
+ });
554
566
  });
555
- return true;
567
+ if (ok) return true;
556
568
  } catch (err) {
557
- _log(`[inject] acpx prompt failed for '${codeName}': ${err.message}`);
569
+ _log(`[inject] acpx exec failed for '${codeName}': ${err.message}`);
558
570
  }
559
571
  } else {
560
572
  _log(`[inject] acpx binary not found \u2014 falling back to tmux send-keys`);