polydev-ai 1.8.97 → 1.9.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/mcp/server.js CHANGED
@@ -400,7 +400,7 @@ class MCPServer {
400
400
  mcp_tools: 'https://polydev.ai/dashboard/mcp-tools',
401
401
  documentation: 'https://polydev.ai/docs/mcp-integration'
402
402
  },
403
- available_models: ['GLM-4.7', 'Gemini 3 Flash', 'Grok 4.1 Fast Reasoning', 'GPT-5 Mini'],
403
+ available_models: ['GPT-5.2', 'Claude Opus 4.5', 'Gemini 3 Pro', 'Grok 4.1'],
404
404
  pricing: {
405
405
  free_tier: '500 credits/month (no credit card required)',
406
406
  premium_tier: '$10/month for 10,000 credits',
@@ -432,7 +432,7 @@ class MCPServer {
432
432
  credits_used_today: data.credits_used_today || 0,
433
433
  subscription_tier: data.subscription_tier || 'Free',
434
434
  token_expires_at: data.token_expires_at,
435
- enabled_models: data.enabled_models || ['GLM-4.7', 'Gemini 3 Flash', 'Grok 4.1 Fast Reasoning', 'GPT-5 Mini'],
435
+ enabled_models: data.enabled_models || ['GPT-5.2', 'Claude Opus 4.5', 'Gemini 3 Pro', 'Grok 4.1'],
436
436
  cli_subscriptions: data.cli_subscriptions || [],
437
437
  quick_links: {
438
438
  dashboard: 'https://polydev.ai/dashboard',
@@ -371,7 +371,16 @@ class StdioMCPWrapper {
371
371
  result: {
372
372
  content: [{
373
373
  type: 'text',
374
- text: `Authentication required.\n\nTo login, either:\n1. Use the "login" tool (opens browser)\n2. Run in terminal: npx polydev-ai\n\nAfter login, restart your IDE.`
374
+ text: `POLYDEV STATUS
375
+ ==============
376
+
377
+ Authentication: Not connected
378
+
379
+ To login:
380
+ 1. Use the "login" tool (opens browser)
381
+ 2. Or run: npx polydev-ai
382
+
383
+ Token will be saved automatically after login.`
375
384
  }],
376
385
  isError: true
377
386
  }
@@ -429,16 +438,14 @@ class StdioMCPWrapper {
429
438
  result: {
430
439
  content: [{
431
440
  type: 'text',
432
- text: `╭─────────────────────────────────────────╮
433
- │ ALREADY AUTHENTICATED ✓ │
434
- ╰─────────────────────────────────────────╯
441
+ text: `ALREADY AUTHENTICATED
442
+ =====================
435
443
 
436
- 🔐 Your token is configured and ready.
444
+ Your token is configured and ready.
437
445
 
438
- 🤖 Available commands:
439
- /polydev:ask - Query multiple AI models
440
- /polydev:auth - Check status & credits
441
- • get_perspectives - Direct tool call
446
+ Available commands:
447
+ /polydev:ask Query multiple AI models
448
+ /polydev:auth Check status & credits
442
449
 
443
450
  To re-login: npx polydev-ai`
444
451
  }]
@@ -498,19 +505,20 @@ To re-login: npx polydev-ai`
498
505
  result: {
499
506
  content: [{
500
507
  type: 'text',
501
- text: `╭─────────────────────────────────────────╮
502
- │ BROWSER OPENED FOR LOGIN 🌐 │
503
- ╰─────────────────────────────────────────╯
508
+ text: `LOGIN SUCCESSFUL
509
+ ================
504
510
 
505
- 📱 Complete authentication in your browser.
511
+ Token saved to:
512
+ ~/.polydev.env
513
+ ~/.zshrc
506
514
 
507
- After login:
508
- • Token will be saved automatically
509
- • You can safely reconnect MCP or restart IDE
510
- • Use /polydev:auth to check status
515
+ IMPORTANT: Restart your IDE to activate.
511
516
 
512
- Polling for authentication completion...
513
- (Session expires in 10 minutes)`
517
+ After restart, you can:
518
+ /polydev:ask Query multiple AI models
519
+ /polydev:auth Check status & credits
520
+
521
+ Dashboard: https://polydev.ai/dashboard`
514
522
  }]
515
523
  }
516
524
  };
@@ -560,7 +568,7 @@ After login:
560
568
  this.isAuthenticated = true;
561
569
  this._freshLogin = true;
562
570
 
563
- console.error('[Polydev] Login successful! Token saved.');
571
+ console.error('[Polydev] Login successful! Token saved.');
564
572
  console.error('[Polydev] You can now use Polydev tools.');
565
573
  console.error('[Polydev] No restart required - token is active immediately.');
566
574
  return; // Stop polling
@@ -617,25 +625,24 @@ After login:
617
625
  result: {
618
626
  content: [{
619
627
  type: 'text',
620
- text: `╭─────────────────────────────────────────╮
621
- │ POLYDEV STATUS │
622
- ╰─────────────────────────────────────────╯
628
+ text: `POLYDEV STATUS
629
+ ==============
623
630
 
624
- 🔐 Authentication: Not logged in
631
+ Authentication: Not connected
625
632
 
626
633
  To login:
627
634
  1. Use the "login" tool (opens browser)
628
635
  2. Or run: npx polydev-ai
629
636
 
630
- After login, restart your IDE.`
637
+ Token will be saved automatically after login.`
631
638
  }]
632
639
  }
633
640
  };
634
641
  }
635
642
 
636
643
  try {
637
- // Fetch account status from simple REST endpoint (not JSON-RPC)
638
- const [accountResponse, cliStatus] = await Promise.all([
644
+ // Fetch account status and model preferences in parallel
645
+ const [accountResponse, modelPrefsResponse, cliStatus] = await Promise.all([
639
646
  fetch('https://www.polydev.ai/api/auth/status', {
640
647
  method: 'POST',
641
648
  headers: {
@@ -644,6 +651,13 @@ After login, restart your IDE.`
644
651
  'User-Agent': 'polydev-stdio-wrapper/1.0.0'
645
652
  }
646
653
  }),
654
+ fetch('https://www.polydev.ai/api/model-preferences', {
655
+ method: 'GET',
656
+ headers: {
657
+ 'Authorization': `Bearer ${this.userToken}`,
658
+ 'User-Agent': 'polydev-stdio-wrapper/1.0.0'
659
+ }
660
+ }).catch(() => null),
647
661
  this.cliManager?.getCliStatus?.() || null
648
662
  ]);
649
663
 
@@ -654,47 +668,61 @@ After login, restart your IDE.`
654
668
  const tier = data.subscription_tier || 'Free';
655
669
  const email = data.email || 'Connected';
656
670
 
657
- // Build CLI status string
658
- let cliSection = '';
659
- if (cliStatus) {
660
- const cliLines = [];
661
- if (cliStatus.claude_code) cliLines.push(` ${cliStatus.claude_code.available ? '✓' : '✗'} Claude Code ${cliStatus.claude_code.available ? '(ready)' : '(not found)'}`);
662
- if (cliStatus.codex_cli) cliLines.push(` ${cliStatus.codex_cli.available ? '✓' : '✗'} Codex CLI ${cliStatus.codex_cli.available ? '(ready)' : '(not found)'}`);
663
- if (cliStatus.gemini_cli) cliLines.push(` ${cliStatus.gemini_cli.available ? '✓' : '✗'} Gemini CLI ${cliStatus.gemini_cli.available ? '(ready)' : '(not found)'}`);
664
- if (cliLines.length > 0) {
665
- cliSection = `\n🖥️ Local CLI Tools:\n${cliLines.join('\n')}`;
671
+ // Parse model preferences
672
+ let modelPrefs = null;
673
+ if (modelPrefsResponse?.ok) {
674
+ try {
675
+ modelPrefs = await modelPrefsResponse.json();
676
+ } catch (e) {
677
+ // Ignore parse errors
666
678
  }
667
679
  }
668
680
 
681
+ // Build configured perspectives section
682
+ let perspectivesSection = '\nConfigured Perspectives:';
683
+ if (modelPrefs?.allProviders && modelPrefs.allProviders.length > 0) {
684
+ const perspectiveCount = modelPrefs.perspectivesPerMessage || modelPrefs.allProviders.length;
685
+ perspectivesSection += ` (${perspectiveCount} active)`;
686
+
687
+ // Show providers in order with their selected models
688
+ for (let i = 0; i < modelPrefs.allProviders.length; i++) {
689
+ const p = modelPrefs.allProviders[i];
690
+ const providerName = p.provider.charAt(0).toUpperCase() + p.provider.slice(1);
691
+ const source = p.cliId ? 'CLI' : (p.tier ? `Credits/${p.tier}` : 'API');
692
+ perspectivesSection += `\n ${i + 1}. ${providerName.padEnd(12)} ${p.model} [${source}]`;
693
+ }
694
+ } else {
695
+ perspectivesSection += '\n (none configured - using defaults)';
696
+ }
697
+
698
+ // Build CLI status section
699
+ let cliSection = '\nLocal CLI Tools:';
700
+ if (cliStatus) {
701
+ cliSection += `\n Claude Code ${cliStatus.claude_code?.available ? '[connected]' : '[not found]'}${cliStatus.claude_code?.version ? ' ' + cliStatus.claude_code.version : ''}`;
702
+ cliSection += `\n Codex CLI ${cliStatus.codex_cli?.available ? '[connected]' : '[not found]'}${cliStatus.codex_cli?.version ? ' ' + cliStatus.codex_cli.version : ''}`;
703
+ cliSection += `\n Gemini CLI ${cliStatus.gemini_cli?.available ? '[connected]' : '[not found]'}${cliStatus.gemini_cli?.version ? ' ' + cliStatus.gemini_cli.version : ''}`;
704
+ } else {
705
+ cliSection += '\n (detecting...)';
706
+ }
707
+
669
708
  return {
670
709
  jsonrpc: '2.0',
671
710
  id,
672
711
  result: {
673
712
  content: [{
674
713
  type: 'text',
675
- text: `╭─────────────────────────────────────────╮
676
- │ POLYDEV STATUS │
677
- ╰─────────────────────────────────────────╯
678
-
679
- 🔐 Authentication: ✓ Logged in
680
- 👤 Account: ${email}
681
- 💰 Credits: ${credits}
682
- 📨 Messages: ${messages}
683
- ⭐ Tier: ${tier}
714
+ text: `POLYDEV STATUS
715
+ ==============
716
+
717
+ Authentication: Connected
718
+ Account: ${email}
719
+ Credits: ${credits}
720
+ Messages: ${messages}
721
+ Tier: ${tier}
722
+ ${perspectivesSection}
684
723
  ${cliSection}
685
724
 
686
- 🤖 Available Models:
687
- • GPT-5.2 (OpenAI)
688
- • Claude Opus 4.5 (Anthropic)
689
- • Gemini 3 Pro (Google)
690
- • Grok 4.1 (xAI)
691
-
692
- 🛠️ Tools:
693
- • get_perspectives - Query multiple AI models
694
- • get_cli_status - Check local CLI tools
695
- • send_cli_prompt - Use local CLIs
696
-
697
- 📊 Dashboard: https://polydev.ai/dashboard`
725
+ Configure: https://polydev.ai/dashboard/models`
698
726
  }]
699
727
  }
700
728
  };
@@ -705,11 +733,10 @@ ${cliSection}
705
733
  result: {
706
734
  content: [{
707
735
  type: 'text',
708
- text: `╭─────────────────────────────────────────╮
709
- │ POLYDEV STATUS │
710
- ╰─────────────────────────────────────────╯
736
+ text: `POLYDEV STATUS
737
+ ==============
711
738
 
712
- ⚠️ Token invalid or expired.
739
+ Token invalid or expired.
713
740
 
714
741
  Please re-login:
715
742
  1. Use the "login" tool
@@ -726,11 +753,10 @@ Please re-login:
726
753
  result: {
727
754
  content: [{
728
755
  type: 'text',
729
- text: `╭─────────────────────────────────────────╮
730
- │ POLYDEV STATUS │
731
- ╰─────────────────────────────────────────╯
756
+ text: `POLYDEV STATUS
757
+ ==============
732
758
 
733
- ⚠️ Could not verify status (offline?)
759
+ Could not verify status (offline?)
734
760
 
735
761
  Error: ${error.message}`
736
762
  }],
@@ -1069,7 +1095,7 @@ Error: ${error.message}`
1069
1095
  </a>
1070
1096
  <button onclick="window.close()" class="secondary-btn">Close Window</button>
1071
1097
 
1072
- <p class="note">✓ Token saved. Restart your IDE to activate.</p>
1098
+ <p class="note">Token saved. Restart your IDE to activate.</p>
1073
1099
  <div class="countdown" id="countdown">
1074
1100
  <div class="countdown-spinner"></div>
1075
1101
  <span>Closing in <strong id="seconds">5</strong>s...</span>
@@ -1930,16 +1956,16 @@ Error: ${error.message}`
1930
1956
  const modelDisplay = cliResult.model_used && cliResult.model_used !== 'cli_default' && cliResult.model_used !== 'cli_default_fallback'
1931
1957
  ? cliResult.model_used
1932
1958
  : cliResult.provider_id;
1933
- formatted += `🟢 **Local CLI Response** (${modelDisplay})\n\n`;
1959
+ formatted += `Local CLI Response (${modelDisplay})\n\n`;
1934
1960
  formatted += `${cleanCliResponse(cliResult.content)}\n\n`;
1935
- formatted += `*Latency: ${cliResult.latency_ms || 0}ms | Tokens: ${cliResult.tokens_used || 0}*\n\n`;
1961
+ formatted += `Latency: ${cliResult.latency_ms || 0}ms | Tokens: ${cliResult.tokens_used || 0}\n\n`;
1936
1962
  formatted += `---\n\n`;
1937
1963
  }
1938
1964
  }
1939
1965
 
1940
1966
  if (failedClis.length > 0 && successfulClis.length === 0) {
1941
1967
  // All local CLIs failed
1942
- formatted += `⚠️ **All Local CLIs Unavailable**\n`;
1968
+ formatted += `[Warning] All Local CLIs Unavailable\n`;
1943
1969
  for (const cliResult of failedClis) {
1944
1970
  formatted += `- ${cliResult.provider_id}: ${cliResult.error}\n`;
1945
1971
  }
@@ -1947,7 +1973,7 @@ Error: ${error.message}`
1947
1973
  formatted += `---\n\n`;
1948
1974
  } else if (failedClis.length > 0) {
1949
1975
  // Some CLIs failed, some succeeded
1950
- formatted += `⚠️ **Some CLIs Failed**\n`;
1976
+ formatted += `[Warning] Some CLIs Failed\n`;
1951
1977
  for (const cliResult of failedClis) {
1952
1978
  formatted += `- ${cliResult.provider_id}: ${cliResult.error}\n`;
1953
1979
  }
@@ -1961,13 +1987,13 @@ Error: ${error.message}`
1961
1987
  formatted += `${safePersp.content}\n\n`;
1962
1988
  } else {
1963
1989
  // Legacy formatting
1964
- const title = (successfulClis.length === 0) ? '🧠 **Perspectives Fallback**' : '🧠 **Supplemental Multi-Model Perspectives**';
1990
+ const title = (successfulClis.length === 0) ? 'Perspectives Fallback' : 'Supplemental Multi-Model Perspectives';
1965
1991
  formatted += `${title}\n\n`;
1966
1992
  formatted += `${safePersp.content}\n\n`;
1967
1993
  }
1968
1994
  } else if (successfulClis.length > 0) {
1969
1995
  // Show remote error only if we have local success
1970
- formatted += `❌ **Perspectives request failed**: ${safePersp.error || 'Unknown error'}\n\n`;
1996
+ formatted += `❌ Perspectives request failed: ${safePersp.error || 'Unknown error'}\n\n`;
1971
1997
  }
1972
1998
 
1973
1999
  return formatted.trim();
@@ -2193,31 +2219,15 @@ Error: ${error.message}`
2193
2219
  fs.mkdirSync(polydevevDir, { recursive: true });
2194
2220
  }
2195
2221
 
2196
- // Load existing usage data
2197
- let usageData = [];
2198
- if (fs.existsSync(usageFile)) {
2199
- try {
2200
- usageData = JSON.parse(fs.readFileSync(usageFile, 'utf8'));
2201
- } catch (parseError) {
2202
- console.error('[Stdio Wrapper] Failed to parse existing usage file, starting fresh:', parseError);
2203
- usageData = [];
2204
- }
2205
- }
2206
-
2207
2222
  // Add new usage record
2208
- usageData.push({
2223
+ const usageData = {
2209
2224
  timestamp: new Date().toISOString(),
2210
2225
  provider: providerId,
2211
2226
  prompt_length: prompt.length,
2212
2227
  success: response.success,
2213
2228
  latency_ms: response.latency_ms || response.latencyMs || 0,
2214
2229
  tokens_used: response.tokens_used || response.tokensUsed || 0
2215
- });
2216
-
2217
- // Keep only last 1000 records
2218
- if (usageData.length > 1000) {
2219
- usageData = usageData.slice(-1000);
2220
- }
2230
+ };
2221
2231
 
2222
2232
  fs.writeFileSync(usageFile, JSON.stringify(usageData, null, 2));
2223
2233
  console.error(`[Stdio Wrapper] Usage recorded locally`);
@@ -2246,28 +2256,28 @@ Error: ${error.message}`
2246
2256
  const cliCount = result.local_cli_count || 1;
2247
2257
 
2248
2258
  if (cliCount > 1) {
2249
- return `✅ **Multi-CLI Response** (${cliCount} local CLIs + perspectives)\n\n${result.content}\n\n*Total Latency: ${result.latency_ms || 0}ms | Total Tokens: ${result.tokens_used || 0} | ${result.timestamp}*`;
2259
+ return `Multi-CLI Response (${cliCount} local CLIs + perspectives)\n\n${result.content}\n\nTotal Latency: ${result.latency_ms || 0}ms | Total Tokens: ${result.tokens_used || 0} | ${result.timestamp}`;
2250
2260
  } else {
2251
- return `✅ **CLI Response** (${result.provider || 'Unknown'} - ${result.mode || 'unknown'} mode)\n\n${result.content}\n\n*Latency: ${result.latency_ms || 0}ms | Tokens: ${result.tokens_used || 0} | ${result.timestamp}*`;
2261
+ return `CLI Response (${result.provider || 'Unknown'} - ${result.mode || 'unknown'} mode)\n\n${result.content}\n\nLatency: ${result.latency_ms || 0}ms | Tokens: ${result.tokens_used || 0} | ${result.timestamp}`;
2252
2262
  }
2253
2263
  } else {
2254
2264
  // Status/detection response
2255
- let formatted = `✅ **CLI Operation Success**\n\n`;
2265
+ let formatted = `CLI Operation Success\n\n`;
2256
2266
  formatted += `${result.message}\n\n`;
2257
2267
 
2258
2268
  if (result.results) {
2259
- formatted += `**Results:**\n`;
2269
+ formatted += `Results:\n`;
2260
2270
  for (const [providerId, status] of Object.entries(result.results)) {
2261
- const icon = status.available ? '🟢' : '🔴';
2262
- const authIcon = status.authenticated ? '🔐' : '🔓';
2263
- formatted += `- ${icon} ${authIcon} **${providerId}**: ${status.available ? 'Available' : 'Not Available'}`;
2271
+ const icon = status.available ? '[+]' : '[-]';
2272
+ const authStatus = status.authenticated ? '[auth]' : '[no-auth]';
2273
+ formatted += `- ${icon} ${authStatus} ${providerId}: ${status.available ? 'Available' : 'Not Available'}`;
2264
2274
  if (status.version) formatted += ` (${status.version})`;
2265
2275
  if (status.error) formatted += ` - ${status.error}`;
2266
2276
  formatted += `\n`;
2267
2277
  }
2268
2278
  }
2269
2279
 
2270
- formatted += `\n*${result.local_only ? 'Local execution' : 'Remote execution'} | ${result.timestamp}*`;
2280
+ formatted += `\n${result.local_only ? 'Local execution' : 'Remote execution'} | ${result.timestamp}`;
2271
2281
  return formatted;
2272
2282
  }
2273
2283
  }
@@ -2324,7 +2334,7 @@ Error: ${error.message}`
2324
2334
  ? result.providerOrder
2325
2335
  : ['claude_code', 'codex_cli', 'gemini_cli'];
2326
2336
 
2327
- // NEW: Cache full list of all providers (CLI + API-only) from dashboard
2337
+ // NEW: Cache full list of all providers (CLI + API-only providers) from dashboard
2328
2338
  // Format: [{ provider: 'openai', model: 'gpt-52-codex', cliId: 'codex_cli' }, { provider: 'x-ai', model: 'grok-4', cliId: null }, ...]
2329
2339
  this.allProviders = result.allProviders || [];
2330
2340
 
@@ -2533,22 +2543,20 @@ Error: ${error.message}`
2533
2543
  result: {
2534
2544
  content: [{
2535
2545
  type: 'text',
2536
- text: `╭─────────────────────────────────────────╮
2537
- │ LOGIN SUCCESSFUL! ✓ │
2538
- ╰─────────────────────────────────────────╯
2546
+ text: `LOGIN SUCCESSFUL
2547
+ ================
2539
2548
 
2540
- 🔐 Token saved to:
2541
- ~/.polydev.env
2542
- ~/.zshrc
2549
+ Token saved to:
2550
+ ~/.polydev.env
2551
+ ~/.zshrc
2543
2552
 
2544
- ⚠️ IMPORTANT: Restart your IDE to activate.
2553
+ IMPORTANT: Restart your IDE to activate.
2545
2554
 
2546
- 🤖 After restart, you can:
2547
- • Use /polydev:ask to query multiple AI models
2548
- • Use /polydev:auth to check status & credits
2549
- • Use get_perspectives tool directly
2555
+ After restart, you can:
2556
+ /polydev:ask Query multiple AI models
2557
+ /polydev:auth Check status & credits
2550
2558
 
2551
- 📊 Dashboard: https://polydev.ai/dashboard`
2559
+ Dashboard: https://polydev.ai/dashboard`
2552
2560
  }]
2553
2561
  }
2554
2562
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polydev-ai",
3
- "version": "1.8.97",
3
+ "version": "1.9.0",
4
4
  "engines": {
5
5
  "node": ">=20.x <=22.x"
6
6
  },