intent-hub 0.1.0 → 0.1.1
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/.claude/settings.local.json +2 -1
- package/LICENSE.md +22 -0
- package/README.md +102 -89
- package/README_ko.md +82 -69
- package/bun.lock +360 -96
- package/package.json +1 -1
- package/packages/agent/package.json +12 -4
- package/packages/agent/src/connection/hub-client.ts +59 -14
- package/packages/agent/src/hooks/intent-hub-hooks.ts +49 -46
- package/packages/agent/src/plugin/intent-hub-plugin.ts +19 -17
- package/packages/hub/package.json +4 -3
- package/packages/hub/src/cli.ts +197 -23
- package/packages/hub/src/core/conflict-detector.ts +30 -32
- package/packages/hub/src/core/intent-analyzer.ts +24 -24
- package/packages/hub/src/core/lock-manager.ts +9 -9
- package/packages/hub/src/core/orchestrator.ts +64 -62
- package/packages/hub/src/llm/negotiation-engine.ts +40 -40
- package/packages/hub/src/llm/smart-analyzer.ts +32 -34
- package/packages/hub/src/network/diagnostics.ts +321 -0
- package/packages/hub/src/network/firewall.ts +171 -0
- package/packages/hub/src/network/index.ts +22 -0
- package/packages/hub/src/network/mdns.ts +211 -0
- package/packages/hub/src/server/hub-server.ts +33 -32
- package/packages/hub/src/server/message-handler.ts +25 -21
- package/packages/hub/src/server/smart-hub-server.ts +77 -80
- package/packages/hub/src/utils/network.ts +109 -0
- package/packages/shared/package.json +8 -3
- package/scripts/test-connection.ts +117 -0
- package/scripts/test-network.ts +195 -0
- package/.turbo/cache/019f5ae385027cb1-meta.json +0 -1
- package/.turbo/cache/019f5ae385027cb1.tar.zst +0 -0
- package/.turbo/cache/040af6112a552a64-meta.json +0 -1
- package/.turbo/cache/040af6112a552a64.tar.zst +0 -0
- package/.turbo/cache/11195eac3ca5c6ce-meta.json +0 -1
- package/.turbo/cache/11195eac3ca5c6ce.tar.zst +0 -0
- package/.turbo/cache/13d11166efdf11cf-meta.json +0 -1
- package/.turbo/cache/13d11166efdf11cf.tar.zst +0 -0
- package/.turbo/cache/19af1af3b136706c-meta.json +0 -1
- package/.turbo/cache/19af1af3b136706c.tar.zst +0 -0
- package/.turbo/cache/1d33efac91c05b50-meta.json +0 -1
- package/.turbo/cache/1d33efac91c05b50.tar.zst +0 -0
- package/.turbo/cache/200b85a612af2d13-meta.json +0 -1
- package/.turbo/cache/200b85a612af2d13.tar.zst +0 -0
- package/.turbo/cache/210308c9ea929858-meta.json +0 -1
- package/.turbo/cache/210308c9ea929858.tar.zst +0 -0
- package/.turbo/cache/38df8e44c617835e-meta.json +0 -1
- package/.turbo/cache/38df8e44c617835e.tar.zst +0 -0
- package/.turbo/cache/3e449de5ef60a7a0-meta.json +0 -1
- package/.turbo/cache/3e449de5ef60a7a0.tar.zst +0 -0
- package/.turbo/cache/51ff024a97c2b4f5-meta.json +0 -1
- package/.turbo/cache/51ff024a97c2b4f5.tar.zst +0 -0
- package/.turbo/cache/54bc756eeebb377a-meta.json +0 -1
- package/.turbo/cache/54bc756eeebb377a.tar.zst +0 -0
- package/.turbo/cache/5ed6a840acafc873-meta.json +0 -1
- package/.turbo/cache/5ed6a840acafc873.tar.zst +0 -0
- package/.turbo/cache/6702dc24e5ca3c2e-meta.json +0 -1
- package/.turbo/cache/6702dc24e5ca3c2e.tar.zst +0 -0
- package/.turbo/cache/725c72cf71ea854f-meta.json +0 -1
- package/.turbo/cache/725c72cf71ea854f.tar.zst +0 -0
- package/.turbo/cache/7344ca28d348037a-meta.json +0 -1
- package/.turbo/cache/7344ca28d348037a.tar.zst +0 -0
- package/.turbo/cache/748fb444cdc0b78c-meta.json +0 -1
- package/.turbo/cache/748fb444cdc0b78c.tar.zst +0 -0
- package/.turbo/cache/789677c36fe7fb98-meta.json +0 -1
- package/.turbo/cache/789677c36fe7fb98.tar.zst +0 -0
- package/.turbo/cache/89ff6c6f38dd4a18-meta.json +0 -1
- package/.turbo/cache/89ff6c6f38dd4a18.tar.zst +0 -0
- package/.turbo/cache/8dbc92d00de0c92e-meta.json +0 -1
- package/.turbo/cache/8dbc92d00de0c92e.tar.zst +0 -0
- package/.turbo/cache/8eb03f40082b9441-meta.json +0 -1
- package/.turbo/cache/8eb03f40082b9441.tar.zst +0 -0
- package/.turbo/cache/9157134d4b916017-meta.json +0 -1
- package/.turbo/cache/9157134d4b916017.tar.zst +0 -0
- package/.turbo/cache/94219ffd32b48e93-meta.json +0 -1
- package/.turbo/cache/94219ffd32b48e93.tar.zst +0 -0
- package/.turbo/cache/95c1d160b4fa84eb-meta.json +0 -1
- package/.turbo/cache/95c1d160b4fa84eb.tar.zst +0 -0
- package/.turbo/cache/998833ea02dfb225-meta.json +0 -1
- package/.turbo/cache/998833ea02dfb225.tar.zst +0 -0
- package/.turbo/cache/a5974ef6ade3eb90-meta.json +0 -1
- package/.turbo/cache/a5974ef6ade3eb90.tar.zst +0 -0
- package/.turbo/cache/aab811809257decb-meta.json +0 -1
- package/.turbo/cache/aab811809257decb.tar.zst +0 -0
- package/.turbo/cache/ab2f82a54da854fd-meta.json +0 -1
- package/.turbo/cache/ab2f82a54da854fd.tar.zst +0 -0
- package/.turbo/cache/abbf4d95d62a7303-meta.json +0 -1
- package/.turbo/cache/abbf4d95d62a7303.tar.zst +0 -0
- package/.turbo/cache/af4441f519f9ce50-meta.json +0 -1
- package/.turbo/cache/af4441f519f9ce50.tar.zst +0 -0
- package/.turbo/cache/b9b85aaaf03d00a6-meta.json +0 -1
- package/.turbo/cache/b9b85aaaf03d00a6.tar.zst +0 -0
- package/.turbo/cache/cd58ee8721bbfed7-meta.json +0 -1
- package/.turbo/cache/cd58ee8721bbfed7.tar.zst +0 -0
- package/.turbo/cache/d285e48b8afa30b5-meta.json +0 -1
- package/.turbo/cache/d285e48b8afa30b5.tar.zst +0 -0
- package/.turbo/cache/d33e90229142acce-meta.json +0 -1
- package/.turbo/cache/d33e90229142acce.tar.zst +0 -0
- package/.turbo/cache/d57839a0d3b04540-meta.json +0 -1
- package/.turbo/cache/d57839a0d3b04540.tar.zst +0 -0
- package/.turbo/cache/d8554ef2c8b6e5eb-meta.json +0 -1
- package/.turbo/cache/d8554ef2c8b6e5eb.tar.zst +0 -0
- package/.turbo/cache/dc7375b51290e102-meta.json +0 -1
- package/.turbo/cache/dc7375b51290e102.tar.zst +0 -0
- package/.turbo/cache/e5310fe547fdbf0a-meta.json +0 -1
- package/.turbo/cache/e5310fe547fdbf0a.tar.zst +0 -0
- package/.turbo/cache/f12bb5f2f188758d-meta.json +0 -1
- package/.turbo/cache/f12bb5f2f188758d.tar.zst +0 -0
- package/.turbo/cache/f2db5af0c0b4d23f-meta.json +0 -1
- package/.turbo/cache/f2db5af0c0b4d23f.tar.zst +0 -0
- package/.turbo/cache/f8935ade01a88cd7-meta.json +0 -1
- package/.turbo/cache/f8935ade01a88cd7.tar.zst +0 -0
- package/.turbo/cache/f982b8dd966f823a-meta.json +0 -1
- package/.turbo/cache/f982b8dd966f823a.tar.zst +0 -0
- package/.turbo/cache/f9d4036dd350ba1a-meta.json +0 -1
- package/.turbo/cache/f9d4036dd350ba1a.tar.zst +0 -0
- package/packages/agent/.turbo/turbo-build.log +0 -5
- package/packages/agent/.turbo/turbo-typecheck.log +0 -1
- package/packages/agent/dist/connection/hub-client.d.ts +0 -33
- package/packages/agent/dist/connection/hub-client.d.ts.map +0 -1
- package/packages/agent/dist/connection/index.d.ts +0 -2
- package/packages/agent/dist/connection/index.d.ts.map +0 -1
- package/packages/agent/dist/hooks/index.d.ts +0 -3
- package/packages/agent/dist/hooks/index.d.ts.map +0 -1
- package/packages/agent/dist/hooks/intent-hub-hooks.d.ts +0 -47
- package/packages/agent/dist/hooks/intent-hub-hooks.d.ts.map +0 -1
- package/packages/agent/dist/index.d.ts +0 -6
- package/packages/agent/dist/index.d.ts.map +0 -1
- package/packages/agent/dist/index.js +0 -3315
- package/packages/agent/dist/plugin/index.d.ts +0 -3
- package/packages/agent/dist/plugin/index.d.ts.map +0 -1
- package/packages/agent/dist/plugin/intent-hub-plugin.d.ts +0 -54
- package/packages/agent/dist/plugin/intent-hub-plugin.d.ts.map +0 -1
- package/packages/hub/.turbo/turbo-build.log +0 -6
- package/packages/hub/.turbo/turbo-typecheck.log +0 -1
- package/packages/hub/dist/api/dashboard.d.ts +0 -17
- package/packages/hub/dist/api/dashboard.d.ts.map +0 -1
- package/packages/hub/dist/cli.d.ts +0 -3
- package/packages/hub/dist/cli.d.ts.map +0 -1
- package/packages/hub/dist/cli.js +0 -7719
- package/packages/hub/dist/core/conflict-detector.d.ts +0 -36
- package/packages/hub/dist/core/conflict-detector.d.ts.map +0 -1
- package/packages/hub/dist/core/index.d.ts +0 -7
- package/packages/hub/dist/core/index.d.ts.map +0 -1
- package/packages/hub/dist/core/intent-analyzer.d.ts +0 -8
- package/packages/hub/dist/core/intent-analyzer.d.ts.map +0 -1
- package/packages/hub/dist/core/lock-manager.d.ts +0 -13
- package/packages/hub/dist/core/lock-manager.d.ts.map +0 -1
- package/packages/hub/dist/core/orchestrator.d.ts +0 -46
- package/packages/hub/dist/core/orchestrator.d.ts.map +0 -1
- package/packages/hub/dist/index.d.ts +0 -9
- package/packages/hub/dist/index.d.ts.map +0 -1
- package/packages/hub/dist/index.js +0 -4686
- package/packages/hub/dist/llm/index.d.ts +0 -7
- package/packages/hub/dist/llm/index.d.ts.map +0 -1
- package/packages/hub/dist/llm/negotiation-engine.d.ts +0 -40
- package/packages/hub/dist/llm/negotiation-engine.d.ts.map +0 -1
- package/packages/hub/dist/llm/provider.d.ts +0 -46
- package/packages/hub/dist/llm/provider.d.ts.map +0 -1
- package/packages/hub/dist/llm/smart-analyzer.d.ts +0 -20
- package/packages/hub/dist/llm/smart-analyzer.d.ts.map +0 -1
- package/packages/hub/dist/server/hub-server.d.ts +0 -35
- package/packages/hub/dist/server/hub-server.d.ts.map +0 -1
- package/packages/hub/dist/server/index.d.ts +0 -5
- package/packages/hub/dist/server/index.d.ts.map +0 -1
- package/packages/hub/dist/server/message-handler.d.ts +0 -18
- package/packages/hub/dist/server/message-handler.d.ts.map +0 -1
- package/packages/hub/dist/server/smart-hub-server.d.ts +0 -43
- package/packages/hub/dist/server/smart-hub-server.d.ts.map +0 -1
- package/packages/hub/dist/state/index.d.ts +0 -2
- package/packages/hub/dist/state/index.d.ts.map +0 -1
- package/packages/hub/dist/state/session-manager.d.ts +0 -19
- package/packages/hub/dist/state/session-manager.d.ts.map +0 -1
- package/packages/hub/dist/tunnel/index.d.ts +0 -14
- package/packages/hub/dist/tunnel/index.d.ts.map +0 -1
- package/packages/shared/.turbo/turbo-build.log +0 -5
- package/packages/shared/.turbo/turbo-typecheck.log +0 -1
- package/packages/shared/dist/index.d.ts +0 -3
- package/packages/shared/dist/index.d.ts.map +0 -1
- package/packages/shared/dist/index.js +0 -50
- package/packages/shared/dist/types/domain.d.ts +0 -50
- package/packages/shared/dist/types/domain.d.ts.map +0 -1
- package/packages/shared/dist/types/index.d.ts +0 -4
- package/packages/shared/dist/types/index.d.ts.map +0 -1
- package/packages/shared/dist/types/intent.d.ts +0 -24
- package/packages/shared/dist/types/intent.d.ts.map +0 -1
- package/packages/shared/dist/types/message.d.ts +0 -151
- package/packages/shared/dist/types/message.d.ts.map +0 -1
- package/packages/shared/dist/utils/id.d.ts +0 -6
- package/packages/shared/dist/utils/id.d.ts.map +0 -1
- package/packages/shared/dist/utils/index.d.ts +0 -3
- package/packages/shared/dist/utils/index.d.ts.map +0 -1
- package/packages/shared/dist/utils/message.d.ts +0 -5
- package/packages/shared/dist/utils/message.d.ts.map +0 -1
package/LICENSE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Jihong Min
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
In modern teams using AI coding assistants (Cursor, GitHub Copilot, OpenCode, etc.):
|
|
39
39
|
|
|
40
40
|
- **Alice** asks her AI to "implement OAuth login"
|
|
41
|
-
- **Bob** asks his AI to "add session management"
|
|
41
|
+
- **Bob** asks his AI to "add session management"
|
|
42
42
|
- Both AIs modify `src/auth/*` simultaneously
|
|
43
43
|
- **Result**: Merge conflicts, lost work, frustration
|
|
44
44
|
|
|
45
45
|
Traditional file-level locks don't work because:
|
|
46
|
+
|
|
46
47
|
1. AI agents don't know about each other
|
|
47
48
|
2. Semantic overlap isn't always file-based
|
|
48
49
|
3. "auth" and "session" might not touch the same files but are conceptually related
|
|
@@ -179,11 +180,13 @@ That's it! Share the outputted URL with your team.
|
|
|
179
180
|
### Step 0: Check Environment with User
|
|
180
181
|
|
|
181
182
|
Ask the user:
|
|
183
|
+
|
|
182
184
|
- **LLM provider**: OpenAI API key? Anthropic API key? Or just test with mock?
|
|
183
185
|
|
|
184
186
|
### Step 1: Start Hub Server
|
|
185
187
|
|
|
186
188
|
**Option A: npx (Recommended - No installation needed):**
|
|
189
|
+
|
|
187
190
|
```bash
|
|
188
191
|
# Quick start with Live Share
|
|
189
192
|
npx intent-hub --share
|
|
@@ -191,19 +194,21 @@ npx intent-hub --share
|
|
|
191
194
|
# With OpenAI
|
|
192
195
|
OPENAI_API_KEY=sk-xxx npx intent-hub --share --llm=openai
|
|
193
196
|
|
|
194
|
-
# With Anthropic
|
|
197
|
+
# With Anthropic
|
|
195
198
|
ANTHROPIC_API_KEY=sk-ant-xxx npx intent-hub --share --llm=anthropic
|
|
196
199
|
```
|
|
197
200
|
|
|
198
201
|
**Option B: Global install:**
|
|
202
|
+
|
|
199
203
|
```bash
|
|
200
204
|
npm install -g intent-hub
|
|
201
205
|
intent-hub --share --llm=openai
|
|
202
206
|
```
|
|
203
207
|
|
|
204
208
|
**Option C: From source:**
|
|
209
|
+
|
|
205
210
|
```bash
|
|
206
|
-
git clone https://github.com/
|
|
211
|
+
git clone https://github.com/jhmin/intent-hub.git
|
|
207
212
|
cd intent-hub && bun install && bun run build
|
|
208
213
|
bun run packages/hub/dist/cli.js --share
|
|
209
214
|
```
|
|
@@ -211,6 +216,7 @@ bun run packages/hub/dist/cli.js --share
|
|
|
211
216
|
### Step 2: Share the URL
|
|
212
217
|
|
|
213
218
|
When server starts with `--share`, it outputs:
|
|
219
|
+
|
|
214
220
|
```
|
|
215
221
|
╔═══════════════════════════════════════════════════════════════╗
|
|
216
222
|
║ 🔗 SHARE YOUR SESSION ║
|
|
@@ -227,13 +233,13 @@ Copy and share this URL with your team!
|
|
|
227
233
|
Each team member's AI agent connects using:
|
|
228
234
|
|
|
229
235
|
```typescript
|
|
230
|
-
import { HubClient } from
|
|
236
|
+
import { HubClient } from "@jhmin/intent-hub-agent";
|
|
231
237
|
|
|
232
238
|
const client = new HubClient({
|
|
233
|
-
hubUrl:
|
|
234
|
-
userId:
|
|
235
|
-
username:
|
|
236
|
-
projectPath:
|
|
239
|
+
hubUrl: "wss://intent-hub-a1b2c3d4.loca.lt", // Shared URL
|
|
240
|
+
userId: "unique-user-id",
|
|
241
|
+
username: "Username",
|
|
242
|
+
projectPath: "/path/to/project",
|
|
237
243
|
});
|
|
238
244
|
|
|
239
245
|
client.connect();
|
|
@@ -241,11 +247,11 @@ client.connect();
|
|
|
241
247
|
|
|
242
248
|
### Troubleshooting
|
|
243
249
|
|
|
244
|
-
| Symptom
|
|
245
|
-
|
|
246
|
-
| Connection failed | Server not running | Run `npx intent-hub --share`
|
|
247
|
-
| Tunnel error
|
|
248
|
-
| LLM error
|
|
250
|
+
| Symptom | Cause | Solution |
|
|
251
|
+
| ----------------- | ------------------ | ------------------------------------------------------------ |
|
|
252
|
+
| Connection failed | Server not running | Run `npx intent-hub --share` |
|
|
253
|
+
| Tunnel error | Network issue | Try `--tunnel=cloudflared` if you have cloudflared installed |
|
|
254
|
+
| LLM error | No API key | Set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` env var |
|
|
249
255
|
|
|
250
256
|
---
|
|
251
257
|
|
|
@@ -311,12 +317,13 @@ Or add to project config file:
|
|
|
311
317
|
Tell your team members:
|
|
312
318
|
|
|
313
319
|
> **"Tell your Claude Code / OpenCode / Cursor this:"**
|
|
314
|
-
>
|
|
320
|
+
>
|
|
315
321
|
> "Install Intent Hub client and connect to ws://team-server:9876.
|
|
316
322
|
> My userId is 'my-unique-id' and name is 'John Doe'.
|
|
317
323
|
> GitHub: https://github.com/your-org/intent-hub"
|
|
318
324
|
|
|
319
325
|
The AI agent will automatically:
|
|
326
|
+
|
|
320
327
|
1. Install required packages
|
|
321
328
|
2. Create config files
|
|
322
329
|
3. Connect to hub server
|
|
@@ -350,11 +357,11 @@ The AI agent will automatically:
|
|
|
350
357
|
|
|
351
358
|
#### Recommended Setup by Team Size
|
|
352
359
|
|
|
353
|
-
| Team Size | Server Location
|
|
354
|
-
|
|
355
|
-
| 1-3
|
|
356
|
-
| 4-10
|
|
357
|
-
| 10+
|
|
360
|
+
| Team Size | Server Location | LLM Setting | Notes |
|
|
361
|
+
| --------- | --------------------- | ------------------- | ------------------------ |
|
|
362
|
+
| 1-3 | Local (one developer) | Mock or OpenAI | Simple setup |
|
|
363
|
+
| 4-10 | Dedicated team server | OpenAI or Anthropic | Stable connection needed |
|
|
364
|
+
| 10+ | Cloud (AWS/GCP) | OpenAI + HA | Production-level |
|
|
358
365
|
|
|
359
366
|
---
|
|
360
367
|
|
|
@@ -363,13 +370,13 @@ The AI agent will automatically:
|
|
|
363
370
|
### With OpenCode (Hooks)
|
|
364
371
|
|
|
365
372
|
```typescript
|
|
366
|
-
import { createIntentHubHooks } from
|
|
373
|
+
import { createIntentHubHooks } from "@intent-hub/agent";
|
|
367
374
|
|
|
368
375
|
const hooks = createIntentHubHooks({
|
|
369
|
-
hubUrl:
|
|
370
|
-
userId:
|
|
371
|
-
username:
|
|
372
|
-
projectPath:
|
|
376
|
+
hubUrl: "ws://localhost:9876",
|
|
377
|
+
userId: "alice",
|
|
378
|
+
username: "Alice",
|
|
379
|
+
projectPath: "/path/to/project",
|
|
373
380
|
onNotification: (event, data) => {
|
|
374
381
|
console.log(`[IntentHub] ${event}:`, data);
|
|
375
382
|
},
|
|
@@ -378,11 +385,11 @@ const hooks = createIntentHubHooks({
|
|
|
378
385
|
// In your AI agent's tool hooks:
|
|
379
386
|
// Pre-tool hook - check if action is allowed
|
|
380
387
|
const result = await hooks.preToolUse({
|
|
381
|
-
toolName:
|
|
382
|
-
toolInput: { filePath:
|
|
383
|
-
sessionId:
|
|
384
|
-
userId:
|
|
385
|
-
username:
|
|
388
|
+
toolName: "edit",
|
|
389
|
+
toolInput: { filePath: "src/auth/login.ts", content: "..." },
|
|
390
|
+
sessionId: "session-123",
|
|
391
|
+
userId: "alice",
|
|
392
|
+
username: "Alice",
|
|
386
393
|
});
|
|
387
394
|
|
|
388
395
|
if (!result.allow) {
|
|
@@ -390,7 +397,7 @@ if (!result.allow) {
|
|
|
390
397
|
}
|
|
391
398
|
|
|
392
399
|
// When user submits a prompt
|
|
393
|
-
const promptResult = await hooks.onUserPromptSubmit(
|
|
400
|
+
const promptResult = await hooks.onUserPromptSubmit("Add OAuth login with Google");
|
|
394
401
|
if (promptResult.message) {
|
|
395
402
|
console.log(promptResult.message); // Warning about locked domains
|
|
396
403
|
}
|
|
@@ -399,29 +406,29 @@ if (promptResult.message) {
|
|
|
399
406
|
### Programmatic Usage
|
|
400
407
|
|
|
401
408
|
```typescript
|
|
402
|
-
import { HubClient } from
|
|
409
|
+
import { HubClient } from "@intent-hub/agent";
|
|
403
410
|
|
|
404
411
|
const client = new HubClient({
|
|
405
|
-
hubUrl:
|
|
406
|
-
userId:
|
|
407
|
-
username:
|
|
408
|
-
projectPath:
|
|
412
|
+
hubUrl: "ws://localhost:9876",
|
|
413
|
+
userId: "alice",
|
|
414
|
+
username: "Alice",
|
|
415
|
+
projectPath: "/path/to/project",
|
|
409
416
|
onConnected: (sessionId) => {
|
|
410
|
-
console.log(
|
|
417
|
+
console.log("Connected:", sessionId);
|
|
411
418
|
},
|
|
412
419
|
onMessage: (message) => {
|
|
413
420
|
switch (message.type) {
|
|
414
|
-
case
|
|
415
|
-
console.log(
|
|
421
|
+
case "hub:lock:acquired":
|
|
422
|
+
console.log("Lock acquired for domains:", message.payload.domains);
|
|
416
423
|
break;
|
|
417
|
-
case
|
|
418
|
-
console.log(
|
|
424
|
+
case "hub:lock:blocked":
|
|
425
|
+
console.log("Blocked by:", message.payload.blockedBy);
|
|
419
426
|
break;
|
|
420
|
-
case
|
|
421
|
-
console.log(
|
|
427
|
+
case "hub:negotiation:start":
|
|
428
|
+
console.log("Negotiation started with:", message.payload.participants);
|
|
422
429
|
break;
|
|
423
|
-
case
|
|
424
|
-
console.log(
|
|
430
|
+
case "hub:decision:required":
|
|
431
|
+
console.log("Decision needed:", message.payload.question);
|
|
425
432
|
break;
|
|
426
433
|
}
|
|
427
434
|
},
|
|
@@ -430,7 +437,7 @@ const client = new HubClient({
|
|
|
430
437
|
client.connect();
|
|
431
438
|
|
|
432
439
|
// Submit intent when user gives a prompt
|
|
433
|
-
client.submitIntent(
|
|
440
|
+
client.submitIntent("Implement Google OAuth login");
|
|
434
441
|
```
|
|
435
442
|
|
|
436
443
|
## Architecture
|
|
@@ -468,18 +475,21 @@ intent-hub/
|
|
|
468
475
|
### 1. Intent Submission
|
|
469
476
|
|
|
470
477
|
When a developer gives their AI a task:
|
|
478
|
+
|
|
471
479
|
```
|
|
472
480
|
User: "Add Google OAuth login"
|
|
473
481
|
```
|
|
474
482
|
|
|
475
483
|
The agent submits this intent to Intent Hub:
|
|
484
|
+
|
|
476
485
|
```typescript
|
|
477
|
-
client.submitIntent(
|
|
486
|
+
client.submitIntent("Add Google OAuth login");
|
|
478
487
|
```
|
|
479
488
|
|
|
480
489
|
### 2. Smart Analysis
|
|
481
490
|
|
|
482
491
|
Intent Hub analyzes the intent using LLM:
|
|
492
|
+
|
|
483
493
|
```json
|
|
484
494
|
{
|
|
485
495
|
"domain": "auth",
|
|
@@ -494,27 +504,30 @@ Intent Hub analyzes the intent using LLM:
|
|
|
494
504
|
|
|
495
505
|
The system checks for semantic conflicts:
|
|
496
506
|
|
|
497
|
-
| Scenario
|
|
498
|
-
|
|
499
|
-
| No overlap
|
|
507
|
+
| Scenario | Result |
|
|
508
|
+
| -------------------------------- | -------------------------------------- |
|
|
509
|
+
| No overlap | **Approved** - proceed immediately |
|
|
500
510
|
| Same domain, different subdomain | **Warning** - may proceed with caution |
|
|
501
|
-
| Same domain, same subdomain
|
|
511
|
+
| Same domain, same subdomain | **Blocked** or **Negotiation** |
|
|
502
512
|
|
|
503
513
|
### 4. Resolution
|
|
504
514
|
|
|
505
515
|
**Auto-Approved:**
|
|
516
|
+
|
|
506
517
|
```
|
|
507
518
|
Alice: auth/oauth ✓
|
|
508
519
|
Carol: payment ✓ (different domain)
|
|
509
520
|
```
|
|
510
521
|
|
|
511
522
|
**Blocked:**
|
|
523
|
+
|
|
512
524
|
```
|
|
513
525
|
Alice: auth/oauth ✓
|
|
514
526
|
Bob: auth/session ⚠️ (same domain - blocked until Alice finishes)
|
|
515
527
|
```
|
|
516
528
|
|
|
517
529
|
**Negotiation (when enabled):**
|
|
530
|
+
|
|
518
531
|
```
|
|
519
532
|
Alice: auth/oauth
|
|
520
533
|
Bob: auth/session
|
|
@@ -526,31 +539,31 @@ Bob: auth/session
|
|
|
526
539
|
|
|
527
540
|
### Agent → Hub
|
|
528
541
|
|
|
529
|
-
| Message
|
|
530
|
-
|
|
531
|
-
| `agent:connect`
|
|
542
|
+
| Message | Description |
|
|
543
|
+
| --------------------- | --------------------------------- |
|
|
544
|
+
| `agent:connect` | Initial connection with user info |
|
|
532
545
|
| `agent:intent:submit` | Submit a new intent (user prompt) |
|
|
533
|
-
| `agent:decision`
|
|
546
|
+
| `agent:decision` | User's decision on a conflict |
|
|
534
547
|
|
|
535
548
|
### Hub → Agent
|
|
536
549
|
|
|
537
|
-
| Message
|
|
538
|
-
|
|
539
|
-
| `hub:connected`
|
|
540
|
-
| `hub:intent:received`
|
|
541
|
-
| `hub:intent:analyzed`
|
|
542
|
-
| `hub:lock:acquired`
|
|
543
|
-
| `hub:lock:blocked`
|
|
544
|
-
| `hub:negotiation:start`
|
|
545
|
-
| `hub:negotiation:resolved` | Negotiation complete with plan
|
|
546
|
-
| `hub:decision:required`
|
|
550
|
+
| Message | Description |
|
|
551
|
+
| -------------------------- | ------------------------------------- |
|
|
552
|
+
| `hub:connected` | Connection confirmed with session ID |
|
|
553
|
+
| `hub:intent:received` | Intent acknowledged |
|
|
554
|
+
| `hub:intent:analyzed` | Analysis complete with domain info |
|
|
555
|
+
| `hub:lock:acquired` | Lock granted, proceed with work |
|
|
556
|
+
| `hub:lock:blocked` | Lock denied, wait or work elsewhere |
|
|
557
|
+
| `hub:negotiation:start` | Negotiation started with another user |
|
|
558
|
+
| `hub:negotiation:resolved` | Negotiation complete with plan |
|
|
559
|
+
| `hub:decision:required` | User input needed |
|
|
547
560
|
|
|
548
561
|
### Broadcasts
|
|
549
562
|
|
|
550
|
-
| Message
|
|
551
|
-
|
|
552
|
-
| `broadcast:user:joined` | New user connected
|
|
553
|
-
| `broadcast:user:left`
|
|
563
|
+
| Message | Description |
|
|
564
|
+
| ----------------------- | ------------------- |
|
|
565
|
+
| `broadcast:user:joined` | New user connected |
|
|
566
|
+
| `broadcast:user:left` | User disconnected |
|
|
554
567
|
| `broadcast:lock:update` | Lock status changed |
|
|
555
568
|
|
|
556
569
|
## Development
|
|
@@ -594,13 +607,13 @@ bun run typecheck
|
|
|
594
607
|
|
|
595
608
|
```typescript
|
|
596
609
|
interface SmartHubServerOptions {
|
|
597
|
-
port: number;
|
|
598
|
-
host?: string;
|
|
599
|
-
llmProvider: LLMProvider;
|
|
610
|
+
port: number; // WebSocket port
|
|
611
|
+
host?: string; // Bind address (default: 0.0.0.0)
|
|
612
|
+
llmProvider: LLMProvider; // OpenAI, Anthropic, or Mock
|
|
600
613
|
orchestratorConfig?: {
|
|
601
|
-
useLLMAnalysis?: boolean;
|
|
602
|
-
autoNegotiate?: boolean;
|
|
603
|
-
conflictThreshold?:
|
|
614
|
+
useLLMAnalysis?: boolean; // Use LLM for intent analysis
|
|
615
|
+
autoNegotiate?: boolean; // Auto-negotiate conflicts
|
|
616
|
+
conflictThreshold?: "low" | "medium" | "high";
|
|
604
617
|
};
|
|
605
618
|
}
|
|
606
619
|
```
|
|
@@ -609,11 +622,11 @@ interface SmartHubServerOptions {
|
|
|
609
622
|
|
|
610
623
|
```typescript
|
|
611
624
|
interface IntentHubHooksConfig {
|
|
612
|
-
hubUrl: string;
|
|
613
|
-
userId: string;
|
|
614
|
-
username: string;
|
|
615
|
-
projectPath: string;
|
|
616
|
-
autoConnect?: boolean;
|
|
625
|
+
hubUrl: string; // WebSocket URL to hub
|
|
626
|
+
userId: string; // Unique user identifier
|
|
627
|
+
username: string; // Display name
|
|
628
|
+
projectPath: string; // Project root path
|
|
629
|
+
autoConnect?: boolean; // Connect on creation (default: true)
|
|
617
630
|
onNotification?: (event: string, data: unknown) => void;
|
|
618
631
|
}
|
|
619
632
|
```
|
|
@@ -622,16 +635,16 @@ interface IntentHubHooksConfig {
|
|
|
622
635
|
|
|
623
636
|
Intent Hub automatically categorizes work into semantic domains:
|
|
624
637
|
|
|
625
|
-
| Domain
|
|
626
|
-
|
|
627
|
-
| `auth`
|
|
628
|
-
| `user`
|
|
629
|
-
| `payment`
|
|
630
|
-
| `api`
|
|
631
|
-
| `ui`
|
|
632
|
-
| `database` | `/db/`, `migration`, `schema`
|
|
633
|
-
| `config`
|
|
634
|
-
| `test`
|
|
638
|
+
| Domain | Triggers |
|
|
639
|
+
| ---------- | -------------------------------------------- |
|
|
640
|
+
| `auth` | `/auth/`, `login`, `oauth`, `session`, `jwt` |
|
|
641
|
+
| `user` | `/user/`, `profile`, `account` |
|
|
642
|
+
| `payment` | `/payment/`, `checkout`, `stripe`, `billing` |
|
|
643
|
+
| `api` | `/api/`, `route`, `endpoint` |
|
|
644
|
+
| `ui` | `.tsx`, `.jsx`, `/component` |
|
|
645
|
+
| `database` | `/db/`, `migration`, `schema` |
|
|
646
|
+
| `config` | `config`, `.env` |
|
|
647
|
+
| `test` | `.test.`, `.spec.`, `/test/` |
|
|
635
648
|
|
|
636
649
|
Custom domains can be configured based on your project structure.
|
|
637
650
|
|