@mrciphersmith/roomyx 0.5.0 → 0.6.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
@@ -8,6 +8,252 @@ Format loosely follows [Keep a Changelog](https://keepachangelog.com). Versions
8
8
  are [semantic](https://semver.org), with the `0.x` convention that breaking
9
9
  changes land in the minor position.
10
10
 
11
+ ## [0.6.0] — 2026-09-09
12
+
13
+ Two passes over the published 0.5.0: running it by hand and putting ten
14
+ screenshots of it in front of four reviewers, then a nine-reviewer read of the
15
+ whole repository. The first produced the TUI work below; the second produced
16
+ three blockers and thirteen major defects, and its report is
17
+ [`docs/roomyx/review-2026-09-09.md`](docs/roomyx/review-2026-09-09.md).
18
+
19
+ **The version is minor rather than patch because several things are breaking**,
20
+ which in `0.x` is where breaking changes go. `Enter` filters the stream instead
21
+ of opening a modal and `AgentModal` is deleted; `roomyx.skills.sync` over MCP no
22
+ longer takes `yes` or `dryRun`; `syncSkill` now refuses to write unless asked,
23
+ so an embedder that relied on the old default gets a refusal rather than a
24
+ file; and `RoomClient` loses `getAgentDetail` and `getLastSeenSeq`, `Footer`
25
+ loses `setWidth`.
26
+
27
+ **If you are on 0.5.0 or earlier, upgrade.** Three of the defects below cost
28
+ data or a session: a mistyped `--kind` makes a room unreadable forever, an idle
29
+ attached client dies of its own accord in about 2.7 hours, and one malformed log
30
+ line turns a client into a request storm.
31
+
32
+ ### Added
33
+
34
+ - **The transcript scrolls, and the arrows belong to it.** `↑`/`↓` by a line,
35
+ `PgUp`/`PgDn` by a page, `Ctrl-U`/`Ctrl-D` by a half, `g`/`G` to the top and
36
+ back to the bottom. The roster keeps its selection on `j`/`k`.
37
+
38
+ Before this, no key scrolled anything: the arrows moved the roster, so four
39
+ keypresses on a room taller than the pane moved one caret and left the stream
40
+ apparently frozen. A room that outgrew its pane could not be read back at
41
+ all.
42
+
43
+ **`:` opens the owner prompt.** `o` means *open* nearly everywhere and was
44
+ borrowed rather than chosen. It still works and is not documented, so a habit
45
+ from 0.5.0 does not break on upgrade.
46
+
47
+ The keymap is now data in `src/client/keymap.ts` rather than an `else if`
48
+ chain inside the keypress handler — which is how it could be wrong without
49
+ being visibly wrong, since there was no artefact anyone could read to answer
50
+ "what keys does this have?". A test asserts no two bindings claim the same
51
+ key, because a first-match-wins resolver silently shadows the loser.
52
+
53
+ - **A footer, generated from that keymap.** Keys on the right, liveness on the
54
+ left — and the liveness is a fact that *moves*: a message count and the age
55
+ of the newest message. A word that has always said the same thing stops being
56
+ read, which is precisely why a dead room looked like a live one; the header
57
+ differed from a working room by one word in the same ink. When the number
58
+ stops, the silence means something.
59
+
60
+ An empty room now says `connected · waiting for the first message` rather
61
+ than showing a void that reads as a hang. Scroll away from the bottom and the
62
+ footer says so and says how to return. On a terminal too narrow for
63
+ everything, hints drop one at a time by usefulness — the first version
64
+ dropped all of them at once, which took the keys away in the two states that
65
+ most need them.
66
+
67
+ Shipped in the same change as the rebind on purpose. A footer is a keymap's
68
+ confession: shipping it first would have printed `↑/↓ roster` on the screen
69
+ as documented behaviour, and made the correction more expensive.
70
+
71
+ - **The transcript has a hierarchy.** A message is a bright speaker name with a
72
+ dim `kind re #n` tag beside it, and the body indented underneath in a dimmer
73
+ ink, with a blank line between turns. Consecutive turns from one speaker
74
+ share a header — a real room had the same nine-character prefix nine times
75
+ running, which hides the one thing a header is for.
76
+
77
+ Before this every message was one line, one colour, one weight, and a wrapped
78
+ continuation began at the same column as a new turn, so sixteen messages were
79
+ a single grey wall. The indent is what makes a wrap read as a continuation.
80
+
81
+ It costs vertical space: a turn is three rows where it was one, so fewer
82
+ turns fit on a short terminal. The shared headers pay most of that back in a
83
+ room where people speak in runs.
84
+
85
+ - **The roster gives up its 24 columns below 80.** At 72 columns it was
86
+ spending a third of the terminal on a few short names while the messages
87
+ wrapped to 46. A fixed gutter is also where non-Latin names die — three CJK
88
+ characters are six cells, not three. Below the breakpoint the stream takes
89
+ the full width and the footer says how many participants are in the room;
90
+ widen the terminal and the list comes back.
91
+
92
+ - **Search, with `/` and `n`/`N`.** Matched case-insensitively against what is
93
+ on screen — the speaker's display name, the kind tag and the body — so
94
+ searching for `Ann` finds messages headed `Ann` rather than every message
95
+ from the id `a`. The footer names the live query and the match position, and
96
+ says `no matches` rather than standing still, because a search that finds
97
+ nothing must not look like one that found something.
98
+
99
+ - **`?` shows the full keymap,** generated from the same table the dispatcher
100
+ and the footer use. The footer teaches the handful of keys worth permanent
101
+ space; everything else lives here rather than in the source.
102
+
103
+ - **`w` writes what is on screen to a file** and names it. A terminal is a bad
104
+ place to search and a good place to read. It never overwrites — the next free
105
+ numbered name is used — and a filtered view gets its own file.
106
+
107
+ - **Connection changes are written into the transcript, not only the footer.**
108
+ A footer repainted at a fixed row, with the cursor parked in another pane, is
109
+ never spoken by a screen reader and never survives a `tee`. A `— disconnected,
110
+ retrying —` line in the stream lands in speech, in scrollback and in the log
111
+ at once.
112
+
113
+ ### Fixed
114
+
115
+ - **Closing the client no longer dumps a stack trace.** `SIGTERM`/`SIGINT`/
116
+ `SIGHUP` had no handler at all, so killing an attached client tore the
117
+ renderer down underneath a live poll: the poll lost its connection, called
118
+ `handleDisconnect`, and wrote "disconnected" into an already-destroyed text
119
+ buffer — `TextBuffer is destroyed`, ten frames of stack, at someone who just
120
+ closed a window. `q` and Ctrl-C escaped it only because that path happened to
121
+ stop the client first. All four now share one ordered shutdown that stops
122
+ polling before destroying the renderer.
123
+
124
+ - **Long messages are no longer silently cut.** `message-row.ts` set
125
+ `height: 1` with no wrapping, so every message was clipped at the pane width
126
+ with no ellipsis and nothing to scroll — and what got cut was the end of the
127
+ sentence, which in a room of arguing agents is where the claim is. Bodies now
128
+ wrap on word boundaries.
129
+
130
+ - **`kind` and `in_reply_to` are displayed.** Both are in `MessageEnvelope` and
131
+ both were written by the dispatcher and rendered by nothing. The
132
+ challenge/answer structure that is the point of the log schema was visible in
133
+ the log and invisible in the viewer of that log. Rows now read
134
+ `Ann [challenge re #1]: …`.
135
+
136
+ - **A pane holding its first messages before its first layout pass no longer
137
+ drops message 1.** The horizontal scrollbar occupies a viewport row whether
138
+ or not there is anything to scroll, leaving `maxScrollTop` at 1 on a pane
139
+ that is not full, so sticky-bottom scrolled down by one.
140
+
141
+ Narrower than [the backlog][backlog] claims, and that correction is recorded
142
+ there: the real client always paints a `[connecting…]` frame before its first
143
+ poll returns, so it never triggered this. No 0.4.0 or 0.5.0 user lost a
144
+ message to it. Fixed because it is one line and a trap for whoever later
145
+ makes the client paint after its first batch rather than before.
146
+
147
+ ### Fixed — from the full-repository review
148
+
149
+ A nine-reviewer pass over `src` and `test` found three blockers and thirteen
150
+ major defects; the report is [`docs/roomyx/review-2026-09-09.md`](docs/roomyx/review-2026-09-09.md)
151
+ and the work is flow 001. Every fix below was reproduced before and verified as
152
+ a regression barrier after — the fix is removed again and the test is required
153
+ to fail.
154
+
155
+ - **`roomyx room append` could make a room unreadable forever.** The reader
156
+ validated with zod; the writer had only TypeScript types, erased at the CLI
157
+ boundary where `--kind` was cast. `--kind bogus-kind` exited 0, wrote the
158
+ line, and every later read of that room threw — on an append-only log with no
159
+ repair command, while `serve` kept binding and `rooms list` kept calling the
160
+ room live. One schema, in `src/log/schema.ts`, is now imported by both
161
+ directions.
162
+
163
+ - **An idle attached client killed itself in about 2.7 hours.** `remove()` in
164
+ `@opentui/core` unlinks without freeing, and the roster was rebuilt on every
165
+ three-second state poll whether or not it had changed: five leaked renderables
166
+ a poll against a finite native pool. Detached rows are destroyed, and an
167
+ unchanged roster is not rebuilt.
168
+
169
+ - **One malformed log line turned a client into a request storm.** `callTool`
170
+ never read `isError`, so a tool error was indistinguishable from a dropped
171
+ transport, and each failing poll scheduled its own reconnect without stopping
172
+ the running loops — 510 connections in ten seconds, measured. Tool errors now
173
+ reach the transcript and the poll continues; reconnect is single-flight with a
174
+ generation counter and backs off to 30s.
175
+
176
+ - **`roomyx serve` would not exit on a signal while a client was attached** —
177
+ the normal state of a served room. The code that ended the connections sat
178
+ inside the callback that waits for them. Sessions close first,
179
+ `closeAllConnections()` bounds it, `SIGHUP` is handled, and deregistration
180
+ happens after the close rather than before, so a hung shutdown can no longer
181
+ hide a still-served room from the registry.
182
+
183
+ - **Concurrent `room append` produced duplicate `seq` values.** `seq` is the
184
+ transcript cursor, so a client polling between two colliding writes never
185
+ received the second message. The lockfile that had guarded the registry for
186
+ three rounds now guards the data too.
187
+
188
+ - **MCP sessions were never released.** Nothing sent the DELETE the SDK needs,
189
+ so every session a server ever accepted was retained — and stayed routable.
190
+ The client terminates its sessions, an unknown session id gets 404 instead of
191
+ a new transport, and an idle sweeper closes what a crashed client could not.
192
+
193
+ - **A roster id could direct the transcript export outside the working
194
+ directory** while the status bar reported otherwise. The id is sanitised and
195
+ the resolved path is checked against `cwd`.
196
+
197
+ - **`roomyx.skills.sync` over MCP wrote without the gate its own CLI help
198
+ promises.** `yes` and `dryRun` are off that tool's schema; the gate lives in
199
+ `syncSkill`, computed once and failing closed.
200
+
201
+ - **A dead room could be resurrected by a recycled port.** `isRoomLive` proved
202
+ only that something answered; the pid in the registry was never read. It is
203
+ now checked first.
204
+
205
+ - **The help overlay drew into its own border below 20 rows** — the clamp added
206
+ while fixing its height reintroduced the defect it fixed. It fits whatever
207
+ height it is given, and the `? or Esc closes` line is never what gets dropped.
208
+
209
+ - **A participant name of 23 characters rendered an empty roster row.** Word
210
+ wrapping moved it to a line that `height: 1` clipped, so the whole word
211
+ vanished while `j`/`k` still moved onto the row. Labels are clipped with a
212
+ marker.
213
+
214
+ - **Three regression tests no longer failed when their fix was removed.** Found
215
+ by mutation, restored the same way: the scrollbar fix is pinned at the
216
+ boundary heights where content exactly fills the pane, and the shutdown
217
+ ordering moved out of `runClient` — which no test can reach — into a unit that
218
+ asserts the order directly.
219
+
220
+ ### Known
221
+
222
+ - **A word ending exactly at the wrap column loses its last character** —
223
+ `whether scrolling or` draws as `whether scrollin` / `or`, with the `g` gone
224
+ rather than wrapped. Width-dependent: 120 columns is clean, 90 is not. Not
225
+ worked around, on purpose: a one-column right margin makes it disappear at
226
+ 60, 72, 108 and 120 and leaves it at 90, which would turn a reproducible
227
+ defect into an intermittent one. `test/client/wrap-defect.test.ts` holds the
228
+ reproduction as a tripwire that starts failing the day it is fixed upstream.
229
+
230
+ - **Nothing responds to a terminal resize.** Every dimension is read once at
231
+ construction, so a resized terminal leaves the footer off-screen, `PgUp`
232
+ overshooting, and the roster breakpoint stuck at its old answer. Deferred
233
+ deliberately: it is a feature rather than a repair, and it should land with
234
+ the display-cell width arithmetic below, which needs the same primitive.
235
+
236
+ - **The footer measures code units and calls them columns**, so a CJK
237
+ participant name eats the key hints — including the only on-screen statement
238
+ of how to quit. Deferred with the resize work for the same reason.
239
+
240
+ - **`room.get_transcript` has no `limit`,** and its consumer on the management
241
+ path is a language model: a cold attach at `since_seq: 0` is the whole log in
242
+ one block. A protocol change deserving a decision record, not a patch inside a
243
+ fix flow.
244
+
245
+ ### Fixed (continued)
246
+
247
+ - **`room append`'s refusal no longer asks you to assert something false.** It
248
+ ended "Pass `--force` if you know it isn't" — but the ordinary way to meet
249
+ that message is a room served by bare `roomyx serve`, which is genuinely live
250
+ and simply has no dispatcher, so there is no second writer to race. The
251
+ registry records that a room serves a path, not whether anything dispatches
252
+ into it, so the message now says what is known and leaves the judgement to
253
+ the operator.
254
+
255
+ [backlog]: docs/roomyx/improvement-backlog.md
256
+
11
257
  ## [0.5.0] — 2026-09-09
12
258
 
13
259
  The security release. Every item here came out of a review of the published
@@ -66,6 +312,19 @@ The security release. Every item here came out of a review of the published
66
312
  did-you-mean, missing and non-numeric values are refused, `--help` exits 0 on
67
313
  stdout, a bad command exits 1 on stderr, and `--` ends flag parsing.
68
314
 
315
+ ### Changed — breaking
316
+
317
+ - **`Enter` filters the stream instead of opening a modal, and the modal is
318
+ gone.** `AgentModal` could not be scrolled, did not compose with search, cost
319
+ a keypress to leave, and was pinned at `top: 2, left: 2` — so, being 70% of
320
+ the terminal wide, it lay across the roster it had been opened from and left
321
+ a selection arrow pointing at a name it had covered.
322
+
323
+ Filtering shows the same data from the transcript the client already has, in
324
+ the pane the reader is already in, and `Esc` clears it. The server's
325
+ `agent.detail` tool is unchanged; the client no longer needs it to answer
326
+ "show me this participant".
327
+
69
328
  ### Removed — breaking
70
329
 
71
330
  - **`roomyx.skills.sync` no longer accepts `targetPath`.** The MCP tool took a
package/README.md CHANGED
@@ -58,11 +58,46 @@ roomyx-client # auto-attaches when exactly one room is live
58
58
  roomyx-client --room r-a1b2c3
59
59
  ```
60
60
 
61
- In the TUI: `↑`/`↓` move through the roster, `Enter` opens the selected agent's
62
- modal, `Esc` closes it, `q` or `Ctrl-C` quits. `o` opens an owner command —
63
- pick `v`eto, `c`onstraint, `a`dd participant or `g`oal edit, type the body,
64
- `Enter` sends. While the prompt is open it owns the keyboard, so a `q` in a
65
- veto is text rather than a quit.
61
+ In the TUI, the transcript owns the arrows and the roster has its own keys:
62
+
63
+ | Key | |
64
+ | --- | --- |
65
+ | `↑` `↓` | scroll the transcript a line |
66
+ | `PgUp` `PgDn` | scroll a page; `Ctrl-U` / `Ctrl-D` a half page |
67
+ | `g` `G` | jump to the top, or back to following the newest message |
68
+ | `j` `k` | move the roster selection |
69
+ | `Enter` | filter the stream to the selected participant; `Esc` clears |
70
+ | `/` | search, then `n` / `N` for next and previous match |
71
+ | `:` | owner command — then `v`eto, `c`onstraint, `a`dd participant or `g`oal edit, type the body, `Enter` sends |
72
+ | `w` | write what is on screen to a file in the working directory |
73
+ | `?` | the full keymap |
74
+ | `q` `Ctrl-C` | quit |
75
+
76
+ Selecting a participant filters the stream where it is rather than opening a
77
+ window over it, so the filter composes with scrolling and with search, and
78
+ leaving it is `Esc` rather than a mode you have to remember you are in. A live
79
+ filter or search is named in the footer — a filter that is on but invisible
80
+ makes a busy room look like a quiet one.
81
+
82
+ `w` exists because a terminal is a bad place to search and a good place to
83
+ read. It never overwrites: the next free numbered name is used, and a filtered
84
+ view gets its own file.
85
+
86
+ The bottom line carries the same keys, so nothing here has to be memorised, and
87
+ next to them the room's liveness: a message count and the age of the newest
88
+ message, or a `DISCONNECTED` that stays put. Scroll away from the bottom and it
89
+ tells you so, and tells you how to get back.
90
+
91
+ While the owner prompt is open it owns the keyboard, so a `q` in a veto is text
92
+ rather than a quit.
93
+
94
+ Below 80 columns the roster gives up its gutter to the transcript and the
95
+ footer carries the participant count instead; widen the terminal and the list
96
+ comes back.
97
+
98
+ Up to 0.5.0 the arrows moved the roster and nothing scrolled at all, `o` opened
99
+ the owner prompt, and `Enter` opened a modal window over the roster. `o` still
100
+ works, so a habit does not break on upgrade, but `:` is the documented key.
66
101
 
67
102
  ## Commands
68
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.5.0",
3
+ "version": "0.6.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/args.ts CHANGED
@@ -98,7 +98,12 @@ export function parseArgs(argv: string[], specs: FlagSpecs): ParsedArgs {
98
98
  continue;
99
99
  }
100
100
 
101
- const spec = specs[name];
101
+ // `specs[name]` resolves through the prototype chain, so `--toString`,
102
+ // `--constructor`, `--valueOf`, `--hasOwnProperty` and `--__proto__` all
103
+ // found a truthy spec, skipped the refusal below, and consumed the next
104
+ // argv token as a value — the module's stated invariant failing for exactly
105
+ // the shape of input it exists to catch.
106
+ const spec = Object.hasOwn(specs, name) ? specs[name] : undefined;
102
107
  if (!spec) {
103
108
  const hint = suggest(name, known);
104
109
  throw new ArgError(
package/src/cli.ts CHANGED
@@ -5,7 +5,9 @@ import { serve } from "./server/serve";
5
5
  import { init } from "./installer/init";
6
6
  import { registerRoom, deregisterRoom, listLiveRooms } from "./installer/registry";
7
7
  import { syncSkill } from "./installer/skill-sync";
8
- import { appendMessage, createRoomLog, parseRoster } from "./log/write";
8
+ import { appendMessage, createRoomLog, LEGAL_KINDS, parseRoster } from "./log/write";
9
+ import { MESSAGE_KINDS } from "./log/schema";
10
+ import type { MessageEnvelope } from "./log/types";
9
11
  import { NAMED_TARGETS, resolveTargets } from "./installer/skill-targets";
10
12
  import { serveManagement } from "./mcp-management/server";
11
13
  import { ArgError, parseArgs, renderFlags } from "./cli/args";
@@ -37,6 +39,37 @@ function bundledSkillPath(): string {
37
39
 
38
40
  const REGISTRY_FLAG = { type: "string", describe: "Registry file (default .roomyx/rooms/registry.json)" } as const;
39
41
 
42
+ /**
43
+ * Runs a long-lived server until a signal, then shuts it down once.
44
+ *
45
+ * Written once because there were three copies and they had drifted: the two
46
+ * here handled SIGINT and SIGTERM and guarded nothing, while the client handled
47
+ * SIGHUP as well and guarded re-entry. So closing a terminal (SIGHUP) killed
48
+ * `roomyx serve` outright, skipping deregistration and leaving a stale registry
49
+ * entry — which a recycled port then resurrects as a live room.
50
+ *
51
+ * `cleanup` runs *after* the close resolves, not before. Deregistering first
52
+ * meant a shutdown that hung — and it hung whenever a client was attached —
53
+ * removed the room from the registry while the process kept running and kept
54
+ * the port. The room became invisible while still being served.
55
+ */
56
+ function runUntilSignal(close: () => Promise<void>, cleanup: () => void = () => undefined): void {
57
+ let shuttingDown = false;
58
+ const shutdown = (): void => {
59
+ if (shuttingDown) return;
60
+ shuttingDown = true;
61
+ void close()
62
+ .catch((error: unknown) => {
63
+ console.error(`shutdown failed: ${error instanceof Error ? error.message : String(error)}`);
64
+ })
65
+ .finally(() => {
66
+ cleanup();
67
+ process.exit(0);
68
+ });
69
+ };
70
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"] as const) process.on(signal, shutdown);
71
+ }
72
+
40
73
  interface Command {
41
74
  usage: string;
42
75
  summary: string;
@@ -88,7 +121,7 @@ const COMMANDS: Record<string, Command> = {
88
121
  usage: "roomyx room append <path> --from <id> --body <text> [flags]",
89
122
  summary: "append a message to a room log",
90
123
  notes:
91
- "Refuses when a live room is serving that log: its dispatcher is the\n single writer (D-01a). --force overrides if you know the room is gone.",
124
+ "Refuses when a live room is serving that log: if that room has a\n dispatcher, the dispatcher is the single writer (D-01a). --force appends\n anyway — a room served by bare `roomyx serve` has no dispatcher to race.",
92
125
  flags: {
93
126
  from: { type: "string", describe: "Required. Participant id" },
94
127
  body: { type: "string", describe: "Required. The message" },
@@ -111,17 +144,41 @@ const COMMANDS: Record<string, Command> = {
111
144
  const registryPath = typeof flags.registry === "string" ? flags.registry : defaultRegistryPath();
112
145
  const serving = (await listLiveRooms(registryPath)).find((room) => room.logPath === absolute);
113
146
  if (serving) {
147
+ // The old wording ended "Pass --force if you know it isn't" — it asked
148
+ // the operator to assert the room is gone. But the common case for
149
+ // reaching this message is a room served by bare `roomyx serve`, where
150
+ // the room is genuinely live and simply has no dispatcher attached, so
151
+ // there is no second writer to race. The flag was the right escape
152
+ // hatch behind a claim that was false exactly when you needed it.
153
+ //
154
+ // roomyx cannot tell the two apart: the registry records that a room
155
+ // serves this path, not whether anything is dispatching into it. So
156
+ // say what is known and let the operator judge, rather than making
157
+ // --force mean something untrue.
114
158
  throw new ArgError(
115
- `A live room (${serving.id}) is serving this log; its dispatcher is the single writer (D-01). Pass --force if you know it isn't.`,
159
+ `A live room (${serving.id}) is serving this log. If it has a dispatcher, that dispatcher is the log's single writer (D-01a) and appending here races it. Pass --force to append anyway.`,
116
160
  );
117
161
  }
