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.
- package/README.md +1 -0
- package/analytics.js +107 -0
- package/config.js +174 -3
- package/index.js +163 -34
- package/intelligence/index.js +45 -0
- package/intelligence/infer.js +316 -0
- package/intelligence/interests.js +369 -0
- package/intelligence/patterns.js +651 -0
- package/intelligence/proactive.js +358 -0
- package/intelligence/serendipity.js +306 -0
- package/notification-emitter.js +77 -0
- package/notify.js +141 -18
- package/package.json +14 -6
- package/presence.js +5 -1
- package/protocol/index.js +88 -1
- package/protocol/telegram-commands.js +199 -0
- package/store/api.js +469 -29
- package/store/index.js +7 -7
- package/store/local.js +67 -11
- package/store/profiles.js +435 -0
- package/store/reservations.js +321 -0
- package/store/skills.js +378 -0
- package/tools/_actions.js +491 -22
- package/tools/_connection-queue.js +257 -0
- package/tools/_discovery-enhanced.js +290 -0
- package/tools/_discovery.js +439 -0
- package/tools/_proactive-discovery.js +301 -0
- package/tools/_shared/index.js +64 -0
- package/tools/_work-context.js +338 -0
- package/tools/_work-context.manual-test.js +199 -0
- package/tools/_work-context.test.js +260 -0
- package/tools/admin-inbox.js +218 -0
- package/tools/agent-treasury.js +288 -0
- package/tools/agents.js +122 -0
- package/tools/analytics.js +191 -0
- package/tools/approve.js +197 -0
- package/tools/arcade.js +173 -0
- package/tools/artifact-create.js +247 -0
- package/tools/artifact-view.js +174 -0
- package/tools/artifacts-price.js +107 -0
- package/tools/ask-expert.js +160 -0
- package/tools/auto-suggest-connections.js +304 -0
- package/tools/away.js +68 -0
- package/tools/back.js +51 -0
- package/tools/become-expert.js +150 -0
- package/tools/bootstrap-skills.js +231 -0
- package/tools/bridge-dashboard.js +342 -0
- package/tools/bridge-health.js +400 -0
- package/tools/bridge-live.js +384 -0
- package/tools/bridges.js +383 -0
- package/tools/broadcast.js +286 -0
- package/tools/bye.js +4 -0
- package/tools/chat.js +202 -0
- package/tools/collaborative-drawing.js +286 -0
- package/tools/colorguess.js +281 -0
- package/tools/crossword.js +369 -0
- package/tools/discover-insights.js +379 -0
- package/tools/discover-momentum.js +256 -0
- package/tools/discover.js +675 -0
- package/tools/discovery-analytics.js +345 -0
- package/tools/discovery-auto-suggest.js +275 -0
- package/tools/discovery-bootstrap.js +267 -0
- package/tools/discovery-daily.js +375 -0
- package/tools/discovery-dashboard.js +385 -0
- package/tools/discovery-digest.js +314 -0
- package/tools/discovery-hub.js +357 -0
- package/tools/discovery-insights.js +384 -0
- package/tools/discovery-momentum.js +281 -0
- package/tools/discovery-monitor.js +319 -0
- package/tools/discovery-proactive.js +300 -0
- package/tools/dm.js +84 -14
- package/tools/draw.js +317 -0
- package/tools/drawing.js +310 -0
- package/tools/earnings.js +126 -0
- package/tools/echo.js +16 -0
- package/tools/farcaster.js +307 -0
- package/tools/feed.js +215 -0
- package/tools/follow.js +224 -0
- package/tools/friends.js +192 -0
- package/tools/game.js +218 -110
- package/tools/games-catalog.js +376 -0
- package/tools/games.js +313 -0
- package/tools/genesis.js +233 -0
- package/tools/gig-browse.js +206 -0
- package/tools/gig-complete.js +139 -0
- package/tools/guessnumber.js +194 -0
- package/tools/hangman.js +129 -0
- package/tools/help.js +269 -0
- package/tools/idea.js +217 -0
- package/tools/inbox.js +291 -25
- package/tools/init.js +657 -33
- package/tools/insights.js +123 -0
- package/tools/invite.js +142 -21
- package/tools/l2-bridge.js +272 -0
- package/tools/l2-status.js +217 -0
- package/tools/l2.js +206 -0
- package/tools/migrate.js +156 -0
- package/tools/mint.js +377 -0
- package/tools/multiplayer-game.js +275 -0
- package/tools/multiplayer-tictactoe.js +303 -0
- package/tools/mute.js +97 -0
- package/tools/notifications.js +415 -0
- package/tools/observe.js +200 -0
- package/tools/onboarding.js +147 -0
- package/tools/open.js +52 -3
- package/tools/party-game.js +314 -0
- package/tools/plan.js +225 -0
- package/tools/presence-agent.js +167 -0
- package/tools/profile.js +219 -0
- package/tools/proof-of-work.js +139 -0
- package/tools/pulse.js +218 -0
- package/tools/react.js +4 -0
- package/tools/release.js +83 -0
- package/tools/report.js +109 -0
- package/tools/reputation.js +175 -0
- package/tools/request.js +231 -0
- package/tools/reservations.js +116 -0
- package/tools/reserve.js +111 -0
- package/tools/riddle.js +240 -0
- package/tools/run-bootstrap.js +69 -0
- package/tools/schedule.js +367 -0
- package/tools/session.js +420 -0
- package/tools/session_price.js +128 -0
- package/tools/settings.js +200 -0
- package/tools/ship.js +188 -0
- package/tools/shipback.js +326 -0
- package/tools/skills-analytics.js +349 -0
- package/tools/skills-bootstrap.js +301 -0
- package/tools/skills-dashboard.js +268 -0
- package/tools/skills-exchange.js +342 -0
- package/tools/skills.js +380 -0
- package/tools/smart-intro.js +353 -0
- package/tools/social-inbox.js +326 -69
- package/tools/social-post.js +251 -66
- package/tools/social-processor.js +445 -0
- package/tools/solo-game.js +390 -0
- package/tools/start.js +296 -81
- package/tools/status.js +53 -6
- package/tools/storybuilder.js +331 -0
- package/tools/stuck.js +297 -0
- package/tools/subscribe.js +148 -0
- package/tools/subscriptions.js +134 -0
- package/tools/suggest-tags.js +184 -0
- package/tools/tag-suggestions.js +257 -0
- package/tools/telegram-bot.js +183 -0
- package/tools/telegram-setup.js +214 -0
- package/tools/tictactoe.js +155 -0
- package/tools/tip.js +120 -0
- package/tools/token.js +103 -0
- package/tools/twentyquestions.js +143 -0
- package/tools/update.js +1 -1
- package/tools/wallet.js +127 -0
- package/tools/watch.js +157 -0
- package/tools/webhook-test.js +388 -0
- package/tools/who.js +118 -25
- package/tools/withdraw.js +145 -0
- package/tools/wordassociation.js +247 -0
- package/tools/work-summary.js +96 -0
- package/tools/workshop-buddy.js +394 -0
- package/tools/workshop.js +327 -0
- package/version.json +12 -3
- 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
|
+
};
|