@mrciphersmith/roomyx 0.6.2 → 0.7.0

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
@@ -13,6 +13,92 @@ patch and never a minor. The rule, the reason, and an audit of the four of seven
13
13
  releases that followed it are in
14
14
  [`docs/roomyx/versioning.md`](docs/roomyx/versioning.md) and decision D-13.
15
15
 
16
+ ## [0.7.0] — 2026-09-10
17
+
18
+ A minor, because two things an existing caller relied on changed. The feature is
19
+ that `roomyx init` now finishes the job instead of leaving you a staged file no
20
+ runtime reads.
21
+
22
+ ### Changed — breaking
23
+
24
+ - **`roomyx skills sync --target all` now writes nine files, not three.** The
25
+ runtime table grew: Cursor and Grok were added, and every one of the four
26
+ agents now has a project-scoped location as well as a user-scoped one. `all`
27
+ genuinely means all, so a caller who typed it before now reaches more places.
28
+ If you wanted the old set, name them: `--target claude`, `--target codex`,
29
+ `--target keryx`.
30
+ - **`roomyx init` is interactive on a terminal.** It used to scaffold `.roomyx/`
31
+ and exit. It still does exactly that through a pipe, in CI, or with
32
+ `--no-interactive` — so nothing scripted changes — but on a terminal it now
33
+ shows what it can do and waits for you to pick.
34
+
35
+ ### Added
36
+
37
+ - **An init picker.** Skill targets for Claude Code, Codex, Cursor, Grok and
38
+ keryx, at both scopes, each showing the exact path it would write. Arrows or
39
+ `j`/`k` move, Space ticks, Enter installs, `q` cancels. Nothing is written
40
+ until you submit. Boxes start ticked only where the answer is not in doubt —
41
+ a runtime whose directory exists on this machine, a project that already uses
42
+ that runtime — because a default tick must never surprise you with a file.
43
+ - **Three more things init offers**, all opt-out in the same list: the room-log
44
+ directory `config.json` has named since the first release and nothing ever
45
+ created; `.gitignore` lines for the registry and lockfiles (the room logs are
46
+ deliberately *not* ignored — the transcript is the point); and registration of
47
+ the roomyx MCP server in `.mcp.json` and `.cursor/mcp.json`.
48
+ - **`roomyx mcp --stdio`.** The transport an MCP client actually spawns. This is
49
+ what init registers: an HTTP URL would name a port nothing is listening on
50
+ until you remember to start a server, so the registration would be broken by
51
+ default. Over stdio the client owns the lifetime and there is no port.
52
+
53
+ ### Fixed
54
+
55
+ - **`roomyx init` no longer leaves you with a skill nothing can see.** The
56
+ staged copy under `.roomyx/skills/` is not a directory any runtime scans, and
57
+ installing was a separate command nothing pointed at. Reported from a real
58
+ install: package installed, `init` run, agent still blind.
59
+ - Two list-rendering defects found by the tests while writing them, both
60
+ width-dependent: the label column pushed the "replaces" warning off a
61
+ 40-column pane, so a row about to overwrite a file read like a fresh install;
62
+ and a plan taller than the terminal drew the hint line through the bottom
63
+ border.
64
+
65
+ ## [0.6.3] — 2026-09-10
66
+
67
+ A patch: closed rooms are now remembered and can be reread. Purely additive —
68
+ nothing removed, no default changed — so `^0.6.0` gets it automatically.
69
+
70
+ ### Added
71
+
72
+ - **`roomyx rooms history`** — the rooms that have closed, newest first, with
73
+ the goal each had, how many people and messages, and where its log is.
74
+ - **`roomyx-client --archive`** — the same list as a picker; Enter opens the
75
+ highlighted room read-only.
76
+ - **`roomyx-client --open <logPath>`** — reread one closed room directly. No
77
+ server, no polling: the log is a finished file, read once. Scrolling,
78
+ per-participant filtering, search, export and help all work exactly as in a
79
+ live room. The owner command does not, and the footer no longer prints its
80
+ key when there is nobody to send it to.
81
+ - **A closed room is recorded in two places, not one.** `roomyx serve` writes
82
+ its history entry on shutdown; a room killed by a signal no handler runs for
83
+ is recorded instead when `roomyx rooms list` next finds it gone. Without the
84
+ second, the rooms most worth rereading — the ones that crashed — would leave
85
+ no trace at all.
86
+
87
+ ### Note on what is stored
88
+
89
+ `.roomyx/rooms/history.jsonl` is an **index, not an archive of copies**. It
90
+ records what a room was and *where its log is*; the transcript stays where you
91
+ put it and is never duplicated. A room log is append-only and is the single
92
+ source of truth for what was said (D-01a) — a copy would be a second one, and
93
+ an append to the original would leave the two disagreeing with nothing
94
+ recording which is current. The cost is that a log you move or delete is gone;
95
+ the list says so, with a `!` at the front of the row, which a shadow copy could
96
+ never have told you. Reasoning in full: decision D-14.
97
+
98
+ One behavioural consequence worth stating: `roomyx rooms list` now appends to
99
+ that file when it prunes a dead room. The MCP surface still does not — it asks
100
+ for no pruning, so "the network surface only reads" stays exactly true.
101
+
16
102
  ## [0.6.2] — 2026-09-10
