@boxcrew/cli 0.1.9 → 0.1.11

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.
Files changed (2) hide show
  1. package/dist/index.js +43 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -517,6 +517,15 @@ function runDaemon(agentName) {
517
517
  const { messageId, message, sessionId } = msg;
518
518
  const childEnv = { ...process.env };
519
519
  delete childEnv.CLAUDECODE;
520
+ delete childEnv.CLAUDE_CODE_ENTRYPOINT;
521
+ const proxyToken = process.env._BX_PROXY_TOKEN;
522
+ const proxyBaseUrl = process.env._BX_PROXY_BASE_URL;
523
+ if (proxyToken) {
524
+ childEnv.ANTHROPIC_API_KEY = proxyToken;
525
+ if (proxyBaseUrl) {
526
+ childEnv.ANTHROPIC_BASE_URL = proxyBaseUrl;
527
+ }
528
+ }
520
529
  let cmd;
521
530
  let args;
522
531
  if (runtime === "opencode") {
@@ -541,26 +550,36 @@ function runDaemon(agentName) {
541
550
  }
542
551
  if (runtime === "openclaw") {
543
552
  let stdout = "";
553
+ let stderrChunks = "";
544
554
  child.stdout.on("data", (chunk) => {
545
555
  stdout += chunk.toString();
546
556
  });
557
+ child.stderr.on("data", (chunk) => {
558
+ stderrChunks += chunk.toString();
559
+ });
547
560
  child.on("exit", (code) => {
548
561
  if (activeProcess === child) activeProcess = null;
549
562
  if (sendToServer) {
550
- const events = parseOpenClawOutput(stdout);
551
- for (const event of events) {
552
- sendToServer({ type: "event", messageId, event });
563
+ if (code && code !== 0) {
564
+ const errorMsg = stderrChunks.trim() || `OpenClaw exited with code ${code}`;
565
+ console.error(`OpenClaw exited with code ${code}: ${stderrChunks.trim()}`);
566
+ sendToServer({ type: "event", messageId, event: { kind: "text", text: `Error: ${errorMsg}` } });
567
+ } else {
568
+ const events = parseOpenClawOutput(stdout);
569
+ for (const event of events) {
570
+ sendToServer({ type: "event", messageId, event });
571
+ }
553
572
  }
554
573
  sendToServer({ type: "event", messageId, event: { kind: "done" } });
555
574
  }
556
- if (code && code !== 0) {
557
- console.error(`OpenClaw exited with code ${code}`);
558
- sendToServer?.({ type: "error", messageId, error: `OpenClaw exited with code ${code}` });
559
- }
560
575
  });
561
576
  } else {
562
577
  const parseLine = runtime === "opencode" ? parseOpenCodeLine : parseStreamJsonLine;
563
578
  const rl = createInterface3({ input: child.stdout });
579
+ let stderrChunks = "";
580
+ child.stderr.on("data", (chunk) => {
581
+ stderrChunks += chunk.toString();
582
+ });
564
583
  rl.on("line", (line) => {
565
584
  const event = parseLine(line);
566
585
  if (event && sendToServer) {
@@ -569,13 +588,14 @@ function runDaemon(agentName) {
569
588
  });
570
589
  child.on("exit", (code) => {
571
590
  if (activeProcess === child) activeProcess = null;
591
+ if (code && code !== 0 && sendToServer) {
592
+ const errorMsg = stderrChunks.trim() || `${runtime} exited with code ${code}`;
593
+ console.error(`${runtime} exited with code ${code}: ${stderrChunks.trim()}`);
594
+ sendToServer({ type: "event", messageId, event: { kind: "text", text: `Error: ${errorMsg}` } });
595
+ }
572
596
  if (sendToServer) {
573
597
  sendToServer({ type: "event", messageId, event: { kind: "done" } });
574
598
  }
575
- if (code && code !== 0) {
576
- console.error(`${runtime} exited with code ${code}`);
577
- sendToServer?.({ type: "error", messageId, error: `${runtime} exited with code ${code}` });
578
- }
579
599
  });
580
600
  }
581
601
  child.on("error", (err) => {
@@ -672,16 +692,21 @@ function registerConnectCommand(program2) {
672
692
  );
673
693
  const logFile = getLogFile(agentName);
674
694
  const logFd = openSync(logFile, "a");
695
+ const daemonEnv = {
696
+ ...process.env,
697
+ _BX_WS_URL: config2.websocket_url,
698
+ _BX_CLAUDE_PATH: options.claudePath,
699
+ _BX_AGENT_NAME: config2.agent_name,
700
+ _BX_RUNTIME: config2.runtime,
701
+ _BX_PROXY_TOKEN: config2.proxy_token,
702
+ _BX_PROXY_BASE_URL: config2.proxy_base_url
703
+ };
704
+ delete daemonEnv.CLAUDECODE;
705
+ delete daemonEnv.CLAUDE_CODE_ENTRYPOINT;
675
706
  const child = spawn(process.argv[0], [process.argv[1], "_daemon", agentName], {
676
707
  detached: true,
677
708
  stdio: ["ignore", logFd, logFd],
678
- env: {
679
- ...process.env,
680
- _BX_WS_URL: config2.websocket_url,
681
- _BX_CLAUDE_PATH: options.claudePath,
682
- _BX_AGENT_NAME: config2.agent_name,
683
- _BX_RUNTIME: config2.runtime
684
- }
709
+ env: daemonEnv
685
710
  });
686
711
  child.unref();
687
712
  const runtimeNames = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxcrew/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "BoxCrew CLI — manage your agents from the terminal",
5
5
  "type": "module",
6
6
  "bin": {