agentgui 1.0.415 → 1.0.416

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.415",
3
+ "version": "1.0.416",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/static/index.html CHANGED
@@ -818,15 +818,9 @@
818
818
  max-width: 200px;
819
819
  }
820
820
 
821
- .cli-agent-selector {
822
- /* CLI agents have a different background color */
823
- background-color: var(--color-bg-secondary);
824
- }
821
+
825
822
 
826
- .acp-agent-selector {
827
- /* ACP agents have a different background color */
828
- background-color: var(--color-bg-secondary);
829
- }
823
+
830
824
 
831
825
  .agent-selector:disabled, .model-selector:disabled {
832
826
  opacity: 0.5;
@@ -3179,8 +3173,7 @@
3179
3173
  <!-- Input area: fixed at bottom -->
3180
3174
  <div class="input-section">
3181
3175
  <div class="input-wrapper">
3182
- <select class="agent-selector cli-agent-selector" data-cli-agent-selector title="Select CLI agent"></select>
3183
- <select class="agent-selector acp-agent-selector" data-acp-agent-selector title="Select ACP agent"></select>
3176
+ <select class="agent-selector" data-agent-selector title="Select agent"></select>
3184
3177
  <select class="model-selector" data-model-selector title="Select model" data-empty="true"></select>
3185
3178
  <textarea
3186
3179
  class="message-textarea"
@@ -341,50 +341,31 @@ class AgentGUIClient {
341
341
  });
342
342
  }
343
343
 
