agentgui 1.0.411 → 1.0.413

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/database.js CHANGED
@@ -939,34 +939,54 @@ export const queries = {
939
939
  return true;
940
940
  },
941
941
 
942
- deleteClaudeSessionFile(sessionId) {
943
- try {
944
- const claudeDir = path.join(os.homedir(), '.claude');
945
- const projectsDir = path.join(claudeDir, 'projects');
946
-
947
- if (!fs.existsSync(projectsDir)) {
948
- return false;
949
- }
950
-
951
- // Search for session file in all project directories
952
- const projects = fs.readdirSync(projectsDir);
953
- for (const project of projects) {
954
- const projectPath = path.join(projectsDir, project);
955
- const sessionFile = path.join(projectPath, `${sessionId}.jsonl`);
956
-
957
- if (fs.existsSync(sessionFile)) {
958
- fs.unlinkSync(sessionFile);
959
- console.log(`[deleteClaudeSessionFile] Deleted Claude session: ${sessionFile}`);
960
- return true;
961
- }
962
- }
963
-
964
- return false;
965
- } catch (err) {
966
- console.error(`[deleteClaudeSessionFile] Error deleting session ${sessionId}:`, err.message);
967
- return false;
968
- }
969
- },
942
+ deleteClaudeSessionFile(sessionId) {
943
+ try {
944
+ const claudeDir = path.join(os.homedir(), '.claude');
945
+ const projectsDir = path.join(claudeDir, 'projects');
946
+
947
+ if (!fs.existsSync(projectsDir)) {
948
+ return false;
949
+ }
950
+
951
+ // Search for session file in all project directories
952
+ const projects = fs.readdirSync(projectsDir);
953
+ for (const project of projects) {
954
+ const projectPath = path.join(projectsDir, project);
955
+ const sessionFile = path.join(projectPath, `${sessionId}.jsonl`);
956
+
957
+ if (fs.existsSync(sessionFile)) {
958
+ fs.unlinkSync(sessionFile);
959
+ console.log(`[deleteClaudeSessionFile] Deleted Claude session file: ${sessionFile}`);
960
+
961
+ // Also remove the entry from sessions-index.json if it exists
962
+ const indexPath = path.join(projectPath, 'sessions-index.json');
963
+ if (fs.existsSync(indexPath)) {
964
+ try {
965
+ const indexContent = fs.readFileSync(indexPath, 'utf8');
966
+ const index = JSON.parse(indexContent);
967
+ if (index.entries && Array.isArray(index.entries)) {
968
+ const originalLength = index.entries.length;
969
+ index.entries = index.entries.filter(entry => entry.sessionId !== sessionId);
970
+ if (index.entries.length < originalLength) {
971
+ fs.writeFileSync(indexPath, JSON.stringify(index, null, 2), { encoding: 'utf8' });
972
+ console.log(`[deleteClaudeSessionFile] Removed session ${sessionId} from sessions-index.json in ${projectPath}`);
973
+ }
974
+ }
975
+ } catch (indexErr) {
976
+ console.error(`[deleteClaudeSessionFile] Failed to update sessions-index.json in ${projectPath}:`, indexErr.message);
977
+ }
978
+ }
979
+
980
+ return true;
981
+ }
982
+ }
983
+
984
+ return false;
985
+ } catch (err) {
986
+ console.error(`[deleteClaudeSessionFile] Error deleting session ${sessionId}:`, err.message);
987
+ return false;
988
+ }
989
+ },
970
990
 
971
991
  cleanup() {
972
992
  const thirtyDaysAgo = Date.now() - (30 * 24 * 60 * 60 * 1000);
@@ -70,7 +70,7 @@ class ClientQueue {
70
70
  this.windowStart = now;
71
71
  this.rateLimitWarned = false;
72
72
  }
73
- const batch = [...this.highPriority.splice(0), ...this.normalPriority.splice(0, 10), ...this.lowPriority.splice(0, 5)];
73
+ const batch = [...this.highPriority.splice(0), ...this.normalPriority.splice(0), ...this.lowPriority.splice(0, 5)];
74
74
  if (batch.length === 0) return;
75
75
  const messagesThisSecond = this.messageCount + batch.length;
76
76
  if (messagesThisSecond > 100) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.411",
3
+ "version": "1.0.413",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/server.js CHANGED
@@ -504,10 +504,9 @@ async function getModelsForAgent(agentId) {
504
504
 
505
505
  if (agentId === 'claude-code') {
506
506
  const hardcodedModels = [
507
- { id: '', label: 'Default' },
507
+ { id: 'haiku', label: 'Haiku (Default)' },
508
508
  { id: 'sonnet', label: 'Sonnet' },
509
509
  { id: 'opus', label: 'Opus' },
510
- { id: 'haiku', label: 'Haiku' },
511
510
  ];
512
511
 
513
512
  const apiModels = await fetchClaudeModelsFromAPI();
@@ -568,6 +567,32 @@ async function getModelsForAgent(agentId) {
568
567
  }
569
568
  }
570
569
 
570
+ // Fallback default models for agents that fail to retrieve models
571
+ const fallbackModels = {
572
+ 'gemini': [
573
+ { id: 'gemini-1.5-pro', label: 'Gemini 1.5 Pro' },
574
+ { id: 'gemini-1.5-flash', label: 'Gemini 1.5 Flash' },
575
+ { id: 'gemini-2.0-pro', label: 'Gemini 2.0 Pro' },
576
+ { id: 'gemini-2.0-flash', label: 'Gemini 2.0 Flash' }
577
+ ],
578
+ 'opencode': [
579
+ { id: 'claude-sonnet-4-20250514', label: 'Claude Sonnet 4' },
580
+ { id: 'claude-haiku-4-20250514', label: 'Claude Haiku 4' },
581
+ { id: 'gpt-4-turbo', label: 'GPT-4 Turbo' },
582
+ { id: 'gemini-pro', label: 'Gemini Pro' }
583
+ ],
584
+ 'kilo': [
585
+ { id: 'claude-sonnet-4', label: 'Claude Sonnet 4' },
586
+ { id: 'gemini-2.0-flash', label: 'Gemini 2.0 Flash' },
587
+ { id: 'gpt-4', label: 'GPT-4' }
588
+ ]
589
+ };
590
+
591
+ if (fallbackModels[agentId]) {
592
+ modelCache.set(agentId, { models: fallbackModels[agentId], timestamp: Date.now() });
593
+ return fallbackModels[agentId];
594
+ }
595
+
571
596
  return [];
572
597
  }
573
598
 
@@ -13,7 +13,7 @@
13
13
  window.addEventListener('conversation-selected', function(e) {
14
14
  currentConversationId = e.detail.conversationId;
15
15
  hasTerminalContent = false;
16
- hideTerminalTab();
16
+ // Do not hide terminal tab; it should always be visible
17
17
  fetchConversationAndCheckScripts();
18
18
  });
19
19
 
@@ -61,10 +61,15 @@
61
61
  window.wsClient.rpc('conv.get', { id: currentConversationId })
62
62
  .then(function(data) {
63
63
  currentWorkingDirectory = data.conversation?.workingDirectory || null;
64
- if (currentWorkingDirectory) showTerminalTab();
64
+ // Always show the terminal tab, even without a working directory
65
+ showTerminalTab();
65
66
  checkScripts();
66
67
  })
67
- .catch(function() { checkScripts(); });
68
+ .catch(function() {
69
+ // Still show terminal tab on error
70
+ showTerminalTab();
71
+ checkScripts();
72
+ });
68
73
  }
69
74
 
70
75
  function checkScripts() {