@mrciphersmith/roomyx 0.1.0 → 0.2.1
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/README.md +180 -19
- package/package.json +3 -2
- package/src/cli.ts +8 -5
- package/src/client/index.ts +4 -1
- package/src/installer/registry.ts +33 -4
- package/src/installer/resolve-connection.ts +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,163 @@
|
|
|
1
1
|
# roomyx
|
|
2
2
|
|
|
3
|
-
MCP server
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
An MCP server and terminal UI for `startup-room`: it reads a room's append-only log and exposes what's happening in it — roster,
|
|
4
|
+
goal contract, transcript, per-agent detail — both to MCP clients as tools and
|
|
5
|
+
to a human as a live TUI. It also ships a room registry, so several rooms can
|
|
6
|
+
run at once and be found by id, and a skill-sync path that installs the bundled
|
|
7
|
+
`startup-room` skill into a project without ever silently overwriting local
|
|
8
|
+
edits.
|
|
9
|
+
|
|
10
|
+
roomyx is **read-only** with respect to a room log. Nothing here writes messages
|
|
11
|
+
into a room; the write path (`room.post_owner_command`) lives in the
|
|
12
|
+
`startup-room` framework, not in this package.
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
**[Bun](https://bun.sh) 1.1 or newer must be on your `PATH`.** Both binaries are
|
|
17
|
+
shipped as TypeScript with a `#!/usr/bin/env bun` shebang and are executed by
|
|
18
|
+
Bun directly — there is no compiled or transpiled build step. Installing with
|
|
19
|
+
npm works fine, but the commands will not run on a machine that has only Node.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @mrciphersmith/roomyx
|
|
25
|
+
# or
|
|
26
|
+
bun install -g @mrciphersmith/roomyx
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick start
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd your-project
|
|
33
|
+
roomyx init # scaffold .roomyx/
|
|
34
|
+
roomyx serve path/to/room.jsonl # serve one room log over MCP
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`serve` prints the room's URL and its generated id:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
roomyx serving path/to/room.jsonl at http://127.0.0.1:4319/mcp
|
|
41
|
+
room ID: r-a1b2c3 — attach with `roomyx-client --room r-a1b2c3`
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then, in a second terminal, attach the TUI:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
roomyx-client # auto-attaches when exactly one room is live
|
|
48
|
+
roomyx-client --room r-a1b2c3
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
In the TUI: `↑`/`↓` move through the roster, `Enter` opens the selected agent's
|
|
52
|
+
modal, `Esc` closes it, `q` or `Ctrl-C` quits.
|
|
53
|
+
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
The orchestrator and the TUI are **separate binaries on purpose** — they are
|
|
57
|
+
independent processes, and making the TUI a subcommand of `roomyx` would tie
|
|
58
|
+
their lifetimes together. That is why it is `roomyx-client`, with a hyphen, and
|
|
59
|
+
not `roomyx client`.
|
|
60
|
+
|
|
61
|
+
### `roomyx init`
|
|
62
|
+
|
|
63
|
+
Creates `.roomyx/` in the current directory: `config.json`, an empty room
|
|
64
|
+
registry, and a staged copy of the bundled `startup-room` skill. It never
|
|
65
|
+
clobbers a registry that already has rooms in it, and never overwrites an
|
|
66
|
+
existing `config.json`.
|
|
67
|
+
|
|
68
|
+
### `roomyx serve <logPath> [flags]`
|
|
69
|
+
|
|
70
|
+
Serves one room log as an MCP server over StreamableHTTP, and registers the room
|
|
71
|
+
in the local registry for the duration of the process. On `SIGINT`/`SIGTERM` it
|
|
72
|
+
deregisters itself and shuts down cleanly.
|
|
73
|
+
|
|
74
|
+
| Flag | Default | Meaning |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| `--port <n>` | `4319` | Listen port. `0` picks an ephemeral one. |
|
|
77
|
+
| `--host <addr>` | `127.0.0.1` | Bind address. |
|
|
78
|
+
| `--acknowledge-non-loopback` | off | Required to bind anything other than loopback. Without it, a non-loopback `--host` is refused. |
|
|
79
|
+
| `--registry <path>` | `.roomyx/rooms/registry.json` | Registry file to register into. |
|
|
80
|
+
|
|
81
|
+
Multiple independent MCP client sessions against one `serve` process are
|
|
82
|
+
supported: each new session gets its own transport and server instance, keyed by
|
|
83
|
+
`mcp-session-id`.
|
|
84
|
+
|
|
85
|
+
### `roomyx rooms list`
|
|
86
|
+
|
|
87
|
+
Lists rooms that are **confirmed live**, not merely present in the registry —
|
|
88
|
+
each entry is verified with a real MCP round-trip, and entries that don't answer
|
|
89
|
+
are pruned from the registry file as a side effect.
|
|
90
|
+
|
|
91
|
+
### `roomyx-client [flags]`
|
|
92
|
+
|
|
93
|
+
The terminal UI.
|
|
94
|
+
|
|
95
|
+
| Flag | Meaning |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `--room <id>` | Attach to a specific live room by id. |
|
|
98
|
+
| `--connect <url>` | Attach to an explicit MCP URL. Wins outright; the registry is not consulted. |
|
|
99
|
+
| `--registry <path>` | Registry file to resolve rooms from. |
|
|
100
|
+
|
|
101
|
+
With no flags it auto-attaches when exactly one room is live, and refuses with a
|
|
102
|
+
list of candidate ids when more than one is.
|
|
103
|
+
|
|
104
|
+
## MCP tools
|
|
105
|
+
|
|
106
|
+
### Per-room server — `roomyx serve`
|
|
107
|
+
|
|
108
|
+
| Tool | Input | Returns |
|
|
109
|
+
| --- | --- | --- |
|
|
110
|
+
| `room.get_state` | — | Roster and current goal contract. |
|
|
111
|
+
| `room.get_transcript` | `since_seq: number` | Messages with `seq` greater than `since_seq`, in order. |
|
|
112
|
+
| `room.get_agent_detail` | `agent_id: string` | One participant's own messages and last-seen status. |
|
|
113
|
+
|
|
114
|
+
### Management server
|
|
115
|
+
|
|
116
|
+
A second, standalone MCP server exposing the installer surface — room listing
|
|
117
|
+
and skill-sync — to any MCP client.
|
|
118
|
+
|
|
119
|
+
| Tool | Input | Returns |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `roomyx.rooms.list` | — | Live, liveness-checked rooms. |
|
|
122
|
+
| `roomyx.skills.sync` | `targetPath: string`, `dryRun?: boolean`, `yes?: boolean` | Sync outcome: whether it would write, whether it did, and where the backup went. |
|
|
123
|
+
|
|
124
|
+
This server currently has **no CLI command** — it is exposed as a library entry
|
|
125
|
+
point (`serveManagement` in `src/mcp-management/server.ts`) for embedding hosts
|
|
126
|
+
to bind.
|
|
127
|
+
|
|
128
|
+
## Skill sync safety
|
|
129
|
+
|
|
130
|
+
`roomyx.skills.sync` will not silently discard local work. It refuses to write,
|
|
131
|
+
and returns a warning instead, in two cases — unless `yes: true` is passed:
|
|
132
|
+
|
|
133
|
+
- the target has changed since roomyx last synced it (hand-edited), or
|
|
134
|
+
- the target already exists but roomyx has **no record of ever having written
|
|
135
|
+
it**, so its content is not roomyx's to overwrite.
|
|
136
|
+
|
|
137
|
+
When it does write, it first copies the previous content to a timestamped
|
|
138
|
+
`.bak-<iso>` file alongside the target, and records the new content's hash in
|
|
139
|
+
`.roomyx/config.json` under `lastSyncedHashes`.
|
|
140
|
+
|
|
141
|
+
## On-disk layout
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
.roomyx/
|
|
145
|
+
├── config.json # schemaVersion, defaultPort, roomLogDir, lastSyncedHashes
|
|
146
|
+
├── rooms/
|
|
147
|
+
│ └── registry.json # live room registry
|
|
148
|
+
└── skills/
|
|
149
|
+
└── startup-room/SKILL.md # staged copy of the bundled skill
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`config.json`'s `roomLogDir` (default `.roomyx/rooms/logs`) is a convention for
|
|
153
|
+
where room logs are expected to live; `init` records it but does not create the
|
|
154
|
+
directory, and `serve` takes whatever path you hand it.
|
|
155
|
+
|
|
156
|
+
The registry is written under an exclusive lockfile and replaced by
|
|
157
|
+
write-to-temp-then-rename, so concurrent `serve` processes can't lose each
|
|
158
|
+
other's registrations or be read mid-write. A lock whose holder crashed is
|
|
159
|
+
reclaimed after 30 seconds, and a release only unlinks the lockfile when it
|
|
160
|
+
still holds the token that call wrote.
|
|
10
161
|
|
|
11
162
|
## Room log format (JSONL)
|
|
12
163
|
|
|
@@ -27,21 +178,31 @@ record; every subsequent line is a `message` record.
|
|
|
27
178
|
- `roster` entries are `{ id, name }` — `id` is what `room.get_agent_detail`
|
|
28
179
|
takes as `agent_id`; `name` is the display name used in `from`.
|
|
29
180
|
|
|
30
|
-
This format is this package's own design choice
|
|
31
|
-
Schema
|
|
32
|
-
|
|
181
|
+
This format is this package's own design choice, not dictated by either JSON
|
|
182
|
+
Schema: the specification defers the on-disk representation to implementation,
|
|
183
|
+
and the schemas describe one message and one goal contract, not the log file as
|
|
184
|
+
a whole. It is documented here because the tests in this package assume it.
|
|
33
185
|
|
|
34
|
-
##
|
|
186
|
+
## Development
|
|
35
187
|
|
|
36
188
|
```bash
|
|
37
|
-
|
|
189
|
+
bun install
|
|
190
|
+
bun run check # lint + typecheck + test
|
|
38
191
|
```
|
|
39
192
|
|
|
40
|
-
|
|
193
|
+
Releases are cut by pushing a `v*` tag whose version matches `package.json`; the
|
|
194
|
+
release workflow verifies, packs, smoke-tests, and publishes to npm with
|
|
195
|
+
provenance via trusted publishing.
|
|
41
196
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
197
|
+
## Further reading
|
|
198
|
+
|
|
199
|
+
Full architecture and the reasoning behind each decision:
|
|
200
|
+
|
|
201
|
+
- [`docs/roomyx/specification.md`](https://github.com/MrCipherSmith/roomyx/blob/main/docs/roomyx/specification.md)
|
|
202
|
+
and [`docs/roomyx/decisions.md`](https://github.com/MrCipherSmith/roomyx/blob/main/docs/roomyx/decisions.md)
|
|
203
|
+
- [`docs/roomyx-installer/specification.md`](https://github.com/MrCipherSmith/roomyx/blob/main/docs/roomyx-installer/specification.md)
|
|
204
|
+
and [`docs/roomyx-installer/decisions.md`](https://github.com/MrCipherSmith/roomyx/blob/main/docs/roomyx-installer/decisions.md)
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/roomyx",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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"
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"cli"
|
|
24
24
|
],
|
|
25
25
|
"bin": {
|
|
26
|
-
"roomyx": "./src/cli.ts"
|
|
26
|
+
"roomyx": "./src/cli.ts",
|
|
27
|
+
"roomyx-client": "./src/client/index.ts"
|
|
27
28
|
},
|
|
28
29
|
"files": [
|
|
29
30
|
"src",
|
package/src/cli.ts
CHANGED
|
@@ -6,10 +6,12 @@ import { registerRoom, deregisterRoom, listLiveRooms } from "./installer/registr
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* `roomyx init` / `roomyx serve <logPath> [...]` / `roomyx rooms list`.
|
|
9
|
-
* `roomyx
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* The TUI is `roomyx-client`, its own binary over src/client/index.ts — the
|
|
10
|
+
* orchestrator and the TUI are independent processes by design (decisions.md
|
|
11
|
+
* D-06), so they are separate binaries, not subcommands of one process that
|
|
12
|
+
* would tie their lifetimes together. Hence the hyphen: `roomyx client`
|
|
13
|
+
* would have to be dispatched from here, which is exactly the coupling D-06
|
|
14
|
+
* rules out.
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
17
|
function parseFlags(args: string[]): Record<string, string | boolean> {
|
|
@@ -56,7 +58,7 @@ async function runServe(logPath: string | undefined, rest: string[]): Promise<vo
|
|
|
56
58
|
const entry = registerRoom(registryPath, { port: handle.port, logPath, pid: process.pid });
|
|
57
59
|
|
|
58
60
|
console.log(`roomyx serving ${logPath} at ${handle.url}`);
|
|
59
|
-
console.log(`room ID: ${entry.id} — attach with \`roomyx
|
|
61
|
+
console.log(`room ID: ${entry.id} — attach with \`roomyx-client --room ${entry.id}\``);
|
|
60
62
|
|
|
61
63
|
const shutdown = () => {
|
|
62
64
|
deregisterRoom(registryPath, entry.id);
|
|
@@ -88,6 +90,7 @@ async function main(): Promise<void> {
|
|
|
88
90
|
await runRoomsList();
|
|
89
91
|
} else {
|
|
90
92
|
console.error("Usage: roomyx <init|serve <logPath>|rooms list>");
|
|
93
|
+
console.error("The terminal UI is a separate binary: roomyx-client [--room <id>]");
|
|
91
94
|
process.exit(1);
|
|
92
95
|
}
|
|
93
96
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -91,6 +91,9 @@ async function main(): Promise<void> {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
main().catch((error) => {
|
|
94
|
-
|
|
94
|
+
// The message, not the object: a stack trace dumped at someone who simply
|
|
95
|
+
// hasn't started a room yet reads as a crash, and matches how cli.ts already
|
|
96
|
+
// reports its own failures.
|
|
97
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
95
98
|
process.exit(1);
|
|
96
99
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { existsSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
5
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
@@ -93,6 +94,23 @@ function withLock<T>(registryPath: string, fn: () => T): T {
|
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
/**
|
|
98
|
+
* True when there is provably nothing to read: no registry file. Callers that
|
|
99
|
+
* only read use this to skip the lock entirely, because taking the lock means
|
|
100
|
+
* writing a lockfile NEXT TO the registry — which fails with ENOENT when the
|
|
101
|
+
* directory itself doesn't exist yet. That is the shape of the bug this
|
|
102
|
+
* guards: `readRegistryUnlocked` has always tolerated a missing registry, but
|
|
103
|
+
* in an un-`init`ed project no caller ever reached it, because withLock threw
|
|
104
|
+
* first. `roomyx rooms list` printed a bare ENOENT and `roomyx-client` printed
|
|
105
|
+
* a stack trace, both for the ordinary case of "you haven't started a room".
|
|
106
|
+
*
|
|
107
|
+
* Racing a registerRoom that lands right after the check is harmless: the
|
|
108
|
+
* reader returns the empty snapshot it would have returned a moment earlier.
|
|
109
|
+
*/
|
|
110
|
+
function hasNoRegistry(path: string): boolean {
|
|
111
|
+
return !existsSync(path);
|
|
112
|
+
}
|
|
113
|
+
|
|
96
114
|
function readRegistryUnlocked(path: string): { schemaVersion: 1; rooms: RoomRegistryEntry[] } {
|
|
97
115
|
if (!existsSync(path)) {
|
|
98
116
|
return { schemaVersion: 1, rooms: [] };
|
|
@@ -115,11 +133,19 @@ function generateRoomId(): string {
|
|
|
115
133
|
return `r-${Math.random().toString(36).slice(2, 8)}`;
|
|
116
134
|
}
|
|
117
135
|
|
|
118
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Adds a new room to the registry, generating its id. Creates the registry's
|
|
138
|
+
* directory if it isn't there: a write path has to be able to create its own
|
|
139
|
+
* storage, or `roomyx serve` in an un-`init`ed project binds its port and only
|
|
140
|
+
* then dies registering itself. This is not a back door around D-01's
|
|
141
|
+
* explicit, never-clobbering `init` — it creates one empty directory, not the
|
|
142
|
+
* config and staged skill that `init` scaffolds, and it clobbers nothing.
|
|
143
|
+
*/
|
|
119
144
|
export function registerRoom(
|
|
120
145
|
registryPath: string,
|
|
121
146
|
info: { port: number; logPath: string; pid: number },
|
|
122
147
|
): RoomRegistryEntry {
|
|
148
|
+
mkdirSync(dirname(registryPath), { recursive: true });
|
|
123
149
|
return withLock(registryPath, () => {
|
|
124
150
|
const registry = readRegistryUnlocked(registryPath);
|
|
125
151
|
const entry: RoomRegistryEntry = {
|
|
@@ -134,8 +160,9 @@ export function registerRoom(
|
|
|
134
160
|
});
|
|
135
161
|
}
|
|
136
162
|
|
|
137
|
-
/** Removes one room by id. No-op if the id isn't
|
|
163
|
+
/** Removes one room by id. No-op if the id — or the whole registry — isn't there. */
|
|
138
164
|
export function deregisterRoom(registryPath: string, id: string): void {
|
|
165
|
+
if (hasNoRegistry(registryPath)) return;
|
|
139
166
|
withLock(registryPath, () => {
|
|
140
167
|
const registry = readRegistryUnlocked(registryPath);
|
|
141
168
|
writeRegistryUnlocked(
|
|
@@ -145,8 +172,9 @@ export function deregisterRoom(registryPath: string, id: string): void {
|
|
|
145
172
|
});
|
|
146
173
|
}
|
|
147
174
|
|
|
148
|
-
/** All registered rooms, live or not. Empty array if
|
|
175
|
+
/** All registered rooms, live or not. Empty array if there is no registry yet. */
|
|
149
176
|
export function listRooms(registryPath: string): RoomRegistryEntry[] {
|
|
177
|
+
if (hasNoRegistry(registryPath)) return [];
|
|
150
178
|
return withLock(registryPath, () => readRegistryUnlocked(registryPath).rooms);
|
|
151
179
|
}
|
|
152
180
|
|
|
@@ -157,6 +185,7 @@ export function listRooms(registryPath: string): RoomRegistryEntry[] {
|
|
|
157
185
|
* omitted from the returned list.
|
|
158
186
|
*/
|
|
159
187
|
export async function listLiveRooms(registryPath: string): Promise<RoomRegistryEntry[]> {
|
|
188
|
+
if (hasNoRegistry(registryPath)) return [];
|
|
160
189
|
const rooms = withLock(registryPath, () => readRegistryUnlocked(registryPath).rooms);
|
|
161
190
|
const checks = await Promise.all(
|
|
162
191
|
rooms.map(async (room) => {
|
|
@@ -15,7 +15,7 @@ function urlFor(room: RoomRegistryEntry): string {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Decides which roomyx server `roomyx
|
|
18
|
+
* Decides which roomyx server `roomyx-client` should connect to.
|
|
19
19
|
* `--connect` always wins outright (explicit URL, registry not consulted).
|
|
20
20
|
* `--room <id>` looks up that specific room among the LIVE ones (a
|
|
21
21
|
* registered-but-dead id is treated the same as unknown, not a stale
|