@mrciphersmith/roomyx 0.11.2 → 0.11.4

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,77 @@ 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.11.4] — 2026-09-11
17
+
18
+ A patch about not doing things.
19
+
20
+ ### Changed
21
+
22
+ - **A sync that would change nothing does nothing.** `syncSkill` had no
23
+ "already up to date" branch, so every `--yes` rewrote the file with the same
24
+ bytes and left another backup beside it. Run after each release, that is a
25
+ directory of identical copies and a modification time that lies about when the
26
+ skill last changed. It now reports `already in sync`, touches neither the file
27
+ nor a backup, and still adopts the hash — so a copy roomyx did not write but
28
+ that matches what it would have written stops being treated as unrecorded
29
+ content.
30
+ - **One backup, at a fixed name.** `SKILL.md.bak` replaces
31
+ `SKILL.md.bak-<timestamp>`. Nobody reads the fourth-oldest copy of a skill
32
+ file; a backup exists to undo the change that was just made, and combined with
33
+ the branch above it now always holds the last version that actually differed.
34
+ - `SyncResult` gains `upToDate`, so a caller can tell "nothing to do" from a
35
+ refusal. `roomyx init`, `roomyx setup` and `roomyx skills sync` all say which
36
+ one happened.
37
+
38
+ ### Fixed
39
+
40
+ - **`roomyx init` no longer re-derives a rule `syncSkill` owns.** It re-read
41
+ both files and compared them itself to decide whether the staged copy was
42
+ already the bundled skill. The two promptly disagreed: the early return above
43
+ stopped building the warnings `init` was reading to infer that same fact, and
44
+ the adoption path went silent — a moved project would have kept a stale staged
45
+ copy forever. It now asks for the verdict instead of computing a second
46
+ opinion. Caught by an existing test, which is the only reason this is a
47
+ paragraph and not a defect.
48
+
49
+ ## [0.11.3] — 2026-09-11
50
+
51
+ A patch, and a deliberately partial one: it makes a known gap visible instead of
52
+ pretending it is closed.
53
+
54
+ ### Added
55
+
56
+ - **`roomyx room append` says when a live room is serving the log.** One line on
57
+ stderr, naming the room. It does not refuse.
58
+
59
+ 0.11.2 recorded that the D-18 writer guard cannot engage for the agent
60
+ workflow: a dispatcher runs `roomyx serve` and writes with `roomyx room
61
+ append`, a fresh process each time, so it never holds a lease and the room
62
+ never reports a dispatcher. What went unsaid is that `append` had already
63
+ worked out that a room was serving the log — and, when no lease was held,
64
+ threw that away without a word. So every append into a room an agent was
65
+ running looked, from the command line, exactly like an append into an
66
+ unattended file.
67
+
68
+ A note rather than a refusal, because nothing at that point can tell a
69
+ dispatcher from a stranger; refusing would block the legitimate writer, which
70
+ was tried in 0.11.2 and reverted. The log is safe either way — `seq`
71
+ allocation is under a lock and three racing writers are tested. What the note
72
+ protects is the conversation: two dispatchers produce a transcript where every
73
+ message is intact and the discussion is nonsense.
74
+
75
+ It goes to stderr because stdout carries `Appended seq N from X` and is
76
+ parsed. Both facts — that the note appears, and that it stays off stdout — are
77
+ pinned by a test and mutation-checked.
78
+
79
+ ### Still open
80
+
81
+ The underlying decision is unchanged: there are two dispatcher models and only
82
+ the embedder one is expressible. Closing it means a dispatcher identity that
83
+ survives across processes — a token minted at `serve` and carried by every
84
+ `append`, or a lease refreshed by the write itself rather than by a heartbeat.
85
+ Either is a protocol change and wants its own decision record.
86
+
16
87
  ## [0.11.2] — 2026-09-11
17
88
 
18
89
  A patch. The bundled skill had drifted behind the server it drives, and the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/roomyx",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
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
@@ -411,6 +411,32 @@ const COMMANDS: Record<string, Command> = {
411
411
  );
412
412
  }
413
413
 
