slashvibe-mcp 0.2.2 → 0.2.4

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 (162) hide show
  1. package/README.md +1 -0
  2. package/analytics.js +107 -0
  3. package/config.js +174 -3
  4. package/index.js +163 -34
  5. package/intelligence/index.js +45 -0
  6. package/intelligence/infer.js +316 -0
  7. package/intelligence/interests.js +369 -0
  8. package/intelligence/patterns.js +651 -0
  9. package/intelligence/proactive.js +358 -0
  10. package/intelligence/serendipity.js +306 -0
  11. package/notification-emitter.js +77 -0
  12. package/notify.js +141 -18
  13. package/package.json +14 -6
  14. package/presence.js +5 -1
  15. package/protocol/index.js +88 -1
  16. package/protocol/telegram-commands.js +199 -0
  17. package/store/api.js +469 -29
  18. package/store/index.js +7 -7
  19. package/store/local.js +67 -11
  20. package/store/profiles.js +435 -0
  21. package/store/reservations.js +321 -0
  22. package/store/skills.js +378 -0
  23. package/tools/_actions.js +491 -22
  24. package/tools/_connection-queue.js +257 -0
  25. package/tools/_discovery-enhanced.js +290 -0
  26. package/tools/_discovery.js +439 -0
  27. package/tools/_proactive-discovery.js +301 -0
  28. package/tools/_shared/index.js +64 -0
  29. package/tools/_work-context.js +338 -0
  30. package/tools/_work-context.manual-test.js +199 -0
  31. package/tools/_work-context.test.js +260 -0
  32. package/tools/admin-inbox.js +218 -0
  33. package/tools/agent-treasury.js +288 -0
  34. package/tools/agents.js +122 -0
  35. package/tools/analytics.js +191 -0
  36. package/tools/approve.js +197 -0
  37. package/tools/arcade.js +173 -0
  38. package/tools/artifact-create.js +247 -0
  39. package/tools/artifact-view.js +174 -0
  40. package/tools/artifacts-price.js +107 -0
  41. package/tools/ask-expert.js +160 -0
  42. package/tools/auto-suggest-connections.js +304 -0
  43. package/tools/away.js +68 -0
  44. package/tools/back.js +51 -0
  45. package/tools/become-expert.js +150 -0
  46. package/tools/bootstrap-skills.js +231 -0
  47. package/tools/bridge-dashboard.js +342 -0
  48. package/tools/bridge-health.js +400 -0
  49. package/tools/bridge-live.js +384 -0
  50. package/tools/bridges.js +383 -0
  51. package/tools/broadcast.js +286 -0
  52. package/tools/bye.js +4 -0
  53. package/tools/chat.js +202 -0
  54. package/tools/collaborative-drawing.js +286 -0
  55. package/tools/colorguess.js +281 -0
  56. package/tools/crossword.js +369 -0
  57. package/tools/discover-insights.js +379 -0
  58. package/tools/discover-momentum.js +256 -0
  59. package/tools/discover.js +675 -0
  60. package/tools/discovery-analytics.js +345 -0
  61. package/tools/discovery-auto-suggest.js +275 -0
  62. package/tools/discovery-bootstrap.js +267 -0
  63. package/tools/discovery-daily.js +375 -0
  64. package/tools/discovery-dashboard.js +385 -0
  65. package/tools/discovery-digest.js +314 -0
  66. package/tools/discovery-hub.js +357 -0
  67. package/tools/discovery-insights.js +384 -0
  68. package/tools/discovery-momentum.js +281 -0
  69. package/tools/discovery-monitor.js +319 -0
  70. package/tools/discovery-proactive.js +300 -0
  71. package/tools/dm.js +84 -14
  72. package/tools/draw.js +317 -0
  73. package/tools/drawing.js +310 -0
  74. package/tools/earnings.js +126 -0
  75. package/tools/echo.js +16 -0
  76. package/tools/farcaster.js +307 -0
  77. package/tools/feed.js +215 -0
  78. package/tools/follow.js +224 -0
  79. package/tools/friends.js +192 -0
  80. package/tools/game.js +218 -110
  81. package/tools/games-catalog.js +376 -0
  82. package/tools/games.js +313 -0
  83. package/tools/genesis.js +233 -0
  84. package/tools/gig-browse.js +206 -0
  85. package/tools/gig-complete.js +139 -0
  86. package/tools/guessnumber.js +194 -0
  87. package/tools/hangman.js +129 -0
  88. package/tools/help.js +269 -0
  89. package/tools/idea.js +217 -0
  90. package/tools/inbox.js +291 -25
  91. package/tools/init.js +657 -33
  92. package/tools/insights.js +123 -0
  93. package/tools/invite.js +142 -21
  94. package/tools/l2-bridge.js +272 -0
  95. package/tools/l2-status.js +217 -0
  96. package/tools/l2.js +206 -0
  97. package/tools/migrate.js +156 -0
  98. package/tools/mint.js +377 -0
  99. package/tools/multiplayer-game.js +275 -0
  100. package/tools/multiplayer-tictactoe.js +303 -0
  101. package/tools/mute.js +97 -0
  102. package/tools/notifications.js +415 -0
  103. package/tools/observe.js +200 -0
  104. package/tools/onboarding.js +147 -0
  105. package/tools/open.js +52 -3
  106. package/tools/party-game.js +314 -0
  107. package/tools/plan.js +225 -0
  108. package/tools/presence-agent.js +167 -0
  109. package/tools/profile.js +219 -0
  110. package/tools/proof-of-work.js +139 -0
  111. package/tools/pulse.js +218 -0
  112. package/tools/react.js +4 -0
  113. package/tools/release.js +83 -0
  114. package/tools/report.js +109 -0
  115. package/tools/reputation.js +175 -0
  116. package/tools/request.js +231 -0
  117. package/tools/reservations.js +116 -0
  118. package/tools/reserve.js +111 -0
  119. package/tools/riddle.js +240 -0
  120. package/tools/run-bootstrap.js +69 -0
  121. package/tools/schedule.js +367 -0
  122. package/tools/session.js +420 -0
  123. package/tools/session_price.js +128 -0
  124. package/tools/settings.js +200 -0
  125. package/tools/ship.js +188 -0
  126. package/tools/shipback.js +326 -0
  127. package/tools/skills-analytics.js +349 -0
  128. package/tools/skills-bootstrap.js +301 -0
  129. package/tools/skills-dashboard.js +268 -0
  130. package/tools/skills-exchange.js +342 -0
  131. package/tools/skills.js +380 -0
  132. package/tools/smart-intro.js +353 -0
  133. package/tools/social-inbox.js +326 -69
  134. package/tools/social-post.js +251 -66
  135. package/tools/social-processor.js +445 -0
  136. package/tools/solo-game.js +390 -0
  137. package/tools/start.js +296 -81
  138. package/tools/status.js +53 -6
  139. package/tools/storybuilder.js +331 -0
  140. package/tools/stuck.js +297 -0
  141. package/tools/subscribe.js +148 -0
  142. package/tools/subscriptions.js +134 -0
  143. package/tools/suggest-tags.js +184 -0
  144. package/tools/tag-suggestions.js +257 -0
  145. package/tools/telegram-bot.js +183 -0
  146. package/tools/telegram-setup.js +214 -0
  147. package/tools/tictactoe.js +155 -0
  148. package/tools/tip.js +120 -0
  149. package/tools/token.js +103 -0
  150. package/tools/twentyquestions.js +143 -0
  151. package/tools/update.js +1 -1
  152. package/tools/wallet.js +127 -0
  153. package/tools/watch.js +157 -0
  154. package/tools/webhook-test.js +388 -0
  155. package/tools/who.js +118 -25
  156. package/tools/withdraw.js +145 -0
  157. package/tools/wordassociation.js +247 -0
  158. package/tools/work-summary.js +96 -0
  159. package/tools/workshop-buddy.js +394 -0
  160. package/tools/workshop.js +327 -0
  161. package/version.json +12 -3
  162. package/tools/board.js +0 -130
