@vibgrate/cli 2026.727.3 → 2026.728.2

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 (81) hide show
  1. package/dist/baseline-MRUM2P6H.js +8 -0
  2. package/dist/{baseline-ATM5MXBZ.js.map → baseline-MRUM2P6H.js.map} +1 -1
  3. package/dist/chunk-3SDV6ADQ.js +78 -0
  4. package/dist/chunk-3SDV6ADQ.js.map +1 -0
  5. package/dist/{chunk-6JIKUDWM.js → chunk-6AXHLQBV.js} +219 -22
  6. package/dist/chunk-6AXHLQBV.js.map +1 -0
  7. package/dist/{chunk-K7REHDQS.js → chunk-6HX47EBL.js} +25 -19
  8. package/dist/chunk-6HX47EBL.js.map +1 -0
  9. package/dist/{chunk-Z7GP7XTJ.js → chunk-A2IYFNCQ.js} +26 -64
  10. package/dist/chunk-A2IYFNCQ.js.map +1 -0
  11. package/dist/{chunk-MAY5HLDH.js → chunk-GQTWDKMJ.js} +158 -161
  12. package/dist/chunk-GQTWDKMJ.js.map +1 -0
  13. package/dist/{chunk-OOIG3RUM.js → chunk-GYSOQH5C.js} +18 -79
  14. package/dist/chunk-GYSOQH5C.js.map +1 -0
  15. package/dist/{chunk-C66GOHYB.js → chunk-IWP7MYIA.js} +61 -23
  16. package/dist/chunk-IWP7MYIA.js.map +1 -0
  17. package/dist/{chunk-77LYGXBI.js → chunk-JRAGO6OB.js} +3 -3
  18. package/dist/{chunk-77LYGXBI.js.map → chunk-JRAGO6OB.js.map} +1 -1
  19. package/dist/{chunk-NDMDSPFX.js → chunk-KKRSQQ3A.js} +4 -3
  20. package/dist/chunk-KKRSQQ3A.js.map +1 -0
  21. package/dist/{chunk-FFWGT55D.js → chunk-NTW5UEKT.js} +3 -3
  22. package/dist/{chunk-FFWGT55D.js.map → chunk-NTW5UEKT.js.map} +1 -1
  23. package/dist/chunk-OSD546W7.js +167 -0
  24. package/dist/chunk-OSD546W7.js.map +1 -0
  25. package/dist/{chunk-3V24O47U.js → chunk-PVZBYZZR.js} +19 -9
  26. package/dist/chunk-PVZBYZZR.js.map +1 -0
  27. package/dist/{chunk-XPJZTSY7.js → chunk-R2QNFXE5.js} +3 -3
  28. package/dist/{chunk-XPJZTSY7.js.map → chunk-R2QNFXE5.js.map} +1 -1
  29. package/dist/{chunk-PXHNTC6D.js → chunk-SIPGDJT4.js} +3 -3
  30. package/dist/{chunk-PXHNTC6D.js.map → chunk-SIPGDJT4.js.map} +1 -1
  31. package/dist/chunk-UIOBFLE6.js +356 -0
  32. package/dist/chunk-UIOBFLE6.js.map +1 -0
  33. package/dist/chunk-UZJS7GMK.js +57 -0
  34. package/dist/chunk-UZJS7GMK.js.map +1 -0
  35. package/dist/{chunk-2VFWXNS5.js → chunk-WH2N22S3.js} +3 -3
  36. package/dist/{chunk-2VFWXNS5.js.map → chunk-WH2N22S3.js.map} +1 -1
  37. package/dist/{chunk-AVQSHIJ5.js → chunk-WY6DGTBP.js} +4 -4
  38. package/dist/{chunk-AVQSHIJ5.js.map → chunk-WY6DGTBP.js.map} +1 -1
  39. package/dist/{chunk-OFUC6RYN.js → chunk-YF43FOPP.js} +8 -101
  40. package/dist/chunk-YF43FOPP.js.map +1 -0
  41. package/dist/{chunk-Y23HMSWU.js → chunk-ZFTFCM7B.js} +14 -7
  42. package/dist/chunk-ZFTFCM7B.js.map +1 -0
  43. package/dist/cli.js +179 -213
  44. package/dist/cli.js.map +1 -1
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.js +8 -6
  47. package/dist/index.js.map +1 -1
  48. package/dist/{interactive-INGJNSON.js → interactive-36ZZ64WL.js} +48 -17
  49. package/dist/interactive-36ZZ64WL.js.map +1 -0
  50. package/dist/{llm-host-7GWDO6IX.js → llm-host-XYBT4267.js} +4 -4
  51. package/dist/{llm-host-7GWDO6IX.js.map → llm-host-XYBT4267.js.map} +1 -1
  52. package/dist/model-manager-OEPY4I7W.js +10 -0
  53. package/dist/{model-orchestrator-TVONAUPS.js.map → model-manager-OEPY4I7W.js.map} +1 -1
  54. package/dist/{model-orchestrator-TVONAUPS.js → model-orchestrator-4VSYP4J4.js} +3 -3
  55. package/dist/model-orchestrator-4VSYP4J4.js.map +1 -0
  56. package/dist/resolve-gguf-Y6FH3CNB.js +9 -0
  57. package/dist/{resolve-gguf-VPL4YQ6J.js.map → resolve-gguf-Y6FH3CNB.js.map} +1 -1
  58. package/dist/{runtime-session-4AMZIAAG.js → runtime-session-EJQZXANB.js} +5 -5
  59. package/dist/{runtime-session-4AMZIAAG.js.map → runtime-session-EJQZXANB.js.map} +1 -1
  60. package/dist/{session-M72522AP.js → session-ZJGENHKX.js} +6 -4
  61. package/dist/{session-M72522AP.js.map → session-ZJGENHKX.js.map} +1 -1
  62. package/dist/{stream-json-6ZBUA2L3.js → stream-json-Z5KC2DM3.js} +8 -6
  63. package/dist/stream-json-Z5KC2DM3.js.map +1 -0
  64. package/dist/{vgd-CVLKBS7K.js → vgd-3MHSB4KA.js} +4 -4
  65. package/dist/vgd-3MHSB4KA.js.map +1 -0
  66. package/package.json +1 -1
  67. package/dist/baseline-ATM5MXBZ.js +0 -8
  68. package/dist/chunk-3V24O47U.js.map +0 -1
  69. package/dist/chunk-6JIKUDWM.js.map +0 -1
  70. package/dist/chunk-C66GOHYB.js.map +0 -1
  71. package/dist/chunk-K7REHDQS.js.map +0 -1
  72. package/dist/chunk-MAY5HLDH.js.map +0 -1
  73. package/dist/chunk-NDMDSPFX.js.map +0 -1
  74. package/dist/chunk-OFUC6RYN.js.map +0 -1
  75. package/dist/chunk-OOIG3RUM.js.map +0 -1
  76. package/dist/chunk-Y23HMSWU.js.map +0 -1
  77. package/dist/chunk-Z7GP7XTJ.js.map +0 -1
  78. package/dist/interactive-INGJNSON.js.map +0 -1
  79. package/dist/resolve-gguf-VPL4YQ6J.js +0 -8
  80. package/dist/stream-json-6ZBUA2L3.js.map +0 -1
  81. package/dist/vgd-CVLKBS7K.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,33 +1,37 @@
