vigthoria-cli 1.6.49 → 1.6.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/chat.js +13 -5
- package/dist/utils/api.js +8 -11
- package/package.json +1 -1
package/dist/commands/chat.js
CHANGED
|
@@ -1209,14 +1209,21 @@ class ChatCommand {
|
|
|
1209
1209
|
// tool-failure echoes, or premature resignation (the model gave up
|
|
1210
1210
|
// instead of retrying with list_dir to find the correct paths)
|
|
1211
1211
|
const gate2 = this.directPromptMode && turn < 6 && (isPolicyAck || isFollowUp || isEmptyAfterSanitize || isResignation);
|
|
1212
|
-
|
|
1212
|
+
// Gate 3: Model outputs code blocks as text instead of using write_file.
|
|
1213
|
+
// If the response contains ``` code fences but no write_file was called,
|
|
1214
|
+
// reject and instruct the model to use write_file.
|
|
1215
|
+
const hasCodeBlocks = (sanitized.match(/```/g) || []).length >= 2;
|
|
1216
|
+
const gate3 = hasCodeBlocks && this.agentToolEvidence.mutation === 0 && turn < 6;
|
|
1217
|
+
if (gate1 || gate2 || gate3) {
|
|
1213
1218
|
// Remove the useless response from history
|
|
1214
|
-
if (isPolicyAck || isFollowUp || isEmptyAfterSanitize || isResignation) {
|
|
1219
|
+
if (isPolicyAck || isFollowUp || isEmptyAfterSanitize || isResignation || gate3) {
|
|
1215
1220
|
this.messages.pop();
|
|
1216
1221
|
}
|
|
1217
|
-
const hint =
|
|
1218
|
-
? '
|
|
1219
|
-
:
|
|
1222
|
+
const hint = gate3
|
|
1223
|
+
? 'You output code as text instead of writing files. Use write_file to create each file on disk. Do NOT output code in markdown fences — call write_file for every file.'
|
|
1224
|
+
: isResignation
|
|
1225
|
+
? 'Files were not found at the guessed paths. Use list_dir to discover the correct directory structure, then read_file with the correct paths.'
|
|
1226
|
+
: `Start by running: list_dir on the project root, then read_file on files relevant to: ${prompt}`;
|
|
1220
1227
|
this.messages.push({
|
|
1221
1228
|
role: 'system',
|
|
1222
1229
|
content: [
|
|
@@ -1807,6 +1814,7 @@ class ChatCommand {
|
|
|
1807
1814
|
'Vigthoria CLI agent operating contract.',
|
|
1808
1815
|
`You are operating inside the project root: ${this.currentProjectPath}`,
|
|
1809
1816
|
'CRITICAL: Begin working on the user\'s task IMMEDIATELY. Your very first response MUST contain <tool_call> blocks to gather evidence. Do NOT acknowledge instructions, restate the task, describe your plan, or discuss tool policies. Act, do not talk.',
|
|
1817
|
+
'FILE CREATION RULE: When the user asks you to build, create, or generate files, you MUST use the write_file tool to actually create each file on disk. NEVER output code snippets as markdown text — always write them to files using write_file. If the task requires a new project, create a new directory first, then write all files into it.',
|
|
1810
1818
|
'Stay inside that project unless the user explicitly asks otherwise.',
|
|
1811
1819
|
'Read files before editing or rewriting them.',
|
|
1812
1820
|
'When the user asks to inspect a folder or find the right file, verify with tools before concluding.',
|
package/dist/utils/api.js
CHANGED
|
@@ -425,11 +425,12 @@ class APIClient {
|
|
|
425
425
|
}
|
|
426
426
|
getOperatorBaseUrls() {
|
|
427
427
|
const configuredModelsApiUrl = String(this.config.get('modelsApiUrl') || 'https://api.vigthoria.io').replace(/\/$/, '');
|
|
428
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_SERVICES === '1';
|
|
428
429
|
const urls = [
|
|
429
430
|
process.env.VIGTHORIA_OPERATOR_URL,
|
|
430
431
|
process.env.OPERATOR_URL,
|
|
431
|
-
'http://127.0.0.1:4009',
|
|
432
432
|
configuredModelsApiUrl,
|
|
433
|
+
...(allowLocal ? ['http://127.0.0.1:4009'] : []),
|
|
433
434
|
].filter(Boolean).map((url) => String(url).replace(/\/$/, ''));
|
|
434
435
|
return [...new Set(urls)];
|
|
435
436
|
}
|
|
@@ -438,39 +439,35 @@ class APIClient {
|
|
|
438
439
|
}
|
|
439
440
|
getMcpBaseUrls() {
|
|
440
441
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
442
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_SERVICES === '1';
|
|
441
443
|
const urls = [
|
|
442
444
|
process.env.VIGTHORIA_MCP_URL,
|
|
443
445
|
process.env.MCP_SERVER_URL,
|
|
444
|
-
'http://127.0.0.1:4008',
|
|
445
446
|
configuredApiUrl,
|
|
447
|
+
...(allowLocal ? ['http://127.0.0.1:4008'] : []),
|
|
446
448
|
].filter(Boolean).map((url) => String(url).replace(/\/$/, ''));
|
|
447
449
|
return [...new Set(urls)];
|
|
448
450
|
}
|
|
449
451
|
getVigFlowBaseUrls() {
|
|
450
452
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
451
|
-
|
|
452
|
-
// rarely running for end-user CLI installations. This avoids
|
|
453
|
-
// wasting connection-attempt time on 127.0.0.1 and hitting the
|
|
454
|
-
// remote gateway only after the local attempts have already
|
|
455
|
-
// errored — which surfaces as a confusing "last error" 404 in
|
|
456
|
-
// some setups.
|
|
453
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_SERVICES === '1';
|
|
457
454
|
const urls = [
|
|
458
455
|
process.env.VIGTHORIA_VIGFLOW_URL,
|
|
459
456
|
process.env.VIGFLOW_URL,
|
|
460
457
|
process.env.WORKFLOW_BUILDER_URL,
|
|
461
458
|
`${configuredApiUrl}/api/vigflow`,
|
|
462
|
-
'http://127.0.0.1:5060',
|
|
463
|
-
'http://127.0.0.1:5050',
|
|
459
|
+
...(allowLocal ? ['http://127.0.0.1:5060', 'http://127.0.0.1:5050'] : []),
|
|
464
460
|
].filter(Boolean).map((url) => String(url).replace(/\/$/, ''));
|
|
465
461
|
return [...new Set(urls)];
|
|
466
462
|
}
|
|
467
463
|
getTemplateServiceBaseUrls() {
|
|
468
464
|
const configuredApiUrl = String(this.config.get('apiUrl') || 'https://coder.vigthoria.io').replace(/\/$/, '');
|
|
465
|
+
const allowLocal = process.env.VIGTHORIA_ALLOW_LOCAL_SERVICES === '1';
|
|
469
466
|
const urls = [
|
|
470
467
|
process.env.VIGTHORIA_TEMPLATE_SERVICE_URL,
|
|
471
468
|
process.env.TEMPLATE_SERVICE_URL,
|
|
472
|
-
'http://127.0.0.1:4011',
|
|
473
469
|
`${configuredApiUrl}/api/template-service`,
|
|
470
|
+
...(allowLocal ? ['http://127.0.0.1:4011'] : []),
|
|
474
471
|
].filter(Boolean).map((url) => String(url).replace(/\/$/, ''));
|
|
475
472
|
return [...new Set(urls)];
|
|
476
473
|
}
|