agentgui 1.0.430 → 1.0.432

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.430",
3
+ "version": "1.0.432",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -442,87 +442,8 @@ function modelIdToLabel(id) {
442
442
  return base.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
443
443
  }
444
444
 
445
- async function fetchClaudeModelsFromAPI() {
446
- const apiKey = process.env.ANTHROPIC_API_KEY;
447
- if (!apiKey) return null;
448
- try {
449
- const https = await import('https');
450
- return new Promise((resolve) => {
451
- const req = https.default.request({
452
- hostname: 'api.anthropic.com', path: '/v1/models', method: 'GET',
453
- headers: { 'x-api-key': apiKey, 'anthropic-version': '2023-06-01' },
454
- timeout: 8000
455
- }, (res) => {
456
- let body = '';
457
- res.on('data', d => body += d);
458
- res.on('end', () => {
459
- try {
460
- const data = JSON.parse(body);
461
- const items = (data.data || []).filter(m => m.id && m.id.startsWith('claude-'));
462
- if (items.length === 0) return resolve(null);
463
- const models = items.map(m => ({ id: m.id, label: m.display_name || modelIdToLabel(m.id) }));
464
- resolve(models);
465
- } catch { resolve(null); }
466
- });
467
- });
468
- req.on('error', () => resolve(null));
469
- req.on('timeout', () => { req.destroy(); resolve(null); });
470
- req.end();
471
- });
472
- } catch { return null; }
473
- }
474
-
475
- async function fetchGeminiModelsFromAPI() {
476
- const apiKey = process.env.GOOGLE_GENAI_API_KEY;
477
- if (!apiKey) return null;
478
- try {
479
- const https = await import('https');
480
- return new Promise((resolve) => {
481
- const req = https.default.request({
482
- hostname: 'generativelanguage.googleapis.com',
483
- path: '/v1beta/models?key=' + apiKey,
484
- method: 'GET',
485
- timeout: 8000
486
- }, (res) => {
487
- let body = '';
488
- res.on('data', d => body += d);
489
- res.on('end', () => {
490
- try {
491
- const data = JSON.parse(body);
492
- const items = (data.models || []).filter(m => m.name && m.name.includes('gemini'));
493
- if (items.length === 0) return resolve(null);
494
- const models = items.map(m => {
495
- const modelId = m.name.replace(/^models\//, '');
496
- return { id: modelId, label: modelId.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase()) };
497
- });
498
- resolve(models);
499
- } catch { resolve(null); }
500
- });
501
- });
502
- req.on('error', () => resolve(null));
503
- req.on('timeout', () => { req.destroy(); resolve(null); });
504
- req.end();
505
- });
506
- } catch { return null; }
507
- }
508
-
509
- async function getModelsForAgent(agentId) {
510
- const cached = modelCache.get(agentId);
511
- if (cached && Date.now() - cached.timestamp < 3600000) {
512
- return cached.models;
513
- }
514
-
515
- let models = null;
516
-
517
- if (agentId === 'claude-code') {
518
- models = await fetchClaudeModelsFromAPI();
519
- } else if (agentId === 'gemini') {
520
- models = await fetchGeminiModelsFromAPI();
521
- }
522
-
523
- const result = models || [];
524
- modelCache.set(agentId, { models: result, timestamp: Date.now() });
525
- return result;
445
+ async function getModelsForAgent() {
446
+ return [];
526
447
  }
527
448
 
528
449
  const GEMINI_SCOPES = [
@@ -978,21 +899,24 @@ function acceptsEncoding(req, encoding) {
978
899
 
979
900
  function compressAndSend(req, res, statusCode, contentType, body) {
980
901
  const raw = typeof body === 'string' ? Buffer.from(body) : body;
902
+ const isHtml = contentType && contentType.includes('text/html');
903
+ const baseHeaders = { 'Content-Type': contentType };
904
+ if (isHtml) baseHeaders['Cache-Control'] = 'no-store';
981
905
  if (raw.length < 860) {
982
- res.writeHead(statusCode, { 'Content-Type': contentType, 'Content-Length': raw.length });
906
+ res.writeHead(statusCode, { ...baseHeaders, 'Content-Length': raw.length });
983
907
  res.end(raw);
984
908
  return;
985
909
  }
986
910
  if (acceptsEncoding(req, 'br')) {
987
911
  const compressed = zlib.brotliCompressSync(raw, { params: { [zlib.constants.BROTLI_PARAM_QUALITY]: 4 } });
988
- res.writeHead(statusCode, { 'Content-Type': contentType, 'Content-Encoding': 'br', 'Content-Length': compressed.length });
912
+ res.writeHead(statusCode, { ...baseHeaders, 'Content-Encoding': 'br', 'Content-Length': compressed.length });
989
913
  res.end(compressed);
990
914
  } else if (acceptsEncoding(req, 'gzip')) {
991
915
  const compressed = zlib.gzipSync(raw, { level: 6 });
992
- res.writeHead(statusCode, { 'Content-Type': contentType, 'Content-Encoding': 'gzip', 'Content-Length': compressed.length });
916
+ res.writeHead(statusCode, { ...baseHeaders, 'Content-Encoding': 'gzip', 'Content-Length': compressed.length });
993
917
  res.end(compressed);
994
918
  } else {
995
- res.writeHead(statusCode, { 'Content-Type': contentType, 'Content-Length': raw.length });
919
+ res.writeHead(statusCode, { ...baseHeaders, 'Content-Length': raw.length });
996
920
  res.end(raw);
997
921
  }
998
922
  }
package/static/index.html CHANGED
@@ -9,14 +9,17 @@
9
9
 
10
10
 
11
11
 
12
- <link href="vendor/rippleui.css" rel="stylesheet">
13
- <link rel="preload" href="vendor/prism-dark.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
14
- <noscript><link href="vendor/prism-dark.css" rel="stylesheet"></noscript>
15
- <link rel="preload" href="vendor/highlight-js.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
16
- <script defer src="vendor/highlight.min.js"></script>
17
- <link rel="stylesheet" href="vendor/xterm.css">
18
- <script defer src="vendor/xterm.min.js"></script>
19
- <script defer src="vendor/xterm-addon-fit.min.js"></script>
12
+ <script>
13
+ (function(){
14
+ var b=(window.__BASE_URL||'');
15
+ ['vendor/rippleui.css','vendor/prism-dark.css','vendor/highlight-js.css','vendor/xterm.css'].forEach(function(h){
16
+ var l=document.createElement('link');l.rel='stylesheet';l.href=b+'/'+h;document.head.appendChild(l);
17
+ });
18
+ ['vendor/highlight.min.js','vendor/xterm.min.js','vendor/xterm-addon-fit.min.js'].forEach(function(s){
19
+ var e=document.createElement('script');e.defer=true;e.src=b+'/'+s;document.head.appendChild(e);
20
+ });
21
+ })();
22
+ </script>
20
23
 
21
24
  <style>
22
25
  *, *::before, *::after { box-sizing: border-box; }