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.
Files changed (193) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/LICENSE.md +22 -0
  3. package/README.md +102 -89
  4. package/README_ko.md +82 -69
  5. package/bun.lock +360 -96
  6. package/package.json +1 -1
  7. package/packages/agent/package.json +12 -4
  8. package/packages/agent/src/connection/hub-client.ts +59 -14
  9. package/packages/agent/src/hooks/intent-hub-hooks.ts +49 -46
  10. package/packages/agent/src/plugin/intent-hub-plugin.ts +19 -17
  11. package/packages/hub/package.json +4 -3
  12. package/packages/hub/src/cli.ts +197 -23
  13. package/packages/hub/src/core/conflict-detector.ts +30 -32
  14. package/packages/hub/src/core/intent-analyzer.ts +24 -24
  15. package/packages/hub/src/core/lock-manager.ts +9 -9
  16. package/packages/hub/src/core/orchestrator.ts +64 -62
  17. package/packages/hub/src/llm/negotiation-engine.ts +40 -40
  18. package/packages/hub/src/llm/smart-analyzer.ts +32 -34
  19. package/packages/hub/src/network/diagnostics.ts +321 -0
  20. package/packages/hub/src/network/firewall.ts +171 -0
  21. package/packages/hub/src/network/index.ts +22 -0
  22. package/packages/hub/src/network/mdns.ts +211 -0
  23. package/packages/hub/src/server/hub-server.ts +33 -32
  24. package/packages/hub/src/server/message-handler.ts +25 -21
  25. package/packages/hub/src/server/smart-hub-server.ts +77 -80
  26. package/packages/hub/src/utils/network.ts +109 -0
  27. package/packages/shared/package.json +8 -3
  28. package/scripts/test-connection.ts +117 -0
  29. package/scripts/test-network.ts +195 -0
  30. package/.turbo/cache/019f5ae385027cb1-meta.json +0 -1
  31. package/.turbo/cache/019f5ae385027cb1.tar.zst +0 -0
  32. package/.turbo/cache/040af6112a552a64-meta.json +0 -1
  33. package/.turbo/cache/040af6112a552a64.tar.zst +0 -0
  34. package/.turbo/cache/11195eac3ca5c6ce-meta.json +0 -1
  35. package/.turbo/cache/11195eac3ca5c6ce.tar.zst +0 -0
  36. package/.turbo/cache/13d11166efdf11cf-meta.json +0 -1
  37. package/.turbo/cache/13d11166efdf11cf.tar.zst +0 -0
  38. package/.turbo/cache/19af1af3b136706c-meta.json +0 -1
  39. package/.turbo/cache/19af1af3b136706c.tar.zst +0 -0
  40. package/.turbo/cache/1d33efac91c05b50-meta.json +0 -1
  41. package/.turbo/cache/1d33efac91c05b50.tar.zst +0 -0
  42. package/.turbo/cache/200b85a612af2d13-meta.json +0 -1
  43. package/.turbo/cache/200b85a612af2d13.tar.zst +0 -0
  44. package/.turbo/cache/210308c9ea929858-meta.json +0 -1
  45. package/.turbo/cache/210308c9ea929858.tar.zst +0 -0
  46. package/.turbo/cache/38df8e44c617835e-meta.json +0 -1
  47. package/.turbo/cache/38df8e44c617835e.tar.zst +0 -0
  48. package/.turbo/cache/3e449de5ef60a7a0-meta.json +0 -1
  49. package/.turbo/cache/3e449de5ef60a7a0.tar.zst +0 -0
  50. package/.turbo/cache/51ff024a97c2b4f5-meta.json +0 -1
  51. package/.turbo/cache/51ff024a97c2b4f5.tar.zst +0 -0
  52. package/.turbo/cache/54bc756eeebb377a-meta.json +0 -1
  53. package/.turbo/cache/54bc756eeebb377a.tar.zst +0 -0
  54. package/.turbo/cache/5ed6a840acafc873-meta.json +0 -1
  55. package/.turbo/cache/5ed6a840acafc873.tar.zst +0 -0
  56. package/.turbo/cache/6702dc24e5ca3c2e-meta.json +0 -1
  57. package/.turbo/cache/6702dc24e5ca3c2e.tar.zst +0 -0
  58. package/.turbo/cache/725c72cf71ea854f-meta.json +0 -1
  59. package/.turbo/cache/725c72cf71ea854f.tar.zst +0 -0
  60. package/.turbo/cache/7344ca28d348037a-meta.json +0 -1
  61. package/.turbo/cache/7344ca28d348037a.tar.zst +0 -0
  62. package/.turbo/cache/748fb444cdc0b78c-meta.json +0 -1
  63. package/.turbo/cache/748fb444cdc0b78c.tar.zst +0 -0
  64. package/.turbo/cache/789677c36fe7fb98-meta.json +0 -1
  65. package/.turbo/cache/789677c36fe7fb98.tar.zst +0 -0
  66. package/.turbo/cache/89ff6c6f38dd4a18-meta.json +0 -1
  67. package/.turbo/cache/89ff6c6f38dd4a18.tar.zst +0 -0
  68. package/.turbo/cache/8dbc92d00de0c92e-meta.json +0 -1
  69. package/.turbo/cache/8dbc92d00de0c92e.tar.zst +0 -0
  70. package/.turbo/cache/8eb03f40082b9441-meta.json +0 -1
  71. package/.turbo/cache/8eb03f40082b9441.tar.zst +0 -0
  72. package/.turbo/cache/9157134d4b916017-meta.json +0 -1
  73. package/.turbo/cache/9157134d4b916017.tar.zst +0 -0
  74. package/.turbo/cache/94219ffd32b48e93-meta.json +0 -1
  75. package/.turbo/cache/94219ffd32b48e93.tar.zst +0 -0
  76. package/.turbo/cache/95c1d160b4fa84eb-meta.json +0 -1
  77. package/.turbo/cache/95c1d160b4fa84eb.tar.zst +0 -0
  78. package/.turbo/cache/998833ea02dfb225-meta.json +0 -1
  79. package/.turbo/cache/998833ea02dfb225.tar.zst +0 -0
  80. package/.turbo/cache/a5974ef6ade3eb90-meta.json +0 -1
  81. package/.turbo/cache/a5974ef6ade3eb90.tar.zst +0 -0
  82. package/.turbo/cache/aab811809257decb-meta.json +0 -1
  83. package/.turbo/cache/aab811809257decb.tar.zst +0 -0
  84. package/.turbo/cache/ab2f82a54da854fd-meta.json +0 -1
  85. package/.turbo/cache/ab2f82a54da854fd.tar.zst +0 -0
  86. package/.turbo/cache/abbf4d95d62a7303-meta.json +0 -1
  87. package/.turbo/cache/abbf4d95d62a7303.tar.zst +0 -0
  88. package/.turbo/cache/af4441f519f9ce50-meta.json +0 -1
  89. package/.turbo/cache/af4441f519f9ce50.tar.zst +0 -0
  90. package/.turbo/cache/b9b85aaaf03d00a6-meta.json +0 -1
  91. package/.turbo/cache/b9b85aaaf03d00a6.tar.zst +0 -0
  92. package/.turbo/cache/cd58ee8721bbfed7-meta.json +0 -1
  93. package/.turbo/cache/cd58ee8721bbfed7.tar.zst +0 -0
  94. package/.turbo/cache/d285e48b8afa30b5-meta.json +0 -1
  95. package/.turbo/cache/d285e48b8afa30b5.tar.zst +0 -0
  96. package/.turbo/cache/d33e90229142acce-meta.json +0 -1
  97. package/.turbo/cache/d33e90229142acce.tar.zst +0 -0
  98. package/.turbo/cache/d57839a0d3b04540-meta.json +0 -1
  99. package/.turbo/cache/d57839a0d3b04540.tar.zst +0 -0
  100. package/.turbo/cache/d8554ef2c8b6e5eb-meta.json +0 -1
  101. package/.turbo/cache/d8554ef2c8b6e5eb.tar.zst +0 -0
  102. package/.turbo/cache/dc7375b51290e102-meta.json +0 -1
  103. package/.turbo/cache/dc7375b51290e102.tar.zst +0 -0
  104. package/.turbo/cache/e5310fe547fdbf0a-meta.json +0 -1
  105. package/.turbo/cache/e5310fe547fdbf0a.tar.zst +0 -0
  106. package/.turbo/cache/f12bb5f2f188758d-meta.json +0 -1
  107. package/.turbo/cache/f12bb5f2f188758d.tar.zst +0 -0
  108. package/.turbo/cache/f2db5af0c0b4d23f-meta.json +0 -1
  109. package/.turbo/cache/f2db5af0c0b4d23f.tar.zst +0 -0
  110. package/.turbo/cache/f8935ade01a88cd7-meta.json +0 -1
  111. package/.turbo/cache/f8935ade01a88cd7.tar.zst +0 -0
  112. package/.turbo/cache/f982b8dd966f823a-meta.json +0 -1
  113. package/.turbo/cache/f982b8dd966f823a.tar.zst +0 -0
  114. package/.turbo/cache/f9d4036dd350ba1a-meta.json +0 -1
  115. package/.turbo/cache/f9d4036dd350ba1a.tar.zst +0 -0
  116. package/packages/agent/.turbo/turbo-build.log +0 -5
  117. package/packages/agent/.turbo/turbo-typecheck.log +0 -1
  118. package/packages/agent/dist/connection/hub-client.d.ts +0 -33
  119. package/packages/agent/dist/connection/hub-client.d.ts.map +0 -1
  120. package/packages/agent/dist/connection/index.d.ts +0 -2
  121. package/packages/agent/dist/connection/index.d.ts.map +0 -1
  122. package/packages/agent/dist/hooks/index.d.ts +0 -3
  123. package/packages/agent/dist/hooks/index.d.ts.map +0 -1
  124. package/packages/agent/dist/hooks/intent-hub-hooks.d.ts +0 -47
  125. package/packages/agent/dist/hooks/intent-hub-hooks.d.ts.map +0 -1
  126. package/packages/agent/dist/index.d.ts +0 -6
  127. package/packages/agent/dist/index.d.ts.map +0 -1
  128. package/packages/agent/dist/index.js +0 -3315
  129. package/packages/agent/dist/plugin/index.d.ts +0 -3
  130. package/packages/agent/dist/plugin/index.d.ts.map +0 -1
  131. package/packages/agent/dist/plugin/intent-hub-plugin.d.ts +0 -54
  132. package/packages/agent/dist/plugin/intent-hub-plugin.d.ts.map +0 -1
  133. package/packages/hub/.turbo/turbo-build.log +0 -6
  134. package/packages/hub/.turbo/turbo-typecheck.log +0 -1
  135. package/packages/hub/dist/api/dashboard.d.ts +0 -17
  136. package/packages/hub/dist/api/dashboard.d.ts.map +0 -1
  137. package/packages/hub/dist/cli.d.ts +0 -3
  138. package/packages/hub/dist/cli.d.ts.map +0 -1
  139. package/packages/hub/dist/cli.js +0 -7719
  140. package/packages/hub/dist/core/conflict-detector.d.ts +0 -36
  141. package/packages/hub/dist/core/conflict-detector.d.ts.map +0 -1
  142. package/packages/hub/dist/core/index.d.ts +0 -7
  143. package/packages/hub/dist/core/index.d.ts.map +0 -1
  144. package/packages/hub/dist/core/intent-analyzer.d.ts +0 -8
  145. package/packages/hub/dist/core/intent-analyzer.d.ts.map +0 -1
  146. package/packages/hub/dist/core/lock-manager.d.ts +0 -13
  147. package/packages/hub/dist/core/lock-manager.d.ts.map +0 -1
  148. package/packages/hub/dist/core/orchestrator.d.ts +0 -46
  149. package/packages/hub/dist/core/orchestrator.d.ts.map +0 -1
  150. package/packages/hub/dist/index.d.ts +0 -9
  151. package/packages/hub/dist/index.d.ts.map +0 -1
  152. package/packages/hub/dist/index.js +0 -4686
  153. package/packages/hub/dist/llm/index.d.ts +0 -7
  154. package/packages/hub/dist/llm/index.d.ts.map +0 -1
  155. package/packages/hub/dist/llm/negotiation-engine.d.ts +0 -40
  156. package/packages/hub/dist/llm/negotiation-engine.d.ts.map +0 -1
  157. package/packages/hub/dist/llm/provider.d.ts +0 -46
  158. package/packages/hub/dist/llm/provider.d.ts.map +0 -1
  159. package/packages/hub/dist/llm/smart-analyzer.d.ts +0 -20
  160. package/packages/hub/dist/llm/smart-analyzer.d.ts.map +0 -1
  161. package/packages/hub/dist/server/hub-server.d.ts +0 -35
  162. package/packages/hub/dist/server/hub-server.d.ts.map +0 -1
  163. package/packages/hub/dist/server/index.d.ts +0 -5
  164. package/packages/hub/dist/server/index.d.ts.map +0 -1
  165. package/packages/hub/dist/server/message-handler.d.ts +0 -18
  166. package/packages/hub/dist/server/message-handler.d.ts.map +0 -1
  167. package/packages/hub/dist/server/smart-hub-server.d.ts +0 -43
  168. package/packages/hub/dist/server/smart-hub-server.d.ts.map +0 -1
  169. package/packages/hub/dist/state/index.d.ts +0 -2
  170. package/packages/hub/dist/state/index.d.ts.map +0 -1
  171. package/packages/hub/dist/state/session-manager.d.ts +0 -19
  172. package/packages/hub/dist/state/session-manager.d.ts.map +0 -1
  173. package/packages/hub/dist/tunnel/index.d.ts +0 -14
  174. package/packages/hub/dist/tunnel/index.d.ts.map +0 -1
  175. package/packages/shared/.turbo/turbo-build.log +0 -5
  176. package/packages/shared/.turbo/turbo-typecheck.log +0 -1
  177. package/packages/shared/dist/index.d.ts +0 -3
  178. package/packages/shared/dist/index.d.ts.map +0 -1
  179. package/packages/shared/dist/index.js +0 -50
  180. package/packages/shared/dist/types/domain.d.ts +0 -50
  181. package/packages/shared/dist/types/domain.d.ts.map +0 -1
  182. package/packages/shared/dist/types/index.d.ts +0 -4
  183. package/packages/shared/dist/types/index.d.ts.map +0 -1
  184. package/packages/shared/dist/types/intent.d.ts +0 -24
  185. package/packages/shared/dist/types/intent.d.ts.map +0 -1
  186. package/packages/shared/dist/types/message.d.ts +0 -151
  187. package/packages/shared/dist/types/message.d.ts.map +0 -1
  188. package/packages/shared/dist/utils/id.d.ts +0 -6
  189. package/packages/shared/dist/utils/id.d.ts.map +0 -1
  190. package/packages/shared/dist/utils/index.d.ts +0 -3
  191. package/packages/shared/dist/utils/index.d.ts.map +0 -1
  192. package/packages/shared/dist/utils/message.d.ts +0 -5
  193. package/packages/shared/dist/utils/message.d.ts.map +0 -1
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "mcp__ide__getDiagnostics"
4
+ "mcp__ide__getDiagnostics",
5
+ "WebFetch(domain:github.com)"
5
6
  ]