344
- /**
345
- * Setup UI elements
346
- */
347
- setupUI() {
348
- const container = document.getElementById(this.config.containerId);
349
- if (!container) {
350
- throw new Error(`Container not found: ${this.config.containerId}`);
351
- }
352
-
353
- // Get references to key UI elements
354
- this.ui.statusIndicator = document.querySelector('[data-status-indicator]');
355
- this.ui.messageInput = document.querySelector('[data-message-input]');
356
- this.ui.sendButton = document.querySelector('[data-send-button]');
357
- this.ui.cliAgentSelector = document.querySelector('[data-cli-agent-selector]');
358
- this.ui.acpAgentSelector = document.querySelector('[data-acp-agent-selector]');
359
- this.ui.modelSelector = document.querySelector('[data-model-selector]');
360
-
361
- if (this.ui.cliAgentSelector) {
362
- this.ui.cliAgentSelector.addEventListener('change', () => {
363
- if (!this._agentLocked) {
364
- this.loadModelsForAgent(this.ui.cliAgentSelector.value);
365
- this.saveAgentAndModelToConversation();
366
- // Hide ACP selector when CLI is selected
367
- if (this.ui.acpAgentSelector) {
368
- this.ui.acpAgentSelector.value = '';
369
- this.ui.acpAgentSelector.style.display = 'none';
370
- }
371
- }
372
- });
373
- }
374
-
375
- if (this.ui.acpAgentSelector) {
376
- this.ui.acpAgentSelector.addEventListener('change', () => {
377
- if (!this._agentLocked) {
378
- this.loadModelsForAgent(this.ui.acpAgentSelector.value);
379
- this.saveAgentAndModelToConversation();
380
- // Hide CLI selector when ACP is selected
381
- if (this.ui.cliAgentSelector) {
382
- this.ui.cliAgentSelector.value = '';
383
- this.ui.cliAgentSelector.style.display = 'none';
384
- }
385
- }
386
- });
387
- }
344
+ /**
345
+ * Setup UI elements
346
+ */
347
+ setupUI() {
348
+ const container = document.getElementById(this.config.containerId);
349
+ if (!container) {
350
+ throw new Error(`Container not found: ${this.config.containerId}`);
351
+ }
352
+
353
+ // Get references to key UI elements
354
+ this.ui.statusIndicator = document.querySelector('[data-status-indicator]');
355
+ this.ui.messageInput = document.querySelector('[data-message-input]');
356
+ this.ui.sendButton = document.querySelector('[data-send-button]');
357
+ this.ui.agentSelector = document.querySelector('[data-agent-selector]');
358
+ this.ui.agentSelector = document.querySelector('[data-agent-selector]');
359
+ this.ui.modelSelector = document.querySelector('[data-model-selector]');
360
+
361
+ if (this.ui.agentSelector) {
362
+ this.ui.agentSelector.addEventListener('change', () => {
363
+ if (!this._agentLocked) {
364
+ this.loadModelsForAgent(this.ui.agentSelector.value);
365
+ this.saveAgentAndModelToConversation();
366
+ }
367
+ });
368
+ }
388
369
 
389
370
  if (this.ui.modelSelector) {
390
371
  this.ui.modelSelector.addEventListener('change', () => {
@@ -1264,12 +1245,12 @@ class AgentGUIClient {
1264
1245
  }
1265
1246
  }
1266
1247
 
1267
- async startExecution() {
1268
- const prompt = this.ui.messageInput?.value || '';
1269
- const conv = this.state.currentConversation;
1270
- const isNewConversation = conv && !conv.messageCount && !this.state.streamingConversations.has(conv.id);
1271
- const agentId = (isNewConversation ? this.getCurrentAgent() : null) || conv?.agentType || this.getCurrentAgent() || 'claude-code';
1272
- const model = this.ui.modelSelector?.value || null;
1248
+ async startExecution() {
1249
+ const prompt = this.ui.messageInput?.value || '';
1250
+ const conv = this.state.currentConversation;
1251
+ const isNewConversation = conv && !conv.messageCount && !this.state.streamingConversations.has(conv.id);
1252
+ const agentId = (isNewConversation ? this.getCurrentAgent() : null) || conv?.agentType || this.getCurrentAgent() || 'claude-code';
1253
+ const model = this.ui.modelSelector?.value || null;
1273
1254
 
1274
1255
  if (!prompt.trim()) {
1275
1256
  this.showError('Please enter a prompt');
@@ -1836,53 +1817,53 @@ class AgentGUIClient {
1836
1817
  /**
1837
1818
  * Load agents
1838
1819
  */
1839
- async loadAgents() {
1840
- return this._dedupedFetch('loadAgents', async () => {
1841
- try {
1842
- const { agents } = await window.wsClient.rpc('agent.ls');
1843
- this.state.agents = agents;
1844
-
1845
- // Split agents by protocol
1846
- const cliAgents = agents.filter(agent => agent.protocol === 'cli');
1847
- const acpAgents = agents.filter(agent => agent.protocol === 'acp');
1848
-
1849
- // Populate CLI agent selector
1850
- if (this.ui.cliAgentSelector) {
1851
- if (cliAgents.length > 0) {
1852
- this.ui.cliAgentSelector.innerHTML = cliAgents
1853
- .map(agent => `<option value="${agent.id}">${agent.name}</option>`)
1854
- .join('');
1855
- this.ui.cliAgentSelector.style.display = 'inline-block';
1856
- } else {
1857
- this.ui.cliAgentSelector.innerHTML = '';
1858
- this.ui.cliAgentSelector.style.display = 'none';
1859
- }
1860
- }
1861
-
1862
- // Populate ACP agent selector
1863
- if (this.ui.acpAgentSelector) {
1864
- if (acpAgents.length > 0) {
1865
- this.ui.acpAgentSelector.innerHTML = acpAgents
1866
- .map(agent => `<option value="${agent.id}">${agent.name}</option>`)
1867
- .join('');
1868
- this.ui.acpAgentSelector.style.display = 'inline-block';
1869
- } else {
1870
- this.ui.acpAgentSelector.innerHTML = '';
1871
- this.ui.acpAgentSelector.style.display = 'none';
1872
- }
1873
- }
1874
-
1875
- window.dispatchEvent(new CustomEvent('agents-loaded', { detail: { agents } }));
1876
- if (agents.length > 0 && !this._agentLocked) {
1877
- this.loadModelsForAgent(agents[0].id);
1878
- }
1879
- return agents;
1880
- } catch (error) {
1881
- console.error('Failed to load agents:', error);
1882
- return [];
1883
- }
1884
- });
1885
- }
1820
+ async loadAgents() {
1821
+ return this._dedupedFetch('loadAgents', async () => {
1822
+ try {
1823
+ const { agents } = await window.wsClient.rpc('agent.ls');
1824
+ this.state.agents = agents;
1825
+
1826
+ // Split agents by protocol
1827
+ const cliAgents = agents.filter(agent => agent.protocol === 'cli');
1828
+ const acpAgents = agents.filter(agent => agent.protocol === 'acp');
1829
+
1830
+ // Populate CLI agent selector
1831
+ if (this.ui.agentSelector) {
1832
+ if (cliAgents.length > 0) {
1833
+ this.ui.agentSelector.innerHTML = cliAgents
1834
+ .map(agent => `<option value="${agent.id}">${agent.name}</option>`)
1835
+ .join('');
1836
+ this.ui.agentSelector.style.display = 'inline-block';
1837
+ } else {
1838
+ this.ui.agentSelector.innerHTML = '';
1839
+ this.ui.agentSelector.style.display = 'none';
1840
+ }
1841
+ }
1842
+
1843
+ // Populate ACP agent selector
1844
+ if (this.ui.agentSelector) {
1845
+ if (acpAgents.length > 0) {
1846
+ this.ui.agentSelector.innerHTML = acpAgents
1847
+ .map(agent => `<option value="${agent.id}">${agent.name}</option>`)
1848
+ .join('');
1849
+ this.ui.agentSelector.style.display = 'inline-block';
1850
+ } else {
1851
+ this.ui.agentSelector.innerHTML = '';
1852
+ this.ui.agentSelector.style.display = 'none';
1853
+ }
1854
+ }
1855
+
1856
+ window.dispatchEvent(new CustomEvent('agents-loaded', { detail: { agents } }));
1857
+ if (agents.length > 0 && !this._agentLocked) {
1858
+ this.loadModelsForAgent(agents[0].id);
1859
+ }
1860
+ return agents;
1861
+ } catch (error) {
1862
+ console.error('Failed to load agents:', error);
1863
+ return [];
1864
+ }
1865
+ });
1866
+ }
1886
1867
 
1887
1868
  async checkSpeechStatus() {
1888
1869
  try {
@@ -1934,105 +1915,105 @@ class AgentGUIClient {
1934
1915
  .join('');
1935
1916
  }
1936
1917
 
1937
- lockAgentAndModel(agentId, model) {
1938
- this._agentLocked = true;
1939
-
1940
- // Find the agent to determine protocol
1941
- const agent = this.state.agents.find(a => a.id === agentId);
1942
-
1943
- if (agent) {
1944
- if (agent.protocol === 'cli') {
1945
- if (this.ui.cliAgentSelector) {
1946
- this.ui.cliAgentSelector.value = agentId;
1947
- this.ui.cliAgentSelector.disabled = true;
1948
- }
1949
- if (this.ui.acpAgentSelector) {
1950
- this.ui.acpAgentSelector.value = '';
1951
- this.ui.acpAgentSelector.disabled = true;
1952
- this.ui.acpAgentSelector.style.display = 'none';
1953
- }
1954
- } else {
1955
- if (this.ui.acpAgentSelector) {
1956
- this.ui.acpAgentSelector.value = agentId;
1957
- this.ui.acpAgentSelector.disabled = true;
1958
- }
1959
- if (this.ui.cliAgentSelector) {
1960
- this.ui.cliAgentSelector.value = '';
1961
- this.ui.cliAgentSelector.disabled = true;
1962
- this.ui.cliAgentSelector.style.display = 'none';
1963
- }
1964
- }
1965
- }
1966
-
1967
- this.loadModelsForAgent(agentId).then(() => {
1968
- if (this.ui.modelSelector && model) {
1969
- this.ui.modelSelector.value = model;
1970
- }
1971
- });
1972
- }
1973
-
1974
- unlockAgentAndModel() {
1975
- this._agentLocked = false;
1976
- if (this.ui.cliAgentSelector) {
1977
- this.ui.cliAgentSelector.disabled = false;
1978
- }
1979
- if (this.ui.acpAgentSelector) {
1980
- this.ui.acpAgentSelector.disabled = false;
1981
- }
1982
-
1983
- // Show both selectors again when unlocking
1984
- if (this.ui.cliAgentSelector && this.state.agents.some(a => a.protocol === 'cli')) {
1985
- this.ui.cliAgentSelector.style.display = 'inline-block';
1986
- }
1987
- if (this.ui.acpAgentSelector && this.state.agents.some(a => a.protocol === 'acp')) {
1988
- this.ui.acpAgentSelector.style.display = 'inline-block';
1989
- }
1990
- }
1918
+ lockAgentAndModel(agentId, model) {
1919
+ this._agentLocked = true;
1920
+
1921
+ // Find the agent to determine protocol
1922
+ const agent = this.state.agents.find(a => a.id === agentId);
1923
+
1924
+ if (agent) {
1925
+ if (agent.protocol === 'cli') {
1926
+ if (this.ui.agentSelector) {
1927
+ this.ui.agentSelector.value = agentId;
1928
+ this.ui.agentSelector.disabled = true;
1929
+ }
1930
+ if (this.ui.agentSelector) {
1931
+ this.ui.agentSelector.value = '';
1932
+ this.ui.agentSelector.disabled = true;
1933
+ this.ui.agentSelector.style.display = 'none';
1934
+ }
1935
+ } else {
1936
+ if (this.ui.agentSelector) {
1937
+ this.ui.agentSelector.value = agentId;
1938
+ this.ui.agentSelector.disabled = true;
1939
+ }
1940
+ if (this.ui.agentSelector) {
1941
+ this.ui.agentSelector.value = '';
1942
+ this.ui.agentSelector.disabled = true;
1943
+ this.ui.agentSelector.style.display = 'none';
1944
+ }
1945
+ }
1946
+ }
1947
+
1948
+ this.loadModelsForAgent(agentId).then(() => {
1949
+ if (this.ui.modelSelector && model) {
1950
+ this.ui.modelSelector.value = model;
1951
+ }
1952
+ });
1953
+ }
1954
+
1955
+ unlockAgentAndModel() {
1956
+ this._agentLocked = false;
1957
+ if (this.ui.agentSelector) {
1958
+ this.ui.agentSelector.disabled = false;
1959
+ }
1960
+ if (this.ui.agentSelector) {
1961
+ this.ui.agentSelector.disabled = false;
1962
+ }
1963
+
1964
+ // Show both selectors again when unlocking
1965
+ if (this.ui.agentSelector && this.state.agents.some(a => a.protocol === 'cli')) {
1966
+ this.ui.agentSelector.style.display = 'inline-block';
1967
+ }
1968
+ if (this.ui.agentSelector && this.state.agents.some(a => a.protocol === 'acp')) {
1969
+ this.ui.agentSelector.style.display = 'inline-block';
1970
+ }
1971
+ }
1991
1972
 
1992
1973
  /**
1993
1974
  * Apply agent and model selection based on conversation state
1994
1975
  * Consolidates duplicate logic for cached and fresh conversation loads
1995
1976
  */
1996
- applyAgentAndModelSelection(conversation, hasActivity) {
1997
- const agentId = conversation.agentId || conversation.agentType || 'claude-code';
1998
- const model = conversation.model || null;
1999
-
2000
- if (hasActivity) {
2001
- this.lockAgentAndModel(agentId, model);
2002
- } else {
2003
- this.unlockAgentAndModel();
2004
- // Find the agent to determine protocol
2005
- const agent = this.state.agents.find(a => a.id === agentId);
2006
-
2007
- if (agent) {
2008
- if (agent.protocol === 'cli') {
2009
- if (this.ui.cliAgentSelector) {
2010
- this.ui.cliAgentSelector.value = agentId;
2011
- this.ui.cliAgentSelector.style.display = 'inline-block';
2012
- }
2013
- if (this.ui.acpAgentSelector) {
2014
- this.ui.acpAgentSelector.value = '';
2015
- this.ui.acpAgentSelector.style.display = 'none';
2016
- }
2017
- } else {
2018
- if (this.ui.acpAgentSelector) {
2019
- this.ui.acpAgentSelector.value = agentId;
2020
- this.ui.acpAgentSelector.style.display = 'inline-block';
2021
- }
2022
- if (this.ui.cliAgentSelector) {
2023
- this.ui.cliAgentSelector.value = '';
2024
- this.ui.cliAgentSelector.style.display = 'none';
2025
- }
2026
- }
2027
- }
2028
-
2029
- this.loadModelsForAgent(agentId).then(() => {
2030
- if (model && this.ui.modelSelector) {
2031
- this.ui.modelSelector.value = model;
2032
- }
2033
- });
2034
- }
2035
- }
1977
+ applyAgentAndModelSelection(conversation, hasActivity) {
1978
+ const agentId = conversation.agentId || conversation.agentType || 'claude-code';
1979
+ const model = conversation.model || null;
1980
+
1981
+ if (hasActivity) {
1982
+ this.lockAgentAndModel(agentId, model);
1983
+ } else {
1984
+ this.unlockAgentAndModel();
1985
+ // Find the agent to determine protocol
1986
+ const agent = this.state.agents.find(a => a.id === agentId);
1987
+
1988
+ if (agent) {
1989
+ if (agent.protocol === 'cli') {
1990
+ if (this.ui.agentSelector) {
1991
+ this.ui.agentSelector.value = agentId;
1992
+ this.ui.agentSelector.style.display = 'inline-block';
1993
+ }
1994
+ if (this.ui.agentSelector) {
1995
+ this.ui.agentSelector.value = '';
1996
+ this.ui.agentSelector.style.display = 'none';
1997
+ }
1998
+ } else {
1999
+ if (this.ui.agentSelector) {
2000
+ this.ui.agentSelector.value = agentId;
2001
+ this.ui.agentSelector.style.display = 'inline-block';
2002
+ }
2003
+ if (this.ui.agentSelector) {
2004
+ this.ui.agentSelector.value = '';
2005
+ this.ui.agentSelector.style.display = 'none';
2006
+ }
2007
+ }
2008
+ }
2009
+
2010
+ this.loadModelsForAgent(agentId).then(() => {
2011
+ if (model && this.ui.modelSelector) {
2012
+ this.ui.modelSelector.value = model;
2013
+ }
2014
+ });
2015
+ }
2016
+ }
2036
2017
 
2037
2018
  /**
2038
2019
  * Load conversations
@@ -2594,25 +2575,25 @@ class AgentGUIClient {
2594
2575
  }
2595
2576
  }
2596
2577
 
2597
- /**
2598
- * Get current selected agent
2599
- */
2600
- getCurrentAgent() {
2601
- if (this.ui.cliAgentSelector?.value) {
2602
- return this.ui.cliAgentSelector.value;
2603
- }
2604
- if (this.ui.acpAgentSelector?.value) {
2605
- return this.ui.acpAgentSelector.value;
2606
- }
2607
- return 'claude-code';
2608
- }
2609
-
2610
- /**
2611
- * Get current selected model
2612
- */
2613
- getCurrentModel() {
2614
- return this.ui.modelSelector?.value || null;
2615
- }
2578
+ /**
2579
+ * Get current selected agent
2580
+ */
2581
+ getCurrentAgent() {
2582
+ if (this.ui.agentSelector?.value) {
2583
+ return this.ui.agentSelector.value;
2584
+ }
2585
+ if (this.ui.agentSelector?.value) {
2586
+ return this.ui.agentSelector.value;
2587
+ }
2588
+ return 'claude-code';
2589
+ }
2590
+
2591
+ /**
2592
+ * Get current selected model
2593
+ */
2594
+ getCurrentModel() {
2595
+ return this.ui.modelSelector?.value || null;
2596
+ }
2616
2597
 
2617
2598
  /**
2618
2599
  * Get metrics