118
162
  }
119
163
 
164
+ // Refused here, in the grammar, so the error names the flag the operator
165
+ // typed rather than a field name from the on-disk schema. `appendMessage`
166
+ // validates too — that is the guard that cannot be bypassed — but a
167
+ // message about `--kind` belongs to the CLI that owns the flag.
168
+ const kind = typeof flags.kind === "string" ? flags.kind : undefined;
169
+ if (kind !== undefined && !(MESSAGE_KINDS as readonly string[]).includes(kind)) {
170
+ throw new ArgError(`Unknown --kind "${kind}". Known kinds: ${LEGAL_KINDS}.`);
171
+ }
172
+ const inReplyTo = typeof flags["in-reply-to"] === "number" ? flags["in-reply-to"] : undefined;
173
+ if (inReplyTo !== undefined && (!Number.isInteger(inReplyTo) || inReplyTo < 1)) {
174
+ throw new ArgError(`--in-reply-to must be a whole number of at least 1, not ${inReplyTo}.`);
175
+ }
176
+
120
177
  const message = appendMessage(absolute, {
121
178
  from,
122
179
  body,
123
- kind: typeof flags.kind === "string" ? (flags.kind as never) : undefined,
124
- inReplyTo: typeof flags["in-reply-to"] === "number" ? flags["in-reply-to"] : undefined,
180
+ kind: kind as MessageEnvelope["kind"],
181
+ inReplyTo,
125
182
  });