6
7
  }
7
8
  }
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/anthropic-for-korea/intent-hub.git
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 '@anthropic-for-korea/intent-hub-agent';
236
+ import { HubClient } from "@jhmin/intent-hub-agent";
231
237
 
232
238
  const client = new HubClient({
233
- hubUrl: 'wss://intent-hub-a1b2c3d4.loca.lt', // Shared URL
234
- userId: 'unique-user-id',
235
- username: 'Username',
236
- projectPath: '/path/to/project',
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 | Cause | Solution |
245
- |---------|-------|----------|
246
- | Connection failed | Server not running | Run `npx intent-hub --share` |
247
- | Tunnel error | Network issue | Try `--tunnel=cloudflared` if you have cloudflared installed |
248
- | LLM error | No API key | Set `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` env var |
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 | LLM Setting | Notes |
354
- |-----------|----------------|-------------|-------|
355
- | 1-3 | Local (one developer) | Mock or OpenAI | Simple setup |
356
- | 4-10 | Dedicated team server | OpenAI or Anthropic | Stable connection needed |
357
- | 10+ | Cloud (AWS/GCP) | OpenAI + HA | Production-level |
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 '@intent-hub/agent';
373
+ import { createIntentHubHooks } from "@intent-hub/agent";
367
374
 
368
375
  const hooks = createIntentHubHooks({
369
- hubUrl: 'ws://localhost:9876',
370
- userId: 'alice',
371
- username: 'Alice',
372
- projectPath: '/path/to/project',
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: 'edit',
382
- toolInput: { filePath: 'src/auth/login.ts', content: '...' },
383
- sessionId: 'session-123',
384
- userId: 'alice',
385
- username: 'Alice',
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('Add OAuth login with Google');
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 '@intent-hub/agent';
409
+ import { HubClient } from "@intent-hub/agent";
403
410
 
404
411
  const client = new HubClient({
405
- hubUrl: 'ws://localhost:9876',
406
- userId: 'alice',
407
- username: 'Alice',
408
- projectPath: '/path/to/project',
412
+ hubUrl: "ws://localhost:9876",
413
+ userId: "alice",
414
+ username: "Alice",
415
+ projectPath: "/path/to/project",
409
416
  onConnected: (sessionId) => {
410
- console.log('Connected:', sessionId);
417
+ console.log("Connected:", sessionId);
411
418
  },
412
419
  onMessage: (message) => {
413
420
  switch (message.type) {
414
- case 'hub:lock:acquired':
415
- console.log('Lock acquired for domains:', message.payload.domains);
421
+ case "hub:lock:acquired":
422
+ console.log("Lock acquired for domains:", message.payload.domains);
416
423
  break;
417
- case 'hub:lock:blocked':
418
- console.log('Blocked by:', message.payload.blockedBy);
424
+ case "hub:lock:blocked":
425
+ console.log("Blocked by:", message.payload.blockedBy);
419
426
  break;
420
- case 'hub:negotiation:start':
421
- console.log('Negotiation started with:', message.payload.participants);
427
+ case "hub:negotiation:start":
428
+ console.log("Negotiation started with:", message.payload.participants);
422
429
  break;
423
- case 'hub:decision:required':
424
- console.log('Decision needed:', message.payload.question);
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('Implement Google OAuth login');
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('Add Google OAuth login');
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 | Result |
498
- |----------|--------|
499
- | No overlap | **Approved** - proceed immediately |
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 | **Blocked** or **Negotiation** |
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 | Description |
530
- |---------|-------------|
531
- | `agent:connect` | Initial connection with user info |
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` | User's decision on a conflict |
546
+ | `agent:decision` | User's decision on a conflict |
534
547
 
535
548
  ### Hub → Agent
536
549
 
537
- | Message | Description |
538
- |---------|-------------|
539
- | `hub:connected` | Connection confirmed with session ID |
540
- | `hub:intent:received` | Intent acknowledged |
541
- | `hub:intent:analyzed` | Analysis complete with domain info |
542
- | `hub:lock:acquired` | Lock granted, proceed with work |
543
- | `hub:lock:blocked` | Lock denied, wait or work elsewhere |
544
- | `hub:negotiation:start` | Negotiation started with another user |
545
- | `hub:negotiation:resolved` | Negotiation complete with plan |
546
- | `hub:decision:required` | User input needed |
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 | Description |
551
- |---------|-------------|
552
- | `broadcast:user:joined` | New user connected |
553
- | `broadcast:user:left` | User disconnected |
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; // WebSocket port
598
- host?: string; // Bind address (default: 0.0.0.0)
599
- llmProvider: LLMProvider; // OpenAI, Anthropic, or Mock
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; // Use LLM for intent analysis
602
- autoNegotiate?: boolean; // Auto-negotiate conflicts
603
- conflictThreshold?: 'low' | 'medium' | 'high';
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; // WebSocket URL to hub
613
- userId: string; // Unique user identifier
614
- username: string; // Display name
615
- projectPath: string; // Project root path
616
- autoConnect?: boolean; // Connect on creation (default: true)
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 | Triggers |
626
- |--------|----------|
627
- | `auth` | `/auth/`, `login`, `oauth`, `session`, `jwt` |
628
- | `user` | `/user/`, `profile`, `account` |
629
- | `payment` | `/payment/`, `checkout`, `stripe`, `billing` |
630
- | `api` | `/api/`, `route`, `endpoint` |
631
- | `ui` | `.tsx`, `.jsx`, `/component` |
632
- | `database` | `/db/`, `migration`, `schema` |
633
- | `config` | `config`, `.env` |
634
- | `test` | `.test.`, `.spec.`, `/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