vigthoria-cli 1.11.17 → 1.11.18
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/chat.js
CHANGED
|
@@ -2551,6 +2551,7 @@ export class ChatCommand {
|
|
|
2551
2551
|
const mustComplete = route?.path === 'template-instant';
|
|
2552
2552
|
let result = await runTemplateInstantPath(this.api, prompt, workspacePath, {
|
|
2553
2553
|
allowFallback: true,
|
|
2554
|
+
forceMinimalFallback: route?.path === 'template-instant',
|
|
2554
2555
|
});
|
|
2555
2556
|
if (!result.ok && mustComplete) {
|
|
2556
2557
|
result = await runTemplateInstantPath(this.api, prompt, workspacePath, {
|
|
@@ -13,6 +13,7 @@ export declare function isTrivialHtmlPageRequest(prompt: string): boolean;
|
|
|
13
13
|
export declare function hasCloneBuildIntent(prompt: string): boolean;
|
|
14
14
|
export declare function hasExplicitWriteIntent(prompt: string): boolean;
|
|
15
15
|
export declare function taskRequiresWorkspaceChanges(prompt: string): boolean;
|
|
16
|
+
export declare function hasAnalyzeAndBuildIntent(prompt: string): boolean;
|
|
16
17
|
export declare function inferAgentTaskType(prompt: string): string;
|
|
17
18
|
export declare function shouldSkipAnalysisRescue(liveOutcome: {
|
|
18
19
|
tasksTotal?: number;
|
|
@@ -88,8 +88,23 @@ export function taskRequiresWorkspaceChanges(prompt) {
|
|
|
88
88
|
}
|
|
89
89
|
return explicitWriteIntent;
|
|
90
90
|
}
|
|
91
|
+
export function hasAnalyzeAndBuildIntent(prompt) {
|
|
92
|
+
const text = stripExecutionShaping(prompt);
|
|
93
|
+
return /\b(analy[sz]e|analyse)\b/i.test(text)
|
|
94
|
+
&& /\b(complete|finish|fix|implement|build|repair|missing\s+elements?)\b/i.test(text)
|
|
95
|
+
&& hasExplicitWriteIntent(prompt);
|
|
96
|
+
}
|
|
91
97
|
export function inferAgentTaskType(prompt) {
|
|
92
98
|
const text = stripExecutionShaping(prompt);
|
|
99
|
+
if (hasAnalyzeAndBuildIntent(prompt)) {
|
|
100
|
+
if (hasGameIntent(prompt)) {
|
|
101
|
+
return 'game-build';
|
|
102
|
+
}
|
|
103
|
+
if (hasWebPageIntent(prompt)) {
|
|
104
|
+
return 'web-build';
|
|
105
|
+
}
|
|
106
|
+
return 'implementation';
|
|
107
|
+
}
|
|
93
108
|
if (/\b(inspect|analyze|analyse|audit|review|find|diagnose|debug|trace|compare|diff|check|investigate)\b/i.test(text)
|
|
94
109
|
&& !hasExplicitWriteIntent(prompt)) {
|
|
95
110
|
return 'debugging';
|
|
@@ -142,13 +157,16 @@ export function resolvePlannerAgentTimeoutMs(baseTimeoutMs, agentTaskType, promp
|
|
|
142
157
|
}
|
|
143
158
|
/** V3 workflow mode: suppress write path when the user did not ask for file changes. */
|
|
144
159
|
export function resolveWorkflowType(agentTaskType, prompt) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return 'analysis_only';
|
|
160
|
+
if (hasAnalyzeAndBuildIntent(prompt)) {
|
|
161
|
+
return 'full';
|
|
148
162
|
}
|
|
149
163
|
if (!taskRequiresWorkspaceChanges(prompt)) {
|
|
150
164
|
return 'analysis_only';
|
|
151
165
|
}
|
|
166
|
+
const kind = String(agentTaskType || '').toLowerCase();
|
|
167
|
+
if (kind === 'analysis' || kind === 'debugging' || kind === 'verification') {
|
|
168
|
+
return 'analysis_only';
|
|
169
|
+
}
|
|
152
170
|
return 'full';
|
|
153
171
|
}
|
|
154
172
|
export function buildExecutionHints(agentTaskType, prompt, options = {}) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
+
import { isTrivialHtmlPageRequest, stripExecutionShaping } from './requestIntent.js';
|
|
6
7
|
function ensurePopupScript(html, vision) {
|
|
7
8
|
const text = String(vision || '').toLowerCase();
|
|
8
9
|
if (!/\b(popup|alert|hello\s*world)\b/.test(text)) {
|
|
@@ -89,25 +90,28 @@ function extractPopupMessage(vision) {
|
|
|
89
90
|
export async function runTemplateInstantPath(api, vision, workspacePath, options = {}) {
|
|
90
91
|
const entryPath = options.entryPath || 'index.html';
|
|
91
92
|
const target = path.join(workspacePath, entryPath);
|
|
93
|
+
const cleanVision = stripExecutionShaping(vision);
|
|
94
|
+
const preferMinimal = options.forceMinimalFallback === true
|
|
95
|
+
|| (options.forceMinimalFallback !== false && isTrivialHtmlPageRequest(cleanVision));
|
|
92
96
|
let html;
|
|
93
97
|
let usedFallback = false;
|
|
94
98
|
let match = {};
|
|
95
|
-
if (
|
|
96
|
-
html = minimalHelloWorldHtml(extractPopupMessage(
|
|
99
|
+
if (preferMinimal) {
|
|
100
|
+
html = minimalHelloWorldHtml(extractPopupMessage(cleanVision));
|
|
97
101
|
usedFallback = true;
|
|
98
102
|
}
|
|
99
103
|
else {
|
|
100
|
-
match = await fetchTemplateMatch(api,
|
|
104
|
+
match = await fetchTemplateMatch(api, cleanVision);
|
|
101
105
|
html = match.html;
|
|
102
106
|
if (!html && options.allowFallback !== false) {
|
|
103
|
-
html = minimalHelloWorldHtml(extractPopupMessage(
|
|
107
|
+
html = minimalHelloWorldHtml(extractPopupMessage(cleanVision));
|
|
104
108
|
usedFallback = true;
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
if (!html) {
|
|
108
112
|
return { ok: false, error: match.error || 'Template match failed' };
|
|
109
113
|
}
|
|
110
|
-
html = ensurePopupScript(html,
|
|
114
|
+
html = ensurePopupScript(html, cleanVision);
|
|
111
115
|
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
112
116
|
fs.writeFileSync(target, html, 'utf8');
|
|
113
117
|
return {
|