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/bin/bot.js CHANGED
@@ -1361,7 +1361,7 @@ async function runShellAgent(job) {
1361
1361
  child.stderr.on("data", (chunk) => {
1362
1362
  stderr += chunk.toString();
1363
1363
  });
1364
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1364
+ const code = await awaitChildClose(child, job.agent.command);
1365
1365
  if (code !== 0) {
1366
1366
  throw new Error(stderr.trim() || `Agent exited with code ${code}`);
1367
1367
  }
@@ -1449,7 +1449,7 @@ async function runCodexAgent(job, update) {
1449
1449
  }
1450
1450
  const rl = createInterface2({ input: child.stdout });
1451
1451
  rl.on("line", processLine);
1452
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1452
+ const code = await awaitChildClose(child, job.agent.command);
1453
1453
  if (code !== 0) {
1454
1454
  throw new Error(errors.at(-1) ?? (stderr.trim() || `Codex exited with code ${code}`));
1455
1455
  }
@@ -1584,7 +1584,7 @@ async function runClaudeCodeAgent(job, update) {
1584
1584
  }
1585
1585
  const rl = createInterface2({ input: child.stdout });
1586
1586
  rl.on("line", processLine);
1587
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1587
+ const code = await awaitChildClose(child, job.agent.command);
1588
1588
  if (code !== 0) {
1589
1589
  const parts = [];
1590
1590
  if (stderr.trim()) parts.push(stderr.trim());
@@ -1721,7 +1721,7 @@ ${job.query}`;
1721
1721
  }
1722
1722
  const rl = createInterface2({ input: child.stdout });
1723
1723
  rl.on("line", processLine);
1724
- const code = await new Promise((resolve11) => child.on("close", resolve11));
1724
+ const code = await awaitChildClose(child, job.agent.command);
1725
1725
  const resumeMatch = stderr.match(/To resume this session:\s*kimi\s+-r\s+([A-Za-z0-9_-]+)/);
1726
1726
  if (resumeMatch) result.sessionId = resumeMatch[1];
1727
1727
  if (code !== 0) {
@@ -2385,7 +2385,7 @@ Invalid ACP stdout: ${line}`;
2385
2385
  clientInfo: {
2386
2386
  name: "botapp-daemon",
2387
2387
  title: "botapp daemon",
2388
- version: "0.2.8"
2388
+ version: "0.2.9"
2389
2389
  }
2390
2390
  });
2391
2391
  const session = await request2("session/new", {
@@ -2512,6 +2512,20 @@ function parseMaybeJson(value) {
2512
2512
  function sleep(ms) {
2513
2513
  return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
2514
2514
  }
2515
+ function awaitChildClose(child, commandLabel) {
2516
+ return new Promise((resolveClose, reject) => {
2517
+ child.once("error", (err) => {
2518
+ if (err.code === "ENOENT") {
2519
+ reject(new Error(
2520
+ `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\`).`
2521
+ ));
2522
+ } else {
2523
+ reject(err);
2524
+ }
2525
+ });
2526
+ child.once("close", resolveClose);
2527
+ });
2528
+ }
2515
2529
  async function waitForChild(child, timeoutMs, label) {
2516
2530
  return new Promise((resolveWait, reject) => {
2517
2531
  const timeout = setTimeout(() => {
@@ -5039,7 +5053,7 @@ function die(msg) {
5039
5053
  }
5040
5054
 
5041
5055
  // src/index.ts
5042
- var version = "0.2.8";
5056
+ var version = "0.2.9";
5043
5057
  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");
5044
5058
  program.addCommand(launchCommand);
5045
5059
  program.addCommand(runCommand);