codeam-cli 2.12.15 → 2.12.17

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/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to `codeam-cli` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.12.16] — 2026-05-15
8
+
9
+ ### Documentation
10
+
11
+ - **meta:** Mention Codex support across CLI/VS Code/JetBrains/README
12
+
13
+ ### Fixed
14
+
15
+ - **cli:** Scope codeam <agent> restore to that agent's most-recent session
16
+ - **cli:** Detect Codex shell-approval prompts as a select_prompt
17
+
7
18
  ## [2.12.14] — 2026-05-14
8
19
 
9
20
  ### Fixed
package/README.md CHANGED
@@ -5,10 +5,12 @@
5
5
  [![license](https://img.shields.io/npm/l/codeam-cli.svg?color=34d399&style=flat-square)](https://github.com/edgar-durand/codeagent-mobile-clients/blob/main/LICENSE)
6
6
  [![node](https://img.shields.io/node/v/codeam-cli.svg?color=34d399&style=flat-square)](https://nodejs.org/)
7
7
 
8
- > **Remote control [Claude Code](https://claude.ai/code) from your phone.**
8
+ > **Remote control AI coding agents from your phone.**
9
9
  > Send prompts, stream responses, and approve commands in real-time — from the subway, the couch, or anywhere away from your desk.
10
10
 
11
- `codeam-cli` is the companion CLI for [**CodeAgent Mobile**](https://codeagent-mobile.com). It wraps Claude Code inside a pseudo-terminal, relays your mobile prompts to the agent, and streams the output back to your phone in real-time.
11
+ `codeam-cli` is the companion CLI for [**CodeAgent Mobile**](https://codeagent-mobile.com). It wraps AI coding agents inside a pseudo-terminal, relays your mobile prompts to the agent, and streams the output back to your phone in real-time.
12
+
13
+ Currently supports **[Claude Code](https://claude.ai/code)** (Anthropic) and **[OpenAI Codex](https://github.com/openai/codex)** — start either via `codeam` (Claude Code) or `codeam codex` (OpenAI Codex).
12
14
 
13
15
  ---
14
16
 
@@ -41,14 +43,18 @@ That's it. Open the [CodeAgent Mobile app](https://codeagent-mobile.com), enter
41
43
 
42
44
  | Command | What it does |
43
45
  |---|---|
44
- | `codeam` | Start Claude Code in the current directory, with mobile control |
45
- | `codeam pair` | Pair a new mobile device (6-digit code or QR) |
46
+ | `codeam` | Start the active agent in the current directory, with mobile control |
47
+ | `codeam <agent>` | Start a specific agent `codeam claude`, `codeam codex`, |
48
+ | `codeam pair` | Pair a new mobile device (6-character code or QR, interactive agent picker) |
49
+ | `codeam pair --agent <id>` | Pair non-interactively for a specific agent (`claude`, `codex`, …) — useful in scripts |
46
50
  | `codeam sessions` | List all paired devices |
51
+ | `codeam sessions switch` | Choose which paired session the next `codeam` invocation will use |
52
+ | `codeam sessions delete <session-id>` | Forget a specific paired session (leaves the others intact) |
47
53
  | `codeam status` | Show connection status |
48
54
  | `codeam logout` | Remove all paired sessions |
49
55
  | `codeam deploy` | Provision a cloud workspace (GitHub Codespaces) and pair it to your phone |
50
- | `codeam deploy ls` | List the cloud workspaces you've deployed (and which still have a session running) |
51
- | `codeam deploy stop` | Pick a deployed workspace and stop its codeam session (and optionally the workspace itself) |
56
+ | `codeam deploy ls` (alias `list`) | List the cloud workspaces you've deployed (and which still have a session running) |
57
+ | `codeam deploy stop` (alias `remove`) | Pick a deployed workspace and stop its codeam session (and optionally the workspace itself) |
52
58
  | `codeam --version`, `-v` | Print the installed CLI version |
53
59
  | `codeam --help`, `-h` | Show usage and the full command list |
54
60
 
@@ -94,6 +100,7 @@ Adding more cloud backends (Gitpod, Coder, your own SSH host, …) is a single n
94
100
 
95
101
  - **Node.js 18+**
96
102
  - **Claude Code** — see the [official quickstart](https://code.claude.com/docs/en/quickstart)
103
+ - **OpenAI Codex** (optional) — see the [official quickstart](https://github.com/openai/codex)
97
104
  - **[CodeAgent Mobile](https://codeagent-mobile.com)** app on your phone ([iOS](https://apps.apple.com/) / [Android](https://play.google.com/store/apps/details?id=com.codeagent.mobile))
98
105
 
99
106
  ---
@@ -102,7 +109,25 @@ Adding more cloud backends (Gitpod, Coder, your own SSH host, …) is a single n
102
109
 
103
110
  | Variable | Default | Effect |
104
111
  |---|---|---|
105
- | `CODEAM_DISABLE_UPDATE_CHECK` | unset | Set to `1` to suppress the "update available" banner. The check also auto-skips on non-TTY stdout, in CI, and during tests. |
112
+ | `CODEAM_API_URL` | `https://codeagent-mobile-api.vercel.app` | Override the backend relay URL. Useful for hitting a staging environment or self-hosted backend. |
113
+ | `CODEAM_DISABLE_UPDATE_CHECK` | unset | Set to `1` to suppress the "update available" banner. The check also auto-skips on non-TTY stdout, when `CI=true`, and during tests. |
114
+ | `CODEAM_AUTO_TOKEN` | unset | One-shot pairing token consumed by `codeam pair-auto`. Used by the `codeam deploy` bootstrap; see *Advanced / scripted pairing* below. |
115
+
116
+ ---
117
+
118
+ ## Advanced / scripted pairing
119
+
120
+ For automation (CI, Codespaces bootstraps, container entry-points) `codeam` ships a non-interactive pairing command:
121
+
122
+ ```bash
123
+ codeam pair-auto --token=<one-shot-pairing-token>
124
+ # or
125
+ codeam pair-auto --token-file=/path/to/token
126
+ # or pass the token via env:
127
+ CODEAM_AUTO_TOKEN=<token> codeam pair-auto
128
+ ```
129
+
130
+ This is the same path `codeam deploy` uses inside a freshly-provisioned Codespace to pair the cloud session to your phone with zero interactive prompts. End users on a laptop should keep using the interactive `codeam pair`.
106
131
 
107
132
  ---
108
133
 
package/dist/index.js CHANGED
@@ -1658,6 +1658,13 @@ function makeConfig(baseDir) {
1658
1658
  }
1659
1659
  return session;
1660
1660
  }
1661
+ function getActiveSessionForAgent2(agent) {
1662
+ const c2 = load();
1663
+ const matches = c2.sessions.filter((s) => s.agent === agent);
1664
+ if (matches.length === 0) return null;
1665
+ matches.sort((a, b) => b.pairedAt - a.pairedAt);
1666
+ return matches[0];
1667
+ }
1661
1668
  function clearAll2() {
1662
1669
  try {
1663
1670
  fs.unlinkSync(file);
@@ -1670,10 +1677,10 @@ function makeConfig(baseDir) {
1670
1677
  function loadCliConfig2() {
1671
1678
  return load();
1672
1679
  }
1673
- return { getConfig: getConfig2, ensurePluginId: ensurePluginId2, addSession: addSession2, removeSession: removeSession2, setActiveSession: setActiveSession2, getActiveSession: getActiveSession2, clearAll: clearAll2, saveCliConfig: saveCliConfig2, loadCliConfig: loadCliConfig2 };
1680
+ return { getConfig: getConfig2, ensurePluginId: ensurePluginId2, addSession: addSession2, removeSession: removeSession2, setActiveSession: setActiveSession2, getActiveSession: getActiveSession2, getActiveSessionForAgent: getActiveSessionForAgent2, clearAll: clearAll2, saveCliConfig: saveCliConfig2, loadCliConfig: loadCliConfig2 };
1674
1681
  }
1675
1682
  var _default = makeConfig();
1676
- var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, clearAll, saveCliConfig, loadCliConfig } = _default;
1683
+ var { getConfig, ensurePluginId, addSession, removeSession, setActiveSession, getActiveSession, getActiveSessionForAgent, clearAll, saveCliConfig, loadCliConfig } = _default;
1677
1684
 
1678
1685
  // src/ui/banner.ts
1679
1686
  var import_picocolors = __toESM(require("picocolors"));
@@ -1682,7 +1689,7 @@ var import_qrcode_terminal = __toESM(require("qrcode-terminal"));
1682
1689
  // package.json
1683
1690
  var package_default = {
1684
1691
  name: "codeam-cli",
1685
- version: "2.12.15",
1692
+ version: "2.12.17",
1686
1693
  description: "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands \u2014 from anywhere.",
1687
1694
  type: "commonjs",
1688
1695
  main: "dist/index.js",
@@ -4825,8 +4832,17 @@ var AgentService = class {
4825
4832
  * the pre-batch (empty/previous) state → Enter submits nothing and the text
4826
4833
  * stays visible-but-unsubmitted in the input field.
4827
4834
  *
4828
- * Sending '\r' in a separate write() 50 ms later guarantees it arrives on
4835
+ * Sending '\r' in a separate write() ~50 ms later guarantees it arrives on
4829
4836
  * a fresh event-loop tick, after React has flushed the text into input state.
4837
+ *
4838
+ * The delay scales with line count: Smart Composer outputs are ~500–1500
4839
+ * chars with embedded `\n`s (Task / Context / Steps blocks). Ink's input
4840
+ * field re-flows multi-line content per render and the 50 ms baseline that
4841
+ * worked for single-line prompts isn't enough headroom — the text lands in
4842
+ * the field but `\r` submits stale state and the prompt sits there until
4843
+ * the user hits Enter manually. Adding ~40 ms per extra line (capped at
4844
+ * 300 ms) keeps short prompts snappy while giving multi-line composer
4845
+ * outputs the time they need to settle.
4830
4846
  */
4831
4847
  sendCommand(text) {
4832
4848
  if (!this.strategy) {
@@ -4841,7 +4857,9 @@ var AgentService = class {
4841
4857
  const s = this.strategy;
4842
4858
  log.trace("claude", `sendCommand text=${text.length}B`);
4843
4859
  s.write(text);
4844
- setTimeout(() => s.write("\r"), 50);
4860
+ const lineCount = text.split("\n").length;
4861
+ const delay = Math.min(300, 50 + (lineCount - 1) * 40);
4862
+ setTimeout(() => s.write("\r"), delay);
4845
4863
  }
4846
4864
  /**
4847
4865
  * Navigate a React Ink selector to the given 0-based target index and confirm.
@@ -5804,7 +5822,7 @@ var BOX_DRAW_RE = /^[╭─╮│╰╯]/u;
5804
5822
  var BULLET_CHARS = "\u2022\xB7\u2027\u2219\u22C5";
5805
5823
  var CODEX_AGENT_REPLY_RE = new RegExp(`^[${BULLET_CHARS}]\\s`, "u");
5806
5824
  var STRIP_BULLET_RE = new RegExp(`^(\\s*)[${BULLET_CHARS}]\\s`, "u");
5807
- var CODEX_USER_ECHO_RE = /^[›>]\s+\S/u;
5825
+ var CODEX_USER_ECHO_RE = /^[›>]\s+(?!\d+\.\s)\S/u;
5808
5826
  var TIP_RE = /^\s*Tip:\s/i;
5809
5827
  var LEARN_MORE_RE = /^\s*Learn more:\s/i;
5810
5828
  var CODEX_STATUS_FOOTER_RE = /\bdefault\s+[·•]\s+\S+/i;
@@ -5979,8 +5997,53 @@ function wrapCodexCodeBlocks(lines) {
5979
5997
  function parseCodexChrome(_line) {
5980
5998
  return null;
5981
5999
  }
5982
- function detectCodexSelector(_lines) {
5983
- return null;
6000
+ function detectCodexSelector(lines) {
6001
+ const hasConfirmTrailer = lines.some(
6002
+ (l) => /press\s+enter\s+to\s+confirm/i.test(l)
6003
+ );
6004
+ if (!hasConfirmTrailer) return null;
6005
+ let optionStartIdx = -1;
6006
+ for (let i = 0; i < lines.length; i++) {
6007
+ if (/^\s*(?:>\s+)?\d+\.\s/.test(lines[i])) {
6008
+ optionStartIdx = i;
6009
+ break;
6010
+ }
6011
+ }
6012
+ if (optionStartIdx === -1) return null;
6013
+ const questionParts = [];
6014
+ for (let i = 0; i < optionStartIdx; i++) {
6015
+ const t2 = lines[i].trim();
6016
+ if (!t2) continue;
6017
+ if (/^[>›]\s*$/.test(t2)) continue;
6018
+ questionParts.push(t2);
6019
+ }
6020
+ const question = questionParts.join("\n").trim();
6021
+ const optionLabels = /* @__PURE__ */ new Map();
6022
+ let cursorIndex = 0;
6023
+ let hasCursor = false;
6024
+ for (let i = optionStartIdx; i < lines.length; i++) {
6025
+ const t2 = lines[i].trim();
6026
+ if (!t2) continue;
6027
+ if (/^press\s+enter\s+to\s+confirm/i.test(t2)) break;
6028
+ const m = t2.match(/^(>\s+)?(\d+)\.\s+(.+)/);
6029
+ if (!m) continue;
6030
+ const num = parseInt(m[2], 10);
6031
+ if (!optionLabels.has(num)) {
6032
+ optionLabels.set(num, m[3].trim());
6033
+ if (m[1]) {
6034
+ cursorIndex = optionLabels.size - 1;
6035
+ hasCursor = true;
6036
+ }
6037
+ }
6038
+ }
6039
+ const keys = [...optionLabels.keys()].sort((a, b) => a - b);
6040
+ if (keys.length < 2 || keys[0] !== 1) return null;
6041
+ return {
6042
+ question,
6043
+ options: keys.map((k2) => optionLabels.get(k2)),
6044
+ optionDescriptions: keys.map(() => ""),
6045
+ currentIndex: hasCursor ? cursorIndex : 0
6046
+ };
5984
6047
  }
5985
6048
 
5986
6049
  // src/agents/codex/renderer.ts
@@ -8103,13 +8166,22 @@ async function dispatchCommand(ctx, cmd) {
8103
8166
  }
8104
8167
 
8105
8168
  // src/commands/start.ts
8106
- async function start() {
8169
+ async function start(requestedAgent) {
8107
8170
  showIntro();
8108
- const session = getActiveSession();
8171
+ const session = requestedAgent ? getActiveSessionForAgent(requestedAgent) : getActiveSession();
8109
8172
  if (!session) {
8110
- console.log(` ${import_picocolors2.default.dim("No paired session found.")}`);
8111
- console.log(` ${import_picocolors2.default.dim(`Run ${import_picocolors2.default.white("codeam pair")} to connect your mobile app.`)}
8173
+ if (requestedAgent) {
8174
+ const displayName = AGENT_REGISTRY[requestedAgent]?.displayName ?? requestedAgent;
8175
+ console.log(` ${import_picocolors2.default.dim(`No paired ${displayName} session found.`)}`);
8176
+ console.log(
8177
+ ` ${import_picocolors2.default.dim(`Run ${import_picocolors2.default.white("codeam pair")} from a ${displayName} setup to connect your mobile app.`)}
8178
+ `
8179
+ );
8180
+ } else {
8181
+ console.log(` ${import_picocolors2.default.dim("No paired session found.")}`);
8182
+ console.log(` ${import_picocolors2.default.dim(`Run ${import_picocolors2.default.white("codeam pair")} to connect your mobile app.`)}
8112
8183
  `);
8184
+ }
8113
8185
  process.exit(0);
8114
8186
  }
8115
8187
  if (!session.agent) {
@@ -10443,7 +10515,7 @@ async function stopWorkspaceFromLocal(target) {
10443
10515
  // src/commands/version.ts
10444
10516
  var import_picocolors11 = __toESM(require("picocolors"));
10445
10517
  function version() {
10446
- const v = true ? "2.12.15" : "unknown";
10518
+ const v = true ? "2.12.17" : "unknown";
10447
10519
  console.log(`${import_picocolors11.default.bold("codeam-cli")} ${import_picocolors11.default.cyan(v)}`);
10448
10520
  }
10449
10521
 
@@ -10452,24 +10524,28 @@ var import_picocolors12 = __toESM(require("picocolors"));
10452
10524
  function help() {
10453
10525
  const lines = [
10454
10526
  "",
10455
- ` ${import_picocolors12.default.bold(import_picocolors12.default.magenta("codeam-cli"))} ${import_picocolors12.default.dim("\u2014 Claude Code remote control")}`,
10527
+ ` ${import_picocolors12.default.bold(import_picocolors12.default.magenta("codeam-cli"))} ${import_picocolors12.default.dim("\u2014 remote-control AI coding agents from your phone")}`,
10456
10528
  "",
10457
10529
  ` ${import_picocolors12.default.bold("Usage")}`,
10458
10530
  ` ${import_picocolors12.default.cyan("codeam")} ${import_picocolors12.default.dim("[command]")}`,
10459
10531
  "",
10460
10532
  ` ${import_picocolors12.default.bold("Commands")}`,
10461
- ` ${import_picocolors12.default.white("codeam")} ${import_picocolors12.default.dim("start Claude Code with mobile control")}`,
10462
- ` ${import_picocolors12.default.white("codeam pair")} ${import_picocolors12.default.dim("pair a new mobile device")}`,
10463
- ` ${import_picocolors12.default.white("codeam sessions")} ${import_picocolors12.default.dim("list paired devices")}`,
10464
- ` ${import_picocolors12.default.white("codeam status")} ${import_picocolors12.default.dim("show connection info")}`,
10465
- ` ${import_picocolors12.default.white("codeam logout")} ${import_picocolors12.default.dim("remove all paired sessions")}`,
10466
- ` ${import_picocolors12.default.white("codeam deploy")} ${import_picocolors12.default.dim("provision a cloud workspace (Codespaces) and pair it")}`,
10467
- ` ${import_picocolors12.default.white("codeam deploy ls")} ${import_picocolors12.default.dim("list deployed cloud workspaces")}`,
10468
- ` ${import_picocolors12.default.white("codeam deploy stop")} ${import_picocolors12.default.dim("stop a deployed workspace session")}`,
10533
+ ` ${import_picocolors12.default.white("codeam")} ${import_picocolors12.default.dim("start the active agent with mobile control")}`,
10534
+ ` ${import_picocolors12.default.white("codeam <agent>")} ${import_picocolors12.default.dim("start a specific agent \u2014 e.g. claude, codex")}`,
10535
+ ` ${import_picocolors12.default.white("codeam pair")} ${import_picocolors12.default.dim("pair a new mobile device (interactive)")}`,
10536
+ ` ${import_picocolors12.default.white("codeam pair --agent <id>")} ${import_picocolors12.default.dim("pair non-interactively for a specific agent")}`,
10537
+ ` ${import_picocolors12.default.white("codeam sessions")} ${import_picocolors12.default.dim("list paired devices")}`,
10538
+ ` ${import_picocolors12.default.white("codeam sessions switch")} ${import_picocolors12.default.dim("switch the active paired session")}`,
10539
+ ` ${import_picocolors12.default.white("codeam sessions delete <id>")} ${import_picocolors12.default.dim("remove a specific paired session")}`,
10540
+ ` ${import_picocolors12.default.white("codeam status")} ${import_picocolors12.default.dim("show connection info")}`,
10541
+ ` ${import_picocolors12.default.white("codeam logout")} ${import_picocolors12.default.dim("remove all paired sessions")}`,
10542
+ ` ${import_picocolors12.default.white("codeam deploy")} ${import_picocolors12.default.dim("provision a cloud workspace (Codespaces) and pair it")}`,
10543
+ ` ${import_picocolors12.default.white("codeam deploy ls | list")} ${import_picocolors12.default.dim("list deployed cloud workspaces")}`,
10544
+ ` ${import_picocolors12.default.white("codeam deploy stop | remove")} ${import_picocolors12.default.dim("stop a deployed workspace session")}`,
10469
10545
  "",
10470
10546
  ` ${import_picocolors12.default.bold("Flags")}`,
10471
- ` ${import_picocolors12.default.white("-v, --version")} ${import_picocolors12.default.dim("print the CLI version")}`,
10472
- ` ${import_picocolors12.default.white("-h, --help")} ${import_picocolors12.default.dim("show this help")}`,
10547
+ ` ${import_picocolors12.default.white("-v, --version")} ${import_picocolors12.default.dim("print the CLI version")}`,
10548
+ ` ${import_picocolors12.default.white("-h, --help")} ${import_picocolors12.default.dim("show this help")}`,
10473
10549
  "",
10474
10550
  ` ${import_picocolors12.default.bold("Links")}`,
10475
10551
  ` ${import_picocolors12.default.dim("Docs:")} ${import_picocolors12.default.green("https://www.codeagent-mobile.com")}`,
@@ -10578,7 +10654,7 @@ function checkForUpdates() {
10578
10654
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
10579
10655
  if (process.env.CI) return;
10580
10656
  if (!process.stdout.isTTY) return;
10581
- const current = true ? "2.12.15" : null;
10657
+ const current = true ? "2.12.17" : null;
10582
10658
  if (!current) return;
10583
10659
  const cache = readCache();
10584
10660
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -10621,6 +10697,9 @@ async function main() {
10621
10697
  if (args[0] === "stop" || args[0] === "remove") return deployStop();
10622
10698
  return deploy(args);
10623
10699
  default:
10700
+ if (typeof command === "string" && isKnownAgentId(command)) {
10701
+ return start(command);
10702
+ }
10624
10703
  return start();
10625
10704
  }
10626
10705
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.12.15",
3
+ "version": "2.12.17",
4
4
  "description": "Remote control Claude Code (and other AI coding agents) from your mobile phone. Pair your device, send prompts, stream responses in real-time, and approve commands — from anywhere.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",