agentgui 1.0.990 → 1.0.991

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.
@@ -23,13 +23,6 @@ const BINARIES = [
23
23
  { cmd: 'hermes', id: 'hermes', name: 'Hermes Agent', icon: 'h', protocol: 'acp' },
24
24
  ];
25
25
 
26
- const CLI_WRAPPERS = [
27
- { id: 'cli-opencode', name: 'OpenCode', icon: 'O', protocol: 'cli-wrapper', acpId: 'opencode' },
28
- { id: 'cli-gemini', name: 'Gemini', icon: 'G', protocol: 'cli-wrapper', acpId: 'gemini' },
29
- { id: 'cli-kilo', name: 'Kilo', icon: 'K', protocol: 'cli-wrapper', acpId: 'kilo' },
30
- { id: 'cli-codex', name: 'Codex', icon: 'X', protocol: 'cli-wrapper', acpId: 'codex' },
31
- ];
32
-
33
26
  export function findCommand(cmd, rootDir) {
34
27
  if (!cmd) return null;
35
28
  const isWindows = os.platform() === 'win32';
@@ -79,19 +72,8 @@ export function discoverAgents(rootDir) {
79
72
  }
80
73
  }
81
74
 
82
- console.log('[discoverAgents] Found agents:', agents.map(a => a.id).join(', '));
83
- for (const wrapper of CLI_WRAPPERS) {
84
- if (agents.some(a => a.id === wrapper.acpId)) {
85
- console.log(`[discoverAgents] Adding CLI wrapper for ${wrapper.id}`);
86
- agents.push(wrapper);
87
- } else {
88
- console.log(`[discoverAgents] Skipping CLI wrapper ${wrapper.id} (ACP agent ${wrapper.acpId} not found)`);
89
- }
90
- }
91
- const wrappedAcpIds = new Set(CLI_WRAPPERS.filter(w => agents.some(a => a.id === w.acpId)).map(w => w.acpId));
92
- const filtered = agents.filter(a => !wrappedAcpIds.has(a.id));
93
- console.log('[discoverAgents] Final agent count:', filtered.length, 'Agent IDs:', filtered.map(a => a.id).join(', '));
94
- return filtered;
75
+ console.log('[discoverAgents] Final agent count:', agents.length, 'Agent IDs:', agents.map(a => a.id).join(', '));
76
+ return agents;
95
77
  }
96
78
 
