slashvibe-mcp 0.4.10 → 0.5.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.
Files changed (246) hide show
  1. package/README.md +136 -68
  2. package/analytics.js +1 -25
  3. package/auth-store.js +158 -0
  4. package/auto-update.js +15 -10
  5. package/bridges/bridge-monitor.js +388 -0
  6. package/bridges/discord-bot.js +431 -0
  7. package/bridges/farcaster.js +299 -0
  8. package/bridges/telegram.js +261 -0
  9. package/bridges/webhook-health.js +420 -0
  10. package/bridges/webhook-server.js +437 -0
  11. package/bridges/whatsapp.js +441 -0
  12. package/bridges/x-webhook.js +423 -0
  13. package/cli.js +38 -0
  14. package/config.js +70 -44
  15. package/crypto.js +6 -1
  16. package/discord.js +170 -0
  17. package/games/arcade.js +406 -0
  18. package/games/chess.js +451 -0
  19. package/games/colorguess.js +343 -0
  20. package/games/crossword-words.js +171 -0
  21. package/games/crossword.js +461 -0
  22. package/games/drawing.js +347 -0
  23. package/games/gameroulette.js +300 -0
  24. package/games/gamerouter.js +336 -0
  25. package/games/gamestatus.js +337 -0
  26. package/games/guessnumber.js +209 -0
  27. package/games/hangman.js +279 -0
  28. package/games/memory.js +338 -0
  29. package/games/multiplayer-tictactoe.js +389 -0
  30. package/games/pixelart.js +399 -0
  31. package/games/quickduel.js +354 -0
  32. package/games/riddle.js +371 -0
  33. package/games/rockpaperscissors.js +291 -0
  34. package/games/snake.js +406 -0
  35. package/games/storybuilder.js +343 -0
  36. package/games/tictactoe.js +345 -0
  37. package/games/twentyquestions.js +286 -0
  38. package/games/twotruths.js +207 -0
  39. package/games/werewolf.js +508 -0
  40. package/games/wordassociation.js +247 -0
  41. package/games/wordchain.js +135 -0
  42. package/hooks/check-guest-messages.js +121 -0
  43. package/hooks/check-guest-messages.sh +204 -0
  44. package/index.js +228 -123
  45. package/intelligence/index.js +23 -1
  46. package/intelligence/infer.js +16 -10
  47. package/intelligence/interests.js +369 -0
  48. package/intelligence/patterns.js +651 -0
  49. package/intelligence/proactive.js +358 -0
  50. package/intelligence/serendipity.js +20 -57
  51. package/memory.js +166 -0
  52. package/notification-emitter.js +2 -2
  53. package/notify.js +76 -39
  54. package/package.json +36 -56
  55. package/presence.js +50 -39
  56. package/prompts.js +9 -5
  57. package/protocol/index.js +500 -0
  58. package/protocol/telegram-commands.js +199 -0
  59. package/setup.js +474 -0
  60. package/smart-inbox.js +276 -0
  61. package/store/api.js +528 -401
  62. package/store/index.js +0 -0
  63. package/store/local.js +10 -9
  64. package/store/profiles.js +435 -0
  65. package/store/reservations.js +321 -0
  66. package/store/skills.js +378 -0
  67. package/tools/_actions.js +749 -13
  68. package/tools/_connection-queue.js +257 -0
  69. package/tools/_deprecated/auto-suggest-connections.js +304 -0
  70. package/tools/_deprecated/away.js +68 -0
  71. package/tools/_deprecated/back.js +51 -0
  72. package/tools/_deprecated/bootstrap-skills.js +231 -0
  73. package/tools/_deprecated/bridge-dashboard.js +342 -0
  74. package/tools/_deprecated/bridge-health.js +400 -0
  75. package/tools/_deprecated/bridge-live.js +384 -0
  76. package/tools/_deprecated/bridges.js +383 -0
  77. package/tools/_deprecated/colorguess.js +281 -0
  78. package/tools/_deprecated/discover-insights.js +379 -0
  79. package/tools/_deprecated/discover-momentum.js +256 -0
  80. package/tools/_deprecated/discovery-analytics.js +345 -0
  81. package/tools/_deprecated/discovery-auto-suggest.js +275 -0
  82. package/tools/_deprecated/discovery-bootstrap.js +267 -0
  83. package/tools/_deprecated/discovery-daily.js +375 -0
  84. package/tools/_deprecated/discovery-dashboard.js +385 -0
  85. package/tools/_deprecated/discovery-digest.js +314 -0
  86. package/tools/_deprecated/discovery-hub.js +357 -0
  87. package/tools/_deprecated/discovery-insights.js +384 -0
  88. package/tools/_deprecated/discovery-momentum.js +281 -0
  89. package/tools/_deprecated/discovery-monitor.js +319 -0
  90. package/tools/_deprecated/discovery-proactive.js +300 -0
  91. package/tools/_deprecated/draw.js +317 -0
  92. package/tools/_deprecated/farcaster.js +307 -0
  93. package/tools/_deprecated/forget.js +119 -0
  94. package/tools/_deprecated/games-catalog.js +376 -0
  95. package/tools/_deprecated/games.js +313 -0
  96. package/tools/_deprecated/guessnumber.js +194 -0
  97. package/tools/_deprecated/hangman.js +129 -0
  98. package/tools/_deprecated/multiplayer-tictactoe.js +303 -0
  99. package/tools/_deprecated/mute.js +97 -0
  100. package/tools/_deprecated/recall.js +147 -0
  101. package/tools/_deprecated/remember.js +86 -0
  102. package/tools/_deprecated/riddle.js +240 -0
  103. package/tools/_deprecated/run-bootstrap.js +69 -0
  104. package/tools/_deprecated/skills-analytics.js +349 -0
  105. package/tools/_deprecated/skills-bootstrap.js +301 -0
  106. package/tools/_deprecated/skills-dashboard.js +268 -0
  107. package/tools/_deprecated/skills-exchange.js +342 -0
  108. package/tools/_deprecated/skills.js +380 -0
  109. package/tools/_deprecated/smart-intro.js +353 -0
  110. package/tools/_deprecated/storybuilder.js +331 -0
  111. package/tools/_deprecated/telegram-bot.js +183 -0
  112. package/tools/_deprecated/telegram-setup.js +214 -0
  113. package/tools/_deprecated/tictactoe.js +155 -0
  114. package/tools/_deprecated/twentyquestions.js +143 -0
  115. package/tools/_deprecated/wordassociation.js +247 -0
  116. package/tools/_discovery-enhanced.js +290 -0
  117. package/tools/_discovery.js +439 -0
  118. package/tools/_proactive-discovery.js +301 -0
  119. package/tools/_shared/index.js +64 -41
  120. package/tools/_shared.js +234 -0
  121. package/tools/_work-context.js +338 -0
  122. package/tools/_work-context.manual-test.js +199 -0
  123. package/tools/_work-context.test.js +260 -0
  124. package/tools/activity.js +220 -0
  125. package/tools/admin-inbox.js +218 -0
  126. package/tools/agent-treasury.js +288 -0
  127. package/tools/agents.js +122 -0
  128. package/tools/analytics.js +191 -0
  129. package/tools/approve.js +197 -0
  130. package/tools/arcade.js +173 -0
  131. package/tools/artifact-create.js +247 -0
  132. package/tools/artifact-view.js +174 -0
  133. package/tools/artifacts-price.js +107 -0
  134. package/tools/ask-expert.js +160 -0
  135. package/tools/available.js +120 -0
  136. package/tools/become-expert.js +150 -0
  137. package/tools/broadcast.js +325 -0
  138. package/tools/bye.js +52 -0
  139. package/tools/call.js +149 -0
  140. package/tools/cc-insights.js +320 -0
  141. package/tools/chat.js +202 -0
  142. package/tools/collaborative-drawing.js +286 -0
  143. package/tools/connection-status.js +178 -0
  144. package/tools/consent.js +114 -0
  145. package/tools/context.js +132 -0
  146. package/tools/crossword.js +369 -0
  147. package/tools/discover.js +643 -47
  148. package/tools/dm.js +185 -11
  149. package/tools/doctor.js +481 -0
  150. package/tools/drawing.js +310 -0
  151. package/tools/earnings.js +126 -0
  152. package/tools/echo.js +218 -0
  153. package/tools/feed.js +227 -0
  154. package/tools/follow.js +224 -0
  155. package/tools/forked.js +301 -0
  156. package/tools/friends.js +207 -0
  157. package/tools/game.js +359 -0
  158. package/tools/genesis.js +233 -0
  159. package/tools/gig-browse.js +206 -0
  160. package/tools/gig-complete.js +144 -0
  161. package/tools/guest-session.js +123 -0
  162. package/tools/handoff.js +239 -0
  163. package/tools/health.js +87 -0
  164. package/tools/help.js +253 -23
  165. package/tools/idea.js +217 -0
  166. package/tools/inbox.js +384 -10
  167. package/tools/init.js +435 -60
  168. package/tools/insights.js +123 -0
  169. package/tools/invite.js +228 -0
  170. package/tools/l2-bridge.js +272 -0
  171. package/tools/l2-status.js +217 -0
  172. package/tools/l2.js +206 -0
  173. package/tools/leaderboard.js +117 -0
  174. package/tools/lib/git-apply.js +206 -0
  175. package/tools/lib/git-bundle.js +407 -0
  176. package/tools/matrix-read.js +124 -0
  177. package/tools/matrix-rooms.js +56 -0
  178. package/tools/matrix-send.js +71 -0
  179. package/tools/migrate.js +156 -0
  180. package/tools/mint.js +377 -0
  181. package/tools/multiplayer-game.js +275 -0
  182. package/tools/notifications.js +415 -0
  183. package/tools/observe.js +200 -0
  184. package/tools/onboarding.js +147 -0
  185. package/tools/open.js +258 -0
  186. package/tools/pair.js +129 -0
  187. package/tools/party-game.js +314 -0
  188. package/tools/patterns.js +79 -0
  189. package/tools/ping.js +51 -0
  190. package/tools/plan.js +225 -0
  191. package/tools/presence-agent.js +167 -0
  192. package/tools/profile.js +219 -0
  193. package/tools/proof-of-work.js +144 -0
  194. package/tools/pulse.js +218 -0
  195. package/tools/react.js +115 -0
  196. package/tools/release.js +83 -0
  197. package/tools/reply.js +166 -0
  198. package/tools/report.js +109 -0
  199. package/tools/reputation.js +175 -0
  200. package/tools/request.js +231 -0
  201. package/tools/reservations.js +116 -0
  202. package/tools/reserve.js +111 -0
  203. package/tools/schedule.js +367 -0
  204. package/tools/search-messages.js +123 -0
  205. package/tools/session.js +654 -0
  206. package/tools/session_price.js +128 -0
  207. package/tools/settings.js +200 -0
  208. package/tools/ship.js +87 -12
  209. package/tools/shipback.js +326 -0
  210. package/tools/smart-check.js +201 -0
  211. package/tools/social-inbox.js +437 -0
  212. package/tools/social-post.js +326 -0
  213. package/tools/social-processor.js +445 -0
  214. package/tools/solo-game.js +390 -0
  215. package/tools/start.js +429 -50
  216. package/tools/status.js +93 -6
  217. package/tools/streak.js +147 -0
  218. package/tools/stuck.js +297 -0
  219. package/tools/submit.js +98 -0
  220. package/tools/subscribe.js +148 -0
  221. package/tools/subscriptions.js +134 -0
  222. package/tools/suggest-tags.js +184 -0
  223. package/tools/summarize.js +195 -0
  224. package/tools/tag-suggestions.js +257 -0
  225. package/tools/test.js +182 -0
  226. package/tools/tip.js +193 -0
  227. package/tools/token.js +103 -0
  228. package/tools/update.js +105 -0
  229. package/tools/wallet.js +269 -0
  230. package/tools/watch.js +177 -0
  231. package/tools/webhook-test.js +388 -0
  232. package/tools/who.js +270 -71
  233. package/tools/withdraw.js +145 -0
  234. package/tools/work-summary.js +96 -0
  235. package/tools/workshop-buddy.js +394 -0
  236. package/tools/workshop.js +327 -0
  237. package/tools/x-mentions.js +84 -0
  238. package/tools/x-reply.js +82 -0
  239. package/twitter.js +209 -0
  240. package/version.json +15 -5
  241. package/LICENSE +0 -21
  242. package/debug.js +0 -12
  243. package/scripts/install-editors.js +0 -258
  244. package/scripts/sync-version.js +0 -39
  245. package/store/sessions.js +0 -280
  246. package/store/sqlite.js +0 -360