414
+ // A live room, and no evidence of a writer — say so rather than drop it.
415
+ //
416
+ // `serving` was already computed for the refusal above and, when nothing
417
+ // holds a lease, was silently discarded. That silence is wrong in exactly
418
+ // the case that matters: an agent dispatcher runs `roomyx serve` and
419
+ // writes with `roomyx room append`, a fresh process each time, so it
420
+ // never holds a lease and the room never reports a dispatcher. Every
421
+ // append into a room an agent is running therefore looks, from here, like
422
+ // an append into an unattended log.
423
+ //
424
+ // A note, not a refusal: there is nothing here that can tell a dispatcher
425
+ // from a stranger, so refusing would block the legitimate writer — which
426
+ // was tried and reverted. The log itself is safe either way; `seq`
427
+ // allocation is under a lock and that is tested. What is at risk is the
428
+ // conversation reading as one when it was two, and a line on stderr is
429
+ // what lets a second writer notice before adding to it.
430
+ //
431
+ // stderr, because stdout carries `Appended seq N from X` and is parsed.
432
+ if (serving !== undefined && !writerPresent && !writerWasThere) {
433
+ console.error(
434
+ `Note: room ${serving.id} is serving ${absolute}. Nothing holds the writer lease, so this append is ` +
435
+ `allowed — but roomyx cannot see whether an agent is dispatching that room. If one is, you are writing ` +
436
+ `into a conversation it is also writing into.`,
437
+ );
438
+ }
439
+
414
440
  // Parsed only after the refusal: an operator whose command is going to be
415
441
  // rejected should not be made to pipe a batch in first, and a reader that
416
442
  // blocks on stdin while holding a decision helps nobody.
@@ -777,7 +803,9 @@ const COMMANDS: Record<string, Command> = {
777
803
  });
778
804
  console.log(name === path ? path : `${name}: ${path}`);
779
805
  for (const warning of result.warnings) console.log(` warning: ${warning}`);
780
- if (result.written) {
806
+ if (result.upToDate) {
807
+ console.log(" already in sync — nothing written, no backup made");
808
+ } else if (result.written) {
781
809
  console.log(result.backedUpTo ? ` written (backup: ${result.backedUpTo})` : " written");
782
810
  } else {
783
811
  // "not written" was the message whenever `dryRun` was false, which
@@ -61,6 +61,7 @@ function applyOne(item: PlanItem, context: ApplyContext): string {
61
61
  // they saw the exact path before agreeing to it.
62
62
  yes: true,
63
63
  });
64
+ if (result.upToDate) return "already in sync";
64
65
  if (!result.written) return result.warnings[0] ?? "not written";
65
66
  return result.backedUpTo ? `written (backup: ${result.backedUpTo})` : "written";
66
67
  }
@@ -76,34 +76,32 @@ export function init(options: InitOptions): InitResult {
76
76
 
77
77
  // Asked before writing, so the decision is made from `syncSkill`'s own
78
78
  // verdict rather than from a second copy of its rules here.
79
+ //
80
+ // It *was* a second copy: this function re-read both files and compared them
81
+ // itself to work out whether the staged copy was already the bundled skill.
82
+ // `syncSkill` now answers that directly with `upToDate`, and asking it is the
83
+ // only way the two cannot disagree — which they did, the moment `syncSkill`
84
+ // learned to return early on identical content and stopped building the
85
+ // warnings this code was reading to infer the same fact.
79
86
  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
87
 
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
88
+ if (dryRun.upToDate) {
89
+ // Byte-identical, so there is nothing a refusal could protect. The call
90
+ // records the hash and writes no file: the sync keys its records by
94
91
  // 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.
92
+ // and says so on every run.
97
93
  syncSkill({ ...syncOptions, yes: true });
98
94
  return { created: !registryAlreadyHasRooms, roomyxDir };
99
95
  }
100
96
 
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 });
97
+ if (dryRun.warnings.length > 0) {
98
+ // Ours to refresh only while it is still ours. A hand-edited or unrecorded
99
+ // staged copy is left exactly as it is, and the caller is told why — the
100
+ // silence was the defect, not the staleness.
101
+ return { created: !registryAlreadyHasRooms, roomyxDir, skillWarnings: dryRun.warnings };
106
102
  }
107
103
 