17
103
 
18
104
  A patch: two reader fixes a fuzzer found, and three testing harnesses. Nothing
package/README.md CHANGED
@@ -39,7 +39,7 @@ bun install -g @mrciphersmith/roomyx
39
39
 
40
40
  ```bash
41
41
  cd your-project
42
- roomyx init # scaffold .roomyx/
42
+ roomyx init # scaffold, then pick what to install
43
43
  roomyx room new room.jsonl --goal "Pick a database" # create a room log
44
44
  roomyx serve room.jsonl # serve it over MCP
45
45
  ```
@@ -107,12 +107,50 @@ nothing to the room. `roomyx client`, with a space, starts that same TUI from
107
107
  the single `roomyx` binary; it is an alias for convenience, not a second
108
108
  implementation, and it does not tie the TUI's lifetime to anything.
109
109
 
110
- ### `roomyx init`
110
+ ### `roomyx init [flags]`
111
111
 
112
- Creates `.roomyx/` in the current directory: `config.json`, an empty room
113
- registry, and a staged copy of the bundled `startup-room` skill. It never
114
- clobbers a registry that already has rooms in it, and never overwrites an
115
- existing `config.json`.
112
+ Sets the project up. On a terminal it shows what it can do and waits for you to
113
+ pick; nothing is written until you submit.
114
+
115
+ ```
116
+ ┌─ roomyx init — pick what to set up ──────────────────────────────┐
117
+ │Skill — every project on this machine │
118
+ │ [x] Claude Code replaces /home/you/.claude/skills/startup-… │
119
+ │ [ ] Cursor /home/you/.cursor/skills/startup-room/SKILL… │
120
+ │ │
121
+ │Skill — this project only (travels with the repo) │
122
+ │ [x] Claude Code /home/you/proj/.claude/skills/startup-room/… │
123
+ │ │
124
+ │Also │
125
+ │ [x] Room-log directory /home/you/proj/.roomyx/rooms/lo… │
126
+ │ [x] Ignore registry, lockfiles /home/you/proj/.gitignore │
127
+ │ [x] MCP server for Claude Code /home/you/proj/.mcp.json │
128
+ │ [ Install ] ↵ │
129
+ │ ↑/↓ or j/k move · Space toggles · Enter installs · q cancels │
130
+ └──────────────────────────────────────────────────────────────────┘
131
+ ```
132
+
133
+ Always, first: `.roomyx/` with `config.json`, an empty room registry, and a
134
+ staged copy of the bundled skill. It never clobbers a registry that already has
135
+ rooms in it, and never overwrites an existing `config.json`.
136
+
137
+ Then, whatever you tick — the skill installed where your agents actually read
138
+ it, the room-log directory, `.gitignore` lines for the machine-local state (not
139
+ for the logs), and the MCP server registered over stdio.
140
+
141
+ | Flag | Meaning |
142
+ | --- | --- |
143
+ | `--yes` | Apply the default selection without asking. |
144
+ | `--no-interactive` | Scaffold `.roomyx/` only. |
145
+
146
+ **Through a pipe or in CI it never prompts** — it scaffolds and exits, printing
147
+ what to run next. A prompt nobody is there to answer is a hang, and a hung
148
+ installer is worse than one that did nothing.
149
+
150
+ Boxes start ticked only where the answer is not in doubt: a runtime whose
151
+ directory exists on this machine, a project that already uses that runtime, the
152
+ log directory the config has always named. A default tick must never surprise
153
+ you with a file — one in `~/.cursor` on a machine without Cursor would.
116
154
 
