@vibgrate/cli 2026.728.3 → 2026.728.5
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/baseline-Y5FBYWNJ.js +8 -0
- package/dist/{baseline-PPZJBYAJ.js.map → baseline-Y5FBYWNJ.js.map} +1 -1
- package/dist/{chunk-A2IYFNCQ.js → chunk-2ZHWF7C6.js} +227 -19
- package/dist/chunk-2ZHWF7C6.js.map +1 -0
- package/dist/{chunk-UZJS7GMK.js → chunk-3LSG7Z4I.js} +10 -6
- package/dist/chunk-3LSG7Z4I.js.map +1 -0
- package/dist/{chunk-3BIRGSRS.js → chunk-4JD63RUR.js} +11 -11
- package/dist/{chunk-3BIRGSRS.js.map → chunk-4JD63RUR.js.map} +1 -1
- package/dist/{chunk-6GRLZ4Z2.js → chunk-643KXZ54.js} +8 -8
- package/dist/{chunk-6GRLZ4Z2.js.map → chunk-643KXZ54.js.map} +1 -1
- package/dist/{chunk-R2QNFXE5.js → chunk-DBOT2ELH.js} +3 -3
- package/dist/{chunk-R2QNFXE5.js.map → chunk-DBOT2ELH.js.map} +1 -1
- package/dist/{chunk-6UK6QPTR.js → chunk-EETK7S43.js} +137 -34
- package/dist/chunk-EETK7S43.js.map +1 -0
- package/dist/{chunk-JRAGO6OB.js → chunk-EVWW3BPM.js} +4 -4
- package/dist/{chunk-JRAGO6OB.js.map → chunk-EVWW3BPM.js.map} +1 -1
- package/dist/chunk-G4HTI4ZM.js +1537 -0
- package/dist/chunk-G4HTI4ZM.js.map +1 -0
- package/dist/chunk-IPICO2RV.js +789 -0
- package/dist/chunk-IPICO2RV.js.map +1 -0
- package/dist/{chunk-VI4ITXHQ.js → chunk-NH5NJ3UO.js} +7 -6
- package/dist/chunk-NH5NJ3UO.js.map +1 -0
- package/dist/{chunk-6UQMXIAG.js → chunk-OWSFZQOP.js} +62 -12
- package/dist/chunk-OWSFZQOP.js.map +1 -0
- package/dist/{chunk-WH2N22S3.js → chunk-PRGCCW7D.js} +4 -4
- package/dist/{chunk-WH2N22S3.js.map → chunk-PRGCCW7D.js.map} +1 -1
- package/dist/chunk-RCP2KQGG.js +3059 -0
- package/dist/chunk-RCP2KQGG.js.map +1 -0
- package/dist/{chunk-OSD546W7.js → chunk-REIGWTTH.js} +5 -3
- package/dist/chunk-REIGWTTH.js.map +1 -0
- package/dist/{chunk-B3YUO3NW.js → chunk-RYNAK4LK.js} +3 -3
- package/dist/{chunk-B3YUO3NW.js.map → chunk-RYNAK4LK.js.map} +1 -1
- package/dist/{chunk-YF43FOPP.js → chunk-RZEXHDCF.js} +33 -14
- package/dist/chunk-RZEXHDCF.js.map +1 -0
- package/dist/{chunk-VYGEOOLY.js → chunk-SGI5ZP2Y.js} +3 -3
- package/dist/{chunk-VYGEOOLY.js.map → chunk-SGI5ZP2Y.js.map} +1 -1
- package/dist/{chunk-HK3AWUXH.js → chunk-TCJTQGAO.js} +3 -3
- package/dist/{chunk-HK3AWUXH.js.map → chunk-TCJTQGAO.js.map} +1 -1
- package/dist/{chunk-ZBTY6VV4.js → chunk-US2DAKCM.js} +15 -5
- package/dist/chunk-US2DAKCM.js.map +1 -0
- package/dist/{chunk-ON25BX6T.js → chunk-UTNNGKKX.js} +3 -3
- package/dist/{chunk-ON25BX6T.js.map → chunk-UTNNGKKX.js.map} +1 -1
- package/dist/chunk-VBVY733D.js +2184 -0
- package/dist/chunk-VBVY733D.js.map +1 -0
- package/dist/{chunk-SZSNPXSW.js → chunk-WHJMS7XC.js} +3 -3
- package/dist/{chunk-SZSNPXSW.js.map → chunk-WHJMS7XC.js.map} +1 -1
- package/dist/chunk-Z6ZWNWWR.js +30 -0
- package/dist/{chunk-DGUM43GV.js.map → chunk-Z6ZWNWWR.js.map} +1 -1
- package/dist/cli.js +192 -90
- package/dist/cli.js.map +1 -1
- package/dist/{execution-env-ZU45JZ4G.js → execution-env-4MS5AYAN.js} +3 -3
- package/dist/{execution-env-ZU45JZ4G.js.map → execution-env-4MS5AYAN.js.map} +1 -1
- package/dist/{federation-SZWZIFZ7.js → federation-MDQPO3PW.js} +3 -3
- package/dist/{federation-SZWZIFZ7.js.map → federation-MDQPO3PW.js.map} +1 -1
- package/dist/{fs-O5IQYXHO.js → fs-4G5A65KS.js} +3 -3
- package/dist/fs-4G5A65KS.js.map +1 -0
- package/dist/{fs-B5HZ2MIU.js → fs-6JKZNQ3U.js} +3 -3
- package/dist/fs-6JKZNQ3U.js.map +1 -0
- package/dist/{git-ref-XDXB6JP5.js → git-ref-RSRAN4OH.js} +3 -3
- package/dist/{git-ref-XDXB6JP5.js.map → git-ref-RSRAN4OH.js.map} +1 -1
- package/dist/{graph-backend-UTOL3SHE.js → graph-backend-GBL33GMW.js} +5 -5
- package/dist/{graph-backend-UTOL3SHE.js.map → graph-backend-GBL33GMW.js.map} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/{interactive-OCWQ326U.js → interactive-KVDKRKNK.js} +45 -24
- package/dist/interactive-KVDKRKNK.js.map +1 -0
- package/dist/{llm-host-XYBT4267.js → llm-host-5RE34322.js} +3 -3
- package/dist/{llm-host-XYBT4267.js.map → llm-host-5RE34322.js.map} +1 -1
- package/dist/load-SEFJA3M5.js +8 -0
- package/dist/{load-QPOWQD7C.js.map → load-SEFJA3M5.js.map} +1 -1
- package/dist/local-runtime-2ED33KK6.js +6 -0
- package/dist/{local-runtime-5O2NN3GA.js.map → local-runtime-2ED33KK6.js.map} +1 -1
- package/dist/mcp-tools-KAJS34TN.js +4 -0
- package/dist/{mcp-tools-I7JK3S2M.js.map → mcp-tools-KAJS34TN.js.map} +1 -1
- package/dist/{model-execution-profile-TFBKCNJG.js → model-execution-profile-ELWF3Z6H.js} +3 -3
- package/dist/{model-execution-profile-TFBKCNJG.js.map → model-execution-profile-ELWF3Z6H.js.map} +1 -1
- package/dist/model-manager-GJ2YSTSK.js +10 -0
- package/dist/{model-manager-LB54VSV7.js.map → model-manager-GJ2YSTSK.js.map} +1 -1
- package/dist/{model-orchestrator-4M5FG6MN.js → model-orchestrator-LHYPJBFH.js} +3 -3
- package/dist/{model-orchestrator-4M5FG6MN.js.map → model-orchestrator-LHYPJBFH.js.map} +1 -1
- package/dist/parse-worker.js +2 -2
- package/dist/{paths-2RAH3GME.js → paths-62AKTFSR.js} +3 -3
- package/dist/{paths-2RAH3GME.js.map → paths-62AKTFSR.js.map} +1 -1
- package/dist/{resolve-gguf-4AFRN4CP.js → resolve-gguf-SDIYGGI6.js} +3 -3
- package/dist/{resolve-gguf-4AFRN4CP.js.map → resolve-gguf-SDIYGGI6.js.map} +1 -1
- package/dist/{runtime-session-EJQZXANB.js → runtime-session-4IACVDSY.js} +7 -7
- package/dist/{runtime-session-EJQZXANB.js.map → runtime-session-4IACVDSY.js.map} +1 -1
- package/dist/session-2JT4AUZT.js +13 -0
- package/dist/{session-ZJGENHKX.js.map → session-2JT4AUZT.js.map} +1 -1
- package/dist/session-store-O4XPXKOV.js +4 -0
- package/dist/{session-store-WFBX7HXL.js.map → session-store-O4XPXKOV.js.map} +1 -1
- package/dist/{sql-extract-JELDZA6W.js → sql-extract-6UJOLJDL.js} +3 -3
- package/dist/{sql-extract-JELDZA6W.js.map → sql-extract-6UJOLJDL.js.map} +1 -1
- package/dist/stream-json-Y45JBNYP.js +112 -0
- package/dist/stream-json-Y45JBNYP.js.map +1 -0
- package/dist/ui-K7D3BCHD.js +5 -0
- package/dist/ui-K7D3BCHD.js.map +1 -0
- package/dist/vg-mcp-bridge-B35WCSAS.js +75 -0
- package/dist/vg-mcp-bridge-B35WCSAS.js.map +1 -0
- package/dist/{vgd-3MHSB4KA.js → vgd-KDQFS33M.js} +6 -6
- package/dist/vgd-KDQFS33M.js.map +1 -0
- package/package.json +1 -1
- package/dist/baseline-PPZJBYAJ.js +0 -8
- package/dist/chunk-57QU36P6.js +0 -5645
- package/dist/chunk-57QU36P6.js.map +0 -1
- package/dist/chunk-6AXHLQBV.js +0 -1892
- package/dist/chunk-6AXHLQBV.js.map +0 -1
- package/dist/chunk-6UK6QPTR.js.map +0 -1
- package/dist/chunk-6UQMXIAG.js.map +0 -1
- package/dist/chunk-A2IYFNCQ.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -10
- package/dist/chunk-OSD546W7.js.map +0 -1
- package/dist/chunk-UZJS7GMK.js.map +0 -1
- package/dist/chunk-VI4ITXHQ.js.map +0 -1
- package/dist/chunk-YF43FOPP.js.map +0 -1
- package/dist/chunk-ZBTY6VV4.js.map +0 -1
- package/dist/fs-B5HZ2MIU.js.map +0 -1
- package/dist/fs-O5IQYXHO.js.map +0 -1
- package/dist/interactive-OCWQ326U.js.map +0 -1
- package/dist/load-QPOWQD7C.js +0 -8
- package/dist/local-runtime-5O2NN3GA.js +0 -5
- package/dist/mcp-tools-I7JK3S2M.js +0 -4
- package/dist/model-manager-LB54VSV7.js +0 -10
- package/dist/session-ZJGENHKX.js +0 -13
- package/dist/session-store-WFBX7HXL.js +0 -4
- package/dist/stream-json-Z5KC2DM3.js +0 -78
- package/dist/stream-json-Z5KC2DM3.js.map +0 -1
- package/dist/ui-Q6DJ3GCU.js +0 -5
- package/dist/ui-Q6DJ3GCU.js.map +0 -1
- package/dist/vgd-3MHSB4KA.js.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { baselineCommand, runBaseline } from './chunk-SGI5ZP2Y.js';
|
|
2
|
+
import './chunk-4JD63RUR.js';
|
|
3
|
+
import './chunk-CRAMOEBE.js';
|
|
4
|
+
import './chunk-RXP66R2E.js';
|
|
5
|
+
import './chunk-GI6W53LM.js';
|
|
6
|
+
import './chunk-Z6ZWNWWR.js';
|
|
7
|
+
//# sourceMappingURL=baseline-Y5FBYWNJ.js.map
|
|
8
|
+
//# sourceMappingURL=baseline-Y5FBYWNJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"baseline-Y5FBYWNJ.js"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { buildAgentMessages, redactSecrets, unifiedDiff, applyEdit } from './chunk-
|
|
2
|
-
import { localGraphBackend } from './chunk-
|
|
1
|
+
import { buildAgentMessages, redactSecrets, unifiedDiff, applyEdit } from './chunk-RZEXHDCF.js';
|
|
2
|
+
import { localGraphBackend } from './chunk-TCJTQGAO.js';
|
|
3
3
|
import { buildIdentifierTrieFromGraph, KvBlockRegistry, graphDraftCandidates, extractIdentifiers, scanIdentifiersAgainstTrie } from './chunk-JIBOJTGS.js';
|
|
4
|
-
import { resolve
|
|
5
|
-
import {
|
|
4
|
+
import { resolve } from './chunk-IPICO2RV.js';
|
|
5
|
+
import { searchSymbols, resolveLib, loadCatalog, readDoc, localPackageDocs, resolveVersion } from './chunk-G4HTI4ZM.js';
|
|
6
|
+
import { summarizeCapsule, CAPSULE_RANKING_VERSION, buildCodeContext, buildTaskCapsule, capsuleToCodeContext, recordCliCall, CLI_TOOL_ALIASES } from './chunk-US2DAKCM.js';
|
|
6
7
|
import { resolveOne } from './chunk-J7LKEB2R.js';
|
|
7
|
-
import { impactOf } from './chunk-
|
|
8
|
-
import { parseSource, langForExtension } from './chunk-
|
|
8
|
+
import { isLocateOnlyInstruction, extractLiteralNeedles, impactOf } from './chunk-EETK7S43.js';
|
|
9
|
+
import { parseSource, langForExtension } from './chunk-UTNNGKKX.js';
|
|
9
10
|
import { repositoryIdFromRoot } from './chunk-BWPBB45M.js';
|
|
10
11
|
import { hashString, canonicalize } from './chunk-JFGYT6BI.js';
|
|
11
12
|
import { spawnSync } from 'child_process';
|
|
@@ -1138,8 +1139,17 @@ var MAX_OUTPUT = 12e3;
|
|
|
1138
1139
|
var AGENT_TOOLS = [
|
|
1139
1140
|
{
|
|
1140
1141
|
name: "search_code",
|
|
1141
|
-
description:
|
|
1142
|
-
parameters: {
|
|
1142
|
+
description: 'Search the codebase by identifier, concept, or exact string/URL. Uses the deterministic code graph for symbols, plus a literal text sweep for phrases, quoted strings, and URLs (preferred over reading files blindly). For "find every occurrence of \u2026", pass the exact needle (optionally quoted).',
|
|
1143
|
+
parameters: {
|
|
1144
|
+
type: "object",
|
|
1145
|
+
properties: {
|
|
1146
|
+
query: {
|
|
1147
|
+
type: "string",
|
|
1148
|
+
description: 'What to find, e.g. "scanDir", "where auth failures are handled", or a URL / "exact phrase"'
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
required: ["query"]
|
|
1152
|
+
}
|
|
1143
1153
|
},
|
|
1144
1154
|
{
|
|
1145
1155
|
name: "read_file",
|
|
@@ -1230,14 +1240,39 @@ var AGENT_TOOLS = [
|
|
|
1230
1240
|
}
|
|
1231
1241
|
}
|
|
1232
1242
|
},
|
|
1243
|
+
{
|
|
1244
|
+
name: "ask_user",
|
|
1245
|
+
description: "Ask the human a clarifying question when intent, scope, or preferred approach is ambiguous. Prefer this over guessing. The host shows the question and returns their answer. Do not use for pure code facts you can look up with search_code/read_file.",
|
|
1246
|
+
parameters: {
|
|
1247
|
+
type: "object",
|
|
1248
|
+
properties: {
|
|
1249
|
+
question: { type: "string", description: "Clear question for the user" },
|
|
1250
|
+
options: {
|
|
1251
|
+
type: "array",
|
|
1252
|
+
items: { type: "string" },
|
|
1253
|
+
description: "Optional short multiple-choice options (user may still type free text)"
|
|
1254
|
+
}
|
|
1255
|
+
},
|
|
1256
|
+
required: ["question"]
|
|
1257
|
+
}
|
|
1258
|
+
},
|
|
1233
1259
|
{
|
|
1234
1260
|
name: "finish",
|
|
1235
|
-
description: "Finish the task.
|
|
1236
|
-
parameters: {
|
|
1261
|
+
description: "Finish the task. Pass a user-facing summary in Markdown: what changed (or what you found), key file:line refs, and any follow-ups. For Q&A / locate tasks, the summary IS the answer.",
|
|
1262
|
+
parameters: {
|
|
1263
|
+
type: "object",
|
|
1264
|
+
properties: {
|
|
1265
|
+
summary: {
|
|
1266
|
+
type: "string",
|
|
1267
|
+
description: "Markdown summary or answer shown in the VG Code panel"
|
|
1268
|
+
}
|
|
1269
|
+
},
|
|
1270
|
+
required: ["summary"]
|
|
1271
|
+
}
|
|
1237
1272
|
},
|
|
1238
1273
|
{
|
|
1239
1274
|
name: "abort",
|
|
1240
|
-
description: "Stop
|
|
1275
|
+
description: "Stop without further edits when the request is impossible. Prefer ask_user when intent is merely unclear.",
|
|
1241
1276
|
parameters: {
|
|
1242
1277
|
type: "object",
|
|
1243
1278
|
properties: { reason: { type: "string", description: "Why the task is aborted" } },
|
|
@@ -1275,6 +1310,8 @@ async function executeTool(call, ctx) {
|
|
|
1275
1310
|
return inspectChangeTool(ctx, a);
|
|
1276
1311
|
case "verify_change":
|
|
1277
1312
|
return verifyChange(ctx, str(a.command) || void 0);
|
|
1313
|
+
case "ask_user":
|
|
1314
|
+
return askUser(ctx, str(a.question), arrStr(a.options));
|
|
1278
1315
|
case "finish":
|
|
1279
1316
|
return { content: "done", mutated: false, finished: true, finalSummary: str(a.summary) || "done" };
|
|
1280
1317
|
case "abort":
|
|
@@ -1291,8 +1328,74 @@ async function executeTool(call, ctx) {
|
|
|
1291
1328
|
return { content: `tool ${call.name} failed: ${e.message}`, mutated: false };
|
|
1292
1329
|
}
|
|
1293
1330
|
}
|
|
1331
|
+
async function askUser(ctx, question, options) {
|
|
1332
|
+
if (!question.trim()) return { content: "ask_user needs a question", mutated: false };
|
|
1333
|
+
if (!ctx.askUser) {
|
|
1334
|
+
return {
|
|
1335
|
+
content: "No interactive host for ask_user (headless). Proceed with your best judgment, state assumptions, and call finish \u2014 or abort if you cannot continue safely.",
|
|
1336
|
+
mutated: false
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
if (ctx.auto) {
|
|
1340
|
+
return {
|
|
1341
|
+
content: "Autonomous mode: no human available. Proceed with the safest default, state assumptions clearly in finish, and do not block on clarification.",
|
|
1342
|
+
mutated: false
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
try {
|
|
1346
|
+
const answer = await ctx.askUser({
|
|
1347
|
+
question: question.trim(),
|
|
1348
|
+
options: options?.map((o) => o.trim()).filter(Boolean).slice(0, 8)
|
|
1349
|
+
});
|
|
1350
|
+
const text = (answer ?? "").trim();
|
|
1351
|
+
if (!text) {
|
|
1352
|
+
return {
|
|
1353
|
+
content: "User dismissed the question without answering. Ask once more only if essential; otherwise finish with open questions listed.",
|
|
1354
|
+
mutated: false
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
return { content: `User answered:
|
|
1358
|
+
${text}`, mutated: false };
|
|
1359
|
+
} catch (e) {
|
|
1360
|
+
return { content: `ask_user failed: ${e.message}`, mutated: false };
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
function arrStr(v) {
|
|
1364
|
+
if (!Array.isArray(v)) return void 0;
|
|
1365
|
+
return v.map((x) => typeof x === "string" ? x : String(x ?? "")).filter(Boolean);
|
|
1366
|
+
}
|
|
1294
1367
|
async function search(ctx, query) {
|
|
1295
1368
|
if (!query) return { content: "search_code needs a query", mutated: false };
|
|
1369
|
+
if (ctx.root) {
|
|
1370
|
+
try {
|
|
1371
|
+
const hybrid = await searchSymbols(ctx.graph, ctx.root, query, 20);
|
|
1372
|
+
if (hybrid.matches.length > 0) {
|
|
1373
|
+
const lines2 = hybrid.matches.map((m) => {
|
|
1374
|
+
if ("preview" in m) {
|
|
1375
|
+
return `- text ${m.file}:${m.line} ${m.preview}`;
|
|
1376
|
+
}
|
|
1377
|
+
return `- ${m.name} (${m.kind}) ${m.file}:${m.line} score ${m.score}`;
|
|
1378
|
+
});
|
|
1379
|
+
const parts = [`Matches for "${query}":`, ...lines2];
|
|
1380
|
+
if (hybrid.totalTextMatches !== void 0) {
|
|
1381
|
+
parts.push(
|
|
1382
|
+
`(${hybrid.totalTextMatches} literal match(es) in tree${hybrid.moreAvailable ? "; list truncated \u2014 raise limit or narrow the needle" : ""})`
|
|
1383
|
+
);
|
|
1384
|
+
}
|
|
1385
|
+
if (hybrid.hint) parts.push(hybrid.hint);
|
|
1386
|
+
return { content: parts.join("\n"), mutated: false };
|
|
1387
|
+
}
|
|
1388
|
+
if (hybrid.totalTextMatches === 0 || /\s|https?:\/\//i.test(query) || /^["'`]/.test(query.trim())) {
|
|
1389
|
+
const hint = hybrid.hint ? `
|
|
1390
|
+
${hybrid.hint}` : "";
|
|
1391
|
+
return {
|
|
1392
|
+
content: `no symbol or text match for "${query}".${hint}`,
|
|
1393
|
+
mutated: false
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
} catch {
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1296
1399
|
const backend = ctx.graphBackend ?? localGraphBackend(ctx.graph);
|
|
1297
1400
|
const res = await backend.search(query, { limit: 10 });
|
|
1298
1401
|
if (res.matches.length === 0) return { content: `no symbols matched "${query}"`, mutated: false };
|
|
@@ -1916,6 +2019,45 @@ function shouldUsePatchIrGrammar(profile) {
|
|
|
1916
2019
|
return false;
|
|
1917
2020
|
}
|
|
1918
2021
|
|
|
2022
|
+
// src/code/locate-answer.ts
|
|
2023
|
+
function primaryLocateNeedle(instruction) {
|
|
2024
|
+
const needles = extractLiteralNeedles(instruction);
|
|
2025
|
+
if (needles.length === 0) return instruction.trim();
|
|
2026
|
+
return [...needles].sort((a, b) => b.length - a.length)[0];
|
|
2027
|
+
}
|
|
2028
|
+
function formatLocateAnswer(needle, hits, total) {
|
|
2029
|
+
if (hits.length === 0) {
|
|
2030
|
+
return `No occurrences of \`${needle}\` in this workspace.
|
|
2031
|
+
(Literal search complete \u2014 0 matches.)`;
|
|
2032
|
+
}
|
|
2033
|
+
const lines = hits.slice(0, 20).map((h) => `- ${h.file}:${h.line} ${h.preview.trim().slice(0, 120)}`);
|
|
2034
|
+
const more = total > hits.length ? `
|
|
2035
|
+
\u2026 and ${total - hits.length} more (showing ${hits.length} of ${total}).` : total > 1 ? `
|
|
2036
|
+
(${total} occurrence${total === 1 ? "" : "s"}.)` : "";
|
|
2037
|
+
return `Found \`${needle}\`:
|
|
2038
|
+
${lines.join("\n")}${more}`;
|
|
2039
|
+
}
|
|
2040
|
+
async function answerLocateInstruction(graph, root, instruction, limit = 30) {
|
|
2041
|
+
const needle = primaryLocateNeedle(instruction);
|
|
2042
|
+
const result = await searchSymbols(graph, root, needle, limit);
|
|
2043
|
+
const hits = result.matches.filter((m) => m.kind === "text").map((m) => ({ file: m.file, line: m.line, preview: m.preview }));
|
|
2044
|
+
const total = result.totalTextMatches ?? hits.length;
|
|
2045
|
+
return {
|
|
2046
|
+
needle,
|
|
2047
|
+
hits,
|
|
2048
|
+
totalTextMatches: total,
|
|
2049
|
+
summary: formatLocateAnswer(needle, hits, total)
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2052
|
+
function sanitizeAgentDisplayText(text) {
|
|
2053
|
+
if (!text) return text;
|
|
2054
|
+
let t = text.replace(/\n*\/\*\s*vg:\s*unknown identifiers[\s\S]*?\*\//gi, "").trim();
|
|
2055
|
+
if (/"schemaVersion"\s*:\s*"patch-ir\/0"/i.test(t) || /"op"\s*:\s*"replace-text"/i.test(t) && /"operations"\s*:/i.test(t)) {
|
|
2056
|
+
return "This looked like a locate/search question, but the model returned an edit payload instead of an answer. Ask again as \u201Cwhere is <url or string>?\u201D \u2014 VG Code will use the literal search path.";
|
|
2057
|
+
}
|
|
2058
|
+
return t;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
1919
2061
|
// src/code/agent.ts
|
|
1920
2062
|
var DEFAULT_MAX_STEPS = 24;
|
|
1921
2063
|
var DEFAULT_CONTEXT_BUDGET = 16e3;
|
|
@@ -1973,6 +2115,7 @@ async function runAgent(options) {
|
|
|
1973
2115
|
if (options.testCommand) {
|
|
1974
2116
|
messages.push({ role: "user", content: `When you want to verify a change, the project's test command is: \`${options.testCommand}\`` });
|
|
1975
2117
|
}
|
|
2118
|
+
const locateOnly = isLocateOnlyInstruction(instruction);
|
|
1976
2119
|
const spans = buildSpanIndex(graph);
|
|
1977
2120
|
const changes = [];
|
|
1978
2121
|
const repeats = /* @__PURE__ */ new Map();
|
|
@@ -1988,6 +2131,56 @@ async function runAgent(options) {
|
|
|
1988
2131
|
let currentStep = 0;
|
|
1989
2132
|
const capsuleSummary = capsule ? summarizeCapsule(capsule) : null;
|
|
1990
2133
|
if (capsuleSummary) onEvent({ type: "capsule", summary: capsuleSummary });
|
|
2134
|
+
if (locateOnly && options.deterministicLocate !== false) {
|
|
2135
|
+
try {
|
|
2136
|
+
const locate = await answerLocateInstruction(graph, root, instruction, 30);
|
|
2137
|
+
providerInfo = { id: "deterministic-locate", model: "literal-sweep", fellBack: false };
|
|
2138
|
+
onEvent({ type: "assistant", text: locate.summary });
|
|
2139
|
+
const traj = trajectory.finalize({
|
|
2140
|
+
taskId: instruction.slice(0, 48),
|
|
2141
|
+
arm: capsule ? "capsule" : "metadata",
|
|
2142
|
+
solved: true,
|
|
2143
|
+
verified: true,
|
|
2144
|
+
steps: 0,
|
|
2145
|
+
stopped: "finished",
|
|
2146
|
+
inferenceTurns: 0,
|
|
2147
|
+
filesChanged: 0,
|
|
2148
|
+
usedCapsule: !!capsule,
|
|
2149
|
+
provider: { id: "deterministic-locate", model: "literal-sweep" }
|
|
2150
|
+
});
|
|
2151
|
+
const earlyMetrics = {
|
|
2152
|
+
discoveryToolCalls: 0,
|
|
2153
|
+
mutationToolCalls: 0,
|
|
2154
|
+
shellCommands: 0,
|
|
2155
|
+
znsAt1: true,
|
|
2156
|
+
usedCapsule: !!capsule,
|
|
2157
|
+
failureCapsuleBuilt: false,
|
|
2158
|
+
trajectory: traj
|
|
2159
|
+
};
|
|
2160
|
+
onEvent({ type: "metrics", metrics: earlyMetrics });
|
|
2161
|
+
return {
|
|
2162
|
+
finalText: locate.summary,
|
|
2163
|
+
changes: [],
|
|
2164
|
+
steps: 0,
|
|
2165
|
+
stopped: "finished",
|
|
2166
|
+
provider: providerInfo,
|
|
2167
|
+
usage,
|
|
2168
|
+
metrics: earlyMetrics,
|
|
2169
|
+
failureCapsule: null,
|
|
2170
|
+
capsuleSummary,
|
|
2171
|
+
provenance: buildRunProvenance({
|
|
2172
|
+
modelProfileId: options.modelProfile?.id ?? capsule?.provenance.modelProfileId ?? null,
|
|
2173
|
+
securityTier: options.executionEnv?.tier ?? options.modelProfile?.securityTier ?? capsule?.provenance.securityTier ?? null,
|
|
2174
|
+
graphCorpusHash: capsule?.provenance.graphCorpusHash ?? graph.provenance?.corpusHash ?? null,
|
|
2175
|
+
rankingVersion: capsule?.provenance.rankingVersion ?? CAPSULE_RANKING_VERSION,
|
|
2176
|
+
policyVersion: capsule?.provenance.policyVersion ?? CONTEXT_POLICY_VERSION,
|
|
2177
|
+
changes: [],
|
|
2178
|
+
verification: []
|
|
2179
|
+
})
|
|
2180
|
+
};
|
|
2181
|
+
} catch {
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
1991
2184
|
const runShell = (command) => {
|
|
1992
2185
|
if (options.executionEnv) return options.executionEnv.run(command, { cwd: root });
|
|
1993
2186
|
return options.run(command);
|
|
@@ -1999,6 +2192,7 @@ async function runAgent(options) {
|
|
|
1999
2192
|
spans,
|
|
2000
2193
|
run: runShell,
|
|
2001
2194
|
approve: options.approve,
|
|
2195
|
+
askUser: options.askUser,
|
|
2002
2196
|
auto: options.auto,
|
|
2003
2197
|
denyCommands: options.denyCommands,
|
|
2004
2198
|
capsule,
|
|
@@ -2233,7 +2427,9 @@ Fix the failing tests, then call finish again.${verifyRounds === 0 ? " (last ver
|
|
|
2233
2427
|
options.modelProfile,
|
|
2234
2428
|
identifierTrie,
|
|
2235
2429
|
draftCandidates,
|
|
2236
|
-
promptSegments
|
|
2430
|
+
promptSegments,
|
|
2431
|
+
/* skipPatchIrGrammar */
|
|
2432
|
+
locateOnly
|
|
2237
2433
|
);
|
|
2238
2434
|
result = c.result;
|
|
2239
2435
|
providerInfo = { id: c.provider.id, model: c.provider.model, fellBack: c.fellBack };
|
|
@@ -2248,11 +2444,15 @@ Fix the failing tests, then call finish again.${verifyRounds === 0 ? " (last ver
|
|
|
2248
2444
|
trajectory.recordUsage(result.usage.promptTokens ?? 0, result.usage.completionTokens ?? 0);
|
|
2249
2445
|
onEvent({ type: "usage", promptTokens: result.usage.promptTokens ?? 0, completionTokens: result.usage.completionTokens ?? 0 });
|
|
2250
2446
|
}
|
|
2251
|
-
|
|
2447
|
+
const displayText = sanitizeAgentDisplayText(result.text ?? "");
|
|
2448
|
+
if (displayText) onEvent({ type: "assistant", text: displayText });
|
|
2252
2449
|
const toolCalls = result.toolCalls ?? [];
|
|
2253
2450
|
if (toolCalls.length === 0) {
|
|
2254
2451
|
messages.push({ role: "assistant", content: result.text });
|
|
2255
|
-
|
|
2452
|
+
if (isUserFacingProse(displayText)) {
|
|
2453
|
+
return finish("finished", displayText, step);
|
|
2454
|
+
}
|
|
2455
|
+
return finish("no-tools", displayText || "done", step);
|
|
2256
2456
|
}
|
|
2257
2457
|
messages.push({ role: "assistant", content: result.text, toolCalls });
|
|
2258
2458
|
for (const call of toolCalls) {
|
|
@@ -2274,7 +2474,7 @@ Fix the failing tests, then call finish again.${verifyRounds === 0 ? " (last ver
|
|
|
2274
2474
|
call.__gateNote = gate.note;
|
|
2275
2475
|
}
|
|
2276
2476
|
}
|
|
2277
|
-
const toolResult = options.externalTools?.owns(call.name) ? await options.externalTools.execute(call) : await executeTool(call, ctx);
|
|
2477
|
+
const toolResult = options.externalTools?.owns(call.name) ? await options.externalTools.execute(call, { graph: ctx.graph }) : await executeTool(call, ctx);
|
|
2278
2478
|
if (!options.externalTools?.owns(call.name)) {
|
|
2279
2479
|
recordDiscoveryGateOutcome(call.name, discoveryGate, { mutated: toolResult.mutated });
|
|
2280
2480
|
}
|
|
@@ -2315,10 +2515,10 @@ ${gateNote}`;
|
|
|
2315
2515
|
}
|
|
2316
2516
|
return finish("max-steps", "reached the step limit before finishing", maxSteps);
|
|
2317
2517
|
}
|
|
2318
|
-
async function complete(providers, messages, tools, onEvent, stream, modelProfile, identifierTrie, draftCandidates, promptSegments) {
|
|
2518
|
+
async function complete(providers, messages, tools, onEvent, stream, modelProfile, identifierTrie, draftCandidates, promptSegments, skipPatchIrGrammar = false) {
|
|
2319
2519
|
if (providers.length === 0) throw new Error("no model provider available");
|
|
2320
2520
|
const onToken = stream ? (t) => onEvent({ type: "token", text: t }) : void 0;
|
|
2321
|
-
const grammar = shouldUsePatchIrGrammar(modelProfile) ? patchIrGbnf() : void 0;
|
|
2521
|
+
const grammar = !skipPatchIrGrammar && shouldUsePatchIrGrammar(modelProfile) ? patchIrGbnf() : void 0;
|
|
2322
2522
|
const requireGrammar = !!(grammar && modelProfile?.constrainedDecoding && providers.some((p) => p.id === "llama-cpp"));
|
|
2323
2523
|
let lastErr;
|
|
2324
2524
|
for (let i = 0; i < providers.length; i++) {
|
|
@@ -2429,6 +2629,14 @@ function writeAgentAudit(fsImpl, rec, ts) {
|
|
|
2429
2629
|
} catch {
|
|
2430
2630
|
}
|
|
2431
2631
|
}
|
|
2632
|
+
function isUserFacingProse(text) {
|
|
2633
|
+
const t = (text ?? "").trim();
|
|
2634
|
+
if (t.length < 12) return false;
|
|
2635
|
+
if (/"schemaVersion"\s*:\s*"patch-ir\/0"/i.test(t)) return false;
|
|
2636
|
+
if (/^\s*\{[\s\S]*"operations"\s*:/.test(t)) return false;
|
|
2637
|
+
if (!/[A-Za-z]{4,}/.test(t)) return false;
|
|
2638
|
+
return true;
|
|
2639
|
+
}
|
|
2432
2640
|
function stableArgs(args) {
|
|
2433
2641
|
const keys = Object.keys(args).sort();
|
|
2434
2642
|
return JSON.stringify(keys.map((k) => [k, args[k]]));
|
|
@@ -2454,5 +2662,5 @@ function buildSpanIndex(graph) {
|
|
|
2454
2662
|
}
|
|
2455
2663
|
|
|
2456
2664
|
export { CONTEXT_POLICY_VERSION, computeFcsReport, createTrajectoryCollector, renderFcsReportMarkdown, runAgent };
|
|
2457
|
-
//# sourceMappingURL=chunk-
|
|
2458
|
-
//# sourceMappingURL=chunk-
|
|
2665
|
+
//# sourceMappingURL=chunk-2ZHWF7C6.js.map
|
|
2666
|
+
//# sourceMappingURL=chunk-2ZHWF7C6.js.map
|