1
1
  #!/usr/bin/env node
2
- import { loadAdvancedScanHook, baselineCommand } from './chunk-FFWGT55D.js';
3
- import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-C66GOHYB.js';
4
- export { runBuild } from './chunk-C66GOHYB.js';
5
- import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-Z7GP7XTJ.js';
2
+ import { sha256Hex, generateKeypair, dssePae, DSSE_PAYLOAD_TYPE, keyId, registerBuild, readGlobal, applyGlobalOptions, ProgressBar, printLogo, fetchCatalog, resolveProviders, runBuild } from './chunk-IWP7MYIA.js';
3
+ export { runBuild } from './chunk-IWP7MYIA.js';
4
+ import { CONTEXT_POLICY_VERSION, computeFcsReport, renderFcsReportMarkdown, createTrajectoryCollector, runAgent } from './chunk-A2IYFNCQ.js';
5
+ import { loadAdvancedScanHook, baselineCommand } from './chunk-NTW5UEKT.js';
6
+ import { runCodeSession } from './chunk-WH2N22S3.js';
7
+ import { summarizeDiffs, ScriptedProvider } from './chunk-YF43FOPP.js';
6
8
  import { disableColor, info, c, json, out } from './chunk-CT5BS56U.js';
7
- import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-77LYGXBI.js';
9
+ import { VGD_PROTOCOL_VERSION, startVgdServer } from './chunk-JRAGO6OB.js';
8
10
  import './chunk-5I4VSBWQ.js';
9
11
  import './chunk-IS7VTH2Q.js';
10
12
  import { gatherSystemMemory } from './chunk-6UQMXIAG.js';
11
- import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-3V24O47U.js';
13
+ import { readOrchestratorState, writeOrchestratorState, parseMode, setDefaultMode, recommendMode, activePin, resolveMode, providerForBackend, QUALIFIED_PACKS, pinPack, unpinPack, buildOrchestratorStatus } from './chunk-PVZBYZZR.js';
12
14
  import { fmt, estimateModelBytes } from './chunk-7N4Y3E47.js';
13
15
  import './chunk-IZDH67DX.js';
14
16
  import './chunk-HK3AWUXH.js';
15
17
  import { vgdIsRunning, vgdRequest, vgdSocketPath } from './chunk-PMYWZRRS.js';
16
- import { defaultProcessEndpoint, startProcessHostServer, resolveInferenceIsolation } from './chunk-PXHNTC6D.js';
17
- 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';
18
20
  import { buildIdentifierTrieFromGraph } from './chunk-JIBOJTGS.js';