117
155
  ### `roomyx room new <path> [flags]` / `roomyx room append <path> [flags]`
118
156
 
@@ -153,25 +191,58 @@ supported: each new session gets its own transport and server instance, keyed by
153
191
 
154
192
  Lists rooms that are **confirmed live**, not merely present in the registry —
155
193
  each entry is verified with a real MCP round-trip, and entries that don't answer
156
- are pruned from the registry file as a side effect.
194
+ are pruned from the registry file as a side effect. A pruned room is also
195
+ recorded in the history index at that moment — for a room that crashed, this is
196
+ the only point at which anything notices it ended.
197
+
198
+ ### `roomyx rooms history`
199
+
200
+ The rooms that have **closed**, newest first — the goal each had, how many
201
+ people and messages, when it closed, and where its log is.
202
+
203
+ What is stored is an **index, not a copy**: `.roomyx/rooms/history.jsonl`
204
+ records what a room was and *where its transcript is*, and the transcript itself
205
+ stays exactly where you put it. A room log is append-only and is the single
206
+ source of truth for what was said, so a second copy would be a second source of
207
+ truth — and an append to the original would leave the two disagreeing with
208
+ nothing recording which is current. The trade is that a log you move or delete
209
+ is genuinely gone; the listing says so, which a shadow copy could never have
210
+ told you. Reasoning: decision D-14.
211
+
212
+ A room is recorded when `roomyx serve` shuts down, and — for a room killed by a
213
+ signal no handler runs for — when `roomyx rooms list` next finds it gone.
157
214
 
158
215
  ### `roomyx mcp [flags]`
159
216
 
160
217
  Starts the management MCP server (room listing + skill-sync). Default port
161
218
  `4320`. See **Management server** below for tools and flags.
162
219
 
163
- ### `roomyx skills sync --target <claude|codex|keryx|all|path> [flags]`
220
+ `--stdio` speaks MCP over stdin/stdout instead, which is what an MCP client
221
+ spawns and what `roomyx init` registers. Over stdio there is no port and nothing
222
+ left running: the client owns the process. Nothing is printed to stdout in that
223
+ mode — stdout is the protocol channel.
224
+
225
+ ### `roomyx skills sync --target <runtime|all|path> [flags]`
164
226
 
165
227
  Installs the bundled `startup-room` skill into a runtime's skill location.
228
+ `roomyx init` does this for you with a picker; this is the same thing for a
229
+ script.
166
230
 
167
231
  | Target | Path |
168
232
  | --- | --- |
169
233
  | `claude` | `~/.claude/skills/startup-room/SKILL.md` |
170
234
  | `codex` | `~/.codex/skills/startup-room/SKILL.md` |
235
+ | `cursor` | `~/.cursor/skills/startup-room/SKILL.md` |
236
+ | `grok` | `~/.grok/skills/startup-room/SKILL.md` |
237
+ | `claude-project` … `grok-project` | the same, under `<cwd>/` instead of `~/` |
171
238
  | `keryx` | `<cwd>/.metaproject/project-skills/startup-room/SKILL.md` |
172
- | `all` | all three of the above |
239
+ | `all` | every row above |
173
240
  | anything else | taken as a literal path |
174
241
 
