@platys/relay 0.0.0-stage → 0.8.0-alpha.12

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.
Files changed (51) hide show
  1. package/README.md +118 -2
  2. package/next/CLAUDE_CHANNEL.md +110 -0
  3. package/next/EASY_SETUP.md +122 -0
  4. package/next/REMOTE_MCP.md +194 -0
  5. package/next/TROUBLESHOOTING.md +72 -0
  6. package/out/core/budget.js +126 -0
  7. package/out/core/collaboration.js +170 -0
  8. package/out/core/companion.js +86 -0
  9. package/out/core/dashboard-page.js +69 -0
  10. package/out/core/dashboard.js +104 -0
  11. package/out/core/remote-connect.js +19 -0
  12. package/out/core/remote-hooks.js +21 -0
  13. package/out/core/remote-mcp.js +258 -0
  14. package/out/core/room.js +272 -0
  15. package/out/core/types.js +52 -0
  16. package/out/core/version.js +1 -0
  17. package/out/node/adapters.js +64 -0
  18. package/out/node/artifacts.js +151 -0
  19. package/out/node/budget-operator.js +212 -0
  20. package/out/node/claude-channel.js +234 -0
  21. package/out/node/cli.js +358 -0
  22. package/out/node/client.js +80 -0
  23. package/out/node/connector.js +171 -0
  24. package/out/node/context.js +59 -0
  25. package/out/node/diagnostics.js +45 -0
  26. package/out/node/git.js +70 -0
  27. package/out/node/hooks.js +113 -0
  28. package/out/node/hosted-connect.js +41 -0
  29. package/out/node/hub.js +101 -0
  30. package/out/node/install.js +64 -0
  31. package/out/node/integration.js +128 -0
  32. package/out/node/maintenance.js +82 -0
  33. package/out/node/network-cli.js +279 -0
  34. package/out/node/network-install.js +56 -0
  35. package/out/node/network-runtime.js +90 -0
  36. package/out/node/network-setup.js +121 -0
  37. package/out/node/network-state.js +61 -0
  38. package/out/node/remote-companion-install.js +44 -0
  39. package/out/node/remote-companion-mcp.js +38 -0
  40. package/out/node/remote-companion.js +192 -0
  41. package/out/node/remote-hooks-install.js +25 -0
  42. package/out/node/remote-setup.js +191 -0
  43. package/out/node/request-budget.js +50 -0
  44. package/out/node/setup-page.js +26 -0
  45. package/out/node/setup-web.js +129 -0
  46. package/out/node/sqlite.js +33 -0
  47. package/out/node/state.js +113 -0
  48. package/out/node/terminal.js +28 -0
  49. package/out/node/tools.js +204 -0
  50. package/out/node/workflow.js +60 -0
  51. package/package.json +65 -4
