50c 2.0.3 → 2.2.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/config.js +19 -3
- package/lib/index.js +2 -2
- package/lib/packs/labs.js +42 -4
- package/package.json +3 -1
package/lib/config.js
CHANGED
|
@@ -134,21 +134,32 @@ async function saveConfigCloud(config) {
|
|
|
134
134
|
await apiRequest('PUT', '/user/config', { packs: config.packs, vault: config.vault });
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// API request helper
|
|
138
|
-
|
|
137
|
+
// API request helper with configurable timeout
|
|
138
|
+
const SLOW_TOOLS = ['genius', 'genius_plus', 'idea_fold', 'bcalc_why', 'cvi_loop', 'agent_autopsy', 'prompt_fortress'];
|
|
139
|
+
const DEFAULT_TIMEOUT = 30000; // 30s
|
|
140
|
+
const SLOW_TIMEOUT = 120000; // 120s for complex AI tools
|
|
141
|
+
|
|
142
|
+
function apiRequest(method, endpoint, body = null, timeout = null) {
|
|
139
143
|
return new Promise((resolve, reject) => {
|
|
140
144
|
const apiKey = process.env.FIFTY_CENT_API_KEY || process.env.FIFTYC_API_KEY || '';
|
|
141
145
|
const url = new URL(endpoint, API_URL);
|
|
142
146
|
|
|
147
|
+
// Auto-detect timeout based on tool
|
|
148
|
+
if (!timeout) {
|
|
149
|
+
const toolName = endpoint.replace('/tools/', '');
|
|
150
|
+
timeout = SLOW_TOOLS.includes(toolName) ? SLOW_TIMEOUT : DEFAULT_TIMEOUT;
|
|
151
|
+
}
|
|
152
|
+
|
|
143
153
|
const options = {
|
|
144
154
|
hostname: url.hostname,
|
|
145
155
|
port: url.port || 443,
|
|
146
156
|
path: url.pathname,
|
|
147
157
|
method: method,
|
|
158
|
+
timeout: timeout,
|
|
148
159
|
headers: {
|
|
149
160
|
'Content-Type': 'application/json',
|
|
150
161
|
'Authorization': `Bearer ${apiKey}`,
|
|
151
|
-
'User-Agent': '50c/2.
|
|
162
|
+
'User-Agent': '50c/2.1.0'
|
|
152
163
|
}
|
|
153
164
|
};
|
|
154
165
|
|
|
@@ -164,6 +175,11 @@ function apiRequest(method, endpoint, body = null) {
|
|
|
164
175
|
});
|
|
165
176
|
});
|
|
166
177
|
|
|
178
|
+
req.on('timeout', () => {
|
|
179
|
+
req.destroy();
|
|
180
|
+
reject(new Error(`Request timeout after ${timeout}ms`));
|
|
181
|
+
});
|
|
182
|
+
|
|
167
183
|
req.on('error', reject);
|
|
168
184
|
if (body) req.write(JSON.stringify(body));
|
|
169
185
|
req.end();
|
package/lib/index.js
CHANGED
|
@@ -26,8 +26,8 @@ const ux = require('./packs/ux');
|
|
|
26
26
|
// Tool name mappings by pack
|
|
27
27
|
const TOOL_PACKS = {
|
|
28
28
|
beacon: ['hints', 'hints_plus', 'roast', 'quick_vibe', 'one_liner', 'name_it', 'price_it', 'compute', 'ide_conversation', 'learning_stats'],
|
|
29
|
-
labs: ['genius', 'mind_opener', 'idea_fold', '
|
|
30
|
-
labs_plus: ['genius_plus', 'bcalc_why', 'discovery_collision', 'cvi_loop', 'cvi_verify', 'chaos_fingerprint', 'resonance', 'prime_residue', 'echo_sequence', 'conversation_diagnostic', 'handoff']
|
|
29
|
+
labs: ['genius', 'mind_opener', 'idea_fold', 'agent_autopsy', 'prompt_fortress', 'context_health', 'context_compress', 'context_extract', 'context_reposition'],
|
|
30
|
+
labs_plus: ['bcalc', 'genius_plus', 'bcalc_why', 'discovery_collision', 'cvi_loop', 'cvi_verify', 'chaos_fingerprint', 'resonance', 'prime_residue', 'echo_sequence', 'conversation_diagnostic', 'handoff']
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// Get all available tools based on enabled packs
|
package/lib/packs/labs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 50c Labs Pack - PRO Tier Tools ($99/mo)
|
|
3
|
-
* genius, mind_opener,
|
|
3
|
+
* genius, mind_opener, agent_autopsy, prompt_fortress, context_*
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { apiRequest } = require('../config');
|
|
@@ -17,7 +17,13 @@ async function ideaFold(claim) {
|
|
|
17
17
|
return apiRequest('POST', '/tools/idea_fold', { claim });
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
async function agentAutopsy(trace, expected = null, context = null) {
|
|
21
|
+
return apiRequest('POST', '/tools/agent_autopsy', { trace, expected, context });
|
|
22
|
+
}
|
|
20
23
|
|
|
24
|
+
async function promptFortress(prompt, constraints = null) {
|
|
25
|
+
return apiRequest('POST', '/tools/prompt_fortress', { prompt, constraints });
|
|
26
|
+
}
|
|
21
27
|
|
|
22
28
|
async function contextHealth(text) {
|
|
23
29
|
return apiRequest('POST', '/tools/context_health', { text });
|
|
@@ -76,7 +82,35 @@ const LABS_TOOLS = [
|
|
|
76
82
|
cost: 0.10,
|
|
77
83
|
tier: 'pro'
|
|
78
84
|
},
|
|
79
|
-
|
|
85
|
+
{
|
|
86
|
+
name: 'agent_autopsy',
|
|
87
|
+
description: 'Diagnose WHY an AI agent failed. $0.10',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
trace: { type: 'string', description: 'Agent logs/output/conversation' },
|
|
92
|
+
expected: { type: 'string', description: 'What agent should have done' },
|
|
93
|
+
context: { type: 'string', description: 'Task context' }
|
|
94
|
+
},
|
|
95
|
+
required: ['trace']
|
|
96
|
+
},
|
|
97
|
+
cost: 0.10,
|
|
98
|
+
tier: 'pro'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'prompt_fortress',
|
|
102
|
+
description: 'Stress-test prompt against 6 attack vectors. $0.20',
|
|
103
|
+
inputSchema: {
|
|
104
|
+
type: 'object',
|
|
105
|
+
properties: {
|
|
106
|
+
prompt: { type: 'string', description: 'Prompt to test' },
|
|
107
|
+
constraints: { type: 'array', items: { type: 'string' }, description: 'Security constraints' }
|
|
108
|
+
},
|
|
109
|
+
required: ['prompt']
|
|
110
|
+
},
|
|
111
|
+
cost: 0.20,
|
|
112
|
+
tier: 'pro'
|
|
113
|
+
},
|
|
80
114
|
{
|
|
81
115
|
name: 'context_health',
|
|
82
116
|
description: 'Token zone, density, redundancy analysis. $0.05',
|
|
@@ -141,7 +175,10 @@ async function handleTool(name, args) {
|
|
|
141
175
|
return await mindOpener(args.problem);
|
|
142
176
|
case 'idea_fold':
|
|
143
177
|
return await ideaFold(args.claim);
|
|
144
|
-
|
|
178
|
+
case 'agent_autopsy':
|
|
179
|
+
return await agentAutopsy(args.trace, args.expected, args.context);
|
|
180
|
+
case 'prompt_fortress':
|
|
181
|
+
return await promptFortress(args.prompt, args.constraints);
|
|
145
182
|
case 'context_health':
|
|
146
183
|
return await contextHealth(args.text);
|
|
147
184
|
case 'context_compress':
|
|
@@ -164,7 +201,8 @@ module.exports = {
|
|
|
164
201
|
genius,
|
|
165
202
|
mindOpener,
|
|
166
203
|
ideaFold,
|
|
167
|
-
|
|
204
|
+
agentAutopsy,
|
|
205
|
+
promptFortress,
|
|
168
206
|
contextHealth,
|
|
169
207
|
contextCompress,
|
|
170
208
|
contextExtract,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "50c",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "AI toolkit. One install, 100+ tools. Works everywhere.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"llm",
|
|
13
13
|
"tools",
|
|
14
14
|
"genius",
|
|
15
|
+
"agent-autopsy",
|
|
16
|
+
"prompt-fortress",
|
|
15
17
|
"bcalc",
|
|
16
18
|
"vault",
|
|
17
19
|
"cloudflare",
|