242
+ Project-scoped locations rank **higher** than user-scoped ones in every one of
243
+ these runtimes, and they travel with the repository — which is usually what a
244
+ team wants.
245
+
175
246
  | Flag | Default | Meaning |
176
247
  | --- | --- | --- |
177
248
  | `--yes` | off | Actually write. **Without it nothing is written** — the run reports what it would do and stops. |
@@ -198,10 +269,18 @@ lifetime from `serve`/`mcp`.
198
269
  | `--room <id>` | Attach to a specific live room by id. |
199
270
  | `--connect <url>` | Attach to an explicit MCP URL. Wins outright; the registry is not consulted. |
200
271
  | `--registry <path>` | Registry file to resolve rooms from. |
272
+ | `--archive` | Pick a closed room from the history index and open it read-only. |
273
+ | `--open <logPath>` | Reread one closed room directly, read-only. No server needed. |
201
274
 
202
275
  With no flags it auto-attaches when exactly one room is live, and refuses with a
203
276
  list of candidate ids when more than one is.
204
277
 
278
+ **Read-only mode.** `--open` and `--archive` load a finished log once — no
279
+ server, no polling, no reconnect. Scrolling, per-participant filtering, search,
280
+ export and help behave exactly as in a live room; the owner command does not
281
+ work, and the footer does not print its key, because there is nothing to send it
282
+ to.
283
+
205
284
  ## MCP tools
206
285
 
207
286
  ### Per-room server — `roomyx serve`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "MCP server + terminal UI for startup-room: live room status, chat, per-agent modal, an installable room registry, and skill-sync.",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/src/cli/specs.ts CHANGED
@@ -13,4 +13,6 @@ export const CLIENT_FLAGS: FlagSpecs = {
13
13
  room: { type: "string", describe: "Attach to a specific live room by id" },
14
14
  connect: { type: "string", describe: "Attach to an explicit MCP URL; the registry is not consulted" },
15
15
  registry: { type: "string", describe: "Registry file (default .roomyx/rooms/registry.json)" },
16
+ open: { type: "string", describe: "Reread a closed room from its log file, read-only" },
17
+ archive: { type: "boolean", describe: "Pick a closed room from the history index" },
16
18
  };
package/src/cli.ts CHANGED
@@ -5,6 +5,7 @@ import { serve } from "./server/serve";
5
5
  import { createServerShutdown } from "./server/shutdown";
6
6
  import { init } from "./installer/init";
7
7
  import { registerRoom, deregisterRoom, listLiveRooms } from "./installer/registry";
8
+ import { archiveRoom, defaultHistoryPath, readHistory } from "./installer/history";
8
9
  import { syncSkill } from "./installer/skill-sync";
9
10
  import { appendMessage, createRoomLog, LEGAL_KINDS, parseRoster } from "./log/write";
10
11
  import { MESSAGE_KINDS } from "./log/schema";
