vigthoria-cli 1.10.49 → 1.10.51
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/agent-session-menu.js +101 -90
- package/dist/commands/chat.js +38 -4
- package/dist/utils/api.js +18 -0
- package/package.json +1 -1
|
@@ -41,6 +41,40 @@ export function shouldShowAgentSessionMenu(options = {}) {
|
|
|
41
41
|
}
|
|
42
42
|
return Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
43
43
|
}
|
|
44
|
+
async function promptSessionSettings(session) {
|
|
45
|
+
const settings = await inquirer.prompt([
|
|
46
|
+
{
|
|
47
|
+
type: 'confirm',
|
|
48
|
+
name: 'debugMode',
|
|
49
|
+
message: 'Enable debug mode (verbose logging)?',
|
|
50
|
+
default: session.debugMode,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'confirm',
|
|
54
|
+
name: 'autoSave',
|
|
55
|
+
message: 'Auto-save session on exit?',
|
|
56
|
+
default: session.autoSave,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'confirm',
|
|
60
|
+
name: 'autoApprove',
|
|
61
|
+
message: 'Auto-approve tool actions (dangerous)?',
|
|
62
|
+
default: session.autoApprove,
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
Object.assign(session, settings);
|
|
66
|
+
}
|
|
67
|
+
async function confirmSettingsStep() {
|
|
68
|
+
const { configureSettings } = await inquirer.prompt([
|
|
69
|
+
{
|
|
70
|
+
type: 'confirm',
|
|
71
|
+
name: 'configureSettings',
|
|
72
|
+
message: 'Configure debug, auto-save and auto-approve now?',
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
75
|
+
]);
|
|
76
|
+
return configureSettings;
|
|
77
|
+
}
|
|
44
78
|
export async function runAgentSessionMenu(defaults = {}) {
|
|
45
79
|
const session = {
|
|
46
80
|
workspacePath: path.resolve(String(defaults.workspacePath || process.cwd())),
|
|
@@ -48,102 +82,79 @@ export async function runAgentSessionMenu(defaults = {}) {
|
|
|
48
82
|
autoApprove: defaults.autoApprove === true,
|
|
49
83
|
autoSave: defaults.autoSave !== false,
|
|
50
84
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(chalk.cyan('═══ Agent Session Setup ═══'));
|
|
87
|
+
console.log(chalk.gray(`Workspace: ${session.workspacePath}`));
|
|
88
|
+
console.log(chalk.gray(`Debug: ${session.debugMode ? 'on' : 'off'} | Auto-approve: ${session.autoApprove ? 'on' : 'off'} | Auto-save: ${session.autoSave ? 'on' : 'off'}`));
|
|
89
|
+
console.log();
|
|
90
|
+
const { action } = await inquirer.prompt([
|
|
91
|
+
{
|
|
92
|
+
type: 'list',
|
|
93
|
+
name: 'action',
|
|
94
|
+
message: 'Configure your session',
|
|
95
|
+
choices: [
|
|
96
|
+
{ name: 'Start session with current settings', value: 'start' },
|
|
97
|
+
{ name: 'Set workspace path (existing directory)', value: 'set-workspace' },
|
|
98
|
+
{ name: 'Create new directory and set as workspace', value: 'create-workspace' },
|
|
99
|
+
{ name: 'Session settings (debug, auto-save, auto-approve)', value: 'settings' },
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
]);
|
|
103
|
+
if (action === 'set-workspace') {
|
|
104
|
+
const { workspacePath } = await inquirer.prompt([
|
|
67
105
|
{
|
|
68
|
-
type: '
|
|
69
|
-
name: '
|
|
70
|
-
message: '
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{ name: 'Create new directory and set as workspace', value: 'create-workspace' },
|
|
74
|
-
{ name: 'Session settings (debug, auto-save, auto-approve)', value: 'settings' },
|
|
75
|
-
{ name: 'Start session with current settings', value: 'start' },
|
|
76
|
-
],
|
|
106
|
+
type: 'input',
|
|
107
|
+
name: 'workspacePath',
|
|
108
|
+
message: 'Workspace directory path:',
|
|
109
|
+
default: session.workspacePath,
|
|
110
|
+
validate: validateExistingDirectory,
|
|
77
111
|
},
|
|
78
112
|
]);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
type: 'input',
|
|
83
|
-
name: 'workspacePath',
|
|
84
|
-
message: 'Workspace directory path:',
|
|
85
|
-
default: session.workspacePath,
|
|
86
|
-
validate: validateExistingDirectory,
|
|
87
|
-
},
|
|
88
|
-
]);
|
|
89
|
-
session.workspacePath = path.resolve(workspacePath);
|
|
113
|
+
session.workspacePath = path.resolve(workspacePath);
|
|
114
|
+
if (await confirmSettingsStep()) {
|
|
115
|
+
await promptSessionSettings(session);
|
|
90
116
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
]);
|
|
116
|
-
const target = path.join(path.resolve(basePath), String(folderName).trim());
|
|
117
|
-
fs.mkdirSync(target, { recursive: true });
|
|
118
|
-
session.workspacePath = target;
|
|
119
|
-
console.log(chalk.green(`Created workspace: ${target}`));
|
|
120
|
-
}
|
|
121
|
-
else if (action === 'settings') {
|
|
122
|
-
const settings = await inquirer.prompt([
|
|
123
|
-
{
|
|
124
|
-
type: 'confirm',
|
|
125
|
-
name: 'debugMode',
|
|
126
|
-
message: 'Enable debug mode (verbose logging)?',
|
|
127
|
-
default: session.debugMode,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
type: 'confirm',
|
|
131
|
-
name: 'autoSave',
|
|
132
|
-
message: 'Auto-save session on exit?',
|
|
133
|
-
default: session.autoSave,
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
type: 'confirm',
|
|
137
|
-
name: 'autoApprove',
|
|
138
|
-
message: 'Auto-approve tool actions (dangerous)?',
|
|
139
|
-
default: session.autoApprove,
|
|
117
|
+
}
|
|
118
|
+
else if (action === 'create-workspace') {
|
|
119
|
+
const { basePath, folderName } = await inquirer.prompt([
|
|
120
|
+
{
|
|
121
|
+
type: 'input',
|
|
122
|
+
name: 'basePath',
|
|
123
|
+
message: 'Base directory:',
|
|
124
|
+
default: os.homedir(),
|
|
125
|
+
validate: validateExistingDirectory,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'input',
|
|
129
|
+
name: 'folderName',
|
|
130
|
+
message: 'New folder name:',
|
|
131
|
+
validate: (value) => {
|
|
132
|
+
const trimmed = String(value || '').trim();
|
|
133
|
+
if (!trimmed) {
|
|
134
|
+
return 'Folder name is required.';
|
|
135
|
+
}
|
|
136
|
+
if (/[<>:"|?*\x00]/.test(trimmed)) {
|
|
137
|
+
return 'Folder name contains invalid characters.';
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
140
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
const target = path.join(path.resolve(basePath), String(folderName).trim());
|
|
144
|
+
fs.mkdirSync(target, { recursive: true });
|
|
145
|
+
session.workspacePath = target;
|
|
146
|
+
console.log(chalk.green(`Created workspace: ${target}`));
|
|
147
|
+
if (await confirmSettingsStep()) {
|
|
148
|
+
await promptSessionSettings(session);
|
|
146
149
|
}
|
|
147
150
|
}
|
|
151
|
+
else if (action === 'settings') {
|
|
152
|
+
await promptSessionSettings(session);
|
|
153
|
+
}
|
|
154
|
+
console.log();
|
|
155
|
+
console.log(chalk.cyan('── Session ready ──'));
|
|
156
|
+
console.log(chalk.gray(`Workspace: ${session.workspacePath}`));
|
|
157
|
+
console.log(chalk.gray(`Debug: ${session.debugMode ? 'on' : 'off'} | Auto-approve: ${session.autoApprove ? 'on' : 'off'} | Auto-save: ${session.autoSave ? 'on' : 'off'}`));
|
|
158
|
+
console.log();
|
|
148
159
|
return session;
|
|
149
160
|
}
|
package/dist/commands/chat.js
CHANGED
|
@@ -918,6 +918,30 @@ export class ChatCommand {
|
|
|
918
918
|
spinner.text = 'Vigthoria Executor running...';
|
|
919
919
|
return;
|
|
920
920
|
}
|
|
921
|
+
if (event.type === 'model_call_start') {
|
|
922
|
+
if (spinner.isSpinning)
|
|
923
|
+
spinner.stop();
|
|
924
|
+
const model = this.sanitizeServerPath(String(event.model || 'model'));
|
|
925
|
+
const iter = event.iteration ? ` iteration ${event.iteration}` : '';
|
|
926
|
+
const msgCount = Number.isFinite(Number(event.message_count)) ? `, ${event.message_count} messages` : '';
|
|
927
|
+
const toolCount = Number.isFinite(Number(event.tool_count)) ? `, ${event.tool_count} tools available` : '';
|
|
928
|
+
process.stderr.write(chalk.cyan(' [Model] ') + `${model}${iter}: thinking${msgCount}${toolCount}\n`);
|
|
929
|
+
spinner.start();
|
|
930
|
+
spinner.text = `Model ${model} is reasoning...`;
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
if (event.type === 'model_call_complete') {
|
|
934
|
+
if (spinner.isSpinning)
|
|
935
|
+
spinner.stop();
|
|
936
|
+
const model = this.sanitizeServerPath(String(event.model || 'model'));
|
|
937
|
+
const toolCalls = Number.isFinite(Number(event.tool_calls)) ? Number(event.tool_calls) : 0;
|
|
938
|
+
const chars = Number.isFinite(Number(event.content_chars)) ? Number(event.content_chars) : 0;
|
|
939
|
+
const finish = event.finish_reason ? `, ${this.sanitizeServerPath(String(event.finish_reason))}` : '';
|
|
940
|
+
process.stderr.write(chalk.cyan(' [Model] ') + `${model}: produced ${toolCalls} tool call${toolCalls === 1 ? '' : 's'}${chars ? `, ${chars} chars` : ''}${finish}\n`);
|
|
941
|
+
spinner.start();
|
|
942
|
+
spinner.text = toolCalls > 0 ? 'Executing model-selected tools...' : 'Processing model response...';
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
921
945
|
if (event.type === 'executor_error') {
|
|
922
946
|
if (spinner.isSpinning)
|
|
923
947
|
spinner.stop();
|
|
@@ -2245,7 +2269,13 @@ export class ChatCommand {
|
|
|
2245
2269
|
return /^(ja|ja bitte|ja bitte mach das|mach das|bitte mach das|genau|ok|okay|yes|yes please|please do|do it|go ahead|continue|proceed|make it so)$/.test(normalized);
|
|
2246
2270
|
}
|
|
2247
2271
|
taskRequiresWorkspaceChanges(prompt) {
|
|
2248
|
-
|
|
2272
|
+
const text = String(prompt || '').trim();
|
|
2273
|
+
const readOnlyIntent = /\b(analy[sz]e|analyse|analysis|audit|review|inspect|proof|understand|summari[sz]e|scan|read[\s-]?only|where we left|what is|how does|show me|tell me|identify\s+gaps?|gap\s+analysis|production\s+blockers?)\b/i.test(text);
|
|
2274
|
+
const explicitWriteIntent = /\b(build|create|make|implement|complete|fix|repair|edit|modify|write|generate|add|finish|scaffold|develop|update|change|refactor)\b/i.test(text);
|
|
2275
|
+
if (readOnlyIntent && !explicitWriteIntent) {
|
|
2276
|
+
return false;
|
|
2277
|
+
}
|
|
2278
|
+
return explicitWriteIntent && /\b(file|project|game|app|website|html5|frontend|component|feature|code|workspace|repo)\b/i.test(text);
|
|
2249
2279
|
}
|
|
2250
2280
|
getPreviousActionablePrompt() {
|
|
2251
2281
|
if (this.lastActionableUserInput && !this.isConfirmationFollowUp(this.lastActionableUserInput)) {
|
|
@@ -2603,8 +2633,7 @@ export class ChatCommand {
|
|
|
2603
2633
|
const executorSucceeded = !liveOutcome.executorFailed
|
|
2604
2634
|
&& !liveOutcome.plannerError
|
|
2605
2635
|
&& !liveOutcome.executorError
|
|
2606
|
-
&& workspaceHasOutput
|
|
2607
|
-
&& (!requiresWorkspaceChanges || changedFileCount > 0);
|
|
2636
|
+
&& (requiresWorkspaceChanges ? (workspaceHasOutput && changedFileCount > 0) : true);
|
|
2608
2637
|
if (!executorSucceeded && requiresWorkspaceChanges && changedFileCount === 0 && !liveOutcome.executorError) {
|
|
2609
2638
|
liveOutcome.executorError = 'No workspace files were changed for a build/edit request.';
|
|
2610
2639
|
}
|
|
@@ -2618,7 +2647,7 @@ export class ChatCommand {
|
|
|
2618
2647
|
taskDisplay.fail(1, failDetail);
|
|
2619
2648
|
}
|
|
2620
2649
|
// ── Self-healing validation ──────────────────────────────────────
|
|
2621
|
-
if (this.currentProjectPath && !this.jsonOutput && success && executorSucceeded) {
|
|
2650
|
+
if (this.currentProjectPath && !this.jsonOutput && success && executorSucceeded && requiresWorkspaceChanges) {
|
|
2622
2651
|
try {
|
|
2623
2652
|
taskDisplay.start(2, 'validating...');
|
|
2624
2653
|
const healResult = await this.api.runSelfHealingCycle(executionPrompt, this.currentProjectPath, workspaceContext);
|
|
@@ -2651,6 +2680,11 @@ export class ChatCommand {
|
|
|
2651
2680
|
selfHealStatus = 'failed';
|
|
2652
2681
|
}
|
|
2653
2682
|
}
|
|
2683
|
+
else if (!requiresWorkspaceChanges && executorSucceeded) {
|
|
2684
|
+
taskDisplay.complete(2);
|
|
2685
|
+
taskDisplay.skip(3);
|
|
2686
|
+
selfHealStatus = 'skipped';
|
|
2687
|
+
}
|
|
2654
2688
|
else {
|
|
2655
2689
|
taskDisplay.skip(2);
|
|
2656
2690
|
taskDisplay.skip(3);
|
package/dist/utils/api.js
CHANGED
|
@@ -1432,6 +1432,15 @@ export class APIClient {
|
|
|
1432
1432
|
activeFile: resolvedContext.activeFile || null,
|
|
1433
1433
|
history: resolvedContext.history || [],
|
|
1434
1434
|
agentTaskType: resolvedContext.agentTaskType || 'general',
|
|
1435
|
+
rawPrompt: resolvedContext.rawPrompt || resolvedContext.prompt || '',
|
|
1436
|
+
contextualPrompt: resolvedContext.contextualPrompt || '',
|
|
1437
|
+
executionHints: {
|
|
1438
|
+
task_kind: resolvedContext.agentTaskType || 'general',
|
|
1439
|
+
requires_file_changes: resolvedContext.agentTaskType === 'analysis' || resolvedContext.agentTaskType === 'verification'
|
|
1440
|
+
? false
|
|
1441
|
+
: undefined,
|
|
1442
|
+
classify_from: resolvedContext.rawPrompt || resolvedContext.prompt || '',
|
|
1443
|
+
},
|
|
1435
1444
|
model: resolvedModel,
|
|
1436
1445
|
requestedModel,
|
|
1437
1446
|
requestedModelResolved: resolvedModel,
|
|
@@ -1568,6 +1577,15 @@ export class APIClient {
|
|
|
1568
1577
|
activeFile: resolvedContext.activeFile || null,
|
|
1569
1578
|
history: resolvedContext.history || [],
|
|
1570
1579
|
agentTaskType: resolvedContext.agentTaskType || 'general',
|
|
1580
|
+
rawPrompt: resolvedContext.rawPrompt || resolvedContext.prompt || '',
|
|
1581
|
+
contextualPrompt: resolvedContext.contextualPrompt || '',
|
|
1582
|
+
executionHints: {
|
|
1583
|
+
task_kind: resolvedContext.agentTaskType || 'general',
|
|
1584
|
+
requires_file_changes: resolvedContext.agentTaskType === 'analysis' || resolvedContext.agentTaskType === 'verification'
|
|
1585
|
+
? false
|
|
1586
|
+
: undefined,
|
|
1587
|
+
classify_from: resolvedContext.rawPrompt || resolvedContext.prompt || '',
|
|
1588
|
+
},
|
|
1571
1589
|
executionSurface: resolvedContext.executionSurface || 'cli',
|
|
1572
1590
|
clientSurface: resolvedContext.clientSurface || 'cli',
|
|
1573
1591
|
localMachineCapable: resolvedContext.localMachineCapable !== false,
|