@vibgrate/cli 2026.727.4 → 2026.728.3

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.
Files changed (80) hide show
  1. package/DOCS.md +3 -3
  2. package/dist/baseline-PPZJBYAJ.js +8 -0
  3. package/dist/{baseline-ENCOSJYQ.js.map → baseline-PPZJBYAJ.js.map} +1 -1
  4. package/dist/{chunk-T3AYRS7J.js → chunk-3BIRGSRS.js} +3 -3
  5. package/dist/{chunk-T3AYRS7J.js.map → chunk-3BIRGSRS.js.map} +1 -1
  6. package/dist/{chunk-YKVH2PGF.js → chunk-57QU36P6.js} +94 -142
  7. package/dist/chunk-57QU36P6.js.map +1 -0
  8. package/dist/{chunk-FPEOIS7K.js → chunk-6GRLZ4Z2.js} +12 -9
  9. package/dist/chunk-6GRLZ4Z2.js.map +1 -0
  10. package/dist/{chunk-K7REHDQS.js → chunk-6HX47EBL.js} +25 -19
  11. package/dist/chunk-6HX47EBL.js.map +1 -0
  12. package/dist/{chunk-KKRSQQ3A.js → chunk-7AVYKZEM.js} +4 -4
  13. package/dist/{chunk-KKRSQQ3A.js.map → chunk-7AVYKZEM.js.map} +1 -1
  14. package/dist/{chunk-MAUJTPQW.js → chunk-A2IYFNCQ.js} +24 -62
  15. package/dist/chunk-A2IYFNCQ.js.map +1 -0
  16. package/dist/{chunk-3SDV6ADQ.js → chunk-CQDUBAQY.js} +3 -3
  17. package/dist/{chunk-3SDV6ADQ.js.map → chunk-CQDUBAQY.js.map} +1 -1
  18. package/dist/{chunk-77LYGXBI.js → chunk-JRAGO6OB.js} +3 -3
  19. package/dist/{chunk-77LYGXBI.js.map → chunk-JRAGO6OB.js.map} +1 -1
  20. package/dist/{chunk-PVZBYZZR.js → chunk-NZELMYT4.js} +27 -6
  21. package/dist/chunk-NZELMYT4.js.map +1 -0
  22. package/dist/chunk-OSD546W7.js +167 -0
  23. package/dist/chunk-OSD546W7.js.map +1 -0
  24. package/dist/{chunk-GYSOQH5C.js → chunk-OV4KGXPD.js} +30 -4
  25. package/dist/chunk-OV4KGXPD.js.map +1 -0
  26. package/dist/{chunk-XPJZTSY7.js → chunk-R2QNFXE5.js} +3 -3
  27. package/dist/{chunk-XPJZTSY7.js.map → chunk-R2QNFXE5.js.map} +1 -1
  28. package/dist/{chunk-PXHNTC6D.js → chunk-SIPGDJT4.js} +3 -3
  29. package/dist/{chunk-PXHNTC6D.js.map → chunk-SIPGDJT4.js.map} +1 -1
  30. package/dist/{chunk-YCJIIGLP.js → chunk-SZSNPXSW.js} +4 -4
  31. package/dist/{chunk-YCJIIGLP.js.map → chunk-SZSNPXSW.js.map} +1 -1
  32. package/dist/chunk-UZJS7GMK.js +57 -0
  33. package/dist/chunk-UZJS7GMK.js.map +1 -0
  34. package/dist/{chunk-LJP2EPKM.js → chunk-VI4ITXHQ.js} +4 -4
  35. package/dist/{chunk-LJP2EPKM.js.map → chunk-VI4ITXHQ.js.map} +1 -1
  36. package/dist/{chunk-HYRAILGM.js → chunk-VYGEOOLY.js} +3 -3
  37. package/dist/{chunk-HYRAILGM.js.map → chunk-VYGEOOLY.js.map} +1 -1
  38. package/dist/{chunk-R6ZRVVZT.js → chunk-WH2N22S3.js} +3 -3
  39. package/dist/{chunk-R6ZRVVZT.js.map → chunk-WH2N22S3.js.map} +1 -1
  40. package/dist/{chunk-KXSKFQMI.js → chunk-YF43FOPP.js} +5 -5
  41. package/dist/chunk-YF43FOPP.js.map +1 -0
  42. package/dist/cli.js +531 -142
  43. package/dist/cli.js.map +1 -1
  44. package/dist/index.d.ts +1 -1
  45. package/dist/index.js +6 -5
  46. package/dist/index.js.map +1 -1
  47. package/dist/{interactive-SMHVURYK.js → interactive-OCWQ326U.js} +18 -17
  48. package/dist/interactive-OCWQ326U.js.map +1 -0
  49. package/dist/{llm-host-7GWDO6IX.js → llm-host-XYBT4267.js} +4 -4
  50. package/dist/{llm-host-7GWDO6IX.js.map → llm-host-XYBT4267.js.map} +1 -1
  51. package/dist/model-manager-LB54VSV7.js +10 -0
  52. package/dist/{model-manager-PN7HEDXD.js.map → model-manager-LB54VSV7.js.map} +1 -1
  53. package/dist/{model-orchestrator-4VSYP4J4.js → model-orchestrator-4M5FG6MN.js} +3 -3
  54. package/dist/{model-orchestrator-4VSYP4J4.js.map → model-orchestrator-4M5FG6MN.js.map} +1 -1
  55. package/dist/resolve-gguf-4AFRN4CP.js +9 -0
  56. package/dist/{resolve-gguf-Y6FH3CNB.js.map → resolve-gguf-4AFRN4CP.js.map} +1 -1
  57. package/dist/{runtime-session-4AMZIAAG.js → runtime-session-EJQZXANB.js} +5 -5
  58. package/dist/{runtime-session-4AMZIAAG.js.map → runtime-session-EJQZXANB.js.map} +1 -1
  59. package/dist/{session-W3646AOV.js → session-ZJGENHKX.js} +6 -5
  60. package/dist/{session-W3646AOV.js.map → session-ZJGENHKX.js.map} +1 -1
  61. package/dist/{stream-json-X7UQFB4T.js → stream-json-Z5KC2DM3.js} +6 -5
  62. package/dist/stream-json-Z5KC2DM3.js.map +1 -0
  63. package/dist/{vgd-CVLKBS7K.js → vgd-3MHSB4KA.js} +4 -4
  64. package/dist/vgd-3MHSB4KA.js.map +1 -0
  65. package/package.json +1 -1
  66. package/dist/baseline-ENCOSJYQ.js +0 -8
  67. package/dist/chunk-FPEOIS7K.js.map +0 -1
  68. package/dist/chunk-GYSOQH5C.js.map +0 -1
  69. package/dist/chunk-K7REHDQS.js.map +0 -1
  70. package/dist/chunk-KUIBP3LU.js +0 -101
  71. package/dist/chunk-KUIBP3LU.js.map +0 -1
  72. package/dist/chunk-KXSKFQMI.js.map +0 -1
  73. package/dist/chunk-MAUJTPQW.js.map +0 -1
  74. package/dist/chunk-PVZBYZZR.js.map +0 -1
  75. package/dist/chunk-YKVH2PGF.js.map +0 -1
  76. package/dist/interactive-SMHVURYK.js.map +0 -1
  77. package/dist/model-manager-PN7HEDXD.js +0 -9
  78. package/dist/resolve-gguf-Y6FH3CNB.js +0 -9
  79. package/dist/stream-json-X7UQFB4T.js.map +0 -1
  80. package/dist/vgd-CVLKBS7K.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,36 +1,37 @@
1
1
  #!/usr/bin/env node
