hedgequantx 2.8.1 → 2.8.3
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/package.json
CHANGED
|
@@ -92,8 +92,9 @@ const draw2ColRowCentered = (leftText, rightText, W) => {
|
|
|
92
92
|
* @param {Array} providers - List of AI providers
|
|
93
93
|
* @param {Object} config - Current config
|
|
94
94
|
* @param {number} boxWidth - Box width
|
|
95
|
+
* @param {boolean} showTest - Show [T] TEST option
|
|
95
96
|
*/
|
|
96
|
-
const drawProvidersTable = (providers, config, boxWidth) => {
|
|
97
|
+
const drawProvidersTable = (providers, config, boxWidth, showTest = false) => {
|
|
97
98
|
const W = boxWidth - 2;
|
|
98
99
|
const colWidth = Math.floor(W / 2);
|
|
99
100
|
|
|
@@ -158,6 +159,12 @@ const drawProvidersTable = (providers, config, boxWidth) => {
|
|
|
158
159
|
console.log(chalk.cyan('║') + leftCol + rightCol + chalk.cyan('║'));
|
|
159
160
|
}
|
|
160
161
|
|
|
162
|
+
// Show [T] TEST option if agents are configured
|
|
163
|
+
if (showTest) {
|
|
164
|
+
console.log(chalk.cyan('╠' + '─'.repeat(W) + '╣'));
|
|
165
|
+
console.log(chalk.cyan('║') + chalk.green(centerText('[T] TEST ALL CONNECTIONS', W)) + chalk.cyan('║'));
|
|
166
|
+
}
|
|
167
|
+
|
|
161
168
|
console.log(chalk.cyan('╠' + '─'.repeat(W) + '╣'));
|
|
162
169
|
console.log(chalk.cyan('║') + chalk.red(centerText('[B] BACK TO MENU', W)) + chalk.cyan('║'));
|
|
163
170
|
console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
|
|
@@ -309,24 +316,33 @@ const drawConnectionTest = async (agents, boxWidth, clearWithBanner) => {
|
|
|
309
316
|
return { success: false, error: 'No agents' };
|
|
310
317
|
}
|
|
311
318
|
|
|
312
|
-
clearWithBanner();
|
|
313
319
|
const W = boxWidth - 2;
|
|
314
320
|
|
|
321
|
+
// Show loading state with complete box
|
|
322
|
+
clearWithBanner();
|
|
315
323
|
console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
|
|
316
324
|
console.log(chalk.cyan('║') + chalk.yellow.bold(centerText('AI AGENTS CONNECTION TEST', W)) + chalk.cyan('║'));
|
|
317
325
|
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
326
|
+
const loadingText = ' Testing connections... Please wait';
|
|
327
|
+
console.log(chalk.cyan('║') + chalk.yellow(loadingText) + ' '.repeat(W - loadingText.length) + chalk.cyan('║'));
|
|
318
328
|
console.log(chalk.cyan('║') + ' '.repeat(W) + chalk.cyan('║'));
|
|
329
|
+
console.log(chalk.cyan('╚' + '═'.repeat(W) + '╝'));
|
|
319
330
|
|
|
320
|
-
// Run pre-flight check
|
|
321
|
-
const spinner = ora({ text: 'Testing connections...', color: 'yellow' }).start();
|
|
331
|
+
// Run pre-flight check (no spinner, box stays complete)
|
|
322
332
|
const results = await runPreflightCheck(agents);
|
|
323
|
-
|
|
333
|
+
|
|
334
|
+
// Clear and redraw with results
|
|
335
|
+
clearWithBanner();
|
|
336
|
+
console.log(chalk.cyan('╔' + '═'.repeat(W) + '╗'));
|
|
337
|
+
console.log(chalk.cyan('║') + chalk.yellow.bold(centerText('AI AGENTS CONNECTION TEST', W)) + chalk.cyan('║'));
|
|
338
|
+
console.log(chalk.cyan('╠' + '═'.repeat(W) + '╣'));
|
|
324
339
|
|
|
325
340
|
// Display results
|
|
326
341
|
const lines = formatPreflightResults(results, boxWidth);
|
|
327
342
|
for (const line of lines) {
|
|
328
|
-
const
|
|
329
|
-
|
|
343
|
+
const lineLen = visibleLength(line);
|
|
344
|
+
const padding = Math.max(0, W - lineLen);
|
|
345
|
+
console.log(chalk.cyan('║') + line + ' '.repeat(padding) + chalk.cyan('║'));
|
|
330
346
|
}
|
|
331
347
|
|
|
332
348
|
// Summary
|
package/src/pages/ai-agents.js
CHANGED
|
@@ -439,13 +439,8 @@ const aiAgentsMenu = async () => {
|
|
|
439
439
|
|
|
440
440
|
while (true) {
|
|
441
441
|
clearWithBanner();
|
|
442
|
-
drawProvidersTable(AI_PROVIDERS, config, boxWidth);
|
|
443
|
-
|
|
444
|
-
// Show [T] TEST option if agents are configured
|
|
445
442
|
const agentCount = getActiveAgentCount();
|
|
446
|
-
|
|
447
|
-
console.log(chalk.cyan(' [T] TEST ALL CONNECTIONS'));
|
|
448
|
-
}
|
|
443
|
+
drawProvidersTable(AI_PROVIDERS, config, boxWidth, agentCount > 0);
|
|
449
444
|
console.log();
|
|
450
445
|
|
|
451
446
|
const promptText = agentCount > 0 ? 'SELECT (1-8/T/B): ' : 'SELECT (1-8/B): ';
|
|
@@ -15,8 +15,8 @@ const cliproxy = require('../cliproxy');
|
|
|
15
15
|
const TEST_PROMPT = `You are being tested. Respond ONLY with this exact JSON, nothing else:
|
|
16
16
|
{"decision":"approve","confidence":100,"reason":"test-ok"}`;
|
|
17
17
|
|
|
18
|
-
/** Timeout for agent response (
|
|
19
|
-
const AGENT_TIMEOUT =
|
|
18
|
+
/** Timeout for agent response (increased for slower providers like Gemini) */
|
|
19
|
+
const AGENT_TIMEOUT = 15000;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Check if CLIProxy is running and responding
|
|
@@ -211,19 +211,27 @@ const runPreflightCheck = async (agents) => {
|
|
|
211
211
|
const formatPreflightResults = (results, boxWidth) => {
|
|
212
212
|
const chalk = require('chalk');
|
|
213
213
|
const lines = [];
|
|
214
|
-
const W = boxWidth -
|
|
214
|
+
const W = boxWidth - 4; // Account for borders and padding
|
|
215
|
+
|
|
216
|
+
// Helper to create dotted line with proper alignment
|
|
217
|
+
const dottedLine = (label, value, labelPad = 3) => {
|
|
218
|
+
const valueLen = value.replace(/\x1b\[[0-9;]*m/g, '').length; // Strip ANSI
|
|
219
|
+
const labelLen = label.length;
|
|
220
|
+
const dotsLen = W - labelPad - labelLen - valueLen - 1;
|
|
221
|
+
return ' '.repeat(labelPad) + chalk.white(label) + chalk.gray('.'.repeat(Math.max(3, dotsLen))) + value;
|
|
222
|
+
};
|
|
215
223
|
|
|
216
224
|
// CLIProxy status
|
|
217
225
|
if (results.cliproxy.success) {
|
|
218
|
-
lines.push(
|
|
226
|
+
lines.push(dottedLine('CLIProxy Status', chalk.green('✓ RUNNING')));
|
|
219
227
|
} else {
|
|
220
|
-
lines.push(
|
|
221
|
-
lines.push(chalk.red(`
|
|
228
|
+
lines.push(dottedLine('CLIProxy Status', chalk.red('✗ NOT RUNNING')));
|
|
229
|
+
lines.push(chalk.red(` Error: ${results.cliproxy.error}`));
|
|
222
230
|
return lines;
|
|
223
231
|
}
|
|
224
232
|
|
|
225
233
|
lines.push('');
|
|
226
|
-
lines.push(chalk.white(`
|
|
234
|
+
lines.push(chalk.white(` Testing ${results.summary.total} agent(s):`));
|
|
227
235
|
lines.push('');
|
|
228
236
|
|
|
229
237
|
// Each agent
|
|
@@ -231,15 +239,15 @@ const formatPreflightResults = (results, boxWidth) => {
|
|
|
231
239
|
const agent = results.agents[i];
|
|
232
240
|
const num = `[${i + 1}/${results.summary.total}]`;
|
|
233
241
|
|
|
234
|
-
lines.push(chalk.cyan(`
|
|
242
|
+
lines.push(chalk.cyan(` ${num} ${agent.name} (${agent.modelId || agent.provider})`));
|
|
235
243
|
|
|
236
244
|
if (agent.success) {
|
|
237
|
-
const latencyStr =
|
|
238
|
-
lines.push(
|
|
239
|
-
lines.push(
|
|
245
|
+
const latencyStr = `✓ OK ${agent.latency}ms`;
|
|
246
|
+
lines.push(dottedLine('Connection', chalk.green(latencyStr), 9));
|
|
247
|
+
lines.push(dottedLine('Format', chalk.green('✓ VALID'), 9));
|
|
240
248
|
} else {
|
|
241
|
-
lines.push(
|
|
242
|
-
lines.push(chalk.red(`
|
|
249
|
+
lines.push(dottedLine('Connection', chalk.red('✗ FAILED'), 9));
|
|
250
|
+
lines.push(chalk.red(` Error: ${agent.error}`));
|
|
243
251
|
}
|
|
244
252
|
|
|
245
253
|
lines.push('');
|