agent-rev 0.2.5 → 0.2.7

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
@@ -3,17 +3,33 @@ import { Command } from 'commander';
3
3
  import * as path from 'path';
4
4
  import * as os from 'os';
5
5
  import * as fs from 'fs/promises';
6
+ import * as fsSync from 'fs';
6
7
  import * as readline from 'readline';
7
8
  import chalk from 'chalk';
8
9
  import { AGENT_HOME, PKG_NAME } from './utils/config.js';
9
10
  import { runRepl, runRole } from './commands/repl.js';
10
11
  import { setupCommand } from './commands/setup.js';
11
12
  import { getLastSessionForDir, listSessions, loadSession } from './utils/sessions.js';
13
+ // Read version from package.json at runtime
14
+ function readVersion() {
15
+ const __filename = new URL(import.meta.url).pathname;
16
+ const __dirname = path.dirname(__filename);
17
+ for (const p of [
18
+ path.join(__dirname, '..', 'package.json'),
19
+ path.join(__dirname, '..', '..', 'package.json'),
20
+ ]) {
21
+ try {
22
+ return JSON.parse(fsSync.readFileSync(p, 'utf-8')).version || '0.0.0';
23
+ }
24
+ catch { }
25
+ }
26
+ return '0.0.0';
27
+ }
12
28
  const program = new Command();
13
29
  program
14
- .name('agent-mp')
30
+ .name(PKG_NAME)
15
31
  .description('Deterministic multi-agent CLI orchestrator')
16
- .version('0.1.0')
32
+ .version(readVersion())
17
33
  .argument('[task...]', 'Task description or arguments')
18
34
  .option('--continue', 'Resume the last session in the current directory')
19
35
  .option('--resume [id]', 'Resume any saved session by ID (omit ID to pick from list)')
@@ -71,8 +87,22 @@ if (nativeRole) {
71
87
  const args = process.argv.slice(2);
72
88
  // --login: OAuth login for this role's account
73
89
  if (args.includes('--login') || args.includes('login')) {
74
- const { qwenLogin } = await import('./utils/qwen-auth.js');
90
+ const { qwenLogin, fetchQwenModels } = await import('./utils/qwen-auth.js');
91
+ const { loadCliConfig, saveCliConfig } = await import('./utils/config.js');
75
92
  const ok = await qwenLogin();
93
+ if (ok) {
94
+ // Fetch and cache available models so /setup can show them
95
+ const models = await fetchQwenModels();
96
+ if (models.length) {
97
+ const cliConfig = await loadCliConfig();
98
+ cliConfig.availableModels = models;
99
+ if (!cliConfig.coordinatorModel)
100
+ cliConfig.coordinatorModel = models[0];
101
+ await saveCliConfig(cliConfig);
102
+ console.log(chalk.green(` ✓ Models cached: ${models.slice(0, 3).join(', ')}${models.length > 3 ? '...' : ''}`));
103
+ console.log(chalk.dim(` Default model: ${cliConfig.coordinatorModel}`));
104
+ }
105
+ }
76
106
  process.exit(ok ? 0 : 1);
77
107
  }
78
108
  // --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.7","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"}}