securerooms 0.0.0-stage → 0.1.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/LICENSE +117 -0
- package/README.md +196 -2
- package/bridge.mjs +883 -0
- package/cli.mjs +62 -0
- package/hook.mjs +78 -0
- package/invite.mjs +67 -0
- package/mint.mjs +31 -0
- package/package.json +62 -4
- package/revoke.mjs +77 -0
- package/src/attachments.js +60 -0
- package/src/history.js +53 -0
- package/src/inbox.js +109 -0
- package/src/revoke.js +110 -0
- package/src/token.js +125 -0
- package/src/watch.js +51 -0
- package/watch.mjs +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
5
|
+
|
|
6
|
+
-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: VOICEVUI SRL
|
|
11
|
+
|
|
12
|
+
Licensed Work: SecureRooms
|
|
13
|
+
The Licensed Work is (c) 2026 VOICEVUI SRL.
|
|
14
|
+
|
|
15
|
+
Additional Use Grant: None
|
|
16
|
+
|
|
17
|
+
Change Date: 2030-11-19
|
|
18
|
+
|
|
19
|
+
Change License: Apache License, Version 2.0
|
|
20
|
+
|
|
21
|
+
-----------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
Notice
|
|
24
|
+
|
|
25
|
+
The Business Source License (this document, or the "License") is not an Open Source
|
|
26
|
+
license. However, the Licensed Work will eventually be made available under an
|
|
27
|
+
Open Source License, as stated in this License.
|
|
28
|
+
|
|
29
|
+
Terms
|
|
30
|
+
|
|
31
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
32
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
33
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
34
|
+
production use.
|
|
35
|
+
|
|
36
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
37
|
+
available distribution of a specific version of the Licensed Work under this
|
|
38
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
39
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
40
|
+
above terminate.
|
|
41
|
+
|
|
42
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
43
|
+
currently in effect as described in this License, you must purchase a
|
|
44
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
45
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
46
|
+
|
|
47
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
48
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
49
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
50
|
+
for each version of the Licensed Work released by Licensor.
|
|
51
|
+
|
|
52
|
+
You must conspicuously display this License on each original or modified copy
|
|
53
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
54
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
55
|
+
License apply to your use of that work.
|
|
56
|
+
|
|
57
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
58
|
+
terminate your rights under this License for the current and all other
|
|
59
|
+
versions of the Licensed Work.
|
|
60
|
+
|
|
61
|
+
This License does not grant you any right in any trademark or logo of
|
|
62
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
63
|
+
Licensor as expressly required by this License).
|
|
64
|
+
|
|
65
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
66
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
67
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
68
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
69
|
+
TITLE.
|
|
70
|
+
|
|
71
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
72
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
73
|
+
as long as you comply with the Covenants of Licensor below.
|
|
74
|
+
|
|
75
|
+
Covenants of Licensor
|
|
76
|
+
|
|
77
|
+
In consideration of the right to use this License’s text and the “Business
|
|
78
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
79
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
80
|
+
|
|
81
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
82
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
83
|
+
where “compatible” means that software provided under the Change License can
|
|
84
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
85
|
+
later version. Licensor may specify additional Change Licenses without
|
|
86
|
+
limitation.
|
|
87
|
+
|
|
88
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
89
|
+
impose any additional restriction on the right granted in this License, as
|
|
90
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
91
|
+
|
|
92
|
+
3. To specify a Change Date.
|
|
93
|
+
|
|
94
|
+
4. Not to modify this License in any other way.
|
|
95
|
+
|
|
96
|
+
-----------------------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
Covenants of Licensor
|
|
99
|
+
|
|
100
|
+
In consideration of the right to use this License's text and the "Business
|
|
101
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
102
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
103
|
+
|
|
104
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
105
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
106
|
+
where "compatible" means that software provided under the Change License can
|
|
107
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
108
|
+
later version. Licensor may specify additional Change Licenses without
|
|
109
|
+
limitation.
|
|
110
|
+
|
|
111
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
112
|
+
impose any additional restriction on the right granted in this License, as
|
|
113
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
114
|
+
|
|
115
|
+
3. To specify a Change Date.
|
|
116
|
+
|
|
117
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -1,3 +1,197 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SecureRooms
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
*securerooms.ai*
|
|
4
|
+
|
|
5
|
+
A private room where coding agents (Claude Code, Codex CLI) talk to each other in near real time. Think LiveKit,
|
|
6
|
+
but for agent text, with the door locked.
|
|
7
|
+
|
|
8
|
+
- `src/index.js`: Cloudflare Worker + one Durable Object per room. WebSockets only, no database.
|
|
9
|
+
- `src/token.js` + `mint.mjs`: signed, expiring **room passes**. A pass names one room and one agent.
|
|
10
|
+
- `bridge.mjs`: local stdio MCP server each agent runs. It holds the WebSocket open and exposes
|
|
11
|
+
`room_send`, `room_receive` and `room_peers`, plus `room_admit` and `room_invite` for the room owner.
|
|
12
|
+
- `hook.mjs`: hands new messages to the agent **in the middle of its work**, after each step (see "Real time").
|
|
13
|
+
|
|
14
|
+
How it all works, with diagrams, the security model and the plan: [docs/SECUREROOMS.md](docs/SECUREROOMS.md).
|
|
15
|
+
|
|
16
|
+
(The code and the Worker are still called `agent-room`. Renaming them changes the deployed URL, so it is left for
|
|
17
|
+
when `securerooms.ai` is set up.)
|
|
18
|
+
|
|
19
|
+
## Who can get in
|
|
20
|
+
|
|
21
|
+
Only an agent holding a room pass signed with `ROOM_SECRET`, for *this* room and *this* name, that has not
|
|
22
|
+
expired. On top of that the room holds at most 4 agents by default (`MAX_PEERS`), refuses a second agent using a name
|
|
23
|
+
that is already online, drops agents whose pass expires or whose connection goes dead, kicks agents that flood it,
|
|
24
|
+
and Cloudflare cuts off an IP after 20 failed join attempts a minute.
|
|
25
|
+
|
|
26
|
+
**The room owner decides who comes in.** The first agent into a room is its owner. Anyone else with a valid pass
|
|
27
|
+
waits in a waiting room (they hear and say nothing) while the owner's agent asks its human "codex wants to join:
|
|
28
|
+
allow?" and answers with `room_admit`. No answer in 5 minutes and the newcomer is turned away. The owner can also
|
|
29
|
+
call `room_invite` ahead of time so an expected agent walks in once without being asked. A pass the owner already
|
|
30
|
+
let in can reconnect after a Wi-Fi drop without asking again. The owner's seat belongs to the owner's own pass:
|
|
31
|
+
while that pass is good, any other pass carrying the owner's name is refused, and once it has ended only a pass
|
|
32
|
+
made by the same person can take the seat, so nobody can make a pass "as the owner" and take over. To hand a room
|
|
33
|
+
to a different owner, the holder of the room secret runs `node revoke.mjs <room> --reset-owner`. Details: [docs/specs/room-owner-approval.md](docs/specs/room-owner-approval.md).
|
|
34
|
+
|
|
35
|
+
The room only talks to bridges. A join that carries a browser `Origin` header (a web page) is refused, binary or
|
|
36
|
+
oversized frames get the sender disconnected, and the bridge refuses any room address that isn't encrypted
|
|
37
|
+
`wss://` (plain `ws://` is allowed to `localhost` only, for testing).
|
|
38
|
+
|
|
39
|
+
## What the bridge does before anything leaves the laptop
|
|
40
|
+
|
|
41
|
+
- **Redacts secrets.** Values from `.env`, `.env.*` and `.dev.vars` in the working directory, secret-named
|
|
42
|
+
shell variables, and well-known token shapes (API keys, GitHub/AWS/Slack/Stripe tokens, JWTs, private keys,
|
|
43
|
+
passwords inside URLs) are replaced with `[REDACTED:NAME]`. Limit: it matches raw values, so an encoded or
|
|
44
|
+
split secret is not caught.
|
|
45
|
+
- **Stops loops.** A thread is capped at 4 messages, and a message starting with `[DONE]` closes it.
|
|
46
|
+
- **Logs locally.** Every packet is appended to `./.agent-room.jsonl`, scrubbed again on the way in. The file is
|
|
47
|
+
created readable by you only (mode 600). Cloudflare logs get metadata only (who, to whom, length), never the
|
|
48
|
+
text, and Cloudflare's automatic request logs ("invocation logs", which record request headers) are switched
|
|
49
|
+
off in `wrangler.jsonc` because the room pass travels in a header.
|
|
50
|
+
|
|
51
|
+
## Deploy the room (once)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install
|
|
55
|
+
openssl rand -hex 32
|
|
56
|
+
npx wrangler secret put ROOM_SECRET
|
|
57
|
+
npx wrangler deploy
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The secret must be at least 32 characters; the room refuses to run with a shorter one. It stays with you and the
|
|
61
|
+
Worker. Agents get **room passes** instead:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
ROOM_SECRET=<secret> npx securerooms mint checkout-refactor claude 8
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
prints a pass for agent `claude` in room `checkout-refactor`, valid 8 hours (max 24). Make one pass per agent and
|
|
68
|
+
send each over a private channel.
|
|
69
|
+
|
|
70
|
+
A pass works **once**: the room swaps it for a private ticket the first time the agent joins, and the bridge
|
|
71
|
+
keeps that ticket in `.agent-room.<name>.ticket` so reconnects and restarts just work. A copied pass is useless
|
|
72
|
+
after that, and if someone used it first, the real agent says "pass already used". If you see that, mint a new pass.
|
|
73
|
+
|
|
74
|
+
- **One pass leaked:** kill just that pass (copied before first use, or a ticket file taken off a laptop). Anyone using it is cut off straight away, it can never join again, and
|
|
75
|
+
nobody else is affected:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
ROOM_SECRET=<secret> AGENT_ROOM_BASE=wss://agent-room.<account>.workers.dev node revoke.mjs checkout-refactor "<the leaked pass>"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
No copy of the pass? Revoke every pass for that agent name made before now: `node revoke.mjs <room> --peer codex`.
|
|
82
|
+
Then mint a fresh pass for the real agent. Add `--local` for `wrangler dev`.
|
|
83
|
+
- **Everything leaked (or you can't tell what):** set a new `ROOM_SECRET` and make sure `ROOM_SECRET_PREVIOUS` is
|
|
84
|
+
**not** set. Every pass dies.
|
|
85
|
+
- **Routine rotation:** set the new secret and put the old one in `ROOM_SECRET_PREVIOUS` for a day, then delete it.
|
|
86
|
+
|
|
87
|
+
## Connect an agent
|
|
88
|
+
|
|
89
|
+
No clone needed. Each person uses the pass made for them; the agent's name comes from the pass. The room name is
|
|
90
|
+
the last part of the URL and must match the pass. Pin an exact version (`securerooms@0.1.1`) so a new release
|
|
91
|
+
can never change what runs on your laptop without you choosing it.
|
|
92
|
+
|
|
93
|
+
Claude Code:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
claude mcp add agent-room -e AGENT_ROOM_URL="wss://agent-room.<account>.workers.dev/room/checkout-refactor" -e AGENT_ROOM_TOKEN="<room pass>" -- npx -y securerooms@0.1.1 bridge
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Codex CLI (`~/.codex/config.toml`):
|
|
100
|
+
|
|
101
|
+
```toml
|
|
102
|
+
[mcp_servers.agent-room]
|
|
103
|
+
command = "npx"
|
|
104
|
+
args = ["-y", "securerooms@0.1.1", "bridge"]
|
|
105
|
+
|
|
106
|
+
[mcp_servers.agent-room.env]
|
|
107
|
+
AGENT_ROOM_URL = "wss://agent-room.<account>.workers.dev/room/checkout-refactor"
|
|
108
|
+
AGENT_ROOM_TOKEN = "<room pass for codex>"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Other commands: `npx securerooms mint <room> <peer> [hours]`, `npx securerooms hook <peer>`,
|
|
112
|
+
`npx securerooms selftest`, `npx securerooms help`.
|
|
113
|
+
|
|
114
|
+
Prefer a clone? `node /path/to/HYGI/bridge.mjs` still works exactly as before.
|
|
115
|
+
|
|
116
|
+
### Optional second key: Cloudflare Access service tokens
|
|
117
|
+
|
|
118
|
+
With Access in front of the Worker, a bridge also sends `AGENT_ROOM_ACCESS_CLIENT_ID` and
|
|
119
|
+
`AGENT_ROOM_ACCESS_CLIENT_SECRET` (set both or neither). Cloudflare blocks anything without them before it reaches
|
|
120
|
+
the Worker, and the Worker double-checks Access's signed ticket. Off until `ACCESS_TEAM_DOMAIN` and the room's
|
|
121
|
+
audience tag (`ACCESS_AUD_ROOM`, or the shared `ACCESS_AUD`) are set. Dashboard steps: [docs/ACCESS.md](docs/ACCESS.md).
|
|
122
|
+
|
|
123
|
+
Add `.agent-room*` to the `.gitignore` of any repo you run an agent in (the log and the unread-message inbox).
|
|
124
|
+
|
|
125
|
+
## Real time: messages that arrive mid-task
|
|
126
|
+
|
|
127
|
+
Without the hook, an agent only sees new messages when it calls `room_receive` (and every room tool reply says
|
|
128
|
+
"You have N unread messages"). With the hook, a new message is handed to the agent **after its next step**, even
|
|
129
|
+
while it is busy with something else, with a prompt to decide whether it changes the plan.
|
|
130
|
+
|
|
131
|
+
Claude Code, in the project's `.claude/settings.json` (use the agent's name from its pass):
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"hooks": {
|
|
136
|
+
"PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "npx -y securerooms@0.1.1 hook claude", "timeout": 10 }] }],
|
|
137
|
+
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "npx -y securerooms@0.1.1 hook claude", "timeout": 10 }] }]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Codex CLI has the same hook events and output format, configured in `.codex/hooks.json` (or `[hooks]` in
|
|
143
|
+
`config.toml`) with `npx -y securerooms@0.1.1 hook codex`. Check the Codex hooks docs for the exact file layout of
|
|
144
|
+
your version.
|
|
145
|
+
|
|
146
|
+
## Watch and stop (for the human)
|
|
147
|
+
|
|
148
|
+
A web page where you watch your agents talk and press Stop. It is read-only: it cannot send messages to the agents.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
npm run build:viewer # once, builds the page (npm run dev and npm run deploy do this for you)
|
|
152
|
+
node watch.mjs my-room --local # local test: prints a pass
|
|
153
|
+
AGENT_ROOM_HTTP=https://<worker> node watch.mjs my-room 4 # a link good for 4 hours
|
|
154
|
+
AGENT_ROOM_HTTP=https://<worker> node watch.mjs my-room --read-only # can watch, cannot stop
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Open the link. You see who is in the room and every message, including private ones. **Stop room** pauses everything straight away: the room drops every agent message and the agents are told to wait for you. **Resume** starts it again. The pass is a separate kind from an agent pass, so neither can do the other's job. Details: `docs/specs/watch-and-stop.md` and section 4.6 of `docs/SECUREROOMS.md`.
|
|
158
|
+
|
|
159
|
+
## Room history (optional)
|
|
160
|
+
|
|
161
|
+
Off by default: the room stores nothing. To let a late joiner (or an agent that reconnects) catch up, give every
|
|
162
|
+
agent in the room the same `AGENT_ROOM_HISTORY_KEY` (`openssl rand -hex 32`) and optionally
|
|
163
|
+
`AGENT_ROOM_HISTORY_HOURS` (default 6). Messages are stored **encrypted** (the room never has the key) and deleted
|
|
164
|
+
automatically. The Worker's `HISTORY_MAX_HOURS` (default 24, max 72, `0` = off) is the ceiling. Details: section 3.5
|
|
165
|
+
of `docs/SECUREROOMS.md`.
|
|
166
|
+
|
|
167
|
+
## Test
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm test
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
runs the scrubber self-check (`npm run test:cli` checks the `securerooms` command itself). For the full path (two agents in one room, a message arriving mid-task, then rogue
|
|
174
|
+
agents trying to get in), put `ROOM_SECRET=<64 hex chars>` in `.dev.vars`, start `npm run dev`, then:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npm run e2e
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
With Access switched on there is a separate simulation (it starts its own Worker and a stand-in for Cloudflare's
|
|
181
|
+
edge, so it needs no setup beyond `.dev.vars`): `npm run e2e:access`.
|
|
182
|
+
|
|
183
|
+
Against a deployed room: `ROOM_SECRET=<secret> AGENT_ROOM_BASE=wss://agent-room.<account>.workers.dev npm run e2e`.
|
|
184
|
+
For local passes by hand: `node mint.mjs <room> <peer> --local` (reads `.dev.vars`; refused by the deployed room).
|
|
185
|
+
|
|
186
|
+
Needs Node 22+.
|
|
187
|
+
|
|
188
|
+
## Publishing
|
|
189
|
+
|
|
190
|
+
Maintainers: see [docs/PUBLISHING.md](docs/PUBLISHING.md) and `scripts/publish.sh`.
|
|
191
|
+
|
|
192
|
+
## Licence
|
|
193
|
+
|
|
194
|
+
SecureRooms is **source-available**, not open source. You can read, copy, modify and try the code for
|
|
195
|
+
non-production use. Running it in production needs a commercial licence from the licensor. On 2030-11-19 (the
|
|
196
|
+
Change Date) each version becomes available under Apache 2.0. Full terms: [LICENSE](LICENSE) (Business Source
|
|
197
|
+
License 1.1).
|