126
183
  console.log(`Appended seq ${message.seq} from ${message.from}.`);
127
184
  },
@@ -160,12 +217,10 @@ const COMMANDS: Record<string, Command> = {
160
217
  console.log(`roomyx serving ${absoluteLogPath} at ${handle.url}`);
161
218
  console.log(`room ID: ${entry.id} — attach with \`roomyx-client --room ${entry.id}\``);
162
219
 
163
- const shutdown = () => {
164
- deregisterRoom(registryPath, entry.id);
165
- void handle.close().then(() => process.exit(0));
166
- };
167
- process.on("SIGINT", shutdown);
168
- process.on("SIGTERM", shutdown);
220
+ runUntilSignal(
221
+ () => handle.close(),
222
+ () => deregisterRoom(registryPath, entry.id),
223
+ );
169
224
  },
170
225
  },
171
226
 
@@ -228,11 +283,7 @@ const COMMANDS: Record<string, Command> = {
228
283
  console.log(`roomyx mcp listening at ${handle.url}`);
229
284
  console.log("tools: roomyx.rooms.list, roomyx.skills.sync");
230
285
 
231
- const shutdown = () => {
232
- void handle.close().then(() => process.exit(0));
233
- };
234
- process.on("SIGINT", shutdown);
235
- process.on("SIGTERM", shutdown);
286
+ runUntilSignal(() => handle.close());
236
287
  },