2
- import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-FPEOIS7K.js';
3
- export { runBuild } from './chunk-FPEOIS7K.js';
4
- import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-MAUJTPQW.js';
5
- import { loadAdvancedScanHook, baselineCommand } from './chunk-HYRAILGM.js';
6
- import { runCodeSession } from './chunk-R6ZRVVZT.js';
7
- import { summarizeDiffs, ScriptedProvider } from './chunk-KXSKFQMI.js';
2
+ import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-6GRLZ4Z2.js';
3
+ export { runBuild } from './chunk-6GRLZ4Z2.js';
4
+ import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-A2IYFNCQ.js';
5
+ import { loadAdvancedScanHook, baselineCommand } from './chunk-VYGEOOLY.js';
6
+ import { runCodeSession } from './chunk-WH2N22S3.js';
7
+ import { summarizeDiffs, ScriptedProvider } from './chunk-YF43FOPP.js';
8
8
  import { disableColor, info, c, json, out } from './chunk-CT5BS56U.js';
9
- import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-77LYGXBI.js';
9
+ import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-JRAGO6OB.js';
10
10
  import './chunk-5I4VSBWQ.js';
11
11
  import './chunk-IS7VTH2Q.js';
12
12
  import { gatherSystemMemory } from './chunk-6UQMXIAG.js';
13
- import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-PVZBYZZR.js';
13
+ import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-NZELMYT4.js';
14
14
  import { fmt, estimateModelBytes } from './chunk-7N4Y3E47.js';
15
15
  import './chunk-IZDH67DX.js';
16
16
  import './chunk-HK3AWUXH.js';
17
17
  import { vgdIsRunning, vgdRequest, vgdSocketPath } from './chunk-PMYWZRRS.js';
18
- import { defaultProcessEndpoint, startProcessHostServer, resolveInferenceIsolation } from './chunk-PXHNTC6D.js';
19
- import { clearHostSessionPool, acquireHostSession, generateOnSession, listHostSessions, hostSessionPoolSize } from './chunk-K7REHDQS.js';
18
+ import { defaultProcessEndpoint, startProcessHostServer, resolveInferenceIsolation } from './chunk-SIPGDJT4.js';
19
+ import { clearHostSessionPool, acquireHostSession, generateOnSession, listHostSessions, hostSessionPoolSize } from './chunk-6HX47EBL.js';
20
20
  import { buildIdentifierTrieFromGraph } from './chunk-JIBOJTGS.js';
21
- import './chunk-KKRSQQ3A.js';
22
- import { buildModelInstallPlan } from './chunk-YCJIIGLP.js';
23
- import { ensurePackage, ensureUnavailableMessage } from './chunk-KUIBP3LU.js';
24
- import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-LJP2EPKM.js';
25
- import { resolveDsn, resolveIngestHost, dashHostForIngestHost, resolveCliInvocation, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, CliError, ExitCode, parseDsn as parseDsn$1, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, NPX_INVOCATION, refreshIfStale, driftCount, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, ASSISTANTS, detectAssistants, usageError, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, buildGraph, writeSnapshot, probeFreshness, discover, assistantById, SMALL_REPO_FILES, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath, SKIP_DIRS, SKIP_FILES } from './chunk-YKVH2PGF.js';
21
+ import './chunk-7AVYKZEM.js';
22
+ import { buildModelInstallPlan } from './chunk-SZSNPXSW.js';
23
+ import { ensurePackage, ensureUnavailableMessage } from './chunk-OSD546W7.js';
24
+ import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-VI4ITXHQ.js';
25
+ import { resolveDsn, resolveIngestHost, dashHostForIngestHost, availableRegionIds, createWorkspaceDsn, writeStoredCredentials, credentialsPath, findGitRoot, ensureGitignored, gitignoreEntryForCredentials, clearStoredCredentials, CliError, ExitCode, parseDsn as parseDsn$1, uploadScanArtifact, ingestHostForRegionId, dsnCommand, pushCommand, refreshIfStale, driftCount, countTokens, shortestPath, pathDisconnect, testsToRun, detectRunner, ASSISTANTS, detectAssistants, usageError, detectServeLaunch, installAssistant, writeNavigationConfig, uninstallAssistant, coveringTests, FREE_PACK, readScanArtifact, buildGraph, writeSnapshot, probeFreshness, discover, assistantById, SMALL_REPO_FILES, publishPrivateLibrary, assessDocQuality, symbolsFromApi, fetchHostedDocsCached, selectForBudget, hostedBase, readStoredCredentials, projectCredentialsPath, homeCredentialsPath, SKIP_DIRS, SKIP_FILES } from './chunk-57QU36P6.js';
26
26
  import { inventory, enrichOnline, ECOSYSTEMS, catalogPath, libDir, loadCatalog, driftFor, addLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface } from './chunk-6AXHLQBV.js';
27
- import { writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols } from './chunk-T3AYRS7J.js';
27
+ import { writeDefaultConfig, parseDsn, detectVcs, computeRepoFingerprint, resolveRepositoryName, fetchScanPreflight, runCoreScan, VERSION, loadConfig, prepareCompressedUpload, computeDriftScore, titleBox, projectTypeToVulnEcosystem, driftBar, gitHistoryAvailable, buildVersionTimelines, findPackageAnyEcosystem, normalizeConstraint, findVersionCrossings, versionSatisfies, PROJECT_TYPE_TO_OSV_ECOSYSTEM, fetchRiskySymbols } from './chunk-3BIRGSRS.js';
28
28
  import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-ZBTY6VV4.js';
29
29
  import { ensureDir, pathExists, readJsonFile, writeTextFile, writeJsonFile } from './chunk-CRAMOEBE.js';
30
30
  import { resolveOne } from './chunk-J7LKEB2R.js';
31
31
  import { embeddingsCached, resolveEmbedModel, loadEmbedder, getNodeEmbeddings, queryGraphSemantic, queryGraph, unavailableMessage, countPending, indexFor, impactOf, modelCacheInfo, clearModelCache } from './chunk-6UK6QPTR.js';
32
- import { discoverModels } from './chunk-3SDV6ADQ.js';
33
- import { listCachedWeights, ensureWeightCached, catalogIntegrityReport, weightStoreDir } from './chunk-GYSOQH5C.js';
32
+ import { discoverModels } from './chunk-CQDUBAQY.js';
33
+ import { resolveCliInvocation, NPX_INVOCATION } from './chunk-UZJS7GMK.js';
34
+ import { freeBytesOnVolume, weightStoreDir, listCachedWeights, ensureWeightCached, catalogIntegrityReport } from './chunk-OV4KGXPD.js';
34
35
  import { resolvedGrammarFiles, grammarSetVersion } from './chunk-ON25BX6T.js';
35
36
  import './chunk-RXP66R2E.js';
36
37
  import { resolveGraphPath, renderReport, loadGraph, writeArtifacts, vibgrateDir, SCHEMA_VERSION } from './chunk-B3YUO3NW.js';
