agentgui 1.0.415 → 1.0.417
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 +1 -1
- package/static/index.html +3 -10
- package/static/js/client.js +174 -210
package/package.json
CHANGED
package/static/index.html
CHANGED
|
@@ -818,15 +818,9 @@
|
|
|
818
818
|
max-width: 200px;
|
|
819
819
|
}
|
|
820
820
|
|
|
821
|
-
|
|
822
|
-
/* CLI agents have a different background color */
|
|
823
|
-
background-color: var(--color-bg-secondary);
|
|
824
|
-
}
|
|
821
|
+
|
|
825
822
|
|
|
826
|
-
|
|
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
|
|
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"
|
package/static/js/client.js
CHANGED
|
@@ -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.
|
|
358
|
-
this.ui.
|
|
359
|
-
this.ui.modelSelector = document.querySelector('[data-model-selector]');
|
|
360
|
-
|
|
361
|
-
if (this.ui.
|
|
362
|
-
this.ui.
|
|
363
|
-
if (!this._agentLocked) {
|
|
364
|
-
this.loadModelsForAgent(this.ui.
|
|
365
|
-
this.saveAgentAndModelToConversation();
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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,36 @@ 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
|
-
//
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
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
|
+
// Populate unified agent selector with all agents (both CLI and ACP)
|
|
1827
|
+
if (this.ui.agentSelector) {
|
|
1828
|
+
if (agents.length > 0) {
|
|
1829
|
+
this.ui.agentSelector.innerHTML = agents
|
|
1830
|
+
.map(agent => `<option value="${agent.id}">${agent.name}</option>`)
|
|
1831
|
+
.join('');
|
|
1832
|
+
this.ui.agentSelector.style.display = 'inline-block';
|
|
1833
|
+
} else {
|
|
1834
|
+
this.ui.agentSelector.innerHTML = '';
|
|
1835
|
+
this.ui.agentSelector.style.display = 'none';
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
window.dispatchEvent(new CustomEvent('agents-loaded', { detail: { agents } }));
|
|
1840
|
+
if (agents.length > 0 && !this._agentLocked) {
|
|
1841
|
+
this.loadModelsForAgent(agents[0].id);
|
|
1842
|
+
}
|
|
1843
|
+
return agents;
|
|
1844
|
+
} catch (error) {
|
|
1845
|
+
console.error('Failed to load agents:', error);
|
|
1846
|
+
return [];
|
|
1847
|
+
}
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1886
1850
|
|
|
1887
1851
|
async checkSpeechStatus() {
|
|
1888
1852
|
try {
|
|
@@ -1934,105 +1898,105 @@ class AgentGUIClient {
|
|
|
1934
1898
|
.join('');
|
|
1935
1899
|
}
|
|
1936
1900
|
|
|
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.
|
|
1946
|
-
this.ui.
|
|
1947
|
-
this.ui.
|
|
1948
|
-
}
|
|
1949
|
-
if (this.ui.
|
|
1950
|
-
this.ui.
|
|
1951
|
-
this.ui.
|
|
1952
|
-
this.ui.
|
|
1953
|
-
}
|
|
1954
|
-
} else {
|
|
1955
|
-
if (this.ui.
|
|
1956
|
-
this.ui.
|
|
1957
|
-
this.ui.
|
|
1958
|
-
}
|
|
1959
|
-
if (this.ui.
|
|
1960
|
-
this.ui.
|
|
1961
|
-
this.ui.
|
|
1962
|
-
this.ui.
|
|
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.
|
|
1977
|
-
this.ui.
|
|
1978
|
-
}
|
|
1979
|
-
if (this.ui.
|
|
1980
|
-
this.ui.
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
// Show both selectors again when unlocking
|
|
1984
|
-
if (this.ui.
|
|
1985
|
-
this.ui.
|
|
1986
|
-
}
|
|
1987
|
-
if (this.ui.
|
|
1988
|
-
this.ui.
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1901
|
+
lockAgentAndModel(agentId, model) {
|
|
1902
|
+
this._agentLocked = true;
|
|
1903
|
+
|
|
1904
|
+
// Find the agent to determine protocol
|
|
1905
|
+
const agent = this.state.agents.find(a => a.id === agentId);
|
|
1906
|
+
|
|
1907
|
+
if (agent) {
|
|
1908
|
+
if (agent.protocol === 'cli') {
|
|
1909
|
+
if (this.ui.agentSelector) {
|
|
1910
|
+
this.ui.agentSelector.value = agentId;
|
|
1911
|
+
this.ui.agentSelector.disabled = true;
|
|
1912
|
+
}
|
|
1913
|
+
if (this.ui.agentSelector) {
|
|
1914
|
+
this.ui.agentSelector.value = '';
|
|
1915
|
+
this.ui.agentSelector.disabled = true;
|
|
1916
|
+
this.ui.agentSelector.style.display = 'none';
|
|
1917
|
+
}
|
|
1918
|
+
} else {
|
|
1919
|
+
if (this.ui.agentSelector) {
|
|
1920
|
+
this.ui.agentSelector.value = agentId;
|
|
1921
|
+
this.ui.agentSelector.disabled = true;
|
|
1922
|
+
}
|
|
1923
|
+
if (this.ui.agentSelector) {
|
|
1924
|
+
this.ui.agentSelector.value = '';
|
|
1925
|
+
this.ui.agentSelector.disabled = true;
|
|
1926
|
+
this.ui.agentSelector.style.display = 'none';
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
this.loadModelsForAgent(agentId).then(() => {
|
|
1932
|
+
if (this.ui.modelSelector && model) {
|
|
1933
|
+
this.ui.modelSelector.value = model;
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
unlockAgentAndModel() {
|
|
1939
|
+
this._agentLocked = false;
|
|
1940
|
+
if (this.ui.agentSelector) {
|
|
1941
|
+
this.ui.agentSelector.disabled = false;
|
|
1942
|
+
}
|
|
1943
|
+
if (this.ui.agentSelector) {
|
|
1944
|
+
this.ui.agentSelector.disabled = false;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
// Show both selectors again when unlocking
|
|
1948
|
+
if (this.ui.agentSelector && this.state.agents.some(a => a.protocol === 'cli')) {
|
|
1949
|
+
this.ui.agentSelector.style.display = 'inline-block';
|
|
1950
|
+
}
|
|
1951
|
+
if (this.ui.agentSelector && this.state.agents.some(a => a.protocol === 'acp')) {
|
|
1952
|
+
this.ui.agentSelector.style.display = 'inline-block';
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1991
1955
|
|
|
1992
1956
|
/**
|
|
1993
1957
|
* Apply agent and model selection based on conversation state
|
|
1994
1958
|
* Consolidates duplicate logic for cached and fresh conversation loads
|
|
1995
1959
|
*/
|
|
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.
|
|
2010
|
-
this.ui.
|
|
2011
|
-
this.ui.
|
|
2012
|
-
}
|
|
2013
|
-
if (this.ui.
|
|
2014
|
-
this.ui.
|
|
2015
|
-
this.ui.
|
|
2016
|
-
}
|
|
2017
|
-
} else {
|
|
2018
|
-
if (this.ui.
|
|
2019
|
-
this.ui.
|
|
2020
|
-
this.ui.
|
|
2021
|
-
}
|
|
2022
|
-
if (this.ui.
|
|
2023
|
-
this.ui.
|
|
2024
|
-
this.ui.
|
|
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
|
-
}
|
|
1960
|
+
applyAgentAndModelSelection(conversation, hasActivity) {
|
|
1961
|
+
const agentId = conversation.agentId || conversation.agentType || 'claude-code';
|
|
1962
|
+
const model = conversation.model || null;
|
|
1963
|
+
|
|
1964
|
+
if (hasActivity) {
|
|
1965
|
+
this.lockAgentAndModel(agentId, model);
|
|
1966
|
+
} else {
|
|
1967
|
+
this.unlockAgentAndModel();
|
|
1968
|
+
// Find the agent to determine protocol
|
|
1969
|
+
const agent = this.state.agents.find(a => a.id === agentId);
|
|
1970
|
+
|
|
1971
|
+
if (agent) {
|
|
1972
|
+
if (agent.protocol === 'cli') {
|
|
1973
|
+
if (this.ui.agentSelector) {
|
|
1974
|
+
this.ui.agentSelector.value = agentId;
|
|
1975
|
+
this.ui.agentSelector.style.display = 'inline-block';
|
|
1976
|
+
}
|
|
1977
|
+
if (this.ui.agentSelector) {
|
|
1978
|
+
this.ui.agentSelector.value = '';
|
|
1979
|
+
this.ui.agentSelector.style.display = 'none';
|
|
1980
|
+
}
|
|
1981
|
+
} else {
|
|
1982
|
+
if (this.ui.agentSelector) {
|
|
1983
|
+
this.ui.agentSelector.value = agentId;
|
|
1984
|
+
this.ui.agentSelector.style.display = 'inline-block';
|
|
1985
|
+
}
|
|
1986
|
+
if (this.ui.agentSelector) {
|
|
1987
|
+
this.ui.agentSelector.value = '';
|
|
1988
|
+
this.ui.agentSelector.style.display = 'none';
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
this.loadModelsForAgent(agentId).then(() => {
|
|
1994
|
+
if (model && this.ui.modelSelector) {
|
|
1995
|
+
this.ui.modelSelector.value = model;
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2036
2000
|
|
|
2037
2001
|
/**
|
|
2038
2002
|
* Load conversations
|
|
@@ -2594,25 +2558,25 @@ class AgentGUIClient {
|
|
|
2594
2558
|
}
|
|
2595
2559
|
}
|
|
2596
2560
|
|
|
2597
|
-
/**
|
|
2598
|
-
* Get current selected agent
|
|
2599
|
-
*/
|
|
2600
|
-
getCurrentAgent() {
|
|
2601
|
-
if (this.ui.
|
|
2602
|
-
return this.ui.
|
|
2603
|
-
}
|
|
2604
|
-
if (this.ui.
|
|
2605
|
-
return this.ui.
|
|
2606
|
-
}
|
|
2607
|
-
return 'claude-code';
|
|
2608
|
-
}
|
|
2609
|
-
|
|
2610
|
-
/**
|
|
2611
|
-
* Get current selected model
|
|
2612
|
-
*/
|
|
2613
|
-
getCurrentModel() {
|
|
2614
|
-
return this.ui.modelSelector?.value || null;
|
|
2615
|
-
}
|
|
2561
|
+
/**
|
|
2562
|
+
* Get current selected agent
|
|
2563
|
+
*/
|
|
2564
|
+
getCurrentAgent() {
|
|
2565
|
+
if (this.ui.agentSelector?.value) {
|
|
2566
|
+
return this.ui.agentSelector.value;
|
|
2567
|
+
}
|
|
2568
|
+
if (this.ui.agentSelector?.value) {
|
|
2569
|
+
return this.ui.agentSelector.value;
|
|
2570
|
+
}
|
|
2571
|
+
return 'claude-code';
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* Get current selected model
|
|
2576
|
+
*/
|
|
2577
|
+
getCurrentModel() {
|
|
2578
|
+
return this.ui.modelSelector?.value || null;
|
|
2579
|
+
}
|
|
2616
2580
|
|
|
2617
2581
|
/**
|
|
2618
2582
|
* Get metrics
|