@dolusoft/claude-collab 1.10.4 → 1.11.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/README.md +106 -17
- package/dist/cli.js +313 -354
- package/dist/cli.js.map +1 -1
- package/dist/mcp-main.js +312 -353
- package/dist/mcp-main.js.map +1 -1
- package/package.json +80 -81
package/README.md
CHANGED
|
@@ -74,6 +74,64 @@ reply("<question-id>", "Returns JSON: { id, name, email }")
|
|
|
74
74
|
# Alice receives the answer
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
## Use Case: Sharing Context Between Agents
|
|
78
|
+
|
|
79
|
+
Claude Code works best when focused on a single context — one terminal per feature, service, or role. But when multiple Claude instances work in parallel, they can't share what they know.
|
|
80
|
+
|
|
81
|
+
**Claude Collab bridges that gap.** If a user told Alice Claude Code about an API key 10 messages ago, Bob Claude Code can ask Alice Claude Code directly — and Alice Claude Code answers from her own conversation context. No copy-paste. No switching tabs. The knowledge travels between agents.
|
|
82
|
+
|
|
83
|
+
Alice Claude Code and Bob Claude Code are both connected via Claude Collab. During Alice Claude Code's session, the user manually entered an API key:
|
|
84
|
+
|
|
85
|
+
> *"My API key is sk-abc123..."*
|
|
86
|
+
|
|
87
|
+
This is now part of Alice Claude Code's context. Bob Claude Code doesn't know — he's been working in a separate terminal and needs the key to make API calls.
|
|
88
|
+
|
|
89
|
+
Bob Claude Code asks Alice Claude Code directly:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
ask("alice", "What is the API key?")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Alice Claude Code's terminal receives the question, and she replies from what she already knows:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
reply("<question-id>", "sk-abc123...")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Bob Claude Code gets the answer and continues working — without the user having to repeat themselves.
|
|
102
|
+
|
|
103
|
+
```mermaid
|
|
104
|
+
sequenceDiagram
|
|
105
|
+
participant User
|
|
106
|
+
participant Alice Claude Code
|
|
107
|
+
participant Bob Claude Code
|
|
108
|
+
|
|
109
|
+
Alice Claude Code->>Alice Claude Code: peer_find()
|
|
110
|
+
Note over Alice Claude Code: UAC popup → firewall opens
|
|
111
|
+
Bob Claude Code->>Bob Claude Code: peer_find()
|
|
112
|
+
Note over Bob Claude Code: UAC popup → firewall opens
|
|
113
|
+
|
|
114
|
+
Alice Claude Code-)Bob Claude Code: UDP multicast discovery
|
|
115
|
+
Bob Claude Code-)Alice Claude Code: UDP multicast discovery
|
|
116
|
+
Alice Claude Code->>Bob Claude Code: WebSocket HELLO
|
|
117
|
+
Bob Claude Code-->>Alice Claude Code: HELLO_ACK
|
|
118
|
+
Note over Alice Claude Code,Bob Claude Code: P2P connection established
|
|
119
|
+
|
|
120
|
+
Note over Alice Claude Code: firewall closes (connection persists)
|
|
121
|
+
Note over Bob Claude Code: firewall closes (connection persists)
|
|
122
|
+
|
|
123
|
+
User->>Alice Claude Code: "My API key is sk-abc123..."
|
|
124
|
+
Note over Alice Claude Code: Stored in context
|
|
125
|
+
|
|
126
|
+
Bob Claude Code->>Alice Claude Code: ask("alice", "What is the API key?")
|
|
127
|
+
Alice Claude Code-->>Bob Claude Code: ASK_ACK
|
|
128
|
+
Note over Alice Claude Code: Question injected into terminal
|
|
129
|
+
Alice Claude Code->>Bob Claude Code: reply(questionId, "sk-abc123...")
|
|
130
|
+
Note over Bob Claude Code: Uses API key
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
77
135
|
## How it works
|
|
78
136
|
|
|
79
137
|
```
|
|
@@ -93,22 +151,18 @@ peer_find:
|
|
|
93
151
|
connect outbound to them automatically
|
|
94
152
|
```
|
|
95
153
|
|
|
96
|
-
##
|
|
154
|
+
## Limitations
|
|
97
155
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
│ └── terminal-injector/ # Injects incoming questions into Claude Code
|
|
109
|
-
└── presentation/
|
|
110
|
-
└── mcp/ # MCP server + tools
|
|
111
|
-
```
|
|
156
|
+
- **Windows only** — terminal injection uses `kernel32.dll` Win32 APIs (`AttachConsole`, `WriteConsoleInput`) compiled via PowerShell. macOS and Linux are not supported.
|
|
157
|
+
- **LAN only** — UDP multicast TTL is set to 1, so packets cannot cross routers. Does not work over the internet or VPNs that don't forward multicast.
|
|
158
|
+
- **No encryption** — peer connections use plain `ws://` WebSocket. Traffic is unencrypted on the network.
|
|
159
|
+
- **5-minute answer timeout** — if the peer does not reply within 5 minutes, `ask()` times out. The question is not retried automatically.
|
|
160
|
+
- **One queued answer per offline peer** — if a peer is offline and you reply to multiple questions from them, only the last reply is queued and delivered on reconnect.
|
|
161
|
+
- **No persistence** — all questions, answers, and history are stored in memory. Restarting the process clears everything.
|
|
162
|
+
- **No broadcast** — `ask()` targets a single peer by name. There is no tool to send a message to all peers at once.
|
|
163
|
+
- **Peer names are not unique** — if two peers join with the same name, the second connection is silently dropped.
|
|
164
|
+
|
|
165
|
+
---
|
|
112
166
|
|
|
113
167
|
## Development
|
|
114
168
|
|
|
@@ -116,8 +170,43 @@ src/
|
|
|
116
170
|
git clone https://github.com/dolusoft/claude-collab.git
|
|
117
171
|
cd claude-collab
|
|
118
172
|
pnpm install
|
|
119
|
-
pnpm build
|
|
120
|
-
pnpm
|
|
173
|
+
pnpm build # tsup → dist/mcp-main.js + dist/cli.js
|
|
174
|
+
pnpm typecheck # tsc --noEmit
|
|
175
|
+
pnpm test # vitest unit tests
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Testing locally with two peers
|
|
179
|
+
|
|
180
|
+
Open two terminals on the same machine and run:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Terminal 1
|
|
184
|
+
node dist/mcp-main.js --name alice
|
|
185
|
+
|
|
186
|
+
# Terminal 2
|
|
187
|
+
node dist/mcp-main.js --name bob
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Both nodes will bind on random ports in the `10000–19999` range and discover each other via UDP multicast automatically.
|
|
191
|
+
|
|
192
|
+
### Project structure
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
src/
|
|
196
|
+
├── infrastructure/
|
|
197
|
+
│ ├── discovery/
|
|
198
|
+
│ │ └── multicast-discovery.ts # UDP multicast (239.255.42.42:11776) + unicast reply
|
|
199
|
+
│ ├── firewall/
|
|
200
|
+
│ │ └── firewall.ts # Windows Firewall via UAC-elevated netsh
|
|
201
|
+
│ ├── p2p/
|
|
202
|
+
│ │ ├── p2p-node.ts # WS server + client + peer management
|
|
203
|
+
│ │ └── p2p-protocol.ts # Wire protocol: HELLO, ASK, ASK_ACK, ANSWER
|
|
204
|
+
│ └── terminal-injector/
|
|
205
|
+
│ └── windows-injector.ts # Injects questions into Claude Code via WriteConsoleInput
|
|
206
|
+
└── presentation/
|
|
207
|
+
└── mcp/
|
|
208
|
+
├── server.ts # MCP server setup
|
|
209
|
+
└── tools/ # ask, reply, peers, history, peer_find
|
|
121
210
|
```
|
|
122
211
|
|
|
123
212
|
## License
|