slashvibe-mcp 0.2.9 → 0.3.13

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 (205) hide show
  1. package/README.md +1 -0
  2. package/analytics.js +107 -0
  3. package/auth-store.js +148 -0
  4. package/auto-update.js +130 -0
  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/config.js +154 -5
  14. package/crypto.js +3 -8
  15. package/games/arcade.js +406 -0
  16. package/games/chess.js +451 -0
  17. package/games/colorguess.js +343 -0
  18. package/games/crossword-words.js +171 -0
  19. package/games/crossword.js +461 -0
  20. package/games/drawing.js +347 -0
  21. package/games/gameroulette.js +300 -0
  22. package/games/gamerouter.js +336 -0
  23. package/games/gamestatus.js +337 -0
  24. package/games/guessnumber.js +209 -0
  25. package/games/hangman.js +279 -0
  26. package/games/memory.js +338 -0
  27. package/games/multiplayer-tictactoe.js +389 -0
  28. package/games/pixelart.js +399 -0
  29. package/games/quickduel.js +354 -0
  30. package/games/riddle.js +371 -0
  31. package/games/rockpaperscissors.js +291 -0
  32. package/games/snake.js +406 -0
  33. package/games/storybuilder.js +343 -0
  34. package/games/tictactoe.js +345 -0
  35. package/games/twentyquestions.js +286 -0
  36. package/games/twotruths.js +207 -0
  37. package/games/werewolf.js +508 -0
  38. package/games/wordassociation.js +247 -0
  39. package/games/wordchain.js +135 -0
  40. package/index.js +105 -216
  41. package/intelligence/index.js +45 -0
  42. package/intelligence/infer.js +316 -0
  43. package/intelligence/interests.js +369 -0
  44. package/intelligence/patterns.js +651 -0
  45. package/intelligence/proactive.js +358 -0
  46. package/intelligence/serendipity.js +306 -0
  47. package/memory.js +166 -0
  48. package/notification-emitter.js +77 -0
  49. package/notify.js +102 -1
  50. package/package.json +21 -7
  51. package/prompts.js +1 -1
  52. package/protocol/index.js +161 -1
  53. package/setup.js +402 -0
  54. package/store/api.js +528 -82
  55. package/store/profiles.js +160 -12
  56. package/tools/_actions.js +463 -16
  57. package/tools/_deprecated/auto-suggest-connections.js +304 -0
  58. package/tools/_deprecated/bootstrap-skills.js +231 -0
  59. package/tools/_deprecated/bridge-dashboard.js +342 -0
  60. package/tools/_deprecated/bridge-health.js +400 -0
  61. package/tools/_deprecated/bridge-live.js +384 -0
  62. package/tools/_deprecated/bridges.js +383 -0
  63. package/tools/_deprecated/colorguess.js +281 -0
  64. package/tools/_deprecated/discover-insights.js +379 -0
  65. package/tools/_deprecated/discover-momentum.js +256 -0
  66. package/tools/_deprecated/discovery-analytics.js +345 -0
  67. package/tools/_deprecated/discovery-auto-suggest.js +275 -0
  68. package/tools/_deprecated/discovery-bootstrap.js +267 -0
  69. package/tools/_deprecated/discovery-daily.js +375 -0
  70. package/tools/_deprecated/discovery-dashboard.js +385 -0
  71. package/tools/_deprecated/discovery-digest.js +314 -0
  72. package/tools/_deprecated/discovery-hub.js +357 -0
  73. package/tools/_deprecated/discovery-insights.js +384 -0
  74. package/tools/_deprecated/discovery-momentum.js +281 -0
  75. package/tools/_deprecated/discovery-monitor.js +319 -0
  76. package/tools/_deprecated/discovery-proactive.js +300 -0
  77. package/tools/_deprecated/draw.js +317 -0
  78. package/tools/_deprecated/farcaster.js +307 -0
  79. package/tools/_deprecated/forget.js +119 -0
  80. package/tools/_deprecated/games-catalog.js +376 -0
  81. package/tools/_deprecated/games.js +313 -0
  82. package/tools/_deprecated/guessnumber.js +194 -0
  83. package/tools/_deprecated/hangman.js +129 -0
  84. package/tools/_deprecated/multiplayer-tictactoe.js +303 -0
  85. package/tools/_deprecated/recall.js +147 -0
  86. package/tools/_deprecated/remember.js +86 -0
  87. package/tools/_deprecated/riddle.js +240 -0
  88. package/tools/_deprecated/run-bootstrap.js +69 -0
  89. package/tools/_deprecated/skills-analytics.js +349 -0
  90. package/tools/_deprecated/skills-bootstrap.js +301 -0
  91. package/tools/_deprecated/skills-dashboard.js +268 -0
  92. package/tools/_deprecated/skills.js +380 -0
  93. package/tools/_deprecated/smart-intro.js +353 -0
  94. package/tools/_deprecated/storybuilder.js +331 -0
  95. package/tools/_deprecated/telegram-bot.js +183 -0
  96. package/tools/_deprecated/telegram-setup.js +214 -0
  97. package/tools/_deprecated/twentyquestions.js +143 -0
  98. package/tools/_discovery-enhanced.js +290 -0
  99. package/tools/_discovery.js +439 -0
  100. package/tools/_proactive-discovery.js +301 -0
  101. package/tools/_shared/index.js +64 -0
  102. package/tools/_shared.js +234 -0
  103. package/tools/_work-context.js +338 -0
  104. package/tools/_work-context.manual-test.js +199 -0
  105. package/tools/_work-context.test.js +260 -0
  106. package/tools/activity.js +220 -0
  107. package/tools/admin-inbox.js +218 -0
  108. package/tools/agent-treasury.js +288 -0
  109. package/tools/analytics.js +191 -0
  110. package/tools/approve.js +197 -0
  111. package/tools/arcade.js +173 -0
  112. package/tools/artifact-create.js +17 -11
  113. package/tools/artifact-view.js +31 -1
  114. package/tools/artifacts-price.js +47 -43
  115. package/tools/ask-expert.js +160 -0
  116. package/tools/available.js +120 -0
  117. package/tools/become-expert.js +150 -0
  118. package/tools/broadcast.js +286 -0
  119. package/tools/chat.js +202 -0
  120. package/tools/collaborative-drawing.js +286 -0
  121. package/tools/connection-status.js +178 -0
  122. package/tools/crossword.js +17 -1
  123. package/tools/discover.js +350 -34
  124. package/tools/dm.js +115 -73
  125. package/tools/drawing.js +1 -1
  126. package/tools/earnings.js +126 -0
  127. package/tools/echo.js +16 -0
  128. package/tools/feed.js +51 -7
  129. package/tools/follow.js +224 -0
  130. package/tools/friends.js +207 -0
  131. package/tools/game.js +2 -2
  132. package/tools/genesis.js +233 -0
  133. package/tools/gig-browse.js +206 -0
  134. package/tools/gig-complete.js +144 -0
  135. package/tools/handoff.js +7 -1
  136. package/tools/help.js +4 -4
  137. package/tools/idea.js +9 -2
  138. package/tools/inbox.js +334 -28
  139. package/tools/init.js +727 -36
  140. package/tools/invite.js +15 -4
  141. package/tools/l2-bridge.js +272 -0
  142. package/tools/l2-status.js +217 -0
  143. package/tools/l2.js +206 -0
  144. package/tools/migrate.js +156 -0
  145. package/tools/mint.js +377 -0
  146. package/tools/multiplayer-game.js +1 -1
  147. package/tools/notifications.js +415 -0
  148. package/tools/observe.js +200 -0
  149. package/tools/onboarding.js +147 -0
  150. package/tools/open.js +143 -12
  151. package/tools/party-game.js +2 -2
  152. package/tools/plan.js +225 -0
  153. package/tools/presence-agent.js +7 -0
  154. package/tools/proof-of-work.js +100 -104
  155. package/tools/pulse.js +218 -0
  156. package/tools/reply.js +166 -0
  157. package/tools/report.js +2 -2
  158. package/tools/reputation.js +175 -0
  159. package/tools/request.js +17 -3
  160. package/tools/schedule.js +367 -0
  161. package/tools/search-messages.js +123 -0
  162. package/tools/session.js +420 -0
  163. package/tools/session_price.js +128 -0
  164. package/tools/settings.js +126 -3
  165. package/tools/ship.js +31 -8
  166. package/tools/shipback.js +326 -0
  167. package/tools/smart-check.js +201 -0
  168. package/tools/social-processor.js +445 -0
  169. package/tools/solo-game.js +1 -1
  170. package/tools/start.js +335 -93
  171. package/tools/status.js +53 -6
  172. package/tools/stuck.js +297 -0
  173. package/tools/subscribe.js +148 -0
  174. package/tools/subscriptions.js +134 -0
  175. package/tools/suggest-tags.js +6 -8
  176. package/tools/tag-suggestions.js +257 -0
  177. package/tools/tip.js +193 -0
  178. package/tools/token.js +103 -0
  179. package/tools/update.js +1 -1
  180. package/tools/wallet.js +239 -186
  181. package/tools/watch.js +157 -0
  182. package/tools/webhook-test.js +388 -0
  183. package/tools/who.js +54 -3
  184. package/tools/withdraw.js +145 -0
  185. package/tools/work-summary.js +96 -0
  186. package/tools/workshop.js +327 -0
  187. package/tools/x-mentions.js +1 -1
  188. package/version.json +14 -3
  189. package/tools/artifacts-buy.js +0 -111
  190. package/tools/connect.js +0 -284
  191. package/tools/gigs-apply.js +0 -99
  192. package/tools/gigs-browse.js +0 -114
  193. package/tools/gigs-complete.js +0 -128
  194. package/tools/gigs-post.js +0 -140
  195. package/tools/live-off.js +0 -109
  196. package/tools/live-watch.js +0 -176
  197. package/tools/live.js +0 -128
  198. package/tools/sessions-browse.js +0 -105
  199. package/tools/whats-happening.js +0 -125
  200. /package/tools/{away.js → _deprecated/away.js} +0 -0
  201. /package/tools/{back.js → _deprecated/back.js} +0 -0
  202. /package/tools/{mute.js → _deprecated/mute.js} +0 -0
  203. /package/tools/{skills-exchange.js → _deprecated/skills-exchange.js} +0 -0
  204. /package/tools/{tictactoe.js → _deprecated/tictactoe.js} +0 -0
  205. /package/tools/{wordassociation.js → _deprecated/wordassociation.js} +0 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * vibe_reputation - Check your reputation score and tier
