agent-rev 0.2.5 → 0.2.6

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.
@@ -223,19 +223,17 @@ function detectModels(cliName) {
223
223
  case 'agent-impl':
224
224
  case 'agent-rev':
225
225
  case 'agent-explorer': {
226
- try {
227
- const cfg = JSON.parse(fsSync.readFileSync(path.join(os.homedir(), `.${cliName}`, 'cli-config.json'), 'utf-8'));
228
- if (cfg.coordinatorModel)
229
- return [cfg.coordinatorModel];
230
- }
231
- catch { }
232
- try {
233
- const cfg = JSON.parse(fsSync.readFileSync(path.join(os.homedir(), '.agent-mp', 'cli-config.json'), 'utf-8'));
234
- if (cfg.coordinatorModel)
235
- return [cfg.coordinatorModel];
226
+ for (const dir of [`.${cliName}`, '.agent-mp']) {
227
+ try {
228
+ const cfg = JSON.parse(fsSync.readFileSync(path.join(os.homedir(), dir, 'cli-config.json'), 'utf-8'));
229
+ if (cfg.availableModels?.length)
230
+ return cfg.availableModels;
231
+ if (cfg.coordinatorModel)
232
+ return [cfg.coordinatorModel];
233
+ }
234
+ catch { }
236
235
  }
237
- catch { }
238
- return ['(configure with /model after login)'];
236
+ return [`run: ${cliName} --login`];
239
237
  }
240
238
  default: return ['default'];
241
239
  }
@@ -63,25 +63,17 @@ function detectModels(cliName) {
63
63
  case 'agent-impl':
64
64
  case 'agent-rev':
65
65
  case 'agent-explorer': {
66
- // Try to read the saved coordinator model from the agent's own config
67
- try {
68
- const agentHome = path.join(os.homedir(), `.${cliName}`);
69
- const cfgRaw = fsSync.readFileSync(path.join(agentHome, 'cli-config.json'), 'utf-8');
70
- const cfg = JSON.parse(cfgRaw);
71
- if (cfg.coordinatorModel)
72
- return [cfg.coordinatorModel];
66
+ for (const dir of [`.${cliName}`, '.agent-mp']) {
67
+ try {
68
+ const cfg = JSON.parse(fsSync.readFileSync(path.join(os.homedir(), dir, 'cli-config.json'), 'utf-8'));
69
+ if (cfg.availableModels?.length)
70
+ return cfg.availableModels;
71
+ if (cfg.coordinatorModel)
72
+ return [cfg.coordinatorModel];
73
+ }
74
+ catch { }
73
75
  }
74
- catch { }
75
- // Try to read from shared agent-mp config as fallback
76
- try {
77
- const agentHome = path.join(os.homedir(), '.agent-mp');
78
- const cfgRaw = fsSync.readFileSync(path.join(agentHome, 'cli-config.json'), 'utf-8');
79
- const cfg = JSON.parse(cfgRaw);
80
- if (cfg.coordinatorModel)
81
- return [cfg.coordinatorModel];
82
- }
83
- catch { }
84
- return ['(configure with /model after login)'];
76
+ return [`run: ${cliName} --login`];
85
77
  }
86
78
  default:
87
79
  return ['default'];
package/dist/index.js CHANGED
@@ -71,8 +71,22 @@ if (nativeRole) {
71
71
  const args = process.argv.slice(2);
72
72
  // --login: OAuth login for this role's account
73
73
  if (args.includes('--login') || args.includes('login')) {
74
- const { qwenLogin } = await import('./utils/qwen-auth.js');
74
+ const { qwenLogin, fetchQwenModels } = await import('./utils/qwen-auth.js');
75
+ const { loadCliConfig, saveCliConfig } = await import('./utils/config.js');
75
76
  const ok = await qwenLogin();
77
+ if (ok) {
78
+ // Fetch and cache available models so /setup can show them
79
+ const models = await fetchQwenModels();
80
+ if (models.length) {
81
+ const cliConfig = await loadCliConfig();
82
+ cliConfig.availableModels = models;
83
+ if (!cliConfig.coordinatorModel)
84
+ cliConfig.coordinatorModel = models[0];
85
+ await saveCliConfig(cliConfig);
86
+ console.log(chalk.green(` ✓ Models cached: ${models.slice(0, 3).join(', ')}${models.length > 3 ? '...' : ''}`));
87
+ console.log(chalk.dim(` Default model: ${cliConfig.coordinatorModel}`));
88
+ }
89
+ }
76
90
  process.exit(ok ? 0 : 1);
77
91
  }
78
92
  // --status: show auth status
@@ -6,6 +6,7 @@ export declare const CONFIG_FILE: string;
6
6
  export interface CliConfig {
7
7
  coordinatorProvider?: string;
8
8
  coordinatorModel?: string;
9
+ availableModels?: string[];
9
10
  roles: Record<string, {
10
11
  cli: string;
11
12
  model: string;
package/package.json CHANGED
@@ -1,31 +1 @@
1
- {
2
- "name": "agent-rev",
3
- "version": "0.2.5",
4
- "description": "",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "files": ["dist/"],
8
- "bin": { "agent-rev": "dist/index.js" },
9
- "scripts": {
10
- "build": "tsc && echo '#!/usr/bin/env node' | cat - dist/index.js > dist/index.tmp && mv dist/index.tmp dist/index.js && chmod +x dist/index.js",
11
- "dev": "tsx src/index.ts",
12
- "prepublishOnly": "npm run build"
13
- },
14
- "keywords": ["ai","agent","multi-agent","cli","coding"],
15
- "license": "MIT",
16
- "dependencies": {
17
- "@anthropic-ai/sdk": "^0.39.0",
18
- "@google/generative-ai": "^0.24.0",
19
- "chalk": "^5.4.1",
20
- "commander": "^13.1.0",
21
- "open": "^11.0.0",
22
- "openai": "^4.91.0"
23
- },
24
- "devDependencies": {
25
- "@types/node": "^22.13.0",
26
- "@types/open": "^6.1.0",
27
- "tsx": "^4.19.3",
28
- "typescript": "^5.7.3"
29
- },
30
- "engines": { "node": ">=18.0.0" }
31
- }
1
+ {"name":"agent-rev","version":"0.2.6","description":"agent-rev agent","type":"module","main":"./dist/index.js","files":["dist/"],"bin":{"agent-rev":"dist/index.js"},"scripts":{"build":"tsc && echo '#!/usr/bin/env node' | cat - dist/index.js > dist/index.tmp && mv dist/index.tmp dist/index.js && chmod +x dist/index.js","dev":"tsx src/index.ts","prepublishOnly":"npm run build"},"keywords":["ai","agent","cli"],"license":"MIT","dependencies":{"@anthropic-ai/sdk":"^0.39.0","@google/generative-ai":"^0.24.0","chalk":"^5.4.1","commander":"^13.1.0","open":"^11.0.0","openai":"^4.91.0"},"devDependencies":{"@types/node":"^22.13.0","@types/open":"^6.1.0","tsx":"^4.19.3","typescript":"^5.7.3"},"engines":{"node":">=18.0.0"}}