polydev-ai 1.2.1 → 1.2.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/lib/cliManager.js +11 -0
- package/mcp/manifest.json +1 -1
- package/mcp/server.js +7 -1
- package/mcp/stdio-wrapper.js +23 -7
- package/package.json +2 -1
package/lib/cliManager.js
CHANGED
|
@@ -350,6 +350,12 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
350
350
|
if (timeoutMs === null) {
|
|
351
351
|
timeoutMs = providerId === 'claude_code' ? 60000 : 30000; // 60s for Claude Code, 30s for others
|
|
352
352
|
}
|
|
353
|
+
|
|
354
|
+
// Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
|
|
355
|
+
if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 300000) {
|
|
356
|
+
timeoutMs = 30000 // Default to 30 seconds
|
|
357
|
+
}
|
|
358
|
+
|
|
353
359
|
const startTime = Date.now();
|
|
354
360
|
|
|
355
361
|
try {
|
|
@@ -434,6 +440,11 @@ This is a known issue with @google/gemini-cli@0.3.4 and older Node.js versions.`
|
|
|
434
440
|
}
|
|
435
441
|
|
|
436
442
|
async executeCliCommand(command, args, mode = 'args', timeoutMs = 30000, stdinInput) {
|
|
443
|
+
// Ensure timeoutMs is valid (not undefined, null, Infinity, or negative)
|
|
444
|
+
if (!timeoutMs || timeoutMs === Infinity || timeoutMs < 1 || timeoutMs > 300000) {
|
|
445
|
+
timeoutMs = 30000 // Default to 30 seconds
|
|
446
|
+
}
|
|
447
|
+
|
|
437
448
|
return new Promise((resolve, reject) => {
|
|
438
449
|
if (process.env.POLYDEV_CLI_DEBUG) {
|
|
439
450
|
console.log(`[CLI Debug] Executing: ${command} ${args.join(' ')} (mode: ${mode})`);
|
package/mcp/manifest.json
CHANGED
package/mcp/server.js
CHANGED
|
@@ -557,6 +557,12 @@ class MCPServer {
|
|
|
557
557
|
try {
|
|
558
558
|
const { provider_id, prompt, mode = 'args', timeout_ms = 30000, user_id } = args;
|
|
559
559
|
|
|
560
|
+
// Ensure timeout_ms is valid (not undefined, null, Infinity, or negative)
|
|
561
|
+
let validTimeout = timeout_ms;
|
|
562
|
+
if (!validTimeout || validTimeout === Infinity || validTimeout < 1 || validTimeout > 300000) {
|
|
563
|
+
validTimeout = 30000 // Default to 30 seconds
|
|
564
|
+
}
|
|
565
|
+
|
|
560
566
|
if (!provider_id || !prompt) {
|
|
561
567
|
throw new Error('provider_id and prompt are required');
|
|
562
568
|
}
|
|
@@ -566,7 +572,7 @@ class MCPServer {
|
|
|
566
572
|
provider_id,
|
|
567
573
|
prompt,
|
|
568
574
|
mode,
|
|
569
|
-
|
|
575
|
+
validTimeout
|
|
570
576
|
);
|
|
571
577
|
|
|
572
578
|
// CLI usage is tracked locally - no database integration needed
|
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -279,6 +279,11 @@ class StdioMCPWrapper {
|
|
|
279
279
|
try {
|
|
280
280
|
let { provider_id, prompt, mode = 'args', timeout_ms = 30000 } = args;
|
|
281
281
|
|
|
282
|
+
// Ensure timeout_ms is valid (not undefined, null, Infinity, or negative)
|
|
283
|
+
if (!timeout_ms || timeout_ms === Infinity || timeout_ms < 1 || timeout_ms > 300000) {
|
|
284
|
+
timeout_ms = 30000 // Default to 30 seconds
|
|
285
|
+
}
|
|
286
|
+
|
|
282
287
|
if (!prompt) {
|
|
283
288
|
throw new Error('prompt is required');
|
|
284
289
|
}
|
|
@@ -289,8 +294,8 @@ class StdioMCPWrapper {
|
|
|
289
294
|
console.error(`[Stdio Wrapper] Auto-selected provider: ${provider_id}`);
|
|
290
295
|
}
|
|
291
296
|
|
|
292
|
-
// Use
|
|
293
|
-
const gracefulTimeout = Math.min(timeout_ms,
|
|
297
|
+
// Use reasonable timeout for CLI responses (15 seconds instead of 5)
|
|
298
|
+
const gracefulTimeout = Math.min(timeout_ms, 15000);
|
|
294
299
|
|
|
295
300
|
// Start both operations concurrently for better performance
|
|
296
301
|
const [localResult, perspectivesResult] = await Promise.allSettled([
|
|
@@ -393,10 +398,14 @@ class StdioMCPWrapper {
|
|
|
393
398
|
const remoteResponse = await this.forwardToRemoteServer(perspectivesRequest);
|
|
394
399
|
|
|
395
400
|
if (remoteResponse.result && remoteResponse.result.content && remoteResponse.result.content[0]) {
|
|
401
|
+
// The remote response already contains formatted "Multiple AI Perspectives" content
|
|
402
|
+
// Return it as-is without additional formatting to avoid duplication
|
|
403
|
+
const rawContent = remoteResponse.result.content[0].text;
|
|
396
404
|
return {
|
|
397
405
|
success: true,
|
|
398
|
-
content:
|
|
399
|
-
timestamp: new Date().toISOString()
|
|
406
|
+
content: rawContent,
|
|
407
|
+
timestamp: new Date().toISOString(),
|
|
408
|
+
raw: true // Flag to indicate this is pre-formatted content
|
|
400
409
|
};
|
|
401
410
|
} else if (remoteResponse.error) {
|
|
402
411
|
return {
|
|
@@ -480,9 +489,16 @@ class StdioMCPWrapper {
|
|
|
480
489
|
}
|
|
481
490
|
|
|
482
491
|
if (perspectivesResult.success) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
492
|
+
if (perspectivesResult.raw) {
|
|
493
|
+
// Raw content is already formatted - use as-is without any additional title
|
|
494
|
+
// The remote server already includes proper headers like "Multiple AI Perspectives"
|
|
495
|
+
formatted += `${perspectivesResult.content}\n\n`;
|
|
496
|
+
} else {
|
|
497
|
+
// Legacy formatting for non-raw content (shouldn't be used with current server)
|
|
498
|
+
const title = isFallback ? '🧠 **Perspectives Fallback**' : '🧠 **Supplemental Multi-Model Perspectives**';
|
|
499
|
+
formatted += `${title}\n\n`;
|
|
500
|
+
formatted += `${perspectivesResult.content}\n\n`;
|
|
501
|
+
}
|
|
486
502
|
} else if (!isFallback) {
|
|
487
503
|
// Show remote error only if not in fallback mode
|
|
488
504
|
formatted += `❌ **Perspectives request failed**: ${perspectivesResult.error}\n\n`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polydev-ai",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Agentic workflow assistant with CLI integration - get diverse perspectives from multiple LLMs when stuck or need enhanced reasoning",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"next": "15.0.0",
|
|
62
62
|
"polydev-ai": "^1.2.0",
|
|
63
63
|
"posthog-js": "^1.157.2",
|
|
64
|
+
"prismjs": "^1.30.0",
|
|
64
65
|
"react": "^18.3.1",
|
|
65
66
|
"react-dom": "^18.3.1",
|
|
66
67
|
"resend": "^6.0.2",
|