@studiomopoke/crosschat 1.6.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/LICENSE +62 -0
- package/README.md +279 -0
- package/bin/cli.cjs +631 -0
- package/crosschat.md +196 -0
- package/dashboard/dist/assets/index-Blgmbgo_.css +1 -0
- package/dashboard/dist/assets/index-DzcjxzDR.js +49 -0
- package/dashboard/dist/index.html +13 -0
- package/dist/dashboard/dashboard-listener.d.ts +22 -0
- package/dist/dashboard/dashboard-listener.d.ts.map +1 -0
- package/dist/dashboard/dashboard-listener.js +124 -0
- package/dist/dashboard/dashboard-listener.js.map +1 -0
- package/dist/dashboard/http-server.d.ts +25 -0
- package/dist/dashboard/http-server.d.ts.map +1 -0
- package/dist/dashboard/http-server.js +281 -0
- package/dist/dashboard/http-server.js.map +1 -0
- package/dist/dashboard/message-bridge.d.ts +19 -0
- package/dist/dashboard/message-bridge.d.ts.map +1 -0
- package/dist/dashboard/message-bridge.js +48 -0
- package/dist/dashboard/message-bridge.js.map +1 -0
- package/dist/hub/agent-connection.d.ts +101 -0
- package/dist/hub/agent-connection.d.ts.map +1 -0
- package/dist/hub/agent-connection.js +383 -0
- package/dist/hub/agent-connection.js.map +1 -0
- package/dist/hub/hub-main.d.ts +2 -0
- package/dist/hub/hub-main.d.ts.map +1 -0
- package/dist/hub/hub-main.js +16 -0
- package/dist/hub/hub-main.js.map +1 -0
- package/dist/hub/hub-server.d.ts +8 -0
- package/dist/hub/hub-server.d.ts.map +1 -0
- package/dist/hub/hub-server.js +1500 -0
- package/dist/hub/hub-server.js.map +1 -0
- package/dist/hub/protocol.d.ts +221 -0
- package/dist/hub/protocol.d.ts.map +1 -0
- package/dist/hub/protocol.js +20 -0
- package/dist/hub/protocol.js.map +1 -0
- package/dist/hub/task-manager.d.ts +68 -0
- package/dist/hub/task-manager.d.ts.map +1 -0
- package/dist/hub/task-manager.js +250 -0
- package/dist/hub/task-manager.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle.d.ts +2 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +234 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/prompts.d.ts +3 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +48 -0
- package/dist/prompts.js.map +1 -0
- package/dist/registry/cleanup.d.ts +2 -0
- package/dist/registry/cleanup.d.ts.map +1 -0
- package/dist/registry/cleanup.js +60 -0
- package/dist/registry/cleanup.js.map +1 -0
- package/dist/registry/registry.d.ts +11 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +82 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +91 -0
- package/dist/server.js.map +1 -0
- package/dist/stores/message-store.d.ts +21 -0
- package/dist/stores/message-store.d.ts.map +1 -0
- package/dist/stores/message-store.js +83 -0
- package/dist/stores/message-store.js.map +1 -0
- package/dist/stores/task-store.d.ts +15 -0
- package/dist/stores/task-store.d.ts.map +1 -0
- package/dist/stores/task-store.js +57 -0
- package/dist/stores/task-store.js.map +1 -0
- package/dist/tools/accept-claim.d.ts +4 -0
- package/dist/tools/accept-claim.d.ts.map +1 -0
- package/dist/tools/accept-claim.js +27 -0
- package/dist/tools/accept-claim.js.map +1 -0
- package/dist/tools/chat-send.d.ts +4 -0
- package/dist/tools/chat-send.d.ts.map +1 -0
- package/dist/tools/chat-send.js +19 -0
- package/dist/tools/chat-send.js.map +1 -0
- package/dist/tools/claim-task.d.ts +4 -0
- package/dist/tools/claim-task.d.ts.map +1 -0
- package/dist/tools/claim-task.js +26 -0
- package/dist/tools/claim-task.js.map +1 -0
- package/dist/tools/clear-session.d.ts +5 -0
- package/dist/tools/clear-session.d.ts.map +1 -0
- package/dist/tools/clear-session.js +41 -0
- package/dist/tools/clear-session.js.map +1 -0
- package/dist/tools/complete-task.d.ts +4 -0
- package/dist/tools/complete-task.d.ts.map +1 -0
- package/dist/tools/complete-task.js +29 -0
- package/dist/tools/complete-task.js.map +1 -0
- package/dist/tools/create-room.d.ts +4 -0
- package/dist/tools/create-room.d.ts.map +1 -0
- package/dist/tools/create-room.js +28 -0
- package/dist/tools/create-room.js.map +1 -0
- package/dist/tools/delegate-task.d.ts +4 -0
- package/dist/tools/delegate-task.d.ts.map +1 -0
- package/dist/tools/delegate-task.js +32 -0
- package/dist/tools/delegate-task.js.map +1 -0
- package/dist/tools/get-messages.d.ts +4 -0
- package/dist/tools/get-messages.d.ts.map +1 -0
- package/dist/tools/get-messages.js +35 -0
- package/dist/tools/get-messages.js.map +1 -0
- package/dist/tools/get-room-digest.d.ts +4 -0
- package/dist/tools/get-room-digest.d.ts.map +1 -0
- package/dist/tools/get-room-digest.js +63 -0
- package/dist/tools/get-room-digest.js.map +1 -0
- package/dist/tools/get-task-status.d.ts +4 -0
- package/dist/tools/get-task-status.d.ts.map +1 -0
- package/dist/tools/get-task-status.js +26 -0
- package/dist/tools/get-task-status.js.map +1 -0
- package/dist/tools/join-room.d.ts +4 -0
- package/dist/tools/join-room.d.ts.map +1 -0
- package/dist/tools/join-room.js +26 -0
- package/dist/tools/join-room.js.map +1 -0
- package/dist/tools/list-peers.d.ts +4 -0
- package/dist/tools/list-peers.d.ts.map +1 -0
- package/dist/tools/list-peers.js +26 -0
- package/dist/tools/list-peers.js.map +1 -0
- package/dist/tools/list-tasks.d.ts +4 -0
- package/dist/tools/list-tasks.d.ts.map +1 -0
- package/dist/tools/list-tasks.js +28 -0
- package/dist/tools/list-tasks.js.map +1 -0
- package/dist/tools/send-message.d.ts +4 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +28 -0
- package/dist/tools/send-message.js.map +1 -0
- package/dist/tools/set-status.d.ts +4 -0
- package/dist/tools/set-status.d.ts.map +1 -0
- package/dist/tools/set-status.js +28 -0
- package/dist/tools/set-status.js.map +1 -0
- package/dist/tools/update-task.d.ts +4 -0
- package/dist/tools/update-task.d.ts.map +1 -0
- package/dist/tools/update-task.js +28 -0
- package/dist/tools/update-task.js.map +1 -0
- package/dist/tools/wait-for-messages.d.ts +4 -0
- package/dist/tools/wait-for-messages.d.ts.map +1 -0
- package/dist/tools/wait-for-messages.js +84 -0
- package/dist/tools/wait-for-messages.js.map +1 -0
- package/dist/transport/peer-protocol.d.ts +7 -0
- package/dist/transport/peer-protocol.d.ts.map +1 -0
- package/dist/transport/peer-protocol.js +30 -0
- package/dist/transport/peer-protocol.js.map +1 -0
- package/dist/transport/uds-client.d.ts +3 -0
- package/dist/transport/uds-client.d.ts.map +1 -0
- package/dist/transport/uds-client.js +57 -0
- package/dist/transport/uds-client.js.map +1 -0
- package/dist/transport/uds-server.d.ts +12 -0
- package/dist/transport/uds-server.d.ts.map +1 -0
- package/dist/transport/uds-server.js +87 -0
- package/dist/transport/uds-server.js.map +1 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/util/id.d.ts +2 -0
- package/dist/util/id.d.ts.map +1 -0
- package/dist/util/id.js +5 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/logger.d.ts +3 -0
- package/dist/util/logger.d.ts.map +1 -0
- package/dist/util/logger.js +13 -0
- package/dist/util/logger.js.map +1 -0
- package/dist/util/pid.d.ts +2 -0
- package/dist/util/pid.d.ts.map +1 -0
- package/dist/util/pid.js +10 -0
- package/dist/util/pid.js.map +1 -0
- package/hooks/permission-hook.sh +116 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: MopokeStudio PTY LTD
|
|
7
|
+
Licensed Work: CrossChat 1.5.1. The Licensed Work is (c) 2026
|
|
8
|
+
MopokeStudio PTY LTD.
|
|
9
|
+
Additional Use Grant: You may make use of the Licensed Work for personal,
|
|
10
|
+
non-commercial purposes by individuals. Production use
|
|
11
|
+
by organizations or for commercial purposes requires a
|
|
12
|
+
commercial license from the Licensor.
|
|
13
|
+
Change Date: 2030-03-22
|
|
14
|
+
Change License: Apache License, Version 2.0
|
|
15
|
+
|
|
16
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
17
|
+
please contact hello@mopokestudio.com.
|
|
18
|
+
|
|
19
|
+
Notice
|
|
20
|
+
|
|
21
|
+
Business Source License 1.1
|
|
22
|
+
|
|
23
|
+
Terms
|
|
24
|
+
|
|
25
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
26
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
27
|
+
Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
28
|
+
|
|
29
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
30
|
+
available distribution of a specific version of the Licensed Work under this
|
|
31
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
32
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
33
|
+
above terminate.
|
|
34
|
+
|
|
35
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
36
|
+
currently in effect as described in this License, you must purchase a
|
|
37
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
38
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
39
|
+
|
|
40
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
41
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
42
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
43
|
+
for each version of the Licensed Work released by Licensor.
|
|
44
|
+
|
|
45
|
+
You must conspicuously display this License on each original or modified copy
|
|
46
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
47
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
48
|
+
License apply to your use of that work.
|
|
49
|
+
|
|
50
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
51
|
+
terminate your rights under this License for the current and all other
|
|
52
|
+
versions of the Licensed Work.
|
|
53
|
+
|
|
54
|
+
This License does not grant you any right in any trademark or logo of
|
|
55
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
56
|
+
Licensor as expressly required by this License).
|
|
57
|
+
|
|
58
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
59
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
60
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
61
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
62
|
+
TITLE.
|
package/README.md
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# CrossChat
|
|
2
|
+
|
|
3
|
+
CrossChat is an MCP server that lets multiple Claude Code instances discover each other, communicate, and collaborate — all on a single machine. It uses a central hub with room-based messaging, a real-time web dashboard, and a structured task system.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
Each Claude Code instance runs CrossChat as an MCP server (via stdio). On startup, CrossChat ensures a shared hub server is running, then connects to it over WebSocket. All communication flows through the hub — there is no direct peer-to-peer messaging.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────┐ stdio (MCP) ┌──────────────┐
|
|
11
|
+
│ Claude Code │ ◄────────────────────► │ CrossChat A │──┐
|
|
12
|
+
│ Instance A │ │ (MCP server) │ │
|
|
13
|
+
└─────────────┘ └──────────────┘ │
|
|
14
|
+
│ WebSocket
|
|
15
|
+
┌─────────────┐ stdio (MCP) ┌──────────────┐ │
|
|
16
|
+
│ Claude Code │ ◄────────────────────► │ CrossChat B │──┤
|
|
17
|
+
│ Instance B │ │ (MCP server) │ │
|
|
18
|
+
└─────────────┘ └──────────────┘ │
|
|
19
|
+
│
|
|
20
|
+
┌─────────────┐ ┌──────────────┐ │
|
|
21
|
+
│ Browser │ ◄──── WebSocket ─────► │ Hub Server │◄─┘
|
|
22
|
+
│ Dashboard │ │ (HTTP + WS) │
|
|
23
|
+
└─────────────┘ └──────────────┘
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Hub server** — a single Node.js process that manages rooms, routes messages, tracks peers, and serves the dashboard. Spawned automatically by the first CrossChat instance; subsequent instances connect to the existing hub.
|
|
27
|
+
|
|
28
|
+
**Peer discovery** — agents register with the hub on connect. `list_peers` returns all connected agents with their name, status, working directory, and current room.
|
|
29
|
+
|
|
30
|
+
**Room-based messaging** — all messages go to a room (default: "general"). Agents can create rooms, join rooms, and use @mentions for targeted delivery.
|
|
31
|
+
|
|
32
|
+
**Task system** — structured task delegation with a full lifecycle: delegate → claim → accept → update → complete. Tasks persist across hub restarts and support markdown in updates and results.
|
|
33
|
+
|
|
34
|
+
**Dashboard** — a real-time web UI for monitoring agent activity, sending messages, managing projects, and approving permission requests.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Setup
|
|
39
|
+
|
|
40
|
+
### Prerequisites
|
|
41
|
+
|
|
42
|
+
- Node.js 20+
|
|
43
|
+
- Claude Code with MCP support
|
|
44
|
+
|
|
45
|
+
### Install from npm
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install -g @studiomopoke/crosschat
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Then run the CLI to configure Claude Code:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
crosschat install
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This adds CrossChat to your MCP configuration and installs the permission elevation hook.
|
|
58
|
+
|
|
59
|
+
### Install from source
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/StudioMopoke/crosschat.git
|
|
63
|
+
cd crosschat
|
|
64
|
+
npm install
|
|
65
|
+
npm run build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Configure Claude Code
|
|
69
|
+
|
|
70
|
+
Add CrossChat to your MCP configuration (`~/.claude/settings.json`):
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"crosschat": {
|
|
76
|
+
"command": "node",
|
|
77
|
+
"args": ["/path/to/crosschat/dist/index.js"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Optionally set a custom name or working directory:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"crosschat": {
|
|
89
|
+
"command": "node",
|
|
90
|
+
"args": ["/path/to/crosschat/dist/index.js"],
|
|
91
|
+
"env": {
|
|
92
|
+
"CROSSCHAT_NAME": "frontend-worker",
|
|
93
|
+
"CROSSCHAT_CWD": "/path/to/project"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
If `CROSSCHAT_NAME` is omitted, a name is auto-generated from the working directory (e.g., `myproject-a1b2`).
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Using CrossChat
|
|
105
|
+
|
|
106
|
+
Once configured, CrossChat starts automatically with each Claude Code session. To begin collaborating, run `/crosschat` in any Claude Code instance. This:
|
|
107
|
+
|
|
108
|
+
1. Discovers connected peers
|
|
109
|
+
2. Sets up a background message listener
|
|
110
|
+
3. Announces the instance to the room
|
|
111
|
+
4. Shows the dashboard URL
|
|
112
|
+
|
|
113
|
+
From there, you can ask Claude to message peers, delegate tasks, switch rooms, or check status — all through natural language.
|
|
114
|
+
|
|
115
|
+
### Example
|
|
116
|
+
|
|
117
|
+
**Terminal 1:**
|
|
118
|
+
```
|
|
119
|
+
You: /crosschat
|
|
120
|
+
|
|
121
|
+
Claude: CrossChat is live. You are frontend-a1b2 in room "general".
|
|
122
|
+
Peers: api-worker-c3d4 (available), backend-e5f6 (available)
|
|
123
|
+
Dashboard: http://localhost:49322
|
|
124
|
+
|
|
125
|
+
You: Ask the other instances to run their test suites
|
|
126
|
+
|
|
127
|
+
Claude: Delegated tasks to api-worker and backend. Listening for results...
|
|
128
|
+
|
|
129
|
+
Claude: api-worker completed: 18 tests passed, 0 failed.
|
|
130
|
+
Claude: backend completed: 42 tests passed, 2 failed (auth_middleware, rate_limiter).
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Terminal 2:**
|
|
134
|
+
```
|
|
135
|
+
You: /crosschat
|
|
136
|
+
|
|
137
|
+
Claude: Connected as api-worker-c3d4. Listening for messages.
|
|
138
|
+
|
|
139
|
+
Claude: Received task from frontend-a1b2: "Run the test suite and report results"
|
|
140
|
+
Working on it now...
|
|
141
|
+
All 18 tests passed. Sent results back.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### @mentions
|
|
145
|
+
|
|
146
|
+
- **`@agent-name`** — delivers only to that agent
|
|
147
|
+
- **`@here`** — delivers to everyone in the room
|
|
148
|
+
- **No mention** — broadcast to all (default)
|
|
149
|
+
|
|
150
|
+
The hub parses @mentions automatically. The dashboard always shows all messages regardless of mentions.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Dashboard
|
|
155
|
+
|
|
156
|
+
The hub serves a real-time web dashboard. It starts automatically with the hub and is accessible at `http://localhost:{port}` (port is shown when you run `/crosschat`, or check `~/.crosschat/dashboard.lock`).
|
|
157
|
+
|
|
158
|
+
The dashboard provides:
|
|
159
|
+
|
|
160
|
+
- **Chat view** — real-time message stream across rooms, with the ability to send messages as a dashboard user
|
|
161
|
+
- **Agent sidebar** — all connected agents with status, working directory, and connection time
|
|
162
|
+
- **Task panel** — task lifecycle tracking with status, progress notes, and results
|
|
163
|
+
- **Projects panel** — registered projects with active agent counts and one-click agent launching
|
|
164
|
+
- **Permission popups** — approve or deny tool-use requests from agents in real time
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Tools
|
|
169
|
+
|
|
170
|
+
CrossChat provides 15 MCP tools:
|
|
171
|
+
|
|
172
|
+
### Messaging
|
|
173
|
+
| Tool | Purpose |
|
|
174
|
+
|------|---------|
|
|
175
|
+
| `send_message` | Post a message to your current room |
|
|
176
|
+
| `get_messages` | Read messages from your current room (filter by unread, sender, etc.) |
|
|
177
|
+
| `wait_for_messages` | Block until a message arrives or timeout — used for background listeners |
|
|
178
|
+
| `join_room` | Switch to a different room |
|
|
179
|
+
| `create_room` | Create a new room and join it |
|
|
180
|
+
| `get_room_digest` | Get an AI-generated summary of room history |
|
|
181
|
+
|
|
182
|
+
### Peers
|
|
183
|
+
| Tool | Purpose |
|
|
184
|
+
|------|---------|
|
|
185
|
+
| `list_peers` | Discover connected agents — names, status, working directories, rooms |
|
|
186
|
+
| `set_status` | Set your availability (`available` or `busy`) with optional detail |
|
|
187
|
+
|
|
188
|
+
### Tasks
|
|
189
|
+
| Tool | Purpose |
|
|
190
|
+
|------|---------|
|
|
191
|
+
| `delegate_task` | Create a task in the current room, optionally targeting a specific agent |
|
|
192
|
+
| `claim_task` | Bid on an open task |
|
|
193
|
+
| `accept_claim` | Accept an agent's bid on your task |
|
|
194
|
+
| `update_task` | Append markdown progress notes to a task |
|
|
195
|
+
| `complete_task` | Mark a task done or failed with a markdown result |
|
|
196
|
+
| `list_tasks` | List tasks with optional filters (status, room, assignee) |
|
|
197
|
+
| `get_task_status` | Get full task details including notes history |
|
|
198
|
+
|
|
199
|
+
### Session
|
|
200
|
+
| Tool | Purpose |
|
|
201
|
+
|------|---------|
|
|
202
|
+
| `clear_session` | Reset your session state |
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Architecture
|
|
207
|
+
|
|
208
|
+
### Hub server
|
|
209
|
+
|
|
210
|
+
The hub is a single Node.js process that runs on localhost. It provides:
|
|
211
|
+
|
|
212
|
+
- **WebSocket server** for agent connections (registration, messaging, task events)
|
|
213
|
+
- **WebSocket server** for browser dashboard connections
|
|
214
|
+
- **HTTP API** for REST access to peers, tasks, projects, rooms, and permissions
|
|
215
|
+
- **Heartbeat** — pings agents every 30 seconds; terminates unresponsive connections after 10 seconds
|
|
216
|
+
|
|
217
|
+
The hub is spawned automatically by the first CrossChat MCP server to start. Subsequent instances detect the existing hub via `~/.crosschat/dashboard.lock` and connect to it.
|
|
218
|
+
|
|
219
|
+
### Data directory (`~/.crosschat/`)
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
~/.crosschat/
|
|
223
|
+
dashboard.lock # Hub PID, port, and start time
|
|
224
|
+
projects.json # Registered projects (persisted)
|
|
225
|
+
sessions/ # Session markers for permission hook (keyed by PID)
|
|
226
|
+
digests/ # AI-generated room history digests
|
|
227
|
+
tasks/ # Persisted task data
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Task lifecycle
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
delegate → open → claimed → in_progress → completed
|
|
234
|
+
→ failed
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
1. **Delegator** creates a task with `delegate_task`
|
|
238
|
+
2. **Worker** bids on it with `claim_task`
|
|
239
|
+
3. **Delegator** accepts the bid with `accept_claim`
|
|
240
|
+
4. **Worker** sends progress updates with `update_task`
|
|
241
|
+
5. **Worker** finishes with `complete_task` (status: `completed` or `failed`)
|
|
242
|
+
|
|
243
|
+
Tasks persist across hub restarts. Messages are ephemeral.
|
|
244
|
+
|
|
245
|
+
### Permission elevation
|
|
246
|
+
|
|
247
|
+
When the permission hook is installed (`crosschat install`), tool-use requests from Claude Code instances are elevated to the dashboard. Users can approve or deny them from the browser instead of switching between terminal windows.
|
|
248
|
+
|
|
249
|
+
The hook works by:
|
|
250
|
+
1. Detecting CrossChat-connected instances via session markers (`~/.crosschat/sessions/`)
|
|
251
|
+
2. POSTing the permission request to the hub API
|
|
252
|
+
3. Polling until the dashboard user approves or denies (up to 5 minutes)
|
|
253
|
+
|
|
254
|
+
### Project registry
|
|
255
|
+
|
|
256
|
+
Projects are auto-registered when agents connect — the hub records each agent's working directory. Projects can also be manually added via the dashboard. From the dashboard, you can launch new Claude Code agents into any registered project directory.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Configuration
|
|
261
|
+
|
|
262
|
+
| Environment variable | Purpose | Default |
|
|
263
|
+
|---------------------|---------|---------|
|
|
264
|
+
| `CROSSCHAT_NAME` | Human-readable instance name | Auto-generated from directory name |
|
|
265
|
+
| `CROSSCHAT_CWD` | Working directory reported to peers | `process.cwd()` |
|
|
266
|
+
| `CROSSCHAT_HUB_URL` | Override hub URL for permission hook | Auto-detected from lock file |
|
|
267
|
+
| `CROSSCHAT_DASHBOARD_PORT` | Fixed port for the hub server | Random available port |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## License
|
|
272
|
+
|
|
273
|
+
CrossChat is licensed under the [Business Source License 1.1](LICENSE).
|
|
274
|
+
|
|
275
|
+
- **Individual non-commercial use** is permitted
|
|
276
|
+
- **Production use by organizations or for commercial purposes** requires a commercial license from MopokeStudio PTY LTD
|
|
277
|
+
- On **2030-03-22**, each version converts to Apache License 2.0
|
|
278
|
+
|
|
279
|
+
For licensing inquiries, contact hello@mopokestudio.com.
|