replicas-cli 0.2.322 → 0.2.323

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.mjs +25 -4
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8026,7 +8026,7 @@ Prints the live noVNC viewer URL (\`https://6080-<hash>.tryreplicas.com/\`) for
8026
8026
  If invoked very early in the workspace lifecycle, \`info\` will poll briefly while the engine finishes registering the preview, then error if it's still not available.
8027
8027
 
8028
8028
  ### \`replicas computer status\`
8029
- Prints which desktop services are running and the active preview URL (if any). Useful for debugging when a tool call seems to be doing nothing.
8029
+ Checks and repairs the desktop bridge, then prints which desktop services are running and the active preview URL (if any). Useful for debugging when a tool call seems to be doing nothing.
8030
8030
 
8031
8031
  ### \`replicas computer screenshot <path> [--raw] [--grid [px]]\`
8032
8032
  Captures the current desktop to a PNG at the given path.
@@ -8143,7 +8143,7 @@ Then embed the printed \`![\u2026](\u2026)\` line in your chat reply. See \`MEDI
8143
8143
  ## Failure modes
8144
8144
 
8145
8145
  - **"Desktop services script missing"**: workspace image is older than this skill. Tell the user - nothing you can do from the CLI side.
8146
- - **\`xdotool ... failed: Can't open display\`**: Xvfb didn't come up. \`replicas computer status\` will show which service is dead. Re-running any CLI command auto-attempts to start it.
8146
+ - **\`xdotool ... failed: Can't open display\`**: Xvfb didn't come up. \`replicas computer status\` will show which service is dead and auto-repair the desktop bridge.
8147
8147
  - **Browser doesn't appear after \`launch chrome\`**: run \`replicas computer observe /tmp/state.png\`. Chrome cold-start on the virtual display takes ~500ms but bigger pages take longer.
8148
8148
  - **Live preview shows static / black screen**: the browser may have crashed. \`replicas computer status\` should show no Chrome process - re-launch.
8149
8149
  - **\`replicas computer info\` errors with "not registered"**: engine couldn't register the preview at startup (transient monolith error, or warming mode). Re-running the engine usually fixes it. Until it's registered, the Desktop tab will show a placeholder.
@@ -9536,7 +9536,7 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
9536
9536
  var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
9537
9537
 
9538
9538
  // ../shared/src/cli-version.ts
9539
- var CLI_VERSION = "0.2.322";
9539
+ var CLI_VERSION = "0.2.323";
9540
9540
 
9541
9541
  // ../shared/src/engine/environment.ts
9542
9542
  var DESKTOP_NOVNC_PORT = 6080;
@@ -14482,6 +14482,24 @@ function parseScreenCoord(value, label, size) {
14482
14482
  function resolvePath(p) {
14483
14483
  return isAbsolute(p) ? p : resolve(process.cwd(), p);
14484
14484
  }
14485
+ function desktopBridgeStatus() {
14486
+ const r = spawnSync("bash", [SERVICES_SCRIPT, "--status-json"], { stdio: "pipe" });
14487
+ if (r.status !== 0) return null;
14488
+ try {
14489
+ return JSON.parse(r.stdout.toString());
14490
+ } catch {
14491
+ return null;
14492
+ }
14493
+ }
14494
+ function bridgeStatus(details, includeBacklog = false, rootsOnly = false) {
14495
+ const pids = rootsOnly ? details.rootPids ?? [] : details.listenerPids ?? [];
14496
+ const listenerCount = rootsOnly ? details.rootListeners ?? pids.length : details.listeners ?? pids.length;
14497
+ const listenerLabel = rootsOnly ? "root listener" : "listener";
14498
+ const parts = [`${listenerCount} ${listenerLabel}${listenerCount === 1 ? "" : "s"} on ${details.port}`];
14499
+ if (includeBacklog) parts.push(`backlog ${details.backlog ?? 0}`);
14500
+ if (pids.length > 0) parts.push(`pid${pids.length === 1 ? "" : "s"} ${pids.join(",")}`);
14501
+ return ` (${parts.join(", ")})`;
14502
+ }
14485
14503
  var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
14486
14504
  async function lookupDesktopViewerUrl() {
14487
14505
  try {
@@ -14512,11 +14530,14 @@ async function computerInfoCommand() {
14512
14530
  console.error(chalk20.dim(`Share this URL with the user to let them watch the desktop live.`));
14513
14531
  }
14514
14532
  async function computerStatusCommand() {
14533
+ ensureServicesRunning();
14534
+ const bridge = desktopBridgeStatus();
14515
14535
  const procs = ["Xvfb", "openbox", "tint2", "x11vnc", "websockify"];
14516
14536
  for (const p of procs) {
14517
14537
  const r = spawnSync("pgrep", ["-af", p], { stdio: "pipe" });
14518
14538
  const running = r.status === 0 && !!r.stdout?.toString().trim();
14519
- console.log(` ${running ? chalk20.green("\u25CF") : chalk20.red("\u25CB")} ${p}`);
14539
+ const suffix = p === "x11vnc" && bridge ? bridgeStatus(bridge.x11vnc, true) : p === "websockify" && bridge ? bridgeStatus(bridge.websockify, false, true) : "";
14540
+ console.log(` ${running ? chalk20.green("\u25CF") : chalk20.red("\u25CB")} ${p}${suffix}`);
14520
14541
  }
14521
14542
  const viewerUrl = await lookupDesktopViewerUrl();
14522
14543
  if (viewerUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.322",
3
+ "version": "0.2.323",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {