agentgui 1.0.988 → 1.0.989

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.
@@ -45,7 +45,12 @@ export function makeGetModelsForAgent(deps) {
45
45
  { id: 'opus', label: 'Opus' }
46
46
  ];
47
47
  } else {
48
- const agent = discoveredAgents.find(a => a.id === agentId);
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);
49
54
  if (agent?.protocol === 'acp') {
50
55
  await ensureRunning(agentId);
51
56
  try { models = await queryACPModels(agentId); } catch (_) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentgui",
3
- "version": "1.0.988",
3
+ "version": "1.0.989",
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,6 +340,25 @@ 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).
348
+ const { makeGetModelsForAgent } = await import('./lib/server-utils.js');
349
+ const discoveredAgents = [{ id: 'cli-opencode', protocol: 'cli-wrapper', acpId: 'opencode' }];
350
+ const calls = [];
351
+ const getModels = makeGetModelsForAgent({
352
+ modelCache: new Map(),
353
+ discoveredAgents,
354
+ ensureRunning: async (id) => { calls.push(['ensure', id]); return 18100; },
355
+ queryACPModels: async (id) => { calls.push(['query', id]); return [{ id: 'm1', label: 'M1' }]; },
356
+ });
357
+ const models = await getModels('opencode');
358
+ assert.deepEqual(calls, [['ensure', 'opencode'], ['query', 'opencode']], 'should ensureRunning + query with acpId');
359
+ assert.equal(models.length, 1, 'should return the ACP-provided models, not an empty list');
360
+ });
361
+
343
362
  console.log(`\n${passed} passed, ${failed} failed, ${skipped} skipped`);
344
363
  process.exit(failed === 0 ? 0 : 1);
345
364
  }; run();