botapp-cli 0.2.8 → 0.2.9

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
@@ -1363,7 +1363,7 @@ async function runShellAgent(job) {
1363
1363
  child.stderr.on("data", (chunk) => {
1364
1364
  stderr += chunk.toString();
1365
1365
  });
1366
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1366
+ const code = await awaitChildClose(child, job.agent.command);
1367
1367
  if (code !== 0) {
1368
1368
  throw new Error(stderr.trim() || `Agent exited with code ${code}`);
1369
1369
  }
@@ -1451,7 +1451,7 @@ async function runCodexAgent(job, update) {
1451
1451
  }
1452
1452
  const rl = createInterface2({ input: child.stdout });
1453
1453
  rl.on("line", processLine);
1454
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1454
+ const code = await awaitChildClose(child, job.agent.command);
1455
1455
  if (code !== 0) {
1456
1456
  throw new Error(errors.at(-1) ?? (stderr.trim() || `Codex exited with code ${code}`));
1457
1457
  }
@@ -1586,7 +1586,7 @@ async function runClaudeCodeAgent(job, update) {
1586
1586
  }
1587
1587
  const rl = createInterface2({ input: child.stdout });
1588
1588
  rl.on("line", processLine);
1589
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1589
+ const code = await awaitChildClose(child, job.agent.command);
1590
1590
  if (code !== 0) {
1591
1591
  const parts = [];
1592
1592
  if (stderr.trim()) parts.push(stderr.trim());
@@ -1723,7 +1723,7 @@ ${job.query}`;
1723
1723
  }
1724
1724
  const rl = createInterface2({ input: child.stdout });
1725
1725
  rl.on("line", processLine);
1726
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1726
+ const code = await awaitChildClose(child, job.agent.command);
1727
1727
  const resumeMatch = stderr.match(/To resume this session:\s*kimi\s+-r\s+([A-Za-z0-9_-]+)/);
1728
1728
  if (resumeMatch) result.sessionId = resumeMatch[1];
1729
1729
  if (code !== 0) {
@@ -2387,7 +2387,7 @@ Invalid ACP stdout: ${line}`;
2387
2387
  clientInfo: {
2388
2388
  name: "botapp-daemon",
2389
2389
  title: "botapp daemon",
2390
- version: "0.2.8"
2390
+ version: "0.2.9"
2391
2391
  }
2392
2392
  });
2393
2393
  const session = await request2("session/new", {
@@ -2514,6 +2514,20 @@ function parseMaybeJson(value) {
2514
2514
  function sleep(ms) {
2515
2515
  return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
2516
2516
  }
2517
+ function awaitChildClose(child, commandLabel) {
2518
+ return new Promise((resolveClose, reject) => {
2519
+ child.once("error", (err) => {
2520
+ if (err.code === "ENOENT") {
2521
+ reject(new Error(
2522
+ `Agent CLI "${commandLabel}" not found on PATH for the daemon process. Install it, or re-register the agent with an absolute path (\`bot daemon agent remove ${commandLabel}\` then \`bot daemon config\`).`
2523
+ ));
2524
+ } else {
2525
+ reject(err);
2526
+ }
2527
+ });
2528
+ child.once("close", resolveClose);
2529
+ });
2530
+ }
2517
2531
  async function waitForChild(child, timeoutMs, label) {
2518
2532
  return new Promise((resolveWait, reject) => {
2519
2533
  const timeout = setTimeout(() => {
@@ -5041,7 +5055,7 @@ function die(msg) {
5041
5055
  }
5042
5056
 
5043
5057
  // src/index.ts
5044
- var version = "0.2.8";
5058
+ var version = "0.2.9";
5045
5059
  var program = new Command25().name("bot").description("botapp CLI \u2014 operate apps from the command line").version(version).enablePositionalOptions(true).option("--json", "Output as JSON").option("-s, --server <url>", "Server URL override").option("-t, --token <token>", "Auth token override").option("-v, --verbose", "Verbose output");
5046
5060
  program.addCommand(launchCommand);
5047
5061
  program.addCommand(runCommand);