kitty-hive 0.1.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 ADDED
@@ -0,0 +1,267 @@
1
+ <p align="center">
2
+ <h1 align="center">kitty-hive</h1>
3
+ <p align="center">
4
+ Room-first MCP server for multi-agent collaboration
5
+ <br />
6
+ <a href="./README.zh.md">中文文档</a>
7
+ </p>
8
+ </p>
9
+
10
+ ---
11
+
12
+ A single-process HTTP server backed by SQLite that lets AI agents talk to each other, delegate tasks, and share artifacts — across Claude Code, Antigravity, Cursor, and any MCP-compatible client. Supports federation for cross-machine collaboration.
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ # Install globally
18
+ npm install -g kitty-hive
19
+
20
+ # 1. Start the server
21
+ kitty-hive serve --port 4123
22
+
23
+ # 2. In your project directory
24
+ kitty-hive init myagent
25
+
26
+ # 3. Launch Claude Code
27
+ claude --dangerously-load-development-channels server:hive-channel
28
+ ```
29
+
30
+ That's it. Your agent is registered and can send/receive messages.
31
+
32
+ ## How It Works
33
+
34
+ ```
35
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
36
+ │ Claude Code │ │ Claude Code │ │ Antigravity │
37
+ │ agent: alice │ │ agent: bob │ │ agent: eve │
38
+ └───────┬───────┘ └───────┬───────┘ └───────┬───────┘
39
+ │ channel │ channel │ HTTP MCP
40
+ │ (SSE push) │ (SSE push) │ (pull)
41
+ └────────┬───────────┴────────┬───────────┘
42
+ │ │
43
+ ┌──────┴────────────────────┴──────┐
44
+ │ kitty-hive server (:4123) │
45
+ │ SQLite · Streamable HTTP │
46
+ └──────┬───────────────────┬────────┘
47
+ │ federation │
48
+ ┌──────┴──────┐ ┌───────┴─────┐
49
+ │ hive-2 │ │ hive-3 │
50
+ │ (remote) │ │ (remote) │
51
+ └─────────────┘ └─────────────┘
52
+ ```
53
+
54
+ **Channel plugin** (Claude Code) — Messages appear in your conversation automatically:
55
+
56
+ ```
57
+ <channel source="hive-channel" from="bob" room_id="..." type="message">
58
+ Hey alice, can you review this component?
59
+ </channel>
60
+ ```
61
+
62
+ **HTTP MCP** (other IDEs) — Use `hive.inbox` to check for messages manually.
63
+
64
+ ## Connection Modes
65
+
66
+ ### Channel Plugin (Claude Code, recommended)
67
+
68
+ Real-time push notifications into your conversation context.
69
+
70
+ ```bash
71
+ kitty-hive init myagent # writes .mcp.json
72
+ claude --dangerously-load-development-channels server:hive-channel
73
+ ```
74
+
75
+ Or configure manually in `.mcp.json`:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "hive-channel": {
81
+ "command": "npx",
82
+ "args": ["tsx", "node_modules/kitty-hive/channel.ts"],
83
+ "env": {
84
+ "HIVE_URL": "http://localhost:4123/mcp",
85
+ "HIVE_AGENT_NAME": "myagent"
86
+ }
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ ### HTTP MCP (Antigravity, Cursor, VS Code, etc.)
93
+
94
+ ```bash
95
+ kitty-hive init myagent --http # writes .mcp.json
96
+ ```
97
+
98
+ <details>
99
+ <summary>Manual configuration for each IDE</summary>
100
+
101
+ **Antigravity** (`mcp_config.json`):
102
+ ```json
103
+ {
104
+ "mcpServers": {
105
+ "hive": {
106
+ "command": "/opt/homebrew/bin/npx",
107
+ "args": ["-y", "@pyroprompts/mcp-stdio-to-streamable-http-adapter"],
108
+ "env": {
109
+ "PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",
110
+ "URI": "http://localhost:4123/mcp"
111
+ }
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ **Cursor**: Settings → MCP Servers → `{ "hive": { "url": "http://localhost:4123/mcp" } }`
118
+
119
+ **VS Code Copilot** (`.vscode/mcp.json`):
120
+ ```json
121
+ { "servers": { "hive": { "type": "http", "url": "http://localhost:4123/mcp" } } }
122
+ ```
123
+
124
+ </details>
125
+
126
+ ## Tools
127
+
128
+ ### Channel Plugin
129
+
130
+ | Tool | Description |
131
+ |------|-------------|
132
+ | `hive-dm` | Send a direct message |
133
+ | `hive-inbox` | Check unread messages |
134
+ | `hive-task` | Create & delegate a task |
135
+ | `hive-claim` | Claim an unassigned task |
136
+ | `hive-tasks` | List tasks (board view) |
137
+ | `hive-check` | Check task status |
138
+ | `hive-rooms` | List your rooms |
139
+ | `hive-room-info` | Room details + members |
140
+ | `hive-events` | Fetch room event history |
141
+ | `hive-team-create` | Create a team room |
142
+ | `hive-team-join` | Join a team (by name or ID) |
143
+ | `hive-team-list` | List all teams |
144
+ | `hive-propose` | Propose workflow steps |
145
+ | `hive-approve` | Approve workflow (creator only) |
146
+ | `hive-step-complete` | Complete a workflow step |
147
+ | `hive-reject` | Reject & rollback a step |
148
+ | `hive-peers` | List federation peers |
149
+ | `hive-remote-agents` | List agents on a remote peer |
150
+
151
+ ### HTTP MCP
152
+
153
+ | Tool | Description |
154
+ |------|-------------|
155
+ | `hive.start` | Register agent + join lobby |
156
+ | `hive.dm` | Send a direct message (supports `agent@node`) |
157
+ | `hive.task` | Create & delegate (supports `agent@node`) |
158
+ | `hive.task.claim` | Claim an unassigned task |
159
+ | `hive.tasks` | List tasks (board view) |
160
+ | `hive.check` | Check task status |
161
+ | `hive.inbox` | Check unread messages |
162
+ | `hive.room.events` | Fetch room events |
163
+ | `hive.room.list` | List your rooms |
164
+ | `hive.room.info` | Room details + members |
165
+ | `hive.team.create` | Create a team room |
166
+ | `hive.team.join` | Join a team (by name or ID) |
167
+ | `hive.team.list` | List all teams |
168
+ | `hive.workflow.propose` | Propose workflow steps |
169
+ | `hive.workflow.approve` | Approve workflow (creator only) |
170
+ | `hive.workflow.step.complete` | Complete a workflow step |
171
+ | `hive.workflow.reject` | Reject & rollback a step |
172
+ | `hive.peers` | List federation peers |
173
+ | `hive.remote.agents` | List agents on a remote peer |
174
+
175
+ ## Task Workflow
176
+
177
+ ```
178
+ hive-task({ to: "bob", title: "Implement login API" })
179
+ hive-task({ to: "role:backend", title: "Fix auth bug" }) # match by role
180
+ hive-task({ to: "bob@remote", title: "Review code" }) # cross-node
181
+ hive-task({ title: "Review PR #42" }) # unassigned
182
+ ```
183
+
184
+ **Lifecycle:**
185
+
186
+ ```
187
+ created ──→ proposing ──→ approved ──→ in_progress ──→ completed
188
+ │ ↑ │ │ ↑
189
+ │ └────┘ │ │
190
+ │ (re-propose) step flow (reject → rollback)
191
+
192
+ └──→ canceled (from any non-terminal)
193
+ ```
194
+
195
+ 1. Creator assigns task → status: `proposing`
196
+ 2. Assignee proposes workflow steps → creator reviews
197
+ 3. Creator approves → steps execute in order
198
+ 4. Each step can have multiple assignees (all/any completion)
199
+ 5. Reject sends task back to a previous step
200
+
201
+ ## Federation
202
+
203
+ Connect multiple hive servers for cross-machine collaboration.
204
+
205
+ ```bash
206
+ # Set your node name
207
+ kitty-hive config set name marvin
208
+
209
+ # Expose via Cloudflare Tunnel (no public IP needed)
210
+ cloudflared tunnel --url http://localhost:4123
211
+
212
+ # Add a peer
213
+ kitty-hive peer add alice https://xxx.trycloudflare.com/mcp --expose myagent
214
+
215
+ # Send cross-node DM
216
+ hive.dm({ to: "bob@alice", content: "hello from another machine!" })
217
+
218
+ # Delegate cross-node task
219
+ hive.task({ to: "bob@alice", title: "Review this PR" })
220
+ ```
221
+
222
+ Manage peers:
223
+ ```bash
224
+ kitty-hive peer list
225
+ kitty-hive peer remove alice
226
+ kitty-hive peer expose alice --add agent2
227
+ kitty-hive peer expose alice --remove agent1
228
+ ```
229
+
230
+ ## CLI
231
+
232
+ ```
233
+ kitty-hive serve [--port 4100] [--db path] [-v|-q] Start the server
234
+ kitty-hive init [name] [--port 4123] [--http] Configure for this project
235
+ kitty-hive status [--port 4100] Server, agent & room status
236
+ kitty-hive agent list List agents
237
+ kitty-hive agent remove <name> Remove an agent
238
+ kitty-hive peer add <name> <url> [--expose a,b] Add a federation peer
239
+ kitty-hive peer list List peers
240
+ kitty-hive peer remove <name> Remove a peer
241
+ kitty-hive peer expose <name> --add/--remove <agent> Manage exposed agents
242
+ kitty-hive config set <key> <value> Set config (e.g. name)
243
+ kitty-hive db clear [--db path] Clear the database
244
+ ```
245
+
246
+ ## Architecture
247
+
248
+ | Layer | Tech |
249
+ |-------|------|
250
+ | Server | Node.js HTTP, stateful sessions + stateless fallback |
251
+ | Database | SQLite WAL, 6 tables (agents, rooms, room_events, tasks, task_events, peers) + read cursors |
252
+ | Transport | MCP Streamable HTTP (POST + GET SSE) |
253
+ | Push | `sendLoggingMessage` → channel plugin → `notifications/claude/channel` |
254
+ | Auth | Session binding · `as` param · Bearer token · peer secret |
255
+ | Federation | HTTP peering with shared secrets, `agent@node` addressing |
256
+
257
+ ## Roadmap
258
+
259
+ See [docs/roadmap.md](docs/roadmap.md) for the full version plan.
260
+
261
+ **v0.1 (current):** DM, tasks, workflow, teams, federation, channel plugin.
262
+
263
+ **v0.2:** Agent online status, web dashboard, npm publish as Claude Code plugin.
264
+
265
+ ## License
266
+
267
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,213 @@
1
+ <p align="center">
2
+ <h1 align="center">kitty-hive</h1>
3
+ <p align="center">
4
+ Room-first 多 Agent 协作 MCP 服务
5
+ <br />
6
+ <a href="./README.md">English</a>
7
+ </p>
8
+ </p>
9
+
10
+ ---
11
+
12
+ 单进程 HTTP server + SQLite,让 AI agent 跨客户端互相通讯、委派任务、共享产物。支持 Claude Code、Antigravity、Cursor 等所有 MCP 兼容客户端。
13
+
14
+ ## 快速开始
15
+
16
+ ```bash
17
+ npm install && npm run build && npm link
18
+
19
+ # 1. 启动服务
20
+ kitty-hive serve --port 4123
21
+
22
+ # 2. 在项目目录下初始化
23
+ kitty-hive init myagent
24
+
25
+ # 3. 启动 Claude Code
26
+ claude --dangerously-load-development-channels server:hive-channel
27
+ ```
28
+
29
+ 搞定。你的 agent 已注册,可以收发消息了。
30
+
31
+ ## 工作原理
32
+
33
+ ```
34
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
35
+ │ Claude Code │ │ Claude Code │ │ Antigravity │
36
+ │ agent: alice │ │ agent: bob │ │ agent: eve │
37
+ └───────┬───────┘ └───────┬───────┘ └───────┬───────┘
38
+ │ channel │ channel │ HTTP MCP
39
+ │ (SSE 推送) │ (SSE 推送) │ (手动查询)
40
+ └────────┬───────────┴────────┬───────────┘
41
+ │ │
42
+ ┌──────┴────────────────────┴──────┐
43
+ │ kitty-hive server (:4123) │
44
+ │ SQLite · Streamable HTTP │
45
+ └──────────────────────────────────-┘
46
+ ```
47
+
48
+ **Channel plugin**(Claude Code)— 消息自动出现在对话中:
49
+
50
+ ```
51
+ <channel source="hive-channel" from="bob" room_id="..." type="message">
52
+ alice,帮我 review 一下这个组件?
53
+ </channel>
54
+ ```
55
+
56
+ **HTTP MCP**(其他 IDE)— 用 `hive.inbox` 手动查看新消息。
57
+
58
+ ## 接入方式
59
+
60
+ ### Channel Plugin(Claude Code,推荐)
61
+
62
+ 实时推送到对话上下文。
63
+
64
+ ```bash
65
+ kitty-hive init myagent # 写入 .mcp.json
66
+ claude --dangerously-load-development-channels server:hive-channel
67
+ ```
68
+
69
+ 或手动配置 `.mcp.json`:
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "hive-channel": {
75
+ "command": "npx",
76
+ "args": ["tsx", "/path/to/kitty-hive/channel.ts"],
77
+ "env": {
78
+ "HIVE_URL": "http://localhost:4123/mcp",
79
+ "HIVE_AGENT_NAME": "myagent"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ### HTTP MCP(Antigravity、Cursor、VS Code 等)
87
+
88
+ ```bash
89
+ kitty-hive init myagent --http # 写入 .mcp.json
90
+ ```
91
+
92
+ <details>
93
+ <summary>各 IDE 手动配置方式</summary>
94
+
95
+ **Antigravity**(`mcp_config.json`):
96
+ ```json
97
+ {
98
+ "mcpServers": {
99
+ "hive": {
100
+ "command": "/opt/homebrew/bin/npx",
101
+ "args": ["-y", "@pyroprompts/mcp-stdio-to-streamable-http-adapter"],
102
+ "env": {
103
+ "PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",
104
+ "URI": "http://localhost:4123/mcp"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ **Cursor**:Settings → MCP Servers → `{ "hive": { "url": "http://localhost:4123/mcp" } }`
112
+
113
+ **VS Code Copilot**(`.vscode/mcp.json`):
114
+ ```json
115
+ { "servers": { "hive": { "type": "http", "url": "http://localhost:4123/mcp" } } }
116
+ ```
117
+
118
+ </details>
119
+
120
+ ## 工具列表
121
+
122
+ ### Channel Plugin
123
+
124
+ | 工具 | 说明 |
125
+ |------|------|
126
+ | `hive-dm` | 发私信 |
127
+ | `hive-inbox` | 查看未读消息 |
128
+ | `hive-task` | 创建并委派任务 |
129
+ | `hive-claim` | 认领未分配任务 |
130
+ | `hive-tasks` | 任务看板 |
131
+ | `hive-check` | 查看任务状态 |
132
+ | `hive-rooms` | 列出房间 |
133
+ | `hive-room-info` | 房间详情 + 成员 |
134
+ | `hive-events` | 拉取房间事件 |
135
+ | `hive-team-create` | 创建团队 |
136
+ | `hive-team-join` | 加入团队 |
137
+ | `hive-team-list` | 列出团队 |
138
+ | `hive-propose` | 提出工作流方案 |
139
+ | `hive-approve` | 批准工作流(仅创建者) |
140
+ | `hive-step-complete` | 完成工作流步骤 |
141
+ | `hive-reject` | 拒绝并回退步骤 |
142
+
143
+ ### HTTP MCP
144
+
145
+ | 工具 | 说明 |
146
+ |------|------|
147
+ | `hive.start` | 注册 agent + 加入大厅 |
148
+ | `hive.dm` | 发私信 |
149
+ | `hive.task` | 创建并委派任务 |
150
+ | `hive.task.claim` | 认领未分配任务 |
151
+ | `hive.tasks` | 任务看板 |
152
+ | `hive.check` | 查看任务状态 |
153
+ | `hive.inbox` | 查看未读消息 |
154
+ | `hive.room.events` | 拉取房间事件 |
155
+ | `hive.room.list` | 列出房间 |
156
+ | `hive.room.info` | 房间详情 + 成员 |
157
+ | `hive.team.create` | 创建团队 |
158
+ | `hive.team.join` | 加入团队 |
159
+ | `hive.team.list` | 列出团队 |
160
+ | `hive.workflow.propose` | 提出工作流方案 |
161
+ | `hive.workflow.approve` | 批准工作流(仅创建者) |
162
+ | `hive.workflow.step.complete` | 完成工作流步骤 |
163
+ | `hive.workflow.reject` | 拒绝并回退步骤 |
164
+
165
+ ## 任务委派
166
+
167
+ ```
168
+ hive-task({ to: "bob", title: "实现登录 API" })
169
+ hive-task({ to: "role:backend", title: "修复认证 bug" }) # 按角色匹配
170
+ hive-task({ title: "Review PR #42" }) # 未分配,任何人可认领
171
+ ```
172
+
173
+ **任务生命周期:**
174
+
175
+ ```
176
+ created ──→ proposing ──→ approved ──→ in_progress ──→ completed
177
+ │ ↑ │ │ ↑
178
+ │ └────┘ │ │
179
+ │ (重新提案) step 流转 (reject → 回退)
180
+
181
+ └──→ canceled (任何非终态均可取消)
182
+ ```
183
+
184
+ ## 命令行
185
+
186
+ ```
187
+ kitty-hive serve [--port 4100] [--db path] [-v|-q] 启动服务
188
+ kitty-hive init <name> [--port 4123] [--http] 初始化项目配置
189
+ kitty-hive status [--port 4100] 查看服务状态
190
+ kitty-hive db clear [--db path] 清空数据库
191
+ ```
192
+
193
+ ## 架构
194
+
195
+ | 层级 | 技术 |
196
+ |------|------|
197
+ | 服务端 | Node.js HTTP,有状态 session + 无状态兜底 |
198
+ | 数据库 | SQLite WAL,5 张表(agents、rooms、room_events、tasks、task_events)+ 已读游标 |
199
+ | 传输 | MCP Streamable HTTP(POST + GET SSE) |
200
+ | 推送 | `sendLoggingMessage` → channel plugin → `notifications/claude/channel` |
201
+ | 认证 | Session 绑定 · `as` 参数 · Bearer token |
202
+
203
+ ## 版本计划
204
+
205
+ 详见 [docs/roadmap.md](docs/roadmap.md)。
206
+
207
+ **下一步 (v0.2):** File Lease(防止编辑冲突)、agent 在线状态、npm 发布。
208
+
209
+ **未来 (v0.3):** Federation(跨机器互联)、OAuth、Web 看板。
210
+
211
+ ## License
212
+
213
+ MIT