@vibgrate/cli 2026.727.2 → 2026.727.4

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 (101) hide show
  1. package/DOCS.md +21 -1
  2. package/README.md +2 -1
  3. package/dist/baseline-ENCOSJYQ.js +8 -0
  4. package/dist/{baseline-TG4ATZGZ.js.map → baseline-ENCOSJYQ.js.map} +1 -1
  5. package/dist/chunk-3SDV6ADQ.js +78 -0
  6. package/dist/chunk-3SDV6ADQ.js.map +1 -0
  7. package/dist/{chunk-LKVMI67M.js → chunk-6AXHLQBV.js} +220 -23
  8. package/dist/chunk-6AXHLQBV.js.map +1 -0
  9. package/dist/{chunk-6ABXHZRN.js → chunk-6UK6QPTR.js} +69 -70
  10. package/dist/chunk-6UK6QPTR.js.map +1 -0
  11. package/dist/{chunk-TCDAZZNP.js → chunk-77LYGXBI.js} +5 -5
  12. package/dist/{chunk-TCDAZZNP.js.map → chunk-77LYGXBI.js.map} +1 -1
  13. package/dist/{chunk-2XQDMLKB.js → chunk-B3YUO3NW.js} +7 -3
  14. package/dist/chunk-B3YUO3NW.js.map +1 -0
  15. package/dist/{chunk-RNP3SMTV.js → chunk-FPEOIS7K.js} +61 -26
  16. package/dist/chunk-FPEOIS7K.js.map +1 -0
  17. package/dist/{chunk-OOIG3RUM.js → chunk-GYSOQH5C.js} +18 -79
  18. package/dist/chunk-GYSOQH5C.js.map +1 -0
  19. package/dist/{chunk-6AYDFFP5.js → chunk-HK3AWUXH.js} +3 -3
  20. package/dist/{chunk-6AYDFFP5.js.map → chunk-HK3AWUXH.js.map} +1 -1
  21. package/dist/{chunk-EX4PQT6W.js → chunk-HYRAILGM.js} +4 -4
  22. package/dist/{chunk-EX4PQT6W.js.map → chunk-HYRAILGM.js.map} +1 -1
  23. package/dist/{chunk-NDMDSPFX.js → chunk-KKRSQQ3A.js} +4 -3
  24. package/dist/chunk-KKRSQQ3A.js.map +1 -0
  25. package/dist/chunk-KUIBP3LU.js +101 -0
  26. package/dist/chunk-KUIBP3LU.js.map +1 -0
  27. package/dist/{chunk-OFUC6RYN.js → chunk-KXSKFQMI.js} +6 -99
  28. package/dist/chunk-KXSKFQMI.js.map +1 -0
  29. package/dist/{chunk-KCKYKDMS.js → chunk-LJP2EPKM.js} +20 -17
  30. package/dist/chunk-LJP2EPKM.js.map +1 -0
  31. package/dist/{chunk-J4RFRKZH.js → chunk-MAUJTPQW.js} +8 -8
  32. package/dist/{chunk-J4RFRKZH.js.map → chunk-MAUJTPQW.js.map} +1 -1
  33. package/dist/{chunk-3Q7QBWFW.js → chunk-ON25BX6T.js} +9 -3
  34. package/dist/chunk-ON25BX6T.js.map +1 -0
  35. package/dist/{chunk-3V24O47U.js → chunk-PVZBYZZR.js} +19 -9
  36. package/dist/chunk-PVZBYZZR.js.map +1 -0
  37. package/dist/{chunk-CY4WKXB2.js → chunk-R6ZRVVZT.js} +4 -4
  38. package/dist/{chunk-CY4WKXB2.js.map → chunk-R6ZRVVZT.js.map} +1 -1
  39. package/dist/{chunk-WGUL45AV.js → chunk-T3AYRS7J.js} +14 -7
  40. package/dist/chunk-T3AYRS7J.js.map +1 -0
  41. package/dist/{chunk-2MBL43EJ.js → chunk-XPJZTSY7.js} +3 -3
  42. package/dist/{chunk-2MBL43EJ.js.map → chunk-XPJZTSY7.js.map} +1 -1
  43. package/dist/chunk-YCJIIGLP.js +356 -0
  44. package/dist/chunk-YCJIIGLP.js.map +1 -0
  45. package/dist/{chunk-KNELIQJO.js → chunk-YKVH2PGF.js} +640 -208
  46. package/dist/chunk-YKVH2PGF.js.map +1 -0
  47. package/dist/{chunk-KSBHGWRV.js → chunk-ZBTY6VV4.js} +4 -4
  48. package/dist/{chunk-KSBHGWRV.js.map → chunk-ZBTY6VV4.js.map} +1 -1
  49. package/dist/{chunk-K3MZIVZW.js → chunk-ZKNB4YH4.js} +19 -5
  50. package/dist/chunk-ZKNB4YH4.js.map +1 -0
  51. package/dist/cli.js +476 -393
  52. package/dist/cli.js.map +1 -1
  53. package/dist/{graph-backend-73URGTFY.js → graph-backend-UTOL3SHE.js} +5 -5
  54. package/dist/{graph-backend-73URGTFY.js.map → graph-backend-UTOL3SHE.js.map} +1 -1
  55. package/dist/index.d.ts +12 -5
  56. package/dist/index.js +12 -11
  57. package/dist/index.js.map +1 -1
  58. package/dist/{interactive-372NLI5C.js → interactive-SMHVURYK.js} +54 -24
  59. package/dist/interactive-SMHVURYK.js.map +1 -0
  60. package/dist/load-QPOWQD7C.js +8 -0
  61. package/dist/{load-I333TGNI.js.map → load-QPOWQD7C.js.map} +1 -1
  62. package/dist/model-manager-PN7HEDXD.js +9 -0
  63. package/dist/{model-orchestrator-TVONAUPS.js.map → model-manager-PN7HEDXD.js.map} +1 -1
  64. package/dist/{model-orchestrator-TVONAUPS.js → model-orchestrator-4VSYP4J4.js} +3 -3
  65. package/dist/model-orchestrator-4VSYP4J4.js.map +1 -0
  66. package/dist/parse-worker.d.ts +1 -1
  67. package/dist/parse-worker.js +1 -1
  68. package/dist/resolve-gguf-Y6FH3CNB.js +9 -0
  69. package/dist/{resolve-gguf-VPL4YQ6J.js.map → resolve-gguf-Y6FH3CNB.js.map} +1 -1
  70. package/dist/{runtime-session-JRKCQUHY.js → runtime-session-4AMZIAAG.js} +7 -7
  71. package/dist/{runtime-session-JRKCQUHY.js.map → runtime-session-4AMZIAAG.js.map} +1 -1
  72. package/dist/session-W3646AOV.js +12 -0
  73. package/dist/{session-ITPYQ5XI.js.map → session-W3646AOV.js.map} +1 -1
  74. package/dist/sql-extract-JELDZA6W.js +81 -0
  75. package/dist/sql-extract-JELDZA6W.js.map +1 -0
  76. package/dist/{stream-json-SLMDKLXP.js → stream-json-X7UQFB4T.js} +11 -10
  77. package/dist/stream-json-X7UQFB4T.js.map +1 -0
  78. package/dist/{types-7AHBUbFm.d.ts → types-DLH-Ritr.d.ts} +18 -1
  79. package/dist/{vgd-7JV5KCNJ.js → vgd-CVLKBS7K.js} +6 -6
  80. package/dist/vgd-CVLKBS7K.js.map +1 -0
  81. package/package.json +1 -1
  82. package/dist/baseline-TG4ATZGZ.js +0 -8
  83. package/dist/chunk-2XQDMLKB.js.map +0 -1
  84. package/dist/chunk-3Q7QBWFW.js.map +0 -1
  85. package/dist/chunk-3V24O47U.js.map +0 -1
  86. package/dist/chunk-6ABXHZRN.js.map +0 -1
  87. package/dist/chunk-K3MZIVZW.js.map +0 -1
  88. package/dist/chunk-KCKYKDMS.js.map +0 -1
  89. package/dist/chunk-KNELIQJO.js.map +0 -1
  90. package/dist/chunk-LKVMI67M.js.map +0 -1
  91. package/dist/chunk-NDMDSPFX.js.map +0 -1
  92. package/dist/chunk-OFUC6RYN.js.map +0 -1
  93. package/dist/chunk-OOIG3RUM.js.map +0 -1
  94. package/dist/chunk-RNP3SMTV.js.map +0 -1
  95. package/dist/chunk-WGUL45AV.js.map +0 -1
  96. package/dist/interactive-372NLI5C.js.map +0 -1
  97. package/dist/load-I333TGNI.js +0 -8
  98. package/dist/resolve-gguf-VPL4YQ6J.js +0 -8
  99. package/dist/session-ITPYQ5XI.js +0 -11
  100. package/dist/stream-json-SLMDKLXP.js.map +0 -1
  101. package/dist/vgd-7JV5KCNJ.js.map +0 -1
@@ -102,7 +102,9 @@ var LANGUAGES = [
102
102
  { id: "astro", label: "Astro", extensions: [".astro"], grammarFile: "tree-sitter-typescript" },
103
103
  { id: "html", label: "HTML", extensions: [".html", ".htm"], grammarFile: "tree-sitter-javascript" },
104
104
  { id: "erb", label: "ERB", extensions: [".erb"], grammarFile: "tree-sitter-ruby" },
105
- { id: "ejs", label: "EJS", extensions: [".ejs"], grammarFile: "tree-sitter-javascript" }
105
+ { id: "ejs", label: "EJS", extensions: [".ejs"], grammarFile: "tree-sitter-javascript" },
106
+ // SQL DDL — pure deterministic extract (sql-extract.ts), no tree-sitter grammar.
107
+ { id: "sql", label: "SQL", extensions: [".sql"], grammarFile: "tree-sitter-typescript" }
106
108
  ];
107
109
  var EXT_TO_LANG = /* @__PURE__ */ new Map();