237
288
  },
238
289
 
@@ -254,7 +305,9 @@ const COMMANDS: Record<string, Command> = {
254
305
  }
255
306
 
256
307
  const yes = flags.yes === true;
257
- const dryRun = flags["dry-run"] === true || !yes;
308
+ // The gate itself lives in `syncSkill` now, computed once for every
309
+ // surface — this line only forwards what the operator typed.
310
+ const dryRun = flags["dry-run"] === true;
258
311
  const configPath = typeof flags.config === "string" ? flags.config : defaultConfigPath();
259
312
  if (!existsSync(configPath)) {
260
313
  throw new ArgError(`No ${configPath}. Run \`roomyx init\` first.`);
@@ -273,7 +326,12 @@ const COMMANDS: Record<string, Command> = {
273
326
  if (result.written) {
274
327
  console.log(result.backedUpTo ? ` written (backup: ${result.backedUpTo})` : " written");
275
328
  } else {
276
- console.log(dryRun ? " would write (pass --yes to apply)" : " not written");
329
+ // "not written" was the message whenever `dryRun` was false, which
330
+ // after the gate moved into syncSkill meant the ordinary
331
+ // no-flags run reported a bare refusal instead of the sentence that
332
+ // says how to proceed. Branch on why nothing was written, not on
333
+ // which flag was passed.
334
+ console.log(result.wouldWrite ? " would write (pass --yes to apply)" : " not written");
277
335
  }
278
336
  }
279
337
  },
