vigthoria-cli 1.10.47 → 1.10.48
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/commands/auth.js +51 -68
- package/dist/commands/bridge.js +12 -19
- package/dist/commands/cancel.js +15 -22
- package/dist/commands/chat.d.ts +28 -0
- package/dist/commands/config.js +33 -73
- package/dist/commands/deploy.js +83 -123
- package/dist/commands/device.js +21 -61
- package/dist/commands/edit.js +32 -39
- package/dist/commands/explain.js +18 -25
- package/dist/commands/fork.d.ts +17 -0
- package/dist/commands/fork.js +164 -0
- package/dist/commands/generate.js +37 -44
- package/dist/commands/history.d.ts +17 -0
- package/dist/commands/history.js +113 -0
- package/dist/commands/hub.js +95 -102
- package/dist/commands/index.js +41 -46
- package/dist/commands/legion.js +146 -186
- package/dist/commands/preview.d.ts +55 -0
- package/dist/commands/preview.js +467 -0
- package/dist/commands/replay.d.ts +18 -0
- package/dist/commands/replay.js +156 -0
- package/dist/commands/repo.d.ts +97 -0
- package/dist/commands/repo.js +773 -0
- package/dist/commands/review.js +29 -36
- package/dist/commands/security.js +5 -12
- package/dist/commands/update.d.ts +9 -0
- package/dist/commands/update.js +201 -0
- package/dist/commands/wallet.js +28 -35
- package/dist/commands/workflow.js +13 -20
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1826 -0
- package/dist/utils/api.d.ts +572 -0
- package/dist/utils/api.js +6629 -0
- package/dist/utils/brain-hub-client.js +1 -5
- package/dist/utils/bridge-client.js +11 -52
- package/dist/utils/cli-state.d.ts +54 -0
- package/dist/utils/cli-state.js +185 -0
- package/dist/utils/codebase-indexer.js +4 -41
- package/dist/utils/config.d.ts +85 -0
- package/dist/utils/config.js +267 -0
- package/dist/utils/context-ranker.js +15 -21
- package/dist/utils/files.js +5 -42
- package/dist/utils/logger.js +42 -50
- package/dist/utils/persona.js +3 -8
- package/dist/utils/post-write-validator.js +22 -29
- package/dist/utils/project-memory.js +16 -23
- package/dist/utils/session.d.ts +118 -0
- package/dist/utils/session.js +423 -0
- package/dist/utils/task-display.js +13 -20
- package/dist/utils/tools.d.ts +276 -0
- package/dist/utils/tools.js +3522 -0
- package/dist/utils/workspace-brain-service.js +8 -45
- package/dist/utils/workspace-cache.js +18 -26
- package/dist/utils/workspace-stream.js +21 -63
- package/package.json +1 -1
package/dist/commands/auth.js
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.saveAuthConfig = saveAuthConfig;
|
|
8
|
-
exports.clearAuthConfig = clearAuthConfig;
|
|
9
|
-
exports.getAuthToken = getAuthToken;
|
|
10
|
-
exports.login = login;
|
|
11
|
-
exports.logout = logout;
|
|
12
|
-
exports.whoami = whoami;
|
|
13
|
-
exports.doctor = doctor;
|
|
14
|
-
exports.handleLogin = handleLogin;
|
|
15
|
-
exports.handleLogout = handleLogout;
|
|
16
|
-
exports.statusAction = statusAction;
|
|
17
|
-
exports.registerAuthCommands = registerAuthCommands;
|
|
18
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
19
|
-
const fs_1 = require("fs");
|
|
20
|
-
const os_1 = require("os");
|
|
21
|
-
const path_1 = __importDefault(require("path"));
|
|
22
|
-
const readline_1 = __importDefault(require("readline"));
|
|
23
|
-
const config_js_1 = require("../utils/config.js");
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
|
|
3
|
+
import { homedir } from 'os';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import readline from 'readline';
|
|
6
|
+
import { Config } from '../utils/config.js';
|
|
24
7
|
const DEFAULT_API_URL = 'https://coder.vigthoria.io';
|
|
25
|
-
const CONFIG_DIR =
|
|
26
|
-
const CONFIG_FILE =
|
|
8
|
+
const CONFIG_DIR = path.join(homedir(), '.vigthoria');
|
|
9
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
27
10
|
const KNOWN_AUTH_BASE_URLS = ['https://coder.vigthoria.io'];
|
|
28
11
|
class HttpError extends Error {
|
|
29
12
|
status;
|
|
@@ -56,11 +39,11 @@ function getAuthBaseCandidates(seedBaseUrl) {
|
|
|
56
39
|
return uniqueStrings([seed, ...(peer ? [peer] : []), ...KNOWN_AUTH_BASE_URLS]).map(trimTrailingSlash);
|
|
57
40
|
}
|
|
58
41
|
function ensureConfigDir() {
|
|
59
|
-
if (!
|
|
60
|
-
|
|
42
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
43
|
+
mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
61
44
|
}
|
|
62
45
|
try {
|
|
63
|
-
|
|
46
|
+
chmodSync(CONFIG_DIR, 0o700);
|
|
64
47
|
}
|
|
65
48
|
catch {
|
|
66
49
|
// Best-effort on non-POSIX filesystems.
|
|
@@ -68,7 +51,7 @@ function ensureConfigDir() {
|
|
|
68
51
|
}
|
|
69
52
|
function syncSharedConfig(config) {
|
|
70
53
|
try {
|
|
71
|
-
const shared = new
|
|
54
|
+
const shared = new Config();
|
|
72
55
|
shared.set('apiUrl', trimTrailingSlash(config.apiUrl || getApiUrl()));
|
|
73
56
|
if (config.token) {
|
|
74
57
|
shared.set('authToken', config.token);
|
|
@@ -89,7 +72,7 @@ function syncSharedConfig(config) {
|
|
|
89
72
|
}
|
|
90
73
|
function clearSharedConfigAuth() {
|
|
91
74
|
try {
|
|
92
|
-
const shared = new
|
|
75
|
+
const shared = new Config();
|
|
93
76
|
shared.set('authToken', null);
|
|
94
77
|
shared.set('refreshToken', null);
|
|
95
78
|
shared.set('userId', null);
|
|
@@ -137,12 +120,12 @@ function extractAuthUser(payload, fallbackEmail) {
|
|
|
137
120
|
}
|
|
138
121
|
return fallbackEmail ? { email: fallbackEmail } : undefined;
|
|
139
122
|
}
|
|
140
|
-
function loadAuthConfig() {
|
|
141
|
-
if (!
|
|
123
|
+
export function loadAuthConfig() {
|
|
124
|
+
if (!existsSync(CONFIG_FILE)) {
|
|
142
125
|
return { apiUrl: getApiUrl() };
|
|
143
126
|
}
|
|
144
127
|
try {
|
|
145
|
-
const parsed = JSON.parse(
|
|
128
|
+
const parsed = JSON.parse(readFileSync(CONFIG_FILE, 'utf8'));
|
|
146
129
|
return {
|
|
147
130
|
apiUrl: trimTrailingSlash(parsed.apiUrl || getApiUrl()),
|
|
148
131
|
token: parsed.token || parsed.authToken,
|
|
@@ -151,28 +134,28 @@ function loadAuthConfig() {
|
|
|
151
134
|
};
|
|
152
135
|
}
|
|
153
136
|
catch (error) {
|
|
154
|
-
console.warn(
|
|
137
|
+
console.warn(chalk.yellow(`Warning: could not read auth config: ${humanMessage(error)}`));
|
|
155
138
|
return { apiUrl: getApiUrl() };
|
|
156
139
|
}
|
|
157
140
|
}
|
|
158
|
-
function saveAuthConfig(config) {
|
|
141
|
+
export function saveAuthConfig(config) {
|
|
159
142
|
ensureConfigDir();
|
|
160
|
-
|
|
143
|
+
writeFileSync(CONFIG_FILE, `${JSON.stringify(config, null, 2)}\n`, 'utf8');
|
|
161
144
|
try {
|
|
162
|
-
|
|
145
|
+
chmodSync(CONFIG_FILE, 0o600);
|
|
163
146
|
}
|
|
164
147
|
catch {
|
|
165
148
|
// Best-effort on non-POSIX filesystems.
|
|
166
149
|
}
|
|
167
150
|
syncSharedConfig(config);
|
|
168
151
|
}
|
|
169
|
-
function clearAuthConfig() {
|
|
170
|
-
if (
|
|
171
|
-
|
|
152
|
+
export function clearAuthConfig() {
|
|
153
|
+
if (existsSync(CONFIG_FILE)) {
|
|
154
|
+
rmSync(CONFIG_FILE, { force: true });
|
|
172
155
|
}
|
|
173
156
|
clearSharedConfigAuth();
|
|
174
157
|
}
|
|
175
|
-
function getAuthToken() {
|
|
158
|
+
export function getAuthToken() {
|
|
176
159
|
return process.env.VIGTHORIA_TOKEN || loadAuthConfig().token;
|
|
177
160
|
}
|
|
178
161
|
async function requestJson(url, init) {
|
|
@@ -243,7 +226,7 @@ async function fetchV3ServiceKey(apiBase, token) {
|
|
|
243
226
|
return undefined;
|
|
244
227
|
}
|
|
245
228
|
async function ask(question, hidden = false) {
|
|
246
|
-
const rl =
|
|
229
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
247
230
|
if (!hidden) {
|
|
248
231
|
try {
|
|
249
232
|
return await new Promise((resolve) => rl.question(question, resolve));
|
|
@@ -282,7 +265,7 @@ function markSuccessExit() {
|
|
|
282
265
|
function markErrorExit() {
|
|
283
266
|
process.exitCode = 1;
|
|
284
267
|
}
|
|
285
|
-
async function login(email, password) {
|
|
268
|
+
export async function login(email, password) {
|
|
286
269
|
try {
|
|
287
270
|
const resolvedEmail = (email || '').trim();
|
|
288
271
|
const resolvedPassword = password || '';
|
|
@@ -339,7 +322,7 @@ async function login(email, password) {
|
|
|
339
322
|
throw new Error(message);
|
|
340
323
|
}
|
|
341
324
|
}
|
|
342
|
-
async function logout() {
|
|
325
|
+
export async function logout() {
|
|
343
326
|
const config = loadAuthConfig();
|
|
344
327
|
if (config.token) {
|
|
345
328
|
const bases = getAuthBaseCandidates(config.apiUrl || getApiUrl());
|
|
@@ -364,13 +347,13 @@ async function logout() {
|
|
|
364
347
|
}
|
|
365
348
|
}
|
|
366
349
|
if (!remoteLogoutDone) {
|
|
367
|
-
console.warn(
|
|
350
|
+
console.warn(chalk.yellow('Remote logout endpoint not reachable; local credentials were still cleared.'));
|
|
368
351
|
}
|
|
369
352
|
}
|
|
370
353
|
clearAuthConfig();
|
|
371
354
|
process.exitCode = 0;
|
|
372
355
|
}
|
|
373
|
-
async function whoami() {
|
|
356
|
+
export async function whoami() {
|
|
374
357
|
const config = loadAuthConfig();
|
|
375
358
|
if (!config.token) {
|
|
376
359
|
return undefined;
|
|
@@ -418,7 +401,7 @@ async function whoami() {
|
|
|
418
401
|
}
|
|
419
402
|
throw new Error(`Unable to verify account on known auth endpoints. Tried ${attempted.join(', ')}`);
|
|
420
403
|
}
|
|
421
|
-
async function doctor() {
|
|
404
|
+
export async function doctor() {
|
|
422
405
|
const config = loadAuthConfig();
|
|
423
406
|
const report = {
|
|
424
407
|
nodeVersion: process.version,
|
|
@@ -431,7 +414,7 @@ async function doctor() {
|
|
|
431
414
|
process.exitCode = 0;
|
|
432
415
|
return report;
|
|
433
416
|
}
|
|
434
|
-
async function handleLogin(options = {}) {
|
|
417
|
+
export async function handleLogin(options = {}) {
|
|
435
418
|
try {
|
|
436
419
|
if (options.token) {
|
|
437
420
|
const config = {
|
|
@@ -444,14 +427,14 @@ async function handleLogin(options = {}) {
|
|
|
444
427
|
config.v3ServiceKey = v3ServiceKey;
|
|
445
428
|
}
|
|
446
429
|
saveAuthConfig(config);
|
|
447
|
-
console.log(
|
|
430
|
+
console.log(chalk.green('Logged in successfully with API token.'));
|
|
448
431
|
process.exitCode = 0;
|
|
449
432
|
return config;
|
|
450
433
|
}
|
|
451
434
|
let email = options.email?.trim();
|
|
452
435
|
let password = options.password;
|
|
453
436
|
if (options.device) {
|
|
454
|
-
console.log(
|
|
437
|
+
console.log(chalk.yellow('Device-code login is not enabled by this Vigthoria service. Falling back to email and password authentication.'));
|
|
455
438
|
}
|
|
456
439
|
if (!email) {
|
|
457
440
|
email = (await ask('Email: ')).trim();
|
|
@@ -463,7 +446,7 @@ async function handleLogin(options = {}) {
|
|
|
463
446
|
throw new Error('Email and password are required. Use --email and --password, or run vigthoria login interactively.');
|
|
464
447
|
}
|
|
465
448
|
const config = await login(email, password);
|
|
466
|
-
console.log(
|
|
449
|
+
console.log(chalk.green('Logged in successfully.'));
|
|
467
450
|
if (config.user?.email) {
|
|
468
451
|
console.log(`Account: ${config.user.email}`);
|
|
469
452
|
}
|
|
@@ -489,7 +472,7 @@ async function handleLogin(options = {}) {
|
|
|
489
472
|
}
|
|
490
473
|
catch { /* non-fatal — login already succeeded */ }
|
|
491
474
|
try {
|
|
492
|
-
const sharedConfig = new
|
|
475
|
+
const sharedConfig = new Config();
|
|
493
476
|
await sharedConfig.refreshHubModelPreferences();
|
|
494
477
|
const hubPrefs = sharedConfig.get('hubModelPrefs');
|
|
495
478
|
if (hubPrefs?.balance !== undefined) {
|
|
@@ -502,32 +485,32 @@ async function handleLogin(options = {}) {
|
|
|
502
485
|
return config;
|
|
503
486
|
}
|
|
504
487
|
catch (error) {
|
|
505
|
-
console.error(
|
|
488
|
+
console.error(chalk.red(`Login failed: ${humanMessage(error)}`));
|
|
506
489
|
process.exitCode = 1;
|
|
507
490
|
return undefined;
|
|
508
491
|
}
|
|
509
492
|
}
|
|
510
|
-
async function handleLogout(_options) {
|
|
493
|
+
export async function handleLogout(_options) {
|
|
511
494
|
try {
|
|
512
495
|
await logout();
|
|
513
|
-
console.log(
|
|
496
|
+
console.log(chalk.green('Logged out successfully.'));
|
|
514
497
|
process.exitCode = 0;
|
|
515
498
|
}
|
|
516
499
|
catch (error) {
|
|
517
|
-
console.error(
|
|
500
|
+
console.error(chalk.red(`Logout failed: ${humanMessage(error)}`));
|
|
518
501
|
process.exitCode = 1;
|
|
519
502
|
}
|
|
520
503
|
}
|
|
521
|
-
async function statusAction() {
|
|
504
|
+
export async function statusAction() {
|
|
522
505
|
try {
|
|
523
506
|
const legacyConfig = loadAuthConfig();
|
|
524
|
-
const sharedConfig = new
|
|
507
|
+
const sharedConfig = new Config();
|
|
525
508
|
const sharedApiUrl = String(sharedConfig.get('apiUrl') || '').trim();
|
|
526
509
|
const sharedToken = String(sharedConfig.get('authToken') || '').trim();
|
|
527
510
|
const effectiveApiUrl = trimTrailingSlash(sharedApiUrl || legacyConfig.apiUrl || getApiUrl());
|
|
528
511
|
const effectiveToken = sharedToken || legacyConfig.token || '';
|
|
529
512
|
if (!effectiveToken) {
|
|
530
|
-
console.log(
|
|
513
|
+
console.log(chalk.yellow('Not logged in.'));
|
|
531
514
|
process.exitCode = 0;
|
|
532
515
|
return;
|
|
533
516
|
}
|
|
@@ -546,8 +529,8 @@ async function statusAction() {
|
|
|
546
529
|
// Network failures should not force logout status.
|
|
547
530
|
}
|
|
548
531
|
if (!authLooksValid) {
|
|
549
|
-
console.log(
|
|
550
|
-
console.log(
|
|
532
|
+
console.log(chalk.yellow('Not logged in. Session expired or invalid.'));
|
|
533
|
+
console.log(chalk.gray('Run: vigthoria login'));
|
|
551
534
|
process.exitCode = 1;
|
|
552
535
|
return;
|
|
553
536
|
}
|
|
@@ -579,8 +562,8 @@ async function statusAction() {
|
|
|
579
562
|
// Status should still render even if health probes fail.
|
|
580
563
|
}
|
|
581
564
|
const plan = String(sharedConfig.get('subscription')?.plan || '').trim();
|
|
582
|
-
console.log(
|
|
583
|
-
console.log(
|
|
565
|
+
console.log(chalk.white('Account Status'));
|
|
566
|
+
console.log(chalk.green('Logged in.'));
|
|
584
567
|
if (user?.email) {
|
|
585
568
|
console.log(`Account: ${user.email}`);
|
|
586
569
|
}
|
|
@@ -594,11 +577,11 @@ async function statusAction() {
|
|
|
594
577
|
process.exitCode = 0;
|
|
595
578
|
}
|
|
596
579
|
catch (error) {
|
|
597
|
-
console.error(
|
|
580
|
+
console.error(chalk.red(`Unable to read status: ${humanMessage(error)}`));
|
|
598
581
|
process.exitCode = 1;
|
|
599
582
|
}
|
|
600
583
|
}
|
|
601
|
-
function registerAuthCommands(program) {
|
|
584
|
+
export function registerAuthCommands(program) {
|
|
602
585
|
const auth = program.command('auth').description('Manage Vigthoria CLI authentication');
|
|
603
586
|
auth
|
|
604
587
|
.command('login')
|
|
@@ -623,16 +606,16 @@ function registerAuthCommands(program) {
|
|
|
623
606
|
try {
|
|
624
607
|
const user = await whoami();
|
|
625
608
|
if (!user) {
|
|
626
|
-
console.log(
|
|
609
|
+
console.log(chalk.yellow('Not logged in.'));
|
|
627
610
|
process.exitCode = 0;
|
|
628
611
|
return;
|
|
629
612
|
}
|
|
630
|
-
console.log(
|
|
613
|
+
console.log(chalk.green('Logged in.'));
|
|
631
614
|
console.log(user.email || user.name || user.id || 'Authenticated user');
|
|
632
615
|
process.exitCode = 0;
|
|
633
616
|
}
|
|
634
617
|
catch (error) {
|
|
635
|
-
console.error(
|
|
618
|
+
console.error(chalk.red(`Unable to fetch account: ${humanMessage(error)}`));
|
|
636
619
|
process.exitCode = 1;
|
|
637
620
|
}
|
|
638
621
|
});
|
package/dist/commands/bridge.js
CHANGED
|
@@ -1,34 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BridgeCommand = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const logger_js_1 = require("../utils/logger.js");
|
|
9
|
-
const api_js_1 = require("../utils/api.js");
|
|
10
|
-
class BridgeCommand {
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { createSpinner } from '../utils/logger.js';
|
|
3
|
+
import { APIClient } from '../utils/api.js';
|
|
4
|
+
export class BridgeCommand {
|
|
11
5
|
api;
|
|
12
6
|
constructor(config, logger) {
|
|
13
|
-
this.api = new
|
|
7
|
+
this.api = new APIClient(config, logger);
|
|
14
8
|
}
|
|
15
9
|
async status() {
|
|
16
|
-
const spinner =
|
|
10
|
+
const spinner = createSpinner('Checking DevTools Bridge...').start();
|
|
17
11
|
const bridge = await this.api.getDevtoolsBridgeStatus();
|
|
18
12
|
spinner.stop();
|
|
19
13
|
console.log();
|
|
20
|
-
console.log(
|
|
21
|
-
console.log(
|
|
14
|
+
console.log(chalk.white('DevTools Bridge:'));
|
|
15
|
+
console.log(chalk.gray(' Status: ') + (bridge.ok ? chalk.green('Reachable') : chalk.yellow('Not running')));
|
|
22
16
|
if (!bridge.ok) {
|
|
23
17
|
const detail = String(bridge.error || 'Connection refused').trim() || 'Connection refused';
|
|
24
|
-
console.log(
|
|
18
|
+
console.log(chalk.gray(' Error: ') + chalk.yellow(detail));
|
|
25
19
|
}
|
|
26
|
-
console.log(
|
|
27
|
-
?
|
|
28
|
-
:
|
|
20
|
+
console.log(chalk.gray(' Browser tasks: ') + (bridge.ok
|
|
21
|
+
? chalk.green('Local browser observability is available for debugging flows.')
|
|
22
|
+
: chalk.gray('Start the DevTools Bridge to enable local browser observability.')));
|
|
29
23
|
console.log();
|
|
30
24
|
this.api.destroy();
|
|
31
25
|
process.exitCode = 0;
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
|
-
exports.BridgeCommand = BridgeCommand;
|
package/dist/commands/cancel.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CancelCommand = void 0;
|
|
7
|
-
const api_js_1 = require("../utils/api.js");
|
|
1
|
+
import { isServerRuntime } from '../utils/api.js';
|
|
8
2
|
/**
|
|
9
3
|
* cancel.ts — Cancel an in-flight V3 agent run, or cancel all active runs.
|
|
10
4
|
*
|
|
@@ -13,9 +7,9 @@ const api_js_1 = require("../utils/api.js");
|
|
|
13
7
|
* vig cancel --all Cancel every currently-active run
|
|
14
8
|
* vig cancel --list Just list active runs (no cancellation)
|
|
15
9
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class CancelCommand {
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { createSpinner, CH } from '../utils/logger.js';
|
|
12
|
+
export class CancelCommand {
|
|
19
13
|
config;
|
|
20
14
|
logger;
|
|
21
15
|
constructor(config, logger) {
|
|
@@ -38,7 +32,7 @@ class CancelCommand {
|
|
|
38
32
|
}
|
|
39
33
|
getBaseUrl() {
|
|
40
34
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
41
|
-
const allowLocal = !
|
|
35
|
+
const allowLocal = !isServerRuntime() || process.env.VIGTHORIA_ALLOW_LOCAL_V3_AGENT === '1';
|
|
42
36
|
return (process.env.VIGTHORIA_V3_AGENT_URL ||
|
|
43
37
|
process.env.V3_AGENT_URL ||
|
|
44
38
|
(allowLocal ? 'http://127.0.0.1:8030' : null) ||
|
|
@@ -80,7 +74,7 @@ class CancelCommand {
|
|
|
80
74
|
async run(contextId, options) {
|
|
81
75
|
const baseUrl = this.getBaseUrl();
|
|
82
76
|
if (options.list) {
|
|
83
|
-
const spinner =
|
|
77
|
+
const spinner = createSpinner('Loading active runs...').start();
|
|
84
78
|
const active = await this.listActive(baseUrl);
|
|
85
79
|
spinner.stop();
|
|
86
80
|
if (!active)
|
|
@@ -90,34 +84,34 @@ class CancelCommand {
|
|
|
90
84
|
return;
|
|
91
85
|
}
|
|
92
86
|
if (active.active_count === 0) {
|
|
93
|
-
this.logger.info(
|
|
87
|
+
this.logger.info(chalk.dim('No active runs.'));
|
|
94
88
|
return;
|
|
95
89
|
}
|
|
96
|
-
console.log(
|
|
90
|
+
console.log(chalk.bold(`\n${CH.success} Active Runs (${active.active_count}/${active.max_concurrent_runs})\n`));
|
|
97
91
|
for (const cid of active.active_context_ids) {
|
|
98
|
-
console.log(` ${
|
|
92
|
+
console.log(` ${chalk.cyan(cid)}`);
|
|
99
93
|
}
|
|
100
94
|
console.log();
|
|
101
95
|
return;
|
|
102
96
|
}
|
|
103
97
|
if (options.all) {
|
|
104
|
-
const spinner =
|
|
98
|
+
const spinner = createSpinner('Loading active runs...').start();
|
|
105
99
|
const active = await this.listActive(baseUrl);
|
|
106
100
|
spinner.stop();
|
|
107
101
|
if (!active)
|
|
108
102
|
return;
|
|
109
103
|
if (active.active_count === 0) {
|
|
110
|
-
this.logger.info(
|
|
104
|
+
this.logger.info(chalk.dim('No active runs to cancel.'));
|
|
111
105
|
return;
|
|
112
106
|
}
|
|
113
107
|
const results = [];
|
|
114
108
|
for (const cid of active.active_context_ids) {
|
|
115
|
-
const sp =
|
|
109
|
+
const sp = createSpinner(`Cancelling ${cid}...`).start();
|
|
116
110
|
const r = await this.cancelOne(baseUrl, cid);
|
|
117
111
|
sp.stop();
|
|
118
112
|
if (r) {
|
|
119
113
|
results.push(r);
|
|
120
|
-
this.logger.success(`Cancelled ${
|
|
114
|
+
this.logger.success(`Cancelled ${chalk.cyan(cid)} (asyncio_cancelled=${r.asyncio_cancelled})`);
|
|
121
115
|
}
|
|
122
116
|
}
|
|
123
117
|
if (options.json)
|
|
@@ -128,7 +122,7 @@ class CancelCommand {
|
|
|
128
122
|
this.logger.error('Usage: vig cancel <context_id> | --all | --list');
|
|
129
123
|
return;
|
|
130
124
|
}
|
|
131
|
-
const spinner =
|
|
125
|
+
const spinner = createSpinner(`Cancelling ${contextId}...`).start();
|
|
132
126
|
const r = await this.cancelOne(baseUrl, contextId);
|
|
133
127
|
spinner.stop();
|
|
134
128
|
if (!r)
|
|
@@ -137,8 +131,7 @@ class CancelCommand {
|
|
|
137
131
|
console.log(JSON.stringify(r, null, 2));
|
|
138
132
|
return;
|
|
139
133
|
}
|
|
140
|
-
this.logger.success(`Cancelled ${
|
|
134
|
+
this.logger.success(`Cancelled ${chalk.cyan(contextId)} ` +
|
|
141
135
|
`(asyncio_cancelled=${r.asyncio_cancelled}, active_runs_after=${r.active_runs_after})`);
|
|
142
136
|
}
|
|
143
137
|
}
|
|
144
|
-
exports.CancelCommand = CancelCommand;
|
package/dist/commands/chat.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class ChatCommand {
|
|
|
26
26
|
private tools;
|
|
27
27
|
private sessionManager;
|
|
28
28
|
private projectMemory;
|
|
29
|
+
private workspaceBrain;
|
|
29
30
|
private currentSession;
|
|
30
31
|
private agentMode;
|
|
31
32
|
private currentProjectPath;
|
|
@@ -61,6 +62,10 @@ export declare class ChatCommand {
|
|
|
61
62
|
private isLegacyAgentFallbackAllowed;
|
|
62
63
|
private resolveAgentExecutionPolicy;
|
|
63
64
|
private getMessagesForModel;
|
|
65
|
+
private normalizeClientV3ToolPath;
|
|
66
|
+
private resolveClientV3ToolPath;
|
|
67
|
+
private normalizeClientV3ToolArgs;
|
|
68
|
+
private executeClientV3Tool;
|
|
64
69
|
private getActivePersonaMode;
|
|
65
70
|
private buildActivePersonaOverlay;
|
|
66
71
|
private isDiagnosticPrompt;
|
|
@@ -69,6 +74,9 @@ export declare class ChatCommand {
|
|
|
69
74
|
* question — these should use analysis_only workflow, not full_autonomy.
|
|
70
75
|
*/
|
|
71
76
|
private isAnalysisLookupPrompt;
|
|
77
|
+
private isImplementationPrompt;
|
|
78
|
+
private getWindowsPromptPathRoots;
|
|
79
|
+
private findPromptDirectoryByName;
|
|
72
80
|
private extractExplicitLocalPath;
|
|
73
81
|
private isUnscopedPromptPathOverrideAllowed;
|
|
74
82
|
private isPathWithinRoot;
|
|
@@ -90,16 +98,24 @@ export declare class ChatCommand {
|
|
|
90
98
|
*/
|
|
91
99
|
private isRepoGroundedPrompt;
|
|
92
100
|
private inferAgentTaskType;
|
|
101
|
+
private bindPromptWorkspace;
|
|
93
102
|
private buildTaskShapingInstructions;
|
|
94
103
|
private buildExecutionPrompt;
|
|
95
104
|
private isProjectBrainRuntimeDisabled;
|
|
96
105
|
private buildProjectBrainRuntimeContext;
|
|
97
106
|
private rememberBrainEvent;
|
|
107
|
+
private initializeWorkspaceBrain;
|
|
108
|
+
private bootstrapWorkspaceBrain;
|
|
109
|
+
private reindexWorkspaceBrain;
|
|
110
|
+
private showBrainIndexStatus;
|
|
98
111
|
private getPromptRuntimeContext;
|
|
99
112
|
private v3IterationCount;
|
|
100
113
|
private v3ToolCallCount;
|
|
101
114
|
private v3LastActivity;
|
|
102
115
|
private v3StreamingStarted;
|
|
116
|
+
private v3StreamedTextBuffer;
|
|
117
|
+
private v3LiveToolEvidence;
|
|
118
|
+
private v3PendingToolCalls;
|
|
103
119
|
/**
|
|
104
120
|
* Strip server-internal path prefixes from tool output strings.
|
|
105
121
|
* Prevents exposing paths like /var/www/V3-Code-Agent/... to end users.
|
|
@@ -110,6 +126,13 @@ export declare class ChatCommand {
|
|
|
110
126
|
private isRawV3StreamPayload;
|
|
111
127
|
private consumeV3StreamPayload;
|
|
112
128
|
private writeV3StreamText;
|
|
129
|
+
private isGenericV3AgentContent;
|
|
130
|
+
private hasAlreadyStreamedV3Content;
|
|
131
|
+
private isThinV3Summary;
|
|
132
|
+
private shouldPrintV3FinalContent;
|
|
133
|
+
private rememberV3ToolEvidence;
|
|
134
|
+
private buildUserFacingV3RunReport;
|
|
135
|
+
private printV3UserReport;
|
|
113
136
|
private updateV3AgentSpinner;
|
|
114
137
|
private updateOperatorSpinner;
|
|
115
138
|
constructor(config: Config, logger: Logger);
|
|
@@ -145,7 +168,11 @@ export declare class ChatCommand {
|
|
|
145
168
|
private runOperatorDirectAnswer;
|
|
146
169
|
private runSimplePrompt;
|
|
147
170
|
private runAgentTurn;
|
|
171
|
+
private localAgentIterationCount;
|
|
172
|
+
private buildLocalAgentChatOptions;
|
|
173
|
+
private printChatModelPreflight;
|
|
148
174
|
private runLocalAgentLoop;
|
|
175
|
+
private primeAgentWorkspaceDiscovery;
|
|
149
176
|
private primeBypassedTargetFileContext;
|
|
150
177
|
private tryDirectSingleFileFlow;
|
|
151
178
|
private isConfirmationFollowUp;
|
|
@@ -222,6 +249,7 @@ export declare class ChatCommand {
|
|
|
222
249
|
private buildLocalAnalysisFallback;
|
|
223
250
|
private tryDeterministicSingleFileRewrite;
|
|
224
251
|
private extractExactTextRequirement;
|
|
252
|
+
private tryLocalToolFallback;
|
|
225
253
|
private executeToolCalls;
|
|
226
254
|
private formatToolResult;
|
|
227
255
|
private truncateText;
|