polydev-ai 1.2.13 → 1.2.14
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/mcp/manifest.json +1 -1
- package/mcp/stdio-wrapper.js +36 -2
- package/package.json +1 -1
package/mcp/manifest.json
CHANGED
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -20,6 +20,10 @@ class StdioMCPWrapper {
|
|
|
20
20
|
|
|
21
21
|
// Smart refresh scheduler (will be started after initialization)
|
|
22
22
|
this.refreshScheduler = null;
|
|
23
|
+
|
|
24
|
+
// Track if initial CLI detection has been done
|
|
25
|
+
this.initialDetectionDone = false;
|
|
26
|
+
this.initialDetectionPromise = null;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
loadManifest() {
|
|
@@ -226,6 +230,10 @@ class StdioMCPWrapper {
|
|
|
226
230
|
// Update database with CLI status
|
|
227
231
|
await this.updateCliStatusInDatabase(results);
|
|
228
232
|
|
|
233
|
+
// Mark initial detection as done
|
|
234
|
+
this.initialDetectionDone = true;
|
|
235
|
+
this.initialDetectionPromise = null;
|
|
236
|
+
|
|
229
237
|
return {
|
|
230
238
|
success: true,
|
|
231
239
|
results,
|
|
@@ -236,6 +244,10 @@ class StdioMCPWrapper {
|
|
|
236
244
|
|
|
237
245
|
} catch (error) {
|
|
238
246
|
console.error('[Stdio Wrapper] Local CLI detection error:', error);
|
|
247
|
+
// Mark as done even on error to prevent blocking
|
|
248
|
+
this.initialDetectionDone = true;
|
|
249
|
+
this.initialDetectionPromise = null;
|
|
250
|
+
|
|
239
251
|
return {
|
|
240
252
|
success: false,
|
|
241
253
|
error: error.message,
|
|
@@ -297,6 +309,16 @@ class StdioMCPWrapper {
|
|
|
297
309
|
console.error(`[Stdio Wrapper] Local CLI prompt sending with perspectives`);
|
|
298
310
|
|
|
299
311
|
try {
|
|
312
|
+
// Ensure initial CLI detection has completed before sending prompts
|
|
313
|
+
if (!this.initialDetectionDone && this.initialDetectionPromise) {
|
|
314
|
+
console.error('[Stdio Wrapper] Waiting for initial CLI detection to complete...');
|
|
315
|
+
await this.initialDetectionPromise;
|
|
316
|
+
} else if (!this.initialDetectionDone && !this.initialDetectionPromise) {
|
|
317
|
+
console.error('[Stdio Wrapper] Running initial CLI detection before sending prompt...');
|
|
318
|
+
this.initialDetectionPromise = this.localForceCliDetection({});
|
|
319
|
+
await this.initialDetectionPromise;
|
|
320
|
+
}
|
|
321
|
+
|
|
300
322
|
let { provider_id, prompt, mode = 'args', timeout_ms = 30000 } = args;
|
|
301
323
|
|
|
302
324
|
// Ensure timeout_ms is valid (not undefined, null, Infinity, or negative)
|
|
@@ -380,7 +402,18 @@ class StdioMCPWrapper {
|
|
|
380
402
|
*/
|
|
381
403
|
async getAllAvailableProviders() {
|
|
382
404
|
try {
|
|
383
|
-
|
|
405
|
+
// Try to load from cache first to avoid re-detection
|
|
406
|
+
const cachedStatus = await this.loadLocalCliStatus();
|
|
407
|
+
let results;
|
|
408
|
+
|
|
409
|
+
if (cachedStatus && Object.keys(cachedStatus).length > 0) {
|
|
410
|
+
console.error('[Stdio Wrapper] Using cached CLI status');
|
|
411
|
+
results = cachedStatus;
|
|
412
|
+
} else {
|
|
413
|
+
console.error('[Stdio Wrapper] No cached status, running detection');
|
|
414
|
+
results = await this.cliManager.forceCliDetection();
|
|
415
|
+
}
|
|
416
|
+
|
|
384
417
|
const availableProviders = [];
|
|
385
418
|
|
|
386
419
|
// Priority order: claude_code > codex_cli > gemini_cli
|
|
@@ -913,7 +946,8 @@ class StdioMCPWrapper {
|
|
|
913
946
|
setTimeout(async () => {
|
|
914
947
|
console.error('[Stdio Wrapper] Running initial CLI detection...');
|
|
915
948
|
try {
|
|
916
|
-
|
|
949
|
+
this.initialDetectionPromise = this.localForceCliDetection({});
|
|
950
|
+
await this.initialDetectionPromise;
|
|
917
951
|
console.error('[Stdio Wrapper] Initial CLI detection completed');
|
|
918
952
|
} catch (error) {
|
|
919
953
|
console.error('[Stdio Wrapper] Initial CLI detection failed:', error);
|
package/package.json
CHANGED