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,233 @@
1
+ /**
2
+ * vibe_genesis - Genesis liquidity mining
3
+ *
4
+ * Deposit USDC to earn yield + Genesis multipliers
5
+ *
6
+ * Actions:
7
+ * - deposit: Lock USDC for yield farming
8
+ * - rewards: Check accumulated rewards
9
+ * - stats: View global Genesis stats
10
+ *
11
+ * Examples:
12
+ * - "vibe genesis deposit $100 for 90 days"
13
+ * - "check my genesis rewards"
14
+ * - "show genesis stats"
15
+ */
16
+
17
+ const fetch = require('node-fetch');
18
+
19
+ module.exports = {
20
+ name: 'vibe_genesis',
21
+ description: 'Genesis liquidity mining: deposit USDC to earn yield with early depositor bonuses. Base APY 5%, Genesis multipliers up to 2x, lock bonuses up to 2x.',
22
+
23
+ inputSchema: {
24
+ type: 'object',
25
+ properties: {
26
+ action: {
27
+ type: 'string',
28
+ enum: ['deposit', 'rewards', 'stats'],
29
+ description: 'Action to perform: deposit (add liquidity), rewards (check earnings), stats (global metrics)'
30
+ },
31
+ amount: {
32
+ type: 'number',
33
+ description: 'Amount to deposit in USD (min $10). Only for deposit action.'
34
+ },
35
+ lock_days: {
36
+ type: 'number',
37
+ enum: [0, 30, 90, 180],
38
+ description: 'Lock period in days: 0 (no lock), 30 (+20% APY), 90 (+50% APY), 180 (+100% APY). Only for deposit action.',
39
+ default: 0
40
+ }
41
+ },
42
+ required: ['action']
43
+ },
44
+
45
+ async execute({ action, amount, lock_days = 0 }, context) {
46
+ try {
47
+ const handle = context.handle;
48
+
49
+ if (!handle) {
50
+ return {
51
+ success: false,
52
+ error: 'Not authenticated. Use vibe init first.'
53
+ };
54
+ }
55
+
56
+ const apiUrl = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
57
+
58
+ switch (action) {
59
+ case 'deposit': {
60
+ if (!amount || amount < 10) {
61
+ return {
62
+ success: false,
63
+ error: 'Minimum deposit is $10'
64
+ };
65
+ }
66
+
67
+ const response = await fetch(`${apiUrl}/api/genesis/deposit`, {
68
+ method: 'POST',
69
+ headers: {
70
+ 'Content-Type': 'application/json',
71
+ 'Authorization': `Bearer ${context.token}`
72
+ },
73
+ body: JSON.stringify({
74
+ from: handle,
75
+ amount,
76
+ lock_days
77
+ })
78
+ });
79
+
80
+ const result = await response.json();
81
+
82
+ if (!response.ok) {
83
+ return {
84
+ success: false,
85
+ error: result.error || 'Deposit failed',
86
+ details: result.details
87
+ };
88
+ }
89
+
90
+ const effectiveAPY = result.effective_apy * 100;
91
+ const unlockDate = result.unlock_at
92
+ ? new Date(result.unlock_at).toLocaleDateString()
93
+ : 'No lock';
94
+
95
+ return {
96
+ success: true,
97
+ message: `Deposited $${amount} to Genesis mining`,
98
+ deposit: {
99
+ deposit_id: result.deposit_id,
100
+ amount: `$${amount}`,
101
+ base_apy: `${(result.base_apy * 100).toFixed(2)}%`,
102
+ genesis_multiplier: `${result.genesis_multiplier}x`,
103
+ effective_apy: `${effectiveAPY.toFixed(2)}%`,
104
+ lock_days,
105
+ unlock_at: unlockDate,
106
+ current_tvl: `$${result.current_tvl.toFixed(2)}`
107
+ },
108
+ formatted: `
109
+ šŸ’§ Genesis Deposit Successful!
110
+
111
+ Amount: $${amount}
112
+ Lock Period: ${lock_days} days
113
+ Unlock: ${unlockDate}
114
+
115
+ APY Breakdown:
116
+ Base: ${(result.base_apy * 100).toFixed(2)}%
117
+ Genesis Multiplier: ${result.genesis_multiplier}x
118
+ Lock Bonus: ${lock_days >= 180 ? '2.0x' : lock_days >= 90 ? '1.5x' : lock_days >= 30 ? '1.2x' : '1.0x'}
119
+
120
+ Effective APY: ${effectiveAPY.toFixed(2)}%
121
+
122
+ Current TVL: $${result.current_tvl.toFixed(2)}
123
+
124
+ Rewards accrue daily. Check with: vibe genesis rewards
125
+ `.trim()
126
+ };
127
+ }
128
+
129
+ case 'rewards': {
130
+ const response = await fetch(
131
+ `${apiUrl}/api/genesis/rewards?handle=${handle}`,
132
+ {
133
+ headers: {
134
+ 'Authorization': `Bearer ${context.token}`
135
+ }
136
+ }
137
+ );
138
+
139
+ const result = await response.json();
140
+
141
+ if (!response.ok) {
142
+ return {
143
+ success: false,
144
+ error: result.error || 'Failed to fetch rewards',
145
+ message: result.message
146
+ };
147
+ }
148
+
149
+ const deposits = result.deposits || [];
150
+ const totals = result.totals;
151
+
152
+ const depositLines = deposits.map(d => {
153
+ return ` $${d.amount.toFixed(2)} | ${d.days_deposited}d | ${(d.effective_apy * 100).toFixed(2)}% APY | +$${d.unclaimed_rewards.toFixed(2)} earned`;
154
+ });
155
+
156
+ return {
157
+ success: true,
158
+ rewards: totals,
159
+ deposits: deposits,
160
+ formatted: `
161
+ šŸ’° Genesis Rewards
162
+
163
+ Total Deposited: $${totals.total_deposited.toFixed(2)}
164
+ Unclaimed Rewards: $${totals.total_rewards.toFixed(2)}
165
+ Total Value: $${totals.total_value.toFixed(2)}
166
+
167
+ Active Deposits:
168
+ ${depositLines.length > 0 ? depositLines.join('\n') : ' No active deposits'}
169
+
170
+ Rewards accrue daily based on your effective APY.
171
+ `.trim()
172
+ };
173
+ }
174
+
175
+ case 'stats': {
176
+ const response = await fetch(`${apiUrl}/api/genesis/stats`);
177
+ const result = await response.json();
178
+
179
+ if (!response.ok) {
180
+ return {
181
+ success: false,
182
+ error: 'Failed to fetch stats'
183
+ };
184
+ }
185
+
186
+ const tierLines = result.multiplier_tiers?.map(t => {
187
+ const marker = t.status === 'current' ? '→' : t.status === 'passed' ? 'āœ“' : ' ';
188
+ return ` ${marker} ${t.tvl_range.padEnd(12)} ${t.multiplier}x ${t.status}`;
189
+ }) || [];
190
+
191
+ return {
192
+ success: true,
193
+ stats: result,
194
+ formatted: `
195
+ 🌊 Genesis Liquidity Mining Stats
196
+
197
+ Phase: ${result.genesis_phase} (${result.genesis_progress}% to goal)
198
+ Total Value Locked: $${result.tvl.toFixed(2)}
199
+ Depositors: ${result.total_depositors}
200
+ Avg Deposit: $${result.avg_deposit.toFixed(2)}
201
+
202
+ Current Multiplier: ${result.current_multiplier}x
203
+ Base APY: ${(result.base_apy * 100).toFixed(2)}%
204
+
205
+ Multiplier Tiers:
206
+ ${tierLines.join('\n')}
207
+
208
+ Rewards Distributed: $${result.total_rewards_distributed.toFixed(2)}
209
+
210
+ Top Depositors:
211
+ ${result.top_depositors?.slice(0, 5).map((d, i) =>
212
+ ` ${i + 1}. ${d.handle} - $${d.total_deposited.toFixed(2)}`
213
+ ).join('\n') || ' No depositors yet'}
214
+ `.trim()
215
+ };
216
+ }
217
+
218
+ default:
219
+ return {
220
+ success: false,
221
+ error: 'Invalid action. Use: deposit, rewards, or stats'
222
+ };
223
+ }
224
+
225
+ } catch (error) {
226
+ return {
227
+ success: false,
228
+ error: 'Genesis action failed',
229
+ details: error.message
230
+ };
231
+ }
232
+ }
233
+ };
@@ -0,0 +1,206 @@
1
+ /**
2
+ * vibe_gig_browse - Browse and filter the gig marketplace
3
+ *
4
+ * Search for gigs by category, skills, budget range, etc.
5
+ */
6
+
7
+ const config = require('../config');
8
+ const { requireInit, displayHandle, header, divider, emptyState, formatTimeAgo } = require('./_shared');
9
+
10
+ const BASE_URL = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
11
+
12
+ const definition = {
13
+ name: 'vibe_gig_browse',
14
+ description: 'Browse the gig marketplace. Filter by category, skills, budget, or search by keyword.',
15
+ inputSchema: {
16
+ type: 'object',
17
+ properties: {
18
+ category: {
19
+ type: 'string',
20
+ enum: ['build', 'fix', 'design', 'review', 'teach', 'consult', 'other'],
21
+ description: 'Filter by gig category'
22
+ },
23
+ skill: {
24
+ type: 'string',
25
+ description: 'Filter by required skill (e.g., "react", "python", "api")'
26
+ },
27
+ min_budget: {
28
+ type: 'number',
29
+ description: 'Minimum budget in dollars'
30
+ },
31
+ max_budget: {
32
+ type: 'number',
33
+ description: 'Maximum budget in dollars'
34
+ },
35
+ search: {
36
+ type: 'string',
37
+ description: 'Search in title and description'
38
+ },
39
+ limit: {
40
+ type: 'number',
41
+ description: 'Number of results (default: 10, max: 50)'
42
+ }
43
+ }
44
+ }
45
+ };
46
+
47
+ async function handler(args) {
48
+ const initCheck = requireInit();
49
+ if (initCheck) return initCheck;
50
+
51
+ const {
52
+ category,
53
+ skill,
54
+ min_budget,
55
+ max_budget,
56
+ search,
57
+ limit = 10
58
+ } = args;
59
+
60
+ try {
61
+ // Build query string
62
+ const params = new URLSearchParams();
63
+ params.set('status', 'open');
64
+ params.set('limit', Math.min(limit, 50).toString());
65
+
66
+ // Note: API may not support all filters yet, but we include them
67
+ if (category) params.set('category', category);
68
+ if (skill) params.set('skill', skill);
69
+ if (min_budget) params.set('min_budget', min_budget.toString());
70
+ if (max_budget) params.set('max_budget', max_budget.toString());
71
+ if (search) params.set('search', search);
72
+
73
+ const response = await fetch(`${BASE_URL}/api/gigs?${params.toString()}`);
74
+ const data = await response.json();
75
+
76
+ // Handle coming soon state
77
+ if (data.coming_soon) {
78
+ return {
79
+ display: header('šŸš€ Gigs Marketplace', 2) + '\n\n' +
80
+ 'ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”\n' +
81
+ '│ LAUNCHING WEDNESDAY JAN 22 │\n' +
82
+ 'ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜\n\n' +
83
+ 'The gigs marketplace is almost ready!\n\n' +
84
+ '• Post gigs to hire builders\n' +
85
+ '• Apply to gigs and get paid\n' +
86
+ '• Build your proof-of-work reputation\n\n' +
87
+ 'Stay tuned for the launch!'
88
+ };
89
+ }
90
+
91
+ if (!data.success) {
92
+ return { display: `āŒ ${data.error || 'Failed to browse gigs'}` };
93
+ }
94
+
95
+ const gigs = data.gigs || [];
96
+
97
+ // Filter client-side if API doesn't support all filters
98
+ let filteredGigs = gigs;
99
+
100
+ // Client-side category filter
101
+ if (category) {
102
+ filteredGigs = filteredGigs.filter(g => g.category === category);
103
+ }
104
+
105
+ // Client-side skill filter (API uses skills_needed)
106
+ if (skill) {
107
+ const lowerSkill = skill.toLowerCase();
108
+ filteredGigs = filteredGigs.filter(g => {
109
+ const skills = g.skills_needed || [];
110
+ return skills.some(s => s.toLowerCase().includes(lowerSkill));
111
+ });
112
+ }
113
+
114
+ // Client-side budget filter (API uses budget object with min/max in dollars)
115
+ if (min_budget) {
116
+ filteredGigs = filteredGigs.filter(g => {
117
+ const budgetMin = g.budget?.min || 0;
118
+ return budgetMin >= min_budget;
119
+ });
120
+ }
121
+ if (max_budget) {
122
+ filteredGigs = filteredGigs.filter(g => {
123
+ const budgetMax = g.budget?.max || Infinity;
124
+ return budgetMax <= max_budget;
125
+ });
126
+ }
127
+
128
+ // Client-side search
129
+ if (search) {
130
+ const lowerSearch = search.toLowerCase();
131
+ filteredGigs = filteredGigs.filter(g =>
132
+ (g.title || '').toLowerCase().includes(lowerSearch) ||
133
+ (g.description || '').toLowerCase().includes(lowerSearch)
134
+ );
135
+ }
136
+
137
+ if (filteredGigs.length === 0) {
138
+ let hint = 'Try broadening your search criteria.';
139
+ if (category || skill) {
140
+ hint = `No gigs found matching your filters. Try removing some filters.`;
141
+ }
142
+ return { display: emptyState('No open gigs found', hint) };
143
+ }
144
+
145
+ // Build display
146
+ let display = header('šŸŽÆ Open Gigs', 2) + '\n\n';
147
+
148
+ // Show active filters
149
+ const filters = [];
150
+ if (category) filters.push(`category: ${category}`);
151
+ if (skill) filters.push(`skill: ${skill}`);
152
+ if (min_budget || max_budget) {
153
+ const budgetStr = min_budget && max_budget
154
+ ? `$${min_budget}-$${max_budget}`
155
+ : min_budget ? `≄$${min_budget}` : `≤$${max_budget}`;
156
+ filters.push(`budget: ${budgetStr}`);
157
+ }
158
+ if (search) filters.push(`search: "${search}"`);
159
+
160
+ if (filters.length > 0) {
161
+ display += `_Filters: ${filters.join(', ')}_\n\n`;
162
+ }
163
+
164
+ display += `Found **${filteredGigs.length}** gig${filteredGigs.length !== 1 ? 's' : ''}\n\n`;
165
+
166
+ // List gigs (API returns: poster, budget{min,max}, skills_needed, applicants as count)
167
+ filteredGigs.forEach((gig, i) => {
168
+ display += `**${i + 1}. ${gig.title}**\n`;
169
+ display += ` ${displayHandle(gig.poster)} • `;
170
+
171
+ // Budget is an object with min/max in dollars
172
+ const budgetDisplay = gig.budget
173
+ ? `$${gig.budget.min || 0}-$${gig.budget.max || '?'}`
174
+ : 'TBD';
175
+ display += `${budgetDisplay} • `;
176
+ display += `${gig.category || 'other'}\n`;
177
+
178
+ if (gig.skills_needed && gig.skills_needed.length > 0) {
179
+ display += ` Skills: ${gig.skills_needed.slice(0, 5).join(', ')}\n`;
180
+ }
181
+
182
+ if (gig.description) {
183
+ const shortDesc = gig.description.slice(0, 100);
184
+ display += ` _${shortDesc}${gig.description.length > 100 ? '...' : ''}_\n`;
185
+ }
186
+
187
+ // API returns applicants as a count (number), not array
188
+ const applicantCount = typeof gig.applicants === 'number' ? gig.applicants : 0;
189
+ display += ` ${applicantCount} applicant${applicantCount !== 1 ? 's' : ''} • `;
190
+ display += `posted ${formatTimeAgo(gig.created_at)}\n`;
191
+
192
+ display += ` **ID:** ${gig.id}\n\n`;
193
+ });
194
+
195
+ display += divider();
196
+ display += 'šŸ’” Apply to a gig with: `apply to gig [gig_id]`';
197
+
198
+ return { display };
199
+
200
+ } catch (e) {
201
+ console.error('[gig-browse] Error:', e);
202
+ return { display: `āŒ Failed to browse gigs: ${e.message}` };
203
+ }
204
+ }
205
+
206
+ module.exports = { definition, handler };
@@ -0,0 +1,139 @@
1
+ /**
2
+ * vibe_gig_complete - Mark a gig as completed
3
+ *
4
+ * When a gig is completed:
5
+ * - Links deliverables (session, artifacts, notes)
6
+ * - Boosts hired person's reputation
7
+ * - Auto-posts celebration to the board
8
+ * - Records rating
9
+ */
10
+
11
+ const config = require('../config');
12
+ const { requireInit, normalizeHandle, displayHandle, success, error, header, divider } = require('./_shared');
13
+
14
+ const BASE_URL = process.env.VIBE_API_URL || 'https://www.slashvibe.dev';
15
+
16
+ const definition = {
17
+ name: 'vibe_gig_complete',
18
+ description: 'Mark a gig as completed with deliverables and rating. Boosts reputation and posts to board.',
19
+ inputSchema: {
20
+ type: 'object',
21
+ properties: {
22
+ gig_id: {
23
+ type: 'string',
24
+ description: 'The gig ID to complete (e.g., gig_abc123)'
25
+ },
26
+ session_id: {
27
+ type: 'string',
28
+ description: 'Optional: Link a session as primary deliverable'
29
+ },
30
+ artifact_ids: {
31
+ type: 'array',
32
+ items: { type: 'string' },
33
+ description: 'Optional: Array of artifact IDs created during the gig'
34
+ },
35
+ notes: {
36
+ type: 'string',
37
+ description: 'Optional: Completion notes or summary'
38
+ },
39
+ rating: {
40
+ type: 'number',
41
+ minimum: 1,
42
+ maximum: 5,
43
+ description: 'Rating for the hired person (1-5 stars)'
44
+ }
45
+ },
46
+ required: ['gig_id', 'rating']
47
+ }
48
+ };
49
+
50
+ async function handler(args) {
51
+ const initCheck = requireInit();
52
+ if (initCheck) return initCheck;
53
+
54
+ // Check if gigs are enabled by making a quick check
55
+ try {
56
+ const checkResponse = await fetch(`${BASE_URL}/api/gigs`);
57
+ const checkData = await checkResponse.json();
58
+ if (checkData.coming_soon) {
59
+ return {
60
+ display: header('šŸš€ Gigs Marketplace', 2) + '\n\n' +
61
+ 'Launching Wednesday Jan 22!\n\n' +
62
+ 'Gig completion will be available after launch.'
63
+ };
64
+ }
65
+ } catch (e) {
66
+ // Continue with request if check fails
67
+ }
68
+
69
+ const {
70
+ gig_id,
71
+ session_id = null,
72
+ artifact_ids = [],
73
+ notes = null,
74
+ rating
75
+ } = args;
76
+
77
+ const handle = config.getHandle();
78
+
79
+ // Validate rating
80
+ if (rating < 1 || rating > 5) {
81
+ return { display: error('Rating must be between 1 and 5 stars') };
82
+ }
83
+
84
+ try {
85
+ const response = await fetch(`${BASE_URL}/api/gigs/complete`, {
86
+ method: 'POST',
87
+ headers: { 'Content-Type': 'application/json' },
88
+ body: JSON.stringify({
89
+ gig_id,
90
+ completed_by: handle,
91
+ deliverables: {
92
+ session_id,
93
+ artifact_ids,
94
+ notes
95
+ },
96
+ rating
97
+ })
98
+ });
99
+
100
+ const data = await response.json();
101
+
102
+ if (!data.success) {
103
+ return { display: error(data.error || 'Failed to complete gig') };
104
+ }
105
+
106
+ // Format success display
107
+ let display = success('Gig Completed!') + '\n\n';
108
+
109
+ display += header('Gig Details', 3) + '\n';
110
+ display += `**Title:** ${data.gig?.title || gig_id}\n`;
111
+ display += `**Hired:** ${displayHandle(data.gig?.hired_handle)}\n`;
112
+ display += `**Rating:** ${'⭐'.repeat(rating)}\n`;
113
+
114
+ if (session_id) {
115
+ display += `**Session:** ${session_id}\n`;
116
+ }
117
+ if (artifact_ids.length > 0) {
118
+ display += `**Artifacts:** ${artifact_ids.length} linked\n`;
119
+ }
120
+ if (notes) {
121
+ display += `**Notes:** ${notes}\n`;
122
+ }
123
+
124
+ display += divider();
125
+ display += `${displayHandle(data.gig?.hired_handle)} earned **+50 vibe points** for completing this gig!\n`;
126
+
127
+ if (data.posted_to_board) {
128
+ display += `\nšŸŽ‰ Celebration posted to the board`;
129
+ }
130
+
131
+ return { display };
132
+
133
+ } catch (e) {
134
+ console.error('[gig-complete] Error:', e);
135
+ return { display: error(`Failed to complete gig: ${e.message}`) };
136
+ }
137
+ }
138
+
139
+ module.exports = { definition, handler };