@@ -303,7 +361,7 @@ function topLevelHelp(): string {
303
361
  ].join("\n");
304
362
  }
305
363
 
306
- function commandHelp(name: string, command: Command): string {
364
+ function commandHelp(command: Command): string {
307
365
  const table = renderFlags(command.flags);
308
366
  return [
309
367
  command.usage,
@@ -345,7 +403,7 @@ async function main(): Promise<void> {
345
403
 
346
404
  const parsed = parseArgs(matched.rest, matched.command.flags);
347
405
  if (parsed.help) {
348
- console.log(commandHelp(matched.name, matched.command));
406
+ console.log(commandHelp(matched.command));
349
407
  return;
350
408
  }
351
409
  await matched.command.run(parsed);
@@ -0,0 +1,53 @@
1
+ import { TextRenderable } from "@opentui/core";
2
+ import type { RenderContext } from "@opentui/core";
3
+ import { footerHints } from "../keymap";
4
+
5
+ /**
6
+ * The bottom line: what the room is doing on the left, what your keys are on
7
+ * the right.
8
+ *
9
+ * Two reviewers arrived at this independently and it closes four separate
10
+ * complaints — an empty room that looked hung, a dead room that looked live, a
11
+ * keymap advertised nowhere, and a scroll position with no indicator. It is
12
+ * deliberately one row: the transcript is the product, and a help panel that
13
+ * costs five rows on a 24-row terminal would be paid for by the thing people
14
+ * came to read.
15
+ *
16
+ * The hints come from the keymap rather than from a string written here, so
17
+ * the footer cannot drift from what the keys actually do.
18
+ */
19
+ export class Footer {
20
+ readonly node: TextRenderable;
21
+ private liveness = "";
22
+ private scrollNote: string | null = null;
23
+ private readonly width: number;
24
+
25
+ constructor(ctx: RenderContext, options: { width: number }) {
26
+ this.width = options.width;
27
+ this.node = new TextRenderable(ctx, { content: "", height: 1 });
28
+ this.render();
29
+ }
30
+
31
+ setLiveness(liveness: string): void {
32
+ this.liveness = liveness;
33
+ this.render();
34
+ }
35
+
36
+ /** Set while the reader has scrolled away from the bottom, null at the bottom. */
37
+ setScrollNote(note: string | null): void {
38
+ this.scrollNote = note;
39
+ this.render();
40
+ }
41
+
42
+ private render(): void {
43
+ const left = this.scrollNote === null ? this.liveness : `${this.liveness} · ${this.scrollNote}`;
44
+ // The left half wins the space it needs — knowing the room is dead matters
45
+ // more than being reminded which key quits — but the hints give way one at
46
+ // a time rather than all at once. The first version dropped every hint the
47
+ // moment the line did not fit, which took them away in exactly the two
48
+ // states that most need them: an empty room, and a scrolled one.
49
+ const right = footerHints(Math.max(0, this.width - left.length - 2));
50
+ const gap = this.width - left.length - right.length;
51
+ this.node.content = right === "" || gap < 2 ? left.slice(0, Math.max(0, this.width)) : `${left}${" ".repeat(gap)}${right}`;
52
+ }
53
+ }