agentgui 1.0.306 → 1.0.308
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/bin/gmgui.cjs +25 -25
- package/package.json +1 -1
- package/server.js +14 -14
package/bin/gmgui.cjs
CHANGED
|
@@ -15,31 +15,31 @@ async function gmgui(args = []) {
|
|
|
15
15
|
// may not be in PATH even though bunx works.
|
|
16
16
|
const installer = 'npm';
|
|
17
17
|
|
|
18
|
-
// Ensure dependencies are installed only if node_modules is missing
|
|
19
|
-
// Skip this for bunx/npx which manage dependencies independently
|
|
20
|
-
const nodeModulesPath = path.join(projectRoot, 'node_modules');
|
|
21
|
-
const execPath = process.env.npm_execpath || '';
|
|
22
|
-
const isBunx = execPath.includes('bun') || process.env.BUN_INSTALL;
|
|
23
|
-
const isNpx = execPath.includes('npx') || process.env._.includes('npx');
|
|
24
|
-
|
|
25
|
-
// Also skip if running from temp/cache directory (bunx/npm cache)
|
|
26
|
-
const isFromCache = projectRoot.includes('node_modules') &&
|
|
27
|
-
(projectRoot.includes('.bun') || projectRoot.includes('_npx') || projectRoot.includes('npm-cache'));
|
|
28
|
-
|
|
29
|
-
if (!isBunx && !isNpx && !isFromCache && !fs.existsSync(nodeModulesPath)) {
|
|
30
|
-
console.log(`Installing dependencies with ${installer}...`);
|
|
31
|
-
const installResult = spawnSync(installer, ['install'], {
|
|
32
|
-
cwd: projectRoot,
|
|
33
|
-
stdio: 'inherit',
|
|
34
|
-
shell: true
|
|
35
|
-
});
|
|
36
|
-
if (installResult.status !== 0 && installResult.status !== null) {
|
|
37
|
-
throw new Error(`${installer} install failed with code ${installResult.status}`);
|
|
38
|
-
}
|
|
39
|
-
if (installResult.error) {
|
|
40
|
-
throw new Error(`${installer} install failed: ${installResult.error.message}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
18
|
+
// Ensure dependencies are installed only if node_modules is missing
|
|
19
|
+
// Skip this for bunx/npx which manage dependencies independently
|
|
20
|
+
const nodeModulesPath = path.join(projectRoot, 'node_modules');
|
|
21
|
+
const execPath = process.env.npm_execpath || '';
|
|
22
|
+
const isBunx = execPath.includes('bun') || process.env.BUN_INSTALL;
|
|
23
|
+
const isNpx = execPath.includes('npx') || (process.env._ && process.env._.includes('npx'));
|
|
24
|
+
|
|
25
|
+
// Also skip if running from temp/cache directory (bunx/npm cache)
|
|
26
|
+
const isFromCache = projectRoot.includes('node_modules') &&
|
|
27
|
+
(projectRoot.includes('.bun') || projectRoot.includes('_npx') || projectRoot.includes('npm-cache'));
|
|
28
|
+
|
|
29
|
+
if (!isBunx && !isNpx && !isFromCache && !fs.existsSync(nodeModulesPath)) {
|
|
30
|
+
console.log(`Installing dependencies with ${installer}...`);
|
|
31
|
+
const installResult = spawnSync(installer, ['install'], {
|
|
32
|
+
cwd: projectRoot,
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
shell: true
|
|
35
|
+
});
|
|
36
|
+
if (installResult.status !== 0 && installResult.status !== null) {
|
|
37
|
+
throw new Error(`${installer} install failed with code ${installResult.status}`);
|
|
38
|
+
}
|
|
39
|
+
if (installResult.error) {
|
|
40
|
+
throw new Error(`${installer} install failed: ${installResult.error.message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
43
|
|
|
44
44
|
const port = process.env.PORT || 3000;
|
|
45
45
|
const baseUrl = process.env.BASE_URL || '/gm';
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -324,16 +324,6 @@ const AGENT_MODEL_COMMANDS = {
|
|
|
324
324
|
};
|
|
325
325
|
|
|
326
326
|
const AGENT_DEFAULT_MODELS = {
|
|
327
|
-
'claude-code': [
|
|
328
|
-
{ id: '', label: 'Default' },
|
|
329
|
-
{ id: 'sonnet', label: 'Sonnet' },
|
|
330
|
-
{ id: 'opus', label: 'Opus' },
|
|
331
|
-
{ id: 'haiku', label: 'Haiku' },
|
|
332
|
-
{ id: 'claude-sonnet-4-5-20250929', label: 'Sonnet 4.5' },
|
|
333
|
-
{ id: 'claude-sonnet-4-6-20260219', label: 'Sonnet 4.6' },
|
|
334
|
-
{ id: 'claude-opus-4-6', label: 'Opus 4.6' },
|
|
335
|
-
{ id: 'claude-haiku-4-5-20251001', label: 'Haiku 4.5' }
|
|
336
|
-
],
|
|
337
327
|
'gemini': [
|
|
338
328
|
{ id: '', label: 'Default' },
|
|
339
329
|
{ id: 'gemini-2.5-pro', label: 'Gemini 2.5 Pro' },
|
|
@@ -399,9 +389,19 @@ async function getModelsForAgent(agentId) {
|
|
|
399
389
|
modelCache.set(agentId, { models: apiModels, timestamp: Date.now() });
|
|
400
390
|
return apiModels;
|
|
401
391
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
392
|
+
try {
|
|
393
|
+
const result = execSync(AGENT_MODEL_COMMANDS[agentId], { encoding: 'utf-8', timeout: 15000 });
|
|
394
|
+
const lines = result.split('\n').map(l => l.trim()).filter(Boolean);
|
|
395
|
+
if (lines.length > 0) {
|
|
396
|
+
const models = [{ id: '', label: 'Default' }];
|
|
397
|
+
for (const line of lines) {
|
|
398
|
+
models.push({ id: line, label: line });
|
|
399
|
+
}
|
|
400
|
+
modelCache.set(agentId, { models, timestamp: Date.now() });
|
|
401
|
+
return models;
|
|
402
|
+
}
|
|
403
|
+
} catch (_) {}
|
|
404
|
+
return [{ id: '', label: 'Default' }];
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
if (AGENT_MODEL_COMMANDS[agentId]) {
|
|
@@ -428,7 +428,7 @@ async function getModelsForAgent(agentId) {
|
|
|
428
428
|
const { getRegisteredAgents } = await import('./lib/claude-runner.js');
|
|
429
429
|
const agents = getRegisteredAgents();
|
|
430
430
|
const agent = agents.find(a => a.id === agentId);
|
|
431
|
-
|
|
431
|
+
|
|
432
432
|
if (agent && agent.command) {
|
|
433
433
|
const modelCmd = `${agent.command} models`;
|
|
434
434
|
try {
|