package/README.md CHANGED
@@ -1,3 +1,119 @@
1
- # Temporary Holding Version
1
+ # Relay
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Talk to your friend's coding agent from your own Claude Code or Codex session.
4
+ You can work in different repositories, on different tasks, and on different
5
+ computers. Relay connects the conversations through an invited group.
6
+
7
+ > **Beta**
8
+ > Real Claude and Codex message delivery has been tested on Windows. macOS/Linux
9
+ > builds go through CI; physical cross-platform testing is still pending.
10
+
11
+ ## Install
12
+
13
+ ### One command: Windows, macOS, or Linux
14
+
15
+ Requires [Node.js 22.13 or newer](https://nodejs.org/en/download).
16
+
17
+ ```sh
18
+ npx --yes @platys/relay setup
19
+ ```
20
+
21
+ Paste your invitation, check your name, and connect. No archive download,
22
+ npm account, GitHub access, or configuration-file editing is needed.
23
+ Setup keeps its runtime outside the npm cache.
24
+
25
+ If you prefer a permanent CLI command:
26
+
27
+ ```sh
28
+ npm install --global @platys/relay
29
+ relay setup
30
+ ```
31
+
32
+ Version **0.8.0-alpha.12** includes the project-folder launcher fix. Windows PowerShell users
33
+ can use `npx.cmd`, `npm.cmd`, or `relay.cmd` if execution policy blocks the shims.
34
+
35
+ ### Windows: no terminal needed
36
+
37
+ Download **RelaySetup-0.8.0-alpha.10-win32-x64.exe** from the
38
+ [beta release](https://github.com/vision-27/relay/releases/tag/v0.8.0-alpha.10).
39
+ Open it, paste a fresh invitation link, and click **Connect Relay**.
40
+ The installer includes its runtime; you do not need Node, npm, Python, or Git.
41
+ The beta installer is unsigned.
42
+
43
+ The repository and desktop releases are private. Your friend needs repository
44
+ access for that installer, or you can send the file. Public npm installation
45
+ above needs neither. The existing desktop download remains alpha.10.
46
+
47
+ ## Start talking
48
+
49
+ 1. **Claude Code:** open the **Claude with Relay** desktop shortcut, choose your
50
+ project folder, and accept Claude's folder/channel trust prompts. Start your task normally.
51
+ 2. **Codex:** reopen the app and review the Relay entries in `/hooks` once.
52
+ Start or resume your task normally.
53
+ 3. Ask your agent:
54
+
55
+ > Find my friend's agent on Relay and ask what they changed in the API.
56
+
57
+ Your friend connects with their own invitation and membership. Both people keep
58
+ their agent sessions open. No shared repository or workspace selection is needed.
59
+
60
+ You can also ask questions from the **shared room** link shown after setup.
61
+
62
+ ## How delivery works
63
+
64
+ | Recipient | What happens |
65
+ | --- | --- |
66
+ | Idle, with automatic delivery enabled | Relay starts a response in the existing session. |
67
+ | Busy | The message waits without cancelling the current work. |
68
+ | Closed or not attached | The message stays pending until the session reconnects and checks Relay. |
69
+
70
+ Both clients use MCP. Codex's companion uses its native queue; Claude's adapter
71
+ uses MCP channels. Claude currently requires its development-channel launch
72
+ setting, which the desktop shortcut supplies. Opening Claude normally still
73
+ provides Relay tools, but does not enable automatic channel wake-up.
74
+
75
+ **Queued** means stored, **accepted** means supplied to the client, **delivered**
76
+ means explicitly acknowledged, and **answered** means an actual reply exists.
77
+
78
+ ## What gets shared?
79
+
80
+ Agents explicitly share questions, answers, and task descriptions. The default
81
+ setup does not upload full transcripts or files automatically. Members of the
82
+ same group can access its shared records, including directed messages.
83
+
84
+ Peer messages provide context; they do not grant permission to run commands or
85
+ change files. See the [security model](SECURITY.md).
86
+
87
+ ## Guides
88
+
89
+ - [Setup, invitations, updates, and uninstall](next/EASY_SETUP.md)
90
+ - [Troubleshooting](next/TROUBLESHOOTING.md)
91
+ - [Manual HTTP MCP configuration](next/REMOTE_MCP.md)
92
+ - [Claude channel details](next/CLAUDE_CHANNEL.md)
93
+ - [Development and release process](CONTRIBUTING.md)
94
+ - [Detailed verification record](next/VERIFICATION.md)
95
+
96
+ ## Current limits
97
+
98
+ - This is an unsigned beta. Full visual setup QA and physical two-computer
99
+ acceptance are still pending.
100
+ - Claude retains its own channel confirmation, supported-account requirements,
101
+ and organization restrictions. See [Claude's channel documentation](https://code.claude.com/docs/en/channels).
102
+ - MCP process restarts in a resumed Claude conversation require reattaching with
103
+ the conversation's existing key. Ask the agent to check Relay again.
104
+ - Relay cannot answer on behalf of a closed agent or guarantee a response time.
105
+
106
+ ## Developing Relay
107
+
108
+ ```sh
109
+ git clone https://github.com/vision-27/relay.git
110
+ cd relay
111
+ npm ci
112
+ npm run check
113
+ npm test
114
+ ```
115
+
116
+ Source is in `next/`. `npm run package:release` builds the installable npm
117
+ archive; `npm run build:desktop` builds an installer for the current OS.
118
+ The optional older repository/network connector is documented in
119
+ [advanced setup](next/README.md).
@@ -0,0 +1,110 @@
1
+ # Claude Code channel preview
2
+
3
+ The [Relay setup app](EASY_SETUP.md) now handles the installation steps below and
4
+ creates a desktop launcher. Claude still shows its own channel trust prompt.
5
+
6
+ Relay's ordinary hosted HTTP MCP already works in Claude Code. This adapter adds
7
+ push delivery to an open Claude Code conversation: idle sessions can respond,
8
+ and busy sessions receive the event without cancelling their current tool call.
9
+ Claude Code starts the small local MCP process and stops it with the session.
10
+ No workspace selection or separate background AI is needed.
11
+
12
+ ## Preview boundary
13
+
14
+ This is a developer preview, not a one-click consumer release. Claude currently
15
+ requires its interactive `--dangerously-load-development-channels` flag for
16
+ custom channels outside its approved list, with its own confirmation screen.
17
+ This does not override organization policy. Review and trust the source before
18
+ using that flag. Claude Desktop, `claude -p`, and Agent SDK channel triggering
19
+ are not supported by this setup. Use a supported first-party Claude login;
20
+ Team/Enterprise organizations must enable channels.
21
+
22
+ See [Claude's channel reference](https://code.claude.com/docs/en/channels-reference)
23
+ and [account requirements](https://code.claude.com/docs/en/channels).
24
+
25
+ ## Try the package
26
+
27
+ Prerequisites: Node.js 22.13 or newer and Claude Code with channel support. Live
28
+ QA used Claude Code 2.1.299 on Windows. macOS/Linux physical devices are untested.
29
+
30
+ 1. Open your friend's Relay invitation and join with your own name. Use your
31
+ own membership token, not your friend's owner token.
32
+ 2. Install the supplied local preview archive:
33
+
34
+ ```sh
35
+ npm install --global @platys/relay
36
+ ```
37
+
38
+ 3. Save a private `connection.json` outside your repository:
39
+
40
+ ```json
41
+ {
42
+ "server": "https://YOUR-RELAY-HOST",
43
+ "projectId": "NETWORK_ID",
44
+ "token": "YOUR_MEMBERSHIP_TOKEN"
45
+ }
46
+ ```
47
+
48
+ 4. Run `npm root --global` to locate the installed package. Add this entry to
49
+ your private, user-level Claude MCP configuration, using absolute paths:
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "relay_remote": {
55
+ "command": "node",
56
+ "args": [
57
+ "/ABSOLUTE/NPM/ROOT/@platys/relay/out/node/claude-channel.js",
58
+ "/ABSOLUTE/PRIVATE/connection.json"
59
+ ]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ Windows JSON can use forward slashes, such as `C:/Users/you/...`. Merge the
66
+ entry with other MCP servers. Replace an existing HTTP `relay_remote` entry
67
+ rather than loading both versions. Keep the connection file private.
68
+
69
+ 5. Launch an interactive session:
70
+
71
+ ```sh
72
+ claude --dangerously-load-development-channels server:relay_remote
73
+ ```
74
+
75
+ 6. After `/mcp` shows Relay connected, say: **"Open Relay for this Claude
76
+ conversation and stay available for questions from my friends."** Claude
77
+ retains its own conversation key. Open the shared room or ask another agent
78
+ to find this session and send it a question.
79
+
80
+ The package also exposes `relay-claude-channel CONNECTION_FILE` for clients
81
+ that resolve npm executable shims. The explicit Node path above avoids Windows
82
+ shim differences. No credential or invitation is included in the archive.
83
+
84
+ ## Delivery and recovery
85
+
86
+ - Only events addressed to this conversation are pushed. Receiving bytes or an
87
+ `accepted` receipt does not mean the model answered; `answered` requires an
88
+ actual `relay_reply`.
89
+ - Network interruptions reconnect and replay pending events. Events already
90
+ supplied to the same running MCP process are suppressed to avoid duplicates.
91
+ - After restarting the MCP process in a resumed conversation, ask Claude to
92
+ call `relay_check` with its existing private key to reattach. Automatic
93
+ recovery after losing the conversation key is not implemented for Claude.
94
+ - Keep the session open. This does not launch a closed Claude application or
95
+ keep a model running after exit. Use `relay_close` when leaving the room.
96
+ - Peer messages are untrusted context. They do not grant file, command, or
97
+ remote-approval authority. Full transcripts and files are not uploaded
98
+ automatically.
99
+
100
+ ## Verified on 14 October 2026
101
+
102
+ Real Claude: HTTP open/check/close; idle room question answered in about three
103
+ seconds; question arriving during `sleep 20` answered after the command ended;
104
+ question from the current Codex controller answered through Relay. These were
105
+ isolated sessions on one Windows computer using the hosted service.
106
+
107
+ Automated Worker tests: official MCP SDK interoperability, channel capability,
108
+ push delivery, exact conversation targeting, wrong-key rejection, repeat-open
109
+ protection, WebSocket reconnect/replay, duplicate suppression, and close.
110
+ See [verification notes](VERIFICATION.md) for evidence and remaining release work.
@@ -0,0 +1,122 @@
1
+ # Get started with Relay
2
+
3
+ Relay connects your existing Claude Code and Codex conversations with your
4
+ friends' agents. Each person installs it once. You do not need the same workspace.
5
+
6
+ ## Before you start
7
+
8
+ - Install and sign in to Claude Code or Codex.
9
+ - Ask your friend for a **fresh Relay invitation link**.
10
+ - For npm setup, install Node.js 22.13 or newer. No npm account is needed.
11
+ - For the Windows app instead, get the installer from the
12
+ [beta release](https://github.com/vision-27/relay/releases/tag/v0.8.0-alpha.10).
13
+ This is a private repository: the owner can give you access or send the file.
14
+
15
+ Paste the invitation directly into setup. If you already joined using the
16
+ browser page, ask for a fresh invite for this installation; invitations are
17
+ single-use. Do not use someone else's membership token.
18
+
19
+ ## Option A: Windows setup app
20
+
21
+ 1. Open **RelaySetup-0.8.0-alpha.10-win32-x64.exe**.
22
+ 2. Paste your invitation link and check your name.
23
+ 3. Click **Connect Relay**.
24
+
25
+ Setup detects your coding clients, saves the connection privately, and installs
26
+ their MCP integrations. It includes its own runtime. No terminal or separate
27
+ Node, Python, or Git installation is needed. This beta executable is unsigned;
28
+ follow your device's software policy if Windows blocks it.
29
+
30
+ ## Option B: npm
31
+
32
+ With Node.js 22.13 or newer installed, open any terminal:
33
+
34
+ ```sh
35
+ npx --yes @platys/relay setup
36
+ ```
37
+
38
+ Or install a permanent CLI command:
39
+
40
+ ```sh
41
+ npm install --global @platys/relay
42
+ relay setup
43
+ ```
44
+
45
+ In Windows PowerShell, use `npx.cmd`, `npm.cmd`, or `relay.cmd` if execution policy blocks
46
+ the corresponding PowerShell command shims.
47
+
48
+ The setup screen asks for the same invitation and name. npm downloads the public
49
+ package automatically; no archive, GitHub access, or npm login is needed. Setup
50
+ retains its own runtime, so clearing the npx cache does not break the connection.
51
+
52
+ ## Connect your first session
53
+
54
+ The project-folder chooser below requires alpha.12 or newer. Earlier npm releases
55
+ and the desktop alpha.10 installer still launch from the home folder.
56
+
57
+ **Claude Code:** click **Open Claude with Relay** in setup, or use the desktop
58
+ shortcut with that name. Choose your project folder, then accept Claude's normal
59
+ folder and channel confirmations. The launcher keeps the current project folder
60
+ when run from a terminal; launching from your home folder, desktop, or filesystem
61
+ root opens a folder chooser instead. On Linux without a graphical folder chooser,
62
+ enter the project path in the terminal. Cancelling does not start Claude.
63
+ The shortcut enables incoming messages without typing a flag.
64
+ Existing Claude sessions need to be reopened with channel support.
65
+
66
+ **Codex:** reopen the app. In `/hooks`, review and trust the two Relay hooks if
67
+ prompted. Start or resume a conversation so it attaches to Relay.
68
+
69
+ Then say:
70
+
71
+ > Find my friend's agent on Relay.
72
+
73
+ If several conversations match, choose the one you mean. An agent appearing in
74
+ the room is not proof it is currently running; keep both sessions open to test.
75
+
76
+ ## Invite a friend
77
+
78
+ Group owners and admins can create invitations. New members cannot invite others
79
+ unless the group owner promotes them to admin.
80
+
81
+ As an owner or admin, ask your connected agent:
82
+
83
+ > Create a Relay invitation for my friend.
84
+
85
+ Send your friend that link and the setup command: `npx --yes @platys/relay setup`.
86
+ Each invitation is single-use and expires after 24 hours. For the Windows app,
87
+ you can send the installer instead. They use their own name and membership. Do not send your connection file,
88
+ owner token, or private conversation key. Joining a Relay group does not grant
89
+ access to this GitHub repository.
90
+
91
+ Invitations add people to the existing group on its current server. Usage stays
92
+ with that server's hosting account, even when an admin creates the invitation.
93
+ Installing Relay does not grant permission to create new groups on that server;
94
+ group creation requires the server operator's credentials.
95
+
96
+ ## Update
97
+
98
+ Run `npx --yes @platys/relay@latest setup`, or update with
99
+ `npm install --global @platys/relay@latest` and run `relay setup` again.
100
+ Windows app users can run a newer installer. Setup retains the saved membership and backs up changed
101
+ client configuration. Reopen your coding client after updating. An npm package
102
+ update alone does not replace the persistent MCP runtime until setup runs.
103
+
104
+ ## Uninstall
105
+
106
+ 1. Remove only `relay_remote` from your client's MCP configuration.
107
+ 2. In Codex, remove only the two Relay inbox hooks from `/hooks` or its hook
108
+ configuration. Keep unrelated hooks.
109
+ 3. Close sessions that were using Relay and delete **Claude with Relay** from
110
+ your desktop.
111
+ 4. If you used npm, run `npm uninstall --global @platys/relay`.
112
+ 5. After confirming you no longer need the connection or backups, remove the
113
+ local `~/.relay/remote-mcp` folder. On Windows it is under your user folder.
114
+
115
+ Uninstalling does not revoke group membership or erase shared history. Ask the
116
+ group owner to revoke the membership if you no longer want access.
117
+
118
+ ## Need help?
119
+
120
+ Start with [troubleshooting](TROUBLESHOOTING.md). For manual MCP configuration,
121
+ see [remote MCP](REMOTE_MCP.md). Claude account/policy requirements and its current
122
+ channel preview limits are explained in [Claude channels](CLAUDE_CHANNEL.md).
@@ -0,0 +1,194 @@
1
+ # Relay remote MCP
2
+
3
+ For setup without token copying or configuration editing, use the
4
+ [Relay setup app](EASY_SETUP.md). The unsigned Windows preview bundles its runtime
5
+ and configures the optional delivery adapters. The manual HTTP path below is
6
+ still available.
7
+
8
+ The [shared room interface](SHARED_ROOM.md) at `/app` shows connected sessions,
9
+ shared messages and delivery receipts live. After joining an invitation, choose
10
+ **Open shared room**. People can send questions through that interface while
11
+ agents keep using their existing MCP tools.
12
+
13
+ The default path for agents working at the same time is a hosted MCP server.
14
+ There is no Relay download, daemon, hook installation, Git requirement, or
15
+ workspace selection. The existing local connector remains an optional integration.
16
+
17
+ ## Connect once
18
+
19
+ 1. Open the invitation link from your friend.
20
+ 2. Enter your name and click **Join Relay**.
21
+ 3. Add the displayed MCP URL and authorization token to your coding client's
22
+ user-level settings. Open/resume the client so it loads the integration.
23
+ 4. Say **“Use Relay to find my friend's agent.”**
24
+
25
+ This alpha uses invitation-based membership and a bearer token. It does not yet
26
+ provide OAuth sign-in or a one-click client installer. Clients must support a
27
+ remote HTTP MCP with custom authorization headers; browser-only clients that
28
+ require OAuth are not covered by this path.
29
+
30
+ The endpoint is `https://YOUR-RELAY/projects/NETWORK_ID/mcp`. An existing network
31
+ membership token works here; repository-project tokens require a separate network.
32
+ Each person has their own token. Never give a friend your owner token.
33
+
34
+ For Codex, the user configuration supports:
35
+
36
+ ```toml
37
+ [mcp_servers.relay_remote]
38
+ url = "https://YOUR-RELAY/projects/NETWORK_ID/mcp"
39
+ http_headers = { Authorization = "Bearer YOUR_MEMBERSHIP_TOKEN" }
40
+ ```
41
+
42
+ Keep this in your private user config, not a checked-in project file. Codex also
43
+ supports `bearer_token_env_var` when an environment-based credential is preferred.
44
+ See the [official Codex MCP documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli).
45
+
46
+ Claude Code supports a user-scoped HTTP server:
47
+
48
+ ```sh
49
+ claude mcp add --transport http --scope user relay_remote https://YOUR-RELAY/projects/NETWORK_ID/mcp --header "Authorization: Bearer YOUR_MEMBERSHIP_TOKEN"
50
+ ```
51
+
52
+ The invitation page also shows JSON for clients that accept an `mcpServers` block.
53
+ Take care with shell history when entering credentials. See the
54
+ [official Claude Code MCP documentation](https://code.claude.com/docs/en/mcp).
55
+
56
+ ## While both agents are working
57
+
58
+ The server's MCP instructions direct each agent to open a distinct conversation,
59
+ check Relay at natural work boundaries, and answer questions addressed to it.
60
+ Every session tool response also includes pending messages. An agent can share
61
+ relevant code excerpts or explanations explicitly in its question or answer;
62
+ Relay does not upload local files or transcripts automatically.
63
+
64
+ An open client does **not** guarantee immediate delivery. The recipient must call
65
+ a Relay tool to read its inbox unless the optional Codex hooks below are enabled.
66
+ The hosted MCP alone has no idle wake-up or background polling. The optional
67
+ Codex delivery companion below adds immediate native handoff. The optional
68
+ [Claude Code channel preview](CLAUDE_CHANNEL.md) adds push delivery through a
69
+ local stdio MCP process, with Claude's development-channel launch requirement.
70
+ Agents should keep working and report a pending
71
+ answer instead of blocking indefinitely or repeatedly polling. Following MCP
72
+ instructions depends on the agent/client; the server cannot schedule the model.
73
+
74
+ ### Automatic inbox checks in Codex
75
+
76
+ With `relay_remote` already configured, run `node out/node/remote-hooks-install.js`
77
+ from this checkout, or merge the JSON shown in **Connect an agent > Automatic inbox
78
+ checks (Codex)** into `~/.codex/hooks.json`. The installer preserves unrelated hooks
79
+ and backs up an existing file. It installs configuration only, with no runtime or daemon.
80
+
81
+ Reopen Codex and review/trust the two Relay entries in `/hooks`. Codex requires
82
+ trust for the exact hook definition; Relay does not bypass this check. The hooks
83
+ call the existing MCP connection at `UserPromptSubmit` and `Stop`, supplying only
84
+ the native session ID, event name and stop-continuation flag. They do not send
85
+ prompts, transcripts, files or tool outputs. Tool-level hooks are deliberately
86
+ omitted because Codex subagent hooks can share a parent session ID.
87
+
88
+ On the next user turn, the hook tells the agent to attach its existing Relay
89
+ conversation with `relay_check(session_key, native_session_id)`, or open one with
90
+ `relay_open(provider, task, native_session_id)`. Exact identity, not workspace
91
+ matching, routes the inbox. Recovery with the same native ID preserves that
92
+ session's inbox and rotates its private key.
93
+
94
+ Pending messages are supplied as untrusted context when a turn starts. A newly
95
+ pending message at `Stop` can request one continuation; `stop_hook_active` prevents
96
+ a continuation loop, and recently supplied messages are suppressed for 60 seconds
97
+ at Stop. They remain pending until explicit acknowledgement or reply. An idle or
98
+ closed app still needs a new turn. This path currently supports Codex; Claude's
99
+ hosted MCP continues to require explicit Relay checks.
100
+
101
+ See [Codex MCP tool hooks](https://learn.chatgpt.com/docs/hooks#MCP-tool-hooks).
102
+
103
+ ### Codex delivery companion
104
+
105
+ For immediate delivery to idle conversations, enable the companion in addition
106
+ to the trusted hooks. It listens for room changes and calls the existing native
107
+ Codex queue: idle sessions can start another turn, while busy sessions process
108
+ the follow-up after their current turn. This is a delivery listener, not a second
109
+ AI model, and it does not read or upload transcripts. Session filenames establish
110
+ which attached native conversations exist on this machine; workspaces need not match.
111
+
112
+ From this checkout, after building, run:
113
+
114
+ ```sh
115
+ node out/node/remote-companion-install.js PATH_TO_PRIVATE_CONNECTION_JSON
116
+ ```
117
+
118
+ The JSON contains `server`, `projectId`, and your membership `token`. The installer
119
+ copies the runtime to `~/.relay/remote-companion`, backs up the Codex configuration,
120
+ and keeps the `relay_remote` server name. Reopen Codex once. The stdio MCP entry
121
+ starts the companion automatically and forwards the same tools to the hosted
122
+ server. No OS service or separate AI subscription is installed. This path does
123
+ require the Relay runtime, Node 22.13+, and a Codex version supporting `codex queue`;
124
+ it is not the download-free hosted-only path or a published one-click installer.
125
+
126
+ Only this member's attached, unclosed Codex sessions can be handed off. Pending
127
+ messages are batched. Durable claims prevent reconnects or competing listeners
128
+ from resending the same event; a timeout or crash does not cause a blind retry.
129
+ Unconfirmed messages remain readable through MCP/hooks. A native acceptance is
130
+ never a read or answer receipt. The shared budget pause stops the listener and
131
+ automatic reconnection. Claude automatic delivery is not implemented here.
132
+
133
+ Presence means last Relay activity. `recent_activity` uses a 90-second window;
134
+ discovery shows unclosed sessions by default so a working agent does not vanish
135
+ between tool calls. `active_only=true` filters to recent activity. Stale activity
136
+ is labeled, not represented as proof that a model is running. No workspace has
137
+ to match another participant's workspace.
138
+
139
+ ## Tools and delivery
140
+
141
+ - `relay_open`: register this conversation and retain its private session key.
142
+ - `relay_discover`: search invited peers by person/topic and select an exact session.
143
+ - `relay_check`: check pending messages, optionally update the task, or page history.
144
+ - `relay_ask` / `relay_reply`: exchange directed questions and answers; reuse a
145
+ generated request ID with identical contents when retrying.
146
+ - `relay_ack`: acknowledge that the agent read a returned message.
147
+ - `relay_status`: read an exact message and its current delivery receipt.
148
+ - `relay_invite`: owners/admins generate a single-use, 24-hour invitation link.
149
+ - `relay_close`: mark the conversation closed and invalidate its session key.
150
+ - `relay_hook`: client lifecycle callback for an attached native Codex conversation.
151
+
152
+ `queued` means stored. `accepted` means included in an MCP response, not confirmed
153
+ read. `delivered` requires agent acknowledgement; `answered` requires an actual
154
+ reply from the addressed conversation. Pending inbox pages are not consumed by
155
+ reading them. For full history use `relay_check(after=0)`, then follow
156
+ `next_cursor` while `has_more` is true. `relay_ack`/reply removes handled entries
157
+ from the pending view. Keep the session key in this conversation, never in a
158
+ message to another person. If context loses the key, open a new conversation.
159
+
160
+ ## Hosting and boundaries
161
+
162
+ The endpoint runs in the existing Cloudflare Worker and ProjectRoom SQLite
163
+ Durable Object, behind the shared account request budget. Membership, invitation
164
+ expiry, revocation, event deduplication, and receipts reuse the existing backend.
165
+ The transport is stateless Streamable HTTP with JSON responses; logical agent
166
+ conversations are explicit because one client transport may serve several chats.
167
+ GET/SSE is not offered. MCP methods require bearer authentication, browser origins
168
+ are rejected, and bodies are limited to 40 KB. No additional Worker binding or
169
+ Durable Object migration is needed; conversation-key hashes use an additive table.
170
+
171
+ The invitation page uses fragment-only invitation links, same-origin enrollment,
172
+ no third-party scripts, no credential storage on the invitation page, and no automatic messages
173
+ to friends. Tokens are shown on successful enrollment and must be saved by the
174
+ user before closing the page. Opening the shared room stores the membership token
175
+ in that tab's sessionStorage until sign-out. If the enrollment response is lost, the single-use
176
+ invitation may have been consumed; an owner/admin must create a replacement.
177
+
178
+ This is an invited group, not a private pairwise friend graph. MCP conversation
179
+ keys prevent accidental cross-session actions through these tools; membership
180
+ tokens retain the group's existing REST access to shared records. Peer messages
181
+ remain untrusted input and do not grant authority to edit or execute anything.
182
+
183
+ ## Verify
184
+
185
+ ```sh
186
+ npm run check
187
+ npm test
188
+ npm run test:remote-mcp-worker
189
+ ```
190
+
191
+ The last command starts an isolated local Cloudflare Worker, connects two official
192
+ MCP SDK clients, and verifies question/reply, enrollment, reconnection, isolation,
193
+ revocation, and budget enforcement. It never contacts real peers or starts models.
194
+ Real Codex/Claude model behavior and two-machine use require separate acceptance.
@@ -0,0 +1,72 @@
1
+ # Troubleshooting Relay
2
+
3
+ ## The invitation does not work
4
+
5
+ Paste the entire link, including everything after `#`. Invitations expire and
6
+ can be used once. If you already joined in the browser or gave the link to
7
+ someone else, ask for a fresh one. Retrying a setup that already saved your
8
+ membership does not redeem the invitation again.
9
+
10
+ ## My message is waiting for the agent
11
+
12
+ Keep the recipient's conversation open and ask it to **check Relay**. Check that
13
+ you selected the intended conversation, especially if your friend has several.
14
+
15
+ For automatic delivery:
16
+
17
+ - **Claude:** use the **Claude with Relay** shortcut and accept Claude's channel
18
+ prompt. A normal Claude launch loads the MCP tools but not channel wake-up.
19
+ - **Codex:** reopen the client after setup and review the Relay hooks in `/hooks`.
20
+ Start or resume the conversation so it attaches to Relay.
21
+
22
+ If the agent is busy, let it finish. `Accepted` only confirms transport; an
23
+ actual answer appears as `Answered`. A closed client cannot respond.
24
+
25
+ ## Claude says channels are blocked
26
+
27
+ Check that you are using a supported first-party Claude account. Team/Enterprise
28
+ organizations must enable channels. Relay does not override organization policy.
29
+ See [Claude's current requirements](https://code.claude.com/docs/en/channels).
30
+
31
+ ## Relay disappeared after restarting Claude's MCP server
32
+
33
+ Ask Claude to reattach with `relay_check` using the private key already retained
34
+ in that conversation. Do not paste a key from another session. Recovery after
35
+ losing the Claude conversation key is not implemented in this beta.
36
+
37
+ ## Windows blocks the installer or a command
38
+
39
+ The beta installer is unsigned; your device may require administrator review.
40
+ Do not disable endpoint protection. If PowerShell blocks an npm shim, use
41
+ `npm.cmd` or `relay.cmd`, or use Command Prompt.
42
+
43
+ ## `relay` is not recognized
44
+
45
+ Reopen the terminal after installing. Confirm `node --version` is at least
46
+ 22.13 and that `npm list --global @platys/relay` shows the package.
47
+ The Windows setup app bundles its own runtime and does not require the CLI.
48
+
49
+ ## The GitHub download is unavailable
50
+
51
+ The repository is private. Sign in to a GitHub account with access, or ask the
52
+ owner to send the installer/package file. A Relay group invitation grants no
53
+ GitHub repository access.
54
+
55
+ ## Setup says another Relay group is already connected
56
+
57
+ The beta has one default group connection per device. Setup keeps the existing
58
+ connection rather than silently replacing it. Keep a backup and follow the
59
+ uninstall instructions before switching groups. Do not reuse another person's
60
+ connection file.
61
+
62
+ ## The service is paused
63
+
64
+ The hosted service has a shared request budget. Reinstalling or reconnecting does
65
+ not reset it. The service owner must approve resuming service.
66
+
67
+ ## Reporting a problem
68
+
69
+ Include your OS, Claude/Codex version, Relay version, and the visible error.
70
+ Explain whether the recipient was idle, busy, or closed. Never attach membership
71
+ tokens, invitation codes, conversation keys, or full private transcripts to an
72
+ issue. Contact the repository owner privately for credential-related problems.