19
- import './chunk-NDMDSPFX.js';
20
- import { runCodeSession } from './chunk-2VFWXNS5.js';
21
- import { ensurePackage, ensureUnavailableMessage, isPackageInstalled, summarizeDiffs, ScriptedProvider } from './chunk-OFUC6RYN.js';
22
- import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-AVQSHIJ5.js';
23
- 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-MAY5HLDH.js';
24
- import { inventory, enrichOnline, ECOSYSTEMS, catalogPath, libDir, loadCatalog, driftFor, addLibrary, resolveLib, libId, resolveVersion, readDoc, localPackageDocs, localApiSurface } from './chunk-6JIKUDWM.js';
25
- 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-Y23HMSWU.js';
21
+ import './chunk-KKRSQQ3A.js';
22
+ import { buildModelInstallPlan } from './chunk-UIOBFLE6.js';
23
+ import { ensurePackage, ensureUnavailableMessage } from './chunk-OSD546W7.js';
24
+ import { serveStdio, exportGraph, GraphSource, createServer, formatForExt } from './chunk-WY6DGTBP.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-GQTWDKMJ.js';
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-ZFTFCM7B.js';
28
+ import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-ZBTY6VV4.js';
26
29
  import { ensureDir, pathExists, readJsonFile, writeTextFile, writeJsonFile } from './chunk-CRAMOEBE.js';
27
30
  import { resolveOne } from './chunk-J7LKEB2R.js';
28
- import { discoverModels, listCachedWeights, isWeightCached, lookupCatalog, ensureWeightCached, catalogIntegrityReport, weightStoreDir } from './chunk-OOIG3RUM.js';
29
- import { recordCliCall, CLI_TOOL_ALIASES, savingsLedgerPath, clearSavings, readSavings, readUsage, readModelSavings, CAPSULE_RANKING_VERSION, SAVINGS_TOOLS, sanitizeClient } from './chunk-ZBTY6VV4.js';
30
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 { resolveCliInvocation, NPX_INVOCATION } from './chunk-UZJS7GMK.js';
34
+ import { listCachedWeights, ensureWeightCached, catalogIntegrityReport, weightStoreDir } from './chunk-GYSOQH5C.js';
31
35
  import { resolvedGrammarFiles, grammarSetVersion } from './chunk-ON25BX6T.js';
32
36
  import './chunk-RXP66R2E.js';
33
37
  import { resolveGraphPath, renderReport, loadGraph, writeArtifacts, vibgrateDir, SCHEMA_VERSION } from './chunk-B3YUO3NW.js';
@@ -2133,9 +2137,19 @@ function runTree(graph, params) {
2133
2137
  // src/lsp/enrich.ts
2134
2138
  var OSV_QUERY_URL = "https://api.osv.dev/v1/query";
2135
2139
  var cache = /* @__PURE__ */ new Map();
2140
+ var SEVERITY_RANK = {
2141
+ critical: 4,
2142
+ high: 3,
2143
+ moderate: 2,
2144
+ low: 1,
2145
+ unknown: 0
2146
+ };
2136
2147
  function key(ecosystem, name, version) {
2137
2148
  return `${ecosystem}:${name}@${version}`;
2138
2149
  }
2150
+ function emptyCounts() {
2151
+ return { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 };
2152
+ }
2139
2153
  function severityOf(v) {
2140
2154
  const dbSpecific = v.database_specific;
2141
2155
  const label = typeof dbSpecific?.severity === "string" ? dbSpecific.severity.toLowerCase() : "";
@@ -2194,6 +2208,62 @@ async function enrichVulns(ecosystem, name, version, opts = { offline: false })
2194
2208
  return { vulns: [], cveCount: 0, source: "error" };
2195
2209
  }
2196
2210
  }
2211
+ async function scanWorkspaceVulns(targets, opts = { offline: false }) {
2212
+ if (opts.offline) {
2213
+ return { findings: [], counts: emptyCounts(), packagesChecked: 0, source: "offline" };
2214
+ }
2215
+ if (targets.length === 0) {
2216
+ return { findings: [], counts: emptyCounts(), packagesChecked: 0, source: "osv" };
2217
+ }
2218
+ const seen = /* @__PURE__ */ new Set();
2219
+ const unique = [];
2220
+ for (const t of targets) {
2221
+ if (!t.ecosystem || !t.package || !t.version) continue;
2222
+ const k = key(t.ecosystem, t.package, t.version);
2223
+ if (seen.has(k)) continue;
2224
+ seen.add(k);
2225
+ unique.push(t);
2226
+ }
2227
+ const concurrency = Math.max(1, Math.min(opts.concurrency ?? 8, 16));
2228
+ const findings = [];
2229
+ let anyOk = false;
2230
+ let anyError = false;
2231
+ let i = 0;
2232
+ async function worker() {
2233
+ for (; ; ) {
2234
+ const idx = i++;
2235
+ if (idx >= unique.length) return;
2236
+ const t = unique[idx];
2237
+ const r = await enrichVulns(t.ecosystem, t.package, t.version, { offline: false });
2238
+ if (r.source === "osv" || r.source === "cache") anyOk = true;
2239
+ else if (r.source === "error") anyError = true;
2240
+ for (const v of r.vulns) {
2241
+ findings.push({
2242
+ package: t.package,
2243
+ version: t.version,
2244
+ ecosystem: t.ecosystem,
2245
+ id: v.id,
2246
+ cves: v.cves,
2247
+ summary: v.summary,
2248
+ severity: v.severity
2249
+ });
2250
+ }
2251
+ }
2252
+ }
2253
+ await Promise.all(Array.from({ length: Math.min(concurrency, unique.length) }, () => worker()));
2254
+ findings.sort(
2255
+ (a, b) => SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity] || a.package.localeCompare(b.package) || a.id.localeCompare(b.id)
2256
+ );
2257
+ const counts = emptyCounts();
2258
+ for (const f of findings) counts[f.severity]++;
2259
+ const source = anyOk ? "osv" : anyError ? "error" : "osv";
2260
+ return {
2261
+ findings,
2262
+ counts,
2263
+ packagesChecked: unique.length,
2264
+ source
2265
+ };
2266
+ }
2197
2267
 
