slashvibe-mcp 0.3.21 → 0.3.22
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/LICENSE +21 -0
- package/README.md +280 -47
- package/config.js +36 -31
- package/crypto.js +1 -6
- package/discord.js +19 -19
- package/index.js +217 -207
- package/intelligence/index.js +2 -9
- package/intelligence/infer.js +10 -16
- package/intelligence/patterns.js +23 -18
- package/intelligence/proactive.js +16 -15
- package/intelligence/serendipity.js +57 -20
- package/memory.js +13 -8
- package/notify.js +39 -14
- package/package.json +27 -20
- package/presence.js +2 -2
- package/prompts.js +5 -9
- package/protocol/index.js +123 -87
- package/protocol/telegram-commands.js +36 -37
- package/store/api.js +358 -529
- package/store/local.js +9 -10
- package/store/profiles.js +48 -192
- package/store/reservations.js +2 -9
- package/store/skills.js +69 -71
- package/store/sqlite.js +355 -0
- package/tools/_actions.js +48 -387
- package/tools/_connection-queue.js +45 -56
- package/tools/_discovery-enhanced.js +52 -57
- package/tools/_discovery.js +87 -185
- package/tools/{l2-status.js → _experimental/l2-status.js} +68 -70
- package/tools/{shipback.js → _experimental/shipback.js} +4 -3
- package/tools/_proactive-discovery.js +60 -73
- package/tools/_shared/index.js +41 -64
- package/tools/admin-inbox.js +10 -15
- package/tools/agents.js +1 -1
- package/tools/artifact-create.js +13 -23
- package/tools/artifact-view.js +4 -4
- package/tools/{_deprecated/back.js → back.js} +1 -1
- package/tools/bye.js +3 -5
- package/tools/consent.js +2 -2
- package/tools/context.js +9 -10
- package/tools/crossword.js +3 -2
- package/tools/discover.js +94 -356
- package/tools/dm.js +27 -86
- package/tools/doctor.js +12 -41
- package/tools/drawing.js +34 -20
- package/tools/echo.js +11 -11
- package/tools/feed.js +30 -58
- package/tools/follow.js +64 -187
- package/tools/{_deprecated/forget.js → forget.js} +4 -7
- package/tools/game.js +144 -48
- package/tools/handoff.js +6 -8
- package/tools/help.js +3 -3
- package/tools/idea.js +15 -27
- package/tools/inbox.js +121 -293
- package/tools/init.js +54 -151
- package/tools/invite.js +8 -21
- package/tools/migrate.js +27 -24
- package/tools/multiplayer-game.js +50 -40
- package/tools/{_deprecated/mute.js → mute.js} +4 -3
- package/tools/notifications.js +58 -48
- package/tools/observe.js +12 -15
- package/tools/onboarding.js +8 -11
- package/tools/open.js +13 -144
- package/tools/party-game.js +23 -12
- package/tools/patterns.js +2 -1
- package/tools/ping.js +5 -7
- package/tools/react.js +28 -30
- package/tools/{_deprecated/recall.js → recall.js} +5 -10
- package/tools/release.js +4 -2
- package/tools/{_deprecated/remember.js → remember.js} +4 -6
- package/tools/report.js +2 -2
- package/tools/request.js +6 -26
- package/tools/reserve.js +1 -1
- package/tools/session-fork.js +97 -0
- package/tools/session-save.js +109 -0
- package/tools/settings.js +30 -99
- package/tools/ship.js +74 -56
- package/tools/{_deprecated/skills-exchange.js → skills-exchange.js} +38 -39
- package/tools/social-inbox.js +22 -28
- package/tools/social-post.js +24 -27
- package/tools/solo-game.js +54 -46
- package/tools/start.js +14 -148
- package/tools/status.js +21 -68
- package/tools/submit.js +4 -2
- package/tools/suggest-tags.js +36 -33
- package/tools/summarize.js +19 -16
- package/tools/tag-suggestions.js +72 -73
- package/tools/test.js +1 -1
- package/tools/{_deprecated/tictactoe.js → tictactoe.js} +26 -26
- package/tools/token.js +4 -4
- package/tools/update.js +1 -2
- package/tools/watch.js +132 -112
- package/tools/who.js +20 -40
- package/tools/{_deprecated/wordassociation.js → wordassociation.js} +23 -20
- package/tools/workshop-buddy.js +52 -53
- package/tools/x-mentions.js +0 -1
- package/tools/x-reply.js +0 -1
- package/twitter.js +14 -20
- package/version.json +8 -10
- package/analytics.js +0 -107
- package/auth-store.js +0 -148
- package/auto-update.js +0 -130
- package/bridges/bridge-monitor.js +0 -388
- package/bridges/discord-bot.js +0 -431
- package/bridges/farcaster.js +0 -299
- package/bridges/telegram.js +0 -261
- package/bridges/webhook-health.js +0 -420
- package/bridges/webhook-server.js +0 -437
- package/bridges/whatsapp.js +0 -441
- package/bridges/x-webhook.js +0 -423
- package/games/arcade.js +0 -406
- package/games/chess.js +0 -451
- package/games/colorguess.js +0 -343
- package/games/crossword-words.js +0 -171
- package/games/crossword.js +0 -461
- package/games/drawing.js +0 -347
- package/games/gameroulette.js +0 -300
- package/games/gamerouter.js +0 -336
- package/games/gamestatus.js +0 -337
- package/games/guessnumber.js +0 -209
- package/games/hangman.js +0 -279
- package/games/memory.js +0 -338
- package/games/multiplayer-tictactoe.js +0 -389
- package/games/pixelart.js +0 -399
- package/games/quickduel.js +0 -354
- package/games/riddle.js +0 -371
- package/games/rockpaperscissors.js +0 -291
- package/games/snake.js +0 -406
- package/games/storybuilder.js +0 -343
- package/games/tictactoe.js +0 -345
- package/games/twentyquestions.js +0 -286
- package/games/twotruths.js +0 -207
- package/games/werewolf.js +0 -508
- package/games/wordassociation.js +0 -247
- package/games/wordchain.js +0 -135
- package/intelligence/interests.js +0 -369
- package/notification-emitter.js +0 -77
- package/setup.js +0 -480
- package/smart-inbox.js +0 -276
- package/tools/_deprecated/auto-suggest-connections.js +0 -304
- package/tools/_deprecated/bootstrap-skills.js +0 -231
- package/tools/_deprecated/bridge-dashboard.js +0 -342
- package/tools/_deprecated/bridge-health.js +0 -400
- package/tools/_deprecated/bridge-live.js +0 -384
- package/tools/_deprecated/bridges.js +0 -383
- package/tools/_deprecated/colorguess.js +0 -281
- package/tools/_deprecated/discover-insights.js +0 -379
- package/tools/_deprecated/discover-momentum.js +0 -256
- package/tools/_deprecated/discovery-analytics.js +0 -345
- package/tools/_deprecated/discovery-auto-suggest.js +0 -275
- package/tools/_deprecated/discovery-bootstrap.js +0 -267
- package/tools/_deprecated/discovery-daily.js +0 -375
- package/tools/_deprecated/discovery-dashboard.js +0 -385
- package/tools/_deprecated/discovery-digest.js +0 -314
- package/tools/_deprecated/discovery-hub.js +0 -357
- package/tools/_deprecated/discovery-insights.js +0 -384
- package/tools/_deprecated/discovery-momentum.js +0 -281
- package/tools/_deprecated/discovery-monitor.js +0 -319
- package/tools/_deprecated/discovery-proactive.js +0 -300
- package/tools/_deprecated/draw.js +0 -317
- package/tools/_deprecated/farcaster.js +0 -307
- package/tools/_deprecated/games-catalog.js +0 -376
- package/tools/_deprecated/games.js +0 -313
- package/tools/_deprecated/guessnumber.js +0 -194
- package/tools/_deprecated/hangman.js +0 -129
- package/tools/_deprecated/multiplayer-tictactoe.js +0 -303
- package/tools/_deprecated/riddle.js +0 -240
- package/tools/_deprecated/run-bootstrap.js +0 -69
- package/tools/_deprecated/skills-analytics.js +0 -349
- package/tools/_deprecated/skills-bootstrap.js +0 -301
- package/tools/_deprecated/skills-dashboard.js +0 -268
- package/tools/_deprecated/skills.js +0 -380
- package/tools/_deprecated/smart-intro.js +0 -353
- package/tools/_deprecated/storybuilder.js +0 -331
- package/tools/_deprecated/telegram-bot.js +0 -183
- package/tools/_deprecated/telegram-setup.js +0 -214
- package/tools/_deprecated/twentyquestions.js +0 -143
- package/tools/_shared.js +0 -234
- package/tools/_work-context.js +0 -338
- package/tools/_work-context.manual-test.js +0 -199
- package/tools/_work-context.test.js +0 -260
- package/tools/activity.js +0 -220
- package/tools/agent-treasury.js +0 -288
- package/tools/analytics.js +0 -191
- package/tools/approve.js +0 -197
- package/tools/arcade.js +0 -173
- package/tools/artifacts-price.js +0 -107
- package/tools/ask-expert.js +0 -160
- package/tools/available.js +0 -120
- package/tools/become-expert.js +0 -150
- package/tools/broadcast.js +0 -325
- package/tools/chat.js +0 -202
- package/tools/collaborative-drawing.js +0 -286
- package/tools/connection-status.js +0 -178
- package/tools/earnings.js +0 -126
- package/tools/friends.js +0 -207
- package/tools/genesis.js +0 -233
- package/tools/gig-browse.js +0 -206
- package/tools/gig-complete.js +0 -144
- package/tools/health.js +0 -87
- package/tools/leaderboard.js +0 -117
- package/tools/lib/git-apply.js +0 -206
- package/tools/lib/git-bundle.js +0 -407
- package/tools/mint.js +0 -377
- package/tools/plan.js +0 -225
- package/tools/profile.js +0 -219
- package/tools/proof-of-work.js +0 -144
- package/tools/pulse.js +0 -218
- package/tools/reply.js +0 -166
- package/tools/reputation.js +0 -175
- package/tools/schedule.js +0 -367
- package/tools/search-messages.js +0 -123
- package/tools/session.js +0 -467
- package/tools/session_price.js +0 -128
- package/tools/smart-check.js +0 -201
- package/tools/social-processor.js +0 -445
- package/tools/streak.js +0 -147
- package/tools/stuck.js +0 -297
- package/tools/subscribe.js +0 -148
- package/tools/subscriptions.js +0 -134
- package/tools/tip.js +0 -193
- package/tools/wallet.js +0 -269
- package/tools/webhook-test.js +0 -388
- package/tools/withdraw.js +0 -145
- package/tools/work-summary.js +0 -96
- package/tools/workshop.js +0 -327
- /package/tools/{l2-bridge.js → _experimental/l2-bridge.js} +0 -0
- /package/tools/{l2.js → _experimental/l2.js} +0 -0
- /package/tools/{_deprecated/away.js → away.js} +0 -0
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Discovery Monitor — Proactive matching when people come online
|
|
3
|
-
*
|
|
4
|
-
* Features:
|
|
5
|
-
* - Watches for new users joining
|
|
6
|
-
* - Automatically suggests connections for new users
|
|
7
|
-
* - Identifies high-value connections when users become active
|
|
8
|
-
* - Sends smart welcome messages with connection suggestions
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const config = require('../config');
|
|
12
|
-
const store = require('../store');
|
|
13
|
-
const userProfiles = require('../store/profiles');
|
|
14
|
-
const { suggest_connection } = require('./_actions');
|
|
15
|
-
const { formatTimeAgo } = require('./_shared');
|
|
16
|
-
|
|
17
|
-
// Watch for new users and suggest welcome connections
|
|
18
|
-
async function monitorNewUsers() {
|
|
19
|
-
const recentUsers = await getRecentUsers(24); // Last 24 hours
|
|
20
|
-
const suggestions = [];
|
|
21
|
-
|
|
22
|
-
for (const user of recentUsers) {
|
|
23
|
-
if (user.isNew) {
|
|
24
|
-
const welcomeConnections = await getWelcomeConnections(user.handle);
|
|
25
|
-
|
|
26
|
-
for (const connection of welcomeConnections.slice(0, 2)) {
|
|
27
|
-
// Suggest the connection
|
|
28
|
-
await suggest_connection(user.handle, connection.handle, connection.reason);
|
|
29
|
-
suggestions.push({
|
|
30
|
-
from: user.handle,
|
|
31
|
-
to: connection.handle,
|
|
32
|
-
reason: connection.reason,
|
|
33
|
-
type: 'welcome'
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return suggestions;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Get users who joined recently
|
|
43
|
-
async function getRecentUsers(hoursBack = 24) {
|
|
44
|
-
const profiles = await userProfiles.getAllProfiles();
|
|
45
|
-
const cutoff = Date.now() - (hoursBack * 60 * 60 * 1000);
|
|
46
|
-
|
|
47
|
-
const recent = profiles.filter(p =>
|
|
48
|
-
p.firstSeen && p.firstSeen > cutoff
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return recent.map(p => ({
|
|
52
|
-
handle: p.handle,
|
|
53
|
-
firstSeen: p.firstSeen,
|
|
54
|
-
building: p.building,
|
|
55
|
-
interests: p.interests || [],
|
|
56
|
-
tags: p.tags || [],
|
|
57
|
-
isNew: true
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Find best welcome connections for new users
|
|
62
|
-
async function getWelcomeConnections(newUserHandle) {
|
|
63
|
-
const newUser = await userProfiles.getProfile(newUserHandle);
|
|
64
|
-
const allProfiles = await userProfiles.getAllProfiles();
|
|
65
|
-
|
|
66
|
-
// Filter to established users (not brand new)
|
|
67
|
-
const weekAgo = Date.now() - (7 * 24 * 60 * 60 * 1000);
|
|
68
|
-
const establishedUsers = allProfiles.filter(p =>
|
|
69
|
-
p.handle !== newUserHandle &&
|
|
70
|
-
p.firstSeen && p.firstSeen < weekAgo &&
|
|
71
|
-
(p.connections?.length || 0) >= 1 // Has made at least one connection
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
if (establishedUsers.length === 0) {
|
|
75
|
-
return []; // No established users to suggest
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const potentialConnections = [];
|
|
79
|
-
|
|
80
|
-
for (const user of establishedUsers) {
|
|
81
|
-
const score = calculateWelcomeScore(newUser, user);
|
|
82
|
-
|
|
83
|
-
if (score.total > 15) {
|
|
84
|
-
potentialConnections.push({
|
|
85
|
-
handle: user.handle,
|
|
86
|
-
score: score.total,
|
|
87
|
-
reason: score.reason,
|
|
88
|
-
building: user.building,
|
|
89
|
-
lastSeen: user.lastSeen
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Sort by score and prioritize recently active users
|
|
95
|
-
return potentialConnections
|
|
96
|
-
.sort((a, b) => {
|
|
97
|
-
// Boost recently active users
|
|
98
|
-
const aActive = a.lastSeen > Date.now() - (24 * 60 * 60 * 1000) ? 10 : 0;
|
|
99
|
-
const bActive = b.lastSeen > Date.now() - (24 * 60 * 60 * 1000) ? 10 : 0;
|
|
100
|
-
|
|
101
|
-
return (b.score + bActive) - (a.score + aActive);
|
|
102
|
-
})
|
|
103
|
-
.slice(0, 3);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Calculate welcome connection score (similar to discovery but weighted for new users)
|
|
107
|
-
function calculateWelcomeScore(newUser, establishedUser) {
|
|
108
|
-
let score = 0;
|
|
109
|
-
let reasons = [];
|
|
110
|
-
|
|
111
|
-
// Base score for being an established, connected user
|
|
112
|
-
score += 10;
|
|
113
|
-
reasons.push('Active community member');
|
|
114
|
-
|
|
115
|
-
// Interest overlap (high weight for new users)
|
|
116
|
-
if (newUser.interests?.length > 0 && establishedUser.interests?.length > 0) {
|
|
117
|
-
const shared = newUser.interests.filter(i =>
|
|
118
|
-
establishedUser.interests.some(ei => ei.toLowerCase() === i.toLowerCase())
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
if (shared.length > 0) {
|
|
122
|
-
score += shared.length * 20;
|
|
123
|
-
reasons.unshift(`Both interested in ${shared.join(', ')}`);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Tag/skill overlap
|
|
128
|
-
if (newUser.tags?.length > 0 && establishedUser.tags?.length > 0) {
|
|
129
|
-
const sharedTags = newUser.tags.filter(t =>
|
|
130
|
-
establishedUser.tags.some(et => et.toLowerCase() === t.toLowerCase())
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
if (sharedTags.length > 0) {
|
|
134
|
-
score += sharedTags.length * 15;
|
|
135
|
-
reasons.unshift(`Both work with ${sharedTags.join(', ')}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Building similar things
|
|
140
|
-
if (newUser.building && establishedUser.building) {
|
|
141
|
-
const newBuilding = newUser.building.toLowerCase();
|
|
142
|
-
const establishedBuilding = establishedUser.building.toLowerCase();
|
|
143
|
-
|
|
144
|
-
const words1 = newBuilding.split(/\s+/).filter(w => w.length > 3);
|
|
145
|
-
const words2 = establishedBuilding.split(/\s+/).filter(w => w.length > 3);
|
|
146
|
-
const overlap = words1.filter(w => words2.includes(w));
|
|
147
|
-
|
|
148
|
-
if (overlap.length > 0) {
|
|
149
|
-
score += overlap.length * 12;
|
|
150
|
-
reasons.unshift(`Both building ${overlap.join(', ')} projects`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Complementary skills boost (mentor potential)
|
|
155
|
-
if (newUser.tags && establishedUser.tags) {
|
|
156
|
-
const complementary = findComplementarySkills(newUser.tags, establishedUser.tags);
|
|
157
|
-
if (complementary.length > 0) {
|
|
158
|
-
score += complementary.length * 8;
|
|
159
|
-
reasons.push(`Could help with ${complementary.join(', ')}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Choose the best reason
|
|
164
|
-
const primaryReason = reasons[0] || 'Welcoming community member';
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
total: score,
|
|
168
|
-
reason: primaryReason
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Find complementary skills for mentorship
|
|
173
|
-
function findComplementarySkills(newUserTags, establishedTags) {
|
|
174
|
-
const mentorPairs = [
|
|
175
|
-
{ beginner: 'frontend', mentor: 'fullstack' },
|
|
176
|
-
{ beginner: 'react', mentor: 'senior-engineer' },
|
|
177
|
-
{ beginner: 'ai', mentor: 'machine-learning' },
|
|
178
|
-
{ beginner: 'startup', mentor: 'founder' },
|
|
179
|
-
{ beginner: 'design', mentor: 'product-design' },
|
|
180
|
-
];
|
|
181
|
-
|
|
182
|
-
const complementary = [];
|
|
183
|
-
|
|
184
|
-
for (const pair of mentorPairs) {
|
|
185
|
-
const hasBeginnerSkill = newUserTags.some(t =>
|
|
186
|
-
t.toLowerCase().includes(pair.beginner.toLowerCase())
|
|
187
|
-
);
|
|
188
|
-
const hasMentorSkill = establishedTags.some(t =>
|
|
189
|
-
t.toLowerCase().includes(pair.mentor.toLowerCase())
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
if (hasBeginnerSkill && hasMentorSkill) {
|
|
193
|
-
complementary.push(pair.mentor);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return complementary;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Monitor for high-value connections (mutual interest spikes)
|
|
201
|
-
async function monitorHighValueConnections() {
|
|
202
|
-
const profiles = await userProfiles.getAllProfiles();
|
|
203
|
-
const activeUsers = await store.getActiveUsers();
|
|
204
|
-
|
|
205
|
-
const highValueOpportunities = [];
|
|
206
|
-
|
|
207
|
-
for (let i = 0; i < activeUsers.length; i++) {
|
|
208
|
-
for (let j = i + 1; j < activeUsers.length; j++) {
|
|
209
|
-
const user1 = activeUsers[i];
|
|
210
|
-
const user2 = activeUsers[j];
|
|
211
|
-
|
|
212
|
-
// Skip if already connected
|
|
213
|
-
const alreadyConnected = await userProfiles.hasBeenConnected(user1.handle, user2.handle);
|
|
214
|
-
if (alreadyConnected) continue;
|
|
215
|
-
|
|
216
|
-
const profile1 = await userProfiles.getProfile(user1.handle);
|
|
217
|
-
const profile2 = await userProfiles.getProfile(user2.handle);
|
|
218
|
-
|
|
219
|
-
const matchScore = calculateTimeSensitiveScore(profile1, profile2, user1, user2);
|
|
220
|
-
|
|
221
|
-
if (matchScore.score > 30) { // High threshold for proactive suggestions
|
|
222
|
-
highValueOpportunities.push({
|
|
223
|
-
user1: user1.handle,
|
|
224
|
-
user2: user2.handle,
|
|
225
|
-
score: matchScore.score,
|
|
226
|
-
reason: matchScore.reason,
|
|
227
|
-
urgency: 'both-online'
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return highValueOpportunities.sort((a, b) => b.score - a.score).slice(0, 3);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// Calculate time-sensitive match scores (bonus for being online together)
|
|
237
|
-
function calculateTimeSensitiveScore(profile1, profile2, activeUser1, activeUser2) {
|
|
238
|
-
let score = 0;
|
|
239
|
-
let reasons = [];
|
|
240
|
-
|
|
241
|
-
// Base match calculation (similar to discovery)
|
|
242
|
-
if (profile1.interests && profile2.interests) {
|
|
243
|
-
const shared = profile1.interests.filter(i => profile2.interests.includes(i));
|
|
244
|
-
score += shared.length * 15;
|
|
245
|
-
if (shared.length > 0) reasons.push(`Both into ${shared.join(', ')}`);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (profile1.tags && profile2.tags) {
|
|
249
|
-
const sharedTags = profile1.tags.filter(t => profile2.tags.includes(t));
|
|
250
|
-
score += sharedTags.length * 12;
|
|
251
|
-
if (sharedTags.length > 0) reasons.push(`Both skilled in ${sharedTags.join(', ')}`);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// Time bonus - both online now
|
|
255
|
-
score += 20;
|
|
256
|
-
reasons.unshift('Both online right now');
|
|
257
|
-
|
|
258
|
-
// Activity similarity bonus
|
|
259
|
-
if (activeUser1.status && activeUser2.status) {
|
|
260
|
-
if (activeUser1.status === activeUser2.status) {
|
|
261
|
-
score += 10;
|
|
262
|
-
reasons.push(`Both ${activeUser1.status}`);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return {
|
|
267
|
-
score,
|
|
268
|
-
reason: reasons[0] || 'Great time to connect'
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Get connection statistics for monitoring
|
|
273
|
-
async function getConnectionStats() {
|
|
274
|
-
const profiles = await userProfiles.getAllProfiles();
|
|
275
|
-
|
|
276
|
-
const stats = {
|
|
277
|
-
totalUsers: profiles.length,
|
|
278
|
-
usersWithConnections: 0,
|
|
279
|
-
avgConnectionsPerUser: 0,
|
|
280
|
-
connectionsMadeToday: 0,
|
|
281
|
-
newUsersToday: 0,
|
|
282
|
-
activeUsersToday: 0
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const today = Date.now() - (24 * 60 * 60 * 1000);
|
|
286
|
-
let totalConnections = 0;
|
|
287
|
-
|
|
288
|
-
for (const profile of profiles) {
|
|
289
|
-
if (profile.connections && profile.connections.length > 0) {
|
|
290
|
-
stats.usersWithConnections++;
|
|
291
|
-
totalConnections += profile.connections.length;
|
|
292
|
-
|
|
293
|
-
// Count connections made today
|
|
294
|
-
const todayConnections = profile.connections.filter(c => c.timestamp > today);
|
|
295
|
-
stats.connectionsMadeToday += todayConnections.length;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (profile.firstSeen > today) {
|
|
299
|
-
stats.newUsersToday++;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (profile.lastSeen > today) {
|
|
303
|
-
stats.activeUsersToday++;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
stats.avgConnectionsPerUser = profiles.length > 0 ? (totalConnections / 2) / profiles.length : 0;
|
|
308
|
-
stats.connectionsMadeToday = Math.floor(stats.connectionsMadeToday / 2); // Each connection counted twice
|
|
309
|
-
|
|
310
|
-
return stats;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
module.exports = {
|
|
314
|
-
monitorNewUsers,
|
|
315
|
-
monitorHighValueConnections,
|
|
316
|
-
getWelcomeConnections,
|
|
317
|
-
getConnectionStats,
|
|
318
|
-
getRecentUsers
|
|
319
|
-
};
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vibe discovery-proactive — Real-time connection opportunities
|
|
3
|
-
*
|
|
4
|
-
* Monitors for immediate connection opportunities:
|
|
5
|
-
* - Users who just came online (welcome back suggestions)
|
|
6
|
-
* - Both users online at same time (perfect timing)
|
|
7
|
-
* - Recent ships that might interest others
|
|
8
|
-
* - Trending topic clusters
|
|
9
|
-
* - Follow-up on previous connections
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const config = require('../config');
|
|
13
|
-
const store = require('../store');
|
|
14
|
-
const userProfiles = require('../store/profiles');
|
|
15
|
-
const proactiveDiscovery = require('./_proactive-discovery');
|
|
16
|
-
const { formatTimeAgo, requireInit } = require('./_shared');
|
|
17
|
-
|
|
18
|
-
const definition = {
|
|
19
|
-
name: 'vibe_discovery_proactive',
|
|
20
|
-
description: 'Find real-time connection opportunities and trending topics.',
|
|
21
|
-
inputSchema: {
|
|
22
|
-
type: 'object',
|
|
23
|
-
properties: {
|
|
24
|
-
action: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
enum: ['opportunities', 'welcome', 'trending', 'ships'],
|
|
27
|
-
description: 'Type of proactive discovery to run'
|
|
28
|
-
},
|
|
29
|
-
autoSuggest: {
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
description: 'Automatically make connection suggestions'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Find and display current connection opportunities
|
|
38
|
-
async function findCurrentOpportunities(autoSuggest = false) {
|
|
39
|
-
const opportunities = await proactiveDiscovery.findOnlineConnectionOpportunities();
|
|
40
|
-
let actionsTaken = 0;
|
|
41
|
-
|
|
42
|
-
let display = `## Real-Time Connection Opportunities 🎯\n\n`;
|
|
43
|
-
|
|
44
|
-
if (opportunities.length === 0) {
|
|
45
|
-
display += `No high-value connections found among current online users.\n\n`;
|
|
46
|
-
display += `**Try:**\n`;
|
|
47
|
-
display += `• Check back when more users are online\n`;
|
|
48
|
-
display += `• \`discovery-proactive trending\` for topic-based connections\n`;
|
|
49
|
-
display += `• \`discovery-proactive ships\` for recent ship connections`;
|
|
50
|
-
|
|
51
|
-
return { display, actionsTaken };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
display += `Found ${opportunities.length} high-value opportunities:\n\n`;
|
|
55
|
-
|
|
56
|
-
for (const opp of opportunities.slice(0, 5)) {
|
|
57
|
-
display += `**@${opp.user1} ↔ @${opp.user2}** _(${opp.score}% match)_\n`;
|
|
58
|
-
|
|
59
|
-
if (opp.reasons.length > 0) {
|
|
60
|
-
display += `🔗 ${opp.reasons.join(' • ')}\n`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
display += `⚡ Both online now - perfect timing!\n`;
|
|
64
|
-
|
|
65
|
-
if (opp.profiles.profile1.building) {
|
|
66
|
-
display += `${opp.user1}: ${opp.profiles.profile1.building}\n`;
|
|
67
|
-
}
|
|
68
|
-
if (opp.profiles.profile2.building) {
|
|
69
|
-
display += `${opp.user2}: ${opp.profiles.profile2.building}\n`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
display += `\n`;
|
|
73
|
-
|
|
74
|
-
// Auto-suggest if requested
|
|
75
|
-
if (autoSuggest) {
|
|
76
|
-
try {
|
|
77
|
-
// Make the suggestion (this would typically call suggest_connection)
|
|
78
|
-
proactiveDiscovery.recordSuggestion(opp.user1, opp.user2);
|
|
79
|
-
actionsTaken++;
|
|
80
|
-
display += `✅ Connection suggested to both users\n\n`;
|
|
81
|
-
} catch (error) {
|
|
82
|
-
display += `❌ Failed to suggest: ${error.message}\n\n`;
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
display += `Run with \`autoSuggest: true\` to make suggestions automatically\n\n`;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return { display, actionsTaken };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Welcome back users who just came online
|
|
93
|
-
async function welcomeNewOnlineUsers() {
|
|
94
|
-
const newOnline = await proactiveDiscovery.findNewOnlineUsers();
|
|
95
|
-
|
|
96
|
-
let display = `## Welcome Back Online Users 👋\n\n`;
|
|
97
|
-
|
|
98
|
-
if (newOnline.length === 0) {
|
|
99
|
-
display += `No users have come online recently.\n\n`;
|
|
100
|
-
display += `This feature detects users who came online in the last 10 minutes.`;
|
|
101
|
-
return { display, actionsTaken: 0 };
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
display += `Found ${newOnline.length} users who just came online:\n\n`;
|
|
105
|
-
|
|
106
|
-
let actionsTaken = 0;
|
|
107
|
-
|
|
108
|
-
for (const user of newOnline) {
|
|
109
|
-
display += `**@${user.handle}** just came online\n`;
|
|
110
|
-
|
|
111
|
-
if (user.profile.building) {
|
|
112
|
-
display += `Building: ${user.profile.building}\n`;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Get suggestions for this user
|
|
116
|
-
const suggestions = await proactiveDiscovery.generateWelcomeBackSuggestions(user.handle);
|
|
117
|
-
|
|
118
|
-
if (suggestions.length > 0) {
|
|
119
|
-
display += `\n**Immediate connection opportunities:**\n`;
|
|
120
|
-
|
|
121
|
-
for (const suggestion of suggestions.slice(0, 2)) {
|
|
122
|
-
display += `• @${suggestion.handle} (${suggestion.score}% match) - ${suggestion.reasons[0]}\n`;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
actionsTaken++;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
display += `\n`;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (actionsTaken > 0) {
|
|
132
|
-
display += `💡 Perfect timing for connections - everyone's online now!\n`;
|
|
133
|
-
display += `Use \`message @handle\` to reach out while they're active.`;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return { display, actionsTaken };
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Find trending topic clusters
|
|
140
|
-
async function findTrendingClusters() {
|
|
141
|
-
const clusters = await proactiveDiscovery.generateTrendingTopicClusters();
|
|
142
|
-
const suggestions = await proactiveDiscovery.suggestTrendingTopicConnections();
|
|
143
|
-
|
|
144
|
-
let display = `## Trending Topic Clusters 📈\n\n`;
|
|
145
|
-
|
|
146
|
-
const clusterEntries = Object.entries(clusters);
|
|
147
|
-
|
|
148
|
-
if (clusterEntries.length === 0) {
|
|
149
|
-
display += `No trending topics detected yet.\n\n`;
|
|
150
|
-
display += `Trending topics are identified when multiple users:\n`;
|
|
151
|
-
display += `• Ship projects with similar keywords\n`;
|
|
152
|
-
display += `• Share similar interests or tags\n`;
|
|
153
|
-
display += `• Work on related projects\n\n`;
|
|
154
|
-
display += `Come back when there's more activity!`;
|
|
155
|
-
return { display, actionsTaken: 0 };
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
display += `Found ${clusterEntries.length} trending topics:\n\n`;
|
|
159
|
-
|
|
160
|
-
for (const [topic, users] of clusterEntries.slice(0, 5)) {
|
|
161
|
-
display += `**${topic}** (${users.length} users)\n`;
|
|
162
|
-
display += `${users.slice(0, 4).map(u => `@${u.handle}`).join(', ')}`;
|
|
163
|
-
if (users.length > 4) {
|
|
164
|
-
display += ` +${users.length - 4} more`;
|
|
165
|
-
}
|
|
166
|
-
display += `\n\n`;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (suggestions.length > 0) {
|
|
170
|
-
display += `**Connection Opportunities:**\n\n`;
|
|
171
|
-
|
|
172
|
-
for (const suggestion of suggestions.slice(0, 3)) {
|
|
173
|
-
display += `**@${suggestion.user1} ↔ @${suggestion.user2}**\n`;
|
|
174
|
-
display += `Topic: ${suggestion.topic} • Match: ${suggestion.score}%\n`;
|
|
175
|
-
display += `${suggestion.reason}\n\n`;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return { display, actionsTaken: suggestions.length };
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Find connections based on recent ships
|
|
183
|
-
async function findShipConnections() {
|
|
184
|
-
const recentShippers = await proactiveDiscovery.findRecentShippers();
|
|
185
|
-
const shipConnections = await proactiveDiscovery.findShipBasedConnections();
|
|
186
|
-
|
|
187
|
-
let display = `## Recent Ships & Connection Opportunities 🚢\n\n`;
|
|
188
|
-
|
|
189
|
-
if (recentShippers.length === 0) {
|
|
190
|
-
display += `No recent ships found (last 24 hours).\n\n`;
|
|
191
|
-
display += `When users ship projects, I can:\n`;
|
|
192
|
-
display += `• Find others working on similar things\n`;
|
|
193
|
-
display += `• Connect complementary skill sets\n`;
|
|
194
|
-
display += `• Suggest collaboration opportunities\n\n`;
|
|
195
|
-
display += `Encourage people to use \`ship "what they built"\`!`;
|
|
196
|
-
return { display, actionsTaken: 0 };
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
display += `**Recent Ships (last 24h):**\n`;
|
|
200
|
-
for (const shipper of recentShippers.slice(0, 5)) {
|
|
201
|
-
display += `• @${shipper.handle}: ${shipper.ships[0].what}\n`;
|
|
202
|
-
}
|
|
203
|
-
display += `\n`;
|
|
204
|
-
|
|
205
|
-
if (shipConnections.length > 0) {
|
|
206
|
-
display += `**Connection Opportunities:**\n\n`;
|
|
207
|
-
|
|
208
|
-
for (const connection of shipConnections.slice(0, 5)) {
|
|
209
|
-
display += `**@${connection.shipper} → @${connection.interestedUser}**\n`;
|
|
210
|
-
display += `${connection.reason}\n`;
|
|
211
|
-
display += `_${formatTimeAgo(connection.timestamp)}_\n\n`;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
display += `💡 These users might benefit from connecting based on recent ships!`;
|
|
215
|
-
} else {
|
|
216
|
-
display += `No specific ship-based connections identified yet.\n`;
|
|
217
|
-
display += `As more people ship and share interests, better matches will emerge.`;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return { display, actionsTaken: shipConnections.length };
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
async function handler(args) {
|
|
224
|
-
const initCheck = requireInit();
|
|
225
|
-
if (initCheck) return initCheck;
|
|
226
|
-
|
|
227
|
-
const action = args.action || 'opportunities';
|
|
228
|
-
const autoSuggest = args.autoSuggest || false;
|
|
229
|
-
|
|
230
|
-
let display = '';
|
|
231
|
-
let actionsTaken = 0;
|
|
232
|
-
|
|
233
|
-
try {
|
|
234
|
-
switch (action) {
|
|
235
|
-
case 'opportunities': {
|
|
236
|
-
const result = await findCurrentOpportunities(autoSuggest);
|
|
237
|
-
display = result.display;
|
|
238
|
-
actionsTaken = result.actionsTaken;
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
case 'welcome': {
|
|
243
|
-
const result = await welcomeNewOnlineUsers();
|
|
244
|
-
display = result.display;
|
|
245
|
-
actionsTaken = result.actionsTaken;
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
case 'trending': {
|
|
250
|
-
const result = await findTrendingClusters();
|
|
251
|
-
display = result.display;
|
|
252
|
-
actionsTaken = result.actionsTaken;
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
case 'ships': {
|
|
257
|
-
const result = await findShipConnections();
|
|
258
|
-
display = result.display;
|
|
259
|
-
actionsTaken = result.actionsTaken;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
default:
|
|
264
|
-
display = `## Proactive Discovery Commands
|
|
265
|
-
|
|
266
|
-
**\`discovery-proactive opportunities\`** — Real-time connection opportunities
|
|
267
|
-
**\`discovery-proactive welcome\`** — Welcome users who just came online
|
|
268
|
-
**\`discovery-proactive trending\`** — Find trending topic clusters
|
|
269
|
-
**\`discovery-proactive ships\`** — Connections based on recent ships
|
|
270
|
-
|
|
271
|
-
**Advanced:**
|
|
272
|
-
Add \`autoSuggest: true\` to automatically make connection suggestions
|
|
273
|
-
|
|
274
|
-
**How it works:**
|
|
275
|
-
• Monitors users coming online in real-time
|
|
276
|
-
• Identifies when both users in a potential match are active
|
|
277
|
-
• Tracks trending topics and clusters users accordingly
|
|
278
|
-
• Finds connection opportunities based on recent ships
|
|
279
|
-
• Provides perfect-timing suggestions when both users are online`;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (actionsTaken > 0) {
|
|
283
|
-
display += `\n\n---\n**Actions taken:** ${actionsTaken}`;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
} catch (error) {
|
|
287
|
-
display = `## Proactive Discovery Error
|
|
288
|
-
|
|
289
|
-
${error.message}
|
|
290
|
-
|
|
291
|
-
Try:
|
|
292
|
-
• \`discovery-proactive opportunities\` for online connections
|
|
293
|
-
• \`discovery-proactive trending\` for topic clusters
|
|
294
|
-
• \`who\` to see current online users`;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return { display };
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
module.exports = { definition, handler };
|