rucan 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -14,7 +14,7 @@ pnpm build
14
14
  pnpm dev
15
15
  ```
16
16
 
17
- To close Rucan and keep your sessions running, press Ctrl+G, type `/exit` and press Enter, then press Enter again in the exit screen. You can also use Q in the menu to open the exit screen. Ctrl+G opens the workspace menu. P pins a session, D closes the UI and keeps sessions running, H selects a host, and E opens the file explorer. Arrow keys, digits and sidebar clicks switch workspaces. T opens optional tmux actions, and S browses scrollback. The first launch creates a sample at `~/.config/rucan/config.yaml` or under an absolute `XDG_CONFIG_HOME`. Local and remote configuration examples follow.
17
+ Type `exit` at the shell prompt to close the current shell. To open Rucan's exit screen, press Ctrl+G and then Q, or enter `/exit` in the menu. Press Enter on the exit screen to keep sessions running. Ctrl+G and F12 open the workspace menu. On Mac keyboards with media keys, press Fn+F12 to send F12. P pins a session, D closes the UI and keeps sessions running, H selects a host, and E opens the file explorer. Arrow keys, digits and sidebar clicks switch workspaces. T opens optional tmux actions, and S browses scrollback. The first launch creates a sample at `~/.config/rucan/config.yaml` or under an absolute `XDG_CONFIG_HOME`. Local and remote configuration examples follow.
18
18
 
19
19
  ```yaml
20
20
  version: 1
@@ -28,6 +28,12 @@ workspaces:
28
28
  persistence: persistent
29
29
  ```
30
30
 
31
+ The numbered workspace list contains running sessions. When the selected session exits, Rucan opens the next running session. If the list is empty, use Ctrl+G, then N to open a new workspace.
32
+
33
+ Press Alt+Space to search Rucan commands, or choose Space in the workspace menu. Use the sidebar buttons to open a new workspace or start an interactive SSH connection. The SSH button accepts an IP address, an OpenSSH alias, or `user@host` and runs OpenSSH on the current workspace host. OpenSSH verifies host keys and handles authentication in the terminal tab.
34
+
35
+ Inside a managed shell, run `rucan` to see session commands. Use `npx rucan@latest` if you run Rucan through npm without a global installation.
36
+
31
37
  `pnpm dev config` validates the configuration and prints its path. The npm package installs the `rucan` command. After the first release:
32
38
 
33
39
  ```sh
Binary file
Binary file
Binary file
Binary file
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "0.1.1",
2
+ "version": "0.1.3",
3
3
  "platforms": {
4
- "linux-x64": "d13f19b03587571576a8b192694deac21a6973fd6ed812fd6f1f4783cd903601",
5
- "linux-arm64": "a4d1ab1cec2a389cadf4991c6c2d6787ebcbef1f39818a69a843a54009343829",
6
- "darwin-x64": "acb21632c46edf48ff9b7a7e6db82ae82923adb9c2b4229b1ce55b01c99c30c8",
7
- "darwin-arm64": "47102a78a9dc3d8974f86d05165291e0876847cf5e22def931768e8776a86605"
4
+ "linux-x64": "d93b044e6f537f96272692e885e9aef05fae6fd1b910453b1b0aebf940fdd09d",
5
+ "linux-arm64": "396da36d4c9723e8675ff5254324ee2fcb808224bab48cb2009a5e437347e768",
6
+ "darwin-x64": "46dce9a3c1c8458f980deb71fcb1b4b58634d0113ac843e86011e6a0b09a2235",
7
+ "darwin-arm64": "b14f9d445ec5dbd91f4f74100eb196dec0134adc7ea07885c245231309db4255"
8
8
  }
9
9
  }
package/dist/main.js CHANGED
@@ -15,6 +15,10 @@ async function main(args) {
15
15
  console.log(`rucan ${version}`);
16
16
  return;
17
17
  }
