agentgui 1.0.425 → 1.0.427

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.
@@ -69,7 +69,7 @@ async function acpFetch(port, path, body = null) {
69
69
  }
70
70
 
71
71
  export function register(router, deps) {
72
- const { db, discoveredAgents, getModelsForAgent, modelCache,
72
+ const { db, discoveredAgents, modelCache,
73
73
  getAgentDescriptor, activeScripts, broadcastSync, startGeminiOAuth,
74
74
  geminiOAuthState } = deps;
75
75
 
@@ -184,11 +184,7 @@ export function register(router, deps) {
184
184
  }
185
185
  } catch (_) {}
186
186
  }
187
- try {
188
- const models = await getModelsForAgent(p.id);
189
- modelCache.set(p.id, { models, ts: Date.now() });
190
- return { models };
191
- } catch { return { models: [] }; }
187
+ return { models: [] };
192
188
  });
193
189
 
194
190
  router.handle('agent.search', (p) => db.searchAgents(discoveredAgents, p.query || p));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.425",
3
+ "version": "1.0.427",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -437,12 +437,6 @@ initializeDescriptors(discoveredAgents);
437
437
 
438
438
  const modelCache = new Map();
439
439
 
440
- const AGENT_MODEL_COMMANDS = {
441
- 'gemini': 'gemini models',
442
- 'opencode': 'opencode models',
443
- 'kilo': 'kilo models',
444
- };
445
-
446
440
  function modelIdToLabel(id) {
447
441
  const base = id.replace(/^claude-/, '').replace(/-\d{8}$/, '');
448
442
  const m = base.match(/^(\w+)-(\d+)(?:-(\d+))?$/);
@@ -450,45 +444,6 @@ function modelIdToLabel(id) {
450
444
  return base.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
451
445
  }
452
446
 
453
- function extractModelsFromClaudeCLI() {
454
- try {
455
- const cliPath = path.resolve('./node_modules/@anthropic-ai/claude-code/cli.js');
456
- if (!fs.existsSync(cliPath)) return null;
457
- const src = fs.readFileSync(cliPath, 'utf8');
458
- const re = /=\{firstParty:"(claude-[^"]+)",bedrock:"[^"]+",vertex:"[^"]+"/g;
459
- const ids = new Set();
460
- let m;
461
- while ((m = re.exec(src)) !== null) ids.add(m[1]);
462
- if (ids.size === 0) return null;
463
-
464
- const models = [{ id: '', label: 'Default' }];
465
- const sorted = [...ids].sort((a, b) => {
466
- const va = a.replace(/claude-/, '').replace(/-\d{8}$/, '');
467
- const vb = b.replace(/claude-/, '').replace(/-\d{8}$/, '');
468
- return vb.localeCompare(va);
469
- });
470
-
471
- const latest = { haiku: null, sonnet: null, opus: null };
472
- for (const id of sorted) {
473
- if (id.startsWith('claude-3-')) continue;
474
- if (id.includes('haiku') && !latest.haiku) latest.haiku = id;
475
- if (id.includes('sonnet') && !latest.sonnet) latest.sonnet = id;
476
- if (id.includes('opus') && !latest.opus) latest.opus = id;
477
- }
478
-
479
- if (latest.opus) models.push({ id: latest.opus, label: 'Opus (Latest)' });
480
- if (latest.sonnet) models.push({ id: latest.sonnet, label: 'Sonnet (Latest)' });
481
- if (latest.haiku) models.push({ id: latest.haiku, label: 'Haiku (Latest)' });
482
-
483
- for (const id of sorted) {
484
- if (id.startsWith('claude-3-')) continue;
485
- models.push({ id, label: modelIdToLabel(id) });
486
- }
487
-
488
- return models;
489
- } catch { return null; }
490
- }
491
-
492
447
  async function fetchClaudeModelsFromAPI() {
493
448
  const apiKey = process.env.ANTHROPIC_API_KEY;
494
449
  if (!apiKey) return null;
@@ -573,56 +528,9 @@ async function getModelsForAgent(agentId) {
573
528
  models = await fetchGeminiModelsFromAPI();
574
529
  }
575
530
 
576
- if (models) {
577
- modelCache.set(agentId, { models, timestamp: Date.now() });
578
- return models;
579
- }
580
-
581
- if (AGENT_MODEL_COMMANDS[agentId]) {
582
- try {
583
- const result = execSync(AGENT_MODEL_COMMANDS[agentId], { encoding: 'utf-8', timeout: 15000 });
584
- const lines = result.split('\n').map(l => l.trim()).filter(Boolean);
585
- if (lines.length > 0) {
586
- models = [{ id: '', label: 'Default' }];
587
- for (const line of lines) {
588
- models.push({ id: line, label: line });
589
- }
590
- modelCache.set(agentId, { models, timestamp: Date.now() });
591
- return models;
592
- }
593
- } catch (_) {}
594
- }
595
-
596
- const { getRegisteredAgents } = await import('./lib/claude-runner.js');
597
- const agents = getRegisteredAgents();
598
- const agent = agents.find(a => a.id === agentId);
599
-
600
- if (agent && agent.command) {
601
- const modelCmd = `${agent.command} models`;
602
- try {
603
- const result = execSync(modelCmd, { encoding: 'utf-8', timeout: 15000 });
604
- const lines = result.split('\n').map(l => l.trim()).filter(Boolean);
605
- if (lines.length > 0) {
606
- models = [{ id: '', label: 'Default' }];
607
- for (const line of lines) {
608
- models.push({ id: line, label: line });
609
- }
610
- modelCache.set(agentId, { models, timestamp: Date.now() });
611
- return models;
612
- }
613
- } catch (_) {}
614
- }
615
-
616
- if (agentId === 'claude-code') {
617
- const cliModels = extractModelsFromClaudeCLI();
618
- if (cliModels) {
619
- modelCache.set(agentId, { models: cliModels, timestamp: Date.now() });
620
- return cliModels;
621
- }
622
- }
623
-
624
- modelCache.set(agentId, { models: [], timestamp: Date.now() });
625
- return [];
531
+ const result = models || [];
532
+ modelCache.set(agentId, { models: result, timestamp: Date.now() });
533
+ return result;
626
534
  }
627
535
 
628
536
  const GEMINI_SCOPES = [
@@ -3266,6 +3174,7 @@ function serveFile(filePath, res, req) {
3266
3174
  let content = data.toString();
3267
3175
  const baseTag = `<script>window.__BASE_URL='${BASE_URL}';</script>`;
3268
3176
  content = content.replace('<head>', '<head>\n ' + baseTag);
3177
+ content = content.replace(/(href|src)="vendor\//g, `$1="${BASE_URL}/vendor/`);
3269
3178
  if (watch) {
3270
3179
  content += `\n<script>(function(){const ws=new WebSocket((location.protocol==='https:'?'wss://':'ws://')+location.host+'${BASE_URL}/hot-reload');ws.onmessage=e=>{if(JSON.parse(e.data).type==='reload')location.reload()};})();</script>`;
3271
3180
  }
@@ -1911,8 +1911,8 @@ class AgentGUIClient {
1911
1911
  }
1912
1912
  try {
1913
1913
  const { models } = await window.wsClient.rpc('agent.models', { id: agentId });
1914
- this._modelCache.set(agentId, models || []);
1915
- this._populateModelSelector(models || []);
1914
+ this._modelCache.set(agentId, models);
1915
+ this._populateModelSelector(models);
1916
1916
  } catch (error) {
1917
1917
  console.error('Failed to load models:', error);
1918
1918
  this._populateModelSelector([]);