agent-rev 0.5.14 → 0.5.24

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/dist/index.js CHANGED
@@ -61,8 +61,8 @@ REPL commands (type inside the session):
61
61
  /run orch <task> Run only orchestrator
62
62
  /run impl <id> Run only implementor
63
63
  /run rev <id> Run only reviewer
64
- /login Login (OAuth)
65
- /logout Logout and clear credentials
64
+ /login Configure API key
65
+ /logout Clear API key and credentials
66
66
  /models [cli] List available models
67
67
  /tasks List all tasks
68
68
  /clear Clear screen
@@ -100,25 +100,32 @@ if (nativeRole) {
100
100
  console.log(chalk.dim(` Version: ${PKG_NAME} --version\n`));
101
101
  process.exit(0);
102
102
  }
103
- // --login: OAuth login for this role's account
103
+ // --login: configure API key for this role
104
104
  if (args.includes('--login') || args.includes('login')) {
105
- const { qwenLogin, fetchQwenModels } = await import('./utils/qwen-auth.js');
106
- const { loadCliConfig, saveCliConfig } = await import('./utils/config.js');
107
- const ok = await qwenLogin();
108
- if (ok) {
109
- // Fetch and cache available models so /setup can show them
110
- const models = await fetchQwenModels();
111
- if (models.length) {
112
- const cliConfig = await loadCliConfig();
113
- cliConfig.availableModels = models;
114
- if (!cliConfig.coordinatorModel)
115
- cliConfig.coordinatorModel = models[0];
116
- await saveCliConfig(cliConfig);
117
- console.log(chalk.green(` ✓ Models cached: ${models.slice(0, 3).join(', ')}${models.length > 3 ? '...' : ''}`));
118
- console.log(chalk.dim(` Default model: ${cliConfig.coordinatorModel}`));
119
- }
105
+ const { saveApiKeyConfig, loadApiKeyConfig, DEFAULT_API_BASE_URL } = await import('./utils/qwen-auth.js');
106
+ const rl = (await import('readline')).createInterface({ input: process.stdin, output: process.stdout });
107
+ const ask = (q) => new Promise((res) => rl.question(q, res));
108
+ const existing = await loadApiKeyConfig();
109
+ console.log(chalk.bold.cyan(`\n ${PKG_NAME} API Key Setup\n`));
110
+ if (existing) {
111
+ console.log(chalk.dim(` Current: ${existing.provider} / ${existing.model}`));
112
+ }
113
+ const apiKey = await ask(` API Key${existing ? ' [Enter to keep]' : ''}: `);
114
+ const model = await ask(` Model [${existing?.model ?? 'qwen-plus'}]: `);
115
+ rl.close();
116
+ const cfg = {
117
+ provider: existing?.provider ?? 'openai-compatible',
118
+ api_key: apiKey.trim() || existing?.api_key || '',
119
+ base_url: DEFAULT_API_BASE_URL,
120
+ model: model.trim() || existing?.model || 'qwen-plus',
121
+ };
122
+ if (!cfg.api_key) {
123
+ console.log(chalk.red(' API key is required.'));
124
+ process.exit(1);
120
125
  }
121
- process.exit(ok ? 0 : 1);
126
+ await saveApiKeyConfig(cfg);
127
+ console.log(chalk.green(`\n ✓ API key saved — ${cfg.provider} / ${cfg.model}\n`));
128
+ process.exit(0);
122
129
  }
123
130
  // --status: show auth status
124
131
  if (args.includes('--status') || args.includes('status')) {
@@ -1,41 +1,39 @@
1
+ /**
2
+ * Inline prompt, styled like Gemini/Qwen CLI.
3
+ * Draws at the current cursor line; when output arrives we erase the area
4
+ * (line-by-line, \x1b[2K) and redraw below. No absolute positioning.
5
+ */
1
6
  export declare class FixedInput {
2
- private buf;
3
7
  private history;
4
- private histIdx;
5
8
  private origLog;
6
- private _pasting;
7
- private _pasteAccum;
8
- private _drawPending;
9
9
  private _activityHeader;
10
10
  private _activityLines;
11
- private get rows();
11
+ private _inputBuffer;
12
+ private _cursorPos;
13
+ private _pasting;
14
+ private _pasteAccum;
15
+ private _resolveInput?;
16
+ private _inputActive;
17
+ private _areaRows;
18
+ private _cursorRow;
19
+ private _onResize?;
12
20
  get cols(): number;
13
- private get _reservedRows();
14
- private get scrollBottom();
15
- private _contentRows;
16
21
  setup(): void;
17
22
  teardown(): void;
18
- redrawBox(): void;
19
23
  suspend(): () => void;
20
- /** Enter activity mode: show the 5-line log box instead of the input box. */
21
24
  startActivity(header: string): void;
22
- /** Update the header line (spinner frame + elapsed time) without clearing lines. */
23
25
  updateActivityHeader(header: string): void;
24
- /**
25
- * Append a line to the activity log (keeps last ACTIVITY_LINES lines).
26
- * Strips ANSI codes and skips blank or pure-JSON lines.
27
- */
28
26
  pushActivity(rawLine: string): void;
29
- /** Leave activity mode and restore the normal input box. */
27
+ /** Replace all content lines at once (for streaming preview). */
28
+ setActivityLines(lines: string[]): void;
30
29
  stopActivity(): void;
31
- readLine(): Promise<string>;
32
30
  println(text: string): void;
33
31
  printSeparator(): void;
34
- private _scheduleDraw;
35
- private _setScrollRegion;
36
- private _clearReserved;
37
- private _drawBox;
38
- private _drawActivityBox;
39
- private _drawInputBox;
40
- private _wrapText;
32
+ redrawBox(): void;
33
+ readLine(): Promise<string>;
34
+ private _commitPaste;
35
+ /** Build a string that erases the currently-drawn area and leaves the cursor at col 0 of the top row. */
36
+ private _buildClear;
37
+ private _clearArea;
38
+ private _redraw;
41
39
  }