2198
2268
  // src/lsp/server.ts
2199
2269
  function bandForDependency(dep) {
@@ -2281,6 +2351,7 @@ var VibgrateLanguageServer = class {
2281
2351
  this.conn.onRequest("vibgrate/graph/query", (_m, params) => this.onGraphQuery(params));
2282
2352
  this.conn.onRequest("vibgrate/score/forFile", (_m, params) => this.onScoreForFile(params));
2283
2353
  this.conn.onRequest("vibgrate/enrich", (_m, params) => this.onEnrich(params));
2354
+ this.conn.onRequest("vibgrate/vulns", (_m, _params) => this.onVulns());
2284
2355
  this.conn.onRequest("workspace/executeCommand", (_m, params) => {
2285
2356
  const p = params;
2286
2357
  if (p.command === "vibgrate.rescan") {
@@ -2536,6 +2607,31 @@ var VibgrateLanguageServer = class {
2536
2607
  const p = params ?? {};
2537
2608
  return enrichVulns(p.ecosystem ?? null, p.package ?? "", p.version ?? null, { offline: this.opts.offline });
2538
2609
  }
2610
+ /**
2611
+ * `vibgrate/vulns` — live OSV.dev pass over every resolved dependency in the
2612
+ * current workspace artifact. Powers the Vulnerabilities panel. Empty
2613
+ * findings with `source: 'osv'` means checked clean; `offline`/`error` mean
2614
+ * we could not check (absent ≠ zero).
2615
+ */
2616
+ async onVulns() {
2617
+ if (this.opts.offline) {
2618
+ return { findings: [], counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 }, packagesChecked: 0, source: "offline" };
2619
+ }
2620
+ const a = this.artifact;
2621
+ if (!a) {
2622
+ return { findings: [], counts: { critical: 0, high: 0, moderate: 0, low: 0, unknown: 0 }, packagesChecked: 0, source: "pending" };
2623
+ }
2624
+ const targets = [];
2625
+ for (const proj of a.projects ?? []) {
2626
+ const ecosystem = osvEcosystem(proj.type);
2627
+ if (!ecosystem) continue;
2628
+ for (const dep of proj.dependencies ?? []) {
2629
+ if (!dep.resolvedVersion) continue;
2630
+ targets.push({ ecosystem, package: dep.package, version: dep.resolvedVersion });
2631
+ }
2632
+ }
2633
+ return scanWorkspaceVulns(targets, { offline: this.opts.offline });
2634
+ }
2539
2635
  onScoreForFile(params) {
2540
2636
  const p = params;
2541
2637
  const a = this.artifact;
@@ -3540,166 +3636,6 @@ function toEstimateJson(e) {
3540
3636
  guessed: e.guessed
3541
3637
  };
3542
3638
  }
3543
-
3544
- // src/runtime/model-install-plan.ts
3545
- var MODEL_INSTALL_PLAN_SCHEMA_VERSION = "model-install-plan/0";
3546
- function runtimeDepsForBackend(backend) {
3547
- const b = backend.toLowerCase();
3548
- if (b === "llama.cpp" || b === "llama-cpp" || b === "vibgrate") {
3549
- return [
3550
- {
3551
- id: "node-llama-cpp",
3552
- kind: "npm-runtime",
3553
- spec: "node-llama-cpp@^3",
3554
- reason: "in-process llama.cpp binding for the first-party / llama-cpp provider"
3555
- }
3556
- ];
3557
- }
3558
- if (b === "ollama") {
3559
- return [
3560
- {
3561
- id: "ollama",
3562
- kind: "native-binary",
3563
- binary: "ollama",
3564
- reason: "Ollama on PATH (install from https://ollama.com \u2014 third-party apps are not auto-installed)"
3565
- }
3566
- ];
3567
- }
3568
- return [];
3569
- }
3570
- function weightsChannelForBackend(backend, opts) {
3571
- const b = backend.toLowerCase();
3572
- if (b === "ollama") return "ollama";
3573
- if (b === "llama.cpp" || b === "llama-cpp" || b === "vibgrate") {
3574
- if (opts?.downloadUrl || opts?.weightsRef && lookupCatalog(opts.weightsRef)) return "vibgrate";
3575
- return "local-path";
3576
- }
3577
- if (b === "lm-studio" || b === "lmstudio" || b === "foundry-local") return "manual";
3578
- return "manual";
3579
- }
3580
- function weightsInstalled(ref, installedNames) {
3581
- const want = ref.toLowerCase();
3582
- return installedNames.some((n) => {
3583
- const have = n.toLowerCase();
3584
- return have === want || have.includes(want) || want.includes(have);
3585
- });
3586
- }
3587
- function buildModelInstallPlan(input) {
3588
- const hasBinary2 = input.hasBinary ?? (() => false);
3589
- const pkgInstalled = input.isPackageInstalled ?? isPackageInstalled;
3590
- const installedNames = input.installedNames ?? [];
3591
- const offline = !!input.offline;
3592
- const backend = input.backend;
3593
- const provider = providerLabel(backend);
3594
- const runtimeDeps = runtimeDepsForBackend(backend).map((dep) => {
3595
- if (dep.kind === "npm-runtime" && dep.spec) {
3596
- return { ...dep, status: pkgInstalled(dep.spec) ? "satisfied" : "missing" };
3597
- }
3598
- if (dep.kind === "native-binary" && dep.binary) {
3599
- return { ...dep, status: hasBinary2(dep.binary) ? "satisfied" : "unmanaged" };
3600
- }
3601
- return { ...dep, status: "unmanaged" };
3602
- });
3603
- const channel = weightsChannelForBackend(backend, {
3604
- downloadUrl: input.downloadUrl,
3605
- weightsRef: input.weightsRef
3606
- });
3607
- const weightCached = (input.isWeightCached ?? isWeightCached)(input.weightsRef);
3608
- const catalog = lookupCatalog(input.weightsRef);
3609
- const downloadUrl = input.downloadUrl ?? catalog?.url;
3610
- let weightsStatus = "missing";
3611
- if (channel === "ollama") {
3612
- weightsStatus = weightsInstalled(input.weightsRef, installedNames) ? "satisfied" : "missing";
3613
- } else if (channel === "vibgrate") {
3614
- weightsStatus = weightCached || weightsInstalled(input.weightsRef, installedNames) || !!input.modelPath ? "satisfied" : "missing";
3615
- } else if (channel === "local-path") {
3616
- weightsStatus = weightsInstalled(input.weightsRef, installedNames) || !!input.modelPath || weightCached ? "satisfied" : "manual";
3617
- } else {
3618
- weightsStatus = weightsInstalled(input.weightsRef, installedNames) ? "satisfied" : "manual";
3619
- }
3620
- const alreadySatisfied = [];
3621
- const willInstall = [];
3622
- const willDownload = [];
3623
- const blocked = [];
3624
- for (const dep of runtimeDeps) {
3625
- if (dep.status === "satisfied") {
3626
- alreadySatisfied.push(dep.id);
3627
- continue;
3628
- }
3629
- if (dep.kind === "npm-runtime" && dep.spec && dep.status === "missing") {
3630
- if (offline) {
3631
- blocked.push({ id: dep.id, reason: `${dep.spec} needed but --local/offline forbids install` });
3632
- } else {
3633
- willInstall.push(dep.spec);
3634
- }
3635
- continue;
3636
- }
3637
- if (dep.kind === "native-binary" && dep.status === "unmanaged") {
3638
- blocked.push({
3639
- id: dep.id,
3640
- reason: dep.reason
3641
- });
3642
- }
3643
- }
3644
- if (weightsStatus === "satisfied") {
3645
- alreadySatisfied.push(`weights:${input.weightsRef}`);
3646
- } else if (weightsStatus === "missing" && (channel === "ollama" || channel === "vibgrate")) {
3647
- if (offline) {
3648
- blocked.push({ id: `weights:${input.weightsRef}`, reason: "weights missing and --local/offline forbids download" });
3649
- } else if (channel === "ollama" && runtimeDeps.some((d) => d.id === "ollama" && d.status === "unmanaged")) {
3650
- willDownload.push(input.weightsRef);
3651
- } else if (channel === "vibgrate" && !downloadUrl) {
3652
- blocked.push({
3653
- id: `weights:${input.weightsRef}`,
3654
- reason: `no first-party download URL for ${input.weightsRef} \u2014 place a gguf in the weight store or pass --model-path`
3655
- });
3656
- } else {
3657
- willDownload.push(input.weightsRef);
3658
- }
3659
- } else if (weightsStatus === "manual" || weightsStatus === "missing") {
3660
- blocked.push({
3661
- id: `weights:${input.weightsRef}`,
3662
- reason: channel === "local-path" ? `point --model-path at a local gguf for ${input.weightsRef}, or run install when a first-party URL is catalogued` : `install or link weights for ${input.weightsRef} via the backend app`
3663
- });
3664
- }
3665
- const effectiveWillInstall = offline ? [] : willInstall;
3666
- const effectiveWillDownload = offline ? [] : willDownload;
3667
- const offlineBlocked = offline && blocked.some((b) => /offline|forbids/i.test(b.reason));
3668
- const allRuntimeOk = runtimeDeps.every((d) => d.status === "satisfied");
3669
- const fullyReady = allRuntimeOk && weightsStatus === "satisfied" && blocked.length === 0;
3670
- return {
3671
- schemaVersion: MODEL_INSTALL_PLAN_SCHEMA_VERSION,
3672
- provider,
3673
- backend,
3674
- model: input.weightsRef,
3675
- mode: input.mode,
3676
- packId: input.packId,
3677
- license: input.license,
3678
- promise: input.promise,
3679
- fit: input.fit,
3680
- runtimeDeps,
3681
- weights: {
3682
- channel,
3683
- ref: input.weightsRef,
3684
- status: weightsStatus,
3685
- downloadUrl: channel === "vibgrate" ? downloadUrl : void 0
3686
- },
3687
- alreadySatisfied,
3688
- willInstall: effectiveWillInstall,
3689
- willDownload: effectiveWillDownload,
3690
- blocked,
3691
- offlineBlocked,
3692
- ready: fullyReady
3693
- };
3694
- }
3695
- function providerLabel(backend) {
3696
- const b = backend.toLowerCase();
3697
- if (b === "llama.cpp" || b === "llama-cpp") return "llama-cpp";
3698
- if (b === "vibgrate") return "vibgrate";
3699
- if (b === "lm-studio" || b === "lmstudio") return "lmstudio";
3700
- if (b === "foundry-local") return "foundry-local";
3701
- return b === "ollama" ? "ollama" : backend;
3702
- }
3703
3639
  async function executeModelInstallPlan(plan, options = {}) {
3704
3640
  const installedDeps = [];
3705
3641
  const pulledWeights = [];
@@ -3742,7 +3678,7 @@ async function executeModelInstallPlan(plan, options = {}) {
3742
3678
  plan,
3743
3679
  installedDeps,
3744
3680
  pulledWeights,
3745
- error: ensureUnavailableMessage(res.reason ?? "install-failed", spec)
3681
+ error: ensureUnavailableMessage(res.reason ?? "install-failed", spec, res.detail)
3746
3682
  };
3747
3683
  }
3748
3684
  installedDeps.push(spec);
@@ -5853,9 +5789,11 @@ function registerCode(program) {
5853
5789
  let provider = opts.provider ?? config.provider;
5854
5790
  let model = opts.model ?? config.model;
5855
5791
  const modeFlag = opts.mode ?? config.modelProfile?.mode;
5856
- if (!opts.model && !opts.modelPath && (modeFlag || !provider && !model)) {
5792
+ let codeModeActive = false;
5793
+ const customSelection = !!(opts.provider || opts.model || opts.modelPath || config.provider || config.model);
5794
+ if (!customSelection && (modeFlag || !provider && !model)) {
5857
5795
  try {
5858
- const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2, providerForBackend: providerForBackend2 } = await import('./model-orchestrator-TVONAUPS.js');
5796
+ const { parseMode: parseMode2, resolveMode: resolveMode2, readOrchestratorState: readOrchestratorState2, activePin: activePin2 } = await import('./model-orchestrator-4VSYP4J4.js');
5859
5797
  const { gatherSystemMemory: gatherSystemMemory2 } = await import('./local-runtime-5O2NN3GA.js');
5860
5798
  const { loadGraph: loadGraph2 } = await import('./load-QPOWQD7C.js');
5861
5799
  const state = readOrchestratorState2();
@@ -5886,26 +5824,31 @@ function registerCode(program) {
5886
5824
  ExitCode.ERROR
5887
5825
  );
5888
5826
  }
5889
- const { resolveGgufPath } = await import('./resolve-gguf-VPL4YQ6J.js');
5827
+ const { resolveGgufPath } = await import('./resolve-gguf-Y6FH3CNB.js');
5828
+ const primaryRef = resolved.pack.primary.backend === "llama.cpp" ? resolved.pack.primary.weightsRef : resolved.underlying.weightsRef;
5890
5829
  const gguf = resolveGgufPath({
5891
- modelRef: resolved.underlying.weightsRef,
5830
+ modelRef: primaryRef,
5892
5831
  modelPath: opts.modelPath
5893
5832
  }) ?? resolveGgufPath({
5894
- modelRef: resolved.pack.primary.backend === "llama.cpp" ? resolved.pack.primary.weightsRef : void 0
5833
+ modelRef: resolved.underlying.weightsRef,
5834
+ modelPath: opts.modelPath
5895
5835
  });
5896
- if (gguf && !opts.provider) {
5836
+ if (!gguf && !opts.mock) {
5837
+ throw new CliError(
5838
+ `Code Mode ${resolved.mode} uses the Vibgrate model manager \u2014 weights not installed. Run \`vg models install ${resolved.mode}\` then retry. (Custom Ollama/LM Studio: pass --provider explicitly.)`,
5839
+ ExitCode.NOT_FOUND
5840
+ );
5841
+ }
5842
+ if (gguf) {
5843
+ codeModeActive = true;
5897
5844
  provider = "llama-cpp";
5898
- model = model ?? gguf.ref ?? resolved.underlying.weightsRef;
5845
+ model = model ?? gguf.ref ?? primaryRef;
5899
5846
  opts.modelPath = gguf.path;
5900
5847
  if (!global.json && !global.quiet && !opts.streamJson) {
5901
5848
  info(
5902
- `${c.cyan("vg code")} \xB7 Code Mode ${c.bold(resolved.mode)} \u2192 embedded llama.cpp ${c.dim(gguf.path)} ${c.dim(`(${resolved.fit.label})`)}`
5849
+ `${c.cyan("vg code")} \xB7 Code Mode ${c.bold(resolved.mode)} \u2192 Vibgrate manager ${c.dim(gguf.path)} ${c.dim(`(${resolved.fit.label})`)}`
5903
5850
  );
5904
5851
  }
5905
- } else {
5906
- const ollamaFb = resolved.underlying.backend === "ollama" ? resolved.underlying : resolved.pack.fallback?.find((f) => f.backend === "ollama") ?? resolved.underlying;
5907
- provider = provider ?? providerForBackend2(ollamaFb.backend);
5908
- model = model ?? ollamaFb.weightsRef;
5909
5852
  }
5910
5853
  if (!config.modelProfile?.capsuleBudgetTokens) {
5911
5854
  config.modelProfile = {
@@ -5919,11 +5862,6 @@ function registerCode(program) {
5919
5862
  } else if (!config.modelProfile?.mode) {
5920
5863
  config.modelProfile = { ...config.modelProfile, mode: resolved.mode };
5921
5864
  }
5922
- if (!global.json && !global.quiet && !opts.streamJson && provider !== "llama-cpp") {
5923
- info(
5924
- `${c.cyan("vg code")} \xB7 Code Mode ${c.bold(resolved.mode)} \u2192 ${resolved.underlying.weightsRef} ${c.dim(`(${resolved.fit.label})`)}`
5925
- );
5926
- }
5927
5865
  } catch (e) {
5928
5866
  if (e instanceof CliError) throw e;
5929
5867
  if (!provider && !model && !opts.mock) throw e;
@@ -5941,7 +5879,7 @@ function registerCode(program) {
5941
5879
  if (!(process.stdin.isTTY && process.stdout.isTTY)) {
5942
5880
  throw usageError('say what to change, e.g. `vg code "add a --timeout flag to the scan command"` (guided mode needs an interactive terminal)');
5943
5881
  }
5944
- const { runInteractive } = await import('./interactive-INGJNSON.js');
5882
+ const { runInteractive } = await import('./interactive-36ZZ64WL.js');
5945
5883
  await runInteractive(
5946
5884
  rootOf(global),
5947
5885
  global,
@@ -5985,28 +5923,52 @@ function registerCode(program) {
5985
5923
  model,
5986
5924
  modelPath: opts.modelPath,
5987
5925
  local: global.local,
5988
- consent: opts.yes,
5989
- mockReply
5926
+ consent: opts.yes || codeModeActive || customSelection,
5927
+ mockReply,
5928
+ codeMode: codeModeActive,
5929
+ preferEmbedded: codeModeActive || void 0
5990
5930
  },
5991
5931
  {}
5992
5932
  );
5933
+ if (!opts.mock && route.providers[0]) {
5934
+ const { ensureManagerRuntime } = await import('./model-manager-OEPY4I7W.js');
5935
+ const ensure = await ensureManagerRuntime({
5936
+ providerId: route.providers[0].id,
5937
+ model: route.providers[0].model,
5938
+ offline: !!global.local,
5939
+ // Code Mode / explicit custom selection / --yes count as consent for
5940
+ // npm runtime deps (and ollama pull when the binary is already present).
5941
+ consent: !!(opts.yes || codeModeActive || customSelection || process.stdin.isTTY),
5942
+ onProgress: (line) => {
5943
+ if (!global.json && !global.quiet && !opts.streamJson) info(c.dim(` ${line}`));
5944
+ }
5945
+ });
5946
+ if (!ensure.ok) {
5947
+ throw new CliError(ensure.error ?? "model manager runtime not ready", ExitCode.ERROR);
5948
+ }
5949
+ if (!global.json && !global.quiet && !opts.streamJson && (ensure.installed.length || ensure.pulled.length)) {
5950
+ for (const s of ensure.installed) info(c.dim(` installed ${s}`));
5951
+ for (const s of ensure.pulled) info(c.dim(` pulled ${s}`));
5952
+ }
5953
+ }
5993
5954
  if (!global.json && !global.quiet) {
5994
5955
  info(`${c.cyan("vg code")} \xB7 ${c.dim(route.reason)}`);
5956
+ info(`${c.cyan("vg code")} \xB7 manager ${c.bold(route.managerLine)}`);
5995
5957
  }
5996
5958
  if (opts.streamJson && !opts.mock) {
5997
5959
  const primarySlug = route.providers[0]?.model.includes("/") ? route.providers[0].model.split("/")[0] : route.providers[0]?.id;
5998
- const { runCodeStreamJson } = await import('./stream-json-6ZBUA2L3.js');
5999
- const { nodeCodeFs } = await import('./session-M72522AP.js');
5960
+ const { runCodeStreamJson } = await import('./stream-json-Z5KC2DM3.js');
5961
+ const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
6000
5962
  const readline5 = await import('readline');
6001
5963
  const child = await import('child_process');
6002
5964
  const { loadOrDiscoverFederation } = await import('./federation-SZWZIFZ7.js');
6003
5965
  const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
6004
5966
  const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
6005
- const { startCodeRuntimeSession } = await import('./runtime-session-4AMZIAAG.js');
5967
+ const { startCodeRuntimeSession } = await import('./runtime-session-EJQZXANB.js');
6006
5968
  const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
6007
5969
  const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
6008
5970
  const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
6009
- const { vgdRequest: vgdRequest2 } = await import('./vgd-CVLKBS7K.js');
5971
+ const { vgdRequest: vgdRequest2 } = await import('./vgd-3MHSB4KA.js');
6010
5972
  const federation = loadOrDiscoverFederation(root2);
6011
5973
  const modelProfile = mergeModelExecutionProfile(
6012
5974
  resolveModelExecutionProfile({
@@ -6095,8 +6057,8 @@ ${res.stderr}` : ""), exitCode: res.status ?? 1 };
6095
6057
  if (!autonomous && !tty) {
6096
6058
  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).");
6097
6059
  }
6098
- const { agentTask } = await import('./interactive-INGJNSON.js');
6099
- const { nodeCodeFs } = await import('./session-M72522AP.js');
6060
+ const { agentTask } = await import('./interactive-36ZZ64WL.js');
6061
+ const { nodeCodeFs } = await import('./session-ZJGENHKX.js');
6100
6062
  const { TtyPrompter } = await import('./ui-Q6DJ3GCU.js');
6101
6063
  let priorSummary;
6102
6064
  if (opts.continue) {
@@ -6118,11 +6080,11 @@ ${res.stderr}` : ""), exitCode: res.status ?? 1 };
6118
6080
  const { loadFederation } = await import('./federation-SZWZIFZ7.js');
6119
6081
  const { resolveExecutionEnv } = await import('./execution-env-ZU45JZ4G.js');
6120
6082
  const { resolveModelExecutionProfile, mergeModelExecutionProfile } = await import('./model-execution-profile-TFBKCNJG.js');
6121
- const { startCodeRuntimeSession } = await import('./runtime-session-4AMZIAAG.js');
6083
+ const { startCodeRuntimeSession } = await import('./runtime-session-EJQZXANB.js');
6122
6084
  const { resolveGraphBackend } = await import('./graph-backend-UTOL3SHE.js');
6123
6085
  const { detectGitRef } = await import('./git-ref-XDXB6JP5.js');
6124
6086
  const { repositoryIdFromRoot } = await import('./paths-2RAH3GME.js');
6125
- const { vgdRequest: vgdRequest2 } = await import('./vgd-CVLKBS7K.js');
6087
+ const { vgdRequest: vgdRequest2 } = await import('./vgd-3MHSB4KA.js');
6126
6088
  const federation = loadFederation(root2);
6127
6089
  const modelProfile = mergeModelExecutionProfile(
6128
6090
  resolveModelExecutionProfile({
@@ -7230,7 +7192,11 @@ function registerLlmHost(program) {
7230
7192
  binding = ensured.module;
7231
7193
  } else if (opts.yes || !global.local) {
7232
7194
  if (!global.json) {
7233
- info(c.dim(` binding unavailable: ${ensureUnavailableMessage(ensured.reason ?? "install-failed", "node-llama-cpp@^3")}`));
7195
+ info(
7196
+ c.dim(
7197
+ ` binding unavailable: ${ensureUnavailableMessage(ensured.reason ?? "install-failed", "node-llama-cpp@^3", ensured.detail)}`
7198
+ )
7199
+ );
7234
7200
  }
7235
7201
  }
7236
7202
  if (global.json) {
@@ -7301,7 +7267,7 @@ var initCommand = new Command("init").description("Initialize vibgrate in a proj
7301
7267
  console.log(chalk7.green("\u2714") + ` Created ${chalk7.bold("vibgrate.config.ts")}`);
7302
7268
  }
7303
7269
  if (opts.baseline) {
7304
- const { runBaseline } = await import('./baseline-ATM5MXBZ.js');
7270
+ const { runBaseline } = await import('./baseline-MRUM2P6H.js');
7305
7271
  await runBaseline(rootDir);
7306
7272
  }
7307
7273
  console.log("");
@@ -8820,7 +8786,7 @@ function reapAndReport(cwd, keepVersion) {
8820
8786
  }
8821
8787
 
8822
8788
  // src/reporting/commands/fix.ts
8823
- var SEVERITY_RANK = { unknown: 0, low: 1, moderate: 2, high: 3, critical: 4 };
8789
+ var SEVERITY_RANK2 = { unknown: 0, low: 1, moderate: 2, high: 3, critical: 4 };
8824
8790
  function ecosystemId(type) {
8825
8791
  return projectTypeToVulnEcosystem(type) ?? type;
8826
8792
  }
@@ -8894,7 +8860,7 @@ var fixCommand = new Command("fix").description("Get ranked, risk-tiered upgrade
8894
8860
  process.exit(1);
8895
8861
  }
8896
8862
  const failOn = opts.failOnVulns;
8897
- if (failOn && !(failOn in SEVERITY_RANK)) {
8863
+ if (failOn && !(failOn in SEVERITY_RANK2)) {
8898
8864
  console.error(chalk7.red(`Invalid --fail-on-vulns value '${opts.failOnVulns}'. Use one of: low, moderate, high, critical.`));
8899
8865
  process.exit(1);
8900
8866
  }
@@ -8996,10 +8962,10 @@ var fixCommand = new Command("fix").description("Get ranked, risk-tiered upgrade
8996
8962
  }
8997
8963
  if (failOn) {
8998
8964
  const recommended = response.plans.find((p) => p.tier === response.recommended);
8999
- const threshold = SEVERITY_RANK[failOn];
8965
+ const threshold = SEVERITY_RANK2[failOn];
9000
8966
  let stillOpen = 0;
9001
- for (const sev of Object.keys(SEVERITY_RANK)) {
9002
- if (SEVERITY_RANK[sev] < threshold) continue;
8967
+ for (const sev of Object.keys(SEVERITY_RANK2)) {
8968
+ if (SEVERITY_RANK2[sev] < threshold) continue;
9003
8969
  const open = response.unresolved.bySeverity[sev] ?? 0;
9004
8970
  const maxFixable = Math.max(0, ...response.plans.map((p) => p.fixes.bySeverity[sev] ?? 0));
9005
8971
  const notFixedByRecommended = maxFixable - (recommended?.fixes.bySeverity[sev] ?? 0);