50c 1.5.0 → 2.0.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.
@@ -0,0 +1,188 @@
1
+ /**
2
+ * 50c Labs Pack - PRO Tier Tools ($99/mo)
3
+ * genius, mind_opener, bcalc, context_*
4
+ */
5
+
6
+ const { apiRequest } = require('../config');
7
+
8
+ async function genius(problem, research = false) {
9
+ return apiRequest('POST', '/tools/genius', { problem, research });
10
+ }
11
+
12
+ async function mindOpener(problem) {
13
+ return apiRequest('POST', '/tools/mind_opener', { problem });
14
+ }
15
+
16
+ async function ideaFold(claim) {
17
+ return apiRequest('POST', '/tools/idea_fold', { claim });
18
+ }
19
+
20
+ async function bcalc(expression, mode = 'explore') {
21
+ return apiRequest('POST', '/tools/bcalc', { expression, mode });
22
+ }
23
+
24
+ async function contextHealth(text) {
25
+ return apiRequest('POST', '/tools/context_health', { text });
26
+ }
27
+
28
+ async function contextCompress(text) {
29
+ return apiRequest('POST', '/tools/context_compress', { text });
30
+ }
31
+
32
+ async function contextExtract(text, extract_type = 'all') {
33
+ return apiRequest('POST', '/tools/context_extract', { text, extract_type });
34
+ }
35
+
36
+ async function contextReposition(text) {
37
+ return apiRequest('POST', '/tools/context_reposition', { text });
38
+ }
39
+
40
+ const LABS_TOOLS = [
41
+ {
42
+ name: 'genius',
43
+ description: 'Deep problem solving. $0.50',
44
+ inputSchema: {
45
+ type: 'object',
46
+ properties: {
47
+ problem: { type: 'string', description: 'Problem to solve' },
48
+ research: { type: 'boolean', description: 'Enable web research', default: false }
49
+ },
50
+ required: ['problem']
51
+ },
52
+ cost: 0.50,
53
+ tier: 'pro'
54
+ },
55
+ {
56
+ name: 'mind_opener',
57
+ description: '5 curious angles before solving. $0.08',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: {
61
+ problem: { type: 'string', description: 'Problem to explore angles on' }
62
+ },
63
+ required: ['problem']
64
+ },
65
+ cost: 0.08,
66
+ tier: 'pro'
67
+ },
68
+ {
69
+ name: 'idea_fold',
70
+ description: 'Test claims with Feynman/Shannon/Curie rigor. $0.10',
71
+ inputSchema: {
72
+ type: 'object',
73
+ properties: {
74
+ claim: { type: 'string', description: 'Claim to test' }
75
+ },
76
+ required: ['claim']
77
+ },
78
+ cost: 0.10,
79
+ tier: 'pro'
80
+ },
81
+ {
82
+ name: 'bcalc',
83
+ description: 'Mathematical discovery engine. $0.15',
84
+ inputSchema: {
85
+ type: 'object',
86
+ properties: {
87
+ expression: { type: 'string', description: 'Math expression or conjecture' },
88
+ mode: { type: 'string', enum: ['explore', 'conjecture', 'connect'], default: 'explore' }
89
+ },
90
+ required: ['expression']
91
+ },
92
+ cost: 0.15,
93
+ tier: 'pro'
94
+ },
95
+ {
96
+ name: 'context_health',
97
+ description: 'Token zone, density, redundancy analysis. $0.05',
98
+ inputSchema: {
99
+ type: 'object',
100
+ properties: {
101
+ text: { type: 'string', description: 'Context to analyze' }
102
+ },
103
+ required: ['text']
104
+ },
105
+ cost: 0.05,
106
+ tier: 'pro'
107
+ },
108
+ {
109
+ name: 'context_compress',
110
+ description: 'Extract entities/decisions, compress context. $0.08',
111
+ inputSchema: {
112
+ type: 'object',
113
+ properties: {
114
+ text: { type: 'string', description: 'Context to compress' }
115
+ },
116
+ required: ['text']
117
+ },
118
+ cost: 0.08,
119
+ tier: 'pro'
120
+ },
121
+ {
122
+ name: 'context_extract',
123
+ description: 'Extract decisions/entities/questions/errors. $0.05',
124
+ inputSchema: {
125
+ type: 'object',
126
+ properties: {
127
+ text: { type: 'string', description: 'Text to extract from' },
128
+ extract_type: { type: 'string', enum: ['all', 'decisions', 'entities', 'questions', 'errors'], default: 'all' }
129
+ },
130
+ required: ['text']
131
+ },
132
+ cost: 0.05,
133
+ tier: 'pro'
134
+ },
135
+ {
136
+ name: 'context_reposition',
137
+ description: 'Reorder for attention optimization. $0.05',
138
+ inputSchema: {
139
+ type: 'object',
140
+ properties: {
141
+ text: { type: 'string', description: 'Context to reposition' }
142
+ },
143
+ required: ['text']
144
+ },
145
+ cost: 0.05,
146
+ tier: 'pro'
147
+ }
148
+ ];
149
+
150
+ async function handleTool(name, args) {
151
+ try {
152
+ switch (name) {
153
+ case 'genius':
154
+ return await genius(args.problem, args.research);
155
+ case 'mind_opener':
156
+ return await mindOpener(args.problem);
157
+ case 'idea_fold':
158
+ return await ideaFold(args.claim);
159
+ case 'bcalc':
160
+ return await bcalc(args.expression, args.mode);
161
+ case 'context_health':
162
+ return await contextHealth(args.text);
163
+ case 'context_compress':
164
+ return await contextCompress(args.text);
165
+ case 'context_extract':
166
+ return await contextExtract(args.text, args.extract_type);
167
+ case 'context_reposition':
168
+ return await contextReposition(args.text);
169
+ default:
170
+ return { error: `Unknown labs tool: ${name}` };
171
+ }
172
+ } catch (e) {
173
+ return { error: e.message };
174
+ }
175
+ }
176
+
177
+ module.exports = {
178
+ LABS_TOOLS,
179
+ handleTool,
180
+ genius,
181
+ mindOpener,
182
+ ideaFold,
183
+ bcalc,
184
+ contextHealth,
185
+ contextCompress,
186
+ contextExtract,
187
+ contextReposition
188
+ };
@@ -0,0 +1,246 @@
1
+ /**
2
+ * 50c Labs+ Pack - ENTERPRISE Tier Tools ($499/mo)
3
+ * genius_plus, bcalc_why, CVI, discovery_collision, chaos tools
4
+ */
5
+
6
+ const { apiRequest } = require('../config');
7
+
8
+ async function geniusPlus(problem) {
9
+ return apiRequest('POST', '/tools/genius_plus', { problem });
10
+ }
11
+
12
+ async function bcalcWhy(expression) {
13
+ return apiRequest('POST', '/tools/bcalc_why', { expression });
14
+ }
15
+
16
+ async function discoveryCollision(tools, target) {
17
+ return apiRequest('POST', '/tools/discovery_collision', { tools, target });
18
+ }
19
+
20
+ async function cviLoop(constraints, task) {
21
+ return apiRequest('POST', '/tools/cvi_loop', { constraints, task });
22
+ }
23
+
24
+ async function cviVerify(constraints, output) {
25
+ return apiRequest('POST', '/tools/cvi_verify', { constraints, output });
26
+ }
27
+
28
+ async function chaosFingerprint(limit = 10000) {
29
+ return apiRequest('POST', '/tools/chaos_fingerprint', { limit });
30
+ }
31
+
32
+ async function resonance(n) {
33
+ return apiRequest('POST', '/tools/resonance', { n });
34
+ }
35
+
36
+ async function primeResidue(n_primes = 5000) {
37
+ return apiRequest('POST', '/tools/prime_residue', { n_primes });
38
+ }
39
+
40
+ async function echoSequence(n = 100) {
41
+ return apiRequest('POST', '/tools/echo_sequence', { n });
42
+ }
43
+
44
+ async function conversationDiagnostic(messages) {
45
+ return apiRequest('POST', '/tools/conversation_diagnostic', { messages });
46
+ }
47
+
48
+ async function handoff(project, context) {
49
+ return apiRequest('POST', '/tools/handoff', { project, context });
50
+ }
51
+
52
+ const LABS_PLUS_TOOLS = [
53
+ {
54
+ name: 'genius_plus',
55
+ description: 'Self-improving code gen. $0.65. Learns from errors.',
56
+ inputSchema: {
57
+ type: 'object',
58
+ properties: {
59
+ problem: { type: 'string', description: 'Complex problem requiring iteration' }
60
+ },
61
+ required: ['problem']
62
+ },
63
+ cost: 0.65,
64
+ tier: 'enterprise'
65
+ },
66
+ {
67
+ name: 'bcalc_why',
68
+ description: 'Deep explanation with BSD/Heegner knowledge. $0.20',
69
+ inputSchema: {
70
+ type: 'object',
71
+ properties: {
72
+ expression: { type: 'string', description: 'Math to explain deeply' }
73
+ },
74
+ required: ['expression']
75
+ },
76
+ cost: 0.20,
77
+ tier: 'enterprise'
78
+ },
79
+ {
80
+ name: 'discovery_collision',
81
+ description: 'Systematic tool combination engine. $0.25',
82
+ inputSchema: {
83
+ type: 'object',
84
+ properties: {
85
+ tools: { type: 'array', items: { type: 'string' }, description: 'Tools to combine' },
86
+ target: { type: 'string', description: 'Goal to achieve' }
87
+ },
88
+ required: ['tools', 'target']
89
+ },
90
+ cost: 0.25,
91
+ tier: 'enterprise'
92
+ },
93
+ {
94
+ name: 'cvi_loop',
95
+ description: 'Constraint-Verified Intelligence loop. $0.30',
96
+ inputSchema: {
97
+ type: 'object',
98
+ properties: {
99
+ constraints: { type: 'array', items: { type: 'string' }, description: 'Constraints to enforce' },
100
+ task: { type: 'string', description: 'Task to complete under constraints' }
101
+ },
102
+ required: ['constraints', 'task']
103
+ },
104
+ cost: 0.30,
105
+ tier: 'enterprise'
106
+ },
107
+ {
108
+ name: 'cvi_verify',
109
+ description: 'Verify output against constraints. $0.10',
110
+ inputSchema: {
111
+ type: 'object',
112
+ properties: {
113
+ constraints: { type: 'array', items: { type: 'string' }, description: 'Constraints to check' },
114
+ output: { type: 'string', description: 'Output to verify' }
115
+ },
116
+ required: ['constraints', 'output']
117
+ },
118
+ cost: 0.10,
119
+ tier: 'enterprise'
120
+ },
121
+ {
122
+ name: 'chaos_fingerprint',
123
+ description: 'Number DNA clustering by collatz/digit_root/omega. $0.15',
124
+ inputSchema: {
125
+ type: 'object',
126
+ properties: {
127
+ limit: { type: 'number', description: 'Upper bound', default: 10000 }
128
+ }
129
+ },
130
+ cost: 0.15,
131
+ tier: 'enterprise'
132
+ },
133
+ {
134
+ name: 'resonance',
135
+ description: 'R(n) novel function - divisor/digit-sum resonance. $0.10',
136
+ inputSchema: {
137
+ type: 'object',
138
+ properties: {
139
+ n: { type: 'number', description: 'Number to analyze' }
140
+ },
141
+ required: ['n']
142
+ },
143
+ cost: 0.10,
144
+ tier: 'enterprise'
145
+ },
146
+ {
147
+ name: 'prime_residue',
148
+ description: 'Open conjecture testing f(p)=p mod digit_sum(p). $0.15',
149
+ inputSchema: {
150
+ type: 'object',
151
+ properties: {
152
+ n_primes: { type: 'number', description: 'Primes to test', default: 5000 }
153
+ }
154
+ },
155
+ cost: 0.15,
156
+ tier: 'enterprise'
157
+ },
158
+ {
159
+ name: 'echo_sequence',
160
+ description: 'Novel sequence e(n)=digit_sum(e(n-1)*n). $0.10',
161
+ inputSchema: {
162
+ type: 'object',
163
+ properties: {
164
+ n: { type: 'number', description: 'Sequence length', default: 100 }
165
+ }
166
+ },
167
+ cost: 0.10,
168
+ tier: 'enterprise'
169
+ },
170
+ {
171
+ name: 'conversation_diagnostic',
172
+ description: 'Detect loops, drift, hallucination in conversation. $0.15',
173
+ inputSchema: {
174
+ type: 'object',
175
+ properties: {
176
+ messages: { type: 'array', items: { type: 'string' }, description: 'Conversation messages' }
177
+ },
178
+ required: ['messages']
179
+ },
180
+ cost: 0.15,
181
+ tier: 'enterprise'
182
+ },
183
+ {
184
+ name: 'handoff',
185
+ description: 'Generate timestamped handoff document. $0.10',
186
+ inputSchema: {
187
+ type: 'object',
188
+ properties: {
189
+ project: { type: 'string', description: 'Project name' },
190
+ context: { type: 'string', description: 'Current context to preserve' }
191
+ },
192
+ required: ['project', 'context']
193
+ },
194
+ cost: 0.10,
195
+ tier: 'enterprise'
196
+ }
197
+ ];
198
+
199
+ async function handleTool(name, args) {
200
+ try {
201
+ switch (name) {
202
+ case 'genius_plus':
203
+ return await geniusPlus(args.problem);
204
+ case 'bcalc_why':
205
+ return await bcalcWhy(args.expression);
206
+ case 'discovery_collision':
207
+ return await discoveryCollision(args.tools, args.target);
208
+ case 'cvi_loop':
209
+ return await cviLoop(args.constraints, args.task);
210
+ case 'cvi_verify':
211
+ return await cviVerify(args.constraints, args.output);
212
+ case 'chaos_fingerprint':
213
+ return await chaosFingerprint(args.limit);
214
+ case 'resonance':
215
+ return await resonance(args.n);
216
+ case 'prime_residue':
217
+ return await primeResidue(args.n_primes);
218
+ case 'echo_sequence':
219
+ return await echoSequence(args.n);
220
+ case 'conversation_diagnostic':
221
+ return await conversationDiagnostic(args.messages);
222
+ case 'handoff':
223
+ return await handoff(args.project, args.context);
224
+ default:
225
+ return { error: `Unknown labs_plus tool: ${name}` };
226
+ }
227
+ } catch (e) {
228
+ return { error: e.message };
229
+ }
230
+ }
231
+
232
+ module.exports = {
233
+ LABS_PLUS_TOOLS,
234
+ handleTool,
235
+ geniusPlus,
236
+ bcalcWhy,
237
+ discoveryCollision,
238
+ cviLoop,
239
+ cviVerify,
240
+ chaosFingerprint,
241
+ resonance,
242
+ primeResidue,
243
+ echoSequence,
244
+ conversationDiagnostic,
245
+ handoff
246
+ };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * 50c UX Pack - UI/UX Toolkit
3
+ * 17 tools for design, A/B testing, accessibility
4
+ */
5
+
6
+ const { apiRequest } = require('../config');
7
+
8
+ // Local free tools
9
+ function hexToRgb(hex) {
10
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
11
+ return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null;
12
+ }
13
+
14
+ function getLuminance(r, g, b) {
15
+ const [rs, gs, bs] = [r, g, b].map(c => { c = c / 255; return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4); });
16
+ return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
17
+ }
18
+
19
+ function contrastCheck(fg, bg) {
20
+ const fgRgb = hexToRgb(fg), bgRgb = hexToRgb(bg);
21
+ if (!fgRgb || !bgRgb) return { error: 'Invalid hex color' };
22
+ const l1 = getLuminance(fgRgb.r, fgRgb.g, fgRgb.b);
23
+ const l2 = getLuminance(bgRgb.r, bgRgb.g, bgRgb.b);
24
+ const ratio = (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
25
+ return { ratio: ratio.toFixed(2), aa_normal: ratio >= 4.5 ? 'PASS' : 'FAIL', aa_large: ratio >= 3 ? 'PASS' : 'FAIL', aaa_normal: ratio >= 7 ? 'PASS' : 'FAIL' };
26
+ }
27
+
28
+ function colorPalette(baseColor, style = 'vibrant') {
29
+ const base = hexToRgb(baseColor);
30
+ if (!base) return { error: 'Invalid hex color' };
31
+ // Simple palette generation
32
+ return {
33
+ base: baseColor,
34
+ light: '#' + [base.r, base.g, base.b].map(c => Math.min(255, c + 40).toString(16).padStart(2, '0')).join(''),
35
+ dark: '#' + [base.r, base.g, base.b].map(c => Math.max(0, c - 40).toString(16).padStart(2, '0')).join(''),
36
+ complement: '#' + [255 - base.r, 255 - base.g, 255 - base.b].map(c => c.toString(16).padStart(2, '0')).join('')
37
+ };
38
+ }
39
+
40
+ function spacingSystem(base = 4, scale = 'tailwind') {
41
+ const multipliers = [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32];
42
+ const system = {};
43
+ multipliers.forEach((m, i) => { system[i] = { px: Math.round(base * m), rem: (base * m / 16).toFixed(3) }; });
44
+ return { base_unit: base, scale, spacing: system };
45
+ }
46
+
47
+ const UX_TOOLS = [
48
+ // Free local tools
49
+ { name: 'ux_contrast_check', description: 'Check color contrast. FREE.', inputSchema: { type: 'object', properties: { foreground: { type: 'string' }, background: { type: 'string' } }, required: ['foreground', 'background'] } },
50
+ { name: 'ux_color_palette', description: 'Generate color palette. FREE.', inputSchema: { type: 'object', properties: { base_color: { type: 'string' }, style: { type: 'string' } }, required: ['base_color'] } },
51
+ { name: 'ux_spacing_system', description: 'Generate spacing scale. FREE.', inputSchema: { type: 'object', properties: { base: { type: 'number' }, scale: { type: 'string' } } } },
52
+
53
+ // API tools
54
+ { name: 'ux_list_blocks', description: 'List design blocks. FREE.', inputSchema: { type: 'object', properties: { type: { type: 'string' } } } },
55
+ { name: 'ux_get_block', description: 'Get block HTML. FREE.', inputSchema: { type: 'object', properties: { block_id: { type: 'string' } }, required: ['block_id'] } },
56
+ { name: 'ux_build_page', description: 'Combine blocks. 2 credits.', inputSchema: { type: 'object', properties: { block_ids: { type: 'array', items: { type: 'string' } } }, required: ['block_ids'] } },
57
+ { name: 'ux_ab_compare', description: 'Compare designs. 2 credits.', inputSchema: { type: 'object', properties: { html_a: { type: 'string' }, html_b: { type: 'string' } }, required: ['html_a', 'html_b'] } },
58
+ { name: 'ux_ab_winner', description: 'Predict winner. 5 credits.', inputSchema: { type: 'object', properties: { html_a: { type: 'string' }, html_b: { type: 'string' } }, required: ['html_a', 'html_b'] } },
59
+ { name: 'ux_a11y_check', description: 'Check accessibility. 2 credits.', inputSchema: { type: 'object', properties: { html: { type: 'string' } }, required: ['html'] } },
60
+ { name: 'ux_roast', description: 'UX review. 5 credits.', inputSchema: { type: 'object', properties: { html: { type: 'string' } }, required: ['html'] } },
61
+ { name: 'ux_copy_improve', description: 'Improve copy. 3 credits.', inputSchema: { type: 'object', properties: { text: { type: 'string' }, context: { type: 'string' } }, required: ['text'] } }
62
+ ];
63
+
64
+ async function handleTool(name, args) {
65
+ try {
66
+ // Local free tools
67
+ if (name === 'ux_contrast_check') return contrastCheck(args.foreground, args.background);
68
+ if (name === 'ux_color_palette') return colorPalette(args.base_color, args.style);
69
+ if (name === 'ux_spacing_system') return spacingSystem(args.base, args.scale);
70
+
71
+ // API tools
72
+ return apiRequest('POST', `/ux/${name.replace('ux_', '')}`, args);
73
+ } catch (e) { return { error: e.message }; }
74
+ }
75
+
76
+ module.exports = { UX_TOOLS, handleTool };