@@ -2135,10 +2136,23 @@ function runTree(graph, params) {
2135
2136
 
2136
2137
  // src/lsp/enrich.ts
2137
2138
  var OSV_QUERY_URL = "https://api.osv.dev/v1/query";
2139
+ var KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
2138
2140
  var cache = /* @__PURE__ */ new Map();
2141
+ var kevCache = null;
2142
+ var KEV_TTL_MS = 6 * 60 * 60 * 1e3;
2143
+ var SEVERITY_RANK = {
2144
+ critical: 4,
2145
+ high: 3,
2146
+ moderate: 2,
2147
+ low: 1,
2148
+ unknown: 0
2149
+ };
2139
2150
  function key(ecosystem, name, version) {
2140
2151
  return `${ecosystem}:${name}@${version}`;
2141
2152
  }
2153
+ function emptyCounts() {
2154
+ return { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 };
2155
+ }
2142
2156
  function severityOf(v) {
2143
2157
  const dbSpecific = v.database_specific;
2144
2158
  const label = typeof dbSpecific?.severity === "string" ? dbSpecific.severity.toLowerCase() : "";
@@ -2159,7 +2173,24 @@ function severityOf(v) {
2159
2173
  }
2160
2174
  return "unknown";
2161
2175
  }
2162
- function toSummary(raw) {
2176
+ function fixedVersionsOf(v, packageName) {
2177
+ const affected = Array.isArray(v.affected) ? v.affected : [];
2178
+ const lower = packageName.toLowerCase();
2179
+ const out2 = [];
2180
+ for (const a of affected) {
2181
+ const pkg = a.package;
2182
+ if (pkg?.name && pkg.name.toLowerCase() !== lower) continue;
2183
+ const ranges = Array.isArray(a.ranges) ? a.ranges : [];
2184
+ for (const range of ranges) {
2185
+ const events = Array.isArray(range.events) ? range.events : [];
2186
+ for (const ev of events) {
2187
+ if (typeof ev.fixed === "string" && ev.fixed && !out2.includes(ev.fixed)) out2.push(ev.fixed);
2188
+ }
2189
+ }
2190
+ }
2191
+ return out2;
2192
+ }
2193
+ function toSummary(raw, packageName = "") {
2163
2194
  const v = raw ?? {};
2164
2195
  const aliases = Array.isArray(v.aliases) ? v.aliases.map(String) : [];
2165
2196
  const details = typeof v.details === "string" ? v.details : "";
@@ -2168,7 +2199,9 @@ function toSummary(raw) {
2168
2199
  id: String(v.id ?? "unknown"),
2169
2200
  cves: aliases.filter((a) => a.startsWith("CVE-")),
2170
2201
  summary,
2171
- severity: severityOf(v)
2202
+ severity: severityOf(v),
2203
+ fixedVersions: fixedVersionsOf(v, packageName),
2204
+ published: typeof v.published === "string" ? v.published : null
2172
2205
  };
2173
2206
  }
2174
2207
  async function enrichVulns(ecosystem, name, version, opts = { offline: false }) {
@@ -2188,7 +2221,7 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
2188
2221
  }).finally(() => clearTimeout(timer));
2189
2222
  if (!res.ok) return { vulns: [], cveCount: 0, source: "error" };
2190
2223
  const data = await res.json();
2191
- const vulns = (data.vulns ?? []).map(toSummary);
2224
+ const vulns = (data.vulns ?? []).map((raw) => toSummary(raw, name));
2192
2225
  const cveCount = new Set(vulns.flatMap((v) => v.cves)).size;
2193
2226
  const result = { vulns, cveCount, source: "osv" };
2194
2227
  cache.set(k, result);
@@ -2197,6 +2230,106 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
2197
2230
  return { vulns: [], cveCount: 0, source: "error" };
2198
2231
  }
2199
2232
  }
2233
+ async function loadKevCves(opts = { offline: false }) {
2234
+ if (opts.offline) return { cves: /* @__PURE__ */ new Set(), source: "skipped" };
2235
+ if (kevCache && Date.now() - kevCache.at < KEV_TTL_MS) {
2236
+ return { cves: kevCache.cves, source: "cisa" };
2237
+ }
2238
+ try {
2239
+ const controller = new AbortController();
2240
+ const timer = setTimeout(() => controller.abort(), 12e3);
2241
+ const res = await fetch(KEV_URL, { signal: controller.signal }).finally(() => clearTimeout(timer));
2242
+ if (!res.ok) return { cves: /* @__PURE__ */ new Set(), source: "error" };
2243
+ const data = await res.json();
2244
+ const cves = /* @__PURE__ */ new Set();
2245
+ for (const v of data.vulnerabilities ?? []) {
2246
+ if (v.cveID) cves.add(v.cveID.toUpperCase());
2247
+ }
2248
+ kevCache = { at: Date.now(), cves };
2249
+ return { cves, source: "cisa" };
2250
+ } catch {
2251
+ return { cves: /* @__PURE__ */ new Set(), source: "error" };
2252
+ }
2253
+ }
2254
+ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
2255
+ if (opts.offline) {
2256
+ return {
2257
+ findings: [],
2258
+ counts: emptyCounts(),
2259
+ packagesChecked: 0,
2260
+ source: "offline",
2261
+ kevSource: "skipped"
2262
+ };
2263
+ }
2264
+ if (targets.length === 0) {
2265
+ return {
2266
+ findings: [],
2267
+ counts: emptyCounts(),
2268
+ packagesChecked: 0,
2269
+ source: "osv",
2270
+ kevSource: "skipped"
2271
+ };
2272
+ }
2273
+ const seen = /* @__PURE__ */ new Set();
2274
+ const unique = [];
2275
+ for (const t of targets) {
2276
+ if (!t.ecosystem || !t.package || !t.version) continue;
2277
+ const k = key(t.ecosystem, t.package, t.version);
2278
+ if (seen.has(k)) continue;
2279
+ seen.add(k);
2280
+ unique.push(t);
2281
+ }
2282
+ const [kev] = await Promise.all([loadKevCves({ offline: false })]);
2283
+ const concurrency = Math.max(1, Math.min(opts.concurrency ?? 8, 16));
2284
+ const findings = [];
2285
+ let anyOk = false;
2286
+ let anyError = false;
2287
+ let i = 0;
2288
+ async function worker() {
2289
+ for (; ; ) {
2290
+ const idx = i++;
2291
+ if (idx >= unique.length) return;
2292
+ const t = unique[idx];
2293
+ const r = await enrichVulns(t.ecosystem, t.package, t.version, { offline: false });
2294
+ if (r.source === "osv" || r.source === "cache") anyOk = true;
2295
+ else if (r.source === "error") anyError = true;
2296
+ for (const v of r.vulns) {
2297
+ const kevHit = v.cves.some((c2) => kev.cves.has(c2.toUpperCase()));
2298
+ findings.push({
2299
+ package: t.package,
2300
+ version: t.version,
2301
+ ecosystem: t.ecosystem,
2302
+ id: v.id,
2303
+ cves: v.cves,
2304
+ summary: v.summary,
2305
+ severity: v.severity,
2306
+ fixedVersions: v.fixedVersions,
2307
+ published: v.published,
2308
+ kev: kevHit,
2309
+ reachability: t.reachability ?? "unknown",
2310
+ file: t.file ?? null,
2311
+ line: t.line ?? null,
2312
+ section: t.section ?? null,
2313
+ latestStable: t.latestStable ?? null
2314
+ });
2315
+ }
2316
+ }
2317
+ }
2318
+ await Promise.all(Array.from({ length: Math.min(concurrency, unique.length) }, () => worker()));
2319
+ findings.sort(
2320
+ (a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity] || Number(b.kev) - Number(a.kev) || a.package.localeCompare(b.package) || a.id.localeCompare(b.id)
2321
+ );
2322
+ const counts = emptyCounts();
2323
+ for (const f of findings) counts[f.severity]++;
2324
+ const source = anyOk ? "osv" : anyError ? "error" : "osv";
2325
+ return {
2326
+ findings,
2327
+ counts,
2328
+ packagesChecked: unique.length,
2329
+ source,
2330
+ kevSource: kev.source
2331
+ };
2332
+ }
2200
2333
 
2201
2334
  // src/lsp/server.ts
