@mrciphersmith/roomyx 0.8.1 → 0.9.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,76 @@ 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.9.0] — 2026-09-10
17
+
18
+ A minor, because it is breaking: `room.get_transcript` returns an object where it
19
+ returned a bare array. In `0.x` the minor position is the breaking position
20
+ (D-13).
21
+
22
+ ### Changed
23
+
24
+ - **`room.get_transcript` pages, and says whether it paged.** The response is now
25
+ `{ messages, has_more, next_seq }`. A cold attach at `since_seq: 0` used to ship
26
+ the entire transcript as one text block — 3.8 MB in the room the backlog
27
+ measured — and the consumer on the management path is a language model, so that
28
+ is not slow CPU, it is a context window. Pass `next_seq` back as `since_seq` to
29
+ continue.
30
+ - **The default is bounded (200).** An opt-in limit would have left every
31
+ existing caller shipping the whole room, which is the caller the problem was
32
+ measured on. A bare array could not express "there is more", and a truncated
33
+ list that looks complete is the defect this project keeps re-filing — hence the
34
+ object rather than a silent cap.
35
+ - **`roomyx-client` reads the page and its cursor.** The polling loop takes
36
+ `next_seq` from the response instead of computing `max` over what arrived: the
37
+ server knows which messages it actually sent, and a bounded page means "the
38
+ last seq I received" and "the cursor" are the same number only by luck.
39
+
40
+ ### Fixed
41
+
42
+ - **The status bar shows the goal's threshold.** The room is goal-driven and its
43
+ goal is a number to cross; the line carried the goal statement and not the
44
+ number, so a reader could not tell how close the room was. A goal that states
45
+ no threshold gets no invented one.
46
+ - **Over-long status lines are clipped with a marker instead of cut by the pane
47
+ edge.** With `wrapMode: "none"` on a `height: 1` row, a truncated goal read as
48
+ a short goal — and an owner command's answer stopped mid-word: a real veto
49
+ against a dispatcher-less room ended at "…the command. A". Both the goal line
50
+ and a notice now end with the client's own `…` marker.
51
+
52
+ ## [0.8.2] — 2026-09-10
53
+
54
+ A patch. Closes the backlog's S3 and corrects two documents that described a
55
+ package this is not.
56
+
57
+ ### Fixed
58
+
59
+ - **The staged skill is synced, not copied once.** `roomyx init` copied
60
+ `.roomyx/skills/startup-room/SKILL.md` when it was absent and did nothing when
61
+ it was present, so after a package upgrade the staged copy kept the old text
62
+ forever — no hash, no backup, no warning. Guarded with `existsSync` it had
63
+ stopped clobbering hand edits and started going stale silently instead. It now
64
+ goes through `syncSkill`: the copy is refreshed when it is still ours,
65
+ left exactly as it is when it has been hand-edited or was never recorded, and
66
+ in that case `init` says so instead of staying quiet. A re-run that changes
67
+ nothing writes nothing — a backup of an identical file once per run would bury
68
+ the backups that matter.
69
+
70
+ ### Changed
71
+
72
+ - **`docs/roomyx/improvement-backlog.md` no longer prescribes `--force`.** Its
73
+ R3 definition of done still read "`--force` overrides", describing a flag
74
+ 0.8.0 removed. An amendment records what the refusal actually depends on now
75
+ — `dispatcherAttached`, the writer lease, and `--take-over` for a writer that
76
+ is provably gone — and marks the old sentence as history rather than
77
+ instruction. The backlog is the document an implementer works from.
78
+ - **`room.post_owner_command` is documented as implemented *and unreachable for
79
+ the consumer it was designed for*.** Both files now say it: the tool is
80
+ registered, tested and answers correctly, and its handler is a JS function
81
+ that the orchestrator spawning `serve` as a child process cannot attach, so a
82
+ bare `roomyx serve` answers `accepted: false`. "Implemented" without that
83
+ distinction reads as "this works for you", which is the misreading a status
84
+ field exists to prevent. D-18 item 6 closes the gap.
85
+
16
86
  ## [0.8.1] — 2026-09-10
17
87
 
