50c 3.5.0 → 3.8.0

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/lib/team.js CHANGED
@@ -14,40 +14,34 @@
14
14
  */
15
15
 
16
16
  const { call50cTool } = require('./subagent.js');
17
+ const registry = require('./tools-registry.js');
17
18
 
18
19
  // ============================================
19
20
  // SAFETY GUARDRAILS
20
21
  // ============================================
21
22
 
22
- const MAX_PAID_TOOLS = 6; // Max paid tools per team request
23
- const MAX_FREE_TOOLS = 20; // Max free tools per team request
24
- const MAX_CALLS_PER_MINUTE = 10; // Rate limit
25
- const callLog = []; // Track calls for rate limiting
23
+ const MAX_PAID_TOOLS = 6;
24
+ const MAX_FREE_TOOLS = 20;
25
+ const MAX_CALLS_PER_MINUTE = 10;
26
+ const callLog = [];
26
27
 
27
- // Free tools (no cost)
28
28
  const FREE_TOOLS = [
29
- 'web_search', 'page_fetch', 'domain_check',
29
+ ...registry.getFreeSlugs(),
30
30
  'fm_index', 'fm_find', 'fm_lines', 'fm_search', 'fm_summary', 'fm_list', 'fm_context',
31
31
  'dewey_add', 'dewey_get', 'dewey_search', 'dewey_list', 'dewey_update', 'dewey_delete', 'dewey_stats',
32
32
  'cf_list_zones', 'cf_get_zone', 'cf_find_zone', 'cf_list_dns', 'cf_ssl_status', 'cf_dev_mode',
33
- 'ux_contrast_check', 'ux_spacing_system',
33
+ 'ux_spacing_system',
34
34
  'vault_status', 'vault_get',
35
35
  'sub_list', 'sub_get', 'sub_discover', 'sub_clone', 'sub_earnings', 'sub_share', 'sub_delete', 'sub_review', 'sub_set_public',
36
- 'fog_check', 'fog_monitor',
37
36
  'caz_get_block'
38
37
  ];
39
38
 
40
- // ENTERPRISE-ONLY tools - require vault credentials + enterprise tier
41
- // These allow autonomous actions (SSH, HTTP, exec) but ONLY when:
42
- // 1. User is on enterprise tier (verified via API key)
43
- // 2. Credentials are stored in 50c-vault (not hardcoded)
44
39
  const ENTERPRISE_GATED_TOOLS = [
45
- 'team_ssh', // SSH to servers (requires vault: ssh_host, ssh_key)
46
- 'team_exec', // Execute commands (requires vault: exec_allowed_hosts)
47
- 'team_http', // HTTP requests to user's servers (requires vault: api_endpoints)
48
- 'team_deploy', // Deploy to user's infra (requires vault: deploy_targets)
49
- 'auto_invent', // Enterprise invention pipeline ($2.00)
50
- 'invent_program' // JSON-defined invention ($2.00)
40
+ ...registry.getEnterpriseSlugs(),
41
+ 'team_ssh',
42
+ 'team_exec',
43
+ 'team_http',
44
+ 'team_deploy',
51
45
  ];
52
46
 
53
47
  // Required vault keys for each enterprise tool