104
+ syncSkill({ ...syncOptions, yes: true });
105
+
108
106
  return { created: !registryAlreadyHasRooms, roomyxDir };
109
107
  }
@@ -17,6 +17,13 @@ export interface SyncResult {
17
17
  written: boolean;
18
18
  backedUpTo: string | null;
19
19
  warnings: string[];
20
+ /**
21
+ * The target already holds exactly the bundled content, so there was nothing
22
+ * to do. Distinct from `written: false`, which also covers a refusal — a
23
+ * caller that cannot tell them apart prints "not written" at someone whose
24
+ * file is perfectly up to date.
25
+ */
26
+ upToDate: boolean;
20
27
  }
21
28
 
22
29
  function hashOf(content: string): string {
@@ -50,6 +57,28 @@ export function syncSkill(options: SyncOptions): SyncResult {
50
57
 
51
58
  const targetExists = existsSync(options.targetPath);
52
59
  const targetContent = targetExists ? readFileSync(options.targetPath, "utf8") : null;
60
+
61
+ // Byte-identical: do nothing, and say so.
62
+ //
63
+ // There was no such branch, so every `--yes` rewrote the file and left another
64
+ // `.bak-<timestamp>` beside it even when not one character differed. Run on a
65
+ // schedule, or after each release, that is a directory of identical backups
66
+ // and a modification time that lies about when the skill last changed.
67
+ //
68
+ // The hash is still adopted, so a file roomyx did not write but that matches
69
+ // what it would have written stops being "unrecorded content" — the next real
70
+ // update then proceeds without a warning about hand edits that do not exist.
71
+ // Adopted only under `yes`, because the CLI promises that without it nothing
72
+ // is written, and the config is a file.
73
+ if (targetContent === bundledContent) {
74
+ if (options.dryRun !== true && options.yes === true && lastSyncedHash !== hashOf(bundledContent)) {
75
+ writeConfig(options.configPath, {
76
+ ...config,
77
+ lastSyncedHashes: { ...config.lastSyncedHashes, [options.targetPath]: hashOf(bundledContent) },
78
+ });
79
+ }
80
+ return { wouldWrite: false, written: false, backedUpTo: null, warnings: [], upToDate: true };
81
+ }
53
82
  // Two distinct "don't touch this blindly" cases, both requiring --yes:
54
83
  // (a) we synced before and the target has since been hand-edited, or
55
84
  // (b) the target already existed with content we have no record of ever
@@ -83,12 +112,19 @@ export function syncSkill(options: SyncOptions): SyncResult {
83
112
  // subsumed: nothing reaches here without `yes: true`. The warnings above are
84
113
  // still built, so a refusal still says which target had unrecorded content.
85
114
  if (options.dryRun === true || options.yes !== true) {
86
- return { wouldWrite: true, written: false, backedUpTo: null, warnings };
115
+ return { wouldWrite: true, written: false, backedUpTo: null, warnings, upToDate: false };
87
116
  }
88
117
 
118
+ // ONE backup, at a fixed name, replaced each time.
119
+ //
120
+ // It used to be `.bak-<timestamp>`, which kept every version forever. Nobody
121
+ // reads the fourth-oldest copy of a skill file; what a backup is for is
122
+ // undoing the change that was just made. Combined with the identical-content
123
+ // branch above, this file now always holds the last version that actually
124
+ // differed — a no-op sync does not touch it.
89
125
  let backedUpTo: string | null = null;
90
126
  if (targetExists) {
91
- backedUpTo = `${options.targetPath}.bak-${new Date().toISOString().replace(/[:.]/g, "-")}`;
127
+ backedUpTo = `${options.targetPath}.bak`;
92
128
  copyFileSync(options.targetPath, backedUpTo);
93
129
  }
94
130
 
@@ -103,5 +139,5 @@ export function syncSkill(options: SyncOptions): SyncResult {
103
139
  lastSyncedHashes: { ...config.lastSyncedHashes, [options.targetPath]: hashOf(bundledContent) },
104
140
  });
105
141
 
106
- return { wouldWrite: true, written: true, backedUpTo, warnings };
142
+ return { wouldWrite: true, written: true, backedUpTo, warnings, upToDate: false };
107
143
  }