18
88
  A patch. Found by triaging the action list against the code: this defect had
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.8.1",
3
+ "version": "0.9.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.ts CHANGED
@@ -234,6 +234,12 @@ const COMMANDS: Record<string, Command> = {
234
234
  const cwd = process.cwd();
235
235
  const result = init({ cwd, bundledSkillPath: bundledSkillPath() });
236
236
  console.log(result.created ? `Created ${result.roomyxDir}` : `${result.roomyxDir} already initialized`);
237
+ for (const warning of result.skillWarnings ?? []) {
238
+ // Said out loud rather than swallowed: the staged copy is now known to
239
+ // differ from the bundled skill, and whoever sees this decides what to
240
+ // do about it.
241
+ console.log(` ! ${warning}`);
242
+ }
237
243
 
238
244
  const { buildPlan, selectedItems } = await import("./installer/init-plan");
239
245
  const { applyPlan } = await import("./installer/init-apply");
@@ -1,5 +1,6 @@
1
1
  import { TextRenderable } from "@opentui/core";
2
2
  import type { RenderContext } from "@opentui/core";
3
+ import { clip } from "../clip";
3
4
  import type { ConnectionStatus } from "../mcp-client";
4
5
  import type { GoalContract } from "../../log/types";
5
6
 
@@ -15,11 +16,15 @@ export type DisplayStatus = ConnectionStatus | "closed";
15
16
  export class StatusBar {
16
17
  readonly node: TextRenderable;
17
18
  private goalStatement = "";
19
+ /** The number the room exists to cross. Empty when the goal states none. */
20
+ private threshold = "";
18
21
  private status: DisplayStatus = "connecting";
22
+ private readonly width: number;
19
23
  /** Takes over the line while an owner command is being composed or answered. */
20
24
  private notice: string | null = null;
21
25
 
22
- constructor(ctx: RenderContext) {
26
+ constructor(ctx: RenderContext, options: { width: number }) {
27
+ this.width = options.width;
23
28
  // Same reason as the roster rows: with the default word wrapping, an
24
29
  // over-long line went to a second row that `height: 1` clipped, taking the
25
30
  // whole trailing word with it. This line carries the goal statement and
@@ -30,6 +35,12 @@ export class StatusBar {
30
35
 
31
36
  setGoalContract(goal: GoalContract): void {
32
37
  this.goalStatement = goal.goal_statement;
38
+ // R12: the room is goal-driven, and the goal is a number to cross. Showing
39
+ // the statement without the number left the reader unable to tell how close
40
+ // the room was, in the one line that has room to say it. A goal that states
41
+ // no threshold gets no invented one.
42
+ this.threshold =
43
+ goal.threshold.pass_at_or_above > 0 ? ` · pass ≥${goal.threshold.pass_at_or_above}` : "";
33
44
  this.render();
34
45
  }
35
46
 
@@ -45,8 +56,13 @@ export class StatusBar {
45
56
  }
46
57
 
47
58
  private render(): void {
59
+ // Clipped rather than cut by the pane edge. `wrapMode: "none"` on a
60
+ // `height: 1` row means anything longer vanished mid-word with nothing to
61
+ // say it had been cut — a truncated goal read as a short goal, and a real
62
+ // vet o's refusal stopped at "…the command. A" (R12, widened 2026-09-09).
63
+ // The client's own cutter is used rather than a second one written here.
48
64
  if (this.notice !== null) {
49
- this.node.content = this.notice;
65
+ this.node.content = clip(this.notice, this.width);
50
66
  return;
51
67
  }
52
68
  const statusLabel = {
@@ -55,6 +71,6 @@ export class StatusBar {
55
71
  disconnected: "disconnected — retrying",
56
72
  closed: "closed",
57
73
  }[this.status];
58
- this.node.content = `[${statusLabel}] ${this.goalStatement}`;
74
+ this.node.content = clip(`[${statusLabel}] ${this.goalStatement}${this.threshold}`, this.width);
59
75
  }
60
76
  }
@@ -1,6 +1,7 @@
1
1
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
3
3
  import type { MessageEnvelope, RoomState } from "../log/types";
4
+ import type { TranscriptPage } from "../server/tools/get-transcript";
4
5
 
5
6
  export type ConnectionStatus = "connecting" | "connected" | "disconnected";
6
7
 
@@ -244,12 +245,19 @@ export class RoomClient {
244
245
  const again = () => {
245
246
  this.transcriptTimer = setTimeout(() => this.pollTranscript(generation), this.transcriptIntervalMs);
246
247
  };
247
- this.callTool<MessageEnvelope[]>("room.get_transcript", { since_seq: this.sinceSeq })
248
- .then((messages) => {
248
+ // No `limit`: the poll asks for what has arrived since the last one, which is
249
+ // normally nothing to a couple of messages. The server's default only
250
+ // matters to a caller doing a cold attach, and it pages there.
251
+ this.callTool<TranscriptPage>("room.get_transcript", { since_seq: this.sinceSeq })
252
+ .then((page) => {
249
253
  if (this.isStale(generation)) return;
250
- if (messages.length > 0) {
251
- this.sinceSeq = Math.max(this.sinceSeq, ...messages.map((m) => m.seq));
252
- this.events.onNewMessages?.(messages);
254
+ if (page.messages.length > 0) {
255
+ // The cursor comes from the page rather than from `max` of what arrived:
256
+ // the server knows which messages it actually sent, and a page is
257
+ // bounded, so "the last seq I received" and "the cursor" are the same
258
+ // number only by luck.
259
+ this.sinceSeq = Math.max(this.sinceSeq, page.next_seq);
260
+ this.events.onNewMessages?.(page.messages);
253
261
  }
254
262
  again();
255
263
  })
@@ -58,7 +58,7 @@ export class ChatView {
58
58
  ) {
59
59
  this.ctx = ctx;
60
60
  this.node = new BoxRenderable(ctx, { width: options.width, height: options.height, flexDirection: "column" });
61
- this.statusBar = new StatusBar(ctx);
61
+ this.statusBar = new StatusBar(ctx, { width: options.width });
62
62
  this.node.add(this.statusBar.node);
63
63
 
64
64
  const body = new BoxRenderable(ctx, { flexDirection: "row", flexGrow: 1 });
@@ -1,5 +1,6 @@
1
- import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
+ import { syncSkill } from "./skill-sync";
3
4
 
4
5
  export interface InitOptions {
5
6
  cwd: string;
@@ -14,6 +15,11 @@ export interface InitResult {
14
15
  */
15
16
  created: boolean;
16
17
  roomyxDir: string;
18
+ /**
19
+ * Why the staged skill was left as it was, when it was. Empty or absent means
20
+ * the sync had nothing to report — not that it did nothing.
21
+ */
22
+ skillWarnings?: string[];
17
23
  }
18
24
 
19
25
  const DEFAULT_CONFIG = {
@@ -45,13 +51,59 @@ export function init(options: InitOptions): InitResult {
45
51
  if (!existsSync(registryPath)) {
46
52
  writeFileSync(registryPath, JSON.stringify({ schemaVersion: 1, rooms: [] }, null, 2));
47
53
  }
48
- // Guarded like the config and the registry beside it. This copy used to be
54
+ // Staged through `syncSkill`, not copied.
55
+ //
56
+ // Three defects lived in the two lines this replaces. The copy was
49
57
  // unconditional — no hash check, no backup, no gate — which is the operation
50
- // `syncSkill` refuses outright, while this function's own comment promises
51
- // "explicit, never-clobbering". Re-running `roomyx init` silently discarded
52
- // hand edits to the staged copy.
58
+ // `syncSkill` refuses outright, while the comment above promises "explicit,
59
+ // never-clobbering": a second `roomyx init` silently discarded hand edits to
60
+ // the staged copy. Guarding it with `existsSync` fixed the clobber and created
61
+ // the opposite one: after a package upgrade the staged copy kept the old text
62
+ // forever, silently. And `.roomyx/skills/` is read by nothing (`skills sync`
63
+ // reads the bundled copy straight from the package), so a stale file there is
64
+ // pure misinformation — it looks like the skill the project uses.
65
+ //
66
+ // `syncSkill` is what this wanted all along: a recorded hash per target, a
67
+ // backup before any overwrite, and a refusal that says which target it is
68
+ // refusing. `init` supplies `yes` itself, because the gate below is about
69
+ // *when* to write, and the operator's consent to scaffolding was the command.
53
70
  const stagedSkill = join(skillDir, "SKILL.md");
54
- if (!existsSync(stagedSkill)) copyFileSync(options.bundledSkillPath, stagedSkill);
71
+ const syncOptions = {
72
+ bundledSkillPath: options.bundledSkillPath,
73
+ targetPath: stagedSkill,
74
+ configPath,
75
+ };
76
+
77
+ // Asked before writing, so the decision is made from `syncSkill`'s own
78
+ // verdict rather than from a second copy of its rules here.
79
+ const dryRun = syncSkill({ ...syncOptions, dryRun: true });
80
+ const bundledContent = readFileSync(options.bundledSkillPath, "utf8");
81
+ const stagedContent = existsSync(stagedSkill) ? readFileSync(stagedSkill, "utf8") : null;
82
+ const identical = stagedContent === bundledContent;
83
+
84
+ if (dryRun.warnings.length > 0 && !identical) {
85
+ // Ours to refresh only while it is still ours. A hand-edited or unrecorded
86
+ // staged copy is left exactly as it is, and the caller is told why — the
87
+ // silence was the defect, not the staleness.
88
+ return { created: !registryAlreadyHasRooms, roomyxDir, skillWarnings: dryRun.warnings };
89
+ }
90
+ if (dryRun.warnings.length > 0 && identical) {
91
+ // The refusal protects content, and byte-identical content cannot be lost —
92
+ // so there is nothing to refuse. Writing here is what records the hash, and
93
+ // the hash is what the next real upgrade needs: the sync keys its records by
94
+ // absolute path, so a moved project otherwise keeps this copy stale forever
95
+ // and says so on every run. One adoption, one backup, and refreshes work
96
+ // again.
97
+ syncSkill({ ...syncOptions, yes: true });
98
+ return { created: !registryAlreadyHasRooms, roomyxDir };
99
+ }
100
+
101
+ if (!identical) {
102
+ // Only when there is a difference: a write with identical content still
103
+ // takes a timestamped backup, so a no-op `init` would fill the directory
104
+ // with copies of the same file and make a real backup impossible to find.
105
+ syncSkill({ ...syncOptions, yes: true });
106
+ }
55
107
 
56
108
  return { created: !registryAlreadyHasRooms, roomyxDir };
57
109
  }
@@ -67,11 +67,26 @@ export function createRoomMcpServer(logPath: string, options: RoomMcpServerOptio
67
67
  "room.get_transcript",
68
68
  {
69
69
  title: "Room transcript delta",
70
- description: "Messages with seq greater than since_seq, in order.",
71
- inputSchema: { since_seq: z.number().int().min(0) },
70
+ description:
71
+ "Messages with seq greater than since_seq, in order — at most `limit` of them. " +
72
+ "The result carries has_more and next_seq so a page can be told from a complete answer: " +
73
+ "pass next_seq back as since_seq to continue.",
74
+ inputSchema: {
75
+ since_seq: z.number().int().min(0),
76
+ limit: z.number().int().min(0).optional(),
77
+ },
72
78
  },
73
- async ({ since_seq }) => ({
74
- content: [{ type: "text", text: JSON.stringify(getTranscriptTool(logPath, since_seq)) }],
79
+ async ({ since_seq, limit }) => ({
80
+ content: [
81
+ {
82
+ type: "text",
83
+ text: JSON.stringify(
84
+ limit === undefined
85
+ ? getTranscriptTool(logPath, since_seq)
86
+ : getTranscriptTool(logPath, since_seq, limit),
87
+ ),
88
+ },
89
+ ],
75
90
  }),
76
91
  );
77
92
 
@@ -1,8 +1,53 @@
1
1
  import { getTranscript, loadRoomLog } from "../../log/store";
2
2
  import type { MessageEnvelope } from "../../log/types";
3
3
 
4
- /** MCP tool `room.get_transcript`: messages with seq > sinceSeq. Read-only. */
5
- export function getTranscriptTool(logPath: string, sinceSeq: number): MessageEnvelope[] {
4
+ /**
5
+ * How many messages `room.get_transcript` returns when the caller does not say.
6
+ *
7
+ * There has to be a default, and this is the reason: the caller that existed
8
+ * before this parameter did was passing only `since_seq`, and a cold attach at
9
+ * `since_seq: 0` shipped the entire transcript as one text block — 3.8 MB in the
10
+ * room the backlog measured. The consumer on the management path is a language
11
+ * model, so that is not slow CPU, it is a context window. An opt-in limit would
12
+ * leave every existing caller shipping the whole room.
13
+ *
14
+ * 200 is a page a model can read in one go and a page the TUI never notices: it
15
+ * polls once a second with a cursor, so it is only ever asking for what has
16
+ * arrived since the last poll.
17
+ */
18
+ export const DEFAULT_TRANSCRIPT_LIMIT = 200;
19
+
20
+ /**
21
+ * A page of the transcript, with the two facts a caller needs to know whether
22
+ * it has the whole answer.
23
+ *
24
+ * It used to be a bare array, which cannot express "there is more" — and a
25
+ * truncated list that looks complete is exactly the defect this project keeps
26
+ * re-filing. `has_more` says whether another call will return anything, and
27
+ * `next_seq` is the cursor to pass as `since_seq` for it, so the caller does not
28
+ * re-derive the cursor from whichever message happened to arrive last.
29
+ */
30
+ export interface TranscriptPage {
31
+ messages: MessageEnvelope[];
32
+ has_more: boolean;
33
+ next_seq: number;
34
+ }
35
+
36
+ /** MCP tool `room.get_transcript`: messages with seq > sinceSeq, at most `limit`. Read-only. */
37
+ export function getTranscriptTool(
38
+ logPath: string,
39
+ sinceSeq: number,
40
+ limit: number = DEFAULT_TRANSCRIPT_LIMIT,
41
+ ): TranscriptPage {
6
42
  const { messages } = loadRoomLog(logPath);
7
- return getTranscript(messages, sinceSeq);
43
+ const after = getTranscript(messages, sinceSeq);
44
+ const page = after.slice(0, Math.max(0, limit));
45
+ return {
46
+ messages: page,
47
+ has_more: after.length > page.length,
48
+ // The cursor advances only over messages actually returned. Advancing it to
49
+ // the last message in the *log* would skip everything the page did not
50
+ // carry, and the log is append-only: nothing would ever fetch it again.
51
+ next_seq: page.length > 0 ? (page[page.length - 1] as MessageEnvelope).seq : sinceSeq,
52
+ };
8
53
  }