@mrciphersmith/roomyx 0.6.1 → 0.6.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/CHANGELOG.md CHANGED
@@ -13,6 +13,83 @@ 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.6.3] — 2026-09-10
17
+
18
+ A patch: closed rooms are now remembered and can be reread. Purely additive —
19
+ nothing removed, no default changed — so `^0.6.0` gets it automatically.
20
+
21
+ ### Added
22
+
23
+ - **`roomyx rooms history`** — the rooms that have closed, newest first, with
24
+ the goal each had, how many people and messages, and where its log is.
25
+ - **`roomyx-client --archive`** — the same list as a picker; Enter opens the
26
+ highlighted room read-only.
27
+ - **`roomyx-client --open <logPath>`** — reread one closed room directly. No
28
+ server, no polling: the log is a finished file, read once. Scrolling,
29
+ per-participant filtering, search, export and help all work exactly as in a
30
+ live room. The owner command does not, and the footer no longer prints its
31
+ key when there is nobody to send it to.
32
+ - **A closed room is recorded in two places, not one.** `roomyx serve` writes
33
+ its history entry on shutdown; a room killed by a signal no handler runs for
34
+ is recorded instead when `roomyx rooms list` next finds it gone. Without the
35
+ second, the rooms most worth rereading — the ones that crashed — would leave
36
+ no trace at all.
37
+
38
+ ### Note on what is stored
39
+
40
+ `.roomyx/rooms/history.jsonl` is an **index, not an archive of copies**. It
41
+ records what a room was and *where its log is*; the transcript stays where you
42
+ put it and is never duplicated. A room log is append-only and is the single
43
+ source of truth for what was said (D-01a) — a copy would be a second one, and
44
+ an append to the original would leave the two disagreeing with nothing
45
+ recording which is current. The cost is that a log you move or delete is gone;
46
+ the list says so, with a `!` at the front of the row, which a shadow copy could
47
+ never have told you. Reasoning in full: decision D-14.
48
+
49
+ One behavioural consequence worth stating: `roomyx rooms list` now appends to
50
+ that file when it prunes a dead room. The MCP surface still does not — it asks
51
+ for no pruning, so "the network surface only reads" stays exactly true.
52
+
53
+ ## [0.6.2] — 2026-09-10
54
+
55
+ A patch: two reader fixes a fuzzer found, and three testing harnesses. Nothing
56
+ removed, no default changed — `^0.6.0` gets it automatically.
57
+
58
+ ### Fixed
59
+
60
+ - **A log line that is not valid JSON now says which file and which line.** It
61
+ threw a bare `SyntaxError: Unexpected token` — no path, no line number — from
62
+ inside the one function whose purpose is to say
63
+ `Invalid "message" line 12 in /path/room.jsonl`. Found by fuzzing: of two
64
+ thousand damaged logs, every unparseable one refused without naming what it
65
+ had refused.
66
+ - **A byte-order mark no longer makes a room unreadable.** Editors add one, it
67
+ is not part of the JSON, and it made the first line unparseable — which meant
68
+ the whole room.
69
+
70
+ ### Added
71
+
72
+ - **`bun run soak`** — a soak harness. The three worst defects this project
73
+ shipped were functions of volume over time and invisible to a unit test by
74
+ construction. It compresses the clock by poll count rather than wall time, so
75
+ an hour of a live room costs a minute, and asserts trends rather than
76
+ thresholds.
77
+ - **`bun scripts/fuzz-log.ts`** — fuzzes the log reader, which is the single
78
+ funnel all three read tools go through. Asserts that it terminates, that every
79
+ refusal names the file and the line, and that anything the writer accepts the
80
+ reader loads.
81
+ - **`bun scripts/replay.ts <room.jsonl>`** — replays a real recorded room
82
+ through the real view at several widths and checks what reached the screen.
83
+ The rendering defects that shipped were all content-dependent and every one
84
+ survived a suite whose fixtures are three short ASCII messages.
85
+
86
+ ### Known
87
+
88
+ - The wrap defect is **not synthetic**. Replaying a real nine-message room at
89
+ width 80 — the most ordinary terminal width there is — loses the final letter
90
+ of `continuation` every time; at 60, 100 and 140 it is intact. Still not
91
+ worked around, for the reason recorded in `test/client/wrap-defect.test.ts`.
92
+
16
93
  ## [0.6.1] — 2026-09-10
17
94
 
18
95
  **A patch, and the first release numbered by the rule rather than by feel.**
package/README.md CHANGED
@@ -153,7 +153,26 @@ supported: each new session gets its own transport and server instance, keyed by
153
153
 
154
154
  Lists rooms that are **confirmed live**, not merely present in the registry —
155
155
  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.
156
+ are pruned from the registry file as a side effect. A pruned room is also
157
+ recorded in the history index at that moment — for a room that crashed, this is
158
+ the only point at which anything notices it ended.
159
+
160
+ ### `roomyx rooms history`
161
+
162
+ The rooms that have **closed**, newest first — the goal each had, how many
163
+ people and messages, when it closed, and where its log is.
164
+
165
+ What is stored is an **index, not a copy**: `.roomyx/rooms/history.jsonl`
166
+ records what a room was and *where its transcript is*, and the transcript itself
167
+ stays exactly where you put it. A room log is append-only and is the single
168
+ source of truth for what was said, so a second copy would be a second source of
169
+ truth — and an append to the original would leave the two disagreeing with
170
+ nothing recording which is current. The trade is that a log you move or delete
171
+ is genuinely gone; the listing says so, which a shadow copy could never have
172
+ told you. Reasoning: decision D-14.
173
+
174
+ A room is recorded when `roomyx serve` shuts down, and — for a room killed by a
175
+ signal no handler runs for — when `roomyx rooms list` next finds it gone.
157
176
 