2202
2335
  function bandForDependency(dep) {
@@ -2284,6 +2417,7 @@ var VibgrateLanguageServer = class {
2284
2417
  this.conn.onRequest("vibgrate/graph/query", (_m, params) => this.onGraphQuery(params));
2285
2418
  this.conn.onRequest("vibgrate/score/forFile", (_m, params) => this.onScoreForFile(params));
2286
2419
  this.conn.onRequest("vibgrate/enrich", (_m, params) => this.onEnrich(params));
2420
+ this.conn.onRequest("vibgrate/vulns", (_m, _params) => this.onVulns());
2287
2421
  this.conn.onRequest("workspace/executeCommand", (_m, params) => {
2288
2422
  const p = params;
2289
2423
  if (p.command === "vibgrate.rescan") {
@@ -2539,6 +2673,72 @@ var VibgrateLanguageServer = class {
2539
2673
  const p = params ?? {};
2540
2674
  return enrichVulns(p.ecosystem ?? null, p.package ?? "", p.version ?? null, { offline: this.opts.offline });
2541
2675
  }
2676
+ /**
2677
+ * `vibgrate/vulns` — live OSV.dev pass over every resolved dependency in the
2678
+ * current workspace artifact. Powers the Vulnerabilities panel. Empty
2679
+ * findings with `source: 'osv'` means checked clean; `offline`/`error` mean
2680
+ * we could not check (absent ≠ zero). Attaches manifest locations, fixed-in
2681
+ * versions, CISA KEV flags, and a best-effort code-map reachability signal.
2682
+ */
2683
+ async onVulns() {
2684
+ if (this.opts.offline) {
2685
+ return {
2686
+ findings: [],
2687
+ counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 },
2688
+ packagesChecked: 0,
2689
+ source: "offline",
2690
+ kevSource: "skipped"
2691
+ };
2692
+ }
2693
+ const a = this.artifact;
2694
+ if (!a) {
2695
+ return {
2696
+ findings: [],
2697
+ counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 },
2698
+ packagesChecked: 0,
2699
+ source: "pending",
2700
+ kevSource: "skipped"
2701
+ };
2702
+ }
2703
+ const reachedPkgs = packageReachSet(this.graph);
2704
+ const targets = [];
2705
+ for (const proj of a.projects ?? []) {
2706
+ const ecosystem = osvEcosystem(proj.type);
2707
+ if (!ecosystem) continue;
2708
+ const relManifest = manifestRelativePath(proj);
2709
+ const absManifest = path37.resolve(this.opts.root, relManifest);
2710
+ let text = null;
2711
+ try {
2712
+ if (fs8.existsSync(absManifest)) text = fs8.readFileSync(absManifest, "utf8");
2713
+ } catch {
2714
+ text = null;
2715
+ }
2716
+ const kind = manifestKind(absManifest);
2717
+ for (const dep of proj.dependencies ?? []) {
2718
+ if (!dep.resolvedVersion) continue;
2719
+ let line = null;
2720
+ if (text && kind) {
2721
+ const l = findPackageLine(text, dep.package, kind);
2722
+ if (l >= 0) line = l + 1;
2723
+ }
2724
+ let reachability = "unknown";
2725
+ if (reachedPkgs) {
2726
+ reachability = packageReached(reachedPkgs, dep.package) ? "reached" : "not-observed";
2727
+ }
2728
+ targets.push({
2729
+ ecosystem,
2730
+ package: dep.package,
2731
+ version: dep.resolvedVersion,
2732
+ file: relManifest,
2733
+ line,
2734
+ section: dep.section ?? null,
2735
+ latestStable: dep.latestStable ?? null,
2736
+ reachability
2737
+ });
2738
+ }
2739
+ }
2740
+ return scanWorkspaceVulns(targets, { offline: this.opts.offline });
2741
+ }
2542
2742
  onScoreForFile(params) {
2543
2743
  const p = params;
2544
2744
  const a = this.artifact;
@@ -2639,6 +2839,63 @@ function buildBreakdown(drift, projects) {
2639
2839
  });
2640
2840
  return items.length > 0 ? items : void 0;
2641
2841
  }
2842
+ function manifestRelativePath(proj) {
2843
+ const base = proj.path === "." || proj.path === "" ? "" : proj.path;
2844
+ const join27 = (name) => base ? path37.join(base, name) : name;
2845
+ switch (proj.type) {
2846
+ case "node":
2847
+ case "typescript":
2848
+ return join27("package.json");
2849
+ case "python":
2850
+ return join27("pyproject.toml");
2851
+ case "go":
2852
+ return join27("go.mod");
2853
+ case "rust":
2854
+ return join27("Cargo.toml");
2855
+ case "ruby":
2856
+ return join27("Gemfile");
2857
+ case "php":
2858
+ return join27("composer.json");
2859
+ case "java":
2860
+ case "kotlin":
2861
+ case "scala":
2862
+ case "groovy":
2863
+ return join27("pom.xml");
2864
+ case "dotnet":
2865
+ return join27(proj.name ? `${proj.name}.csproj` : "Directory.Build.props");
2866
+ case "dart":
2867
+ return join27("pubspec.yaml");
2868
+ case "elixir":
2869
+ return join27("mix.exs");
2870
+ default:
2871
+ return join27("package.json");
2872
+ }
2873
+ }
2874
+ function packageReachSet(graph) {
2875
+ if (!graph?.nodes?.length) return null;
2876
+ const set = /* @__PURE__ */ new Set();
2877
+ for (const n of graph.nodes) {
2878
+ if (n.kind !== "external" && n.kind !== "package" && n.kind !== "module") continue;
2879
+ const names = [n.name, n.qualifiedName].filter(Boolean);
2880
+ for (const raw of names) {
2881
+ const cleaned = raw.replace(/^node_modules\//, "").replace(/\\/g, "/");
2882
+ if (cleaned.startsWith("@")) {
2883
+ const parts = cleaned.split("/");
2884
+ if (parts.length >= 2) set.add(`${parts[0]}/${parts[1]}`.toLowerCase());
2885
+ } else {
2886
+ set.add(cleaned.split("/")[0].toLowerCase());
2887
+ }
2888
+ set.add(cleaned.toLowerCase());
2889
+ }
2890
+ }
2891
+ return set;
2892
+ }
2893
+ function packageReached(set, pkg) {
2894
+ const p = pkg.toLowerCase();
2895
+ if (set.has(p)) return true;
2896
+ if (!p.startsWith("@") && set.has(p.split("/")[0])) return true;
2897
+ return false;
2898
+ }
2642
2899
  function osvEcosystem(type) {
2643
2900
  switch (type) {
2644
2901
  case "node":
@@ -3585,7 +3842,7 @@ async function executeModelInstallPlan(plan, options = {}) {
3585
3842
  plan,
3586
3843
  installedDeps,
3587
3844
  pulledWeights,
3588
- error: ensureUnavailableMessage(res.reason ?? "install-failed", spec)
3845
+ error: ensureUnavailableMessage(res.reason ?? "install-failed", spec, res.detail)
3589
3846
  };
3590
3847
  }
3591
3848
  installedDeps.push(spec);
@@ -5279,17 +5536,35 @@ function registerModels(program) {
5279
5536
  }
5280
5537
  });
5281
5538
  applyGlobalOptions(pull);
5282
- const uninstallCmd = cmd.command("uninstall").description("uninstall a locally-installed model via your runtime (Ollama)").argument("<name>", "installed model name, e.g. qwen2.5-coder:7b").option("--runtime <id>", "runtime to remove from (default: ollama)", "ollama").option("--dry-run", "print the uninstall plan only \u2014 do not delete").option("--yes", "uninstall without an interactive confirm (required non-interactively)").action(async function(name, opts) {
5539
+ const uninstallCmd = cmd.command("uninstall").description("uninstall a locally-installed model (Ollama, LM Studio, or GGUF)").argument("<name>", "installed model name, e.g. qwen2.5-coder:7b or a .gguf basename").option("--runtime <id>", "runtime: ollama | lm-studio | gguf (default: auto-detect from installed fleet)").option("--dry-run", "print the uninstall plan only \u2014 do not delete").option("--yes", "uninstall without an interactive confirm (required non-interactively)").action(async function(name, opts) {
5283
5540
  const global = readGlobal(this);
5284
- if (opts.runtime !== "ollama") {
5285
- throw new CliError(`only the ollama runtime supports uninstall today (got --runtime ${opts.runtime}). LM Studio / gguf models are managed in their own apps.`, ExitCode.USAGE_ERROR);
5286
- }
5287
5541
  const dryRun = !!opts.dryRun;
5288
- const plan = { runtime: "ollama", command: `ollama rm ${name}`, willRemove: !dryRun };
5542
+ const target = resolveUninstallTarget(name, opts.runtime);
5543
+ if (!target) {
5544
+ const hint = opts.runtime ? `no installed model named "${name}" for runtime ${opts.runtime}` : `no installed model named "${name}"`;
5545
+ throw new CliError(
5546
+ `${hint} \u2014 check the name with \`vg models --raw\`.`,
5547
+ ExitCode.NOT_FOUND
5548
+ );
5549
+ }
5550
+ const plan = target.runtime === "ollama" ? {
5551
+ runtime: "ollama",
5552
+ name: target.name,
5553
+ path: target.path,
5554
+ command: `ollama rm ${target.name}`,
5555
+ willRemove: !dryRun
5556
+ } : {
5557
+ runtime: target.runtime,
5558
+ name: target.name,
5559
+ path: target.path,
5560
+ command: `rm ${target.path}`,
5561
+ willRemove: !dryRun
5562
+ };
5289
5563
  if (dryRun) {
5290
5564
  if (global.json) json({ ...plan, willRemove: false, note: "dry-run \u2014 re-run without --dry-run to uninstall" });
5291
5565
  else {
5292
5566
  info(`${c.cyan("vg models uninstall")} \xB7 would run: ${c.bold(plan.command)}`);
5567
+ info(c.dim(` ${target.runtime} \xB7 ${target.name}`));
5293
5568
  info(c.dim(" dry-run \u2014 re-run without --dry-run to uninstall (non-interactive: add --yes)"));
5294
5569
  }
5295
5570
  return;
@@ -5298,27 +5573,55 @@ function registerModels(program) {
5298
5573
  if (!opts.yes) {
5299
5574
  if (!interactive) {
5300
5575
  throw new CliError(
5301
- `refusing to uninstall "${name}" non-interactively without --yes \u2014 re-run with --yes, or pass --dry-run to preview.`,
5576
+ `refusing to uninstall "${target.name}" non-interactively without --yes \u2014 re-run with --yes, or pass --dry-run to preview.`,
5302
5577
  ExitCode.USAGE_ERROR
5303
5578
  );
5304
5579
  }
5305
- const ok = await confirmYesNo(`Uninstall local model ${name}?`);
5580
+ const ok = await confirmYesNo(`Uninstall local model ${target.name} (${target.runtime})?`);
5306
5581
  if (!ok) {
5307
5582
  if (global.json) json({ ...plan, willRemove: false, cancelled: true });
5308
5583
  else info(c.dim(" cancelled"));
5309
5584
  return;
5310
5585
  }
5311
5586
  }
5312
- if (!hasBinary("ollama")) {
5313
- throw new CliError("ollama is not installed or not on PATH \u2014 install it from https://ollama.com, then re-run.", ExitCode.NOT_FOUND);
5314
- }
5315
- if (!global.json) info(c.dim(` $ ${plan.command}`));
5316
- const res = spawnSync("ollama", ["rm", name], { stdio: global.json ? "ignore" : "inherit" });
5317
- if (res.status !== 0) {
5318
- throw new CliError(`\`ollama rm ${name}\` failed (exit ${res.status ?? "signal"}) \u2014 check the model name with \`vg models\`.`, ExitCode.ERROR);
5587
+ if (target.runtime === "ollama") {
5588
+ if (!hasBinary("ollama")) {
5589
+ throw new CliError(
5590
+ "ollama is not installed or not on PATH \u2014 install it from https://ollama.com, then re-run.",
5591
+ ExitCode.NOT_FOUND
5592
+ );
5593
+ }
5594
+ if (!global.json) info(c.dim(` $ ${plan.command}`));
5595
+ const res = spawnSync("ollama", ["rm", target.name], { stdio: global.json ? "ignore" : "inherit" });
5596
+ if (res.status !== 0) {
5597
+ throw new CliError(
5598
+ `\`ollama rm ${target.name}\` failed (exit ${res.status ?? "signal"}) \u2014 check the model name with \`vg models --raw\`.`,
5599
+ ExitCode.ERROR
5600
+ );
5601
+ }
5602
+ } else {
5603
+ if (!target.path || !fs8.existsSync(target.path)) {
5604
+ throw new CliError(
5605
+ `model file not found at ${target.path || "(unknown path)"} \u2014 it may already be removed.`,
5606
+ ExitCode.NOT_FOUND
5607
+ );
5608
+ }
5609
+ if (!target.path.endsWith(".gguf")) {
5610
+ throw new CliError(
5611
+ `refusing to delete non-GGUF path for ${target.runtime} model "${target.name}"`,
5612
+ ExitCode.USAGE_ERROR
5613
+ );
5614
+ }
5615
+ if (!global.json) info(c.dim(` $ rm ${target.path}`));
5616
+ try {
5617
+ fs8.unlinkSync(target.path);
5618
+ } catch (e) {
5619
+ const msg = e instanceof Error ? e.message : String(e);
5620
+ throw new CliError(`could not delete ${target.path}: ${msg}`, ExitCode.ERROR);
5621
+ }
5319
5622
  }
5320
5623
  if (global.json) json({ ...plan, removed: true });
5321
- else info(c.green(` \u2714 uninstalled ${name}`));
5624
+ else info(c.green(` \u2714 uninstalled ${target.name}`));
5322
5625
  });
5323
5626
  applyGlobalOptions(uninstallCmd);
5324
5627
  const hostBench = cmd.command("host-bench").description("Approach B host measurement arms (TTFT / grammar / KV / sampler) + optional release gates").option("--mock", "registry metric shells only (no generate)").option("--simulate", "multi-turn warm-host simulation without a GPU (default)").option("--live", "run against a real binding + GGUF (requires --model-path)").option("--model-path <path>", "GGUF path for --live").option("--turns <n>", "turns per arm for simulate/live (default 2)", "2").option("--arms <ids>", "comma-separated arm ids (default: all)").option("--gate", "evaluate release gates; exit 2 on hard failure").option("--dry-run", "print planned arms only \u2014 do not run").action(async function(opts) {
@@ -5506,10 +5809,12 @@ function repoSignals(root2) {
5506
5809
  }
5507
5810
  function buildFullStatus(root2, models, sys) {
5508
5811
  const state = readOrchestratorState();
5812
+ const freeDiskBytes = freeBytesOnVolume(weightStoreDir());
5509
5813
  return buildOrchestratorStatus({
5510
5814
  system: sys,
5511
5815
  repo: repoSignals(root2),
5512
5816
  installedNames: models.map((m) => m.name),
5817
+ freeDiskBytes,
5513
5818
  pins: state.pins,
5514
5819
  defaultMode: state.defaultMode
5515
5820
  });
@@ -5528,7 +5833,8 @@ function printOrchestratorStatus(orch) {
5528
5833
  const sys = orch.system;
5529
5834
  const ram = `RAM ${fmt(sys.freeRamBytes)} free / ${fmt(sys.totalRamBytes)}`;
5530
5835
  const vram = typeof sys.vramTotalBytes === "number" ? ` \xB7 VRAM ${fmt(sys.vramFreeBytes ?? 0)} free / ${fmt(sys.vramTotalBytes)}` : "";
5531
- info(c.dim(` ${ram}${vram}`));
5836
+ const disk = typeof sys.freeDiskBytes === "number" ? ` \xB7 Disk ${fmt(sys.freeDiskBytes)} free (model cache)` : "";
5837
+ info(c.dim(` ${ram}${vram}${disk}`));
5532
5838
  if (orch.memoryBreakdown) {
5533
5839
  const b = orch.memoryBreakdown;
5534
5840
  info(
@@ -5569,6 +5875,56 @@ function confirmYesNo(question) {
5569
5875
  });
5570
5876
  });
5571
5877
  }
5878
+ function normalizeUninstallRuntime(raw) {
5879
+ if (!raw?.trim()) return void 0;
5880
+ const r = raw.trim().toLowerCase();
5881
+ if (r === "ollama") return "ollama";
5882
+ if (r === "lm-studio" || r === "lmstudio" || r === "lm_studio") return "lm-studio";
5883
+ if (r === "gguf" || r === "llama-cpp" || r === "llamacpp" || r === "vibgrate") return "gguf";
5884
+ throw new CliError(
5885
+ `unknown --runtime ${raw} (use ollama, lm-studio, or gguf)`,
5886
+ ExitCode.USAGE_ERROR
5887
+ );
5888
+ }
5889
+ function resolveUninstallTarget(name, runtimeOpt) {
5890
+ const want = name.trim();
5891
+ if (!want) return null;
5892
+ const wantLc = want.toLowerCase();
5893
+ const runtime = normalizeUninstallRuntime(runtimeOpt);
5894
+ const fleet = discoverModels().filter((m) => runtime ? m.runtime === runtime : true);
5895
+ const exact = fleet.filter((m) => m.name.toLowerCase() === wantLc);
5896
+ if (exact.length === 1) return exact[0];
5897
+ if (exact.length > 1) {
5898
+ const order = ["ollama", "gguf", "lm-studio"];
5899
+ for (const rt of order) {
5900
+ const hit = exact.find((m) => m.runtime === rt);
5901
+ if (hit) return hit;
5902
+ }
5903
+ return exact[0];
5904
+ }
5905
+ const base = path37.basename(wantLc);
5906
+ const soft = fleet.filter((m) => {
5907
+ const n = m.name.toLowerCase();
5908
+ return n === base || n.endsWith("/" + base) || n.endsWith(wantLc) || path37.basename(n) === base;
5909
+ });
5910
+ if (soft.length === 1) return soft[0];
5911
+ if (soft.length > 1) {
5912
+ const baseHits = soft.filter((m) => path37.basename(m.name).toLowerCase() === base);
5913
+ const pool = baseHits.length ? baseHits : soft;
5914
+ const order = ["ollama", "gguf", "lm-studio"];
5915
+ for (const rt of order) {
5916
+ const hit = pool.find((m) => m.runtime === rt);
5917
+ if (hit) return hit;
5918
+ }
5919
+ return pool[0];
5920
+ }
5921
+ if (!runtime || runtime === "ollama") {
5922
+ if (want.includes(":") || !want.includes("/") && !want.endsWith(".gguf")) {
5923
+ return { runtime: "ollama", name: want, path: "" };
5924
+ }
5925
+ }
5926
+ return null;
5927
+ }
5572
5928
  function printInstallPlanHuman(label, plan) {
5573
5929
  const title = plan.mode ? `${plan.mode} \u2192 ${plan.model}` : plan.model;
5574
5930
  info(`${c.cyan(label)} \xB7 ${c.bold(title)}`);
@@ -5700,7 +6056,7 @@ function registerCode(program) {
5700
6056
  const customSelection = !!(opts.provider || opts.model || opts.modelPath || config.provider || config.model);
5701
6057
  if (!customSelection && (modeFlag || !provider && !model)) {
5702
6058
  try {
5703
- const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-4VSYP4J4.js');
6059
+ const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-4M5FG6MN.js');
5704
6060
  const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-5O2NN3GA.js');
5705
6061
  const { loadGraph: loadGraph2 } = await import('./load-QPOWQD7C.js');
5706
6062
  const state = readOrchestratorState2();
@@ -5731,7 +6087,7 @@ function registerCode(program) {
5731
6087
  ExitCode.ERROR
5732
6088
  );
5733
6089
  }
5734
- const { resolveGgufPath } = await import('./resolve-gguf-Y6FH3CNB.js');
6090
+ const { resolveGgufPath } = await import('./resolve-gguf-4AFRN4CP.js');
5735
6091
  const primaryRef = resolved.pack.primary.backend === "llama.cpp" ? resolved.pack.primary.weightsRef : resolved.underlying.weightsRef;
5736
6092
  const gguf = resolveGgufPath({
5737
6093
  modelRef: primaryRef,
@@ -5786,7 +6142,7 @@ function registerCode(program) {
5786
6142
  if (!(process.stdin.isTTY && process.stdout.isTTY)) {
5787
6143
  throw usageError('say what to change, e.g. `vg code "add a --timeout flag to the scan command"` (guided mode needs an interactive terminal)');
5788
6144
  }
5789
- const { runInteractive } = await import('./interactive-SMHVURYK.js');
6145
+ const { runInteractive } = await import('./interactive-OCWQ326U.js');
5790
6146
  await runInteractive(
5791
6147
  rootOf(global),
5792
6148
  global,
@@ -5838,7 +6194,7 @@ function registerCode(program) {
5838
6194
  {}
5839
6195
  );
5840
6196
  if (!opts.mock && route.providers[0]) {
5841
- const { ensureManagerRuntime } = await import('./model-manager-PN7HEDXD.js');
6197
+ const { ensureManagerRuntime } = await import('./model-manager-LB54VSV7.js');
5842
6198
  const ensure = await ensureManagerRuntime({
5843
6199
  providerId: route.providers[0].id,
5844
6200
  model: route.providers[0].model,
@@ -5858,102 +6214,121 @@ function registerCode(program) {
5858
6214
  for (const s of ensure.pulled) info(c.dim(` pulled ${s}`));
5859
6215
  }
5860
6216
  }
5861
- if (!global.json && !global.quiet) {
6217
+ if (!global.json && !global.quiet && !opts.streamJson) {
5862
6218
  info(`${c.cyan("vg code")} \xB7 ${c.dim(route.reason)}`);
5863
6219
  info(`${c.cyan("vg code")} \xB7 manager ${c.bold(route.managerLine)}`);
5864
6220
  }
5865
6221
  if (opts.streamJson && !opts.mock) {
5866
- const primarySlug = route.providers[0]?.model.includes("/") ? route.providers[0].model.split("/")[0] : route.providers[0]?.id;
5867
- const { runCodeStreamJson } = await import('./stream-json-X7UQFB4T.js');
5868
- const { nodeCodeFs } = await import('./session-W3646AOV.js');
5869
- const readline5 = await import('readline');
5870
- const child = await import('child_process');
5871
- const { loadOrDiscoverFederation } = await import('./federation-SZWZIFZ7.js');
5872
- const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
5873
- const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
5874
- const { startCodeRuntimeSession } = await import('./runtime-session-4AMZIAAG.js');
5875
- const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
5876
- const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
5877
- const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
5878
- const { vgdRequest: vgdRequest2 } = await import('./vgd-CVLKBS7K.js');
5879
- const federation = loadOrDiscoverFederation(root2);
5880
- const modelProfile = mergeModelExecutionProfile(
5881
- resolveModelExecutionProfile({
5882
- providerId: primarySlug,
5883
- model: route.providers[0]?.model,
5884
- budget: Number(opts.budget) || void 0,
5885
- securityTier
5886
- }),
5887
- config.modelProfile
5888
- );
5889
- const tier = securityTier ?? modelProfile.securityTier ?? (auto ? "L1" : "L0");
5890
- const writableRoots = federation?.members.map((m) => m.root) ?? [root2];
5891
- const executionEnv = resolveExecutionEnv(tier, { writableRoots });
5892
- const runtime = await startCodeRuntimeSession({ root: root2 });
5893
- const git2 = detectGitRef(root2);
5894
- const repositoryId = repositoryIdFromRoot(root2);
5895
- if (runtime.socketPath && git2.ref) {
5896
- try {
5897
- await vgdRequest2(
5898
- { op: "put-graph", repositoryId, gitRef: git2.ref, graph },
5899
- { socketPath: runtime.socketPath }
5900
- );
5901
- } catch {
5902
- }
5903
- }
5904
- const graphBackend = resolveGraphBackend({
5905
- graph,
5906
- repositoryId,
5907
- gitRef: git2.ref || null,
5908
- socketPath: runtime.socketPath
5909
- });
5910
- const run = (command) => {
5911
- const res = child.spawnSync(command, { cwd: root2, shell: true, encoding: "utf8", timeout: 12e4, maxBuffer: 10 * 1024 * 1024 });
5912
- return { stdout: (res.stdout ?? "") + (res.stderr ? `
5913
- ${res.stderr}` : ""), exitCode: res.status ?? 1 };
5914
- };
5915
- const emit2 = (line) => {
6222
+ const emitStream = (line) => {
5916
6223
  process.stdout.write(JSON.stringify(line) + "\n");
5917
6224
  };
5918
6225
  try {
5919
- await runCodeStreamJson({
5920
- graph,
5921
- root: root2,
5922
- instruction,
5923
- providers: route.providers,
5924
- fsImpl: nodeCodeFs(root2),
5925
- run,
5926
- executionEnv,
5927
- graphBackend,
5928
- modelProfile,
5929
- auto: !!auto,
5930
- maxSteps,
5931
- budget: modelProfile.capsuleBudgetTokens,
5932
- contextBudget,
5933
- denyCommands: config.denyCommands,
5934
- testCommand: config.testCommand,
5935
- stream: true,
5936
- verify: verify3 ? { command: verify3.command, maxRounds: modelProfile.maxRepairRounds } : void 0,
5937
- capsule,
5938
- files: opts.file.length ? opts.file : void 0,
5939
- worktreeOverlay: true,
5940
- advancedMode: !capsule,
5941
- attribution: { client: "vg-code", provider: primarySlug, model: route.providers[0]?.model },
5942
- now: () => Date.now(),
5943
- emit: emit2,
5944
- bindDecisions: (session) => {
5945
- const rl = readline5.createInterface({ input: process.stdin });
5946
- rl.on("line", (raw) => {
5947
- try {
5948
- const msg = JSON.parse(raw);
5949
- if (typeof msg.approveId === "number") session.submitDecision(msg.approveId, !!msg.approve);
5950
- } catch {
5951
- }
5952
- });
6226
+ const primarySlug = route.providers[0]?.model.includes("/") ? route.providers[0].model.split("/")[0] : route.providers[0]?.id;
6227
+ const { runCodeStreamJson } = await import('./stream-json-Z5KC2DM3.js');
6228
+ const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
6229
+ const readline5 = await import('readline');
6230
+ const child = await import('child_process');
6231
+ const { loadOrDiscoverFederation } = await import('./federation-SZWZIFZ7.js');
6232
+ const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
6233
+ const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
6234
+ const { startCodeRuntimeSession } = await import('./runtime-session-EJQZXANB.js');
6235
+ const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
6236
+ const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
6237
+ const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
6238
+ const { vgdRequest: vgdRequest2 } = await import('./vgd-3MHSB4KA.js');
6239
+ const federation = loadOrDiscoverFederation(root2);
6240
+ const modelProfile = mergeModelExecutionProfile(
6241
+ resolveModelExecutionProfile({
6242
+ providerId: primarySlug,
6243
+ model: route.providers[0]?.model,
6244
+ budget: Number(opts.budget) || void 0,
6245
+ securityTier
6246
+ }),
6247
+ config.modelProfile
6248
+ );
6249
+ const tier = securityTier ?? modelProfile.securityTier ?? (auto ? "L1" : "L0");
6250
+ const writableRoots = federation?.members.map((m) => m.root) ?? [root2];
6251
+ const executionEnv = resolveExecutionEnv(tier, { writableRoots });
6252
+ const runtime = await startCodeRuntimeSession({ root: root2 });
6253
+ const git2 = detectGitRef(root2);
6254
+ const repositoryId = repositoryIdFromRoot(root2);
6255
+ if (runtime.socketPath && git2.ref) {
6256
+ try {
6257
+ await vgdRequest2(
6258
+ { op: "put-graph", repositoryId, gitRef: git2.ref, graph },
6259
+ { socketPath: runtime.socketPath }
6260
+ );
6261
+ } catch {
5953
6262
  }
6263
+ }
6264
+ const graphBackend = resolveGraphBackend({
6265
+ graph,
6266
+ repositoryId,
6267
+ gitRef: git2.ref || null,
6268
+ socketPath: runtime.socketPath
5954
6269
  });
5955
- } finally {
5956
- await runtime.dispose();
6270
+ const run = (command) => {
6271
+ const res = child.spawnSync(command, {
6272
+ cwd: root2,
6273
+ shell: true,
6274
+ encoding: "utf8",
6275
+ timeout: 12e4,
6276
+ maxBuffer: 10 * 1024 * 1024
6277
+ });
6278
+ return {
6279
+ stdout: (res.stdout ?? "") + (res.stderr ? `
6280
+ ${res.stderr}` : ""),
6281
+ exitCode: res.status ?? 1
6282
+ };
6283
+ };
6284
+ try {
6285
+ await runCodeStreamJson({
6286
+ graph,
6287
+ root: root2,
6288
+ instruction,
6289
+ providers: route.providers,
6290
+ fsImpl: nodeCodeFs(root2),
6291
+ run,
6292
+ executionEnv,
6293
+ graphBackend,
6294
+ modelProfile,
6295
+ auto: !!auto,
6296
+ maxSteps,
6297
+ budget: modelProfile.capsuleBudgetTokens,
6298
+ contextBudget,
6299
+ denyCommands: config.denyCommands,
6300
+ testCommand: config.testCommand,
6301
+ stream: true,
6302
+ verify: verify3 ? { command: verify3.command, maxRounds: modelProfile.maxRepairRounds } : void 0,
6303
+ capsule,
6304
+ files: opts.file.length ? opts.file : void 0,
6305
+ worktreeOverlay: true,
6306
+ advancedMode: !capsule,
6307
+ attribution: {
6308
+ client: "vg-code",
6309
+ provider: primarySlug,
6310
+ model: route.providers[0]?.model
6311
+ },
6312
+ now: () => Date.now(),
6313
+ emit: emitStream,
6314
+ bindDecisions: (session) => {
6315
+ const rl = readline5.createInterface({ input: process.stdin });
6316
+ rl.on("line", (raw) => {
6317
+ try {
6318
+ const msg = JSON.parse(raw);
6319
+ if (typeof msg.approveId === "number") session.submitDecision(msg.approveId, !!msg.approve);
6320
+ } catch {
6321
+ }
6322
+ });
6323
+ }
6324
+ });
6325
+ } finally {
6326
+ await runtime.dispose();
6327
+ }
6328
+ } catch (e) {
6329
+ const message = e instanceof Error ? e.message : String(e);
6330
+ emitStream({ event: "error", message });
6331
+ process.exitCode = e instanceof CliError ? e.code : ExitCode.ERROR;
5957
6332
  }
5958
6333
  return;
5959
6334
  }
@@ -5964,8 +6339,8 @@ ${res.stderr}` : ""), exitCode: res.status ?? 1 };
5964
6339
  if (!autonomous && !tty) {
5965
6340
  throw usageError("the agent approves each edit/command \u2014 run in a terminal to approve interactively, or pass --auto to run autonomously (or --single for a one-shot diff).");
5966
6341
  }
5967
- const { agentTask } = await import('./interactive-SMHVURYK.js');
5968
- const { nodeCodeFs } = await import('./session-W3646AOV.js');
6342
+ const { agentTask } = await import('./interactive-OCWQ326U.js');
6343
+ const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
5969
6344
  const { TtyPrompter } = await import('./ui-Q6DJ3GCU.js');
5970
6345
  let priorSummary;
5971
6346
  if (opts.continue) {
@@ -5987,11 +6362,11 @@ ${res.stderr}` : ""), exitCode: res.status ?? 1 };
5987
6362
  const { loadFederation } = await import('./federation-SZWZIFZ7.js');
5988
6363
  const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
5989
6364
  const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
5990
- const { startCodeRuntimeSession } = await import('./runtime-session-4AMZIAAG.js');
6365
+ const { startCodeRuntimeSession } = await import('./runtime-session-EJQZXANB.js');
5991
6366
  const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
5992
6367
  const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
5993
6368
  const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
5994
- const { vgdRequest: vgdRequest2 } = await import('./vgd-CVLKBS7K.js');
6369
+ const { vgdRequest: vgdRequest2 } = await import('./vgd-3MHSB4KA.js');
5995
6370
  const federation = loadFederation(root2);
5996
6371
  const modelProfile = mergeModelExecutionProfile(
5997
6372
  resolveModelExecutionProfile({
@@ -7099,7 +7474,11 @@ function registerLlmHost(program) {
7099
7474
  binding = ensured.module;
7100
7475
  } else if (opts.yes || !global.local) {
7101
7476
  if (!global.json) {
7102
- info(c.dim(` binding unavailable: ${ensureUnavailableMessage(ensured.reason ?? "install-failed", "node-llama-cpp@^3")}`));
7477
+ info(
7478
+ c.dim(
7479
+ ` binding unavailable: ${ensureUnavailableMessage(ensured.reason ?? "install-failed", "node-llama-cpp@^3", ensured.detail)}`
7480
+ )
7481
+ );
7103
7482
  }
7104
7483
  }
7105
7484
  if (global.json) {
@@ -7170,7 +7549,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
7170
7549
  console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
7171
7550
  }
7172
7551
  if (opts.baseline) {
7173
- const { runBaseline } = await import('./baseline-ENCOSJYQ.js');
7552
+ const { runBaseline } = await import('./baseline-PPZJBYAJ.js');
7174
7553
  await runBaseline(rootDir);
7175
7554
  }
7176
7555
  console.log("");
@@ -8689,7 +9068,7 @@ function reapAndReport(cwd, keepVersion) {
8689
9068
  }
8690
9069
 
8691
9070
  // src/reporting/commands/fix.ts
8692
- var SEVERITY_RANK = { unknown: 0, low: 1, moderate: 2, high: 3, critical: 4 };
9071
+ var SEVERITY_RANK2 = { unknown: 0, low: 1, moderate: 2, high: 3, critical: 4 };
8693
9072
  function ecosystemId(type) {
8694
9073
  return projectTypeToVulnEcosystem(type) ?? type;
8695
9074
  }
@@ -8763,7 +9142,7 @@ var fixCommand = new Command("fix").description("Get ranked, risk-tiered upgrade
8763
9142
  process.exit(1);
8764
9143
  }
8765
9144
  const failOn = opts.failOnVulns;
8766
- if (failOn && !(failOn in SEVERITY_RANK)) {
9145
+ if (failOn && !(failOn in SEVERITY_RANK2)) {
8767
9146
  console.error(chalk7.red(`Invalid --fail-on-vulns value '${opts.failOnVulns}'. Use one of: low, moderate, high, critical.`));
8768
9147
  process.exit(1);
8769
9148
  }
@@ -8865,10 +9244,10 @@ var fixCommand = new Command("fix").description("Get ranked, risk-tiered upgrade
8865
9244
  }
8866
9245
  if (failOn) {
8867
9246
  const recommended = response.plans.find((p) => p.tier === response.recommended);
8868
- const threshold = SEVERITY_RANK[failOn];
9247
+ const threshold = SEVERITY_RANK2[failOn];
8869
9248
  let stillOpen = 0;
8870
- for (const sev of Object.keys(SEVERITY_RANK)) {
8871
- if (SEVERITY_RANK[sev] < threshold) continue;
9249
+ for (const sev of Object.keys(SEVERITY_RANK2)) {
9250
+ if (SEVERITY_RANK2[sev] < threshold) continue;
8872
9251
  const open = response.unresolved.bySeverity[sev] ?? 0;
8873
9252
  const maxFixable = Math.max(0, ...response.plans.map((p) => p.fixes.bySeverity[sev] ?? 0));
8874
9253
  const notFixedByRecommended = maxFixable - (recommended?.fixes.bySeverity[sev] ?? 0);
@@ -10810,7 +11189,7 @@ async function resolveAdvisory(id, opts) {
10810
11189
  }
10811
11190
 
10812
11191
  // src/reporting/commands/evidence/feeds.ts
10813
- var KEV_URL = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
11192
+ var KEV_URL2 = "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json";
10814
11193
  var OSV_BATCH_URL = "https://api.osv.dev/v1/querybatch";
10815
11194
  var OSV_VULN_URL = "https://api.osv.dev/v1/vulns/";
10816
11195
  async function getJson(url, init) {
@@ -10825,7 +11204,7 @@ async function getJson(url, init) {
10825
11204
  return res.json();
10826
11205
  }
10827
11206
  async function fetchKevCatalog() {
10828
- const data = await getJson(KEV_URL);
11207
+ const data = await getJson(KEV_URL2);
10829
11208
  const map = /* @__PURE__ */ new Map();
10830
11209
  for (const v of data.vulnerabilities ?? []) {
10831
11210
  if (v.cveID) map.set(v.cveID.toUpperCase(), v);
@@ -11973,12 +12352,22 @@ function handleError(err) {
11973
12352
  if (err.code === "commander.version") process.exit(ExitCode.OK);
11974
12353
  process.exit(ExitCode.USAGE_ERROR);
11975
12354
  }
12355
+ const streamJsonHost = process.argv.includes("--stream-json") || process.env.VG_CODE_STREAM_JSON === "1";
12356
+ const emitHostError = (message2) => {
12357
+ if (!streamJsonHost) return;
12358
+ try {
12359
+ process.stdout.write(JSON.stringify({ event: "error", message: message2 }) + "\n");
12360
+ } catch {
12361
+ }
12362
+ };
11976
12363
  if (err instanceof CliError) {
12364
+ emitHostError(err.message);
11977
12365
  info(c.red(`error: ${err.message}`));
11978
12366
  process.exit(err.code);
11979
12367
  }
11980
12368
  const message = err instanceof Error ? err.message : String(err);
11981
12369
  const correlation = Math.random().toString(36).slice(2, 10);
12370
+ emitHostError(message);
11982
12371
  info(c.red(`error: ${message}`));
11983
12372
  info(c.dim(` (ref ${correlation}) \u2014 re-run with --json for detail, or report at https://vibgrate.com/help`));
11984
12373
  process.exit(ExitCode.ERROR);