agent-mp 0.4.10 → 0.4.11

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.
@@ -10,7 +10,7 @@ import { writeJson, ensureDir, readJson, listDir, fileExists } from '../utils/fs
10
10
  import { loadAuth, saveAuth, loadCliConfig, saveCliConfig, loadProjectConfig } from '../utils/config.js';
11
11
  import { log } from '../utils/logger.js';
12
12
  import { AgentEngine, ExitError } from '../core/engine.js';
13
- import { qwenAuthStatus, QWEN_AGENT_HOME, fetchQwenModels } from '../utils/qwen-auth.js';
13
+ import { qwenLogin, qwenAuthStatus, QWEN_AGENT_HOME, fetchQwenModels } from '../utils/qwen-auth.js';
14
14
  import { renderWelcomePanel, renderHelpHint, renderSectionBox, renderMultiSectionBox } from '../ui/theme.js';
15
15
  import { FixedInput } from '../ui/input.js';
16
16
  import { newSession, saveSession } from '../utils/sessions.js';
@@ -258,42 +258,18 @@ function buildCmd(cliName, model) {
258
258
  }
259
259
  async function cmdLogin(rl) {
260
260
  console.log(chalk.bold.cyan('\n Login\n'));
261
- // If active provider is Qwen, do fresh OAuth for corporate account
261
+ // If active provider is Qwen, use built-in OAuth device flow (no qwen CLI needed)
262
262
  const auth = await loadAuth();
263
263
  if (auth.activeProvider === 'qwen') {
264
- console.log(chalk.dim(' Qwen login for corporate account\n'));
265
- console.log(chalk.dim(' Corporate credentials stored in: ~/.agent-cli/\n'));
266
- console.log(chalk.yellow(' IMPORTANT: Use your CORPORATE account when prompted.\n'));
267
- console.log(chalk.yellow(' The browser will open. If you see your personal account,'));
268
- console.log(chalk.yellow(' log out and sign in with your corporate account.\n'));
264
+ console.log(chalk.dim(` Credentials will be saved to: ${QWEN_AGENT_HOME}/\n`));
269
265
  try {
270
- const { execSync } = await import('child_process');
271
- const personalCreds = path.join(os.homedir(), '.qwen', 'oauth_creds.json');
272
- const corporateCreds = path.join(QWEN_AGENT_HOME, 'oauth_creds.json');
273
- // Backup personal credentials
274
- let personalBackup = null;
275
- if (await fileExists(personalCreds)) {
276
- personalBackup = await fs.readFile(personalCreds, 'utf-8');
277
- await fs.unlink(personalCreds);
278
- }
279
- // Remove corporate creds to force fresh login
280
- await fs.unlink(corporateCreds).catch(() => { });
281
- // Login with Qwen CLI - forces fresh login since personal creds are backed up
282
- execSync('qwen auth qwen-oauth', { stdio: 'inherit' });
283
- // Copy NEW credentials to corporate directory
284
- if (await fileExists(personalCreds)) {
285
- const newCreds = await fs.readFile(personalCreds, 'utf-8');
286
- await fs.writeFile(corporateCreds, newCreds);
287
- }
288
- // Restore personal credentials
289
- if (personalBackup) {
290
- await fs.writeFile(personalCreds, personalBackup);
291
- }
266
+ const success = await qwenLogin();
267
+ if (!success)
268
+ return false;
292
269
  const emailInput = await ask(rl, ' Your email (optional, for display): ');
293
270
  auth.entries = auth.entries.filter((e) => e.provider !== 'qwen');
294
271
  auth.entries.push({ provider: 'qwen', method: 'oauth', ...(emailInput.trim() ? { email: emailInput.trim() } : {}) });
295
272
  await saveAuth(auth);
296
- console.log(chalk.green(' Corporate auth recorded'));
297
273
  return true;
298
274
  }
299
275
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-mp",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "Deterministic multi-agent CLI orchestrator — plan, code, review",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",