108
110
  for (const lang of LANGUAGES) {
@@ -985,6 +987,10 @@ function pythonHeader(full) {
985
987
  return full.split("\n")[0];
986
988
  }
987
989
  async function parseSource(rel, langId, source) {
990
+ if (langId === "sql") {
991
+ const { parseSqlFile } = await import('./sql-extract-JELDZA6W.js');
992
+ return parseSqlFile(rel, source);
993
+ }
988
994
  const embedded = extractEmbeddedScript(langId, source);
989
995
  const effLangId = embedded?.langId ?? langId;
990
996
  const text = embedded?.masked ?? source;
@@ -1174,5 +1180,5 @@ function dedupeImports(imports) {
1174
1180
  }
1175
1181
 
1176
1182
  export { LANGUAGES, allLanguageIds, grammarSetVersion, grammarsSourceDir, langById, langForExtension, parseSource, resolvedGrammarFiles, setGrammarsOverride };
1177
- //# sourceMappingURL=chunk-3Q7QBWFW.js.map
1178
- //# sourceMappingURL=chunk-3Q7QBWFW.js.map
1183
+ //# sourceMappingURL=chunk-ON25BX6T.js.map
1184
+ //# sourceMappingURL=chunk-ON25BX6T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engine/languages.ts","../src/engine/grammars.ts","../src/engine/queries.ts","../src/engine/sfc.ts","../src/engine/parse.ts"],"names":["require","ranges"],"mappings":";;;;;;;;;AAsBO,IAAM,SAAA,GAA2B;AAAA,EACtC;AAAA,IACE,EAAA,EAAI,IAAA;AAAA,IACJ,KAAA,EAAO,YAAA;AAAA,IACP,UAAA,EAAY,CAAC,KAAA,EAAO,MAAA,EAAQ,MAAM,CAAA;AAAA,IAClC,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,KAAA;AAAA,IACJ,KAAA,EAAO,KAAA;AAAA,IACP,UAAA,EAAY,CAAC,MAAM,CAAA;AAAA,IACnB,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,EAAA,EAAI,IAAA;AAAA,IACJ,KAAA,EAAO,YAAA;AAAA,IACP,UAAA,EAAY,CAAC,KAAA,EAAO,MAAA,EAAQ,QAAQ,MAA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AAA,CAAQ;AAAA,KACf,CAAA;AAAA,EACH;AACF;AAGA,SAAS,SAAA,CACP,IAAA,EACA,KAAA,EACA,GAAA,EACuC;AACvC,EAAA,IAAI,IAAA;AACJ,EAAA,KAAA,MAAW,KAAK,IAAA,EAAM;AACpB,IAAA,IAAI,CAAA,CAAE,MAAA,KAAW,KAAA,IAAS,CAAA,CAAE,SAAS,GAAA,EAAK;AAC1C,IAAA,IAAI,CAAA,CAAE,MAAA,IAAU,KAAA,IAAS,CAAA,CAAE,QAAQ,GAAA,EAAK;AACtC,MAAA,IAAI,CAAC,IAAA,IAAQ,CAAA,CAAE,IAAA,GAAO,CAAA,CAAE,SAAS,IAAA,CAAK,IAAA,GAAO,IAAA,CAAK,MAAA,EAAQ,IAAA,GAAO,CAAA;AAAA,IACnE;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT;AAEA,SAAS,YAAY,IAAA,EAAsB;AACzC,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,gBAAA,EAAkB,EAAE,CAAA;AAC1C;AAEA,SAAS,cAAc,OAAA,EAAmC;AACxD,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,MAAmB,EAAC;AAC1B,EAAA,KAAA,MAAW,CAAA,IAAK,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,CAAE,MAAA,CAAO,aAAA,CAAc,CAAA,CAAE,MAAM,CAAC,CAAA,EAAG;AACxE,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,CAAA,CAAE,MAAM,CAAA,EAAG;AACxB,IAAA,IAAA,CAAK,GAAA,CAAI,EAAE,MAAM,CAAA;AACjB,IAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAAA,EACZ;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-ON25BX6T.js","sourcesContent":["/**\n * Language registry: 20 grammar-backed languages (first wave + the Phase-3\n * expansion) plus the embedded-script container formats (Vue/Svelte/Astro\n * single-file components, parsed via sfc.ts with the JS/TS grammars).\n *\n * Each language maps to a tree-sitter grammar shipped (pre-compiled to .wasm) by\n * `tree-sitter-wasms`. `grammarFile` is the base name under that package's `out/`\n * directory (and our bundled `grammars/` copy). The grammar *version* is recorded\n * in provenance so the determinism contract is explicit about its inputs.\n */\n\nexport interface LanguageDef {\n /** Canonical short id used in the schema (`lang` field) and `--only`. */\n id: string;\n /** Human label. */\n label: string;\n /** File extensions (lowercase, with leading dot). */\n extensions: string[];\n /** tree-sitter-wasms grammar base name, e.g. `tree-sitter-typescript`. */\n grammarFile: string;\n}\n\nexport const LANGUAGES: LanguageDef[] = [\n {\n id: 'ts',\n label: 'TypeScript',\n extensions: ['.ts', '.mts', '.cts'],\n grammarFile: 'tree-sitter-typescript',\n },\n {\n id: 'tsx',\n label: 'TSX',\n extensions: ['.tsx'],\n grammarFile: 'tree-sitter-tsx',\n },\n {\n id: 'js',\n label: 'JavaScript',\n extensions: ['.js', '.mjs', '.cjs', '.jsx'],\n grammarFile: 'tree-sitter-javascript',\n },\n {\n id: 'py',\n label: 'Python',\n extensions: ['.py', '.pyi'],\n grammarFile: 'tree-sitter-python',\n },\n {\n id: 'go',\n label: 'Go',\n extensions: ['.go'],\n grammarFile: 'tree-sitter-go',\n },\n {\n id: 'java',\n label: 'Java',\n extensions: ['.java'],\n grammarFile: 'tree-sitter-java',\n },\n {\n id: 'rust',\n label: 'Rust',\n extensions: ['.rs'],\n grammarFile: 'tree-sitter-rust',\n },\n {\n id: 'cs',\n label: 'C#',\n extensions: ['.cs'],\n grammarFile: 'tree-sitter-c_sharp',\n },\n {\n id: 'rb',\n label: 'Ruby',\n extensions: ['.rb'],\n grammarFile: 'tree-sitter-ruby',\n },\n { id: 'php', label: 'PHP', extensions: ['.php'], grammarFile: 'tree-sitter-php' },\n { id: 'kotlin', label: 'Kotlin', extensions: ['.kt', '.kts'], grammarFile: 'tree-sitter-kotlin' },\n { id: 'swift', label: 'Swift', extensions: ['.swift'], grammarFile: 'tree-sitter-swift' },\n { id: 'scala', label: 'Scala', extensions: ['.scala', '.sc'], grammarFile: 'tree-sitter-scala' },\n { id: 'dart', label: 'Dart', extensions: ['.dart'], grammarFile: 'tree-sitter-dart' },\n { id: 'lua', label: 'Lua', extensions: ['.lua'], grammarFile: 'tree-sitter-lua' },\n { id: 'ex', label: 'Elixir', extensions: ['.ex', '.exs'], grammarFile: 'tree-sitter-elixir' },\n // Known limitation: the bundled bash grammar's external scanner throws under\n // web-tree-sitter 0.25.10 on `case`/heredoc constructs. Such files degrade\n // gracefully (per-file empty parse + a surfaced warning, never a build crash);\n // functions in case/heredoc-free scripts extract normally.\n { id: 'sh', label: 'Shell', extensions: ['.sh', '.bash'], grammarFile: 'tree-sitter-bash' },\n { id: 'zig', label: 'Zig', extensions: ['.zig'], grammarFile: 'tree-sitter-zig' },\n { id: 'c', label: 'C', extensions: ['.c'], grammarFile: 'tree-sitter-c' },\n // C++ owns `.h`: the cpp grammar is a superset of C, so C headers parse clean\n // under it, while C++ headers (classes/templates) break the C grammar.\n {\n id: 'cpp',\n label: 'C++',\n extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx', '.h'],\n grammarFile: 'tree-sitter-cpp',\n },\n // Objective-C owns `.m` (the far more common meaning in repos than MATLAB);\n // `.mm` (ObjC++) degrades gracefully on C++-only constructs.\n { id: 'objc', label: 'Objective-C', extensions: ['.m', '.mm'], grammarFile: 'tree-sitter-objc' },\n // `.mli` interface files parse best-effort under the implementation grammar.\n { id: 'ocaml', label: 'OCaml', extensions: ['.ml', '.mli'], grammarFile: 'tree-sitter-ocaml' },\n { id: 'rescript', label: 'ReScript', extensions: ['.res'], grammarFile: 'tree-sitter-rescript' },\n { id: 'solidity', label: 'Solidity', extensions: ['.sol'], grammarFile: 'tree-sitter-solidity' },\n // Embedded-script container formats (single-file components and templates).\n // Their script regions are extracted with a position-preserving mask and\n // parsed with the JS/TS (or Ruby, for ERB) grammars — see sfc.ts. The\n // grammarFile below is the effective-grammar fallback so bundling always\n // ships something loadable for the id; the actual grammar is chosen per file\n // (script `lang` attribute / the container's fixed embedded language).\n { id: 'vue', label: 'Vue', extensions: ['.vue'], grammarFile: 'tree-sitter-typescript' },\n { id: 'svelte', label: 'Svelte', extensions: ['.svelte'], grammarFile: 'tree-sitter-typescript' },\n { id: 'astro', label: 'Astro', extensions: ['.astro'], grammarFile: 'tree-sitter-typescript' },\n { id: 'html', label: 'HTML', extensions: ['.html', '.htm'], grammarFile: 'tree-sitter-javascript' },\n { id: 'erb', label: 'ERB', extensions: ['.erb'], grammarFile: 'tree-sitter-ruby' },\n { id: 'ejs', label: 'EJS', extensions: ['.ejs'], grammarFile: 'tree-sitter-javascript' },\n // SQL DDL — pure deterministic extract (sql-extract.ts), no tree-sitter grammar.\n { id: 'sql', label: 'SQL', extensions: ['.sql'], grammarFile: 'tree-sitter-typescript' },\n];\n\nconst EXT_TO_LANG = new Map<string, LanguageDef>();\nfor (const lang of LANGUAGES) {\n for (const ext of lang.extensions) EXT_TO_LANG.set(ext, lang);\n}\n\nconst ID_TO_LANG = new Map<string, LanguageDef>(LANGUAGES.map((l) => [l.id, l]));\n\nexport function langForExtension(ext: string): LanguageDef | undefined {\n return EXT_TO_LANG.get(ext.toLowerCase());\n}\n\nexport function langById(id: string): LanguageDef | undefined {\n return ID_TO_LANG.get(id);\n}\n\nexport function allLanguageIds(): string[] {\n return LANGUAGES.map((l) => l.id);\n}\n","import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createRequire } from 'node:module';\nimport { Parser, Language } from 'web-tree-sitter';\nimport { langById, LANGUAGES, type LanguageDef } from './languages.js';\n\n/**\n * Grammar loader. Resolves the pre-compiled tree-sitter `.wasm` for a language\n * from, in order:\n * 1. the `--grammars <dir>` override (offline / air-gapped)\n * 2. ../grammars next to dist (bundled in the published package)\n * 3. the installed `tree-sitter-wasms` package (dev / fallback)\n *\n * Languages are cached. The grammar set version is recorded in provenance so the\n * determinism contract is explicit about which grammars produced the graph.\n */\n\nconst require = createRequire(import.meta.url);\n\nlet parserInit: Promise<void> | null = null;\nconst languageCache = new Map<string, Language>();\n\n// The `--grammars <dir>` override, set per process (and per parse worker, via the\n// parse payload) before parsing. Configured by a command option, not an env var.\nlet grammarsOverride: string | undefined;\nexport function setGrammarsOverride(dir?: string): void {\n grammarsOverride = dir ? path.resolve(dir) : undefined;\n}\n\nfunction thisDir(): string {\n return path.dirname(fileURLToPath(import.meta.url));\n}\n\nlet cachedTreeSitterWasmsDir: string | null = null;\nfunction treeSitterWasmsOutDir(): string {\n if (cachedTreeSitterWasmsDir) return cachedTreeSitterWasmsDir;\n const pkgJson = require.resolve('tree-sitter-wasms/package.json');\n cachedTreeSitterWasmsDir = path.join(path.dirname(pkgJson), 'out');\n return cachedTreeSitterWasmsDir;\n}\n\n/**\n * The grammar-set version string recorded in provenance (determinism input).\n * The `+swift-vendored` suffix marks the vendored tree-sitter-swift build (see\n * vendor/README.md) that replaces the tree-sitter-wasms prebuilt; bump the\n * suffix if a vendored grammar is regenerated, so caches invalidate.\n */\nexport function grammarSetVersion(): string {\n try {\n const pkgJson = require.resolve('tree-sitter-wasms/package.json');\n const { version } = JSON.parse(fs.readFileSync(pkgJson, 'utf8')) as { version: string };\n return `tree-sitter-wasms@${version}+swift-vendored@0.7.1`;\n } catch {\n return 'tree-sitter-wasms@unknown+swift-vendored@0.7.1';\n }\n}\n\n/**\n * Candidate directories holding grammar .wasm files, highest priority first.\n * The vendor/ dirs are OVERLAYS holding only rebuilt replacements for\n * defective prebuilts (vendor/README.md) — they outrank the tree-sitter-wasms\n * fallback so dev/test runs without a prior `pnpm build` never load a\n * known-bad prebuilt, but they are never a complete grammar set.\n */\nfunction grammarDirs(): string[] {\n const dirs: string[] = [];\n // the `--grammars <dir>` override (offline / air-gapped), if set\n if (grammarsOverride) dirs.push(grammarsOverride);\n // ../grammars relative to dist/ (bundled in the published artifact)\n dirs.push(path.join(thisDir(), '..', 'grammars'));\n dirs.push(path.join(thisDir(), 'grammars'));\n // vendored overlays\n dirs.push(path.join(thisDir(), '..', 'vendor')); // from dist/\n dirs.push(path.join(thisDir(), '..', '..', 'vendor')); // from src/engine/\n // node_modules fallback\n try {\n dirs.push(treeSitterWasmsOutDir());\n } catch {\n /* tree-sitter-wasms not resolvable — rely on the dirs above */\n }\n return dirs;\n}\n\nconst isVendorOverlay = (dir: string): boolean => path.basename(dir) === 'vendor';\n\n/**\n * The first existing directory that holds a grammar .wasm set. Skips the\n * vendor overlays — they hold single replacement files, never a full set.\n * For a complete per-language resolution use resolvedGrammarFiles().\n */\nexport function grammarsSourceDir(): string | null {\n for (const dir of grammarDirs()) {\n if (isVendorOverlay(dir)) continue;\n if (fs.existsSync(dir) && fs.readdirSync(dir).some((f) => f.endsWith('.wasm'))) return dir;\n }\n return null;\n}\n\nfunction resolveGrammarFile(grammarFile: string): string {\n const fileName = `${grammarFile}.wasm`;\n for (const dir of grammarDirs()) {\n const candidate = path.join(dir, fileName);\n if (fs.existsSync(candidate)) return candidate;\n }\n throw new Error(\n `grammar \"${fileName}\" not found. Looked in: ${grammarDirs().join(', ')}. ` +\n `Pass --grammars <dir> pointing at a directory of grammar .wasm files.`,\n );\n}\n\n/**\n * Every registered language's grammar .wasm resolved through the same\n * priority order the parser uses (override > bundled > vendor overlay >\n * tree-sitter-wasms). Used by `vg bundle` so an air-gapped bundle always\n * carries the exact grammar files a scan would load.\n */\nexport function resolvedGrammarFiles(): { fileName: string; absPath: string }[] {\n return LANGUAGES.map((l) => ({\n fileName: `${l.grammarFile}.wasm`,\n absPath: resolveGrammarFile(l.grammarFile),\n }));\n}\n\nasync function ensureParserInit(): Promise<void> {\n if (!parserInit) parserInit = Parser.init();\n await parserInit;\n}\n\n/** Load (and cache) the tree-sitter Language for a vg language id. */\nexport async function loadLanguage(langId: string): Promise<Language> {\n const cached = languageCache.get(langId);\n if (cached) return cached;\n const def = langById(langId);\n if (!def) throw new Error(`unknown language id \"${langId}\"`);\n await ensureParserInit();\n const wasmPath = resolveGrammarFile(def.grammarFile);\n const language = await Language.load(fs.readFileSync(wasmPath));\n languageCache.set(langId, language);\n return language;\n}\n\n/** Construct a fresh parser bound to a language. */\nexport async function parserFor(def: LanguageDef): Promise<Parser> {\n const language = await loadLanguage(def.id);\n const parser = new Parser();\n parser.setLanguage(language);\n return parser;\n}\n","import type { NodeKind } from '../schema.js';\n\n/**\n * Per-language tree-sitter queries driving extraction. Each query uses a small,\n * fixed capture vocabulary so the generic extractor (parse.ts) stays\n * language-agnostic:\n *\n * @def — a definition node (its kind comes from the rule)\n * @name — the name node of that definition\n * @callee — a called name node (a call edge, resolved later)\n * @source — an import/require source string node (incl. quotes)\n * @extends / @implements — a base type name node (a heritage edge)\n *\n * Queries are best-effort per language: if a pattern fails to compile against a\n * grammar it is skipped (logged once), so one bad rule never disables a whole\n * language. Coverage is deepest for the TS/JS-first audience and a solid\n * baseline elsewhere — honestly recorded as `heuristic` resolution.\n */\n\nexport interface DefRule {\n kind: NodeKind;\n query: string;\n}\n\nexport interface LangQueries {\n defs: DefRule[];\n calls: string[];\n imports: string[];\n heritage: string[];\n /** Assert/guard expressions captured as @guard → invariant facts. */\n guards?: string[];\n /**\n * Constructor-parameter / field declared types captured as @typeref — a\n * structural dependency (e.g. Spring constructor/field injection) that never\n * appears as a `call_expression`/`object_creation_expression`, so it needs its\n * own capture. Resolved to a `references` edge (not `call`) in resolve.ts.\n */\n typeRefs?: string[];\n /**\n * Namespace declarations captured as @namespace — the namespaces a file\n * declares its types in. For languages where a namespace is decoupled from\n * the directory (C#), this lets the resolver connect a cross-directory\n * reference when the caller `using`-imports that namespace. Absent for\n * languages that have no namespace concept or where package == directory.\n */\n namespaces?: string[];\n}\n\n// assert-like call detection, shared by the C-family languages.\nconst ASSERT_CALLS = [\n '(call_expression function: (identifier) @_g (#match? @_g \"^(assert|invariant|require|precondition|invariantViolation)$\")) @guard',\n];\n\nconst TS_JS_CALLS = [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (member_expression property: (property_identifier) @callee))',\n '(new_expression constructor: (identifier) @callee)',\n];\n\nconst TS_JS_IMPORTS = [\n '(import_statement source: (string) @source)',\n '(call_expression function: (identifier) @_req (#eq? @_req \"require\") arguments: (arguments (string) @source))',\n];\n\nconst TYPESCRIPT: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_declaration name: (identifier) @name) @def' },\n {\n kind: 'function',\n query: '(generator_function_declaration name: (identifier) @name) @def',\n },\n {\n kind: 'function',\n query:\n '(variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)]) @def',\n },\n { kind: 'method', query: '(method_definition name: (property_identifier) @name) @def' },\n // Object-literal methods: `{ showToast: function () {} }` / `{ showToast: () => {} }`\n // (common in Vue/NS utilities; class method_definition alone does not cover these).\n {\n kind: 'method',\n query:\n '(pair key: (property_identifier) @name value: [(function_expression) (arrow_function)] @def)',\n },\n { kind: 'class', query: '(class_declaration name: (type_identifier) @name) @def' },\n { kind: 'class', query: '(abstract_class_declaration name: (type_identifier) @name) @def' },\n { kind: 'interface', query: '(interface_declaration name: (type_identifier) @name) @def' },\n ],\n calls: TS_JS_CALLS,\n imports: TS_JS_IMPORTS,\n heritage: [\n '(class_heritage (extends_clause value: (identifier) @extends))',\n '(class_heritage (extends_clause value: (member_expression property: (property_identifier) @extends)))',\n '(class_heritage (implements_clause (type_identifier) @implements))',\n '(extends_type_clause type: (type_identifier) @extends)',\n ],\n guards: ASSERT_CALLS,\n};\n\nconst JAVASCRIPT: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_declaration name: (identifier) @name) @def' },\n {\n kind: 'function',\n query: '(generator_function_declaration name: (identifier) @name) @def',\n },\n {\n kind: 'function',\n query:\n '(variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)]) @def',\n },\n { kind: 'method', query: '(method_definition name: (property_identifier) @name) @def' },\n // Object-literal methods (see TYPESCRIPT above).\n {\n kind: 'method',\n query:\n '(pair key: (property_identifier) @name value: [(function_expression) (arrow_function)] @def)',\n },\n { kind: 'class', query: '(class_declaration name: (identifier) @name) @def' },\n ],\n calls: TS_JS_CALLS,\n imports: TS_JS_IMPORTS,\n heritage: [\n '(class_heritage (identifier) @extends)',\n '(class_heritage (member_expression property: (property_identifier) @extends))',\n ],\n guards: ASSERT_CALLS,\n};\n\nconst PYTHON: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_definition name: (identifier) @name) @def' },\n { kind: 'class', query: '(class_definition name: (identifier) @name) @def' },\n ],\n calls: [\n '(call function: (identifier) @callee)',\n '(call function: (attribute attribute: (identifier) @callee))',\n ],\n imports: [\n '(import_statement name: (dotted_name) @source)',\n '(import_from_statement module_name: (dotted_name) @source)',\n // Relative imports (`from .models import X`, `from ..core.utils import Y`) —\n // the module is a `relative_import` node, not a `dotted_name`. These are the\n // bulk of intra-package edges and were previously dropped entirely.\n '(import_from_statement module_name: (relative_import) @source)',\n ],\n heritage: ['(class_definition superclasses: (argument_list (identifier) @extends))'],\n guards: ['(assert_statement) @guard'],\n};\n\nconst GO: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_declaration name: (identifier) @name) @def' },\n { kind: 'method', query: '(method_declaration name: (field_identifier) @name) @def' },\n { kind: 'class', query: '(type_declaration (type_spec name: (type_identifier) @name)) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (selector_expression field: (field_identifier) @callee))',\n ],\n imports: ['(import_spec path: (interpreted_string_literal) @source)'],\n heritage: [],\n};\n\nconst JAVA: LangQueries = {\n defs: [\n { kind: 'method', query: '(method_declaration name: (identifier) @name) @def' },\n { kind: 'method', query: '(constructor_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(class_declaration name: (identifier) @name) @def' },\n { kind: 'interface', query: '(interface_declaration name: (identifier) @name) @def' },\n ],\n calls: ['(method_invocation name: (identifier) @callee)', '(object_creation_expression type: (type_identifier) @callee)'],\n imports: ['(import_declaration (scoped_identifier) @source)'],\n heritage: [\n '(superclass (type_identifier) @extends)',\n '(super_interfaces (type_list (type_identifier) @implements))',\n ],\n // Spring-style dependency injection wires a collaborator via a constructor\n // parameter or a field, never a `new`/method call — so without these, an\n // injected repository/service shows zero callers even when it is the sole\n // reason five other classes exist.\n typeRefs: [\n '(constructor_declaration parameters: (formal_parameters (formal_parameter type: (type_identifier) @typeref)))',\n '(field_declaration type: (type_identifier) @typeref)',\n ],\n // A Java package is a directory, so cross-directory (cross-package) DI\n // resolves through `import a.b.Foo`. Capturing the package lets the resolver\n // reach the implementation in another package when the caller imports it.\n namespaces: ['(package_declaration (scoped_identifier) @namespace)', '(package_declaration (identifier) @namespace)'],\n};\n\nconst RUST: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_item name: (identifier) @name) @def' },\n { kind: 'class', query: '(struct_item name: (type_identifier) @name) @def' },\n { kind: 'class', query: '(enum_item name: (type_identifier) @name) @def' },\n { kind: 'interface', query: '(trait_item name: (type_identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (field_expression field: (field_identifier) @callee))',\n '(call_expression function: (scoped_identifier name: (identifier) @callee))',\n ],\n imports: ['(use_declaration (scoped_identifier) @source)'],\n heritage: [],\n};\n\nconst C_SHARP: LangQueries = {\n defs: [\n { kind: 'method', query: '(method_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(class_declaration name: (identifier) @name) @def' },\n { kind: 'interface', query: '(interface_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(struct_declaration name: (identifier) @name) @def' },\n // Enums and records are load-bearing lookup targets in real C# codebases\n // (permission enums, DTO records); without these captures a `Privilege`-\n // style lookup only ever resolves via the literal text fallthrough.\n // 'class' is this engine's established kind for enum-like types (see the\n // Rust enum_item and C enum_specifier mappings).\n { kind: 'class', query: '(enum_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(record_declaration name: (identifier) @name) @def' },\n ],\n calls: [\n '(invocation_expression function: (member_access_expression name: (identifier) @callee))',\n '(invocation_expression function: (identifier) @callee)',\n // `new Foo(...)` is an instantiation dependency (the caller depends on Foo),\n // and it is how a test most directly links to the class under test — without\n // it a test that only constructs the service showed up as no coverage.\n '(object_creation_expression type: (identifier) @callee)',\n ],\n imports: ['(using_directive (qualified_name) @source)', '(using_directive (identifier) @source)'],\n heritage: ['(base_list (identifier) @extends)'],\n // Dependency-injection wiring: the interface a class depends on appears as a\n // constructor-parameter type or a readonly field type, never as a call — so\n // without these captures a controller/service injected through an interface\n // looks like it references nothing. Simple (identifier) types only; generics/\n // qualified names are left to a precise rung. Mirrors the Java DI captures.\n typeRefs: [\n '(constructor_declaration (parameter_list (parameter type: (identifier) @typeref)))',\n '(field_declaration (variable_declaration type: (identifier) @typeref))',\n ],\n // A namespace is decoupled from the directory in C#, so cross-namespace\n // resolution needs to know which namespace a file declares. Both block-scoped\n // (`namespace N { }`) and file-scoped (`namespace N;`) forms.\n namespaces: [\n '(namespace_declaration name: [(identifier) (qualified_name)] @namespace)',\n '(file_scoped_namespace_declaration name: [(identifier) (qualified_name)] @namespace)',\n ],\n};\n\nconst RUBY: LangQueries = {\n defs: [\n { kind: 'method', query: '(method name: (identifier) @name) @def' },\n { kind: 'class', query: '(class name: (constant) @name) @def' },\n { kind: 'module', query: '(module name: (constant) @name) @def' },\n ],\n calls: ['(call method: (identifier) @callee)', '(command method: (identifier) @callee)'],\n imports: [\n '(call method: (identifier) @_m (#match? @_m \"require\") arguments: (argument_list (string (string_content) @source)))',\n ],\n heritage: ['(class (superclass (constant) @extends))'],\n};\n\n\nconst PHP: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_definition name: (name) @name) @def' },\n {\n kind: 'function',\n query:\n '(assignment_expression left: (variable_name (name) @name) right: [(anonymous_function_creation_expression) (arrow_function)]) @def',\n },\n { kind: 'method', query: '(method_declaration name: (name) @name) @def' },\n { kind: 'class', query: '(class_declaration name: (name) @name) @def' },\n { kind: 'class', query: '(trait_declaration name: (name) @name) @def' },\n { kind: 'interface', query: '(interface_declaration name: (name) @name) @def' },\n ],\n calls: [\n '(function_call_expression function: (name) @callee)',\n '(member_call_expression name: (name) @callee)',\n '(nullsafe_member_call_expression name: (name) @callee)',\n '(scoped_call_expression name: (name) @callee)',\n '(object_creation_expression (name) @callee)',\n ],\n imports: [\n '(namespace_use_clause (qualified_name) @source)',\n '(namespace_use_clause (name) @source)',\n '[(require_expression (string) @source) (require_once_expression (string) @source) (include_expression (string) @source) (include_once_expression (string) @source)]',\n ],\n heritage: ['(base_clause (name) @extends)', '(class_interface_clause (name) @implements)'],\n // PHP namespaces are decoupled from directories (PSR-4 maps them, but the\n // resolver has no composer.json), so cross-namespace DI resolves through\n // `use`. Constructor-parameter and typed-property types are the injection\n // points.\n namespaces: ['(namespace_definition name: (namespace_name) @namespace)'],\n typeRefs: [\n '(simple_parameter type: (named_type (name) @typeref))',\n '(property_declaration type: (named_type (name) @typeref))',\n ],\n guards: ['(function_call_expression function: (name) @_g (#eq? @_g \"assert\")) @guard'],\n};\n\n// fwcd grammar: no field names — captures are positional; each def pattern binds\n// exactly one @name (params live under function_value_parameters). `class` vs\n// `interface` are both class_declaration, split by the anonymous keyword token.\nconst KOTLIN: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_declaration (simple_identifier) @name) @def' },\n { kind: 'class', query: '(class_declaration \"class\" (type_identifier) @name) @def' },\n { kind: 'interface', query: '(class_declaration \"interface\" (type_identifier) @name) @def' },\n { kind: 'class', query: '(object_declaration (type_identifier) @name) @def' },\n ],\n calls: [\n '(call_expression (simple_identifier) @callee)',\n '(call_expression (navigation_expression (navigation_suffix (simple_identifier) @callee)))',\n ],\n imports: ['(import_header (identifier) @source)'],\n // Kotlin: package for cross-package DI reachability; primary-constructor\n // `val` params and property types are the injection points.\n namespaces: ['(package_header (identifier) @namespace)'],\n typeRefs: [\n '(class_parameter (user_type (type_identifier) @typeref))',\n '(property_declaration (variable_declaration (user_type (type_identifier) @typeref)))',\n '(property_declaration (variable_declaration (nullable_type (user_type (type_identifier) @typeref))))',\n ],\n heritage: [\n '(delegation_specifier (constructor_invocation (user_type (type_identifier) @extends)))',\n '(delegation_specifier (user_type (type_identifier) @implements))',\n ],\n guards: ['(call_expression (simple_identifier) @_g (#match? @_g \"^(require|check|assert)$\")) @guard'],\n};\n\n// class/struct/enum/extension are ALL class_declaration; extensions carry\n// name: (user_type …) and so get their own (duplicate-named) class def node.\nconst SWIFT: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_declaration name: (simple_identifier) @name) @def' },\n { kind: 'method', query: '(protocol_function_declaration name: (simple_identifier) @name) @def' },\n { kind: 'class', query: '(class_declaration name: (type_identifier) @name) @def' },\n { kind: 'class', query: '(class_declaration name: (user_type (type_identifier) @name)) @def' },\n { kind: 'interface', query: '(protocol_declaration name: (type_identifier) @name) @def' },\n ],\n calls: [\n '(call_expression (simple_identifier) @callee)',\n '(call_expression (navigation_expression suffix: (navigation_suffix suffix: (simple_identifier) @callee)))',\n ],\n imports: ['(import_declaration (identifier) @source)'],\n heritage: ['(inheritance_specifier inherits_from: (user_type (type_identifier) @extends))'],\n // Swift: init-parameter and stored-property types are the injection points\n // (protocol-typed). Whole-module visibility (handled in resolve.ts) makes the\n // conforming implementation reachable cross-file.\n typeRefs: [\n '(parameter (user_type (type_identifier) @typeref))',\n '(type_annotation (user_type (type_identifier) @typeref))',\n ],\n guards: [\n '(call_expression (simple_identifier) @_g (#match? @_g \"^(assert|precondition|assertionFailure|preconditionFailure)$\")) @guard',\n ],\n};\n\nconst SCALA: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_definition name: (identifier) @name) @def' },\n { kind: 'method', query: '(function_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(class_definition name: (identifier) @name) @def' },\n { kind: 'interface', query: '(trait_definition name: (identifier) @name) @def' },\n { kind: 'module', query: '(object_definition name: (identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (field_expression field: (identifier) @callee))',\n ],\n imports: [\n '(import_declaration path: (stable_identifier) @source)',\n '(import_declaration path: (identifier) @source)',\n ],\n heritage: [\n '(extends_clause type: (type_identifier) @extends)',\n '(extends_clause type: (generic_type type: (type_identifier) @extends))',\n '(extends_clause type: (compound_type base: (type_identifier) @extends))',\n '(extends_clause type: (compound_type extra: (type_identifier) @implements))',\n ],\n // Scala: package for cross-package DI reachability; class-parameter and val\n // types are the injection points.\n namespaces: ['(package_clause name: (package_identifier) @namespace)'],\n typeRefs: [\n '(class_parameter type: (type_identifier) @typeref)',\n '(val_definition type: (type_identifier) @typeref)',\n ],\n guards: ['(call_expression function: (identifier) @_g (#match? @_g \"^(require|assert|assume)$\")) @guard'],\n};\n\n// No call_expression node in this grammar: a call is an identifier followed by a\n// sibling selector(argument_part), hence the anchored sibling patterns.\nconst DART: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_signature name: (identifier) @name) @def' },\n { kind: 'method', query: '(constructor_signature name: (identifier) @name) @def' },\n { kind: 'class', query: '(class_definition name: (identifier) @name) @def' },\n { kind: 'class', query: '(mixin_declaration (identifier) @name) @def' },\n ],\n calls: [\n '(_ (identifier) @callee . (selector (argument_part)))',\n '(_ (selector (unconditional_assignable_selector (identifier) @callee)) . (selector (argument_part)))',\n '(_ (selector (conditional_assignable_selector (identifier) @callee)) . (selector (argument_part)))',\n '(cascade_section (cascade_selector (identifier) @callee) . (argument_part))',\n ],\n imports: ['(import_specification (configurable_uri (uri (string_literal) @source)))'],\n // Dart: constructor/method parameter types and typed field declarations are\n // the injection points (Dart resolves cross-file via `import`, so no\n // namespace query is needed — the import rung already reaches the impl).\n typeRefs: [\n '(formal_parameter (type_identifier) @typeref)',\n '(declaration (type_identifier) @typeref)',\n ],\n heritage: [\n '(superclass (type_identifier) @extends)',\n '(interfaces (type_identifier) @implements)',\n '(mixins (type_identifier) @implements)',\n ],\n guards: ['(assert_statement) @guard'],\n};\n\nconst LUA: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_definition_statement name: (identifier) @name) @def' },\n { kind: 'function', query: '(function_definition_statement name: (variable field: (identifier) @name)) @def' },\n { kind: 'method', query: '(function_definition_statement name: (variable method: (identifier) @name)) @def' },\n { kind: 'function', query: '(local_function_definition_statement name: (identifier) @name) @def' },\n {\n kind: 'function',\n query:\n '(variable_assignment (variable_list (variable field: (identifier) @name)) (expression_list value: (function_definition))) @def',\n },\n {\n kind: 'function',\n query:\n '(local_variable_declaration (variable_list (variable name: (identifier) @name)) (expression_list value: (function_definition))) @def',\n },\n ],\n calls: [\n '(call function: (variable name: (identifier) @callee))',\n '(call function: (variable field: (identifier) @callee))',\n '(call function: (variable method: (identifier) @callee))',\n ],\n imports: [\n '(call function: (variable name: (identifier) @_r (#eq? @_r \"require\")) arguments: (argument_list (expression_list (string) @source)))',\n ],\n heritage: [],\n guards: ['(call function: (variable name: (identifier) @_g (#eq? @_g \"assert\"))) @guard'],\n};\n\n// Expression-based grammar: defmodule/def/defp are ordinary `call` nodes keyed by\n// their target identifier, so every rule is predicate-gated. A parenthesized def\n// head is itself a call and yields one benign same-line self-capture; the\n// resolver's qualified-call/enclosing-def rules keep it from becoming an edge.\nconst ELIXIR: LangQueries = {\n defs: [\n { kind: 'module', query: '(call target: (identifier) @_kw (#eq? @_kw \"defmodule\") (arguments (alias) @name)) @def' },\n {\n kind: 'function',\n query:\n '(call target: (identifier) @_kw (#match? @_kw \"^(def|defp|defmacro|defmacrop|defguard|defguardp)$\") (arguments (call target: (identifier) @name))) @def',\n },\n {\n kind: 'function',\n query:\n '(call target: (identifier) @_kw (#match? @_kw \"^(def|defp|defmacro|defmacrop)$\") (arguments (identifier) @name)) @def',\n },\n {\n kind: 'function',\n query:\n '(call target: (identifier) @_kw (#match? @_kw \"^(def|defp|defmacro|defmacrop|defguard|defguardp)$\") (arguments (binary_operator left: (call target: (identifier) @name)))) @def',\n },\n ],\n calls: [\n '(call target: (dot right: (identifier) @callee))',\n '(call target: (identifier) @callee (#not-match? @callee \"^(def|defp|defmacro|defmacrop|defmodule|defstruct|defprotocol|defimpl|defguard|defguardp|defdelegate|defexception|defoverridable|alias|import|require|use|quote|unquote|moduledoc|doc|spec|type|typep|typedoc|opaque|behaviour|impl|derive|enforce_keys|callback|macrocallback|optional_callbacks|compile|deprecated|dialyzer|external_resource|on_definition|on_load|after_compile|before_compile)$\"))',\n ],\n imports: [\n '(call target: (identifier) @_kw (#match? @_kw \"^(alias|import|require|use)$\") (arguments (alias) @source))',\n '(call target: (identifier) @_kw (#match? @_kw \"^(alias|import|require|use)$\") (arguments (dot left: (alias) @source)))',\n ],\n heritage: [],\n};\n\n// Every shell command is a `command` node, so callees include external binaries\n// (rsync, git, …). Safe: the resolver has no global-name fallback, so only\n// callees matching a reachable function_definition become edges.\nconst BASH: LangQueries = {\n defs: [{ kind: 'function', query: '(function_definition name: (word) @name) @def' }],\n calls: ['(command name: (command_name (word) @callee))'],\n imports: [\n '(command name: (command_name (word) @_c (#match? @_c \"^(source|\\\\.)$\")) argument: [(word) (string) (raw_string) (concatenation)] @source)',\n ],\n heritage: [],\n};\n\nconst ZIG: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(variable_declaration (identifier) @name (struct_declaration)) @def' },\n { kind: 'class', query: '(variable_declaration (identifier) @name (enum_declaration)) @def' },\n { kind: 'class', query: '(variable_declaration (identifier) @name (union_declaration)) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (field_expression member: (identifier) @callee))',\n ],\n imports: ['(builtin_function (builtin_identifier) @_i (#eq? @_i \"@import\") (arguments (string) @source))'],\n heritage: [],\n guards: ['(call_expression function: (field_expression member: (identifier) @_g (#eq? @_g \"assert\"))) @guard'],\n};\n\n// Only body-bearing function_definitions match (prototypes are `declaration`s).\nconst C_LANG: LangQueries = {\n defs: [\n {\n kind: 'function',\n query:\n '(function_definition declarator: [(function_declarator declarator: (identifier) @name) (pointer_declarator declarator: (function_declarator declarator: (identifier) @name))]) @def',\n },\n { kind: 'class', query: '(struct_specifier name: (type_identifier) @name body: (field_declaration_list)) @def' },\n { kind: 'class', query: '(enum_specifier name: (type_identifier) @name body: (enumerator_list)) @def' },\n { kind: 'class', query: '(type_definition declarator: (type_identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (field_expression field: (field_identifier) @callee))',\n ],\n imports: ['(preproc_include path: (string_literal) @source)', '(preproc_include path: (system_lib_string) @source)'],\n heritage: [],\n guards: ['(call_expression function: (identifier) @_g (#match? @_g \"^(assert|static_assert)$\")) @guard'],\n};\n\nconst CPP: LangQueries = {\n defs: [\n {\n kind: 'function',\n query:\n '(function_definition declarator: [(function_declarator declarator: (identifier) @name) (pointer_declarator declarator: (function_declarator declarator: (identifier) @name)) (reference_declarator (function_declarator declarator: (identifier) @name))]) @def',\n },\n { kind: 'method', query: '(function_definition declarator: (function_declarator declarator: (field_identifier) @name)) @def' },\n {\n kind: 'method',\n query:\n '(function_definition declarator: [(function_declarator declarator: (qualified_identifier name: (identifier) @name)) (pointer_declarator declarator: (function_declarator declarator: (qualified_identifier name: (identifier) @name))) (reference_declarator (function_declarator declarator: (qualified_identifier name: (identifier) @name)))]) @def',\n },\n {\n kind: 'method',\n query:\n '(function_definition declarator: (function_declarator declarator: (qualified_identifier name: (qualified_identifier name: (identifier) @name)))) @def',\n },\n { kind: 'class', query: '(class_specifier name: (type_identifier) @name body: (field_declaration_list)) @def' },\n { kind: 'class', query: '(struct_specifier name: (type_identifier) @name body: (field_declaration_list)) @def' },\n { kind: 'module', query: '(namespace_definition name: (namespace_identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (field_expression field: (field_identifier) @callee))',\n '(call_expression function: (qualified_identifier name: (identifier) @callee))',\n '(call_expression function: (qualified_identifier name: (qualified_identifier name: (identifier) @callee)))',\n '(new_expression type: (type_identifier) @callee)',\n ],\n imports: ['(preproc_include path: (string_literal) @source)', '(preproc_include path: (system_lib_string) @source)'],\n heritage: [\n '(base_class_clause (type_identifier) @extends)',\n '(base_class_clause (qualified_identifier name: (type_identifier) @extends))',\n ],\n guards: ['(call_expression function: (identifier) @_g (#match? @_g \"^(assert|static_assert)$\")) @guard'],\n};\n\nconst OBJC: LangQueries = {\n defs: [\n {\n kind: 'function',\n query: '(function_definition declarator: (function_declarator declarator: (identifier) @name)) @def',\n },\n // The selector segments are the method_definition's direct bare identifiers\n // (param names sit inside method_parameter); the first segment names it.\n { kind: 'method', query: '(method_definition (identifier) @name) @def' },\n { kind: 'class', query: '(class_implementation . (identifier) @name) @def' },\n { kind: 'interface', query: '(class_interface . (identifier) @name) @def' },\n // A @protocol is Objective-C's interface — without this it is not a node, so\n // conformance and protocol-typed DI cannot resolve.\n { kind: 'interface', query: '(protocol_declaration (identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(message_expression method: (identifier) @callee)',\n ],\n imports: [\n '(preproc_include path: (string_literal) @source)',\n '(preproc_include path: (system_lib_string) @source)',\n ],\n // Superclass (`: NSObject`) is `extends`; adopted protocols (`<Servicing>`,\n // captured as parameterized_arguments after the interface name) are the\n // `implements` relationship a DI call disambiguates through.\n heritage: [\n '(class_interface superclass: (identifier) @extends)',\n '(class_interface (parameterized_arguments (type_name (type_identifier) @implements)))',\n ],\n guards: ASSERT_CALLS,\n};\n\nconst OCAML: LangQueries = {\n defs: [\n // Only parameterised bindings — plain `let x = …` values would drown the\n // graph in constants.\n { kind: 'function', query: '(let_binding pattern: (value_name) @name (parameter)) @def' },\n { kind: 'module', query: '(module_binding name: (module_name) @name) @def' },\n ],\n calls: ['(application_expression function: (value_path (value_name) @callee))'],\n imports: ['(open_module (module_path (module_name) @source))'],\n heritage: [],\n};\n\nconst RESCRIPT: LangQueries = {\n defs: [\n { kind: 'function', query: '(let_binding pattern: (value_identifier) @name body: (function)) @def' },\n { kind: 'module', query: '(module_binding name: (module_identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (value_identifier) @callee)',\n '(call_expression function: (value_identifier_path (value_identifier) @callee))',\n ],\n imports: ['(open_statement (module_identifier) @source)'],\n heritage: [],\n};\n\nconst SOLIDITY: LangQueries = {\n defs: [\n { kind: 'function', query: '(function_definition name: (identifier) @name) @def' },\n { kind: 'function', query: '(modifier_definition name: (identifier) @name) @def' },\n { kind: 'class', query: '(contract_declaration name: (identifier) @name) @def' },\n { kind: 'class', query: '(library_declaration name: (identifier) @name) @def' },\n { kind: 'interface', query: '(interface_declaration name: (identifier) @name) @def' },\n ],\n calls: [\n '(call_expression function: (identifier) @callee)',\n '(call_expression function: (member_expression property: (identifier) @callee))',\n '(emit_statement name: (identifier) @callee)',\n ],\n imports: ['(import_directive source: (string) @source)'],\n heritage: ['(inheritance_specifier ancestor: (user_defined_type (identifier) @extends))'],\n guards: [\n '(call_expression function: (identifier) @_g (#match? @_g \"^(require|assert)$\")) @guard',\n ],\n};\n\nconst BY_LANG: Record<string, LangQueries> = {\n ts: TYPESCRIPT,\n tsx: TYPESCRIPT,\n js: JAVASCRIPT,\n py: PYTHON,\n go: GO,\n java: JAVA,\n rust: RUST,\n cs: C_SHARP,\n rb: RUBY,\n php: PHP,\n kotlin: KOTLIN,\n swift: SWIFT,\n scala: SCALA,\n dart: DART,\n lua: LUA,\n ex: ELIXIR,\n sh: BASH,\n zig: ZIG,\n c: C_LANG,\n cpp: CPP,\n objc: OBJC,\n ocaml: OCAML,\n rescript: RESCRIPT,\n solidity: SOLIDITY,\n // Container formats (vue/svelte/astro/html/erb/ejs) have no entry here on\n // purpose: parse.ts routes them to their embedded language's queries.\n};\n\nexport function queriesFor(langId: string): LangQueries | undefined {\n return BY_LANG[langId];\n}\n","/**\n * Embedded-script container formats — files whose code lives in script regions\n * inside a non-code host document:\n *\n * - single-file components: Vue (`.vue`), Svelte (`.svelte`), Astro\n * (`.astro`, frontmatter fence + client `<script>`s);\n * - plain HTML with inline `<script>` blocks (`.html`/`.htm`);\n * - `<% … %>` templates: ERB (`.erb`, Ruby) and EJS (`.ejs`, JavaScript).\n *\n * The graph parses these by masking: every character outside the script\n * region(s) is replaced with a space (newlines kept), and the result is parsed\n * with the ordinary grammar of the embedded language. Masking preserves byte\n * offsets and line numbers exactly, so defs/calls/imports land on their true\n * positions in the original file and every downstream stage (resolution,\n * impact, display) works unchanged. Pure and deterministic: identical source →\n * identical mask.\n *\n * Template/markup content is intentionally out of scope — imports, exported\n * bindings, and calls all live in the script regions, which is what call/import\n * edges are built from.\n */\n\nexport interface EmbeddedScript {\n /** Effective grammar to parse the masked source with ('ts' | 'tsx' | 'js' | 'rb'). */\n langId: string;\n /** The original source with all non-script content blanked to spaces. */\n masked: string;\n}\n\ninterface ScriptTagSpec {\n kind: 'script-tags';\n /** Grammar when a block has no `lang` attribute. */\n defaultLang: string;\n /** Also extract a leading `---` frontmatter fence (Astro). */\n frontmatter?: boolean;\n}\n\ninterface DelimitedSpec {\n kind: 'delimited';\n /** The container's fixed embedded language. */\n lang: string;\n}\n\n/** Container language ids (must match the languages.ts registry entries). */\nconst CONTAINERS: Record<string, ScriptTagSpec | DelimitedSpec> = {\n vue: { kind: 'script-tags', defaultLang: 'js' },\n svelte: { kind: 'script-tags', defaultLang: 'js' },\n astro: { kind: 'script-tags', defaultLang: 'ts', frontmatter: true }, // frontmatter is TS\n html: { kind: 'script-tags', defaultLang: 'js' },\n erb: { kind: 'delimited', lang: 'rb' },\n ejs: { kind: 'delimited', lang: 'js' },\n};\n\nexport function isContainerLang(langId: string): boolean {\n return langId in CONTAINERS;\n}\n\ninterface Range {\n start: number;\n end: number;\n}\n\n// `<script …>body</script>` — non-greedy body, so multiple blocks (Vue's\n// `<script>` + `<script setup>`, Svelte's `context=\"module\"`) each match.\n// A void `<script src=… />` has an empty body and contributes nothing.\nconst SCRIPT_RE = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script\\s*>/gi;\n\n// Astro frontmatter: a `---` fence on the first line, closed by a `---` line.\nconst ASTRO_FENCE_RE = /^---\\r?\\n([\\s\\S]*?)(\\r?\\n)---(?:\\r?\\n|$)/;\n\n// `<% code %>` regions (ERB/EJS): `=`/`-` output tags included, `#`/`%%`\n// comment/escape forms excluded, optional `-`/`_` trim markers kept out of the\n// body. Non-greedy to the first closer, the standard template behaviour.\nconst DELIMITED_RE = /<%(?![%#])[=\\-_]?([\\s\\S]*?)[-_]?%>/g;\n\nconst LANG_ATTR_RE = /\\blang\\s*=\\s*[\"']?([A-Za-z]+)/i;\n\n/** Rank grammars so mixed blocks pick the most permissive one (tsx ⊇ ts ⊇ js for our queries). */\nconst GRAMMAR_RANK: Record<string, number> = { js: 0, ts: 1, tsx: 2 };\n\nfunction grammarForAttr(attrs: string, fallback: string): string {\n const m = LANG_ATTR_RE.exec(attrs);\n if (!m) return fallback;\n const lang = m[1].toLowerCase();\n if (lang === 'ts' || lang === 'typescript') return 'ts';\n if (lang === 'tsx') return 'tsx';\n return 'js'; // js / jsx / anything exotic → the JS grammar\n}\n\n/**\n * Extract the script regions of a container-format file. Returns null for\n * non-container language ids (the caller parses the source as-is). A container\n * file with no script region returns a fully-blank mask — the file still gets\n * a graph node, it just defines nothing.\n */\nexport function extractEmbeddedScript(langId: string, source: string): EmbeddedScript | null {\n const spec = CONTAINERS[langId];\n if (!spec) return null;\n\n if (spec.kind === 'delimited') {\n const ranges: Range[] = [];\n for (const m of source.matchAll(DELIMITED_RE)) {\n const body = m[1] ?? '';\n if (!body.trim()) continue;\n const start = m.index + m[0].indexOf(body);\n ranges.push({ start, end: start + body.length });\n }\n // Fragments are expressions/statements cut from one template — terminate\n // each region (on the trim/closing char, still inside the match, so the\n // length is unchanged) so `<%= a %> … <%= b %>` on one line parses as two\n // statements rather than one garbled one.\n return { langId: spec.lang, masked: mask(source, ranges, { terminate: true }) };\n }\n\n const ranges: Range[] = [];\n let grammar = spec.defaultLang;\n\n if (spec.frontmatter) {\n const fence = ASTRO_FENCE_RE.exec(source);\n if (fence) {\n const start = fence[0].indexOf('\\n') + 1;\n ranges.push({ start, end: start + fence[1].length });\n }\n }\n\n for (const m of source.matchAll(SCRIPT_RE)) {\n const attrs = m[1] ?? '';\n const body = m[2] ?? '';\n if (!body) continue;\n const start = m.index + '<script'.length + attrs.length + 1; // past the tag's '>'\n ranges.push({ start, end: start + body.length });\n const g = grammarForAttr(attrs, spec.defaultLang);\n if (GRAMMAR_RANK[g] > GRAMMAR_RANK[grammar]) grammar = g;\n }\n\n return { langId: grammar, masked: mask(source, ranges) };\n}\n\n/**\n * Blank everything outside `ranges` to spaces, preserving newlines (and CR).\n * With `terminate`, the character right after each range (part of the closing\n * delimiter, never a newline) becomes `;` — a statement boundary for the\n * embedded language.\n */\nfunction mask(source: string, ranges: Range[], opts: { terminate?: boolean } = {}): string {\n const out = new Array<string>(source.length);\n for (let i = 0; i < source.length; i++) {\n const ch = source[i];\n out[i] = ch === '\\n' || ch === '\\r' ? ch : ' ';\n }\n for (const r of ranges) {\n for (let i = r.start; i < r.end && i < source.length; i++) out[i] = source[i];\n if (opts.terminate && r.end < source.length && out[r.end] === ' ') out[r.end] = ';';\n }\n return out.join('');\n}\n","import { Query, type Node, type Language } from 'web-tree-sitter';\nimport { parserFor, loadLanguage } from './grammars.js';\nimport { langById } from './languages.js';\nimport { queriesFor, type DefRule } from './queries.js';\nimport { extractEmbeddedScript } from './sfc.js';\nimport { hashString } from './hash.js';\nimport { redactSecrets } from '../core-open/utils/redact.js';\nimport type { FileParse, RawCall, RawDef, RawGuard, RawHeritage, RawImport, RawTypeRef } from './types.js';\n\n/**\n * Parse a single file's source into the raw symbol/edge tables. Pure and\n * deterministic: identical (lang, source) → identical FileParse. Cross-file\n * resolution is a later stage (resolve.ts); here we only see one file.\n */\n\n// Compiled queries are cached per (lang, querySource) — compilation is the\n// expensive part and queries are reused across every file of a language.\nconst compiledCache = new Map<string, Query | null>();\n\nfunction compile(lang: Language, langId: string, source: string): Query | null {\n const key = `${langId}::${source}`;\n if (compiledCache.has(key)) return compiledCache.get(key) ?? null;\n let q: Query | null = null;\n try {\n q = new Query(lang, source);\n } catch {\n q = null; // grammar doesn't support this pattern — skip it gracefully\n }\n compiledCache.set(key, q);\n return q;\n}\n\nfunction namedCapture(\n captures: { name: string; node: Node }[],\n name: string,\n): Node | undefined {\n return captures.find((c) => c.name === name)?.node;\n}\n\n/**\n * Wrapper node types that sit between a *qualified* callee identifier and the\n * call node (`obj.foo()` / `pkg::foo()` / `recv.foo()` across the grammars).\n * A bare call's identifier hangs directly off the call node instead.\n */\nconst MEMBER_PARENT_TYPES = new Set([\n 'member_expression', // ts/js: obj.foo()\n 'attribute', // python: obj.foo()\n 'selector_expression', // go: pkg.Foo()\n 'field_expression', // rust/scala/c/cpp/zig: recv.foo()\n 'scoped_identifier', // rust: Type::foo()\n 'member_access_expression', // c#: obj.Foo()\n 'qualified_identifier', // c++: ns::f(), Type::m()\n 'dot', // elixir: Mod.fun()\n 'navigation_suffix', // kotlin/swift: recv.foo()\n 'member_call_expression', // php: $x->m()\n 'nullsafe_member_call_expression', // php: $x?->m()\n 'scoped_call_expression', // php: X::m()\n 'unconditional_assignable_selector', // dart: x.foo()\n 'conditional_assignable_selector', // dart: x?.foo()\n 'cascade_selector', // dart: x..foo()\n 'value_identifier_path', // rescript: Mod.foo() (only exists for qualified calls)\n]);\n\n/**\n * Was this callee identifier part of a qualified call (`x.foo()`) rather than a\n * bare one (`foo()`)? The queries capture only the trailing name, so the\n * resolver needs this bit to know a same-file def with the same short name is\n * NOT evidence — the receiver points elsewhere (see resolve.ts).\n */\nfunction isQualifiedCallee(node: Node): boolean {\n const parent = node.parent;\n if (!parent) return false;\n if (MEMBER_PARENT_TYPES.has(parent.type)) return true;\n // Java `method_invocation` and Ruby `call` keep receiver and name on the call\n // node itself — qualified iff the receiver/object field is present.\n if (parent.type === 'method_invocation') return parent.childForFieldName('object') != null;\n // Ruby `call` carries a `receiver` field when qualified; Python's `call` has\n // no such field (its qualified form is the `attribute` wrapper above), and\n // Elixir's `call` has none either (its qualified form is the `dot` wrapper).\n if (parent.type === 'call') return parent.childForFieldName('receiver') != null;\n // Lua wraps every callee in `variable`; qualified iff a `table` receiver exists\n // (`repo.fetch()` / `repo:method()` carry table:, bare `foo()` has only name:).\n if (parent.type === 'variable') return parent.childForFieldName('table') != null;\n // OCaml wraps every callee in `value_path`; qualified iff a module path is\n // present (`Mod.f x` has two named children, bare `f x` has one).\n if (parent.type === 'value_path') return parent.namedChildCount > 1;\n // ObjC message sends: `[obj doThing]` points elsewhere, but `[self …]` /\n // `[super …]` stay within the class — same-file evidence still counts there.\n if (parent.type === 'message_expression') {\n const recv = parent.childForFieldName('receiver');\n return recv != null && recv.text !== 'self' && recv.text !== 'super';\n }\n return false;\n}\n\nfunction signatureOf(source: string, def: Node, langId: string): string {\n // The text up to the body opening, single-lined, bounded — a deterministic,\n // human-meaningful signature without dragging in the whole body.\n // - Brace languages: cut at the body `{`.\n // - Python: cut at the def-terminating `:` at bracket-depth 0 (so a `:` inside\n // typed params / generics / the `-> Dict[...]` return type doesn't cut it,\n // and the docstring/body is excluded).\n // - Ruby: the header is the first line.\n const full = source.slice(def.startIndex, def.endIndex);\n let head: string;\n if (langId === 'py') head = pythonHeader(full);\n // Ruby/Elixir: `do…end` bodies (and Elixir `%{}` default args would break a\n // brace cut) — the header is the first line.\n else if (langId === 'rb' || langId === 'ex') head = full.split('\\n')[0];\n else {\n const braceIdx = full.indexOf('{');\n head = braceIdx >= 0 ? full.slice(0, braceIdx) : full.split('\\n')[0];\n }\n head = head.replace(/\\s+/g, ' ').trim().replace(/[:{]\\s*$/, '').trim();\n return head.length > 200 ? `${head.slice(0, 197)}...` : head;\n}\n\n/**\n * A short doc summary for a definition — the leading doc-comment (JSDoc/TSDoc,\n * `//`, `///`, `#`) directly above it, or (Python) the body docstring. Gives a\n * tersely-named symbol real prose for semantic search. Deterministic, marker-\n * stripped, whitespace-collapsed, truncated; never the full body. Returns\n * undefined when there is no doc.\n */\nfunction scrubbedDoc(source: string, def: Node, langId: string): string | undefined {\n const doc = docOf(source, def, langId);\n return doc === undefined ? undefined : redactSecrets(doc);\n}\n\nfunction docOf(source: string, def: Node, langId: string): string | undefined {\n const lines = source.split('\\n');\n if (langId === 'py') return pythonDocstring(lines, def.startPosition.row);\n return leadingComment(lines, def.startPosition.row);\n}\n\n/** Contiguous comment lines directly above `row` (0-based), markers stripped. */\nfunction leadingComment(lines: string[], row: number): string | undefined {\n const collected: string[] = [];\n for (let r = row - 1; r >= 0; r--) {\n const line = lines[r].trim();\n if (line === '') break; // a blank line detaches the comment\n if (/^(\\/\\/|\\/\\*\\*?|\\*\\/?|#|;|--)/.test(line)) collected.unshift(line);\n else break;\n }\n if (!collected.length) return undefined;\n const text = collected\n .join('\\n')\n .replace(/\\/\\*\\*?|\\*\\//g, ' ') // /** and */\n .replace(/^\\s*[*]\\s?/gm, ' ') // leading * in block comments\n .replace(/^\\s*(\\/\\/+|#+|;+|--)\\s?/gm, ' ') // line-comment markers\n .replace(/@\\w+/g, ' '); // drop JSDoc tags (@param, @returns…)\n return clip(text);\n}\n\n/** The first string literal in a Python body (the docstring), if present. */\nfunction pythonDocstring(lines: string[], row: number): string | undefined {\n // Find the header's terminating line (ends with ':'), then the first non-blank line.\n let r = row;\n while (r < lines.length && !/:\\s*(#.*)?$/.test(lines[r])) r++;\n let j = r + 1;\n while (j < lines.length && lines[j].trim() === '') j++;\n const first = lines[j]?.trim() ?? '';\n const m = /^[rubfRUBF]{0,2}(\"\"\"|''')/.exec(first);\n if (!m) return undefined;\n const q = m[1];\n let rest = first.slice(first.indexOf(q) + 3);\n if (rest.includes(q)) return clip(rest.slice(0, rest.indexOf(q))); // single-line docstring\n const parts = [rest];\n for (let k = j + 1; k < lines.length; k++) {\n const idx = lines[k].indexOf(q);\n if (idx >= 0) {\n parts.push(lines[k].slice(0, idx));\n break;\n }\n parts.push(lines[k]);\n }\n return clip(parts.join(' '));\n}\n\nfunction clip(s: string): string | undefined {\n const t = s.replace(/\\s+/g, ' ').trim();\n if (!t) return undefined;\n return t.length > 200 ? `${t.slice(0, 197)}...` : t;\n}\n\n/** Python def/class header up to the terminating `:` at bracket-depth 0. */\nfunction pythonHeader(full: string): string {\n let depth = 0;\n for (let i = 0; i < full.length; i++) {\n const c = full[i];\n if (c === '(' || c === '[' || c === '{') depth++;\n else if (c === ')' || c === ']' || c === '}') depth--;\n else if (c === ':' && depth === 0) return full.slice(0, i);\n }\n return full.split('\\n')[0];\n}\n\nexport async function parseSource(\n rel: string,\n langId: string,\n source: string,\n): Promise<FileParse> {\n // Pure extractors (no tree-sitter) — SQL DDL topology.\n if (langId === 'sql') {\n const { parseSqlFile } = await import('./sql-extract.js');\n return parseSqlFile(rel, source);\n }\n\n // Container formats (Vue/Svelte/Astro SFCs): parse the embedded script\n // region with the JS/TS grammar over a position-preserving mask, so every\n // offset/line below refers to the original file. The node keeps the\n // container's own lang id.\n const embedded = extractEmbeddedScript(langId, source);\n const effLangId = embedded?.langId ?? langId;\n const text = embedded?.masked ?? source;\n const def = langById(effLangId);\n const langQueries = queriesFor(effLangId);\n const hash = hashString(source);\n const result: FileParse = {\n rel,\n lang: langId,\n hash,\n bytes: Buffer.byteLength(source, 'utf8'),\n defs: [],\n calls: [],\n imports: [],\n heritage: [],\n typeRefs: [],\n guards: [],\n };\n if (!def || !langQueries) return result;\n\n const language = await loadLanguage(effLangId);\n const parser = await parserFor(def);\n const tree = parser.parse(text);\n if (!tree) return result;\n const root = tree.rootNode;\n\n // --- definitions ---\n const rawDefs: (RawDef & { _start: number; _end: number })[] = [];\n for (const rule of langQueries.defs) {\n collectDefs(language, effLangId, text, root, rule, rawDefs);\n }\n // Dedupe definitions that overlap on the same name+range (multiple rules can\n // match the same node, e.g. abstract vs plain class).\n const seen = new Set<string>();\n const deduped = rawDefs.filter((d) => {\n const key = `${d._start}:${d._end}:${d.name}:${d.kind}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n // Compute dotted qualified names by nesting (smallest enclosing def is parent).\n const byStart = [...deduped].sort((a, b) => a._start - b._start || b._end - a._end);\n for (const d of byStart) {\n const parent = enclosing(byStart, d._start, d._end);\n d.qualifiedName = parent ? `${parent.qualifiedName}.${d.name}` : d.name;\n }\n result.defs = byStart\n .map((d) => {\n const { _start, _end, ...rest } = d;\n void _start;\n void _end;\n return rest;\n })\n .sort(\n (a, b) =>\n a.startLine - b.startLine ||\n a.qualifiedName.localeCompare(b.qualifiedName) ||\n a.name.localeCompare(b.name),\n );\n\n // --- calls ---\n // A definition's own name node must never double as a call site: in\n // expression-based grammars (Elixir) a `def foo(…)` head is itself a `call`\n // node, which would fabricate a recursion edge for every definition.\n const defNameBytes = new Set<number>();\n for (const qsrc of langQueries.defs) {\n const q = compile(language, effLangId, qsrc.query);\n if (!q) continue;\n for (const m of q.matches(root)) {\n const nameNode = namedCapture(m.captures, 'name');\n if (nameNode) defNameBytes.add(nameNode.startIndex);\n }\n }\n const calls: RawCall[] = [];\n for (const qsrc of langQueries.calls) {\n const q = compile(language, effLangId, qsrc);\n if (!q) continue;\n for (const cap of q.captures(root)) {\n if (cap.name !== 'callee') continue;\n if (defNameBytes.has(cap.node.startIndex)) continue;\n calls.push({\n callee: cap.node.text,\n byte: cap.node.startIndex,\n line: cap.node.startPosition.row + 1,\n qualified: isQualifiedCallee(cap.node),\n });\n }\n }\n result.calls = calls.sort((a, b) => a.byte - b.byte || a.callee.localeCompare(b.callee));\n\n // --- imports ---\n const imports: RawImport[] = [];\n for (const qsrc of langQueries.imports) {\n const q = compile(language, effLangId, qsrc);\n if (!q) continue;\n for (const cap of q.captures(root)) {\n if (cap.name !== 'source') continue;\n imports.push({ source: stripQuotes(cap.node.text) });\n }\n }\n result.imports = dedupeImports(imports);\n\n // --- heritage (extends / implements) ---\n const heritage: RawHeritage[] = [];\n for (const qsrc of langQueries.heritage) {\n const q = compile(language, effLangId, qsrc);\n if (!q) continue;\n for (const cap of q.captures(root)) {\n if (cap.name !== 'extends' && cap.name !== 'implements') continue;\n heritage.push({ superName: cap.node.text, byte: cap.node.startIndex, kind: cap.name });\n }\n }\n result.heritage = heritage.sort(\n (a, b) =>\n a.byte - b.byte || a.kind.localeCompare(b.kind) || a.superName.localeCompare(b.superName),\n );\n\n // --- type references (constructor-param / field types → DI dependency edges) ---\n const typeRefs: RawTypeRef[] = [];\n for (const qsrc of langQueries.typeRefs ?? []) {\n const q = compile(language, effLangId, qsrc);\n if (!q) continue;\n for (const cap of q.captures(root)) {\n if (cap.name !== 'typeref') continue;\n typeRefs.push({ name: cap.node.text, byte: cap.node.startIndex });\n }\n }\n result.typeRefs = typeRefs.sort((a, b) => a.byte - b.byte || a.name.localeCompare(b.name));\n\n // --- namespaces declared by this file (C# cross-namespace resolution) ---\n const namespaces = new Set<string>();\n for (const qsrc of langQueries.namespaces ?? []) {\n const q = compile(language, effLangId, qsrc);\n if (!q) continue;\n for (const cap of q.captures(root)) {\n if (cap.name !== 'namespace') continue;\n const name = cap.node.text.trim();\n if (name) namespaces.add(name);\n }\n }\n if (namespaces.size) result.namespaces = [...namespaces].sort();\n\n // --- guards (assert-like expressions → invariant facts) ---\n const guards: RawGuard[] = [];\n for (const qsrc of langQueries.guards ?? []) {\n const q = compile(language, effLangId, qsrc);\n if (!q) continue;\n for (const cap of q.captures(root)) {\n if (cap.name !== 'guard') continue;\n const expr = cap.node.text.replace(/\\s+/g, ' ').trim();\n guards.push({ expr: expr.length > 160 ? `${expr.slice(0, 157)}...` : expr, line: cap.node.startPosition.row + 1 });\n }\n }\n result.guards = guards.sort((a, b) => a.line - b.line || a.expr.localeCompare(b.expr));\n\n tree.delete();\n return result;\n}\n\n/**\n * Dart splits a function into sibling signature + body nodes (and wraps class\n * methods in a method_signature). Return the trailing function_body so the def\n * span covers it — otherwise calls inside the body attribute to the file and\n * nested defs do not nest.\n */\nfunction dartBodyOf(defNode: Node): Node | null {\n if (!defNode.type.endsWith('_signature')) return null;\n if (defNode.nextNamedSibling?.type === 'function_body') return defNode.nextNamedSibling;\n const wrapper = defNode.parent;\n if (wrapper?.type === 'method_signature' && wrapper.nextNamedSibling?.type === 'function_body') {\n return wrapper.nextNamedSibling;\n }\n return null;\n}\n\nfunction collectDefs(\n language: Language,\n langId: string,\n source: string,\n root: Node,\n rule: DefRule,\n out: (RawDef & { _start: number; _end: number })[],\n): void {\n const q = compile(language, langId, rule.query);\n if (!q) return;\n for (const match of q.matches(root)) {\n const defNode = namedCapture(match.captures, 'def');\n const nameNode = namedCapture(match.captures, 'name');\n if (!defNode || !nameNode) continue;\n // Dart splits a function into sibling signature + body nodes; the def span\n // must cover the body or calls inside it would attribute to the file, and\n // nested defs would not nest.\n const spanEnd = dartBodyOf(defNode) ?? defNode;\n out.push({\n kind: rule.kind,\n name: nameNode.text,\n qualifiedName: nameNode.text, // refined after nesting is computed\n startLine: defNode.startPosition.row + 1,\n endLine: spanEnd.endPosition.row + 1,\n startByte: defNode.startIndex,\n endByte: spanEnd.endIndex,\n signature:\n rule.kind === 'function' || rule.kind === 'method'\n ? redactSecrets(signatureOf(source, defNode, langId))\n : undefined,\n // GUARDRAILS §1: signatures/docs are lifted verbatim from source and are\n // persisted (graph.json, `vg share` commits it) — scrub at ingest.\n doc: scrubbedDoc(source, defNode, langId),\n visibility: undefined,\n _start: defNode.startIndex,\n _end: spanEnd.endIndex,\n });\n }\n}\n\n/** The smallest def strictly containing [start,end) other than itself. */\nfunction enclosing(\n defs: { qualifiedName: string; _start: number; _end: number }[],\n start: number,\n end: number,\n): { qualifiedName: string } | undefined {\n let best: { qualifiedName: string; _start: number; _end: number } | undefined;\n for (const d of defs) {\n if (d._start === start && d._end === end) continue;\n if (d._start <= start && d._end >= end) {\n if (!best || d._end - d._start < best._end - best._start) best = d;\n }\n }\n return best;\n}\n\nfunction stripQuotes(text: string): string {\n return text.replace(/^['\"`]|['\"`]$/g, '');\n}\n\nfunction dedupeImports(imports: RawImport[]): RawImport[] {\n const seen = new Set<string>();\n const out: RawImport[] = [];\n for (const i of imports.sort((a, b) => a.source.localeCompare(b.source))) {\n if (seen.has(i.source)) continue;\n seen.add(i.source);\n out.push(i);\n }\n return out;\n}\n"]}
@@ -5,7 +5,7 @@ import * as fs from 'fs';
5
5
  import * as path from 'path';
6
6
 
7
7
  var MODEL_ORCHESTRATOR_SCHEMA_VERSION = "model-orchestrator/0";
8
- var PACK_CHANNEL = "2026.07.3";
8
+ var PACK_CHANNEL = "2026.07.4";
9
9
  var QUALIFIED_PACKS = [
10
10
  {
11
11
  packId: `spark@${PACK_CHANNEL}`,
@@ -50,7 +50,7 @@ var QUALIFIED_PACKS = [
50
50
  },
51
51
  resources: { minRamGb: 4, estimatedKvPer1kContext: 2 * 1024 * 1024 },
52
52
  provenance: {
53
- notes: "Spark@2026.07.3 \u2014 Approach B default: GGUF primary, PatchIR grammar fail-closed, Ollama fallback"
53
+ notes: "Spark@2026.07.4 \u2014 Approach B: first-party GGUF + embedded vibgrate manager; Ollama pack fallback only"
54
54
  }
55
55
  },
56
56
  {
@@ -96,7 +96,7 @@ var QUALIFIED_PACKS = [
96
96
  },
97
97
  resources: { minRamGb: 8, minVramGb: 6, estimatedKvPer1kContext: 4 * 1024 * 1024 },
98
98
  provenance: {
99
- notes: "Flow@2026.07.3 \u2014 Approach B default GGUF when fit allows; Ollama fallback for machines without store"
99
+ notes: "Flow@2026.07.4 \u2014 first-party GGUF primary; Ollama pack fallback only"
100
100
  }
101
101
  },
102
102
  {
@@ -105,13 +105,20 @@ var QUALIFIED_PACKS = [
105
105
  displayName: "Forge",
106
106
  promise: "Strongest deep work that safely fits (migrations, multi-file).",
107
107
  primary: {
108
- backend: "ollama",
109
- weightsRef: "qwen2.5-coder:14b",
108
+ backend: "llama.cpp",
109
+ weightsRef: "qwen2.5-coder-14b-q4_k_m.gguf",
110
110
  quant: "q4_k_m",
111
111
  license: "Apache-2.0",
112
112
  weightsBytes: estimateModelBytes("qwen2.5-coder:14b").bytes
113
113
  },
114
114
  fallback: [
115
+ {
116
+ backend: "ollama",
117
+ weightsRef: "qwen2.5-coder:14b",
118
+ quant: "q4_k_m",
119
+ license: "Apache-2.0",
120
+ weightsBytes: estimateModelBytes("qwen2.5-coder:14b").bytes
121
+ },
115
122
  {
116
123
  backend: "ollama",
117
124
  weightsRef: "qwen2.5-coder:7b",
@@ -128,12 +135,15 @@ var QUALIFIED_PACKS = [
128
135
  maxParallelEdits: 6,
129
136
  minEffectiveScore: 0.7,
130
137
  constrainedDecoding: false,
131
- preferredInference: "ollama",
138
+ preferredInference: "llama.cpp",
139
+ inferenceIsolation: "embedded",
132
140
  kvCacheStrategy: "stable_prefix",
133
141
  securityTier: "L1"
134
142
  },
135
143
  resources: { minRamGb: 16, minVramGb: 12, estimatedKvPer1kContext: 8 * 1024 * 1024 },
136
- provenance: { notes: "Forge@2026.07.2 \u2014 deep work; PatchIR-oriented edits without forced grammar yet" }
144
+ provenance: {
145
+ notes: "Forge@2026.07.4 \u2014 first-party 14B GGUF + embedded vibgrate manager (same path as Spark/Flow); Ollama pack fallback only"
146
+ }
137
147
  }
138
148
  ];
139
149
  var GiB = 1024 ** 3;
@@ -474,5 +484,5 @@ function parseMode(raw) {
474
484
  }
475
485
 
476
486
  export { MODEL_ORCHESTRATOR_SCHEMA_VERSION, QUALIFIED_PACKS, activePin, buildOrchestratorStatus, fitPack, listModes, orchestratorStatePath, packById, packForMode, parseMode, pinPack, providerForBackend, readOrchestratorState, recommendMode, resolveMode, setDefaultMode, unpinPack, writeOrchestratorState };
477
- //# sourceMappingURL=chunk-3V24O47U.js.map
478
- //# sourceMappingURL=chunk-3V24O47U.js.map
487
+ //# sourceMappingURL=chunk-PVZBYZZR.js.map
488
+ //# sourceMappingURL=chunk-PVZBYZZR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime/model-orchestrator.ts"],"names":[],"mappings":";;;;;;AA6BO,IAAM,iCAAA,GAAoC;AAoKjD,IAAM,YAAA,GAAe,WAAA;AASd,IAAM,eAAA,GAAmC;AAAA,EAC9C;AAAA,IACE,MAAA,EAAQ,SAAS,YAAY,CAAA,CAAA;AAAA,IAC7B,IAAA,EAAM,OAAA;AAAA,IACN,WAAA,EAAa,OAAA;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A,EAAM,MAAA,EAAO,GAAI,IAAA;AACrC;AAGO,SAAS,mBAAmB,OAAA,EAA4C;AAC7E,EAAA,QAAQ,OAAA;AAAS,IACf,KAAK,QAAA;AACH,MAAA,OAAO,QAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,WAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,UAAA;AAAA,IACT;AACE,MAAA,OAAO,QAAA;AAAA;AAEb;AAGO,SAAS,UAAU,GAAA,EAAkD;AAC1E,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,MAAM,CAAA,GAAI,GAAA,CAAI,IAAA,EAAK,CAAE,WAAA,EAAY;AACjC,EAAA,IAAI,MAAM,OAAA,IAAW,CAAA,KAAM,MAAA,IAAU,CAAA,KAAM,SAAS,OAAO,CAAA;AAC3D,EAAA,OAAO,IAAA;AACT","file":"chunk-PVZBYZZR.js","sourcesContent":["/**\n * Vibgrate Model Orchestrator — Code Modes (Spark / Flow / Forge).\n *\n * Product stance (PRD): users and agents select outcome-oriented **Code Modes**,\n * never GGUF names by default. This module:\n * 1. Declares versioned **qualified packs** (contract + primary/fallback weights)\n * 2. Runs a **fit** algorithm (available memory now × reserves × repo signals)\n * 3. Resolves mode → pack → concrete model / backend\n * 4. Supports pin/unpin for reproducibility\n *\n * Pure resolve + fit helpers have no I/O. Registry pin state uses the global\n * Vibgrate data dir (never in-repo). Pull/ensure is a separate CLI concern that\n * calls into `vg models pull` after resolve.\n *\n * schemaVersion: model-orchestrator/0\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { estimateModelBytes, type SystemMemory } from '../code/capability.js';\nimport {\n MODEL_EXECUTION_PROFILE_SCHEMA_VERSION,\n type ModelExecutionProfile,\n type ModelMode,\n type ToolCallingMode,\n type EditFormatPreference,\n} from './model-execution-profile.js';\nimport { vibgrateDataDir } from './paths.js';\n\nexport const MODEL_ORCHESTRATOR_SCHEMA_VERSION = 'model-orchestrator/0' as const;\n\n/** UX fit vocabulary (stricter than “weights fit”). */\nexport type FitLabel = 'flies' | 'comfortable' | 'tight' | 'will_not_fit';\n\nexport type TaskClass = 'spark_task' | 'flow_task' | 'forge_task' | 'explicit_mode';\n\nexport interface PackWeightsRef {\n /** Backend that can load these weights. */\n backend: 'ollama' | 'llama.cpp' | 'lm-studio' | 'foundry-local' | 'other';\n /** Concrete model id / slug (e.g. qwen2.5-coder:3b). */\n weightsRef: string;\n quant?: string;\n /** SPDX / short license note for first-download surface. */\n license?: string;\n /** Approx weights size in bytes (for fit when not discoverable). */\n weightsBytes?: number;\n /**\n * Optional HTTPS GGUF URL for the first-party weight store (must pass host\n * allowlist). When set, `vg models install` can download without Ollama.\n */\n downloadUrl?: string;\n /** Optional content hash for downloaded GGUF. */\n sha256?: string;\n}\n\nexport interface PackContract {\n toolCalling: ToolCallingMode;\n editFormat: EditFormatPreference;\n capsuleBudgetTokens: number;\n maxRepairRounds: number;\n maxParallelEdits: number;\n /** Minimum qualification score (0–1) this pack was gated on. */\n minEffectiveScore?: number;\n constrainedDecoding?: boolean;\n kvCacheStrategy?: ModelExecutionProfile['kvCacheStrategy'];\n securityTier?: ModelExecutionProfile['securityTier'];\n /**\n * Preferred inference path when available (ADR-005). Weights may still be\n * pulled via Ollama; embedded llama.cpp is preferred for sampler/grammar.\n */\n preferredInference?: 'ollama' | 'llama.cpp';\n /** Process isolation for preferredInference llama.cpp (default embedded). */\n inferenceIsolation?: ModelExecutionProfile['inferenceIsolation'];\n}\n\nexport interface QualifiedPack {\n /** e.g. flow@2026.07.1 */\n packId: string;\n mode: ModelMode;\n displayName: string;\n /** User-facing promise (one line). */\n promise: string;\n primary: PackWeightsRef;\n fallback?: PackWeightsRef[];\n contract: PackContract;\n resources: {\n minRamGb: number;\n minVramGb?: number;\n /** Estimated KV cache bytes per 1k context tokens. */\n estimatedKvPer1kContext?: number;\n };\n provenance?: {\n evalRunIds?: string[];\n notes?: string;\n };\n}\n\nexport interface RepoSignals {\n /** Approximate source file count (0 = unknown). */\n fileCount?: number;\n /** Graph node count when a map is warm (0 = unknown). */\n graphNodeCount?: number;\n /** Dominant languages (optional). */\n languages?: string[];\n}\n\nexport interface FitInput {\n system: SystemMemory;\n pack: QualifiedPack;\n repo?: RepoSignals;\n taskClass?: TaskClass;\n /**\n * Static reserves (bytes) for IDE / OS / graph / tests.\n * Defaults applied when omitted.\n */\n reserves?: {\n ideBytes?: number;\n osBytes?: number;\n graphBytes?: number;\n testsBytes?: number;\n safetyMarginBytes?: number;\n };\n /** Context budget used to estimate KV (tokens). Defaults from pack contract. */\n contextBudgetTokens?: number;\n}\n\nexport interface FitResult {\n label: FitLabel;\n /** 0–100; higher is more headroom. */\n score: number;\n needBytes: number;\n availableBytes: number;\n /** Breakdown for “memory pie” UX. */\n breakdown: {\n modelBytes: number;\n kvBytes: number;\n ideBytes: number;\n osBytes: number;\n graphBytes: number;\n testsBytes: number;\n freeAfterReservesBytes: number;\n };\n /** When tight: suggested reduced capsule budget. */\n reducedCapsuleBudgetTokens?: number;\n reasons: string[];\n}\n\nexport interface ResolvedMode {\n schemaVersion: typeof MODEL_ORCHESTRATOR_SCHEMA_VERSION;\n mode: ModelMode;\n pack: QualifiedPack;\n /** Concrete weights chosen (primary or fallback after fit). */\n underlying: PackWeightsRef;\n fit: FitResult;\n profile: ModelExecutionProfile;\n /** True when pack id was pinned by the user. */\n pinned: boolean;\n /** How the mode was chosen. */\n selection: 'explicit' | 'default' | 'auto_fit' | 'pinned';\n}\n\nexport interface OrchestratorStatus {\n schemaVersion: typeof MODEL_ORCHESTRATOR_SCHEMA_VERSION;\n defaultMode: ModelMode;\n pin?: { mode: ModelMode; packId: string } | null;\n modes: Array<{\n mode: ModelMode;\n packId: string;\n displayName: string;\n promise: string;\n underlyingModelId: string;\n backend: string;\n fit: FitLabel;\n fitScore: number;\n needBytes: number;\n availableBytes: number;\n installed: boolean;\n pinned: boolean;\n }>;\n recommended: ModelMode;\n system: {\n totalRamBytes: number;\n freeRamBytes: number;\n vramTotalBytes?: number;\n vramFreeBytes?: number;\n loaded: Array<{ name: string; bytes: number }>;\n };\n memoryBreakdown?: FitResult['breakdown'];\n}\n\n// ── Curated packs (versioned; weights may change under the same mode contract) ─\n\n/** Pack channel — bump when contracts or weight refs change under stable mode names. */\nconst PACK_CHANNEL = '2026.07.4';\n\n/**\n * Current qualified packs — one primary per mode.\n *\n * Approach B default: Spark/Flow **primary** is first-party GGUF (llama.cpp)\n * for install + inference when fit allows. Ollama remains an explicit fallback\n * adapter, not the default path.\n */\nexport const QUALIFIED_PACKS: QualifiedPack[] = [\n {\n packId: `spark@${PACK_CHANNEL}`,\n mode: 'spark',\n displayName: 'Spark',\n promise: 'Fastest capable local coding — simple edits, minimal memory.',\n primary: {\n backend: 'llama.cpp',\n weightsRef: 'qwen2.5-coder-3b-q4_k_m.gguf',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:3b').bytes,\n },\n fallback: [\n {\n backend: 'ollama',\n weightsRef: 'qwen2.5-coder:3b',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:3b').bytes,\n },\n {\n backend: 'ollama',\n weightsRef: 'qwen2.5-coder:1.5b',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:1.5b').bytes,\n },\n ],\n contract: {\n toolCalling: 'grammar',\n editFormat: 'patch_ir_json',\n capsuleBudgetTokens: 2000,\n maxRepairRounds: 2,\n maxParallelEdits: 2,\n minEffectiveScore: 0.55,\n constrainedDecoding: true,\n preferredInference: 'llama.cpp',\n inferenceIsolation: 'embedded',\n kvCacheStrategy: 'stable_prefix',\n securityTier: 'L1',\n },\n resources: { minRamGb: 4, estimatedKvPer1kContext: 2 * 1024 * 1024 },\n provenance: {\n notes: 'Spark@2026.07.4 — Approach B: first-party GGUF + embedded vibgrate manager; Ollama pack fallback only',\n },\n },\n {\n packId: `flow@${PACK_CHANNEL}`,\n mode: 'flow',\n displayName: 'Flow',\n promise: 'Best everyday graph-guided coding for this machine.',\n primary: {\n backend: 'llama.cpp',\n weightsRef: 'qwen2.5-coder-7b-q4_k_m.gguf',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:7b').bytes,\n },\n fallback: [\n {\n backend: 'ollama',\n weightsRef: 'qwen2.5-coder:7b',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:7b').bytes,\n },\n {\n backend: 'ollama',\n weightsRef: 'qwen2.5-coder:3b',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:3b').bytes,\n },\n ],\n contract: {\n toolCalling: 'native',\n editFormat: 'auto',\n capsuleBudgetTokens: 3500,\n maxRepairRounds: 2,\n maxParallelEdits: 4,\n minEffectiveScore: 0.65,\n constrainedDecoding: false,\n preferredInference: 'llama.cpp',\n inferenceIsolation: 'embedded',\n kvCacheStrategy: 'stable_prefix',\n securityTier: 'L1',\n },\n resources: { minRamGb: 8, minVramGb: 6, estimatedKvPer1kContext: 4 * 1024 * 1024 },\n provenance: {\n notes: 'Flow@2026.07.4 — first-party GGUF primary; Ollama pack fallback only',\n },\n },\n {\n packId: `forge@${PACK_CHANNEL}`,\n mode: 'forge',\n displayName: 'Forge',\n promise: 'Strongest deep work that safely fits (migrations, multi-file).',\n primary: {\n backend: 'llama.cpp',\n weightsRef: 'qwen2.5-coder-14b-q4_k_m.gguf',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:14b').bytes,\n },\n fallback: [\n {\n backend: 'ollama',\n weightsRef: 'qwen2.5-coder:14b',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:14b').bytes,\n },\n {\n backend: 'ollama',\n weightsRef: 'qwen2.5-coder:7b',\n quant: 'q4_k_m',\n license: 'Apache-2.0',\n weightsBytes: estimateModelBytes('qwen2.5-coder:7b').bytes,\n },\n ],\n contract: {\n toolCalling: 'native',\n editFormat: 'patch_ir_json',\n capsuleBudgetTokens: 6000,\n maxRepairRounds: 3,\n maxParallelEdits: 6,\n minEffectiveScore: 0.7,\n constrainedDecoding: false,\n preferredInference: 'llama.cpp',\n inferenceIsolation: 'embedded',\n kvCacheStrategy: 'stable_prefix',\n securityTier: 'L1',\n },\n resources: { minRamGb: 16, minVramGb: 12, estimatedKvPer1kContext: 8 * 1024 * 1024 },\n provenance: {\n notes:\n 'Forge@2026.07.4 — first-party 14B GGUF + embedded vibgrate manager (same path as Spark/Flow); Ollama pack fallback only',\n },\n },\n];\n\nconst GiB = 1024 ** 3;\n\n/**\n * Static reserves applied on top of *available* RAM.\n *\n * Important: `freeRamBytes` is already residual after currently-running\n * processes (IDE, OS, browsers, …). Subtracting a full IDE/OS footprint again\n * double-counts and falsely zeros fit on healthy machines. Keep growth\n * headroom for graph/tests (often not yet resident) + safety, and a modest\n * fraction of IDE/OS for workspace growth under load.\n */\nconst DEFAULT_RESERVES = {\n ideBytes: 1.5 * GiB,\n osBytes: 2 * GiB,\n graphBytes: 0.5 * GiB,\n testsBytes: 0.25 * GiB,\n safetyMarginBytes: 1 * GiB,\n};\n\n/** Fraction of IDE+OS reserves kept as growth headroom on the free-RAM path. */\nconst IDE_OS_GROWTH_FRACTION = 0.25;\n\n// ── Pack lookup ───────────────────────────────────────────────────────────────\n\nexport function packForMode(mode: ModelMode, packs: QualifiedPack[] = QUALIFIED_PACKS): QualifiedPack | null {\n return packs.find((p) => p.mode === mode) ?? null;\n}\n\nexport function packById(packId: string, packs: QualifiedPack[] = QUALIFIED_PACKS): QualifiedPack | null {\n return packs.find((p) => p.packId === packId) ?? null;\n}\n\nexport function listModes(): ModelMode[] {\n return ['spark', 'flow', 'forge'];\n}\n\n// ── Fit algorithm ─────────────────────────────────────────────────────────────\n\n/**\n * Fit decision: available memory *now* after IDE/OS/graph/tests reserves and\n * safety margin — not only “weights fit in total RAM”.\n *\n * Target: < 100 ms once system snapshot is warm (pure arithmetic).\n */\nexport function fitPack(input: FitInput): FitResult {\n const r = { ...DEFAULT_RESERVES, ...input.reserves };\n const pack = input.pack;\n const weightsBytes =\n pack.primary.weightsBytes ??\n estimateModelBytes(pack.primary.weightsRef).bytes;\n const ctxTokens = input.contextBudgetTokens ?? pack.contract.capsuleBudgetTokens * 2;\n const kvPer1k = pack.resources.estimatedKvPer1kContext ?? 2 * 1024 * 1024;\n const kvBytes = Math.round((ctxTokens / 1000) * kvPer1k);\n const modelBytes = weightsBytes;\n const needBytes = modelBytes + kvBytes;\n\n const useVram =\n typeof input.system.vramTotalBytes === 'number' && input.system.vramTotalBytes > 0;\n const freeNow = useVram\n ? (input.system.vramFreeBytes ?? 0)\n : input.system.freeRamBytes;\n const loadedBytes = input.system.loaded.reduce((n, m) => n + m.bytes, 0);\n // Prefer free-after-unload for fit of *next* load when something is resident.\n const freePool = freeNow + loadedBytes;\n\n const graphBump =\n (input.repo?.graphNodeCount ?? 0) > 50_000\n ? 0.5 * GiB\n : (input.repo?.fileCount ?? 0) > 5_000\n ? 0.25 * GiB\n : 0;\n const graphBytes = r.graphBytes + graphBump;\n\n // On discrete VRAM, only model+KV compete for VRAM — host reserves stay on RAM.\n // On unified / CPU path: free/available RAM already excludes current IDE/OS\n // usage, so only charge growth (graph/tests/safety + modest IDE/OS headroom).\n const reserved = useVram\n ? r.safetyMarginBytes\n : graphBytes +\n r.testsBytes +\n r.safetyMarginBytes +\n IDE_OS_GROWTH_FRACTION * (r.ideBytes + r.osBytes);\n const freeAfterReserves = Math.max(0, freePool - reserved);\n\n const availableBytes = freeAfterReserves;\n const reasons: string[] = [];\n const headroom = availableBytes - needBytes;\n const ratio = needBytes > 0 ? availableBytes / needBytes : 0;\n\n let label: FitLabel;\n let reducedCapsuleBudgetTokens: number | undefined;\n\n if (availableBytes < needBytes * 0.85) {\n label = 'will_not_fit';\n reasons.push(\n `needs ~${fmtGb(needBytes)} but only ~${fmtGb(availableBytes)} is free after reserves`,\n );\n } else if (ratio < 1.1 || headroom < 0.5 * GiB) {\n label = 'tight';\n reducedCapsuleBudgetTokens = Math.max(\n 1200,\n Math.floor(pack.contract.capsuleBudgetTokens * 0.65),\n );\n reasons.push('tight fit — capsule budget will be reduced automatically');\n } else if (ratio >= 1.6 && headroom >= 2 * GiB) {\n label = 'flies';\n reasons.push('comfortable headroom for this mode');\n } else {\n label = 'comfortable';\n reasons.push('within policy for this machine');\n }\n\n // Large monorepo + forge → soft-downgrade score (does not force will_not_fit).\n if (\n pack.mode === 'forge' &&\n ((input.repo?.fileCount ?? 0) > 10_000 || (input.repo?.graphNodeCount ?? 0) > 100_000) &&\n label === 'comfortable'\n ) {\n reasons.push('large repository — prefer moderated capsule + graph paging');\n }\n\n // Score: map ratio into 0–100 with floors for labels.\n let score = Math.max(0, Math.min(100, Math.round(ratio * 50)));\n if (label === 'will_not_fit') score = Math.min(score, 20);\n if (label === 'tight') score = Math.min(Math.max(score, 25), 45);\n if (label === 'comfortable') score = Math.min(Math.max(score, 50), 75);\n if (label === 'flies') score = Math.max(score, 80);\n\n return {\n label,\n score,\n needBytes,\n availableBytes,\n breakdown: {\n modelBytes,\n kvBytes,\n // Report the charged growth headroom (not the full static IDE/OS footprint).\n ideBytes: useVram ? 0 : IDE_OS_GROWTH_FRACTION * r.ideBytes,\n osBytes: useVram ? 0 : IDE_OS_GROWTH_FRACTION * r.osBytes,\n graphBytes: useVram ? 0 : graphBytes,\n testsBytes: useVram ? 0 : r.testsBytes,\n freeAfterReservesBytes: freeAfterReserves,\n },\n reducedCapsuleBudgetTokens,\n reasons,\n };\n}\n\nfunction fmtGb(bytes: number): string {\n return `${(bytes / GiB).toFixed(1)} GiB`;\n}\n\n// ── Resolve mode → pack → underlying ──────────────────────────────────────────\n\nexport interface ResolveModeOptions {\n mode?: ModelMode;\n /** Prefer auto-fit when no mode set (default true for first-run wizard). */\n autoFit?: boolean;\n system: SystemMemory;\n repo?: RepoSignals;\n taskClass?: TaskClass;\n /** Installed model names (ollama/lmstudio) for installed: true. */\n installedNames?: string[];\n /** Pin map mode → packId. */\n pin?: { mode: ModelMode; packId: string } | null;\n packs?: QualifiedPack[];\n defaultMode?: ModelMode;\n}\n\nfunction packToProfile(pack: QualifiedPack, underlying: PackWeightsRef, fit: FitResult): ModelExecutionProfile {\n const budget =\n fit.label === 'tight' && fit.reducedCapsuleBudgetTokens\n ? fit.reducedCapsuleBudgetTokens\n : pack.contract.capsuleBudgetTokens;\n return {\n schemaVersion: MODEL_EXECUTION_PROFILE_SCHEMA_VERSION,\n id: underlying.weightsRef,\n displayName: `${pack.displayName} · ${underlying.weightsRef}`,\n mode: pack.mode,\n backend:\n underlying.backend === 'ollama'\n ? 'ollama'\n : underlying.backend === 'llama.cpp'\n ? 'llama.cpp'\n : underlying.backend === 'lm-studio'\n ? 'openai-compatible'\n : 'other',\n toolCalling: pack.contract.toolCalling,\n editFormat: pack.contract.editFormat,\n capsuleBudgetTokens: budget,\n maxParallelEdits: pack.contract.maxParallelEdits,\n maxRepairRounds: pack.contract.maxRepairRounds,\n temperature: 0,\n constrainedDecoding: pack.contract.constrainedDecoding ?? false,\n kvCacheStrategy: pack.contract.kvCacheStrategy,\n resources: {\n minRamGb: pack.resources.minRamGb,\n minVramGb: pack.resources.minVramGb,\n quant: underlying.quant,\n },\n securityTier: pack.contract.securityTier,\n inferenceIsolation: pack.contract.inferenceIsolation ?? 'embedded',\n };\n}\n\nfunction tryWeights(\n pack: QualifiedPack,\n weights: PackWeightsRef,\n system: SystemMemory,\n repo?: RepoSignals,\n taskClass?: TaskClass,\n): { fit: FitResult; underlying: PackWeightsRef } {\n const trial: QualifiedPack = { ...pack, primary: weights };\n return { fit: fitPack({ system, pack: trial, repo, taskClass }), underlying: weights };\n}\n\n/**\n * Resolve a Code Mode to a pack, concrete weights, fit label, and MEP.\n * Refuses primary load when fit is will_not_fit and tries fallbacks; if all\n * fail, returns the best effort with label will_not_fit (caller must not load).\n */\nexport function resolveMode(opts: ResolveModeOptions): ResolvedMode {\n const packs = opts.packs ?? QUALIFIED_PACKS;\n const defaultMode = opts.defaultMode ?? 'flow';\n let mode: ModelMode = opts.mode ?? defaultMode;\n let selection: ResolvedMode['selection'] = opts.mode ? 'explicit' : 'default';\n\n if (!opts.mode && opts.autoFit !== false) {\n mode = recommendMode(opts.system, opts.repo, packs);\n selection = 'auto_fit';\n }\n\n let pack = packForMode(mode, packs);\n if (!pack) {\n pack = packForMode('flow', packs)!;\n mode = 'flow';\n selection = 'default';\n }\n\n if (opts.pin && opts.pin.mode === mode) {\n const pinned = packById(opts.pin.packId, packs);\n if (pinned && pinned.mode === mode) {\n pack = pinned;\n selection = 'pinned';\n }\n }\n\n const candidates = [pack.primary, ...(pack.fallback ?? [])];\n let best: { fit: FitResult; underlying: PackWeightsRef } | null = null;\n\n for (const w of candidates) {\n const trial = tryWeights(pack, w, opts.system, opts.repo, opts.taskClass);\n if (!best || fitRank(trial.fit) > fitRank(best.fit)) best = trial;\n if (trial.fit.label === 'flies' || trial.fit.label === 'comfortable') {\n best = trial;\n break;\n }\n }\n\n const chosen = best ?? tryWeights(pack, pack.primary, opts.system, opts.repo, opts.taskClass);\n const profile = packToProfile(pack, chosen.underlying, chosen.fit);\n\n return {\n schemaVersion: MODEL_ORCHESTRATOR_SCHEMA_VERSION,\n mode,\n pack,\n underlying: chosen.underlying,\n fit: chosen.fit,\n profile,\n pinned: selection === 'pinned',\n selection,\n };\n}\n\nfunction fitRank(f: FitResult): number {\n const order: Record<FitLabel, number> = {\n flies: 4,\n comfortable: 3,\n tight: 2,\n will_not_fit: 1,\n };\n return order[f.label] * 1000 + f.score;\n}\n\n/**\n * Pick the strongest mode that still fits at least “comfortable” (or tight\n * for spark). Prefer Flow when both Flow and Forge are comfortable.\n */\nexport function recommendMode(\n system: SystemMemory,\n repo?: RepoSignals,\n packs: QualifiedPack[] = QUALIFIED_PACKS,\n): ModelMode {\n const order: ModelMode[] = ['forge', 'flow', 'spark'];\n let bestTight: ModelMode | null = null;\n for (const mode of order) {\n const pack = packForMode(mode, packs);\n if (!pack) continue;\n const resolved = resolveMode({\n mode,\n autoFit: false,\n system,\n repo,\n packs,\n });\n if (resolved.fit.label === 'flies' || resolved.fit.label === 'comfortable') {\n // Prefer Flow as daily default when Forge also fits, unless repo is tiny.\n if (mode === 'forge') {\n const flow = resolveMode({ mode: 'flow', autoFit: false, system, repo, packs });\n if (flow.fit.label === 'flies' || flow.fit.label === 'comfortable') {\n const files = repo?.fileCount ?? 0;\n if (files < 2000) return 'flow';\n }\n return 'forge';\n }\n return mode;\n }\n if (resolved.fit.label === 'tight' && !bestTight) bestTight = mode;\n }\n return bestTight ?? 'spark';\n}\n\n/** Build orchestrator status for `vg models status` / host UIs. */\nexport function buildOrchestratorStatus(opts: {\n system: SystemMemory;\n repo?: RepoSignals;\n installedNames?: string[];\n /** Single pin (legacy) or full pin map. */\n pin?: { mode: ModelMode; packId: string } | null;\n pins?: Partial<Record<ModelMode, string>>;\n defaultMode?: ModelMode;\n packs?: QualifiedPack[];\n}): OrchestratorStatus {\n const packs = opts.packs ?? QUALIFIED_PACKS;\n const installed = new Set((opts.installedNames ?? []).map((n) => n.toLowerCase()));\n const recommended = recommendMode(opts.system, opts.repo, packs);\n const pinFor = (mode: ModelMode): { mode: ModelMode; packId: string } | null => {\n const fromMap = opts.pins?.[mode];\n if (fromMap) return { mode, packId: fromMap };\n if (opts.pin?.mode === mode) return opts.pin;\n return null;\n };\n const modes = listModes().map((mode) => {\n const resolved = resolveMode({\n mode,\n autoFit: false,\n system: opts.system,\n repo: opts.repo,\n pin: pinFor(mode),\n packs,\n });\n const id = resolved.underlying.weightsRef.toLowerCase();\n const installedHit =\n installed.has(id) ||\n [...installed].some((n) => n.includes(id) || id.includes(n));\n return {\n mode,\n packId: resolved.pack.packId,\n displayName: resolved.pack.displayName,\n promise: resolved.pack.promise,\n underlyingModelId: resolved.underlying.weightsRef,\n backend: resolved.underlying.backend,\n fit: resolved.fit.label,\n fitScore: resolved.fit.score,\n needBytes: resolved.fit.needBytes,\n availableBytes: resolved.fit.availableBytes,\n installed: installedHit,\n pinned: resolved.pinned,\n };\n });\n\n const recResolved = resolveMode({\n mode: recommended,\n autoFit: false,\n system: opts.system,\n repo: opts.repo,\n pin: pinFor(recommended),\n packs,\n });\n\n return {\n schemaVersion: MODEL_ORCHESTRATOR_SCHEMA_VERSION,\n defaultMode: opts.defaultMode ?? 'flow',\n pin: pinFor(recommended),\n modes,\n recommended,\n system: {\n totalRamBytes: opts.system.totalRamBytes,\n freeRamBytes: opts.system.freeRamBytes,\n ...(typeof opts.system.vramTotalBytes === 'number'\n ? { vramTotalBytes: opts.system.vramTotalBytes }\n : {}),\n ...(typeof opts.system.vramFreeBytes === 'number'\n ? { vramFreeBytes: opts.system.vramFreeBytes }\n : {}),\n loaded: opts.system.loaded.map((l) => ({ name: l.name, bytes: l.bytes })),\n },\n memoryBreakdown: recResolved.fit.breakdown,\n };\n}\n\n// ── Pin registry (global storage, not in-repo) ────────────────────────────────\n\nexport interface OrchestratorPinState {\n schemaVersion: 'model-orchestrator-pin/0';\n /** mode → packId */\n pins: Partial<Record<ModelMode, string>>;\n /** Workspace / global default mode preference. */\n defaultMode?: ModelMode;\n updatedAt: string;\n}\n\nexport function orchestratorStatePath(\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n home?: string,\n): string {\n return path.join(vibgrateDataDir(env, platform, home), 'model-orchestrator', 'state.json');\n}\n\nexport function readOrchestratorState(\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n home?: string,\n): OrchestratorPinState {\n const p = orchestratorStatePath(env, platform, home);\n try {\n const raw = JSON.parse(fs.readFileSync(p, 'utf8')) as Partial<OrchestratorPinState>;\n return {\n schemaVersion: 'model-orchestrator-pin/0',\n pins: raw.pins && typeof raw.pins === 'object' ? raw.pins : {},\n defaultMode:\n raw.defaultMode === 'spark' || raw.defaultMode === 'flow' || raw.defaultMode === 'forge'\n ? raw.defaultMode\n : undefined,\n updatedAt: typeof raw.updatedAt === 'string' ? raw.updatedAt : new Date(0).toISOString(),\n };\n } catch {\n return {\n schemaVersion: 'model-orchestrator-pin/0',\n pins: {},\n updatedAt: new Date(0).toISOString(),\n };\n }\n}\n\nexport function writeOrchestratorState(\n state: OrchestratorPinState,\n env: NodeJS.ProcessEnv = process.env,\n platform: NodeJS.Platform = process.platform,\n home?: string,\n): string {\n const p = orchestratorStatePath(env, platform, home);\n fs.mkdirSync(path.dirname(p), { recursive: true });\n const next: OrchestratorPinState = {\n ...state,\n schemaVersion: 'model-orchestrator-pin/0',\n updatedAt: new Date().toISOString(),\n };\n fs.writeFileSync(p, JSON.stringify(next, null, 2) + '\\n', 'utf8');\n return p;\n}\n\nexport function pinPack(\n mode: ModelMode,\n packId: string,\n env?: NodeJS.ProcessEnv,\n platform?: NodeJS.Platform,\n home?: string,\n): OrchestratorPinState {\n const state = readOrchestratorState(env, platform, home);\n if (!packById(packId)) {\n throw new Error(`unknown pack id: ${packId}`);\n }\n state.pins[mode] = packId;\n writeOrchestratorState(state, env, platform, home);\n return state;\n}\n\nexport function unpinPack(\n mode: ModelMode,\n env?: NodeJS.ProcessEnv,\n platform?: NodeJS.Platform,\n home?: string,\n): OrchestratorPinState {\n const state = readOrchestratorState(env, platform, home);\n delete state.pins[mode];\n writeOrchestratorState(state, env, platform, home);\n return state;\n}\n\nexport function setDefaultMode(\n mode: ModelMode,\n env?: NodeJS.ProcessEnv,\n platform?: NodeJS.Platform,\n home?: string,\n): OrchestratorPinState {\n const state = readOrchestratorState(env, platform, home);\n state.defaultMode = mode;\n writeOrchestratorState(state, env, platform, home);\n return state;\n}\n\n/** Active pin for a mode, if any. */\nexport function activePin(\n mode: ModelMode,\n state: OrchestratorPinState = readOrchestratorState(),\n): { mode: ModelMode; packId: string } | null {\n const packId = state.pins[mode];\n return packId ? { mode, packId } : null;\n}\n\n/** Map backend hint to vg code --provider id. */\nexport function providerForBackend(backend: PackWeightsRef['backend']): string {\n switch (backend) {\n case 'ollama':\n return 'ollama';\n case 'llama.cpp':\n return 'llama-cpp';\n case 'lm-studio':\n return 'lmstudio';\n default:\n return 'ollama';\n }\n}\n\n/** Parse mode from user string; null if invalid. */\nexport function parseMode(raw: string | undefined | null): ModelMode | null {\n if (!raw) return null;\n const m = raw.trim().toLowerCase();\n if (m === 'spark' || m === 'flow' || m === 'forge') return m;\n return null;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { buildMessages, parseEdits, applyEdits, unifiedDiff, redactSecrets } from './chunk-OFUC6RYN.js';
2
- import { recordCliCall, CLI_TOOL_ALIASES, buildCodeContext, buildTaskCapsule, capsuleToCodeContext } from './chunk-KSBHGWRV.js';
1
+ import { buildMessages, parseEdits, applyEdits, unifiedDiff, redactSecrets } from './chunk-KXSKFQMI.js';
2
+ import { recordCliCall, CLI_TOOL_ALIASES, buildCodeContext, buildTaskCapsule, capsuleToCodeContext } from './chunk-ZBTY6VV4.js';
3
3
  import { repositoryIdFromRoot } from './chunk-BWPBB45M.js';
4
4
  import * as fs from 'fs';
5
5
  import * as path from 'path';
@@ -251,5 +251,5 @@ function shortId() {
251
251
  }
252
252
 
253
253
  export { commitChanges, nodeCodeFs, runCodeSession, undoChanges };
254
- //# sourceMappingURL=chunk-CY4WKXB2.js.map
255
- //# sourceMappingURL=chunk-CY4WKXB2.js.map
254
+ //# sourceMappingURL=chunk-R6ZRVVZT.js.map
255
+ //# sourceMappingURL=chunk-R6ZRVVZT.js.map