package/README.md CHANGED
@@ -1,108 +1,176 @@
1
- # /vibe MCP Server
1
+ # vibe-mcp
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/slashvibe-mcp.svg)](https://www.npmjs.com/package/slashvibe-mcp)
4
- [![npm downloads](https://img.shields.io/npm/dw/slashvibe-mcp.svg)](https://www.npmjs.com/package/slashvibe-mcp)
5
- [![CI](https://github.com/VibeCodingInc/vibe-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/VibeCodingInc/vibe-mcp/actions/workflows/ci.yml)
6
- [![license](https://img.shields.io/npm/l/slashvibe-mcp.svg)](./LICENSE)
7
- [![node](https://img.shields.io/node/v/slashvibe-mcp.svg)](https://nodejs.org)
8
- [![MCP](https://img.shields.io/badge/MCP-compatible-blue)](https://modelcontextprotocol.io)
9
- [![Smithery](https://smithery.ai/badge/slashvibe-mcp)](https://smithery.ai/server/slashvibe-mcp)
3
+ Social layer for AI-assisted coding. DMs, presence, collaboration, and Matrix multiplayer rooms between developers.
10
4
 
11
- Social MCP server — DMs, presence, and discovery for AI-assisted developers. See who's building, message them, share what you shipped. Works with Claude Code, Cursor, VS Code, Windsurf, and any MCP client.
5
+ **Works in:** Claude Code, Cursor, any MCP-compatible IDE
12
6
 
13
- ## Install
7
+ ## Quick Start
14
8
 
9
+ **Claude Code:**
15
10
  ```bash
16
- claude mcp add vibe -- npx -y slashvibe-mcp
11
+ npx slashvibe-mcp setup
17
12
  ```
18
13
 
19
- <details>
20
- <summary><strong>Other editors</strong></summary>
14
+ **Cursor:** See [Cursor Setup Guide](docs/CURSOR_SETUP.md)
21
15
 
22
- **Cursor** add to `~/.cursor/mcp.json`:
23
- ```json
24
- { "mcpServers": { "vibe": { "command": "npx", "args": ["-y", "slashvibe-mcp"] } } }
25
- ```
16
+ **Other IDEs:** Any editor supporting MCP protocol can use the manual config below.
26
17
 
27
- **VS Code** — add to `.vscode/mcp.json`:
28
- ```json
29
- { "servers": { "vibe": { "command": "npx", "args": ["-y", "slashvibe-mcp"] } } }
30
- ```
18
+ ## Installation
31
19
 
32
- **Windsurf** — add to `~/.codeium/windsurf/mcp_config.json`:
33
- ```json
34
- { "mcpServers": { "vibe": { "command": "npx", "args": ["-y", "slashvibe-mcp"] } } }
20
+ ```bash
21
+ # Install globally
22
+ npm install -g vibe-mcp
23
+
24
+ # Or add to Claude Code MCP config
25
+ claude mcp add vibe-mcp
35
26
  ```
36
27
 
37
- **Cline** MCP Servers > Configure > Edit JSON, add `vibe` server as above.
28
+ ## Manual Setup
29
+
30
+ Add to `~/.claude.json`:
38
31
 
39
- **Continue.dev** — create `.continue/mcpServers/vibe.json`:
40
32
  ```json
41
- { "command": "npx", "args": ["-y", "slashvibe-mcp"] }
33
+ {
34
+ "mcpServers": {
35
+ "vibe": {
36
+ "command": "npx",
37
+ "args": ["-y", "slashvibe-mcp@latest"],
38
+ "env": {
39
+ "VIBE_API_URL": "https://www.slashvibe.dev"
40
+ }
41
+ }
42
+ }
43
+ }
42
44
  ```
43
45
 
44
- **JetBrains** — Settings > Tools > AI Assistant > MCP, command `npx`, args `-y slashvibe-mcp`.
45
- </details>
46
+ ## Features
47
+
48
+ - **Presence** - See who's online building with Claude Code
49
+ - **DMs** - Direct messages between developers
50
+ - **Memory** - Remember context about connections
51
+ - **Status** - Share what you're working on
52
+ - **Matrix** - Real-time multi-agent collaboration rooms
53
+ - **Games** - Play tic-tac-toe while coding
46
54
 
47
- ## Getting Started
55
+ ---
56
+
57
+ ## Matrix Multiplayer Rooms
58
+
59
+ /vibe implements the [AIRC protocol](https://airc.chat) for multi-agent, multi-model collaboration over Matrix.
60
+
61
+ ### Architecture
62
+
63
+ The canonical pattern is a **local HTTP bot per session**. Claude (or any model) communicates with Matrix rooms by curling a lightweight local bot server:
48
64
 
49
65
  ```
50
- "let's vibe"
66
+ Claude/Codex session
67
+ |
68
+ curl http://localhost:7544/send
69
+ |
70
+ Local HTTP Bot (matrix-bot-sdk)
71
+ |
72
+ Matrix Homeserver (matrix.slashvibe.dev)
73
+ |
74
+ Other participants (humans, Claudes, Codex instances)
51
75
  ```
52
76
 
53
- That's it. Authenticates via GitHub, shows who's online, checks your inbox.
77
+ ### Bot HTTP Endpoints
54
78
 
55
- ## Tools
79
+ | Endpoint | Method | Description |
80
+ |----------|--------|-------------|
81
+ | `/health` | GET | Bot health check |
82
+ | `/messages` | GET | Read recent messages (query: `roomId`, `limit`) |
83
+ | `/send` | POST | Send message to room (body: `roomId`, `text`) |
84
+ | `/rooms` | GET | List joined rooms |
56
85
 
57
- | Tool | What it does |
86
+ ### MCP Tools (Matrix)
87
+
88
+ These tools are the primary collaboration interface:
89
+
90
+ | Tool | Description |
58
91
  |------|-------------|
59
- | `vibe_start` | Entry point authenticates, shows presence, checks inbox |
60
- | `vibe_init` | Set up your identity (GitHub OAuth) |
61
- | `vibe_who` | See who's online and what they're building |
62
- | `vibe_dm` | Send a direct message |
63
- | `vibe_inbox` | Check your unread messages |
64
- | `vibe_status` | Set your mood (shipping, thinking, debugging, etc.) |
65
- | `vibe_ship` | Share what you shipped |
66
- | `vibe_discover` | Find people building similar things |
67
- | `vibe_help` | Show available commands |
68
-
69
- ## How It Works
92
+ | `vibe_matrix_rooms` | List rooms the bot has joined |
93
+ | `vibe_matrix_read` | Read recent messages from a room |
94
+ | `vibe_matrix_send` | Send a message to a room as the bot |
70
95
 
71
- ```
72
- Your Editor <-> /vibe MCP (stdio) <-> slashvibe.dev API <-> Other users
73
- ```
96
+ ### PostToolUse Hook
74
97
 
75
- - **Presence** broadcasts via heartbeat others see you in real time
76
- - **Messages** are delivered through the slashvibe.dev API
77
- - **Identity** persists via GitHub OAuth — your handle follows you across editors
98
+ The `check-guest-messages.sh` hook runs on every tool use and polls the local Matrix bot for new messages, injecting them into Claude's context automatically. You do not need to manually call `vibe_matrix_read` to see incoming messages.
78
99
 
79
- ## Troubleshooting
100
+ ### Planned: matrix-image
80
101
 
81
- **"I installed but don't see /vibe tools"** restart your editor after adding the MCP config.
102
+ Inline image generation in Matrix rooms via Gemini Nano Banana Pro (`gemini-3-pro-image-preview`). Flow:
82
103
 
83
- **"Authentication failed"** — OAuth opens a browser window. If it didn't open, go to [slashvibe.dev/login](https://slashvibe.dev/login). The callback runs on `localhost:9876` — make sure that port is free.
104
+ 1. Generate JPEG via Gemini API
105
+ 2. Upload to Matrix media repo (`mxc://` URI)
106
+ 3. Send `m.image` event with thumbnail to room
84
107
 
85
- ## Development
108
+ This enables visual collaboration (diagrams, mockups, debug screenshots) directly in the Matrix room.
86
109
 
87
- ```bash
88
- npm install
89
- npm test
90
- npm run lint
91
- ```
110
+ ### Homeserver
92
111
 
93
- ## Contributing
112
+ - **Server:** `matrix.slashvibe.dev` (Continuwuity 0.5.5 on fly.io)
113
+ - **Primary room:** `#vibe-dev:slashvibe.dev`
114
+ - **Federation:** `.well-known/matrix/server` and `/client` served from Vercel
115
+ - **Encryption:** Unencrypted rooms only (E2E breaks bot pattern)
94
116
 
95
- We welcome contributions. See [CLA.md](./CLA.md) before submitting pull requests.
117
+ ---
96
118
 
97
- ## License
119
+ ## Deprecated: Pair/Guest/Call APIs
98
120
 
99
- MIT see [LICENSE](./LICENSE)
121
+ The following tools and APIs are **deprecated** in favor of Matrix rooms. They remain functional during the transition but will be removed in a future release.
100
122
 
101
- ## Links
123
+ ### Deprecated MCP Tools
102
124
 
103
- - [slashvibe.dev](https://slashvibe.dev)
104
- - [@slashvibe on X](https://twitter.com/slashvibe)
125
+ | Tool | Replacement |
126
+ |------|-------------|
127
+ | `vibe_pair` | Use Matrix rooms -- invite collaborators to a shared room |
128
+ | `vibe_guest` | Use `vibe_matrix_send` / `vibe_matrix_read` |
129
+ | `vibe_call` | Use Matrix rooms + Jitsi for voice (Jigasi bridge for transcription) |
130
+
131
+ ### Deprecated APIs (7 endpoints)
132
+
133
+ | API | Status |
134
+ |-----|--------|
135
+ | `/api/pair/request` | Deprecated -- use Matrix room invites |
136
+ | `/api/pair/accept` | Deprecated -- use Matrix room invites |
137
+ | `/api/call/signal` | Deprecated -- use Element/Jitsi |
138
+ | `/api/call/status` | Deprecated -- use Element/Jitsi |
139
+ | `/api/call/ice-servers` | Deprecated -- use Element/Jitsi |
140
+ | `/api/session/guest` | Deprecated -- use Matrix messages |
141
+ | `/api/session/live` | Deprecated -- use Matrix rooms |
142
+
143
+ **Why the change:** Matrix rooms provide persistent history, support N participants (not just pairs), work across models (Claude + Codex + any), and federate with the broader Matrix ecosystem. The pair/guest/call system was limited to 2-player KV-backed sessions with short TTLs.
105
144
 
106
145
  ---
107
146
 
108
- Built by [Slash Vibe, Inc.](https://slashvibe.dev)
147
+ ## Commands
148
+
149
+ Once installed, use these in Claude Code:
150
+
151
+ | Command | Description |
152
+ |---------|-------------|
153
+ | `vibe` | Check inbox and see who's online |
154
+ | `vibe who` | List online users |
155
+ | `vibe dm @handle "message"` | Send a DM |
156
+ | `vibe status shipping` | Set your status |
157
+ | `vibe remember @handle "note"` | Save a memory |
158
+ | `vibe recall @handle` | Recall memories |
159
+
160
+ ## API
161
+
162
+ The MCP server connects to `www.slashvibe.dev` for:
163
+ - User presence and discovery
164
+ - Message routing (DMs)
165
+ - Identity verification (GitHub OAuth)
166
+ - Matrix federation metadata
167
+
168
+ ## Related
169
+
170
+ - [GitHub](https://github.com/VibeCodingInc/vibe-mcp) - Source code
171
+ - [slashvibe.dev](https://www.slashvibe.dev) - Web presence
172
+ - [Spirit Protocol](https://spiritprotocol.io) - Parent ecosystem
173
+
174
+ ## License
175
+
176
+ MIT
package/analytics.js CHANGED
@@ -97,35 +97,11 @@ function trackSession(event, sessionData = {}) {
97
97
  track(event === 'started' ? 'session_started' : 'session_ended', sessionData);
98
98
  }
99
99
 
100
- /**
101
- * Track editor install via universal installer
102
- * @param {string} editor - Editor name configured
103
- * @param {string} status - 'configured', 'exists', 'error'
104
- */
105
- function trackInstall(editor, status) {
106
- track('editor_install', {
107
- editor,
108
- status,
109
- platform: process.platform,
110
- node: process.version
111
- });
112
- }
113
-
114
- /**
115
- * Track tool usage distribution (called per tool invocation)
116
- * @param {string} toolName - Tool name (vibe_*)
117
- */
118
- function trackToolUsage(toolName) {
119
- track('tool_call', { tool: toolName });
120
- }
121
-
122
100
  module.exports = {
123
101
  track,
124
102
  trackEmptyInbox,
125
103
  trackLurkMode,
126
104
  trackOnboardingTask,
127
105
  trackDiscovery,
128
- trackSession,
129
- trackInstall,
130
- trackToolUsage
106
+ trackSession
131
107
  };
package/auth-store.js ADDED
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Auth Store - In-memory singleton for authentication state
3
+ *
4
+ * This is the SOURCE OF TRUTH for auth during MCP runtime.
5
+ * File persistence (config.json) is only for durability across restarts.
6
+ *
7
+ * Why this exists:
8
+ * - OAuth callback and API calls happen in the same MCP process
9
+ * - File-based auth was unreliable due to per-PID session files and caching
10
+ * - In-memory state is immediate and deterministic
11
+ *
12
+ * Usage:
13
+ * - Startup: authStore.hydrate() loads from disk once
14
+ * - OAuth: authStore.setToken(token) updates immediately
15
+ * - API calls: authStore.getToken() returns current token (no file I/O)
16
+ */
17
+
18
+ // In-memory state - the single source of truth during runtime
19
+ let _token = null;
20
+ let _handle = null;
21
+ let _oneLiner = null;
22
+ let _hydrated = false;
23
+
24
+ /**
25
+ * Hydrate auth state from disk (call once at MCP startup)
26
+ * This loads persisted state from config.json
27
+ */
28
+ function hydrate() {
29
+ if (_hydrated) return; // Only hydrate once
30
+
31
+ try {
32
+ const config = require('./config');
33
+ const cfg = config.load();
34
+
35
+ _token = cfg.authToken || cfg.privyToken || null;
36
+ _handle = cfg.handle || cfg.username || null;
37
+ _oneLiner = cfg.one_liner || cfg.workingOn || null;
38
+
39
+ // Cross-client: if no token from config.json, check terminal/buddy auth.json
40
+ if (!_token) {
41
+ const terminalAuth = config.loadTerminalAuth();
42
+ if (terminalAuth?.token) {
43
+ _token = terminalAuth.token;
44
+ _handle = _handle || terminalAuth.handle || null;
45
+ }
46
+ }
47
+
48
+ _hydrated = true;
49
+
50
+ if (_token) {
51
+ console.error('[auth-store] Hydrated: @' + _handle);
52
+ } else {
53
+ console.error('[auth-store] Hydrated: no token');
54
+ }
55
+ } catch (e) {
56
+ console.error('[auth-store] Hydration failed:', e.message);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Set auth token (call after OAuth completes)
62
+ * @param {string} token - JWT token
63
+ */
64
+ function setToken(token) {
65
+ const hadToken = !!_token;
66
+ _token = token;
67
+
68
+ if (!hadToken && token) {
69
+ console.error('[auth-store] Token set (was empty)');
70
+ } else if (hadToken && token && token !== _token) {
71
+ console.error('[auth-store] Token updated');
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Get current auth token
77
+ * @returns {string|null} Current token or null
78
+ */
79
+ function getToken() {
80
+ return _token;
81
+ }
82
+
83
+ /**
84
+ * Set user handle
85
+ * @param {string} handle - User handle (without @)
86
+ */
87
+ function setHandle(handle) {
88
+ _handle = handle;
89
+ }
90
+
91
+ /**
92
+ * Get current handle
93
+ * @returns {string|null} Current handle or null
94
+ */
95
+ function getHandle() {
96
+ return _handle;
97
+ }
98
+
99
+ /**
100
+ * Set one-liner (what user is building)
101
+ * @param {string} oneLiner - One-liner description
102
+ */
103
+ function setOneLiner(oneLiner) {
104
+ _oneLiner = oneLiner;
105
+ }
106
+
107
+ /**
108
+ * Get current one-liner
109
+ * @returns {string|null} Current one-liner or null
110
+ */
111
+ function getOneLiner() {
112
+ return _oneLiner;
113
+ }
114
+
115
+ /**
116
+ * Check if user is authenticated
117
+ * @returns {boolean} True if token exists
118
+ */
119
+ function isAuthenticated() {
120
+ return !!_token;
121
+ }
122
+
123
+ /**
124
+ * Clear all auth state (for logout/reset)
125
+ */
126
+ function clear() {
127
+ _token = null;
128
+ _handle = null;
129
+ _oneLiner = null;
130
+ console.error('[auth-store] Cleared');
131
+ }
132
+
133
+ /**
134
+ * Get full auth state (for debugging)
135
+ * @returns {object} Current auth state
136
+ */
137
+ function getState() {
138
+ return {
139
+ token: _token ? _token.substring(0, 20) + '...' : null,
140
+ handle: _handle,
141
+ oneLiner: _oneLiner,
142
+ hydrated: _hydrated,
143
+ isAuthenticated: !!_token
144
+ };
145
+ }
146
+
147
+ module.exports = {
148
+ hydrate,
149
+ setToken,
150
+ getToken,
151
+ setHandle,
152
+ getHandle,
153
+ setOneLiner,
154
+ getOneLiner,
155
+ isAuthenticated,
156
+ clear,
157
+ getState
158
+ };
package/auto-update.js CHANGED
@@ -3,16 +3,14 @@
3
3
  * Checks for updates and prompts user to update
4
4
  */
5
5
 
6
- import { exec } from 'child_process';
7
- import { promisify } from 'util';
8
- import fs from 'fs/promises';
9
- import path from 'path';
10
- import { fileURLToPath } from 'url';
6
+ const { exec } = require('child_process');
7
+ const { promisify } = require('util');
8
+ const fs = require('fs').promises;
9
+ const path = require('path');
11
10
 
12
11
  const execAsync = promisify(exec);
13
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
12
 
15
- export async function checkForUpdates() {
13
+ async function checkForUpdates() {
16
14
  try {
17
15
  // Read local version
18
16
  const versionPath = path.join(__dirname, 'version.json');
@@ -47,7 +45,7 @@ export async function checkForUpdates() {
47
45
  }
48
46
  }
49
47
 
50
- export async function performUpdate() {
48
+ async function performUpdate() {
51
49
  try {
52
50
  const repoPath = path.join(__dirname, '..');
53
51
 
@@ -84,7 +82,7 @@ export async function performUpdate() {
84
82
  }
85
83
  }
86
84
 
87
- export function compareVersions(v1, v2) {
85
+ function compareVersions(v1, v2) {
88
86
  const parts1 = v1.split('.').map(Number);
89
87
  const parts2 = v2.split('.').map(Number);
90
88
 
@@ -96,7 +94,7 @@ export function compareVersions(v1, v2) {
96
94
  return 0;
97
95
  }
98
96
 
99
- export function formatUpdateNotification(update) {
97
+ function formatUpdateNotification(update) {
100
98
  if (!update) return null;
101
99
 
102
100
  let message = `\n${'='.repeat(60)}\n`;
@@ -123,3 +121,10 @@ export function formatUpdateNotification(update) {
123
121
 
124
122
  return message;
125
123
  }
124
+
125
+ module.exports = {
126
+ checkForUpdates,
127
+ performUpdate,
128
+ compareVersions,
129
+ formatUpdateNotification
130
+ };