esque-bridge 0.6.10 → 0.6.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/index.js +20 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -469,6 +469,26 @@ function runAgent(prompt, esqueSessionId) {
469
469
  clearTimers();
470
470
  if (truncated) return;
471
471
  if (code !== 0) {
472
+ // A non-zero exit usually still carries the REAL reason. `claude
473
+ // --print --output-format json` emits a result object with the error
474
+ // (API overload, usage limit, a refusal) on stdout even when it exits
475
+ // 1 — surfacing "exited 1" instead throws that away. Parse stdout; if
476
+ // there's a real message, return it as an error reply (so the phone
477
+ // shows the cause and the user can just resend) rather than a bare
478
+ // exit code. Fall back to exit-code + stderr only when stdout is empty.
479
+ let parsedErr = null;
480
+ try {
481
+ const p = adapter.parseOutput(stdout);
482
+ if (p && p.text && p.text !== '(no output)' && p.text !== '(claude returned no text)') {
483
+ parsedErr = p;
484
+ }
485
+ } catch {
486
+ /* unparseable stdout — fall through to the generic message */
487
+ }
488
+ if (parsedErr) {
489
+ resolveOnce({ ...parsedErr, isError: true });
490
+ return;
491
+ }
472
492
  rejectOnce(
473
493
  new Error(
474
494
  `${adapter.label} exited ${code}${stderr ? `: ${stderr.trim().slice(0, 500)}` : ''}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esque-bridge",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "description": "Desktop-side receiver for the Esque Agent mobile app. Pairs your phone with a local coding-agent CLI (Claude Code, Codex, Aider, or any custom command) via a tunnel + QR code, so prompts run through your subscription instead of per-token API billing.",
5
5
  "bin": {
6
6
  "esque-bridge": "index.js"