18
+ if (args.length === 0 && process.env.RUCAN_SESSION_ID) {
19
+ console.log("Rucan session commands\n\n rucan ls List sessions\n rucan pin Pin this session\n rucan unpin Unpin this session\n rucan --help Show all CLI commands\n\nType exit to close this shell. Open the Rucan menu to close the UI.");
20
+ return;
21
+ }
18
22
  if (args.length === 1 && args[0] === "--help") {
19
23
  console.log("Usage: rucan [attach | remote | tmux | update | doctor | config | ls | status | new | pin | unpin | detach | rename | kill | shutdown | --fixture | --help | --version]\n\nOpen the workspace UI or control a local terminal session.");
20
24
  return;
@@ -0,0 +1,45 @@
1
+ import { spawn } from "node:child_process";
2
+ import { realpath } from "node:fs/promises";
3
+ import { basename, dirname } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { installUpdate, registry } from "./updates.js";
6
+ import { compareVersions, stableVersion, version } from "./version.js";
7
+ export async function restartAfterUpdate(target, host, session) {
8
+ if (!stableVersion(target) || compareVersions(target, version) <= 0)
9
+ throw new Error("Expected a newer stable version");
10
+ const folder = await realpath(fileURLToPath(new URL("../../", import.meta.url)));
11
+ const modules = dirname(folder);
12
+ const fromNpx = basename(modules) === "node_modules" &&
13
+ basename(dirname(dirname(modules))) === "_npx";
14
+ const open = host ? ["remote", "open", host] : [];
15
+ let command = process.execPath;
16
+ let args;
17
+ if (fromNpx) {
18
+ command = "npm";
19
+ args = [
20
+ "exec",
21
+ "--yes",
22
+ "--prefer-online",
23
+ "--ignore-scripts",
24
+ `--registry=${registry}`,
25
+ `--package=rucan@${target}`,
26
+ "--",
27
+ "rucan",
28
+ ...open,
29
+ ];
30
+ }
31
+ else {
32
+ args = [await installUpdate(target), ...open];
33
+ }
34
+ const env = { ...process.env, RUCAN_RESUME_SESSION: session };
35
+ await new Promise((resolve, reject) => {
36
+ const child = spawn(command, args, { env, stdio: "inherit" });
37
+ child.once("error", reject);
38
+ child.once("exit", (code, signal) => {
39
+ if (code === 0)
40
+ resolve();
41
+ else
42
+ reject(new Error(`Updated Rucan exited with ${signal ?? code}`));
43
+ });
44
+ });
45
+ }
@@ -6,7 +6,7 @@ import { isAbsolute, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { promisify } from "node:util";
8
8
  import { compareVersions, stableVersion, version } from "./version.js";
9
- const registry = "https://registry.npmjs.org";
9
+ export const registry = "https://registry.npmjs.org";
10
10
  const ttl = 6 * 60 * 60 * 1000;
11
11
  function directory() {
12
12
  const configured = process.env.XDG_CACHE_HOME;
@@ -105,9 +105,9 @@ async function installMethod() {
105
105
  maxBuffer: 16384,
106
106
  timeout: 2000,
107
107
  });
108
- return (await realpath(join(stdout.trim(), "rucan"))) ===
109
- packageDirectory
110
- ? manager
108
+ const root = stdout.trim();
109
+ return (await realpath(join(root, "rucan"))) === packageDirectory
110
+ ? { manager, root }
111
111
  : undefined;
112
112
  }
113
113
  catch {
@@ -122,15 +122,16 @@ export async function installUpdate(target) {
122
122
  const method = await installMethod();
123
123
  if (!method)
124
124
  throw new Error("This installation is managed externally. Install the update using the original installation method.");
125
+ const { manager, root } = method;
125
126
  const args = [
126
- method === "pnpm" ? "add" : "install",
127
+ manager === "pnpm" ? "add" : "install",
127
128
  "--global",
128
129
  "--ignore-scripts",
129
130
  `--registry=${registry}`,
130
131
  `rucan@${target}`,
131
132
  ];
132
133
  await new Promise((resolve, reject) => {
133
- const child = spawn(method, args, { stdio: "inherit" });
134
+ const child = spawn(manager, args, { stdio: "inherit" });
134
135
  child.once("error", reject);
135
136
  child.once("exit", (code) => {
136
137
  if (code === 0)
@@ -139,4 +140,5 @@ export async function installUpdate(target) {
139
140
  reject(new Error(`Update exited with status ${code}`));
140
141
  });
141
142
  });
143
+ return join(root, "rucan", "dist", "main.js");
142
144
  }
@@ -0,0 +1,103 @@
1
+ import stringWidth from "string-width";
2
+ import { version } from "../release/version.js";
3
+ export const reset = "\x1b[0m";
4
+ const bar = "\x1b[38;5;252;48;5;235m";
5
+ const brand = "\x1b[1;38;5;17;48;5;87m";
6
+ const tab = "\x1b[1;38;5;231;48;5;61m";
7
+ const sidebar = "\x1b[38;5;250;48;5;234m";
8
+ const section = "\x1b[1;38;5;117;48;5;234m";
9
+ const edge = "\x1b[38;5;67;48;5;234m";
10
+ const good = "\x1b[38;5;120;48;5;235m";
11
+ const warning = "\x1b[38;5;221;48;5;235m";
12
+ const action = "\x1b[1;38;5;153m";
13
+ const button = "\x1b[1;38;5;117;48;5;236m";
14
+ const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
15
+ export function fit(text, width) {
16
+ if (width <= 0)
17
+ return "";
18
+ const safe = text.replace(/[\p{Cc}\p{Bidi_Control}]/gu, "");
19
+ if (stringWidth(safe) <= width)
20
+ return safe;
21
+ let result = "";
22
+ let used = 0;
23
+ for (const { segment } of segmenter.segment(safe)) {
24
+ used += stringWidth(segment);
25
+ if (used > width)
26
+ break;
27
+ result += segment;
28
+ }
29
+ return result;
30
+ }
31
+ function fill(text, width) {
32
+ return text + " ".repeat(Math.max(0, width - stringWidth(text)));
33
+ }
34
+ export function renderHeader(header, width) {
35
+ if (typeof header === "string")
36
+ return tab + fill(fit(` ${header}`, width), width) + reset;
37
+ const logo = fit(` rucan v${version} `, width);
38
+ const remaining = width - stringWidth(logo);
39
+ if (remaining < 3)
40
+ return brand + fill(logo, width) + reset;
41
+ const label = fit(` ▰ ${header.tab} `, Math.min(remaining - 1, Math.max(12, Math.floor(width * 0.45))));
42
+ const statusWidth = remaining - stringWidth(label) - 1;
43
+ const status = fit(` ● ${header.status}`, statusWidth);
44
+ return (brand +
45
+ logo +
46
+ reset +
47
+ bar +
48
+ " " +
49
+ tab +
50
+ label +
51
+ reset +
52
+ (header.healthy ? good : warning) +
53
+ fill(status, statusWidth) +
54
+ reset);
55
+ }
56
+ export function renderSidebar(text, width, heading) {
57
+ if (width <= 0)
58
+ return "";
59
+ const label = fit(text, width - 1);
60
+ const style = heading || label === "EXPLORER"
61
+ ? section
62
+ : label.startsWith("+ ") || label.startsWith("↗ ")
63
+ ? button
64
+ : label.startsWith("›")
65
+ ? tab
66
+ : sidebar;
67
+ return style + fill(label, width - 1) + reset + edge + "│" + reset;
68
+ }
69
+ export function renderPaletteLine(text, width, row) {
70
+ const cardWidth = Math.min(54, width - 2);
71
+ if (cardWidth < 4)
72
+ return "";
73
+ const style = row === 0 ? tab : row === 1 ? button : text.startsWith("›") ? tab : bar;
74
+ return (" ".repeat(Math.floor((width - cardWidth) / 2)) +
75
+ style +
76
+ fill(fit(` ${text}`, cardWidth), cardWidth) +
77
+ reset);
78
+ }
79
+ export function renderPanelLine(text, width, row) {
80
+ const label = fit(text, width - 2);
81
+ if (!label)
82
+ return "";
83
+ return row === 0 && width >= 5
84
+ ? ` ${action}◆ ${fit(label, width - 4)}${reset}`
85
+ : ` ${label}`;
86
+ }
87
+ export function renderFooter(footer, width) {
88
+ const badge = fit(` v${version} `, width);
89
+ const bodyWidth = width - stringWidth(badge);
90
+ const [first = "", ...rest] = footer.split(" · ");
91
+ const lead = fit(` ${first} `, bodyWidth);
92
+ const remaining = bodyWidth - stringWidth(lead);
93
+ const hints = rest.length ? fit(` ${rest.join(" · ")}`, remaining) : "";
94
+ return (tab +
95
+ lead +
96
+ reset +
97
+ bar +
98
+ fill(hints, remaining) +
99
+ reset +
100
+ brand +
101
+ badge +
102
+ reset);
103
+ }
@@ -1,6 +1,7 @@
1
1
  const pasteStart = Buffer.from("\x1b[200~");
2
2
  const pasteEnd = Buffer.from("\x1b[201~");
3
3
  const mouseStart = Buffer.from("\x1b[<");
4
+ const f12 = Buffer.from("\x1b[24~");
4
5
  function mouseReport(bytes) {
5
6
  const prefix = bytes.subarray(0, mouseStart.length);
6
7
  if (!mouseStart.subarray(0, prefix.length).equals(prefix))
@@ -51,6 +52,10 @@ export class InputRouter {
51
52
  if (byte === this.#prefix && !this.#paste) {
52
53
  event = { type: "prefix" };
53
54
  }
55
+ else if (byte === 0x1b && input[index + 1] === 0x20 && !this.#paste) {
56
+ event = { type: "palette" };
57
+ length = 2;
58
+ }
54
59
  else if (byte === 0x1b) {
55
60
  const remainder = input.subarray(index);
56
61
  const marker = this.#paste ? pasteEnd : pasteStart;
@@ -66,12 +71,22 @@ export class InputRouter {
66
71
  }
67
72
  }
68
73
  else if (!this.#paste) {
69
- const mouse = mouseReport(remainder);
70
- if (mouse === "incomplete")
71
- incomplete = true;
72
- else if (mouse) {
73
- event = { type: "mouse", ...mouse.event };
74
- length = mouse.length;
74
+ const key = remainder.subarray(0, f12.length);
75
+ if (f12.subarray(0, key.length).equals(key)) {
76
+ incomplete = key.length < f12.length;
77
+ if (!incomplete) {
78
+ event = { type: "prefix" };
79
+ length = f12.length;
80
+ }
81
+ }
82
+ else {
83
+ const mouse = mouseReport(remainder);
84
+ if (mouse === "incomplete")
85
+ incomplete = true;
86
+ else if (mouse) {
87
+ event = { type: "mouse", ...mouse.event };
88
+ length = mouse.length;
89
+ }
75
90
  }
76
91
  }
77
92
  }
@@ -1,18 +1,22 @@
1
1
  import { posix } from "node:path";
2
- import { availableUpdate, installUpdate, skipUpdate, } from "../release/updates.js";
3
- import { version } from "../release/version.js";
2
+ import { availableUpdate, skipUpdate } from "../release/updates.js";
3
+ import { restartAfterUpdate } from "../release/restart.js";
4
4
  import { Explorer } from "../explorer/explorer.js";
5
5
  import { setTimeout as delay } from "node:timers/promises";
6
6
  import { connectRemoteAgent } from "../agent/ssh.js";
7
7
  import { connectLocalAgent } from "../agent/local.js";
8
8
  import { mountRawInput } from "./raw-input.js";
9
- import { exitLines, footerFor, menuFor, selectionLines, } from "./view.js";
9
+ import { CommandPalette } from "./palette.js";
10
+ import { sidebarActionAt } from "./sidebar-actions.js";
11
+ import { openSshShell } from "./ssh-shell.js";
12
+ import { workspaceScreen } from "./workspace-screen.js";
10
13
  import { listTmux, openTmux } from "./tmux.js";
11
14
  import { TerminalWatch } from "./watch.js";
15
+ import { watchWorkspaceList } from "./workspace-refresh.js";
12
16
  import { terminalMouse } from "./mouse.js";
13
17
  import { geometry, Screen } from "./screen.js";
14
18
  import { decodeSnapshot } from "./snapshot.js";
15
- import { createWorkspace, decodeWorkspace, listWorkspaces, workspaceLabels, } from "./workspaces.js";
19
+ import { createWorkspace, decodeWorkspace, listWorkspaces, reconcileWorkspaces, } from "./workspaces.js";
16
20
  export async function runInteractive(config, requested, host) {
17
21
  if (!process.stdin.isTTY || !process.stdout.isTTY)
18
22
  throw new Error("The workspace UI requires a terminal.");
@@ -33,7 +37,7 @@ export async function runInteractive(config, requested, host) {
33
37
  }
34
38
  target = undefined;
35
39
  if (next?.type === "update")
36
- await installUpdate(next.version);
40
+ await restartAfterUpdate(next.version, alias, next.session);
37
41
  if (next?.type === "host") {
38
42
  currentHost = next.host;
39
43
  prepared = next.client;
@@ -71,6 +75,8 @@ class InteractiveWorkspace {
71
75
  #name = "";
72
76
  #command = "";
73
77
  #commandError = false;
78
+ #palette;
79
+ #sshTarget = "";
74
80
  #tmux = [];
75
81
  #tmuxIndex = 0;
76
82
  #workspaces = [];
@@ -91,13 +97,13 @@ class InteractiveWorkspace {
91
97
  this.#explorer = new Explorer(connect, config.explorer.exclusions, () => this.#draw());
92
98
  }
93
99
  async run(requested) {
94
- this.#workspaces = await listWorkspaces(this.#client);
100
+ this.#workspaces = (await listWorkspaces(this.#client)).filter(({ running }) => running);
95
101
  const target = requested
96
102
  ? this.#workspaces.find(({ id, name }) => id === requested || name === requested)
97
- : this.#workspaces.find(({ running }) => running);
103
+ : (this.#workspaces.find(({ id }) => id === process.env.RUCAN_RESUME_SESSION) ?? this.#workspaces[0]);
104
+ delete process.env.RUCAN_RESUME_SESSION;
98
105
  if (requested && !target)
99
106
  throw new Error(`Unknown session ${requested}`);
100
- await this.#select(target ?? (await this.#new()), false);
101
107
  const onResize = () => {
102
108
  if (this.#resizePending)
103
109
  return;
@@ -114,7 +120,9 @@ class InteractiveWorkspace {
114
120
  });
115
121
  this.#screen.enter();
116
122
  let unmount;
123
+ let stopRefresh;
117
124
  try {
125
+ await this.#select(target ?? (await this.#new()), false);
118
126
  unmount = mountRawInput(this.#config.terminal.prefix_key, {
119
127
  input: (events) => this.#enqueue(async () => {
120
128
  for (const event of events) {
@@ -127,6 +135,7 @@ class InteractiveWorkspace {
127
135
  stop: () => this.#stop(),
128
136
  });
129
137
  this.#draw();
138
+ stopRefresh = watchWorkspaceList(() => this.#enqueue(() => this.#refreshWorkspaces()));
130
139
  if (this.#config.updates.check_on_startup) {
131
140
  void availableUpdate()
132
141
  .then((target) => {
@@ -140,6 +149,7 @@ class InteractiveWorkspace {
140
149
  await done;
141
150
  }
142
151
  finally {
152
+ stopRefresh?.();
143
153
  this.#stop();
144
154
  this.#client.close();
145
155
  unmount?.();
@@ -185,16 +195,48 @@ class InteractiveWorkspace {
185
195
  this.#controlsInput = controls;
186
196
  this.#status = controls ? "" : "Read-only · input held by another client";
187
197
  this.#snapshot = decodeSnapshot(await this.#client.request({ type: "snapshot", session: workspace.id }));
188
- await this.#resize();
198
+ if (this.#snapshot.state !== "running") {
199
+ await this.#refreshWorkspaces(workspace.id, render);
200
+ return;
201
+ }
189
202
  if (render)
190
203
  this.#draw();
191
204
  this.#watcher.start(workspace.id, this.#snapshot, (snapshot) => {
205
+ if (snapshot.state !== "running") {
206
+ void this.#enqueue(() => this.#refreshWorkspaces(workspace.id));
207
+ return;
208
+ }
192
209
  this.#snapshot = snapshot;
193
210
  this.#draw();
194
211
  }, (error) => {
195
212
  this.#status = error instanceof Error ? error.message : String(error);
196
213
  this.#draw();
197
214
  });
215
+ await this.#resize();
216
+ }
217
+ async #refreshWorkspaces(exitedId, render = true) {
218
+ const running = (await listWorkspaces(this.#client)).filter(({ id, running }) => running && id !== exitedId);
219
+ const selected = this.#selected;
220
+ const previous = this.#workspaces;
221
+ const { workspaces, next } = reconcileWorkspaces(previous, running, selected?.id);
222
+ this.#workspaces = workspaces;
223
+ if (selected ? !workspaces.some(({ id }) => id === selected.id) : next) {
224
+ this.#watcher.stop();
225
+ this.#selected = undefined;
226
+ this.#snapshot = undefined;
227
+ this.#controlsInput = false;
228
+ this.#status = "";
229
+ if (this.#mode === "history")
230
+ this.#mode = "terminal";
231
+ if (next) {
232
+ await this.#select(next, render);
233
+ return;
234
+ }
235
+ }
236
+ if (render &&
237
+ (previous.length !== workspaces.length ||
238
+ workspaces.some((workspace, index) => workspace !== previous[index])))
239
+ this.#draw();
198
240
  }
199
241
  async #recoverControl() {
200
242
  const selected = this.#selected;
@@ -242,6 +284,14 @@ class InteractiveWorkspace {
242
284
  }
243
285
  }
244
286
  async #input(event) {
287
+ if (event.type === "palette") {
288
+ if (this.#mode === "terminal" || this.#mode === "menu")
289
+ this.#openPalette();
290
+ else if (this.#mode === "palette")
291
+ this.#mode = "terminal";
292
+ this.#draw();
293
+ return;
294
+ }
245
295
  if (event.type === "prefix") {
246
296
  if (this.#mode === "explorer")
247
297
  this.#explorer.leave();
@@ -258,8 +308,15 @@ class InteractiveWorkspace {
258
308
  event.row >= 3 &&
259
309
  !event.release &&
260
310
  event.button === 0) {
311
+ const action = sidebarActionAt(event.row, this.#layout.rows - 2);
261
312
  const workspace = this.#workspaces[event.row - 3];
262
- if (workspace && event.col === 4 && workspace.ownership === "managed")
313
+ if (action) {
314
+ await this.#menu(action);
315
+ this.#draw();
316
+ }
317
+ else if (workspace &&
318
+ event.col === 4 &&
319
+ workspace.ownership === "managed")
263
320
  await this.#pin(workspace);
264
321
  else if (workspace)
265
322
  await this.#select(workspace);
@@ -282,7 +339,21 @@ class InteractiveWorkspace {
282
339
  return;
283
340
  }
284
341
  const key = event.bytes.toString("utf8");
285
- if (this.#mode === "explorer") {
342
+ if (this.#mode === "palette") {
343
+ if (key === "\x1b")
344
+ this.#mode = "terminal";
345
+ else {
346
+ const action = this.#palette?.input(key);
347
+ if (action) {
348
+ this.#mode = "menu";
349
+ await this.#menu(action);
350
+ }
351
+ }
352
+ }
353
+ else if (this.#mode === "ssh") {
354
+ await this.#readSshTarget(key);
355
+ }
356
+ else if (this.#mode === "explorer") {
286
357
  if (key === "\x1b") {
287
358
  this.#explorer.leave();
288
359
  this.#mode = "menu";
@@ -353,7 +424,11 @@ class InteractiveWorkspace {
353
424
  else if (this.#mode === "update") {
354
425
  if (key === "1") {
355
426
  if (this.#update) {
356
- this.#result = { type: "update", version: this.#update };
427
+ this.#result = {
428
+ type: "update",
429
+ version: this.#update,
430
+ session: this.#selected?.id,
431
+ };
357
432
  this.#stop();
358
433
  }
359
434
  }
@@ -487,6 +562,9 @@ class InteractiveWorkspace {
487
562
  if (key === "\x1b") {
488
563
  this.#mode = "terminal";
489
564
  }
565
+ else if (key === " ") {
566
+ this.#openPalette();
567
+ }
490
568
  else if (key.startsWith("/")) {
491
569
  this.#command = "";
492
570
  this.#commandError = false;
@@ -507,8 +585,8 @@ class InteractiveWorkspace {
507
585
  await this.#scroll(this.#layout.terminalRows);
508
586
  this.#mode = "history";
509
587
  }
510
- else if (key === "u" && this.#update) {
511
- this.#mode = "update";
588
+ else if (key === "u") {
589
+ await this.#checkForUpdate();
512
590
  }
513
591
  else if (key === "t") {
514
592
  const inventory = await listTmux(this.#client);
@@ -527,6 +605,10 @@ class InteractiveWorkspace {
527
605
  this.#newIndex = 0;
528
606
  this.#mode = "create";
529
607
  }
608
+ else if (key === "c") {
609
+ this.#sshTarget = "";
610
+ this.#mode = "ssh";
611
+ }
530
612
  else if (key === "h") {
531
613
  this.#hosts = [
532
614
  undefined,
@@ -554,6 +636,36 @@ class InteractiveWorkspace {
554
636
  }
555
637
  }
556
638
  }
639
+ #openPalette() {
640
+ this.#palette = new CommandPalette(Boolean(this.#selected), this.#update);
641
+ this.#mode = "palette";
642
+ }
643
+ async #checkForUpdate() {
644
+ if (!this.#update) {
645
+ this.#status = "Checking for updates…";
646
+ this.#draw();
647
+ this.#update = await availableUpdate(true);
648
+ }
649
+ if (this.#stopped)
650
+ return;
651
+ this.#status = this.#update ? "" : "No newer stable release found";
652
+ if (this.#update)
653
+ this.#mode = "update";
654
+ }
655
+ async #readSshTarget(key) {
656
+ if (key === "\x1b")
657
+ this.#mode = "menu";
658
+ else if (key === "\x7f")
659
+ this.#sshTarget = this.#sshTarget.slice(0, -1);
660
+ else if (key === "\r") {
661
+ const workspace = await openSshShell(this.#client, this.#config, this.#layout, this.#sshTarget);
662
+ this.#workspaces.push(workspace);
663
+ this.#mode = "terminal";
664
+ await this.#select(workspace);
665
+ }
666
+ else if (/^[a-zA-Z0-9_.:@-]+$/u.test(key))
667
+ this.#sshTarget = (this.#sshTarget + key).slice(0, 128);
668
+ }
557
669
  async #readCommand(input) {
558
670
  if (input === "\x1b") {
559
671
  this.#mode = "menu";
@@ -599,78 +711,32 @@ class InteractiveWorkspace {
599
711
  #draw() {
600
712
  if (this.#stopped)
601
713
  return;
602
- const selected = this.#selected;
603
- const title = selected
604
- ? `${selected.name}${selected.persistent ? " ◆" : ""}`
605
- : "No session";
606
- const footer = footerFor(this.#mode, this.#config.terminal.prefix_key, this.#name, this.#offset);
607
- const explorer = this.#mode === "explorer"
608
- ? this.#explorer.layout(this.#layout.rows - 2)
609
- : undefined;
610
- if (this.#mode === "update" && this.#update) {
611
- this.#screen.draw({
612
- layout: this.#layout,
613
- header: `Update available: v${version} → v${this.#update}`,
614
- footer,
615
- sidebarLines: [],
616
- snapshot: undefined,
617
- showCursor: false,
618
- });
619
- return;
620
- }
621
- const running = this.#snapshot?.state === "running";
622
- this.#screen.draw({
714
+ const rows = this.#layout.rows - 2;
715
+ this.#screen.draw(workspaceScreen({
716
+ config: this.#config,
717
+ mode: this.#mode,
718
+ host: this.#host,
719
+ status: this.#status,
720
+ update: this.#update,
623
721
  layout: this.#layout,
624
- header: {
625
- tab: title,
626
- status: this.#status ||
627
- (running
628
- ? this.#host
629
- ? `${this.#host} connected`
630
- : "Local agent connected"
631
- : "Session exited"),
632
- healthy: running && !this.#status,
633
- },
634
- footer: this.#update && this.#mode !== "exit"
635
- ? `${footer} · U Review v${this.#update}`
636
- : footer,
637
- sidebarLines: (this.#mode === "create"
638
- ? selectionLines("OPEN WORKSPACE", ["Default shell", ...this.#newEntries.map(({ name }) => name)], this.#newIndex, this.#layout.rows - 2)
639
- : undefined) ??
640
- (this.#mode === "hosts"
641
- ? selectionLines("HOSTS", this.#hosts.map((host) => host ?? "Local"), this.#hostIndex, this.#layout.rows - 2)
642
- : undefined) ??
643
- (this.#mode === "tmux"
644
- ? selectionLines("TMUX SESSIONS", this.#tmux.map((entry) => entry.name), this.#tmuxIndex, this.#layout.rows - 2)
645
- : undefined) ??
646
- explorer?.sidebar ??
647
- workspaceLabels(this.#config, this.#workspaces, selected?.id),
648
- ...(explorer
649
- ? { contentLines: explorer.content }
650
- : this.#mode === "menu"
651
- ? { contentLines: menuFor(this.#update) }
652
- : this.#mode === "exit"
653
- ? { contentLines: exitLines(this.#host) }
654
- : this.#mode === "command"
655
- ? {
656
- contentLines: [
657
- `Command /${this.#command}▏`,
658
- "",
659
- this.#commandError
660
- ? "Unknown command. Try /exit."
661
- : "/exit Quit Rucan",
662
- ],
663
- }
664
- : {}),
665
- snapshot: explorer ||
666
- this.#mode === "menu" ||
667
- this.#mode === "exit" ||
668
- this.#mode === "command"
669
- ? undefined
670
- : this.#mode === "history"
671
- ? this.#history
672
- : this.#snapshot,
673
- showCursor: this.#mode === "terminal" && this.#controlsInput,
674
- });
722
+ selected: this.#selected,
723
+ workspaces: this.#workspaces,
724
+ snapshot: this.#snapshot,
725
+ history: this.#history,
726
+ controlsInput: this.#controlsInput,
727
+ explorer: this.#mode === "explorer" ? this.#explorer.layout(rows) : undefined,
728
+ newEntries: this.#newEntries,
729
+ newIndex: this.#newIndex,
730
+ hosts: this.#hosts,
731
+ hostIndex: this.#hostIndex,
732
+ tmux: this.#tmux,
733
+ tmuxIndex: this.#tmuxIndex,
734
+ name: this.#name,
735
+ offset: this.#offset,
736
+ command: this.#command,
737
+ commandError: this.#commandError,
738
+ sshTarget: this.#sshTarget,
739
+ paletteLines: this.#mode === "palette" ? this.#palette?.lines(rows) : undefined,
740
+ }));
675
741
  }
676
742
  }
@@ -0,0 +1,67 @@
1
+ const actions = [
2
+ { key: "n", label: "New workspace" },
3
+ { key: "c", label: "SSH connect" },
4
+ { key: "e", label: "Browse files" },
5
+ { key: "h", label: "Switch host" },
6
+ { key: "t", label: "Manage tmux sessions" },
7
+ { key: "p", label: "Pin workspace", requiresSession: true },
8
+ { key: "s", label: "View terminal history", requiresSession: true },
9
+ { key: "r", label: "Rename workspace", requiresSession: true },
10
+ { key: "d", label: "Close UI and keep sessions" },
11
+ { key: "q", label: "Quit Rucan" },
12
+ ];
13
+ export class CommandPalette {
14
+ hasSession;
15
+ update;
16
+ #query = "";
17
+ #index = 0;
18
+ constructor(hasSession, update) {
19
+ this.hasSession = hasSession;
20
+ this.update = update;
21
+ }
22
+ #matches() {
23
+ const available = [
24
+ ...actions,
25
+ {
26
+ key: "u",
27
+ label: this.update
28
+ ? `Review update to v${this.update}`
29
+ : "Check for updates",
30
+ },
31
+ ];
32
+ const terms = this.#query.trim().toLowerCase().split(/\s+/u);
33
+ return available.filter(({ label, requiresSession }) => (!requiresSession || this.hasSession) &&
34
+ terms.every((term) => label.toLowerCase().includes(term)));
35
+ }
36
+ input(key) {
37
+ if (key === "\r")
38
+ return this.#matches()[this.#index]?.key;
39
+ if (key === "\x1b[A" || key === "\x1b[B") {
40
+ const step = key === "\x1b[A" ? -1 : 1;
41
+ this.#index = Math.max(0, Math.min(this.#index + step, this.#matches().length - 1));
42
+ }
43
+ else if (key === "\x7f") {
44
+ this.#query = [...this.#query].slice(0, -1).join("");
45
+ this.#index = 0;
46
+ }
47
+ else if (/^\P{Cc}+$/u.test(key)) {
48
+ this.#query = [...(this.#query + key)].slice(0, 64).join("");
49
+ this.#index = 0;
50
+ }
51
+ return undefined;
52
+ }
53
+ lines(rows) {
54
+ const matches = this.#matches();
55
+ const visible = Math.max(1, Math.min(7, rows - 2));
56
+ const first = Math.max(0, this.#index - visible + 1);
57
+ return [
58
+ "◆ Rucan commands",
59
+ `⌕ ${this.#query || "Search actions"}▏`,
60
+ ...(matches.length
61
+ ? matches
62
+ .slice(first, first + visible)
63
+ .map(({ label }, index) => index + first === this.#index ? `› ${label}` : ` ${label}`)
64
+ : [" No matching actions"]),
65
+ ];
66
+ }
67
+ }
@@ -1,35 +1,12 @@
1
- import stringWidth from "string-width";
2
- import { version } from "../release/version.js";
3
- const reset = "\x1b[0m";
4
- const chrome = "\x1b[1;36m";
5
- const brand = "\x1b[1;30;106m";
6
- const activeTab = "\x1b[1;97;44m";
7
- const connected = "\x1b[32m";
8
- const attention = "\x1b[33m";
9
- const divider = "\x1b[2m";
1
+ import { fit, renderFooter, renderHeader, renderPaletteLine, renderPanelLine, renderSidebar, reset, } from "./chrome.js";
10
2
  const hideCursor = "\x1b[?25l";
11
3
  const move = (row, col) => `\x1b[${row};${col}H`;
12
- const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
13
4
  export function geometry(rows, cols) {
14
5
  const sidebar = cols >= 48 ? Math.max(16, Math.floor(cols * 0.25)) : 0;
15
6
  const terminalCols = Math.max(1, Math.min(500, cols - sidebar));
16
7
  const terminalRows = Math.max(1, Math.min(200, rows - 2, Math.floor(12000 / terminalCols)));
17
8
  return { rows, cols, sidebar, terminalRows, terminalCols };
18
9
  }
19
- function fit(text, width) {
20
- const safe = text.replace(/[\p{Cc}\p{Bidi_Control}]/gu, "");
21
- if (stringWidth(safe) <= width)
22
- return safe;
23
- let result = "";
24
- let used = 0;
25
- for (const { segment } of segmenter.segment(safe)) {
26
- used += stringWidth(segment);
27
- if (used > width)
28
- break;
29
- result += segment;
30
- }
31
- return result;
32
- }
33
10
  function sgr([flags, fg, bg]) {
34
11
  const attributes = [0];
35
12
  const styles = [1, 2, 3, 4, 7];
@@ -50,26 +27,6 @@ function sgr([flags, fg, bg]) {
50
27
  }
51
28
  return `\x1b[${attributes.join(";")}m`;
52
29
  }
53
- function renderHeader(header, width) {
54
- if (typeof header === "string")
55
- return chrome + fit(header, width) + reset;
56
- const logo = fit(` rucan v${version} `, width);
57
- const remaining = width - stringWidth(logo);
58
- if (remaining < 3)
59
- return brand + logo + reset;
60
- const tab = fit(` ${header.tab} `, Math.min(remaining - 1, Math.max(12, Math.floor(width * 0.45))));
61
- const status = fit(` ● ${header.status}`, remaining - stringWidth(tab) - 1);
62
- return (brand +
63
- logo +
64
- reset +
65
- " " +
66
- activeTab +
67
- tab +
68
- reset +
69
- (header.healthy ? connected : attention) +
70
- status +
71
- reset);
72
- }
73
30
  /** Own every write to the outer terminal while the interactive UI is mounted. */
74
31
  export class Screen {
75
32
  #output;
@@ -98,25 +55,17 @@ export class Screen {
98
55
  const model = this.#latest;
99
56
  if (!model)
100
57
  return;
101
- const { layout, header, footer, sidebarLines, snapshot, showCursor, contentLines, } = model;
58
+ const { layout, header, footer, sidebarLines, snapshot, showCursor, contentLines, paletteLines, } = model;
102
59
  const lines = [renderHeader(header, layout.cols)];
60
+ const paletteTop = Math.max(0, Math.floor((layout.rows - 2 - (paletteLines?.length ?? 0)) / 3));
103
61
  for (let row = 0; row < layout.rows - 2; row++) {
104
- const sidebar = fit(sidebarLines[row] ?? "", Math.max(0, layout.sidebar - 1));
105
- let line = layout.sidebar > 0
106
- ? (row === 0 || sidebar.startsWith("›")
107
- ? chrome + sidebar + reset
108
- : sidebar) +
109
- " ".repeat(Math.max(0, layout.sidebar - 1 - stringWidth(sidebar))) +
110
- divider +
111
- "│" +
112
- reset
113
- : "";
62
+ let line = renderSidebar(sidebarLines[row] ?? "", layout.sidebar, row === 0);
114
63
  let col = layout.sidebar;
115
- if (contentLines && layout.cols - col > 2) {
116
- const content = fit(contentLines[row] ?? "", layout.cols - col - 2);
117
- if (content)
118
- line += " " + (row === 0 ? chrome : reset) + content + reset;
119
- }
64
+ const paletteLine = paletteLines?.[row - paletteTop];
65
+ if (paletteLine)
66
+ line += renderPaletteLine(paletteLine, layout.cols - col, row - paletteTop);
67
+ else if (contentLines)
68
+ line += renderPanelLine(contentLines[row] ?? "", layout.cols - col, row);
120
69
  for (const [width, text, style] of snapshot?.grid.lines[row] ?? []) {
121
70
  if (col >= layout.cols)
122
71
  break;
@@ -128,7 +77,7 @@ export class Screen {
128
77
  }
129
78
  lines.push(line + reset);
130
79
  }
131
- lines.push(chrome + fit(footer, layout.cols) + reset);
80
+ lines.push(renderFooter(footer, layout.cols));
132
81
  let output = hideCursor;
133
82
  if (this.#paintedLayout &&
134
83
  (this.#paintedLayout.rows !== layout.rows ||
@@ -0,0 +1,18 @@
1
+ export const sidebarActions = [
2
+ { key: "n", label: "+ New workspace" },
3
+ { key: "c", label: "↗ SSH connect" },
4
+ ];
5
+ export function workspaceSidebar(lines, rows) {
6
+ if (rows < sidebarActions.length + 1)
7
+ return [...lines];
8
+ const listRows = rows - sidebarActions.length;
9
+ return [
10
+ ...Array.from({ length: listRows }, (_, index) => lines[index] ?? ""),
11
+ ...sidebarActions.map(({ label }) => label),
12
+ ];
13
+ }
14
+ export function sidebarActionAt(row, rows) {
15
+ if (rows < sidebarActions.length + 1)
16
+ return undefined;
17
+ return sidebarActions[row - (rows - sidebarActions.length + 2)]?.key;
18
+ }
@@ -0,0 +1,29 @@
1
+ import { isIP } from "node:net";
2
+ import { decodeWorkspace } from "./workspaces.js";
3
+ export function validSshDestination(target) {
4
+ if (target.length === 0 || target.length > 255)
5
+ return false;
6
+ const parts = target.split("@");
7
+ if (parts.length > 2)
8
+ return false;
9
+ if (parts.length === 2 &&
10
+ !/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*$/u.test(parts[0] ?? ""))
11
+ return false;
12
+ const host = parts.at(-1) ?? "";
13
+ return isIP(host) === 6 || /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/u.test(host);
14
+ }
15
+ export async function openSshShell(client, config, layout, target) {
16
+ if (!validSshDestination(target))
17
+ throw new Error("Enter an SSH host or user@host.");
18
+ return decodeWorkspace(await client.request({
19
+ type: "create",
20
+ name: target,
21
+ cwd: "~",
22
+ command: "ssh",
23
+ args: ["-o", "StrictHostKeyChecking=ask", "--", target],
24
+ rows: layout.terminalRows,
25
+ cols: layout.terminalCols,
26
+ persistent: config.defaults.persistence === "persistent",
27
+ scrollback: config.terminal.scrollback_lines,
28
+ }));
29
+ }
@@ -1,44 +1,50 @@
1
1
  export function footerFor(mode, prefix, name, scrollback) {
2
2
  switch (mode) {
3
3
  case "create":
4
- return "↑↓ Choose workspace · Enter Open · Esc Back";
4
+ return "Esc Menu · ↑↓ Choose workspace · Enter Open";
5
5
  case "hosts":
6
- return "↑↓ Select host · Enter Connect · Esc Back";
6
+ return "Esc Menu · ↑↓ Select host · Enter Connect";
7
7
  case "rename":
8
- return `Rename workspace: ${name} · Enter Save · Esc Cancel`;
8
+ return `Esc Menu · Enter Save · Name ${name}`;
9
9
  case "history":
10
- return `History · ${scrollback} lines back · ↑↓ Scroll · Esc Back`;
10
+ return `Esc Menu · ↑↓ Scroll · History ${scrollback} lines back`;
11
11
  case "update":
12
- return "1 Update now · 2 Continue · 3 Skip this version";
12
+ return "Esc Terminal · 1 Update now · 2 Continue · 3 Skip this version";
13
13
  case "tmux":
14
- return "↑↓ Select · Enter Attach · N Open New Tmux Session · Esc Back";
14
+ return "Esc Menu · ↑↓ Select · Enter Attach · N New tmux session";
15
15
  case "explorer":
16
- return "↑↓ Select · Enter Expand/Preview · R Refresh · O Editor · Esc Back";
16
+ return "Esc Menu · ↑↓ Select · Enter Expand/Preview · R Refresh · O Editor";
17
17
  case "command":
18
- return "Enter Run command · Esc Back";
18
+ return "Esc Menu · Enter Run command";
19
19
  case "exit":
20
- return "Enter Keep all · Esc Back";
20
+ return "Esc Menu · Enter Keep all";
21
21
  case "menu":
22
- return "Q Quit · Esc Return to terminal · ↑↓ / 1–9 Switch";
22
+ return "Esc Terminal · Q Quit · ↑↓ / 1–9 Switch";
23
+ case "palette":
24
+ return "Esc Terminal · ↑↓ Select · Enter Run";
25
+ case "ssh":
26
+ return "Esc Menu · Enter Connect";
23
27
  case "terminal":
24
- return `${prefix} Menu · Q or /exit to quit`;
28
+ return `${prefix} Menu (F12) · Alt+Space Search · exit Close shell`;
25
29
  }
26
30
  }
27
31
  export function menuFor(update) {
28
32
  return [
29
33
  "Workspace actions",
34
+ "Space Search actions",
30
35
  "",
31
36
  "/exit or Q Quit Rucan",
32
37
  "D Close UI and keep sessions",
33
38
  "",
34
39
  "N New workspace",
40
+ "C SSH connect",
35
41
  "P Pin",
36
42
  "H Hosts",
37
43
  "E Files",
38
44
  "T Tmux",
39
45
  "S History",
40
46
  "R Rename",
41
- ...(update ? [`U Update to v${update}`] : []),
47
+ update ? `U Update to v${update}` : "U Check for updates",
42
48
  ];
43
49
  }
44
50
  export function selectionLines(title, entries, index, available) {
@@ -0,0 +1,15 @@
1
+ /** Poll workspace metadata without overlapping requests or watching inactive PTYs. */
2
+ export function watchWorkspaceList(refresh) {
3
+ let stopped = false;
4
+ let timer;
5
+ const schedule = () => {
6
+ if (stopped)
7
+ return;
8
+ timer = setTimeout(() => void refresh().finally(schedule), 2000);
9
+ };
10
+ schedule();
11
+ return () => {
12
+ stopped = true;
13
+ clearTimeout(timer);
14
+ };
15
+ }
@@ -0,0 +1,92 @@
1
+ import { version } from "../release/version.js";
2
+ import { workspaceSidebar } from "./sidebar-actions.js";
3
+ import { exitLines, footerFor, menuFor, selectionLines, } from "./view.js";
4
+ import { workspaceLabels } from "./workspaces.js";
5
+ export function workspaceScreen(state) {
6
+ const selected = state.selected;
7
+ const title = selected
8
+ ? `${selected.name}${selected.persistent ? " ◆" : ""}`
9
+ : "No session";
10
+ const footer = footerFor(state.mode, state.config.terminal.prefix_key, state.name, state.offset);
11
+ const explorer = state.mode === "explorer" ? state.explorer : undefined;
12
+ if (state.mode === "update" && state.update) {
13
+ return {
14
+ layout: state.layout,
15
+ header: `Update available: v${version} → v${state.update}`,
16
+ footer,
17
+ sidebarLines: [],
18
+ snapshot: undefined,
19
+ showCursor: false,
20
+ };
21
+ }
22
+ const selection = (state.mode === "create"
23
+ ? selectionLines("OPEN WORKSPACE", ["Default shell", ...state.newEntries.map(({ name }) => name)], state.newIndex, state.layout.rows - 2)
24
+ : undefined) ??
25
+ (state.mode === "hosts"
26
+ ? selectionLines("HOSTS", state.hosts.map((host) => host ?? "Local"), state.hostIndex, state.layout.rows - 2)
27
+ : undefined) ??
28
+ (state.mode === "tmux"
29
+ ? selectionLines("TMUX SESSIONS", state.tmux.map((entry) => entry.name), state.tmuxIndex, state.layout.rows - 2)
30
+ : undefined);
31
+ const running = state.snapshot?.state === "running";
32
+ return {
33
+ layout: state.layout,
34
+ header: {
35
+ tab: title,
36
+ status: state.status ||
37
+ (running
38
+ ? state.host
39
+ ? `${state.host} connected`
40
+ : "Local agent connected"
41
+ : "No active workspace"),
42
+ healthy: running && !state.status,
43
+ },
44
+ footer: state.update && state.mode !== "exit"
45
+ ? `${footer} · U Review v${state.update}`
46
+ : footer,
47
+ sidebarLines: selection ??
48
+ explorer?.sidebar ??
49
+ workspaceSidebar(workspaceLabels(state.config, state.workspaces, selected?.id), state.layout.rows - 2),
50
+ ...(selection && state.layout.sidebar === 0
51
+ ? { contentLines: selection }
52
+ : explorer
53
+ ? { contentLines: explorer.content }
54
+ : state.mode === "menu"
55
+ ? { contentLines: menuFor(state.update) }
56
+ : state.mode === "exit"
57
+ ? { contentLines: exitLines(state.host) }
58
+ : state.mode === "command"
59
+ ? {
60
+ contentLines: [
61
+ `Command /${state.command}▏`,
62
+ "",
63
+ state.commandError
64
+ ? "Unknown command. Try /exit."
65
+ : "/exit Quit Rucan",
66
+ ],
67
+ }
68
+ : state.mode === "ssh"
69
+ ? {
70
+ contentLines: [
71
+ "SSH connect",
72
+ `Host ${state.sshTarget}▏`,
73
+ "Enter an IP, SSH alias, or user@host.",
74
+ ],
75
+ }
76
+ : state.mode === "palette" && state.paletteLines
77
+ ? { paletteLines: state.paletteLines }
78
+ : {}),
79
+ snapshot: (selection && state.layout.sidebar === 0) ||
80
+ explorer ||
81
+ state.mode === "menu" ||
82
+ state.mode === "palette" ||
83
+ state.mode === "ssh" ||
84
+ state.mode === "exit" ||
85
+ state.mode === "command"
86
+ ? undefined
87
+ : state.mode === "history"
88
+ ? state.history
89
+ : state.snapshot,
90
+ showCursor: state.mode === "terminal" && state.controlsInput,
91
+ };
92
+ }
@@ -41,6 +41,18 @@ export async function listWorkspaces(client) {
41
41
  .map(decodeWorkspace)
42
42
  .sort((left, right) => left.name.localeCompare(right.name));
43
43
  }
44
+ export function reconcileWorkspaces(previous, running, selectedId) {
45
+ const current = new Map(running.map((workspace) => [workspace.id, workspace]));
46
+ const workspaces = previous.filter(({ id }) => current.has(id));
47
+ for (const { id } of workspaces)
48
+ current.delete(id);
49
+ workspaces.push(...current.values());
50
+ const index = previous.findIndex(({ id }) => id === selectedId);
51
+ return {
52
+ workspaces,
53
+ next: workspaces[Math.min(Math.max(0, index), workspaces.length - 1)],
54
+ };
55
+ }
44
56
  function defaultWorkspace(config, host) {
45
57
  return (config.workspaces.find(({ host: entry, backend }) => entry === host && backend === "native") ?? {
46
58
  name: host ?? "local-shell",
@@ -71,8 +83,7 @@ export function workspaceLabels(config, sessions, activeId) {
71
83
  const selected = workspace.id === activeId ? "›" : " ";
72
84
  const pin = workspace.backend === "tmux" ? "T" : workspace.persistent ? "◆" : "◇";
73
85
  const slot = index < 9 ? String(index + 1) : " ";
74
- const exited = workspace.running ? "" : " ×";
75
- return `${selected}${slot} ${pin} ${workspace.name}${exited}`;
86
+ return `${selected}${slot} ${pin} ${workspace.name}`;
76
87
  }),
77
88
  ];
78
89
  for (const workspace of config.workspaces) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rucan",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"