agentgui 1.0.423 → 1.0.424
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/lib/ws-handlers-session.js +29 -2
- package/package.json +1 -1
|
@@ -111,7 +111,8 @@ export function register(router, deps) {
|
|
|
111
111
|
if (!agent || agent.protocol !== 'acp') return { subAgents: [] };
|
|
112
112
|
try {
|
|
113
113
|
const data = await acpFetch(agent.acpPort || 8080, '/agents/search', {});
|
|
114
|
-
|
|
114
|
+
const list = Array.isArray(data) ? data : (data?.agents || []);
|
|
115
|
+
return { subAgents: list.map(a => ({ id: a.agent_id || a.id, name: a.metadata?.ref?.name || a.name || a.agent_id || a.id })) };
|
|
115
116
|
} catch (_) { return { subAgents: [] }; }
|
|
116
117
|
});
|
|
117
118
|
|
|
@@ -143,12 +144,21 @@ export function register(router, deps) {
|
|
|
143
144
|
} catch (_) {}
|
|
144
145
|
try {
|
|
145
146
|
const data = await acpFetch(port, '/agents/search', {});
|
|
147
|
+
const list = Array.isArray(data) ? data : (data?.agents || []);
|
|
146
148
|
const allModels = new Map();
|
|
147
|
-
for (const a of
|
|
149
|
+
for (const a of list) {
|
|
150
|
+
const agentId = a.agent_id || a.id;
|
|
151
|
+
const name = a.metadata?.ref?.name || a.name || agentId;
|
|
152
|
+
if (agentId && name) allModels.set(agentId, name);
|
|
148
153
|
for (const m of (a.metadata?.models || a.specs?.models || [])) {
|
|
149
154
|
const id = m.id || m;
|
|
150
155
|
if (id) allModels.set(id, m.name || m.label || id);
|
|
151
156
|
}
|
|
157
|
+
try {
|
|
158
|
+
const desc = await acpFetch(port, `/agents/${agentId}/descriptor`);
|
|
159
|
+
const enumVals = desc?.specs?.config?.properties?.model?.enum || desc?.specs?.input?.properties?.model?.enum || [];
|
|
160
|
+
for (const v of enumVals) allModels.set(v, v);
|
|
161
|
+
} catch (_) {}
|
|
152
162
|
}
|
|
153
163
|
if (allModels.size > 0) {
|
|
154
164
|
const models = Array.from(allModels.entries()).map(([id, label]) => ({ id, label }));
|
|
@@ -157,6 +167,23 @@ export function register(router, deps) {
|
|
|
157
167
|
}
|
|
158
168
|
} catch (_) {}
|
|
159
169
|
}
|
|
170
|
+
const acpAgents = discoveredAgents.filter(x => x.protocol === 'acp');
|
|
171
|
+
for (const acpAgent of acpAgents) {
|
|
172
|
+
const port = acpAgent.acpPort || 8080;
|
|
173
|
+
try {
|
|
174
|
+
const desc = await acpFetch(port, `/agents/${p.id}/descriptor`);
|
|
175
|
+
if (desc) {
|
|
176
|
+
const enumVals = desc?.specs?.config?.properties?.model?.enum || desc?.specs?.input?.properties?.model?.enum || [];
|
|
177
|
+
if (enumVals.length > 0) {
|
|
178
|
+
const models = enumVals.map(v => ({ id: v, label: v }));
|
|
179
|
+
modelCache.set(p.id, { models, ts: Date.now() });
|
|
180
|
+
return { models };
|
|
181
|
+
}
|
|
182
|
+
const name = desc?.metadata?.ref?.name;
|
|
183
|
+
if (name) { const models = [{ id: p.id, label: name }]; modelCache.set(p.id, { models, ts: Date.now() }); return { models }; }
|
|
184
|
+
}
|
|
185
|
+
} catch (_) {}
|
|
186
|
+
}
|
|
160
187
|
try {
|
|
161
188
|
const models = await getModelsForAgent(p.id);
|
|
162
189
|
modelCache.set(p.id, { models, ts: Date.now() });
|