agentmesh-ai 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/LICENSE +21 -0
- package/README.md +247 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +134 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/memory.d.ts +8 -0
- package/dist/cli/commands/memory.d.ts.map +1 -0
- package/dist/cli/commands/memory.js +40 -0
- package/dist/cli/commands/memory.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +8 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +90 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +117 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +66 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +50 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/conversation/client.d.ts +72 -0
- package/dist/conversation/client.d.ts.map +1 -0
- package/dist/conversation/client.js +245 -0
- package/dist/conversation/client.js.map +1 -0
- package/dist/conversation/index.d.ts +7 -0
- package/dist/conversation/index.d.ts.map +1 -0
- package/dist/conversation/index.js +4 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/protocol.d.ts +217 -0
- package/dist/conversation/protocol.d.ts.map +1 -0
- package/dist/conversation/protocol.js +7 -0
- package/dist/conversation/protocol.js.map +1 -0
- package/dist/conversation/recorder.d.ts +4 -0
- package/dist/conversation/recorder.d.ts.map +1 -0
- package/dist/conversation/recorder.js +60 -0
- package/dist/conversation/recorder.js.map +1 -0
- package/dist/conversation/server.d.ts +59 -0
- package/dist/conversation/server.d.ts.map +1 -0
- package/dist/conversation/server.js +529 -0
- package/dist/conversation/server.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/claude-md.d.ts +2 -0
- package/dist/integrations/claude-md.d.ts.map +1 -0
- package/dist/integrations/claude-md.js +35 -0
- package/dist/integrations/claude-md.js.map +1 -0
- package/dist/integrations/copilot.d.ts +2 -0
- package/dist/integrations/copilot.d.ts.map +1 -0
- package/dist/integrations/copilot.js +39 -0
- package/dist/integrations/copilot.js.map +1 -0
- package/dist/integrations/detect.d.ts +9 -0
- package/dist/integrations/detect.d.ts.map +1 -0
- package/dist/integrations/detect.js +34 -0
- package/dist/integrations/detect.js.map +1 -0
- package/dist/mcp/conversation-tools.d.ts +4 -0
- package/dist/mcp/conversation-tools.d.ts.map +1 -0
- package/dist/mcp/conversation-tools.js +540 -0
- package/dist/mcp/conversation-tools.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +86 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/memory-tools.d.ts +4 -0
- package/dist/mcp/memory-tools.d.ts.map +1 -0
- package/dist/mcp/memory-tools.js +195 -0
- package/dist/mcp/memory-tools.js.map +1 -0
- package/dist/mcp/resources.d.ts +3 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +23 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +6 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/merge-view.d.ts +9 -0
- package/dist/memory/merge-view.d.ts.map +1 -0
- package/dist/memory/merge-view.js +88 -0
- package/dist/memory/merge-view.js.map +1 -0
- package/dist/memory/reader.d.ts +8 -0
- package/dist/memory/reader.d.ts.map +1 -0
- package/dist/memory/reader.js +53 -0
- package/dist/memory/reader.js.map +1 -0
- package/dist/memory/schema.d.ts +154 -0
- package/dist/memory/schema.d.ts.map +1 -0
- package/dist/memory/schema.js +34 -0
- package/dist/memory/schema.js.map +1 -0
- package/dist/memory/searcher.d.ts +7 -0
- package/dist/memory/searcher.d.ts.map +1 -0
- package/dist/memory/searcher.js +49 -0
- package/dist/memory/searcher.js.map +1 -0
- package/dist/memory/secret-scanner.d.ts +21 -0
- package/dist/memory/secret-scanner.d.ts.map +1 -0
- package/dist/memory/secret-scanner.js +54 -0
- package/dist/memory/secret-scanner.js.map +1 -0
- package/dist/memory/types.d.ts +71 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +5 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory/writer.d.ts +4 -0
- package/dist/memory/writer.d.ts.map +1 -0
- package/dist/memory/writer.js +114 -0
- package/dist/memory/writer.js.map +1 -0
- package/dist/utils/git.d.ts +7 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +46 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/id.d.ts +6 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +20 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/yaml.d.ts +7 -0
- package/dist/utils/yaml.d.ts.map +1 -0
- package/dist/utils/yaml.js +50 -0
- package/dist/utils/yaml.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AgentHub Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# AgentHub
|
|
2
|
+
|
|
3
|
+
**Shared memory & conversation protocol for AI coding agents.**
|
|
4
|
+
|
|
5
|
+
You use Claude Code. Your teammate uses Cursor. Another uses Copilot. Your AIs have no idea what each other is doing. AgentHub fixes that.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npx agenthub init && npx agenthub setup
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it. Your AI now shares knowledge with every other AI on the team.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What It Does
|
|
16
|
+
|
|
17
|
+
**Shared Memory** — Each AI automatically records what it learns (APIs, decisions, gotchas). Every other AI can read it.
|
|
18
|
+
|
|
19
|
+
**Real-time Discussion** — When AIs need to align on something, they open a conversation space and discuss. Humans only step in for final decisions.
|
|
20
|
+
|
|
21
|
+
**Team Consensus** — Important decisions require all humans to vote. No single person can override the team.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. Initialize (30 seconds)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx agenthub init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Answers a few questions, creates `.agenthub/` in your project.
|
|
34
|
+
|
|
35
|
+
### 2. Configure your AI tool (1 minute)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx agenthub setup
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Auto-detects Claude Code, Cursor, Windsurf and writes their MCP config.
|
|
42
|
+
|
|
43
|
+
### 3. Invite teammates
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
"Clone the repo and run: npx agenthub setup"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
No accounts, no servers, no extra software.
|
|
50
|
+
|
|
51
|
+
### 4. Start coding
|
|
52
|
+
|
|
53
|
+
Your AI now automatically:
|
|
54
|
+
- Reads shared memory before starting work
|
|
55
|
+
- Records important knowledge after completing work
|
|
56
|
+
- Alerts you when there's a discussion or vote waiting
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## How It Works
|
|
61
|
+
|
|
62
|
+
### Shared Memory
|
|
63
|
+
|
|
64
|
+
Each AI writes to its own file. No Git conflicts, ever.
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
.agenthub/
|
|
68
|
+
├── hub.yaml # Project info + agent registry
|
|
69
|
+
├── memory/
|
|
70
|
+
│ ├── alice-claude-code.yaml # Alice's AI writes here
|
|
71
|
+
│ ├── bob-cursor.yaml # Bob's AI writes here
|
|
72
|
+
│ └── carol-copilot.yaml # Carol's AI writes here
|
|
73
|
+
└── conversations/ # Discussion logs
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
When any AI reads memory, it sees a merged view of everyone's knowledge:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
## User Service API 🔒
|
|
80
|
+
Agent: alice-claude-code (Backend Developer)
|
|
81
|
+
Status: protected
|
|
82
|
+
|
|
83
|
+
POST /api/users → register
|
|
84
|
+
POST /api/auth/login → login, returns JWT
|
|
85
|
+
GET /api/users/:id → get user info
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## UI Design System 📋
|
|
90
|
+
Agent: bob-cursor (Frontend Developer)
|
|
91
|
+
Status: proposal
|
|
92
|
+
|
|
93
|
+
shadcn/ui, Indigo primary, 8px radius, 4px spacing
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Three Levels of Knowledge
|
|
97
|
+
|
|
98
|
+
| Status | Meaning | Icon |
|
|
99
|
+
|--------|---------|------|
|
|
100
|
+
| `auto` | Routine facts (APIs, models) — recorded automatically | (none) |
|
|
101
|
+
| `proposal` | Important decision, needs team confirmation | 📋 |
|
|
102
|
+
| `protected` | Team consensus — cannot be overridden | 🔒 |
|
|
103
|
+
|
|
104
|
+
### Real-time Discussion
|
|
105
|
+
|
|
106
|
+
When your AI needs to discuss something with the team:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# One person starts the conversation space
|
|
110
|
+
npx agenthub serve
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Then any team member can say: *"Discuss database selection with the team"*
|
|
114
|
+
|
|
115
|
+
The AI handles multi-round discussion automatically — you only trigger it once.
|
|
116
|
+
|
|
117
|
+
### Team Voting
|
|
118
|
+
|
|
119
|
+
For important decisions, every human must approve:
|
|
120
|
+
|
|
121
|
+
1. AI presents options via an interactive form
|
|
122
|
+
2. Each team member's AI asks their human to vote
|
|
123
|
+
3. **All approve** → decision becomes protected
|
|
124
|
+
4. **Anyone rejects** → discussion restarts with feedback
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Works With Everything
|
|
129
|
+
|
|
130
|
+
| Tool | Integration | Experience |
|
|
131
|
+
|------|-------------|------------|
|
|
132
|
+
| Claude Code | MCP (native) | Automatic read/write/discuss |
|
|
133
|
+
| Cursor | MCP (native) | Automatic read/write/discuss |
|
|
134
|
+
| Windsurf | MCP (native) | Automatic read/write/discuss |
|
|
135
|
+
| GitHub Copilot | Instructions file | AI reads .agenthub/ on request |
|
|
136
|
+
| Any AI tool | Plain files | Human tells AI to read .agenthub/ |
|
|
137
|
+
|
|
138
|
+
AgentHub doesn't call any AI API. It's a pure protocol layer — each tool uses its own intelligence.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Use Cases
|
|
143
|
+
|
|
144
|
+
### Solo Developer (Solves AI Amnesia)
|
|
145
|
+
|
|
146
|
+
Your AI forgets everything between sessions. With AgentHub, it reads `.agenthub/memory/` and instantly recovers context.
|
|
147
|
+
|
|
148
|
+
### Team Collaboration (Zero Communication Overhead)
|
|
149
|
+
|
|
150
|
+
Alice writes the backend. Bob clones the repo — his AI already knows every API, every data model, every convention Alice established.
|
|
151
|
+
|
|
152
|
+
### Handover (Better Than Any Document)
|
|
153
|
+
|
|
154
|
+
Alice leaves the project. Her AI's memory file contains every decision, every gotcha, every "don't change this because..." — automatically accumulated over months.
|
|
155
|
+
|
|
156
|
+
### New Project (AI-First Planning)
|
|
157
|
+
|
|
158
|
+
Three people start a new project. They open a conversation space, their AIs discuss tech stack, architecture, conventions. Conclusions become protected memories. Everyone starts coding in sync.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Safety
|
|
163
|
+
|
|
164
|
+
### Secret Scanner
|
|
165
|
+
|
|
166
|
+
Before any knowledge is shared, AgentHub scans for:
|
|
167
|
+
- API keys (OpenAI, AWS, GitHub, Stripe)
|
|
168
|
+
- Passwords and tokens
|
|
169
|
+
- Private keys
|
|
170
|
+
- Database connection strings
|
|
171
|
+
- Internal URLs
|
|
172
|
+
|
|
173
|
+
High-risk content is **blocked**. Medium-risk gets a **warning**.
|
|
174
|
+
|
|
175
|
+
### Human-in-the-Loop
|
|
176
|
+
|
|
177
|
+
- Routine knowledge: AI records automatically
|
|
178
|
+
- Important proposals: AI asks human first
|
|
179
|
+
- Team constraints: requires unanimous vote
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## CLI Commands
|
|
184
|
+
|
|
185
|
+
| Command | Description |
|
|
186
|
+
|---------|-------------|
|
|
187
|
+
| `npx agenthub init` | Create .agenthub/ directory |
|
|
188
|
+
| `npx agenthub setup` | Auto-configure MCP for your AI tools |
|
|
189
|
+
| `npx agenthub serve` | Start conversation space |
|
|
190
|
+
| `npx agenthub status` | Show project memory status |
|
|
191
|
+
| `npx agenthub memory` | View/search shared memory |
|
|
192
|
+
| `npx agenthub memory -s "database"` | Search for specific info |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## MCP Tools (for AI)
|
|
197
|
+
|
|
198
|
+
| Tool | What It Does |
|
|
199
|
+
|------|-------------|
|
|
200
|
+
| `read_memory` | Read all shared knowledge |
|
|
201
|
+
| `write_memory` | Record new knowledge |
|
|
202
|
+
| `search_memory` | Search by keyword |
|
|
203
|
+
| `discuss` | Multi-round team discussion |
|
|
204
|
+
| `start_meeting` | Check attendance, start meeting |
|
|
205
|
+
| `escalate_to_human` | Team-wide vote on decisions |
|
|
206
|
+
| `vote_on_decision` | Cast vote on pending decision |
|
|
207
|
+
| `send_message` | Send single message |
|
|
208
|
+
| `get_messages` | Read messages on a topic |
|
|
209
|
+
| `save_to_memory` | Save discussion conclusion |
|
|
210
|
+
| `list_conversations` | See who's online, what's being discussed |
|
|
211
|
+
| `list_pending_decisions` | See what needs voting |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Architecture
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
.agenthub/ (files) Conversation Space (WebSocket)
|
|
219
|
+
│ │
|
|
220
|
+
│ Shared Memory │ Real-time Discussion
|
|
221
|
+
│ (Git-synced YAML) │ (Optional, ephemeral)
|
|
222
|
+
│ │
|
|
223
|
+
├── read/write locally ├── discuss, vote, meet
|
|
224
|
+
├── sync via Git ├── auto-sync memory on join
|
|
225
|
+
└── works offline └── results saved to files
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
- **Files are the source of truth** — server is just a sync layer
|
|
229
|
+
- **Server down?** Memory still works. Only real-time discussion needs it.
|
|
230
|
+
- **No AI API calls** — AgentHub is a pure protocol, not a model provider
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Protocol Specifications
|
|
235
|
+
|
|
236
|
+
For tool builders and contributors:
|
|
237
|
+
|
|
238
|
+
- [Memory Format](docs/spec/memory-format.md) — `.agenthub/` file structure
|
|
239
|
+
- [MCP Tools](docs/spec/mcp-tools.md) — tool definitions and parameters
|
|
240
|
+
- [Conversation Protocol](docs/spec/conversation-protocol.md) — WebSocket messages
|
|
241
|
+
- [Decision Protocol](docs/spec/decision-protocol.md) — voting and consensus rules
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAaA,wBAAsB,WAAW,kBAwHhC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agenthub init — Initialize .agenthub/ in the current project.
|
|
3
|
+
*/
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { mkdir } from 'node:fs/promises';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import inquirer from 'inquirer';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { writeYaml } from '../../utils/yaml.js';
|
|
10
|
+
import { isGitRepo } from '../../utils/git.js';
|
|
11
|
+
import { generateAgentId } from '../../utils/id.js';
|
|
12
|
+
export async function initCommand() {
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
const agentHubDir = join(cwd, '.agenthub');
|
|
15
|
+
// Check if already initialized
|
|
16
|
+
if (existsSync(agentHubDir)) {
|
|
17
|
+
console.log(chalk.yellow('⚠️ .agenthub/ already exists in this directory.'));
|
|
18
|
+
const { proceed } = await inquirer.prompt([{
|
|
19
|
+
type: 'confirm',
|
|
20
|
+
name: 'proceed',
|
|
21
|
+
message: 'Reinitialize?',
|
|
22
|
+
default: false,
|
|
23
|
+
}]);
|
|
24
|
+
if (!proceed)
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log('');
|
|
28
|
+
// Check for git
|
|
29
|
+
const hasGit = isGitRepo(cwd);
|
|
30
|
+
if (hasGit) {
|
|
31
|
+
console.log(chalk.dim(' Git repository detected ✓'));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(chalk.dim(' No Git repo detected (memory sync requires Git)'));
|
|
35
|
+
}
|
|
36
|
+
console.log('');
|
|
37
|
+
// Ask questions
|
|
38
|
+
const answers = await inquirer.prompt([
|
|
39
|
+
{
|
|
40
|
+
type: 'input',
|
|
41
|
+
name: 'project',
|
|
42
|
+
message: 'Project name?',
|
|
43
|
+
default: getDefaultProjectName(cwd),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'input',
|
|
47
|
+
name: 'displayName',
|
|
48
|
+
message: 'Your name?',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'list',
|
|
52
|
+
name: 'role',
|
|
53
|
+
message: 'Your role?',
|
|
54
|
+
choices: [
|
|
55
|
+
'Backend Developer',
|
|
56
|
+
'Frontend Developer',
|
|
57
|
+
'Full Stack Developer',
|
|
58
|
+
'Mobile Developer',
|
|
59
|
+
'DevOps / Infrastructure',
|
|
60
|
+
'Designer',
|
|
61
|
+
'Other',
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: 'list',
|
|
66
|
+
name: 'tool',
|
|
67
|
+
message: 'Your AI coding tool?',
|
|
68
|
+
choices: [
|
|
69
|
+
{ name: 'Claude Code', value: 'claude-code' },
|
|
70
|
+
{ name: 'Cursor', value: 'cursor' },
|
|
71
|
+
{ name: 'GitHub Copilot', value: 'copilot' },
|
|
72
|
+
{ name: 'Windsurf', value: 'windsurf' },
|
|
73
|
+
{ name: 'Codex', value: 'codex' },
|
|
74
|
+
{ name: 'Other', value: 'other' },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
]);
|
|
78
|
+
const agentId = generateAgentId(answers.displayName, answers.tool);
|
|
79
|
+
const now = new Date().toISOString();
|
|
80
|
+
// Create directories
|
|
81
|
+
await mkdir(join(agentHubDir, 'memory'), { recursive: true });
|
|
82
|
+
await mkdir(join(agentHubDir, 'conversations'), { recursive: true });
|
|
83
|
+
// Create hub.yaml
|
|
84
|
+
const hub = {
|
|
85
|
+
project: answers.project,
|
|
86
|
+
created: now,
|
|
87
|
+
version: '1.0',
|
|
88
|
+
agents: [{
|
|
89
|
+
id: agentId,
|
|
90
|
+
display_name: answers.displayName,
|
|
91
|
+
role: answers.role,
|
|
92
|
+
tool: answers.tool,
|
|
93
|
+
}],
|
|
94
|
+
};
|
|
95
|
+
await writeYaml(join(agentHubDir, 'hub.yaml'), hub);
|
|
96
|
+
// Create agent memory file (empty, ready to be written to)
|
|
97
|
+
const memoryFile = {
|
|
98
|
+
agent: agentId,
|
|
99
|
+
role: answers.role,
|
|
100
|
+
tool: answers.tool,
|
|
101
|
+
last_active: now,
|
|
102
|
+
entries: [],
|
|
103
|
+
};
|
|
104
|
+
await writeYaml(join(agentHubDir, 'memory', `${agentId}.yaml`), memoryFile);
|
|
105
|
+
// Output
|
|
106
|
+
console.log('');
|
|
107
|
+
console.log(chalk.green('✅ Created .agenthub/'));
|
|
108
|
+
console.log('');
|
|
109
|
+
console.log(chalk.dim(' .agenthub/'));
|
|
110
|
+
console.log(chalk.dim(' ├── hub.yaml'));
|
|
111
|
+
console.log(chalk.dim(' ├── memory/'));
|
|
112
|
+
console.log(chalk.dim(` │ └── ${agentId}.yaml`));
|
|
113
|
+
console.log(chalk.dim(' └── conversations/'));
|
|
114
|
+
console.log('');
|
|
115
|
+
console.log(` Your Agent ID: ${chalk.cyan(agentId)}`);
|
|
116
|
+
console.log('');
|
|
117
|
+
console.log(chalk.dim(' Next steps:'));
|
|
118
|
+
console.log(` 1. Run ${chalk.cyan('npx agenthub setup')} to configure your AI tool`);
|
|
119
|
+
if (hasGit) {
|
|
120
|
+
console.log(` 2. ${chalk.cyan('git add .agenthub/ && git commit')} to share with teammates`);
|
|
121
|
+
console.log(` 3. Tell your teammates: ${chalk.cyan('"clone and run npx agenthub setup"')}`);
|
|
122
|
+
}
|
|
123
|
+
console.log('');
|
|
124
|
+
}
|
|
125
|
+
function getDefaultProjectName(cwd) {
|
|
126
|
+
try {
|
|
127
|
+
const pkg = require(join(cwd, 'package.json'));
|
|
128
|
+
return pkg.name || cwd.split(/[\\/]/).pop() || 'my-project';
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return cwd.split(/[\\/]/).pop() || 'my-project';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,MAAM,CAAC,KAAK,UAAU,WAA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
|
1
|
+
/**
|
|
2
|
+
* agenthub memory — View or search shared memory.
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { findAgentHubDir } from '../../utils/git.js';
|
|
6
|
+
import { readAllAgentMemories } from '../../memory/reader.js';
|
|
7
|
+
import { searchMemories } from '../../memory/searcher.js';
|
|
8
|
+
import { mergeMemories, formatMergedMemories } from '../../memory/merge-view.js';
|
|
9
|
+
export async function memoryCommand(options) {
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
const agentHubDir = findAgentHubDir(cwd);
|
|
12
|
+
if (!agentHubDir) {
|
|
13
|
+
console.log(chalk.red('❌ No .agenthub/ found. Run "npx agenthub init" first.'));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const memories = await readAllAgentMemories(agentHubDir);
|
|
17
|
+
if (memories.length === 0) {
|
|
18
|
+
console.log(chalk.dim('\n No shared memories found yet.\n'));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (options.search) {
|
|
22
|
+
// Search mode
|
|
23
|
+
const results = searchMemories(memories, options.search);
|
|
24
|
+
if (results.length === 0) {
|
|
25
|
+
console.log(chalk.dim(`\n No results for "${options.search}".\n`));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.log(`\n Found ${results.length} result(s) for "${options.search}":\n`);
|
|
29
|
+
console.log(formatMergedMemories(results));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// List mode with optional filters
|
|
34
|
+
const tags = options.tags?.split(',').map(t => t.trim());
|
|
35
|
+
const merged = mergeMemories(memories, { tags, agent: options.agent });
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log(formatMergedMemories(merged));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/cli/commands/memory.ts"],"names":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AC,GAAG,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,kCAAkC;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/serve.ts"],"names":[],"mappings":"AASA,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,iBAmFvD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agenthub serve — Start the conversation space server.
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { ConversationServer } from '../../conversation/server.js';
|
|
6
|
+
import { saveConversation } from '../../conversation/recorder.js';
|
|
7
|
+
import { findAgentHubDir } from '../../utils/git.js';
|
|
8
|
+
import { networkInterfaces } from 'node:os';
|
|
9
|
+
export async function serveCommand(options) {
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
const agentHubDir = findAgentHubDir(cwd);
|
|
12
|
+
if (!agentHubDir) {
|
|
13
|
+
console.log(chalk.red('❌ No .agenthub/ found. Run "npx agenthub init" first.'));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const port = parseInt(options.port ?? '4800', 10);
|
|
17
|
+
const host = options.host ?? '0.0.0.0';
|
|
18
|
+
const server = new ConversationServer({ port, host, key: options.key });
|
|
19
|
+
// Event handlers
|
|
20
|
+
server.onAgentJoined = (agent) => {
|
|
21
|
+
console.log(chalk.green(` ✅ ${agent.displayName} (${agent.role}) joined`));
|
|
22
|
+
};
|
|
23
|
+
server.onAgentLeft = (agentId) => {
|
|
24
|
+
console.log(chalk.dim(` ← ${agentId} left`));
|
|
25
|
+
};
|
|
26
|
+
server.onMessage = (msg) => {
|
|
27
|
+
console.log(chalk.dim(` 💬 [${msg.topic}] ${msg.from.displayName}: ${msg.content.slice(0, 80)}${msg.content.length > 80 ? '...' : ''}`));
|
|
28
|
+
};
|
|
29
|
+
server.onConclusion = (conclusion) => {
|
|
30
|
+
console.log(chalk.cyan(` 📋 Conclusion on "${conclusion.topic}": ${conclusion.summary.slice(0, 80)}...`));
|
|
31
|
+
};
|
|
32
|
+
try {
|
|
33
|
+
await server.start();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.log(chalk.red(`❌ Failed to start server: ${err.message}`));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const lanIp = getLanIp();
|
|
40
|
+
console.log('');
|
|
41
|
+
console.log(chalk.green(' 🚀 Conversation space is running'));
|
|
42
|
+
console.log('');
|
|
43
|
+
console.log(` Local: ${chalk.cyan(`ws://localhost:${port}`)}`);
|
|
44
|
+
if (lanIp) {
|
|
45
|
+
console.log(` Network: ${chalk.cyan(`ws://${lanIp}:${port}`)}`);
|
|
46
|
+
}
|
|
47
|
+
console.log(` Key: ${chalk.cyan(server.key)}`);
|
|
48
|
+
console.log('');
|
|
49
|
+
console.log(chalk.dim(' Share with teammates:'));
|
|
50
|
+
console.log(chalk.dim(` Set these env vars in their MCP config:`));
|
|
51
|
+
console.log(chalk.dim(` AGENTHUB_SERVER_URL=ws://${lanIp ?? 'localhost'}:${port}`));
|
|
52
|
+
console.log(chalk.dim(` AGENTHUB_SERVER_KEY=${server.key}`));
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(chalk.dim(' Press Ctrl+C to stop'));
|
|
55
|
+
console.log('');
|
|
56
|
+
// Handle graceful shutdown
|
|
57
|
+
const shutdown = async () => {
|
|
58
|
+
console.log('');
|
|
59
|
+
console.log(chalk.dim(' Shutting down...'));
|
|
60
|
+
// Save conversation logs
|
|
61
|
+
const messages = server.allMessages;
|
|
62
|
+
const conclusions = server.allConclusions;
|
|
63
|
+
if (messages.length > 0) {
|
|
64
|
+
const topics = [...new Set(messages.map(m => m.topic))];
|
|
65
|
+
for (const topic of topics) {
|
|
66
|
+
const topicMessages = messages.filter(m => m.topic === topic);
|
|
67
|
+
const topicConclusions = conclusions.filter(c => c.topic === topic);
|
|
68
|
+
const filePath = await saveConversation(agentHubDir, topic, topicMessages, topicConclusions);
|
|
69
|
+
console.log(chalk.dim(` 📝 Saved: ${filePath}`));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
await server.stop();
|
|
73
|
+
console.log(chalk.dim(' Done.'));
|
|
74
|
+
process.exit(0);
|
|
75
|
+
};
|
|
76
|
+
process.on('SIGINT', shutdown);
|
|
77
|
+
process.on('SIGTERM', shutdown);
|
|
78
|
+
}
|
|
79
|
+
function getLanIp() {
|
|
80
|
+
const interfaces = networkInterfaces();
|
|
81
|
+
for (const name of Object.keys(interfaces)) {
|
|
82
|
+
for (const iface of interfaces[name] ?? []) {
|
|
83
|
+
if (iface.family === 'IPv4' && !iface.internal) {
|
|
84
|
+
return iface.address;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/cli/commands/serve.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