@@ -0,0 +1,177 @@
1
+ const https = require('https');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const API_BASE = 'https://api.50c.ai';
6
+ const CACHE_FILE = path.join(__dirname, '..', '.tools-cache.json');
7
+ const CACHE_TTL = 3600000; // 1 hour
8
+
9
+ let _cache = null;
10
+ let _cacheTime = 0;
11
+
12
+ const FALLBACK_TOOLS = [
13
+ { slug: 'web_search', name: 'web_search', description: 'Search the internet. Returns structured results with title, snippet, URL.', price: 0, tier: 'free', category: 'web_seo' },
14
+ { slug: 'page_fetch', name: 'page_fetch', description: 'Fetch and extract clean content from any URL.', price: 0, tier: 'free', category: 'web_seo' },
15
+ { slug: 'domain_check', name: 'domain_check', description: 'Check domain name availability.', price: 0, tier: 'free', category: 'web_seo' },
16
+ { slug: 'contrast_check', name: 'contrast_check', description: 'WCAG color contrast accessibility checker.', price: 0, tier: 'free', category: 'web_seo' },
17
+ { slug: 'roadmap_add', name: 'roadmap_add', description: 'Add idea to dev roadmap.', price: 0, tier: 'free', category: 'utility' },
18
+ { slug: 'roadmap_list', name: 'roadmap_list', description: 'List roadmap ideas with optional filter.', price: 0, tier: 'free', category: 'utility' },
19
+ { slug: 'roadmap_update', name: 'roadmap_update', description: 'Update roadmap item status, priority, or notes.', price: 0, tier: 'free', category: 'utility' },
20
+ { slug: 'roadmap_delete', name: 'roadmap_delete', description: 'Delete a roadmap item.', price: 0, tier: 'free', category: 'utility' },
21
+ { slug: 'beacon_scan', name: 'beacon_scan', description: 'Context health analysis with entropy scoring.', price: 0.01, tier: 'starter', category: 'context' },
22
+ { slug: 'beacon_rank', name: 'beacon_rank', description: 'Rank messages by information value.', price: 0.01, tier: 'starter', category: 'context' },
23
+ { slug: 'beacon_extract', name: 'beacon_extract', description: 'Extract decisions, errors, entities, or questions from messages.', price: 0.01, tier: 'starter', category: 'context' },
24
+ { slug: 'prompt_categorize', name: 'prompt_categorize', description: 'Auto-detect app type from concept description.', price: 0.01, tier: 'starter', category: 'primitives' },
25
+ { slug: 'one_liner', name: 'one_liner', description: 'Elevator pitch in 8 words.', price: 0.02, tier: 'starter', category: 'primitives' },
26
+ { slug: 'prompt_extract', name: 'prompt_extract', description: 'Extract features, audience, and requirements from concept.', price: 0.02, tier: 'starter', category: 'primitives' },
27
+ { slug: 'beacon_compress', name: 'beacon_compress', description: 'Intelligent context compression preserving key information.', price: 0.02, tier: 'starter', category: 'context' },
28
+ { slug: 'beacon_focus', name: 'beacon_focus', description: 'U-curve reorder messages for optimal query relevance.', price: 0.02, tier: 'starter', category: 'context' },
29
+ { slug: 'echo_sequence', name: 'echo_sequence', description: 'Mathematical echo pattern sequence analysis.', price: 0.02, tier: 'starter', category: 'deep_ai' },
30
+ { slug: 'resonance', name: 'resonance', description: 'Mathematical resonance pattern detection.', price: 0.02, tier: 'starter', category: 'deep_ai' },
31
+ { slug: 'name_it', name: 'name_it', description: '5 product names with domain availability check.', price: 0.03, tier: 'starter', category: 'primitives' },
32
+ { slug: 'caz_dedup', name: 'caz_dedup', description: 'Semantic deduplication of items.', price: 0.03, tier: 'starter', category: 'context' },
33
+ { slug: 'fog_monitor', name: 'fog_monitor', description: 'Monitor conversation health for fog buildup.', price: 0.03, tier: 'starter', category: 'context' },
34
+ { slug: 'fog_checkpoint', name: 'fog_checkpoint', description: 'Checkpoint: what is clear vs unclear in conversation.', price: 0.03, tier: 'starter', category: 'context' },
35
+ { slug: 'hints', name: 'hints', description: '5 brutal debugging hints, 2 words each.', price: 0.05, tier: 'starter', category: 'primitives' },
36
+ { slug: 'quick_vibe', name: 'quick_vibe', description: '3 unconventional ideas for what you are working on.', price: 0.05, tier: 'starter', category: 'primitives' },
37
+ { slug: 'roast', name: 'roast', description: 'Brutal code review. 3 flaws plus fixes.', price: 0.05, tier: 'starter', category: 'primitives' },
38
+ { slug: 'price_it', name: 'price_it', description: 'SaaS pricing strategy recommendation.', price: 0.05, tier: 'starter', category: 'primitives' },
39
+ { slug: 'prompt_phases', name: 'prompt_phases', description: 'Generate 4-phase development prompts.', price: 0.05, tier: 'starter', category: 'primitives' },
40
+ { slug: 'fog_check', name: 'fog_check', description: 'Check conversation for confusion and ambiguity.', price: 0.05, tier: 'starter', category: 'context' },
41
+ { slug: 'fog_clear', name: 'fog_clear', description: 'Suggest actions to clear conversation fog.', price: 0.05, tier: 'starter', category: 'context' },
42
+ { slug: 'prime_residue', name: 'prime_residue', description: 'Prime number residue pattern analysis.', price: 0.05, tier: 'starter', category: 'deep_ai' },
43
+ { slug: 'context_compress', name: 'context_compress', description: 'Compress conversation context intelligently.', price: 0.05, tier: 'pro', category: 'context' },
44
+ { slug: 'schema_generator', name: 'schema_generator', description: 'Generate JSON-LD structured data for SEO.', price: 0.05, tier: 'pro', category: 'web_seo' },
45
+ { slug: 'faq_generator', name: 'faq_generator', description: 'Generate FAQ content with schema markup.', price: 0.05, tier: 'pro', category: 'web_seo' },
46
+ { slug: 'mind_opener', name: 'mind_opener', description: '5 curious angles before solving a problem.', price: 0.08, tier: 'pro', category: 'primitives' },
47
+ { slug: 'prompt_refine', name: 'prompt_refine', description: 'Refine concept with targeted feedback.', price: 0.08, tier: 'pro', category: 'primitives' },
48
+ { slug: 'suggest', name: 'suggest', description: 'Smart next-step suggestions based on context.', price: 0.08, tier: 'pro', category: 'primitives' },
49
+ { slug: 'hints_plus', name: 'hints_plus', description: '10 brutal hints, 4 words each.', price: 0.10, tier: 'pro', category: 'primitives' },
50
+ { slug: 'prompt_expand', name: 'prompt_expand', description: 'Expand idea into detailed concept.', price: 0.10, tier: 'pro', category: 'primitives' },
51
+ { slug: 'idea_fold', name: 'idea_fold', description: 'Test claims through STEM lenses.', price: 0.10, tier: 'pro', category: 'deep_ai' },
52
+ { slug: 'agent_autopsy', name: 'agent_autopsy', description: 'Diagnose why an AI agent failed.', price: 0.10, tier: 'pro', category: 'primitives' },
53
+ { slug: 'cvi_verify', name: 'cvi_verify', description: 'Verify output against constraints.', price: 0.10, tier: 'pro', category: 'deep_ai' },
54
+ { slug: 'handoff', name: 'handoff', description: 'Generate timestamped handoff document.', price: 0.10, tier: 'pro', category: 'utility' },
55
+ { slug: 'compute', name: 'compute', description: 'Execute Python code in isolated sandbox.', price: 0.10, tier: 'pro', category: 'deep_ai' },
56
+ { slug: 'ux_roast', name: 'ux_roast', description: 'Brutal UX review of a website.', price: 0.10, tier: 'pro', category: 'web_seo' },
57
+ { slug: 'seo_audit', name: 'seo_audit', description: 'Quick SEO audit of a URL.', price: 0.10, tier: 'pro', category: 'web_seo' },
58
+ { slug: 'traffic_optimizer', name: 'traffic_optimizer', description: 'Traffic optimization strategies for a site.', price: 0.10, tier: 'pro', category: 'web_seo' },
59
+ { slug: 'prompt_fortress', name: 'prompt_fortress', description: 'Stress-test prompt against 6 attack vectors.', price: 0.20, tier: 'pro', category: 'primitives' },
60
+ { slug: 'bcalc', name: 'bcalc', description: 'Mathematical discovery engine. Explore number theory and test conjectures.', price: 0.15, tier: 'enterprise', category: 'deep_ai' },
61
+ { slug: 'discovery_collision', name: 'discovery_collision', description: 'Systematic multi-tool experiments for unexpected connections.', price: 0.15, tier: 'enterprise', category: 'deep_ai' },
62
+ { slug: 'chaos_fingerprint', name: 'chaos_fingerprint', description: 'Number DNA clustering and pattern signatures.', price: 0.15, tier: 'enterprise', category: 'deep_ai' },
63
+ { slug: 'conversation_diagnostic', name: 'conversation_diagnostic', description: 'Detect loops, drift, and hallucination in conversations.', price: 0.15, tier: 'enterprise', category: 'context' },
64
+ { slug: 'bcalc_why', name: 'bcalc_why', description: 'Deep math explanation revealing why patterns exist.', price: 0.20, tier: 'enterprise', category: 'deep_ai' },
65
+ { slug: 'cvi_loop', name: 'cvi_loop', description: 'Constraint-Verified Intelligence loop for rigorous solutions.', price: 0.30, tier: 'enterprise', category: 'deep_ai' },
66
+ { slug: 'genius', name: 'genius', description: 'Deep problem solving with extended reasoning.', price: 0.50, tier: 'enterprise', category: 'deep_ai' },
67
+ { slug: 'genius_plus', name: 'genius_plus', description: 'Self-improving code generation that iterates to production-ready.', price: 0.65, tier: 'enterprise', category: 'deep_ai' },
68
+ { slug: 'auto_invent', name: 'auto_invent', description: 'Full invention pipeline. Chains mind_opener, idea_fold, bcalc, genius_plus, compute, cvi_verify.', price: 2.00, tier: 'enterprise', category: 'deep_ai' },
69
+ { slug: 'invent_program', name: 'invent_program', description: 'JSON-defined invention programs with custom step sequences.', price: 2.00, tier: 'enterprise', category: 'deep_ai' },
70
+ { slug: 'adoption_calc', name: 'adoption_calc', description: 'Adoption probability calculator. P=(1-e^(-λR))×N×W. Diagnoses bottleneck.', price: 0, tier: 'free', category: 'deep_ai' },
71
+ { slug: 'adoption_diagnose', name: 'adoption_diagnose', description: 'Find which adoption term is near zero. Identifies reward/network/window bottleneck.', price: 0, tier: 'free', category: 'deep_ai' },
72
+ { slug: 'adoption_simulate', name: 'adoption_simulate', description: 'Time-dependent adoption ODE with feedback loops, churn, and upheaval decay.', price: 0, tier: 'free', category: 'deep_ai' },
73
+ ];
74
+
75
+ function fetchFromAPI() {
76
+ return new Promise((resolve, reject) => {
77
+ const req = https.get(`${API_BASE}/v1/tools`, { timeout: 5000 }, (res) => {
78
+ let data = '';
79
+ res.on('data', c => data += c);
80
+ res.on('end', () => {
81
+ try { resolve(JSON.parse(data).tools || []); }
82
+ catch { reject(new Error('Invalid JSON')); }
83
+ });
84
+ });
85
+ req.on('error', reject);
86
+ req.on('timeout', () => { req.destroy(); reject(new Error('timeout')); });
87
+ });
88
+ }
89
+
90
+ function loadDiskCache() {
91
+ try {
92
+ const raw = fs.readFileSync(CACHE_FILE, 'utf8');
93
+ const parsed = JSON.parse(raw);
94
+ if (parsed.tools && parsed.ts) return parsed;
95
+ } catch {}
96
+ return null;
97
+ }
98
+
99
+ function saveDiskCache(tools) {
100
+ try { fs.writeFileSync(CACHE_FILE, JSON.stringify({ tools, ts: Date.now() })); } catch {}
101
+ }
102
+
103
+ async function getTools() {
104
+ if (_cache && (Date.now() - _cacheTime) < CACHE_TTL) return _cache;
105
+
106
+ try {
107
+ const tools = await fetchFromAPI();
108
+ if (tools.length > 0) {
109
+ _cache = tools;
110
+ _cacheTime = Date.now();
111
+ saveDiskCache(tools);
112
+ return tools;
113
+ }
114
+ } catch {}
115
+
116
+ const disk = loadDiskCache();
117
+ if (disk && disk.tools.length > 0) {
118
+ _cache = disk.tools;
119
+ _cacheTime = Date.now();
120
+ return _cache;
121
+ }
122
+
123
+ _cache = FALLBACK_TOOLS;
124
+ _cacheTime = Date.now();
125
+ return _cache;
126
+ }
127
+
128
+ function getToolSync(slug) {
129
+ if (_cache) return _cache.find(t => t.slug === slug);
130
+ return FALLBACK_TOOLS.find(t => t.slug === slug);
131
+ }
132
+
133
+ function getPriceSync(slug) {
134
+ const t = getToolSync(slug);
135
+ return t ? t.price : null;
136
+ }
137
+
138
+ function getTierSync(slug) {
139
+ const t = getToolSync(slug);
140
+ return t ? t.tier : null;
141
+ }
142
+
143
+ function getFreeSlugs() {
144
+ const src = _cache || FALLBACK_TOOLS;
145
+ return src.filter(t => t.tier === 'free').map(t => t.slug);
146
+ }
147
+
148
+ function getEnterpriseSlugs() {
149
+ const src = _cache || FALLBACK_TOOLS;
150
+ return src.filter(t => t.tier === 'enterprise').map(t => t.slug);
151
+ }
152
+
153
+ function getAllSlugs() {
154
+ const src = _cache || FALLBACK_TOOLS;
155
+ return src.map(t => t.slug);
156
+ }
157
+
158
+ function toMCPTools() {
159
+ const src = _cache || FALLBACK_TOOLS;
160
+ return src.filter(t => t.active !== 0).map(t => ({
161
+ name: t.slug,
162
+ description: `${t.description} $${t.price.toFixed(2)}`,
163
+ inputSchema: t.params_json ? JSON.parse(t.params_json) : { type: 'object', properties: {} }
164
+ }));
165
+ }
166
+
167
+ module.exports = {
168
+ getTools,
169
+ getToolSync,
170
+ getPriceSync,
171
+ getTierSync,
172
+ getFreeSlugs,
173
+ getEnterpriseSlugs,
174
+ getAllSlugs,
175
+ toMCPTools,
176
+ FALLBACK_TOOLS,
177
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "50c",
3
- "version": "3.5.0",
3
+ "version": "3.8.0",
4
4
  "description": "AI developer tools via MCP. Pay-per-use from $0.01. No subscriptions.",
5
5
  "bin": {
6
6
  "50c": "./bin/50c.js"