158
177
  ### `roomyx mcp [flags]`
159
178
 
@@ -198,10 +217,18 @@ lifetime from `serve`/`mcp`.
198
217
  | `--room <id>` | Attach to a specific live room by id. |
199
218
  | `--connect <url>` | Attach to an explicit MCP URL. Wins outright; the registry is not consulted. |
200
219
  | `--registry <path>` | Registry file to resolve rooms from. |
220
+ | `--archive` | Pick a closed room from the history index and open it read-only. |
221
+ | `--open <logPath>` | Reread one closed room directly, read-only. No server needed. |
201
222
 
202
223
  With no flags it auto-attaches when exactly one room is live, and refuses with a
203
224
  list of candidate ids when more than one is.
204
225
 
226
+ **Read-only mode.** `--open` and `--archive` load a finished log once — no
227
+ server, no polling, no reconnect. Scrolling, per-participant filtering, search,
228
+ export and help behave exactly as in a live room; the owner command does not
229
+ work, and the footer does not print its key, because there is nothing to send it
230
+ to.
231
+
205
232
  ## MCP tools
206
233
 
207
234
  ### Per-room server — `roomyx serve`
@@ -334,3 +361,28 @@ Full architecture and the reasoning behind each decision:
334
361
  ## License
335
362
 
336
363
  MIT
364
+
365
+ ## Soak testing
366
+
367
+ ```bash
368
+ bun run soak # ~2 min, about 3 hours of a live room
369
+ bun scripts/soak.ts --polls 20000 # ~7 min, about a working day
370
+ ```
371
+
372
+ The three worst defects this project has shipped were invisible to a unit test
373
+ by construction: an idle client that exhausted the native renderable pool after
374
+ about 2.7 hours, a server that retained every session it ever accepted, and one
375
+ malformed log line that took a client from one connection to 510 in ten seconds.
376
+ Each is a function of volume over time, and the suite's longest test runs forty
377
+ seconds and asserts a state.
378
+
379
+ `scripts/soak.ts` compresses the clock by poll count rather than by wall time —
380
+ the 2.7-hour death is 3275 state polls, which at a 20 ms interval is sixty-five
381
+ seconds — and drives a real `ChatView` and a real `RoomClient` against a real
382
+ `roomyx serve`, through a proxy that counts every request. It reports **trends**,
383
+ not thresholds: a threshold has to be guessed and is wrong on someone else's
384
+ machine, while "the renderable count grew with the transcript and not with the
385
+ poll loop" is true or false everywhere.
386
+
387
+ It is not in `bun test` on purpose. It takes minutes, and a suite people skip is
388
+ worse than one they run.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
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"
@@ -37,7 +37,10 @@
37
37
  "test": "bun test",
38
38
  "typecheck": "tsc --noEmit",
39
39
  "lint": "eslint src test",
40
- "check": "bun run lint && bun run typecheck && bun test"
40
+ "check": "bun run lint && bun run typecheck && bun test",
41
+ "soak": "bun scripts/soak.ts",
42
+ "fuzz": "bun scripts/fuzz-log.ts",
43
+ "replay": "bun scripts/replay.ts"
41
44
  },
42
45
  "dependencies": {
43
46
  "@modelcontextprotocol/sdk": "^1.25.0",
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";
@@ -209,7 +210,16 @@ const COMMANDS: Record<string, Command> = {
209
210
 
210
211
  runUntilSignal(
211
212
  () => handle.close(),
212
- () => deregisterRoom(registryPath, entry.id),
213
+ () => {
214
+ // Archive before deregistering, not after: `archiveRoom` reads the
215
+ // log to summarise it, and it reads better while the entry that says
216
+ // where the log is still exists. The order also means a crash
217
+ // between the two leaves the room recorded in history and still in
218
+ // the registry, which the next prune resolves — rather than gone
219
+ // from both.
220
+ archiveRoom(defaultHistoryPath(registryPath), entry);
221
+ deregisterRoom(registryPath, entry.id);
222
+ },
213
223
  );
214
224
  },
215
225
  },
@@ -235,6 +245,35 @@ const COMMANDS: Record<string, Command> = {
235
245
  },
236
246
  },
237
247
 
248
+ "rooms history": {
249
+ usage: "roomyx rooms history [flags]",
250
+ summary: "rooms that have closed, newest first",
251
+ notes:
252
+ "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`.",
253
+ flags: { registry: REGISTRY_FLAG },
254
+ run: async ({ flags }) => {
255
+ const registryPath = typeof flags.registry === "string" ? flags.registry : defaultRegistryPath();
256
+ const { rooms, unreadable } = readHistory(defaultHistoryPath(registryPath));
257
+ if (rooms.length === 0) {
258
+ console.log("No closed rooms recorded yet.");
259
+ }
260
+ for (const room of rooms) {
261
+ const when = room.closedAt.slice(0, 16).replace("T", " ");
262
+ const goal = room.goal === "" ? "(goal unavailable)" : room.goal;
263
+ console.log(
264
+ `${room.id} closed=${when} messages=${room.messages} participants=${room.participants} ${goal}`,
265
+ );
266
+ // The path on its own line: it is the argument to --open, and a goal
267
+ // statement is long enough that putting them on one line means the
268
+ // thing you have to copy is the thing that gets wrapped.
269
+ console.log(` ${room.logPath}${room.logExists ? "" : " (log no longer at this path)"}`);
270
+ }
271
+ if (unreadable > 0) {
272
+ console.log(`\n${unreadable} history line(s) could not be read and were skipped.`);
273
+ }
274
+ },
275
+ },
276
+
238
277
  client: {
239
278
  usage: "roomyx client [flags]",
240
279
  summary: "attach the terminal UI (same as the roomyx-client binary)",
@@ -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
  }