97
79
  export async function initializeAgentDiscovery(discoveredAgents, rootDir, logError) {
@@ -1,4 +1,4 @@
1
- export function createProcessMessage({ queries, activeExecutions, rateLimitState, execMachine, broadcastSync, runClaudeWithStreaming, cleanupExecution, discoveredAgents, STARTUP_CWD, buildSystemPrompt, parseRateLimitResetTime, touchACP, getJsonlWatcher, debugLog, logError, scheduleRetry, drainMessageQueue, createEventHandler }) {
1
+ export function createProcessMessage({ queries, activeExecutions, rateLimitState, execMachine, broadcastSync, runClaudeWithStreaming, cleanupExecution, STARTUP_CWD, buildSystemPrompt, parseRateLimitResetTime, touchACP, getJsonlWatcher, debugLog, logError, scheduleRetry, drainMessageQueue, createEventHandler }) {
2
2
  async function processMessageWithStreaming(conversationId, messageId, sessionId, content, agentId, model, subAgent) {
3
3
  const startTime = Date.now();
4
4
  touchACP(agentId);
@@ -31,9 +31,7 @@ export function createProcessMessage({ queries, activeExecutions, rateLimitState
31
31
  // Resolve agent before building stateRef so isJsonlBacked can be set correctly.
32
32
  // claude-code (protocol: direct) writes JSONL -> JsonlParser owns event broadcasting.
33
33
  // All other agents (protocol: acp) rely solely on onEvent for streaming.
34
- let resolvedAgentId = agentId || 'claude-code';
35
- const wrapperAgent = discoveredAgents.find(a => a.id === resolvedAgentId && a.protocol === 'cli-wrapper' && a.acpId);
36
- if (wrapperAgent) resolvedAgentId = wrapperAgent.acpId;
34
+ const resolvedAgentId = agentId || 'claude-code';
37
35
  const isJsonlBacked = resolvedAgentId === 'claude-code';
38
36
  // stateRef tracks eventCount (for session response metadata) and resumeSessionId
39
37
  const stateRef = { eventCount: 0, resumeSessionId: conv?.claudeSessionId || null };
@@ -45,18 +45,10 @@ export function makeGetModelsForAgent(deps) {
45
45
  { id: 'opus', label: 'Opus' }
46
46
  ];
47
47
  } else {
48
- // The client sends canonical registry ids ('opencode', 'kilo', 'codex'),
49
- // but discoverAgents() replaces each found ACP agent with its cli-wrapper
50
- // entry whose own id is prefixed ('cli-opencode') and whose acpId carries
51
- // the original id. Match on acpId too so model discovery resolves the
52
- // wrapper instead of finding nothing and silently returning [] models.
53
- const agent = discoveredAgents.find(a => a.id === agentId || a.acpId === agentId);
48
+ const agent = discoveredAgents.find(a => a.id === agentId);
54
49
  if (agent?.protocol === 'acp') {
55
50
  await ensureRunning(agentId);
56
51
  try { models = await queryACPModels(agentId); } catch (_) {}
57
- } else if (agent?.protocol === 'cli-wrapper' && agent.acpId) {
58
- await ensureRunning(agent.acpId);
59
- try { models = await queryACPModels(agent.acpId); } catch (_) {}
60
52
  }
61
53
  }
62
54
  modelCache.set(agentId, { models, timestamp: Date.now() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.990",
3
+ "version": "1.0.991",
4
4
  "description": "Multi-agent ACP client with real-time communication",
5
5
  "type": "module",
6
6
  "main": "electron/main.js",
package/test.js CHANGED
@@ -340,13 +340,13 @@ await ok('cross-tab-storage: "updated in another tab" banner on stale load', ()
340
340
  }
341
341
  });
342
342
 
343
- await ok('agents.models: resolves cli-wrapper by acpId (registry id, not wrapper id)', async () => {
344
- // The client picker sends canonical registry ids ('opencode'), but
345
- // discoverAgents() stores only the cli-wrapper entry ('cli-opencode',
346
- // acpId:'opencode'). getModelsForAgent must resolve via acpId, else model
347
- // discovery silently returns [] for every ACP agent (witnessed regression).
343
+ await ok('agents.models: ACP agent reaches ensureRunning + queryACPModels (not empty)', async () => {
344
+ // discoveredAgents and the client both use the canonical registry id
345
+ // ('opencode', protocol 'acp'). getModelsForAgent must start the ACP server
346
+ // and query it - a regression once silently returned [] for every ACP agent
347
+ // because of an id-scheme mismatch.
348
348
  const { makeGetModelsForAgent } = await import('./lib/server-utils.js');
349
- const discoveredAgents = [{ id: 'cli-opencode', protocol: 'cli-wrapper', acpId: 'opencode' }];
349
+ const discoveredAgents = [{ id: 'opencode', protocol: 'acp' }];
350
350
  const calls = [];
351
351
  const getModels = makeGetModelsForAgent({
352
352
  modelCache: new Map(),
@@ -355,7 +355,7 @@ await ok('agents.models: resolves cli-wrapper by acpId (registry id, not wrapper
355
355
  queryACPModels: async (id) => { calls.push(['query', id]); return [{ id: 'm1', label: 'M1' }]; },
356
356
  });
357
357
  const models = await getModels('opencode');
358
- assert.deepEqual(calls, [['ensure', 'opencode'], ['query', 'opencode']], 'should ensureRunning + query with acpId');
358
+ assert.deepEqual(calls, [['ensure', 'opencode'], ['query', 'opencode']], 'should ensureRunning + query the ACP agent');
359
359
  assert.equal(models.length, 1, 'should return the ACP-provided models, not an empty list');
360
360
  });
361
361