agentgui 1.0.879 → 1.0.880
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 +22 -13
- package/package.json +1 -1
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { queryModels } from './acp-sdk-manager.js';
|
|
2
2
|
|
|
3
|
+
const STATIC_MODELS = {
|
|
4
|
+
'claude-code': [
|
|
5
|
+
{ id: 'haiku', label: 'Haiku' },
|
|
6
|
+
{ id: 'sonnet', label: 'Sonnet' },
|
|
7
|
+
{ id: 'opus', label: 'Opus' }
|
|
8
|
+
],
|
|
9
|
+
'gemini': [
|
|
10
|
+
{ id: 'gemini-3-pro', label: 'Gemini 3 Pro' },
|
|
11
|
+
{ id: 'gemini-3-flash', label: 'Gemini 3 Flash' },
|
|
12
|
+
{ id: 'gemini-3.1-pro', label: 'Gemini 3.1 Pro' },
|
|
13
|
+
{ id: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro' },
|
|
14
|
+
{ id: 'gemini-2.5-flash', label: 'Gemini 2.5 Flash' },
|
|
15
|
+
{ id: 'gemini-2.0-flash', label: 'Gemini 2.0 Flash' }
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
|
|
3
19
|
export function register(router, deps) {
|
|
4
20
|
const { db, discoveredAgents, modelCache, getAgentDescriptor } = deps;
|
|
5
21
|
console.log('[ws-handlers-session] register() called with discoveredAgents.length:', discoveredAgents.length);
|
|
@@ -74,19 +90,12 @@ export function register(router, deps) {
|
|
|
74
90
|
const cached = modelCache.get(p.id);
|
|
75
91
|
if (cached && (Date.now() - cached.ts) < 300000) return { models: cached.models };
|
|
76
92
|
let models = [];
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} else {
|
|
84
|
-
const agent = discoveredAgents.find(x => x.id === p.id);
|
|
85
|
-
if (agent?.protocol === 'acp') {
|
|
86
|
-
models = await queryModels(p.id);
|
|
87
|
-
} else if (agent?.protocol === 'cli-wrapper' && agent.acpId) {
|
|
88
|
-
models = await queryModels(agent.acpId);
|
|
89
|
-
}
|
|
93
|
+
const agent = discoveredAgents.find(x => x.id === p.id);
|
|
94
|
+
const targetId = agent?.protocol === 'cli-wrapper' && agent.acpId ? agent.acpId : p.id;
|
|
95
|
+
if (p.id === 'cli-claude' || STATIC_MODELS[targetId]) {
|
|
96
|
+
models = STATIC_MODELS[targetId] || STATIC_MODELS['claude-code'];
|
|
97
|
+
} else if (agent?.protocol === 'acp' || (agent?.protocol === 'cli-wrapper' && agent.acpId)) {
|
|
98
|
+
models = await queryModels(targetId);
|
|
90
99
|
}
|
|
91
100
|
if (models.length > 0) modelCache.set(p.id, { models, ts: Date.now() });
|
|
92
101
|
return { models };
|