@@ -71,12 +72,66 @@ interface Command {
71
72
 
72
73
  const COMMANDS: Record<string, Command> = {
73
74
  init: {
74
- usage: "roomyx init",
75
- summary: "scaffold .roomyx/ in this project",
76
- flags: {},
77
- run: async () => {
78
- const result = init({ cwd: process.cwd(), bundledSkillPath: bundledSkillPath() });
75
+ usage: "roomyx init [flags]",
76
+ summary: "scaffold .roomyx/, then set up skills, MCP and git for this project",
77
+ notes:
78
+ "Interactive when the terminal allows it: tick what you want, see every\n path before agreeing to it, and nothing is written until you submit.\n Through a pipe or in CI it scaffolds .roomyx/ and asks nothing, so it can\n never hang waiting for a keypress nobody is there to make.",
79
+ flags: {
80
+ yes: { type: "boolean", describe: "Apply the default selection without asking" },
81
+ "no-interactive": { type: "boolean", describe: "Scaffold .roomyx/ only" },
82
+ },
83
+ run: async ({ flags }) => {
84
+ const cwd = process.cwd();
85
+ const result = init({ cwd, bundledSkillPath: bundledSkillPath() });
79
86
  console.log(result.created ? `Created ${result.roomyxDir}` : `${result.roomyxDir} already initialized`);
87
+
88
+ const { buildPlan, selectedItems } = await import("./installer/init-plan");
89
+ const { applyPlan } = await import("./installer/init-apply");
90
+
91
+ const plan = buildPlan({ cwd });
92
+ // A terminal on both ends or nothing to ask. `--yes` overrides, because
93
+ // a script that has decided already should not be refused for lacking a
94
+ // tty — but the default must never block a pipeline on a prompt.
95
+ const interactive = process.stdout.isTTY === true && process.stdin.isTTY === true;
96
+ if (flags["no-interactive"] === true || (!interactive && flags.yes !== true)) {
97
+ console.log("");
98
+ console.log("Nothing else was written. To install the skill and register the MCP server:");
99
+ console.log(" roomyx init --yes # the default selection, no prompt");
100
+ console.log(" roomyx init # pick, in a terminal");
101
+ return;
102
+ }
103
+
104
+ let chosen = plan;
105
+ if (flags.yes !== true) {
106
+ const { runInitPicker } = await import("./client/init-screen");
107
+ const picked = await runInitPicker(plan);
108
+ if (picked === null) {
109
+ console.log("Cancelled — nothing else was written.");
110
+ return;
111
+ }
112
+ chosen = picked;
113
+ }
114
+
115
+ const results = applyPlan(selectedItems(chosen), {
116
+ cwd,
117
+ bundledSkillPath: bundledSkillPath(),
118
+ configPath: join(cwd, ".roomyx", "config.json"),
119
+ });
120
+
121
+ console.log("");
122
+ for (const line of results) {
123
+ console.log(`${line.ok ? " ok " : " !! "} ${line.label}`);
124
+ console.log(` ${line.path} — ${line.message}`);
125
+ }
126
+
127
+ const failed = results.filter((line) => !line.ok).length;
128
+ if (failed > 0) console.log(`\n${failed} item(s) failed. Everything else was applied.`);
129
+ if (results.some((line) => line.ok && line.id.startsWith("skill:"))) {
130
+ // The one thing an operator reliably forgets, and the symptom is
131
+ // "roomyx installed the skill and my agent still cannot see it".
132
+ console.log("\nRestart your agent — skills are discovered at startup.");
133
+ }
134
+ console.log("\nNext: roomyx room new .roomyx/rooms/logs/<name>.jsonl --goal \"<what the room is for>\"");
80
135
  },
81
136
  },
82
137
 
@@ -209,7 +264,16 @@ const COMMANDS: Record<string, Command> = {
209
264
 
210
265
  runUntilSignal(
211
266
  () => handle.close(),
212
- () => deregisterRoom(registryPath, entry.id),
267
+ () => {
268
+ // Archive before deregistering, not after: `archiveRoom` reads the
269
+ // log to summarise it, and it reads better while the entry that says
270
+ // where the log is still exists. The order also means a crash
271
+ // between the two leaves the room recorded in history and still in
272
+ // the registry, which the next prune resolves — rather than gone
273
+ // from both.
274
+ archiveRoom(defaultHistoryPath(registryPath), entry);
275
+ deregisterRoom(registryPath, entry.id);
276
+ },
213
277
  );
214
278
  },
215
279
  },
@@ -235,6 +299,35 @@ const COMMANDS: Record<string, Command> = {
235
299
  },
236
300
  },
237
301
 
302
+ "rooms history": {
303
+ usage: "roomyx rooms history [flags]",
304
+ summary: "rooms that have closed, newest first",
305
+ notes:
306
+ "History records what a room was and where its log is — it does not copy\n the log. Reopen one read-only with `roomyx-client --open <logPath>`, or\n pick from the list with `roomyx-client --archive`.",
307
+ flags: { registry: REGISTRY_FLAG },
308
+ run: async ({ flags }) => {
309
+ const registryPath = typeof flags.registry === "string" ? flags.registry : defaultRegistryPath();
310
+ const { rooms, unreadable } = readHistory(defaultHistoryPath(registryPath));
311
+ if (rooms.length === 0) {
312
+ console.log("No closed rooms recorded yet.");
313
+ }
314
+ for (const room of rooms) {
315
+ const when = room.closedAt.slice(0, 16).replace("T", " ");
316
+ const goal = room.goal === "" ? "(goal unavailable)" : room.goal;
317
+ console.log(
318
+ `${room.id} closed=${when} messages=${room.messages} participants=${room.participants} ${goal}`,
319
+ );
320
+ // The path on its own line: it is the argument to --open, and a goal
321
+ // statement is long enough that putting them on one line means the
322
+ // thing you have to copy is the thing that gets wrapped.
323
+ console.log(` ${room.logPath}${room.logExists ? "" : " (log no longer at this path)"}`);
324
+ }
325
+ if (unreadable > 0) {
326
+ console.log(`\n${unreadable} history line(s) could not be read and were skipped.`);
327
+ }
328
+ },
329
+ },
330
+
238
331
  client: {
239
332
  usage: "roomyx client [flags]",
240
333
  summary: "attach the terminal UI (same as the roomyx-client binary)",
@@ -250,6 +343,7 @@ const COMMANDS: Record<string, Command> = {
250
343
  summary: "start the management MCP server",
251
344
  notes: "Default port 4320, so it does not collide with `roomyx serve`.",
252
345
  flags: {
346
+ stdio: { type: "boolean", describe: "Speak MCP over stdin/stdout instead of HTTP (what an MCP client spawns)" },
253
347
  port: { type: "number", describe: "Listen port (default 4320; 0 picks an ephemeral one)" },
254
348
  host: { type: "string", describe: "Bind address (default 127.0.0.1)" },
255
349
  "acknowledge-non-loopback": { type: "boolean", describe: "Required to bind a non-loopback host" },
@@ -257,18 +351,36 @@ const COMMANDS: Record<string, Command> = {
257
351
  config: { type: "string", describe: "Config file (default .roomyx/config.json)" },
258
352
  },
259
353
  run: async ({ flags }) => {
260
- const handle = await serveManagement(
261
- {
262
- registryPath: typeof flags.registry === "string" ? flags.registry : defaultRegistryPath(),
263
- bundledSkillPath: bundledSkillPath(),
264
- configPath: typeof flags.config === "string" ? flags.config : defaultConfigPath(),
265
- },
266
- {
267
- port: typeof flags.port === "number" ? flags.port : undefined,
268
- host: typeof flags.host === "string" ? flags.host : undefined,
269
- acknowledgeNonLoopback: flags["acknowledge-non-loopback"] === true,
270
- },
271
- );
354
+ const managementOptions = {
355
+ registryPath: typeof flags.registry === "string" ? flags.registry : defaultRegistryPath(),
356
+ bundledSkillPath: bundledSkillPath(),
357
+ configPath: typeof flags.config === "string" ? flags.config : defaultConfigPath(),
358
+ };
359
+
360
+ if (flags.stdio === true) {
361
+ // The transport an MCP client actually wants: it spawns the process and
362
+ // owns its lifetime, so there is no port to pick, nothing to leave
363
+ // running, and no registration that points at something not started
364
+ // yet. This is what `roomyx init` writes into `.mcp.json`.
365
+ //
366
+ // **Nothing may be printed to stdout here** — stdout is the protocol
367
+ // channel, and one stray line of greeting is a parse error at the far
368
+ // end. The HTTP branch below prints because it has a stdout to itself.
369
+ const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
370
+ const { createManagementMcpServer } = await import("./mcp-management/server");
371
+ const server = createManagementMcpServer(managementOptions);
372
+ await server.connect(new StdioServerTransport());
373
+ // The client closes the pipe when it is done; there is no port to
374
+ // release, so the signal handlers the HTTP branch installs would have
375
+ // nothing to do.
376
+ return;
377
+ }
378
+
379
+ const handle = await serveManagement(managementOptions, {
380
+ port: typeof flags.port === "number" ? flags.port : undefined,
381
+ host: typeof flags.host === "string" ? flags.host : undefined,
382
+ acknowledgeNonLoopback: flags["acknowledge-non-loopback"] === true,
383
+ });
272
384
 
273
385
  console.log(`roomyx mcp listening at ${handle.url}`);
274
386
  console.log("tools: roomyx.rooms.list, roomyx.skills.sync");
@@ -278,7 +390,7 @@ const COMMANDS: Record<string, Command> = {
278
390
  },
279
391
 
280
392
  "skills sync": {
281
- usage: "roomyx skills sync --target <claude|codex|keryx|all|path> [flags]",
393
+ usage: "roomyx skills sync --target <runtime|all|path> [flags]",
282
394
  summary: "install the bundled startup-room skill",
283
395
  notes:
284
396
  "Without --yes nothing is written: the run reports what it would do and\n stops. D-02 — landing on a real skill file is a deliberate act, not a\n side effect of the mechanism existing.",
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Clips a label to `width` columns, marking the cut.
3
+ *
4
+ * Written because a row is a `TextRenderable` with `height: 1` in a fixed-width
5
+ * box, and the default word wrapping put an over-long label on a second line
6
+ * that `height: 1` then clipped — so the overflow was not trimmed at the column
7
+ * edge, the whole trailing word vanished. A single-token name of 23 characters
8
+ * rendered a completely blank row in the roster, while `j`/`k` still moved onto
9
+ * it and Enter still filtered by it: a filter attributed to a participant whose
10
+ * name was nowhere on screen.
11
+ *
12
+ * Counted in code units, which is what the box is laid out in. That is wrong
13
+ * for wide characters and is recorded as such — the display-cell arithmetic is
14
+ * deferred with the resize work that will need the same primitive — but a name
15
+ * cut one column early is a different order of problem from a name that is not
16
+ * drawn at all.
17
+ *
18
+ * Shared rather than copied: the archive list is the second fixed-width list of
19
+ * single-line rows in this client, and the bug above is a property of that
20
+ * shape, not of the roster.
21
+ */
22
+ export function clip(label: string, width: number): string {
23
+ if (width <= 0) return "";
24
+ if (label.length <= width) return label;
25
+ return width === 1 ? "…" : `${label.slice(0, width - 1)}…`;
26
+ }
@@ -1,6 +1,7 @@
1
1
  import { TextRenderable } from "@opentui/core";
2
2
  import type { RenderContext } from "@opentui/core";
3
3
  import { footerHints } from "../keymap";
4
+ import type { Action } from "../keymap";
4
5
 
5
6
  /**
6
7
  * The bottom line: what the room is doing on the left, what your keys are on
@@ -21,9 +22,12 @@ export class Footer {
21
22
  private liveness = "";
22
23
  private scrollNote: string | null = null;
23
24
  private readonly width: number;
25
+ /** Bindings that do not apply to this surface — see `footerHints`. */
26
+ private readonly hidden: readonly Action[];
24
27
 
25
- constructor(ctx: RenderContext, options: { width: number }) {
28
+ constructor(ctx: RenderContext, options: { width: number; hideBindings?: readonly Action[] }) {
26
29
  this.width = options.width;
30
+ this.hidden = options.hideBindings ?? [];
27
31
  this.node = new TextRenderable(ctx, { content: "", height: 1 });
28
32
  this.render();
29
33
  }
@@ -46,7 +50,7 @@ export class Footer {
46
50
  // a time rather than all at once. The first version dropped every hint the
47
51
  // moment the line did not fit, which took them away in exactly the two
48
52
  // states that most need them: an empty room, and a scrolled one.
49
- const right = footerHints(Math.max(0, this.width - left.length - 2));
53
+ const right = footerHints(Math.max(0, this.width - left.length - 2), this.hidden);
50
54
  const gap = this.width - left.length - right.length;
51
55
  this.node.content = right === "" || gap < 2 ? left.slice(0, Math.max(0, this.width)) : `${left}${" ".repeat(gap)}${right}`;
52
56
  }
@@ -1,34 +1,7 @@
1
1
  import { BoxRenderable, TextRenderable } from "@opentui/core";
2
2
  import type { RenderContext } from "@opentui/core";
3
3
  import type { RosterEntry } from "../../log/types";
4
-
5
- /**
6
- * Clips a label to `width` columns, marking the cut.
7
- *
8
- * The row is a `TextRenderable` with `height: 1` in a fixed-width box, and the
9
- * default word wrapping put an over-long label on a second line that `height: 1`
10
- * then clipped — so the overflow was not trimmed at the column edge, the whole
11
- * trailing word vanished. A single-token name of 23 characters rendered a
12
- * completely blank row, while `j`/`k` still moved onto it and Enter still
13
- * filtered by it: a filter attributed to a participant whose name was nowhere
14
- * on screen.
15
- *
16
- * Counted in code units, which is what the box is laid out in. That is wrong
17
- * for wide characters and is recorded as such — the display-cell arithmetic is
18
- * deferred with the resize work that will need the same primitive — but a name
19
- * cut one column early is a different order of problem from a name that is not
20
- * drawn at all.
21
- */
22
- function clip(label: string, width: number): string {
23
- // Unreachable from `ChatView`, which constructs this with a hardcoded width
24
- // of 24 — a mutation pass confirmed deleting it changes nothing. Kept as a
25
- // total function rather than as a guard: `clip` is exported-shaped and a
26
- // caller with a narrower gutter is exactly what the deferred resize work will
27
- // introduce. Recorded so it is not read as protection it does not provide.
28
- if (width <= 0) return "";
29
- if (label.length <= width) return label;
30
- return width === 1 ? "…" : `${label.slice(0, width - 1)}…`;
31
- }
4
+ import { clip } from "../clip";
32
5
 
33
6
  /** Same ids, same names, same order — the only thing a rebuild would change. */
34
7
  function sameRoster(a: RosterEntry[], b: RosterEntry[]): boolean {
@@ -3,11 +3,19 @@ import type { RenderContext } from "@opentui/core";
3
3
  import type { ConnectionStatus } from "../mcp-client";
4
4
  import type { GoalContract } from "../../log/types";
5
5
 
6
- /** One-line status bar: goal statement + connection status. */
6
+ /**
7
+ * One-line status bar: goal statement + connection status.
8
+ *
9
+ * `"closed"` is a display state, not a transport state — a room being reread
10
+ * from its log has no socket at all. It is widened here rather than added to
11
+ * `ConnectionStatus`, which describes what the MCP client is doing and would
12
+ * then carry a member the client can never emit.
13
+ */
14
+ export type DisplayStatus = ConnectionStatus | "closed";
7
15
  export class StatusBar {
8
16
  readonly node: TextRenderable;
9
17
  private goalStatement = "";
10
- private status: ConnectionStatus = "connecting";
18
+ private status: DisplayStatus = "connecting";
11
19
  /** Takes over the line while an owner command is being composed or answered. */
12
20
  private notice: string | null = null;
13
21
 
@@ -25,7 +33,7 @@ export class StatusBar {
25
33
  this.render();
26
34
  }
27
35
 
28
- setConnectionStatus(status: ConnectionStatus): void {
36
+ setConnectionStatus(status: DisplayStatus): void {
29
37
  this.status = status;
30
38
  this.render();
31
39
  }
@@ -41,9 +49,12 @@ export class StatusBar {
41
49
  this.node.content = this.notice;
42
50
  return;
43
51
  }
44
- const statusLabel = { connecting: "connecting…", connected: "connected", disconnected: "disconnected — retrying" }[
45
- this.status
46
- ];
52
+ const statusLabel = {
53
+ connecting: "connecting…",
54
+ connected: "connected",
55
+ disconnected: "disconnected — retrying",
56
+ closed: "closed",
57
+ }[this.status];
47
58
  this.node.content = `[${statusLabel}] ${this.goalStatement}`;
48
59
  }
49
60
  }