@@ -0,0 +1,199 @@
1
+ /**
2
+ * /vibe Telegram Command Processor
3
+ *
4
+ * Executes /vibe commands received via Telegram bot.
5
+ * Maps Telegram users to /vibe handles and executes core protocol functions.
6
+ */
7
+
8
+ const { dm } = require('../tools/dm');
9
+ const { status } = require('../tools/status');
10
+ const { who } = require('../tools/who');
11
+ const { ship } = require('../tools/ship');
12
+ const config = require('../config');
13
+
14
+ /**
15
+ * Process a /vibe command from Telegram
16
+ */
17
+ async function processVibeCommand(command, params, telegramUser) {
18
+ // Map Telegram user to /vibe handle
19
+ const vibeHandle = mapTelegramUserToHandle(telegramUser);
20
+
21
+ if (!vibeHandle) {
22
+ return `❌ Telegram account not linked to /vibe. Contact admin to link @${telegramUser.username || telegramUser.first_name} to a /vibe handle.`;
23
+ }
24
+
25
+ try {
26
+ switch (command) {
27
+ case 'status':
28
+ return await executeStatus(params.mood, params.note, vibeHandle);
29
+
30
+ case 'who':
31
+ return await executeWho();
32
+
33
+ case 'ship':
34
+ return await executeShip(params.message, vibeHandle);
35
+
36
+ case 'dm':
37
+ return await executeDM(params.handle, params.message, vibeHandle);
38
+
39
+ default:
40
+ return `❌ Unknown command: ${command}`;
41
+ }
42
+
43
+ } catch (error) {
44
+ console.error(`Telegram command error [${command}]:`, error);
45
+ return `❌ Command failed: ${error.message}`;
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Map Telegram user to /vibe handle using config
51
+ */
52
+ function mapTelegramUserToHandle(telegramUser) {
53
+ const cfg = config.load();
54
+ const telegramMappings = cfg.telegram_user_mappings || {};
55
+
56
+ // Try username first, then user ID
57
+ const telegramKey = telegramUser.username || telegramUser.id.toString();
58
+ return telegramMappings[telegramKey] || null;
59
+ }
60
+
61
+ /**
62
+ * Execute status command
63
+ */
64
+ async function executeStatus(mood, note, handle) {
65
+ if (!mood) {
66
+ return '❌ Need a mood. Try: `/status shipping "building the future"`';
67
+ }
68
+
69
+ const validMoods = ['shipping', 'debugging', 'deep', 'afk', 'celebrating', 'pairing'];
70
+ if (!validMoods.includes(mood)) {
71
+ return `❌ Invalid mood. Use: ${validMoods.join(', ')}`;
72
+ }
73
+
74
+ // Execute the status update
75
+ const result = await status.handler({ mood, note });
76
+
77
+ if (result.error) {
78
+ return `❌ ${result.error}`;
79
+ }
80
+
81
+ return `✅ Status updated: **${handle}** is ${mood}${note ? ` - "${note}"` : ''}`;
82
+ }
83
+
84
+ /**
85
+ * Execute who command
86
+ */
87
+ async function executeWho() {
88
+ const result = await who.handler({});
89
+
90
+ if (result.error) {
91
+ return `❌ ${result.error}`;
92
+ }
93
+
94
+ // Convert display format to Telegram-friendly
95
+ let response = result.display;
96
+
97
+ // Replace markdown formatting for Telegram
98
+ response = response
99
+ .replace(/\*\*(.*?)\*\*/g, '*$1*') // Bold
100
+ .replace(/_(.*?)_/g, '_$1_') // Italic
101
+ .replace(/`(.*?)`/g, '`$1`'); // Code
102
+
103
+ return response;
104
+ }
105
+
106
+ /**
107
+ * Execute ship command
108
+ */
109
+ async function executeShip(message, handle) {
110
+ const result = await ship.handler({ what: message });
111
+
112
+ if (result.error) {
113
+ return `❌ ${result.error}`;
114
+ }
115
+
116
+ return `🚀 Shipped! ${message ? `"${message}"` : 'Great work!'} has been announced to /vibe.`;
117
+ }
118
+
119
+ /**
120
+ * Execute DM command
121
+ */
122
+ async function executeDM(targetHandle, message, fromHandle) {
123
+ if (!targetHandle) {
124
+ return '❌ Need target handle. Try: `/dm @alice "hey there!"`';
125
+ }
126
+
127
+ if (!message) {
128
+ return '❌ Need message content.';
129
+ }
130
+
131
+ // Remove @ if present
132
+ const cleanHandle = targetHandle.replace('@', '');
133
+
134
+ const result = await dm.handler({
135
+ to: cleanHandle,
136
+ message: message
137
+ });
138
+
139
+ if (result.error) {
140
+ return `❌ ${result.error}`;
141
+ }
142
+
143
+ return `📨 DM sent to @${cleanHandle}: "${message}"`;
144
+ }
145
+
146
+ /**
147
+ * Link a Telegram user to a /vibe handle (admin function)
148
+ */
149
+ async function linkTelegramUser(telegramUser, vibeHandle) {
150
+ const cfg = config.load();
151
+
152
+ if (!cfg.telegram_user_mappings) {
153
+ cfg.telegram_user_mappings = {};
154
+ }
155
+
156
+ // Store both username and ID for flexibility
157
+ if (telegramUser.username) {
158
+ cfg.telegram_user_mappings[telegramUser.username] = vibeHandle;
159
+ }
160
+ cfg.telegram_user_mappings[telegramUser.id.toString()] = vibeHandle;
161
+
162
+ config.save(cfg);
163
+
164
+ return {
165
+ success: true,
166
+ message: `Linked Telegram user ${telegramUser.username || telegramUser.id} to /vibe handle @${vibeHandle}`
167
+ };
168
+ }
169
+
170
+ /**
171
+ * Get all Telegram user mappings (admin function)
172
+ */
173
+ function getTelegramMappings() {
174
+ const cfg = config.load();
175
+ return cfg.telegram_user_mappings || {};
176
+ }
177
+
178
+ /**
179
+ * Remove Telegram user mapping (admin function)
180
+ */
181
+ function unlinkTelegramUser(telegramKey) {
182
+ const cfg = config.load();
183
+
184
+ if (cfg.telegram_user_mappings && cfg.telegram_user_mappings[telegramKey]) {
185
+ delete cfg.telegram_user_mappings[telegramKey];
186
+ config.save(cfg);
187
+ return { success: true, message: `Unlinked ${telegramKey}` };
188
+ }
189
+
190
+ return { success: false, message: `No mapping found for ${telegramKey}` };
191
+ }
192
+
193
+ module.exports = {
194
+ processVibeCommand,
195
+ linkTelegramUser,
196
+ unlinkTelegramUser,
197
+ getTelegramMappings,
198
+ mapTelegramUserToHandle
199
+ };