3
+ *
4
+ * View your standing in the /vibe social hierarchy
5
+ *
6
+ * Examples:
7
+ * - "vibe reputation"
8
+ * - "check my tier"
9
+ * - "show my badges"
10
+ * - "vibe rep leaderboard"
11
+ */
12
+
13
+ const fetch = require('node-fetch');
14
+
15
+ module.exports = {
16
+ name: 'vibe_reputation',
17
+ description: 'Check your reputation score, tier, badges, and ranking. Shows economic, social, expert, and creator scores.',
18
+
19
+ inputSchema: {
20
+ type: 'object',
21
+ properties: {
22
+ action: {
23
+ type: 'string',
24
+ enum: ['score', 'leaderboard'],
25
+ description: 'Action: score (your stats) or leaderboard (top users)',
26
+ default: 'score'
27
+ },
28
+ dimension: {
29
+ type: 'string',
30
+ enum: ['overall', 'economic', 'social', 'expert', 'creator'],
31
+ description: 'Leaderboard dimension (only for leaderboard action)',
32
+ default: 'overall'
33
+ },
34
+ limit: {
35
+ type: 'number',
36
+ description: 'Number of users to show in leaderboard (default 10)',
37
+ default: 10
38
+ }
39
+ }
40
+ },
41
+
42
+ async execute({ action = 'score', dimension = 'overall', limit = 10 }, context) {
43
+ try {
44
+ const handle = context.handle;
45
+
46
+ if (!handle) {
47
+ return {
48
+ success: false,
49
+ error: 'Not authenticated. Use vibe init first.'
50
+ };
51
+ }
52
+
53
+ const apiUrl = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
54
+
55
+ if (action === 'score') {
56
+ const response = await fetch(
57
+ `${apiUrl}/api/reputation/score?handle=${handle}`,
58
+ {
59
+ headers: {
60
+ 'Authorization': `Bearer ${context.token}`
61
+ }
62
+ }
63
+ );
64
+
65
+ const result = await response.json();
66
+
67
+ if (!response.ok) {
68
+ return {
69
+ success: false,
70
+ error: result.error || 'Failed to fetch reputation',
71
+ message: result.message
72
+ };
73
+ }
74
+
75
+ const tierIcons = {
76
+ genesis: '🌱',
77
+ bronze: '🥉',
78
+ silver: '🥈',
79
+ gold: '🥇',
80
+ platinum: '💎',
81
+ diamond: '👑'
82
+ };
83
+
84
+ const progressBar = '█'.repeat(Math.floor(result.progress_to_next * 20)) +
85
+ '░'.repeat(20 - Math.floor(result.progress_to_next * 20));
86
+
87
+ const badgeList = result.badges?.slice(0, 5).map(b =>
88
+ ` ${b.icon || '🏆'} ${b.name} (${b.rarity})`
89
+ ) || [];
90
+
91
+ return {
92
+ success: true,
93
+ reputation: result,
94
+ formatted: `
95
+ ⭐ Reputation: ${handle}
96
+
97
+ Tier: ${tierIcons[result.tier] || ''} ${result.tier.toUpperCase()}
98
+ Overall Score: ${result.overall_score}
99
+ Global Rank: #${result.rank} (top ${result.percentile.toFixed(1)}%)
100
+
101
+ Dimension Scores:
102
+ 💰 Economic: ${result.scores.economic}
103
+ 👥 Social: ${result.scores.social}
104
+ 🎓 Expert: ${result.scores.expert}
105
+ 🎨 Creator: ${result.scores.creator}
106
+
107
+ Progress to ${result.next_tier?.toUpperCase() || 'MAX'}:
108
+ [${progressBar}] ${(result.progress_to_next * 100).toFixed(1)}%
109
+ ${result.points_needed > 0 ? `${result.points_needed} points needed` : 'Max tier reached!'}
110
+
111
+ Badges (${result.badges?.length || 0}):
112
+ ${badgeList.length > 0 ? badgeList.join('\n') : ' No badges yet'}
113
+
114
+ Tier Unlocks:
115
+ ${JSON.stringify(result.tier_unlocks, null, 2).replace(/[{}"]/g, '').trim()}
116
+ `.trim()
117
+ };
118
+
119
+ } else if (action === 'leaderboard') {
120
+ const response = await fetch(
121
+ `${apiUrl}/api/reputation/leaderboard?dimension=${dimension}&limit=${Math.min(limit, 50)}`,
122
+ {
123
+ headers: {
124
+ 'Authorization': `Bearer ${context.token}`
125
+ }
126
+ }
127
+ );
128
+
129
+ const result = await response.json();
130
+
131
+ if (!response.ok) {
132
+ return {
133
+ success: false,
134
+ error: 'Failed to fetch leaderboard'
135
+ };
136
+ }
137
+
138
+ const tierIcons = {
139
+ genesis: '🌱',
140
+ bronze: '🥉',
141
+ silver: '🥈',
142
+ gold: '🥇',
143
+ platinum: '💎',
144
+ diamond: '👑'
145
+ };
146
+
147
+ const leaderboardLines = result.leaderboard?.map(user => {
148
+ const tier = tierIcons[user.tier] || '';
149
+ const scoreField = dimension === 'overall' ? user.overall_score : user.score;
150
+ return ` ${user.rank}. ${user.handle.padEnd(15)} ${scoreField.toString().padStart(5)} ${tier} ${user.tier}`;
151
+ }) || [];
152
+
153
+ return {
154
+ success: true,
155
+ leaderboard: result.leaderboard,
156
+ formatted: `
157
+ 🏆 Reputation Leaderboard (${dimension})
158
+
159
+ ${leaderboardLines.join('\n')}
160
+
161
+ Dimension: ${dimension}
162
+ Total users: ${result.leaderboard?.length || 0}
163
+ `.trim()
164
+ };
165
+ }
166
+
167
+ } catch (error) {
168
+ return {
169
+ success: false,
170
+ error: 'Failed to fetch reputation',
171
+ details: error.message
172
+ };
173
+ }
174
+ }
175
+ };
package/tools/request.js CHANGED
@@ -64,9 +64,16 @@ async function handler(args) {
64
64
  if (args.claim) {
65
65
  // Post a claim as a special entry
66
66
  try {
67
+ // Include auth token for API authorization
68
+ const authToken = config.getAuthToken();
69
+ const headers = { 'Content-Type': 'application/json' };
70
+ if (authToken) {
71
+ headers['Authorization'] = `Bearer ${authToken}`;
72
+ }
73
+
67
74
  const response = await fetch(`${apiUrl}/api/board`, {
68
75
  method: 'POST',
69
- headers: { 'Content-Type': 'application/json' },
76
+ headers,
70
77
  body: JSON.stringify({
71
78
  author: myHandle,
72
79
  category: 'claim',
@@ -103,9 +110,16 @@ async function handler(args) {
103
110
  const fullContent = `${content}${bountyText}`;
104
111
 
105
112
  try {
113
+ // Include auth token for API authorization
114
+ const authToken = config.getAuthToken();
115
+ const headers = { 'Content-Type': 'application/json' };
116
+ if (authToken) {
117
+ headers['Authorization'] = `Bearer ${authToken}`;
118
+ }
119
+
106
120
  const response = await fetch(`${apiUrl}/api/board`, {
107
121
  method: 'POST',
108
- headers: { 'Content-Type': 'application/json' },
122
+ headers,
109
123
  body: JSON.stringify({
110
124
  author: myHandle,
111
125
  category: 'request',
@@ -136,7 +150,7 @@ async function handler(args) {
136
150
  // Browse requests
137
151
  try {
138
152
  const limit = Math.min(args.limit || 10, 30);
139
- let url = `${apiUrl}/api/board?limit=${limit * 2}&category=request`;
153
+ const url = `${apiUrl}/api/board?limit=${limit * 2}&category=request`;
140
154
 
141
155
  // Also get claims to show status
142
156
  const claimsUrl = `${apiUrl}/api/board?limit=50&category=claim`;
@@ -0,0 +1,367 @@
1
+ /**
2
+ * vibe schedule — Schedule and manage upcoming sessions
3
+ *
4
+ * Commands:
5
+ * - schedule "title" --time "tomorrow 3pm" → Schedule a session
6
+ * - schedule list → Your scheduled sessions
7
+ * - schedule browse → All upcoming sessions
8
+ * - schedule rsvp <id> → RSVP to a session
9
+ * - schedule cancel <id> → Cancel your session
10
+ * - schedule myrsvps → Sessions you've RSVP'd to
11
+ */
12
+
13
+ const config = require('../config');
14
+ const { requireInit } = require('./_shared');
15
+
16
+ const definition = {
17
+ name: 'vibe_schedule',
18
+ description: 'Schedule upcoming broadcast sessions. RSVP to sessions to get notified when they go live.',
19
+ inputSchema: {
20
+ type: 'object',
21
+ properties: {
22
+ action: {
23
+ type: 'string',
24
+ enum: ['create', 'list', 'browse', 'rsvp', 'cancel', 'myrsvps'],
25
+ description: 'Action: create, list, browse, rsvp, cancel, myrsvps'
26
+ },
27
+ title: {
28
+ type: 'string',
29
+ description: 'Session title (for create action)'
30
+ },
31
+ time: {
32
+ type: 'string',
33
+ description: 'When to schedule (e.g., "tomorrow 3pm", "2026-01-20T15:00:00Z")'
34
+ },
35
+ duration: {
36
+ type: 'number',
37
+ description: 'Estimated duration in minutes (default: 60)'
38
+ },
39
+ tags: {
40
+ type: 'array',
41
+ items: { type: 'string' },
42
+ description: 'Tags for the session (e.g., ["mcp", "ai"])'
43
+ },
44
+ scheduleId: {
45
+ type: 'string',
46
+ description: 'Schedule ID (for rsvp/cancel actions)'
47
+ }
48
+ }
49
+ }
50
+ };
51
+
52
+ async function handler(args) {
53
+ const initCheck = requireInit();
54
+ if (initCheck) return initCheck;
55
+
56
+ const myHandle = config.getHandle();
57
+ const apiUrl = config.getApiUrl();
58
+ const action = args.action || 'browse';
59
+
60
+ try {
61
+ // CREATE — Schedule a new session
62
+ if (action === 'create') {
63
+ if (!args.title) {
64
+ return { display: '⚠️ Please provide a title: `vibe schedule create "Building X" --time "tomorrow 3pm"`' };
65
+ }
66
+
67
+ if (!args.time) {
68
+ return { display: '⚠️ Please provide a time: `vibe schedule create "Building X" --time "tomorrow 3pm"`' };
69
+ }
70
+
71
+ // Parse time string
72
+ const scheduledFor = parseTimeString(args.time);
73
+ if (!scheduledFor) {
74
+ return { display: '⚠️ Could not parse time. Try ISO format: `2026-01-20T15:00:00Z` or `tomorrow 3pm`' };
75
+ }
76
+
77
+ const response = await fetch(`${apiUrl}/api/sessions/schedule`, {
78
+ method: 'POST',
79
+ headers: { 'Content-Type': 'application/json' },
80
+ body: JSON.stringify({
81
+ handle: myHandle,
82
+ title: args.title,
83
+ scheduledFor: scheduledFor.toISOString(),
84
+ duration: args.duration || 60,
85
+ tags: args.tags || []
86
+ })
87
+ });
88
+
89
+ const data = await response.json();
90
+
91
+ if (!data.success) {
92
+ return { display: `⚠️ ${data.error}` };
93
+ }
94
+
95
+ const schedule = data.schedule;
96
+ const dateStr = formatScheduleTime(schedule.scheduledFor);
97
+
98
+ let display = `## 📅 Session Scheduled!\n\n`;
99
+ display += `**${schedule.title}**\n`;
100
+ display += `📆 ${dateStr}\n`;
101
+ display += `⏱️ ~${schedule.duration} minutes\n\n`;
102
+ display += `**Share URL:**\n${schedule.shareUrl}\n\n`;
103
+ display += `Your followers will be notified.\n\n`;
104
+ display += `---\n`;
105
+ display += `_When it's time, use \`vibe broadcast start\` to go live._`;
106
+
107
+ return { display };
108
+ }
109
+
110
+ // LIST — My scheduled sessions
111
+ if (action === 'list') {
112
+ const response = await fetch(`${apiUrl}/api/sessions/schedule?handle=${myHandle}`);
113
+ const data = await response.json();
114
+
115
+ if (!data.success) {
116
+ return { display: `⚠️ ${data.error}` };
117
+ }
118
+
119
+ if (data.schedules.length === 0) {
120
+ let display = `## My Scheduled Sessions\n\n`;
121
+ display += `_No upcoming sessions scheduled._\n\n`;
122
+ display += `**Schedule one:**\n`;
123
+ display += `\`vibe schedule create "Topic" --time "tomorrow 3pm"\``;
124
+ return { display };
125
+ }
126
+
127
+ let display = `## My Scheduled Sessions\n\n`;
128
+
129
+ for (const schedule of data.schedules) {
130
+ const dateStr = formatScheduleTime(schedule.scheduledFor);
131
+ display += `**${schedule.title}**\n`;
132
+ display += `📆 ${dateStr}`;
133
+ if (schedule.rsvpCount > 0) {
134
+ display += ` · 🎟️ ${schedule.rsvpCount} RSVPs`;
135
+ }
136
+ display += `\n`;
137
+ display += `ID: \`${schedule.id}\`\n\n`;
138
+ }
139
+
140
+ display += `---\n`;
141
+ display += `_Cancel: \`vibe schedule cancel <id>\`_`;
142
+
143
+ return { display };
144
+ }
145
+
146
+ // BROWSE — All upcoming sessions
147
+ if (action === 'browse') {
148
+ const response = await fetch(`${apiUrl}/api/sessions/schedule`);
149
+ const data = await response.json();
150
+
151
+ if (!data.success) {
152
+ return { display: `⚠️ ${data.error}` };
153
+ }
154
+
155
+ if (data.schedules.length === 0) {
156
+ let display = `## Upcoming Sessions\n\n`;
157
+ display += `_No sessions scheduled yet._\n\n`;
158
+ display += `**Be the first:**\n`;
159
+ display += `\`vibe schedule create "Topic" --time "tomorrow 3pm"\``;
160
+ return { display };
161
+ }
162
+
163
+ let display = `## 📅 Upcoming Sessions\n\n`;
164
+
165
+ for (const schedule of data.schedules) {
166
+ const dateStr = formatScheduleTime(schedule.scheduledFor);
167
+ display += `**${schedule.title}**\n`;
168
+ display += `@${schedule.handle} · ${dateStr}`;
169
+ if (schedule.rsvpCount > 0) {
170
+ display += ` · 🎟️ ${schedule.rsvpCount}`;
171
+ }
172
+ display += `\n`;
173
+ if (schedule.tags && schedule.tags.length > 0) {
174
+ display += `🏷️ ${schedule.tags.join(', ')}\n`;
175
+ }
176
+ display += `\`vibe schedule rsvp ${schedule.id}\`\n\n`;
177
+ }
178
+
179
+ return { display };
180
+ }
181
+
182
+ // RSVP — RSVP to a session
183
+ if (action === 'rsvp') {
184
+ if (!args.scheduleId) {
185
+ return { display: '⚠️ Please provide a schedule ID: `vibe schedule rsvp sched_xxx`' };
186
+ }
187
+
188
+ const response = await fetch(`${apiUrl}/api/sessions/rsvp`, {
189
+ method: 'POST',
190
+ headers: { 'Content-Type': 'application/json' },
191
+ body: JSON.stringify({
192
+ scheduleId: args.scheduleId,
193
+ handle: myHandle
194
+ })
195
+ });
196
+
197
+ const data = await response.json();
198
+
199
+ if (!data.success) {
200
+ return { display: `⚠️ ${data.error}` };
201
+ }
202
+
203
+ let display = `## 🎟️ RSVP Confirmed!\n\n`;
204
+ if (data.schedule) {
205
+ display += `**${data.schedule.title}**\n`;
206
+ display += `@${data.schedule.handle}\n`;
207
+ display += `📆 ${formatScheduleTime(data.schedule.scheduledFor)}\n\n`;
208
+ }
209
+ display += `You'll be notified when they go live.\n\n`;
210
+ display += `_${data.rsvpCount} people attending_`;
211
+
212
+ return { display };
213
+ }
214
+
215
+ // CANCEL — Cancel my session
216
+ if (action === 'cancel') {
217
+ if (!args.scheduleId) {
218
+ return { display: '⚠️ Please provide a schedule ID: `vibe schedule cancel sched_xxx`' };
219
+ }
220
+
221
+ const response = await fetch(`${apiUrl}/api/sessions/schedule`, {
222
+ method: 'DELETE',
223
+ headers: { 'Content-Type': 'application/json' },
224
+ body: JSON.stringify({
225
+ id: args.scheduleId,
226
+ handle: myHandle
227
+ })
228
+ });
229
+
230
+ const data = await response.json();
231
+
232
+ if (!data.success) {
233
+ return { display: `⚠️ ${data.error}` };
234
+ }
235
+
236
+ return { display: `✅ Session cancelled. RSVPs have been notified.` };
237
+ }
238
+
239
+ // MYRSVPS — Sessions I've RSVP'd to
240
+ if (action === 'myrsvps') {
241
+ const response = await fetch(`${apiUrl}/api/sessions/rsvp?handle=${myHandle}`);
242
+ const data = await response.json();
243
+
244
+ if (!data.success) {
245
+ return { display: `⚠️ ${data.error}` };
246
+ }
247
+
248
+ if (data.rsvps.length === 0) {
249
+ let display = `## My RSVPs\n\n`;
250
+ display += `_You haven't RSVP'd to any sessions._\n\n`;
251
+ display += `**Browse upcoming:**\n`;
252
+ display += `\`vibe schedule browse\``;
253
+ return { display };
254
+ }
255
+
256
+ let display = `## 🎟️ My RSVPs\n\n`;
257
+
258
+ for (const schedule of data.rsvps) {
259
+ const dateStr = formatScheduleTime(schedule.scheduledFor);
260
+ display += `**${schedule.title}**\n`;
261
+ display += `@${schedule.handle} · ${dateStr}\n\n`;
262
+ }
263
+
264
+ display += `_You'll be notified when these sessions go live._`;
265
+
266
+ return { display };
267
+ }
268
+
269
+ return { display: 'Unknown action. Use: create, list, browse, rsvp, cancel, myrsvps' };
270
+
271
+ } catch (error) {
272
+ return { display: `## Error\n\n${error.message}` };
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Parse natural language time strings
278
+ */
279
+ function parseTimeString(timeStr) {
280
+ // Try ISO format first
281
+ const isoDate = new Date(timeStr);
282
+ if (!isNaN(isoDate.getTime())) {
283
+ return isoDate;
284
+ }
285
+
286
+ const now = new Date();
287
+ const lower = timeStr.toLowerCase();
288
+
289
+ // "tomorrow 3pm", "tomorrow at 3pm"
290
+ if (lower.includes('tomorrow')) {
291
+ const tomorrow = new Date(now);
292
+ tomorrow.setDate(tomorrow.getDate() + 1);
293
+
294
+ const timeMatch = lower.match(/(\d{1,2})(?::(\d{2}))?\s*(am|pm)?/i);
295
+ if (timeMatch) {
296
+ let hours = parseInt(timeMatch[1]);
297
+ const mins = parseInt(timeMatch[2]) || 0;
298
+ const ampm = timeMatch[3]?.toLowerCase();
299
+
300
+ if (ampm === 'pm' && hours < 12) hours += 12;
301
+ if (ampm === 'am' && hours === 12) hours = 0;
302
+
303
+ tomorrow.setHours(hours, mins, 0, 0);
304
+ return tomorrow;
305
+ }
306
+
307
+ // Default to noon
308
+ tomorrow.setHours(12, 0, 0, 0);
309
+ return tomorrow;
310
+ }
311
+
312
+ // "in 2 hours"
313
+ const inHoursMatch = lower.match(/in\s+(\d+)\s+hours?/);
314
+ if (inHoursMatch) {
315
+ const hours = parseInt(inHoursMatch[1]);
316
+ return new Date(now.getTime() + hours * 60 * 60 * 1000);
317
+ }
318
+
319
+ // "next monday 3pm"
320
+ const dayNames = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
321
+ for (let i = 0; i < dayNames.length; i++) {
322
+ if (lower.includes(dayNames[i])) {
323
+ const targetDay = i;
324
+ const currentDay = now.getDay();
325
+ let daysUntil = targetDay - currentDay;
326
+ if (daysUntil <= 0) daysUntil += 7;
327
+
328
+ const targetDate = new Date(now);
329
+ targetDate.setDate(targetDate.getDate() + daysUntil);
330
+
331
+ const timeMatch = lower.match(/(\d{1,2})(?::(\d{2}))?\s*(am|pm)?/i);
332
+ if (timeMatch) {
333
+ let hours = parseInt(timeMatch[1]);
334
+ const mins = parseInt(timeMatch[2]) || 0;
335
+ const ampm = timeMatch[3]?.toLowerCase();
336
+
337
+ if (ampm === 'pm' && hours < 12) hours += 12;
338
+ if (ampm === 'am' && hours === 12) hours = 0;
339
+
340
+ targetDate.setHours(hours, mins, 0, 0);
341
+ } else {
342
+ targetDate.setHours(12, 0, 0, 0);
343
+ }
344
+
345
+ return targetDate;
346
+ }
347
+ }
348
+
349
+ return null;
350
+ }
351
+
352
+ /**
353
+ * Format schedule time for display
354
+ */
355
+ function formatScheduleTime(isoString) {
356
+ const date = new Date(isoString);
357
+ return date.toLocaleDateString('en-US', {
358
+ weekday: 'short',
359
+ month: 'short',
360
+ day: 'numeric',
361
+ hour: 'numeric',
362
+ minute: '2-digit',
363
+ timeZoneName: 'short'
364
+ });
365
+ }
366
+
367
+ module.exports = { definition, handler };
@@ -0,0 +1,123 @@
1
+ /**
2
+ * vibe_search_messages - Search your DM history
3
+ *
4
+ * Search through all your conversations or filter to a specific person.
5
+ * Returns matching messages with context highlighting.
6
+ */
7
+
8
+ const config = require('../config');
9
+ const store = require('../store');
10
+
11
+ const searchMessagesSchema = {
12
+ name: 'vibe_search_messages',
13
+ description: 'Search through your DM history. Find messages by keyword across all conversations or with a specific person.',
14
+ inputSchema: {
15
+ type: 'object',
16
+ properties: {
17
+ query: {
18
+ type: 'string',
19
+ description: 'Search term (at least 2 characters)',
20
+ },
21
+ with: {
22
+ type: 'string',
23
+ description: 'Optional: Filter to conversation with specific user (e.g., @alice)',
24
+ },
25
+ limit: {
26
+ type: 'number',
27
+ description: 'Max results to return (default: 20)',
28
+ },
29
+ },
30
+ required: ['query'],
31
+ },
32
+ };
33
+
34
+ async function searchMessagesHandler({ query, with: withUser, limit = 20 }) {
35
+ const handle = config.getHandle();
36
+ if (!handle) {
37
+ return {
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: '❌ Not initialized. Run `vibe init` first.',
42
+ },
43
+ ],
44
+ };
45
+ }
46
+
47
+ if (!query || query.trim().length < 2) {
48
+ return {
49
+ content: [
50
+ {
51
+ type: 'text',
52
+ text: '❌ Search query must be at least 2 characters.',
53
+ },
54
+ ],
55
+ };
56
+ }
57
+
58
+ try {
59
+ const results = await store.searchMessages(query, {
60
+ with: withUser?.replace('@', ''),
61
+ limit: Math.min(limit, 50),
62
+ });
63
+
64
+ if (!results.messages || results.messages.length === 0) {
65
+ const scope = withUser ? ` in conversation with @${withUser.replace('@', '')}` : '';
66
+ return {
67
+ content: [
68
+ {
69
+ type: 'text',
70
+ text: `🔍 No messages found for "${query}"${scope}.`,
71
+ },
72
+ ],
73
+ };
74
+ }
75
+
76
+ // Format results
77
+ let output = `🔍 **Search: "${query}"**\n`;
78
+ output += `Found ${results.total} message${results.total !== 1 ? 's' : ''}`;
79
+ if (withUser) {
80
+ output += ` with @${withUser.replace('@', '')}`;
81
+ }
82
+ output += '\n\n';
83
+
84
+ for (const msg of results.messages) {
85
+ const fromMe = msg.from === handle;
86
+ const direction = fromMe ? '→' : '←';
87
+ const other = fromMe ? msg.to : msg.from;
88
+ const date = new Date(msg.created_at).toLocaleDateString();
89
+
90
+ output += `**${direction} @${other}** (${date})\n`;
91
+ output += `> ${msg.match_preview}\n\n`;
92
+ }
93
+
94
+ if (results.has_more) {
95
+ output += `_Showing ${results.count} of ${results.total} results. Add \`limit: ${limit + 20}\` for more._\n`;
96
+ }
97
+
98
+ return {
99
+ content: [
100
+ {
101
+ type: 'text',
102
+ text: output,
103
+ },
104
+ ],
105
+ };
106
+
107
+ } catch (error) {
108
+ console.error('[search-messages] Error:', error);
109
+ return {
110
+ content: [
111
+ {
112
+ type: 'text',
113
+ text: `❌ Search failed: ${error.message}`,
114
+ },
115
+ ],
116
+ };
117
+ }
118
+ }
119
+
120
+ module.exports = {
121
+ schema: searchMessagesSchema,
122
+ handler: searchMessagesHandler,
123
+ };