50c 2.1.0 → 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/package.json +1 -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
|