@vizalice/codegraph 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +872 -0
- package/dist/bin/codegraph.d.ts +26 -0
- package/dist/bin/codegraph.d.ts.map +1 -0
- package/dist/bin/codegraph.js +2324 -0
- package/dist/bin/codegraph.js.map +1 -0
- package/dist/bin/command-supervision.d.ts +49 -0
- package/dist/bin/command-supervision.d.ts.map +1 -0
- package/dist/bin/command-supervision.js +95 -0
- package/dist/bin/command-supervision.js.map +1 -0
- package/dist/bin/fatal-handler.d.ts +20 -0
- package/dist/bin/fatal-handler.d.ts.map +1 -0
- package/dist/bin/fatal-handler.js +118 -0
- package/dist/bin/fatal-handler.js.map +1 -0
- package/dist/bin/node-version-check.d.ts +37 -0
- package/dist/bin/node-version-check.d.ts.map +1 -0
- package/dist/bin/node-version-check.js +79 -0
- package/dist/bin/node-version-check.js.map +1 -0
- package/dist/bin/uninstall.d.ts +14 -0
- package/dist/bin/uninstall.d.ts.map +1 -0
- package/dist/bin/uninstall.js +36 -0
- package/dist/bin/uninstall.js.map +1 -0
- package/dist/context/formatter.d.ts +36 -0
- package/dist/context/formatter.d.ts.map +1 -0
- package/dist/context/formatter.js +269 -0
- package/dist/context/formatter.js.map +1 -0
- package/dist/context/index.d.ts +119 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +1333 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/markers.d.ts +19 -0
- package/dist/context/markers.d.ts.map +1 -0
- package/dist/context/markers.js +22 -0
- package/dist/context/markers.js.map +1 -0
- package/dist/db/index.d.ts +378 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +831 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +44 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +236 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +705 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +2435 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/db/schema.sql +207 -0
- package/dist/db/sqlite-adapter.d.ts +55 -0
- package/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/dist/db/sqlite-adapter.js +135 -0
- package/dist/db/sqlite-adapter.js.map +1 -0
- package/dist/db/wal-valve.d.ts +119 -0
- package/dist/db/wal-valve.d.ts.map +1 -0
- package/dist/db/wal-valve.js +290 -0
- package/dist/db/wal-valve.js.map +1 -0
- package/dist/directory.d.ts +183 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +797 -0
- package/dist/directory.js.map +1 -0
- package/dist/errors.d.ts +136 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +219 -0
- package/dist/errors.js.map +1 -0
- package/dist/extraction/astro-extractor.d.ts +79 -0
- package/dist/extraction/astro-extractor.d.ts.map +1 -0
- package/dist/extraction/astro-extractor.js +320 -0
- package/dist/extraction/astro-extractor.js.map +1 -0
- package/dist/extraction/cfml-extractor.d.ts +107 -0
- package/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/dist/extraction/cfml-extractor.js +494 -0
- package/dist/extraction/cfml-extractor.js.map +1 -0
- package/dist/extraction/dfm-extractor.d.ts +31 -0
- package/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/dist/extraction/dfm-extractor.js +151 -0
- package/dist/extraction/dfm-extractor.js.map +1 -0
- package/dist/extraction/extraction-version.d.ts +25 -0
- package/dist/extraction/extraction-version.d.ts.map +1 -0
- package/dist/extraction/extraction-version.js +28 -0
- package/dist/extraction/extraction-version.js.map +1 -0
- package/dist/extraction/function-ref.d.ts +118 -0
- package/dist/extraction/function-ref.d.ts.map +1 -0
- package/dist/extraction/function-ref.js +733 -0
- package/dist/extraction/function-ref.js.map +1 -0
- package/dist/extraction/generated-detection.d.ts +66 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -0
- package/dist/extraction/generated-detection.js +248 -0
- package/dist/extraction/generated-detection.js.map +1 -0
- package/dist/extraction/grammars.d.ts +138 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +694 -0
- package/dist/extraction/grammars.js.map +1 -0
- package/dist/extraction/index.d.ts +308 -0
- package/dist/extraction/index.d.ts.map +1 -0
- package/dist/extraction/index.js +2711 -0
- package/dist/extraction/index.js.map +1 -0
- package/dist/extraction/kernel/decode.d.ts +9 -0
- package/dist/extraction/kernel/decode.d.ts.map +1 -0
- package/dist/extraction/kernel/decode.js +162 -0
- package/dist/extraction/kernel/decode.js.map +1 -0
- package/dist/extraction/kernel/index.d.ts +64 -0
- package/dist/extraction/kernel/index.d.ts.map +1 -0
- package/dist/extraction/kernel/index.js +279 -0
- package/dist/extraction/kernel/index.js.map +1 -0
- package/dist/extraction/kernel/layout.d.ts +101 -0
- package/dist/extraction/kernel/layout.d.ts.map +1 -0
- package/dist/extraction/kernel/layout.js +104 -0
- package/dist/extraction/kernel/layout.js.map +1 -0
- package/dist/extraction/kernel/loader.d.ts +103 -0
- package/dist/extraction/kernel/loader.d.ts.map +1 -0
- package/dist/extraction/kernel/loader.js +146 -0
- package/dist/extraction/kernel/loader.js.map +1 -0
- package/dist/extraction/languages/arkts.d.ts +3 -0
- package/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/dist/extraction/languages/arkts.js +127 -0
- package/dist/extraction/languages/arkts.js.map +1 -0
- package/dist/extraction/languages/c-cpp.d.ts +124 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/dist/extraction/languages/c-cpp.js +1689 -0
- package/dist/extraction/languages/c-cpp.js.map +1 -0
- package/dist/extraction/languages/cfquery.d.ts +12 -0
- package/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/dist/extraction/languages/cfquery.js +28 -0
- package/dist/extraction/languages/cfquery.js.map +1 -0
- package/dist/extraction/languages/cfscript.d.ts +3 -0
- package/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/dist/extraction/languages/cfscript.js +73 -0
- package/dist/extraction/languages/cfscript.js.map +1 -0
- package/dist/extraction/languages/cobol.d.ts +33 -0
- package/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/dist/extraction/languages/cobol.js +499 -0
- package/dist/extraction/languages/cobol.js.map +1 -0
- package/dist/extraction/languages/csharp.d.ts +25 -0
- package/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/dist/extraction/languages/csharp.js +175 -0
- package/dist/extraction/languages/csharp.js.map +1 -0
- package/dist/extraction/languages/dart.d.ts +3 -0
- package/dist/extraction/languages/dart.d.ts.map +1 -0
- package/dist/extraction/languages/dart.js +374 -0
- package/dist/extraction/languages/dart.js.map +1 -0
- package/dist/extraction/languages/erlang.d.ts +3 -0
- package/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/dist/extraction/languages/erlang.js +350 -0
- package/dist/extraction/languages/erlang.js.map +1 -0
- package/dist/extraction/languages/go.d.ts +3 -0
- package/dist/extraction/languages/go.d.ts.map +1 -0
- package/dist/extraction/languages/go.js +111 -0
- package/dist/extraction/languages/go.js.map +1 -0
- package/dist/extraction/languages/index.d.ts +10 -0
- package/dist/extraction/languages/index.d.ts.map +1 -0
- package/dist/extraction/languages/index.js +71 -0
- package/dist/extraction/languages/index.js.map +1 -0
- package/dist/extraction/languages/java.d.ts +3 -0
- package/dist/extraction/languages/java.d.ts.map +1 -0
- package/dist/extraction/languages/java.js +315 -0
- package/dist/extraction/languages/java.js.map +1 -0
- package/dist/extraction/languages/javascript.d.ts +3 -0
- package/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/dist/extraction/languages/javascript.js +106 -0
- package/dist/extraction/languages/javascript.js.map +1 -0
- package/dist/extraction/languages/kotlin.d.ts +3 -0
- package/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/dist/extraction/languages/kotlin.js +379 -0
- package/dist/extraction/languages/kotlin.js.map +1 -0
- package/dist/extraction/languages/lua.d.ts +3 -0
- package/dist/extraction/languages/lua.d.ts.map +1 -0
- package/dist/extraction/languages/lua.js +150 -0
- package/dist/extraction/languages/lua.js.map +1 -0
- package/dist/extraction/languages/luau.d.ts +3 -0
- package/dist/extraction/languages/luau.d.ts.map +1 -0
- package/dist/extraction/languages/luau.js +37 -0
- package/dist/extraction/languages/luau.js.map +1 -0
- package/dist/extraction/languages/nix.d.ts +3 -0
- package/dist/extraction/languages/nix.d.ts.map +1 -0
- package/dist/extraction/languages/nix.js +294 -0
- package/dist/extraction/languages/nix.js.map +1 -0
- package/dist/extraction/languages/objc.d.ts +3 -0
- package/dist/extraction/languages/objc.d.ts.map +1 -0
- package/dist/extraction/languages/objc.js +179 -0
- package/dist/extraction/languages/objc.js.map +1 -0
- package/dist/extraction/languages/pascal.d.ts +3 -0
- package/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/dist/extraction/languages/pascal.js +77 -0
- package/dist/extraction/languages/pascal.js.map +1 -0
- package/dist/extraction/languages/php.d.ts +3 -0
- package/dist/extraction/languages/php.d.ts.map +1 -0
- package/dist/extraction/languages/php.js +196 -0
- package/dist/extraction/languages/php.js.map +1 -0
- package/dist/extraction/languages/python.d.ts +3 -0
- package/dist/extraction/languages/python.d.ts.map +1 -0
- package/dist/extraction/languages/python.js +56 -0
- package/dist/extraction/languages/python.js.map +1 -0
- package/dist/extraction/languages/r.d.ts +3 -0
- package/dist/extraction/languages/r.d.ts.map +1 -0
- package/dist/extraction/languages/r.js +314 -0
- package/dist/extraction/languages/r.js.map +1 -0
- package/dist/extraction/languages/ruby.d.ts +3 -0
- package/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/dist/extraction/languages/ruby.js +149 -0
- package/dist/extraction/languages/ruby.js.map +1 -0
- package/dist/extraction/languages/rust.d.ts +3 -0
- package/dist/extraction/languages/rust.d.ts.map +1 -0
- package/dist/extraction/languages/rust.js +145 -0
- package/dist/extraction/languages/rust.js.map +1 -0
- package/dist/extraction/languages/scala.d.ts +3 -0
- package/dist/extraction/languages/scala.d.ts.map +1 -0
- package/dist/extraction/languages/scala.js +209 -0
- package/dist/extraction/languages/scala.js.map +1 -0
- package/dist/extraction/languages/solidity.d.ts +3 -0
- package/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/dist/extraction/languages/solidity.js +293 -0
- package/dist/extraction/languages/solidity.js.map +1 -0
- package/dist/extraction/languages/swift.d.ts +3 -0
- package/dist/extraction/languages/swift.d.ts.map +1 -0
- package/dist/extraction/languages/swift.js +152 -0
- package/dist/extraction/languages/swift.js.map +1 -0
- package/dist/extraction/languages/terraform.d.ts +3 -0
- package/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/dist/extraction/languages/terraform.js +641 -0
- package/dist/extraction/languages/terraform.js.map +1 -0
- package/dist/extraction/languages/typescript.d.ts +16 -0
- package/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/dist/extraction/languages/typescript.js +167 -0
- package/dist/extraction/languages/typescript.js.map +1 -0
- package/dist/extraction/languages/vbnet.d.ts +11 -0
- package/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/dist/extraction/languages/vbnet.js +141 -0
- package/dist/extraction/languages/vbnet.js.map +1 -0
- package/dist/extraction/liquid-extractor.d.ts +59 -0
- package/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/dist/extraction/liquid-extractor.js +357 -0
- package/dist/extraction/liquid-extractor.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +68 -0
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/dist/extraction/mybatis-extractor.js +300 -0
- package/dist/extraction/mybatis-extractor.js.map +1 -0
- package/dist/extraction/parse-pool.d.ts +160 -0
- package/dist/extraction/parse-pool.d.ts.map +1 -0
- package/dist/extraction/parse-pool.js +402 -0
- package/dist/extraction/parse-pool.js.map +1 -0
- package/dist/extraction/parse-worker.d.ts +8 -0
- package/dist/extraction/parse-worker.d.ts.map +1 -0
- package/dist/extraction/parse-worker.js +138 -0
- package/dist/extraction/parse-worker.js.map +1 -0
- package/dist/extraction/razor-extractor.d.ts +42 -0
- package/dist/extraction/razor-extractor.d.ts.map +1 -0
- package/dist/extraction/razor-extractor.js +285 -0
- package/dist/extraction/razor-extractor.js.map +1 -0
- package/dist/extraction/store-worker.d.ts +24 -0
- package/dist/extraction/store-worker.d.ts.map +1 -0
- package/dist/extraction/store-worker.js +139 -0
- package/dist/extraction/store-worker.js.map +1 -0
- package/dist/extraction/store-writer.d.ts +63 -0
- package/dist/extraction/store-writer.d.ts.map +1 -0
- package/dist/extraction/store-writer.js +174 -0
- package/dist/extraction/store-writer.js.map +1 -0
- package/dist/extraction/svelte-extractor.d.ts +56 -0
- package/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/dist/extraction/svelte-extractor.js +275 -0
- package/dist/extraction/svelte-extractor.js.map +1 -0
- package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-helpers.js +153 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +260 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/dist/extraction/tree-sitter-types.js +10 -0
- package/dist/extraction/tree-sitter-types.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts +728 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/dist/extraction/tree-sitter.js +6676 -0
- package/dist/extraction/tree-sitter.js.map +1 -0
- package/dist/extraction/vue-extractor.d.ts +51 -0
- package/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/dist/extraction/vue-extractor.js +254 -0
- package/dist/extraction/vue-extractor.js.map +1 -0
- package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/dist/extraction/wasm-runtime-flags.js +130 -0
- package/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +13 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/queries.d.ts +106 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +341 -0
- package/dist/graph/queries.js.map +1 -0
- package/dist/graph/traversal.d.ts +127 -0
- package/dist/graph/traversal.d.ts.map +1 -0
- package/dist/graph/traversal.js +599 -0
- package/dist/graph/traversal.js.map +1 -0
- package/dist/index.d.ts +677 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1718 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/beta-signup.d.ts +54 -0
- package/dist/installer/beta-signup.d.ts.map +1 -0
- package/dist/installer/beta-signup.js +178 -0
- package/dist/installer/beta-signup.js.map +1 -0
- package/dist/installer/config-writer.d.ts +28 -0
- package/dist/installer/config-writer.d.ts.map +1 -0
- package/dist/installer/config-writer.js +91 -0
- package/dist/installer/config-writer.js.map +1 -0
- package/dist/installer/index.d.ts +144 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +634 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/instructions-template.d.ts +41 -0
- package/dist/installer/instructions-template.d.ts.map +1 -0
- package/dist/installer/instructions-template.js +53 -0
- package/dist/installer/instructions-template.js.map +1 -0
- package/dist/installer/targets/antigravity.d.ts +57 -0
- package/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/installer/targets/antigravity.js +308 -0
- package/dist/installer/targets/antigravity.js.map +1 -0
- package/dist/installer/targets/claude.d.ts +62 -0
- package/dist/installer/targets/claude.d.ts.map +1 -0
- package/dist/installer/targets/claude.js +486 -0
- package/dist/installer/targets/claude.js.map +1 -0
- package/dist/installer/targets/codex.d.ts +18 -0
- package/dist/installer/targets/codex.d.ts.map +1 -0
- package/dist/installer/targets/codex.js +185 -0
- package/dist/installer/targets/codex.js.map +1 -0
- package/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/dist/installer/targets/copilot-cli.js +209 -0
- package/dist/installer/targets/copilot-cli.js.map +1 -0
- package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/dist/installer/targets/copilot-vscode.js +219 -0
- package/dist/installer/targets/copilot-vscode.js.map +1 -0
- package/dist/installer/targets/cursor.d.ts +35 -0
- package/dist/installer/targets/cursor.d.ts.map +1 -0
- package/dist/installer/targets/cursor.js +254 -0
- package/dist/installer/targets/cursor.js.map +1 -0
- package/dist/installer/targets/dsh.d.ts +97 -0
- package/dist/installer/targets/dsh.d.ts.map +1 -0
- package/dist/installer/targets/dsh.js +358 -0
- package/dist/installer/targets/dsh.js.map +1 -0
- package/dist/installer/targets/gemini.d.ts +26 -0
- package/dist/installer/targets/gemini.d.ts.map +1 -0
- package/dist/installer/targets/gemini.js +165 -0
- package/dist/installer/targets/gemini.js.map +1 -0
- package/dist/installer/targets/hermes.d.ts +18 -0
- package/dist/installer/targets/hermes.d.ts.map +1 -0
- package/dist/installer/targets/hermes.js +359 -0
- package/dist/installer/targets/hermes.js.map +1 -0
- package/dist/installer/targets/kiro.d.ts +27 -0
- package/dist/installer/targets/kiro.d.ts.map +1 -0
- package/dist/installer/targets/kiro.js +178 -0
- package/dist/installer/targets/kiro.js.map +1 -0
- package/dist/installer/targets/opencode.d.ts +38 -0
- package/dist/installer/targets/opencode.d.ts.map +1 -0
- package/dist/installer/targets/opencode.js +288 -0
- package/dist/installer/targets/opencode.js.map +1 -0
- package/dist/installer/targets/registry.d.ts +35 -0
- package/dist/installer/targets/registry.d.ts.map +1 -0
- package/dist/installer/targets/registry.js +101 -0
- package/dist/installer/targets/registry.js.map +1 -0
- package/dist/installer/targets/shared.d.ts +132 -0
- package/dist/installer/targets/shared.d.ts.map +1 -0
- package/dist/installer/targets/shared.js +314 -0
- package/dist/installer/targets/shared.js.map +1 -0
- package/dist/installer/targets/toml.d.ts +53 -0
- package/dist/installer/targets/toml.d.ts.map +1 -0
- package/dist/installer/targets/toml.js +226 -0
- package/dist/installer/targets/toml.js.map +1 -0
- package/dist/installer/targets/types.d.ts +109 -0
- package/dist/installer/targets/types.d.ts.map +1 -0
- package/dist/installer/targets/types.js +16 -0
- package/dist/installer/targets/types.js.map +1 -0
- package/dist/installer/targets/zcode.d.ts +106 -0
- package/dist/installer/targets/zcode.d.ts.map +1 -0
- package/dist/installer/targets/zcode.js +451 -0
- package/dist/installer/targets/zcode.js.map +1 -0
- package/dist/mcp/daemon-manager.d.ts +42 -0
- package/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/dist/mcp/daemon-manager.js +129 -0
- package/dist/mcp/daemon-manager.js.map +1 -0
- package/dist/mcp/daemon-paths.d.ts +73 -0
- package/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/dist/mcp/daemon-paths.js +165 -0
- package/dist/mcp/daemon-paths.js.map +1 -0
- package/dist/mcp/daemon-registry.d.ts +47 -0
- package/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/dist/mcp/daemon-registry.js +233 -0
- package/dist/mcp/daemon-registry.js.map +1 -0
- package/dist/mcp/daemon.d.ts +290 -0
- package/dist/mcp/daemon.d.ts.map +1 -0
- package/dist/mcp/daemon.js +862 -0
- package/dist/mcp/daemon.js.map +1 -0
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/dist/mcp/dynamic-boundaries.js +360 -0
- package/dist/mcp/dynamic-boundaries.js.map +1 -0
- package/dist/mcp/early-ppid.d.ts +26 -0
- package/dist/mcp/early-ppid.d.ts.map +1 -0
- package/dist/mcp/early-ppid.js +29 -0
- package/dist/mcp/early-ppid.js.map +1 -0
- package/dist/mcp/engine.d.ts +122 -0
- package/dist/mcp/engine.d.ts.map +1 -0
- package/dist/mcp/engine.js +350 -0
- package/dist/mcp/engine.js.map +1 -0
- package/dist/mcp/explore-dedup.d.ts +137 -0
- package/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/dist/mcp/explore-dedup.js +236 -0
- package/dist/mcp/explore-dedup.js.map +1 -0
- package/dist/mcp/explore-diagnostics.d.ts +287 -0
- package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/dist/mcp/explore-diagnostics.js +555 -0
- package/dist/mcp/explore-diagnostics.js.map +1 -0
- package/dist/mcp/explore-session-state.d.ts +217 -0
- package/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/dist/mcp/explore-session-state.js +322 -0
- package/dist/mcp/explore-session-state.js.map +1 -0
- package/dist/mcp/index.d.ts +137 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +554 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/liveness-watchdog.d.ts +35 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/dist/mcp/liveness-watchdog.js +269 -0
- package/dist/mcp/liveness-watchdog.js.map +1 -0
- package/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
- package/dist/mcp/ppid-watchdog.js +64 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -0
- package/dist/mcp/proxy.d.ts +87 -0
- package/dist/mcp/proxy.d.ts.map +1 -0
- package/dist/mcp/proxy.js +672 -0
- package/dist/mcp/proxy.js.map +1 -0
- package/dist/mcp/query-pool.d.ts +108 -0
- package/dist/mcp/query-pool.d.ts.map +1 -0
- package/dist/mcp/query-pool.js +315 -0
- package/dist/mcp/query-pool.js.map +1 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/query-worker.d.ts.map +1 -0
- package/dist/mcp/query-worker.js +87 -0
- package/dist/mcp/query-worker.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +34 -0
- package/dist/mcp/server-instructions.d.ts.map +1 -0
- package/dist/mcp/server-instructions.js +111 -0
- package/dist/mcp/server-instructions.js.map +1 -0
- package/dist/mcp/session.d.ts +109 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +375 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/startup-handshake.d.ts +44 -0
- package/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/dist/mcp/startup-handshake.js +73 -0
- package/dist/mcp/startup-handshake.js.map +1 -0
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/dist/mcp/stdin-teardown.js +49 -0
- package/dist/mcp/stdin-teardown.js.map +1 -0
- package/dist/mcp/tools.d.ts +862 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +6526 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/transport.d.ts +188 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +377 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/version.d.ts +19 -0
- package/dist/mcp/version.d.ts.map +1 -0
- package/dist/mcp/version.js +71 -0
- package/dist/mcp/version.js.map +1 -0
- package/dist/project-config.d.ts +94 -0
- package/dist/project-config.d.ts.map +1 -0
- package/dist/project-config.js +374 -0
- package/dist/project-config.js.map +1 -0
- package/dist/prompt-hook-output.d.ts +23 -0
- package/dist/prompt-hook-output.d.ts.map +1 -0
- package/dist/prompt-hook-output.js +35 -0
- package/dist/prompt-hook-output.js.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +59 -0
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/resolution/callback-synthesizer.js +4030 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -0
- package/dist/resolution/cooperative-yield.d.ts +40 -0
- package/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/dist/resolution/cooperative-yield.js +44 -0
- package/dist/resolution/cooperative-yield.js.map +1 -0
- package/dist/resolution/frameworks/astro.d.ts +9 -0
- package/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/dist/resolution/frameworks/astro.js +169 -0
- package/dist/resolution/frameworks/astro.js.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/dist/resolution/frameworks/cics.d.ts +20 -0
- package/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/dist/resolution/frameworks/cics.js +90 -0
- package/dist/resolution/frameworks/cics.js.map +1 -0
- package/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/dist/resolution/frameworks/csharp.js +241 -0
- package/dist/resolution/frameworks/csharp.js.map +1 -0
- package/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/dist/resolution/frameworks/drupal.js +367 -0
- package/dist/resolution/frameworks/drupal.js.map +1 -0
- package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/dist/resolution/frameworks/expo-modules.js +148 -0
- package/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/dist/resolution/frameworks/express.d.ts +8 -0
- package/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/dist/resolution/frameworks/express.js +308 -0
- package/dist/resolution/frameworks/express.js.map +1 -0
- package/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/dist/resolution/frameworks/fabric.js +354 -0
- package/dist/resolution/frameworks/fabric.js.map +1 -0
- package/dist/resolution/frameworks/go.d.ts +8 -0
- package/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/dist/resolution/frameworks/go.js +184 -0
- package/dist/resolution/frameworks/go.js.map +1 -0
- package/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/dist/resolution/frameworks/goframe.js +112 -0
- package/dist/resolution/frameworks/goframe.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +50 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/resolution/frameworks/index.js +175 -0
- package/dist/resolution/frameworks/index.js.map +1 -0
- package/dist/resolution/frameworks/java.d.ts +8 -0
- package/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/dist/resolution/frameworks/java.js +517 -0
- package/dist/resolution/frameworks/java.js.map +1 -0
- package/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/dist/resolution/frameworks/laravel.js +257 -0
- package/dist/resolution/frameworks/laravel.js.map +1 -0
- package/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/dist/resolution/frameworks/nestjs.js +698 -0
- package/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/dist/resolution/frameworks/play.d.ts +19 -0
- package/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/dist/resolution/frameworks/play.js +111 -0
- package/dist/resolution/frameworks/play.js.map +1 -0
- package/dist/resolution/frameworks/python.d.ts +10 -0
- package/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/dist/resolution/frameworks/python.js +400 -0
- package/dist/resolution/frameworks/python.js.map +1 -0
- package/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/dist/resolution/frameworks/react-native.js +410 -0
- package/dist/resolution/frameworks/react-native.js.map +1 -0
- package/dist/resolution/frameworks/react.d.ts +8 -0
- package/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/dist/resolution/frameworks/react.js +334 -0
- package/dist/resolution/frameworks/react.js.map +1 -0
- package/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/dist/resolution/frameworks/ruby.js +302 -0
- package/dist/resolution/frameworks/ruby.js.map +1 -0
- package/dist/resolution/frameworks/rust.d.ts +8 -0
- package/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/dist/resolution/frameworks/rust.js +304 -0
- package/dist/resolution/frameworks/rust.js.map +1 -0
- package/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/dist/resolution/frameworks/svelte.js +253 -0
- package/dist/resolution/frameworks/svelte.js.map +1 -0
- package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift-objc.js +252 -0
- package/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/dist/resolution/frameworks/swift.d.ts +10 -0
- package/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/dist/resolution/frameworks/swift.js +400 -0
- package/dist/resolution/frameworks/swift.js.map +1 -0
- package/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/dist/resolution/frameworks/terraform.js +277 -0
- package/dist/resolution/frameworks/terraform.js.map +1 -0
- package/dist/resolution/frameworks/vue.d.ts +9 -0
- package/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/dist/resolution/frameworks/vue.js +303 -0
- package/dist/resolution/frameworks/vue.js.map +1 -0
- package/dist/resolution/go-module.d.ts +26 -0
- package/dist/resolution/go-module.d.ts.map +1 -0
- package/dist/resolution/go-module.js +78 -0
- package/dist/resolution/go-module.js.map +1 -0
- package/dist/resolution/goframe-synthesizer.d.ts +29 -0
- package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/dist/resolution/goframe-synthesizer.js +163 -0
- package/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +84 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -0
- package/dist/resolution/import-resolver.js +2134 -0
- package/dist/resolution/import-resolver.js.map +1 -0
- package/dist/resolution/index.d.ts +343 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +2339 -0
- package/dist/resolution/index.js.map +1 -0
- package/dist/resolution/lru-cache.d.ts +24 -0
- package/dist/resolution/lru-cache.d.ts.map +1 -0
- package/dist/resolution/lru-cache.js +62 -0
- package/dist/resolution/lru-cache.js.map +1 -0
- package/dist/resolution/memory-budget.d.ts +48 -0
- package/dist/resolution/memory-budget.d.ts.map +1 -0
- package/dist/resolution/memory-budget.js +162 -0
- package/dist/resolution/memory-budget.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +123 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +2134 -0
- package/dist/resolution/name-matcher.js.map +1 -0
- package/dist/resolution/path-aliases.d.ts +68 -0
- package/dist/resolution/path-aliases.d.ts.map +1 -0
- package/dist/resolution/path-aliases.js +238 -0
- package/dist/resolution/path-aliases.js.map +1 -0
- package/dist/resolution/resolver-pool.d.ts +106 -0
- package/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/dist/resolution/resolver-pool.js +344 -0
- package/dist/resolution/resolver-pool.js.map +1 -0
- package/dist/resolution/resolver-worker.d.ts +17 -0
- package/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/dist/resolution/resolver-worker.js +141 -0
- package/dist/resolution/resolver-worker.js.map +1 -0
- package/dist/resolution/strip-comments.d.ts +27 -0
- package/dist/resolution/strip-comments.d.ts.map +1 -0
- package/dist/resolution/strip-comments.js +492 -0
- package/dist/resolution/strip-comments.js.map +1 -0
- package/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/dist/resolution/swift-objc-bridge.js +256 -0
- package/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/dist/resolution/types.d.ts +265 -0
- package/dist/resolution/types.d.ts.map +1 -0
- package/dist/resolution/types.js +8 -0
- package/dist/resolution/types.js.map +1 -0
- package/dist/resolution/workspace-packages.d.ts +58 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/dist/resolution/workspace-packages.js +346 -0
- package/dist/resolution/workspace-packages.js.map +1 -0
- package/dist/search/identifier-segments.d.ts +60 -0
- package/dist/search/identifier-segments.d.ts.map +1 -0
- package/dist/search/identifier-segments.js +176 -0
- package/dist/search/identifier-segments.js.map +1 -0
- package/dist/search/query-parser.d.ts +57 -0
- package/dist/search/query-parser.d.ts.map +1 -0
- package/dist/search/query-parser.js +177 -0
- package/dist/search/query-parser.js.map +1 -0
- package/dist/search/query-utils.d.ts +87 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +450 -0
- package/dist/search/query-utils.js.map +1 -0
- package/dist/sync/git-hooks.d.ts +45 -0
- package/dist/sync/git-hooks.d.ts.map +1 -0
- package/dist/sync/git-hooks.js +227 -0
- package/dist/sync/git-hooks.js.map +1 -0
- package/dist/sync/index.d.ts +19 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +35 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/watch-policy.d.ts +48 -0
- package/dist/sync/watch-policy.d.ts.map +1 -0
- package/dist/sync/watch-policy.js +124 -0
- package/dist/sync/watch-policy.js.map +1 -0
- package/dist/sync/watcher.d.ts +379 -0
- package/dist/sync/watcher.d.ts.map +1 -0
- package/dist/sync/watcher.js +921 -0
- package/dist/sync/watcher.js.map +1 -0
- package/dist/sync/worktree.d.ts +63 -0
- package/dist/sync/worktree.d.ts.map +1 -0
- package/dist/sync/worktree.js +182 -0
- package/dist/sync/worktree.js.map +1 -0
- package/dist/telemetry/index.d.ts +143 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +541 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/types.d.ts +465 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +117 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/color.d.ts +21 -0
- package/dist/ui/color.d.ts.map +1 -0
- package/dist/ui/color.js +42 -0
- package/dist/ui/color.js.map +1 -0
- package/dist/ui/glyphs.d.ts +67 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +125 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/shimmer-progress.d.ts +11 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/dist/ui/shimmer-progress.js +164 -0
- package/dist/ui/shimmer-progress.js.map +1 -0
- package/dist/ui/shimmer-worker.d.ts +2 -0
- package/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/dist/ui/shimmer-worker.js +126 -0
- package/dist/ui/shimmer-worker.js.map +1 -0
- package/dist/ui/types.d.ts +15 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +3 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/upgrade/index.d.ts +171 -0
- package/dist/upgrade/index.d.ts.map +1 -0
- package/dist/upgrade/index.js +659 -0
- package/dist/upgrade/index.js.map +1 -0
- package/dist/upgrade/remove-binary.d.ts +87 -0
- package/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/dist/upgrade/remove-binary.js +289 -0
- package/dist/upgrade/remove-binary.js.map +1 -0
- package/dist/upgrade/update-check.d.ts +92 -0
- package/dist/upgrade/update-check.d.ts.map +1 -0
- package/dist/upgrade/update-check.js +258 -0
- package/dist/upgrade/update-check.js.map +1 -0
- package/dist/utils.d.ts +224 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +583 -0
- package/dist/utils.js.map +1 -0
- package/package.json +61 -0
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/ab-adoption.sh +91 -0
- package/scripts/agent-eval/ab-hook.sh +86 -0
- package/scripts/agent-eval/ab-impl.sh +78 -0
- package/scripts/agent-eval/ab-new-vs-baseline.sh +161 -0
- package/scripts/agent-eval/ab-sufficiency.sh +78 -0
- package/scripts/agent-eval/allocation-fixtures.json +344 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/audit.sh +68 -0
- package/scripts/agent-eval/bench-readme.sh +48 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/compare-arms.mjs +209 -0
- package/scripts/agent-eval/diff-index-drift.mjs +102 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +120 -0
- package/scripts/agent-eval/no-cli-shim.sh +96 -0
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
- package/scripts/agent-eval/offload-eval-setup.sh +24 -0
- package/scripts/agent-eval/offload-eval-styles.sh +72 -0
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
- package/scripts/agent-eval/offload-eval.md +76 -0
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +238 -0
- package/scripts/agent-eval/parse-run.mjs +1401 -0
- package/scripts/agent-eval/parse-session.mjs +130 -0
- package/scripts/agent-eval/probe-allocation.mjs +335 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-decl-only.mjs +198 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-factory-closure.mjs +147 -0
- package/scripts/agent-eval/probe-file-spend.mjs +195 -0
- package/scripts/agent-eval/probe-named-symbol.mjs +163 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-suite-envelope.mjs +124 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/redirect-read-hook.sh +38 -0
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +149 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +145 -0
- package/scripts/build-kernel.sh +87 -0
- package/scripts/dump-graph.mjs +57 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/kernel-parity.mjs +283 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/npm-shim.js +279 -0
- package/scripts/pack-npm.sh +123 -0
- package/scripts/prepare-release.mjs +270 -0
package/dist/db/index.js
ADDED
|
@@ -0,0 +1,831 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Database Layer
|
|
4
|
+
*
|
|
5
|
+
* Handles SQLite database initialization and connection management.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.DATABASE_FILENAME = exports.DatabaseConnection = exports.WAL_HEAL_THRESHOLD_BYTES = void 0;
|
|
42
|
+
exports.resolveWalHealBytes = resolveWalHealBytes;
|
|
43
|
+
exports.getDatabasePath = getDatabasePath;
|
|
44
|
+
exports.removeDatabaseFiles = removeDatabaseFiles;
|
|
45
|
+
const sqlite_adapter_1 = require("./sqlite-adapter");
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const migrations_1 = require("./migrations");
|
|
49
|
+
const directory_1 = require("../directory");
|
|
50
|
+
/**
|
|
51
|
+
* Apply connection-level PRAGMAs. Shared by `initialize` and `open` so the two
|
|
52
|
+
* paths can't drift.
|
|
53
|
+
*
|
|
54
|
+
* `busy_timeout` is set FIRST, before any pragma that might touch the database
|
|
55
|
+
* file (notably `journal_mode`). If another process holds a write lock at open
|
|
56
|
+
* time, the later pragmas — and the connection's first query — then wait out
|
|
57
|
+
* the lock instead of throwing "database is locked" immediately. See issue #238.
|
|
58
|
+
*
|
|
59
|
+
* The 5s window (was 120s) rides out a normal incremental sync; the old
|
|
60
|
+
* 2-minute wait presented as a frozen, hung agent. With WAL, reads never block
|
|
61
|
+
* on a writer, so this timeout only governs cross-process write contention
|
|
62
|
+
* (e.g. the git-hook `codegraph sync` running while the MCP server writes).
|
|
63
|
+
*/
|
|
64
|
+
function configureConnection(db) {
|
|
65
|
+
db.pragma('busy_timeout = 5000'); // MUST be first — see above
|
|
66
|
+
db.pragma('foreign_keys = ON');
|
|
67
|
+
db.pragma('journal_mode = WAL'); // node:sqlite supports WAL on every platform
|
|
68
|
+
db.pragma('synchronous = NORMAL'); // safe with WAL mode
|
|
69
|
+
db.pragma('cache_size = -64000'); // 64 MB page cache
|
|
70
|
+
db.pragma('temp_store = MEMORY'); // temp tables in memory
|
|
71
|
+
db.pragma('mmap_size = 268435456'); // 256 MB memory-mapped I/O
|
|
72
|
+
// Without a journal_size_limit the -wal file never shrinks below its
|
|
73
|
+
// high-water mark while a connection lives: checkpoints fold frames back but
|
|
74
|
+
// leave the file at full size, so one giant deferred-sync WAL stays giant
|
|
75
|
+
// forever. With the limit set, any checkpoint that resets the WAL truncates
|
|
76
|
+
// the file back down. Killed-process leftovers are handled separately by
|
|
77
|
+
// healOversizedWal() at open. (#1431)
|
|
78
|
+
db.pragma(`journal_size_limit = ${exports.WAL_HEAL_THRESHOLD_BYTES}`);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* WAL size past which `healOversizedWal` (run at every `open`) checkpoints and
|
|
82
|
+
* truncates the file, and to which `journal_size_limit` clips the WAL after any
|
|
83
|
+
* resetting checkpoint. A SIGKILL'd process (the #850 liveness watchdog, OOM,
|
|
84
|
+
* crash) can leave an arbitrarily large WAL behind — a whole deferred-sync
|
|
85
|
+
* run's worth (#1248) — and before #1431 no later session ever shrank it: the
|
|
86
|
+
* file just grew, killed session after killed session, until the disk filled
|
|
87
|
+
* (25.6 GB observed). 64 MB is far above anything a healthy open ever sees
|
|
88
|
+
* (a clean close deletes the WAL) yet small enough to cap the leak.
|
|
89
|
+
* Override with `CODEGRAPH_WAL_HEAL_MB` (also feeds `journal_size_limit`).
|
|
90
|
+
*/
|
|
91
|
+
exports.WAL_HEAL_THRESHOLD_BYTES = resolveWalHealBytes(process.env.CODEGRAPH_WAL_HEAL_MB);
|
|
92
|
+
/** Resolve the heal threshold from the env override (MB); invalid ⇒ 64 MB. */
|
|
93
|
+
function resolveWalHealBytes(envVal) {
|
|
94
|
+
if (envVal !== undefined && envVal !== '') {
|
|
95
|
+
const n = Number(envVal);
|
|
96
|
+
if (Number.isFinite(n) && n > 0)
|
|
97
|
+
return Math.floor(n * 1024 * 1024);
|
|
98
|
+
}
|
|
99
|
+
return 64 * 1024 * 1024;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Database connection wrapper with lifecycle management
|
|
103
|
+
*/
|
|
104
|
+
class DatabaseConnection {
|
|
105
|
+
db;
|
|
106
|
+
dbPath;
|
|
107
|
+
backend;
|
|
108
|
+
/**
|
|
109
|
+
* `dev:ino` of the DB file at the moment we opened it (or null when the
|
|
110
|
+
* platform/filesystem reports no usable inode). Lets us notice when the file
|
|
111
|
+
* we hold open has been unlinked and REPLACED by a new file at the same path
|
|
112
|
+
* — a git worktree removed and re-added, or `.codegraph/` deleted and
|
|
113
|
+
* re-`init`ed under a long-lived server — at which point our fd reads a now
|
|
114
|
+
* dead inode forever (#925). See `isReplacedOnDisk`.
|
|
115
|
+
*/
|
|
116
|
+
openedInode;
|
|
117
|
+
constructor(db, dbPath, backend) {
|
|
118
|
+
this.db = db;
|
|
119
|
+
this.dbPath = dbPath;
|
|
120
|
+
this.backend = backend;
|
|
121
|
+
this.openedInode = statInode(dbPath);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Initialize a new database at the given path
|
|
125
|
+
*/
|
|
126
|
+
static initialize(dbPath) {
|
|
127
|
+
// Ensure parent directory exists
|
|
128
|
+
const dir = path.dirname(dbPath);
|
|
129
|
+
if (!fs.existsSync(dir)) {
|
|
130
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
131
|
+
}
|
|
132
|
+
// Create and configure database
|
|
133
|
+
const { db, backend } = (0, sqlite_adapter_1.createDatabase)(dbPath);
|
|
134
|
+
configureConnection(db);
|
|
135
|
+
// Run schema initialization
|
|
136
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
137
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
138
|
+
db.exec(schema);
|
|
139
|
+
// Record current schema version so migrations aren't re-applied on open
|
|
140
|
+
const currentVersion = (0, migrations_1.getCurrentVersion)(db);
|
|
141
|
+
if (currentVersion < migrations_1.CURRENT_SCHEMA_VERSION) {
|
|
142
|
+
db.prepare('INSERT OR IGNORE INTO schema_versions (version, applied_at, description) VALUES (?, ?, ?)').run(migrations_1.CURRENT_SCHEMA_VERSION, Date.now(), 'Initial schema includes all migrations');
|
|
143
|
+
}
|
|
144
|
+
return new DatabaseConnection(db, dbPath, backend);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Open an existing database
|
|
148
|
+
*/
|
|
149
|
+
static open(dbPath) {
|
|
150
|
+
if (!fs.existsSync(dbPath)) {
|
|
151
|
+
throw new Error(`Database not found: ${dbPath}`);
|
|
152
|
+
}
|
|
153
|
+
const { db, backend } = (0, sqlite_adapter_1.createDatabase)(dbPath);
|
|
154
|
+
configureConnection(db);
|
|
155
|
+
// Check and run migrations if needed
|
|
156
|
+
const conn = new DatabaseConnection(db, dbPath, backend);
|
|
157
|
+
const currentVersion = (0, migrations_1.getCurrentVersion)(db);
|
|
158
|
+
if (currentVersion < migrations_1.CURRENT_SCHEMA_VERSION) {
|
|
159
|
+
(0, migrations_1.runMigrations)(db, currentVersion);
|
|
160
|
+
}
|
|
161
|
+
// Self-heal a bulk-load window that never closed (crash between
|
|
162
|
+
// beginBulkNodeLoad and endBulkNodeLoad): the FTS triggers are missing and
|
|
163
|
+
// nodes_fts is stale. Rebuild + recreate so search stays in sync.
|
|
164
|
+
conn.healBulkNodeLoad();
|
|
165
|
+
// Self-heal a killed session's leftover oversized WAL (#1431) — one
|
|
166
|
+
// statSync when healthy, off-thread checkpoint+truncate when not.
|
|
167
|
+
void conn.healOversizedWal();
|
|
168
|
+
return conn;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* FTS maintenance triggers dropped/recreated around a bulk load.
|
|
172
|
+
* Names must match schema.sql.
|
|
173
|
+
*/
|
|
174
|
+
static FTS_TRIGGER_NAMES = ['nodes_ai', 'nodes_ad', 'nodes_au'];
|
|
175
|
+
/**
|
|
176
|
+
* Enter bulk-load mode: drop the per-row FTS sync triggers so mass node
|
|
177
|
+
* inserts skip per-row tokenization. MUST be paired with endBulkNodeLoad()
|
|
178
|
+
* (use try/finally); a crash inside the window is healed on the next open().
|
|
179
|
+
* The window is DB-wide (triggers are schema objects), which is safe because
|
|
180
|
+
* endBulkNodeLoad() rebuilds nodes_fts from the nodes table wholesale — any
|
|
181
|
+
* row written by anyone during the window is captured by the rebuild.
|
|
182
|
+
*/
|
|
183
|
+
beginBulkNodeLoad() {
|
|
184
|
+
for (const t of DatabaseConnection.FTS_TRIGGER_NAMES) {
|
|
185
|
+
this.db.exec(`DROP TRIGGER IF EXISTS ${t}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Leave bulk-load mode: rebuild the whole FTS index from the nodes table in
|
|
190
|
+
* one pass (far cheaper than per-row trigger firings), then recreate the
|
|
191
|
+
* triggers by re-running schema.sql (idempotent — everything in it is
|
|
192
|
+
* IF NOT EXISTS).
|
|
193
|
+
*/
|
|
194
|
+
endBulkNodeLoad() {
|
|
195
|
+
this.db.exec(`INSERT INTO nodes_fts(nodes_fts) VALUES('rebuild')`);
|
|
196
|
+
this.recreateFtsTriggers();
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* NON-UNIQUE secondary indexes maintained per-row during the parse phase's
|
|
200
|
+
* bulk inserts — the store-architecture arc's first lever (plan §4d: dubbo's
|
|
201
|
+
* parse-loop wall is 94% store-writer busy, and the #1320 post-mortem showed
|
|
202
|
+
* statement batching and sorted inserts are ~zero on this path because
|
|
203
|
+
* B-TREE MAINTENANCE is the floor). A fresh init writes every row of
|
|
204
|
+
* nodes/unresolved_refs/files exactly once and reads none of them until
|
|
205
|
+
* resolution, so the parse window can drop all of these and rebuild each in
|
|
206
|
+
* one table scan afterwards — the same measured trade as the resolution
|
|
207
|
+
* phase's edge-index window (2.8s → 1.1s inserting, ~0.3s recreating).
|
|
208
|
+
* Primary keys and UNIQUE constraints stay (upserts and OR-IGNORE dedup
|
|
209
|
+
* conflict on them).
|
|
210
|
+
*/
|
|
211
|
+
static BULK_PARSE_INDEX_NAMES = [
|
|
212
|
+
'idx_nodes_kind',
|
|
213
|
+
'idx_nodes_name',
|
|
214
|
+
'idx_nodes_qualified_name',
|
|
215
|
+
'idx_nodes_file_path',
|
|
216
|
+
'idx_nodes_language',
|
|
217
|
+
'idx_nodes_file_line',
|
|
218
|
+
'idx_nodes_lower_name',
|
|
219
|
+
'idx_unresolved_from_node',
|
|
220
|
+
'idx_unresolved_name',
|
|
221
|
+
'idx_unresolved_file_path',
|
|
222
|
+
'idx_unresolved_from_name',
|
|
223
|
+
'idx_unresolved_status',
|
|
224
|
+
'idx_unresolved_failed_tail',
|
|
225
|
+
'idx_files_language',
|
|
226
|
+
'idx_files_modified_at',
|
|
227
|
+
];
|
|
228
|
+
/**
|
|
229
|
+
* Enter bulk-parse-load mode (FRESH-INIT ONLY — the caller gates on a fresh
|
|
230
|
+
* DB, because an incremental index deletes per-file rows mid-phase and needs
|
|
231
|
+
* the file_path indexes): drop every parse-lane secondary index, including
|
|
232
|
+
* the four non-unique edge indexes (parse inserts contains-edges too; the
|
|
233
|
+
* UNIQUE identity index stays for INSERT OR IGNORE dedup, and its `source`
|
|
234
|
+
* prefix keeps source-keyed reads indexed, as in the edge window). MUST be
|
|
235
|
+
* paired with endBulkParseLoad(); a crash inside the window is healed on the
|
|
236
|
+
* next DatabaseConnection open (schema.sql re-applies CREATE INDEX IF NOT
|
|
237
|
+
* EXISTS).
|
|
238
|
+
*/
|
|
239
|
+
beginBulkParseLoad() {
|
|
240
|
+
for (const idx of DatabaseConnection.BULK_PARSE_INDEX_NAMES) {
|
|
241
|
+
this.db.exec(`DROP INDEX IF EXISTS ${idx}`);
|
|
242
|
+
}
|
|
243
|
+
this.beginBulkEdgeLoad();
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Leave bulk-parse-load mode: recreate everything the window dropped, one
|
|
247
|
+
* table scan per index, with a yield between statements (same
|
|
248
|
+
* liveness-watchdog rationale as endBulkEdgeLoad — at kernel scale each
|
|
249
|
+
* build is a long synchronous scan). The edge indexes are rebuilt here too,
|
|
250
|
+
* so paths that never enter the resolution phase's own bulk-edge window
|
|
251
|
+
* (small runs) are left with a complete schema; the batched resolver's
|
|
252
|
+
* beginBulkEdgeLoad simply re-drops them (DROP IF EXISTS — idempotent).
|
|
253
|
+
*/
|
|
254
|
+
async endBulkParseLoad() {
|
|
255
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
256
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
257
|
+
for (const idx of DatabaseConnection.BULK_PARSE_INDEX_NAMES) {
|
|
258
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
259
|
+
if (!m)
|
|
260
|
+
throw new Error(`schema.sql: parse index ${idx} not found for bulk-load recreation`);
|
|
261
|
+
this.db.exec(m[0]);
|
|
262
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
263
|
+
}
|
|
264
|
+
await this.endBulkEdgeLoad();
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* unresolved_refs secondary indexes NOT read by the batched resolution
|
|
268
|
+
* loop. The loop pages pending refs by keyset (`status='pending' AND id>?`
|
|
269
|
+
* — the status index + PK), deletes resolved rows by id, and parks failures
|
|
270
|
+
* with a status UPDATE; every other ref index serves SYNC-time paths
|
|
271
|
+
* (per-file re-index deletes, name-keyed retry, failed-tail heal). Each
|
|
272
|
+
* per-batch DELETE maintains all of them — the biggest single main-thread
|
|
273
|
+
* stage on the dubbo profile (deletes 1.2s of a 5.4s resolution phase) —
|
|
274
|
+
* so the batched loop drops them and rebuilds at the end, where the table
|
|
275
|
+
* holds only the surviving FAILED refs (resolved rows are gone), making
|
|
276
|
+
* the recreate near-free.
|
|
277
|
+
*/
|
|
278
|
+
static BULK_REF_INDEX_NAMES = [
|
|
279
|
+
'idx_unresolved_from_node',
|
|
280
|
+
'idx_unresolved_name',
|
|
281
|
+
'idx_unresolved_file_path',
|
|
282
|
+
'idx_unresolved_from_name',
|
|
283
|
+
'idx_unresolved_failed_tail',
|
|
284
|
+
];
|
|
285
|
+
/**
|
|
286
|
+
* Enter bulk-ref mode for the batched resolution loop — see
|
|
287
|
+
* BULK_REF_INDEX_NAMES. MUST be paired with endBulkRefLoad(); a crash
|
|
288
|
+
* inside the window heals on the next open (schema.sql re-applies
|
|
289
|
+
* CREATE INDEX IF NOT EXISTS).
|
|
290
|
+
*/
|
|
291
|
+
beginBulkRefLoad() {
|
|
292
|
+
for (const idx of DatabaseConnection.BULK_REF_INDEX_NAMES) {
|
|
293
|
+
this.db.exec(`DROP INDEX IF EXISTS ${idx}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/** Leave bulk-ref mode: recreate each index in one scan (yield between). */
|
|
297
|
+
async endBulkRefLoad() {
|
|
298
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
299
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
300
|
+
for (const idx of DatabaseConnection.BULK_REF_INDEX_NAMES) {
|
|
301
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
302
|
+
if (!m)
|
|
303
|
+
throw new Error(`schema.sql: ref index ${idx} not found for bulk-load recreation`);
|
|
304
|
+
this.db.exec(m[0]);
|
|
305
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Names of the NON-UNIQUE edge indexes dropped for a bulk edge load.
|
|
310
|
+
* idx_edges_identity deliberately stays: INSERT OR IGNORE's dedup conflicts
|
|
311
|
+
* on it (#1034), and its leftmost column is `source`, so the source-keyed
|
|
312
|
+
* reads resolution makes mid-window (supertype walks over
|
|
313
|
+
* `implements`/`extends`) keep an index via its prefix — verified with
|
|
314
|
+
* EXPLAIN QUERY PLAN. Target-keyed and kind-keyed reads (traversal,
|
|
315
|
+
* synthesis) happen only after endBulkEdgeLoad().
|
|
316
|
+
*/
|
|
317
|
+
static BULK_EDGE_INDEX_NAMES = [
|
|
318
|
+
'idx_edges_kind',
|
|
319
|
+
'idx_edges_source_kind',
|
|
320
|
+
'idx_edges_target_kind',
|
|
321
|
+
'idx_edges_provenance',
|
|
322
|
+
];
|
|
323
|
+
/**
|
|
324
|
+
* Enter bulk-edge-load mode: drop the non-unique edge indexes so the mass
|
|
325
|
+
* INSERT OR IGNORE stream pays one B-tree (the identity index) instead of
|
|
326
|
+
* five — measured 2.8s → 1.1s inserting a 224k-edge resolution set, with
|
|
327
|
+
* recreation costing ~0.3s. MUST be paired with endBulkEdgeLoad(); a crash
|
|
328
|
+
* inside the window is healed on the next DatabaseConnection open (schema.sql
|
|
329
|
+
* re-applies CREATE INDEX IF NOT EXISTS).
|
|
330
|
+
*/
|
|
331
|
+
beginBulkEdgeLoad() {
|
|
332
|
+
for (const idx of DatabaseConnection.BULK_EDGE_INDEX_NAMES) {
|
|
333
|
+
this.db.exec(`DROP INDEX IF EXISTS ${idx}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Leave bulk-edge-load mode: recreate the dropped indexes in one pass each
|
|
338
|
+
* over the (now fully loaded) edges table — far cheaper than maintaining
|
|
339
|
+
* them per-insert. DDL is extracted from schema.sql so it cannot drift.
|
|
340
|
+
*
|
|
341
|
+
* Async with a yield BETWEEN the four CREATE INDEX statements: each build is
|
|
342
|
+
* a synchronous scan of the whole edges table (~20s apiece at Linux-kernel
|
|
343
|
+
* scale, 79s total measured), and running them back-to-back is a single
|
|
344
|
+
* event-loop stall longer than the #850 liveness watchdog's 60s window — a
|
|
345
|
+
* daemon-triggered re-index would be SIGKILLed right after doing the work.
|
|
346
|
+
* One yield per statement keeps every stall to a single index build, which
|
|
347
|
+
* stays inside the window.
|
|
348
|
+
*/
|
|
349
|
+
async endBulkEdgeLoad() {
|
|
350
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
351
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
352
|
+
for (const idx of DatabaseConnection.BULK_EDGE_INDEX_NAMES) {
|
|
353
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
354
|
+
if (!m)
|
|
355
|
+
throw new Error(`schema.sql: edge index ${idx} not found for bulk-load recreation`);
|
|
356
|
+
this.db.exec(m[0]);
|
|
357
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/** Recreate the FTS triggers + rebuild if a bulk-load window never closed. */
|
|
361
|
+
healBulkNodeLoad() {
|
|
362
|
+
const row = this.db
|
|
363
|
+
.prepare(`SELECT count(*) AS c FROM sqlite_master WHERE type = 'trigger' AND name IN ('nodes_ai','nodes_ad','nodes_au')`)
|
|
364
|
+
.get();
|
|
365
|
+
if ((row?.c ?? 0) >= DatabaseConnection.FTS_TRIGGER_NAMES.length)
|
|
366
|
+
return;
|
|
367
|
+
this.endBulkNodeLoad();
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Recreate the FTS sync triggers from schema.sql — extracted from the file
|
|
371
|
+
* rather than duplicated here so the DDL cannot drift from the schema.
|
|
372
|
+
* (Re-execing the whole schema is not an option: it contains data INSERTs
|
|
373
|
+
* that are not idempotent, e.g. schema_versions.)
|
|
374
|
+
*/
|
|
375
|
+
recreateFtsTriggers() {
|
|
376
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
377
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
378
|
+
const triggerDdls = schema.match(/CREATE TRIGGER IF NOT EXISTS nodes_a[idu]\b[\s\S]*?END;/g);
|
|
379
|
+
if (!triggerDdls || triggerDdls.length !== DatabaseConnection.FTS_TRIGGER_NAMES.length) {
|
|
380
|
+
throw new Error(`schema.sql: expected ${DatabaseConnection.FTS_TRIGGER_NAMES.length} nodes FTS triggers, found ${triggerDdls?.length ?? 0}`);
|
|
381
|
+
}
|
|
382
|
+
for (const ddl of triggerDdls) {
|
|
383
|
+
this.db.exec(ddl);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Get the underlying database instance
|
|
388
|
+
*/
|
|
389
|
+
getDb() {
|
|
390
|
+
return this.db;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get the SQLite backend serving this connection. Per-instance so
|
|
394
|
+
* MCP cross-project queries report the right backend even when
|
|
395
|
+
* multiple project DBs are open in the same process.
|
|
396
|
+
*/
|
|
397
|
+
getBackend() {
|
|
398
|
+
return this.backend;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Get database file path
|
|
402
|
+
*/
|
|
403
|
+
getPath() {
|
|
404
|
+
return this.dbPath;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The journal mode actually in effect (e.g. 'wal', 'delete').
|
|
408
|
+
*
|
|
409
|
+
* SQLite silently keeps the prior mode if WAL can't be enabled — e.g. on
|
|
410
|
+
* filesystems without shared-memory support (some network/virtualized mounts,
|
|
411
|
+
* WSL2 /mnt). So the effective mode can differ
|
|
412
|
+
* from what `configureConnection` requested. Surfaced in `codegraph status` so
|
|
413
|
+
* a "database is locked" report is triageable: 'wal' ⇒ readers never block on a
|
|
414
|
+
* writer; anything else ⇒ they can. See issue #238.
|
|
415
|
+
*/
|
|
416
|
+
getJournalMode() {
|
|
417
|
+
const raw = this.db.pragma('journal_mode');
|
|
418
|
+
const row = Array.isArray(raw) ? raw[0] : raw;
|
|
419
|
+
const mode = row && typeof row === 'object'
|
|
420
|
+
? row.journal_mode
|
|
421
|
+
: row;
|
|
422
|
+
return String(mode ?? '').toLowerCase();
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Get current schema version
|
|
426
|
+
*/
|
|
427
|
+
getSchemaVersion() {
|
|
428
|
+
const row = this.db
|
|
429
|
+
.prepare('SELECT version, applied_at, description FROM schema_versions ORDER BY version DESC LIMIT 1')
|
|
430
|
+
.get();
|
|
431
|
+
if (!row)
|
|
432
|
+
return null;
|
|
433
|
+
return {
|
|
434
|
+
version: row.version,
|
|
435
|
+
appliedAt: row.applied_at,
|
|
436
|
+
description: row.description ?? undefined,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Execute a function within a transaction
|
|
441
|
+
*/
|
|
442
|
+
transaction(fn) {
|
|
443
|
+
return this.db.transaction(fn)();
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Get database file size in bytes
|
|
447
|
+
*/
|
|
448
|
+
getSize() {
|
|
449
|
+
const stats = fs.statSync(this.dbPath);
|
|
450
|
+
return stats.size;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Size of the `-wal` sidecar file in bytes. 0 when it doesn't exist (non-WAL
|
|
454
|
+
* journal mode, in-memory DB, or no write since the last checkpoint+reset).
|
|
455
|
+
*/
|
|
456
|
+
getWalSizeBytes() {
|
|
457
|
+
if (!this.dbPath || this.dbPath === ':memory:')
|
|
458
|
+
return 0;
|
|
459
|
+
try {
|
|
460
|
+
return fs.statSync(`${this.dbPath}-wal`).size;
|
|
461
|
+
}
|
|
462
|
+
catch {
|
|
463
|
+
return 0;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/** Size of the main DB file in bytes (0 for in-memory/unknown) — the WAL
|
|
467
|
+
* valve scales its fold caps with it (resolveWalValveMb). */
|
|
468
|
+
getDbFileSizeBytes() {
|
|
469
|
+
if (!this.dbPath || this.dbPath === ':memory:')
|
|
470
|
+
return 0;
|
|
471
|
+
try {
|
|
472
|
+
return fs.statSync(this.dbPath).size;
|
|
473
|
+
}
|
|
474
|
+
catch {
|
|
475
|
+
return 0;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
/** Current `wal_autocheckpoint` interval in pages (0 = disabled). */
|
|
479
|
+
getWalAutocheckpoint() {
|
|
480
|
+
const v = this.db.pragma('wal_autocheckpoint', { simple: true });
|
|
481
|
+
const n = Number(v);
|
|
482
|
+
return Number.isFinite(n) ? n : 0;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Set the connection's `wal_autocheckpoint` interval (pages; 0 disables).
|
|
486
|
+
* Bulk indexing defers checkpoints entirely (#1231): the default 1000-page
|
|
487
|
+
* auto-checkpoint re-writes hot B-tree/FTS pages into the main DB file over
|
|
488
|
+
* and over — measured at ~95% of ALL disk I/O during a bulk index, and the
|
|
489
|
+
* difference between 45s and 19+ minutes on HDD-class storage. During
|
|
490
|
+
* deferral a {@link WalCheckpointValve} bounds WAL growth off-thread.
|
|
491
|
+
*/
|
|
492
|
+
setWalAutocheckpoint(pages) {
|
|
493
|
+
this.db.pragma(`wal_autocheckpoint = ${Math.max(0, Math.floor(pages))}`);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* `PRAGMA wal_checkpoint(PASSIVE)` on a worker thread with its own
|
|
497
|
+
* connection. PASSIVE never blocks the writer, and running it off-thread
|
|
498
|
+
* means the main thread — and the #850 watchdog heartbeat — keep turning
|
|
499
|
+
* even when the backfill is minutes of I/O on slow storage (a synchronous
|
|
500
|
+
* checkpoint that exceeds the watchdog's 60s window gets a healthy index
|
|
501
|
+
* SIGKILLed — observed in the #1231 repro).
|
|
502
|
+
*
|
|
503
|
+
* Returns SQLite's checkpoint result row — `log === checkpointed` with
|
|
504
|
+
* `busy === 0` means the ENTIRE WAL was backfilled, so the writer's next
|
|
505
|
+
* commit restarts the WAL from the top and the file stops growing. The
|
|
506
|
+
* WAL valve needs that signal because a WAL file's SIZE never shrinks:
|
|
507
|
+
* after the first wrap, raw file size says nothing about the un-backfilled
|
|
508
|
+
* backlog. Best-effort: returns null on any failure (including worker
|
|
509
|
+
* threads being unavailable — a potentially minutes-long checkpoint must
|
|
510
|
+
* never run inline on the main thread).
|
|
511
|
+
*/
|
|
512
|
+
async checkpointWalPassive() {
|
|
513
|
+
return this.checkpointWal('PASSIVE');
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* `PRAGMA wal_checkpoint(TRUNCATE)` — same off-thread pattern as PASSIVE,
|
|
517
|
+
* but on success the WAL FILE is chopped to zero. A completed passive
|
|
518
|
+
* backfill bounds the un-checkpointed backlog, yet the FILE only stops
|
|
519
|
+
* growing when a commit finds ZERO readers holding WAL marks — rare while
|
|
520
|
+
* pool workers cycle, so at kernel scale a fully-backfilled WAL still
|
|
521
|
+
* accreted the phase's whole write volume on disk (§7a.1: 22GB). The valve
|
|
522
|
+
* calls this exactly at a parked barrier (writer parked, pool drained,
|
|
523
|
+
* backfill complete) where the no-reader condition is guaranteed rather
|
|
524
|
+
* than lucky. The worker sets a short busy_timeout so a racing reader
|
|
525
|
+
* degrades this to a no-op (busy=1) instead of a stall.
|
|
526
|
+
*/
|
|
527
|
+
async checkpointWalTruncate() {
|
|
528
|
+
return this.checkpointWal('TRUNCATE');
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Shrink a leftover oversized WAL (#1431). A SIGKILL'd session — the #850
|
|
532
|
+
* liveness watchdog, OOM, a crash — leaves its WAL on disk, the next session
|
|
533
|
+
* appends to the same file, and (pre-#1431) nothing ever truncated it:
|
|
534
|
+
* PASSIVE checkpoints fold frames but keep the file at its high-water mark,
|
|
535
|
+
* and the one shrinking path (a clean last-connection close) is exactly what
|
|
536
|
+
* the killed world never takes. Unbounded growth until the disk fills.
|
|
537
|
+
*
|
|
538
|
+
* Called fire-and-forget from every `open()`: cost is one statSync when the
|
|
539
|
+
* WAL is small (the overwhelmingly common case). Past the threshold it runs
|
|
540
|
+
* the off-thread PASSIVE fold then TRUNCATE — both on worker connections
|
|
541
|
+
* with a busy_timeout, so a racing writer degrades this to a no-op that the
|
|
542
|
+
* next open retries rather than a stall.
|
|
543
|
+
*/
|
|
544
|
+
async healOversizedWal() {
|
|
545
|
+
const beforeBytes = this.getWalSizeBytes();
|
|
546
|
+
if (beforeBytes <= exports.WAL_HEAL_THRESHOLD_BYTES) {
|
|
547
|
+
return { healed: false, beforeBytes, afterBytes: beforeBytes };
|
|
548
|
+
}
|
|
549
|
+
// Single-flight: open() fires this fire-and-forget and callers may also
|
|
550
|
+
// invoke it explicitly. Two concurrent passes DEFEAT each other — each
|
|
551
|
+
// checkpoint worker sees the other as a busy reader and no-ops — so share
|
|
552
|
+
// one in-flight pass instead of racing.
|
|
553
|
+
this.walHeal ??= this.runWalHeal(beforeBytes).finally(() => { this.walHeal = null; });
|
|
554
|
+
return this.walHeal;
|
|
555
|
+
}
|
|
556
|
+
walHeal = null;
|
|
557
|
+
async runWalHeal(beforeBytes) {
|
|
558
|
+
// A racing reader/writer (another session healing the same file, a query
|
|
559
|
+
// pool warming up) degrades a checkpoint pass to a busy no-op — retry a
|
|
560
|
+
// few times before leaving the rest to the next open.
|
|
561
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
562
|
+
if (attempt > 0)
|
|
563
|
+
await new Promise((r) => setTimeout(r, 300));
|
|
564
|
+
await this.checkpointWalPassive();
|
|
565
|
+
await this.checkpointWalTruncate();
|
|
566
|
+
if (this.getWalSizeBytes() <= exports.WAL_HEAL_THRESHOLD_BYTES)
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
const afterBytes = this.getWalSizeBytes();
|
|
570
|
+
if (process.env.CODEGRAPH_WAL_VALVE_DEBUG) {
|
|
571
|
+
console.error(`[wal-heal] oversized WAL at open: ${Math.round(beforeBytes / (1024 * 1024))}MB -> ${Math.round(afterBytes / (1024 * 1024))}MB`);
|
|
572
|
+
}
|
|
573
|
+
return { healed: afterBytes < beforeBytes, beforeBytes, afterBytes };
|
|
574
|
+
}
|
|
575
|
+
async checkpointWal(mode) {
|
|
576
|
+
if (!this.dbPath || this.dbPath === ':memory:') {
|
|
577
|
+
try {
|
|
578
|
+
const row = this.db.prepare(`PRAGMA wal_checkpoint(${mode})`).get();
|
|
579
|
+
return row ? { busy: Number(row.busy), log: Number(row.log), checkpointed: Number(row.checkpointed) } : null;
|
|
580
|
+
}
|
|
581
|
+
catch {
|
|
582
|
+
return null;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
try {
|
|
586
|
+
const { Worker } = await Promise.resolve().then(() => __importStar(require('node:worker_threads')));
|
|
587
|
+
const workerSource = `
|
|
588
|
+
const { workerData, parentPort } = require('node:worker_threads');
|
|
589
|
+
let row = null;
|
|
590
|
+
let err = null;
|
|
591
|
+
try {
|
|
592
|
+
const { DatabaseSync } = require('node:sqlite');
|
|
593
|
+
const db = new DatabaseSync(workerData.dbPath);
|
|
594
|
+
const mode = workerData.mode === 'TRUNCATE' ? 'TRUNCATE' : 'PASSIVE';
|
|
595
|
+
try {
|
|
596
|
+
if (mode === 'TRUNCATE') db.exec('PRAGMA busy_timeout = 2000');
|
|
597
|
+
row = db.prepare('PRAGMA wal_checkpoint(' + mode + ')').get();
|
|
598
|
+
} catch (e) { err = String(e && e.message || e); }
|
|
599
|
+
try { db.close(); } catch {}
|
|
600
|
+
} catch (e) { err = err || String(e && e.message || e); }
|
|
601
|
+
parentPort.postMessage({ row, err });
|
|
602
|
+
`;
|
|
603
|
+
return await new Promise((resolve) => {
|
|
604
|
+
let settled = false;
|
|
605
|
+
const finish = (row) => {
|
|
606
|
+
if (settled)
|
|
607
|
+
return;
|
|
608
|
+
settled = true;
|
|
609
|
+
resolve(row ? { busy: Number(row.busy), log: Number(row.log), checkpointed: Number(row.checkpointed) } : null);
|
|
610
|
+
};
|
|
611
|
+
try {
|
|
612
|
+
const worker = new Worker(workerSource, { eval: true, workerData: { dbPath: this.dbPath, mode } });
|
|
613
|
+
worker.once('message', (m) => {
|
|
614
|
+
if (m?.err && process.env.CODEGRAPH_WAL_VALVE_DEBUG) {
|
|
615
|
+
console.error(`[wal-valve] checkpoint worker (${mode}): ${m.err}`);
|
|
616
|
+
}
|
|
617
|
+
void worker.terminate();
|
|
618
|
+
finish(m?.row ?? null);
|
|
619
|
+
});
|
|
620
|
+
worker.once('error', () => { void worker.terminate(); finish(null); });
|
|
621
|
+
worker.once('exit', () => finish(null));
|
|
622
|
+
}
|
|
623
|
+
catch {
|
|
624
|
+
finish(null);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
catch {
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Optimize database (vacuum and analyze)
|
|
634
|
+
*/
|
|
635
|
+
optimize() {
|
|
636
|
+
this.db.exec('VACUUM');
|
|
637
|
+
this.db.exec('ANALYZE');
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Lightweight maintenance to run after bulk writes (indexAll, sync).
|
|
641
|
+
* Two operations:
|
|
642
|
+
*
|
|
643
|
+
* - `PRAGMA optimize` — incremental ANALYZE; SQLite only re-analyzes
|
|
644
|
+
* tables whose row counts changed materially since the last
|
|
645
|
+
* ANALYZE. Without it, the query planner has no statistics on the
|
|
646
|
+
* freshly-bulk-loaded tables and can pick suboptimal indexes.
|
|
647
|
+
*
|
|
648
|
+
* - `PRAGMA wal_checkpoint(PASSIVE)` — fold pending WAL pages back
|
|
649
|
+
* into the main database file so the WAL file doesn't grow
|
|
650
|
+
* unboundedly between automatic checkpoints (auto-fires at 1000
|
|
651
|
+
* pages by default; large indexAll runs blow past that).
|
|
652
|
+
*
|
|
653
|
+
* Runs on a WORKER THREAD with its own connection: on a multi-GB index
|
|
654
|
+
* these pragmas are minutes of synchronous IO (a 95k-file kernel index
|
|
655
|
+
* left a 593MB WAL whose checkpoint alone blew the #850 watchdog's 60s
|
|
656
|
+
* window and got a COMPLETED index SIGKILLed at the finish line). WAL
|
|
657
|
+
* checkpointing from a second connection is standard SQLite; `PRAGMA
|
|
658
|
+
* optimize` persists its statistics in sqlite_stat tables, so the main
|
|
659
|
+
* connection benefits the same. The main thread just awaits a message,
|
|
660
|
+
* so the event loop — and the watchdog heartbeat — keep turning.
|
|
661
|
+
*
|
|
662
|
+
* Everything is silently swallowed on failure — best-effort
|
|
663
|
+
* optimization, never load-bearing for correctness. If worker threads
|
|
664
|
+
* are unavailable, falls back to a bounded in-line `PRAGMA optimize`
|
|
665
|
+
* and SKIPS the checkpoint (the final close() checkpoints after the
|
|
666
|
+
* CLI has already disarmed its watchdog).
|
|
667
|
+
*/
|
|
668
|
+
async runMaintenance() {
|
|
669
|
+
// In-memory / test databases: nothing worth a worker round-trip.
|
|
670
|
+
if (!this.dbPath || this.dbPath === ':memory:') {
|
|
671
|
+
try {
|
|
672
|
+
this.db.exec('PRAGMA optimize');
|
|
673
|
+
}
|
|
674
|
+
catch { /* ignore */ }
|
|
675
|
+
try {
|
|
676
|
+
this.db.exec('PRAGMA wal_checkpoint(PASSIVE)');
|
|
677
|
+
}
|
|
678
|
+
catch { /* ignore */ }
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
await this.runPragmasOffThread(['PRAGMA analysis_limit=1000', 'PRAGMA optimize', 'PRAGMA wal_checkpoint(PASSIVE)'],
|
|
682
|
+
// Worker threads unavailable — bounded in-line fallback, no checkpoint.
|
|
683
|
+
['PRAGMA analysis_limit=1000', 'PRAGMA optimize']);
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Run pragmas on a worker thread against its own connection to this DB
|
|
687
|
+
* (shared machinery for {@link runMaintenance} and
|
|
688
|
+
* {@link checkpointWalPassive}). Each pragma is individually best-effort;
|
|
689
|
+
* the whole call is best-effort. `inlineFallback` (if any) runs on THIS
|
|
690
|
+
* connection only when worker threads are unavailable — keep it to pragmas
|
|
691
|
+
* that are safe to run synchronously on the main thread.
|
|
692
|
+
*/
|
|
693
|
+
async runPragmasOffThread(pragmas, inlineFallback = []) {
|
|
694
|
+
try {
|
|
695
|
+
const { Worker } = await Promise.resolve().then(() => __importStar(require('node:worker_threads')));
|
|
696
|
+
const workerSource = `
|
|
697
|
+
const { workerData, parentPort } = require('node:worker_threads');
|
|
698
|
+
try {
|
|
699
|
+
const { DatabaseSync } = require('node:sqlite');
|
|
700
|
+
const db = new DatabaseSync(workerData.dbPath);
|
|
701
|
+
for (const p of workerData.pragmas) { try { db.exec(p); } catch {} }
|
|
702
|
+
try { db.close(); } catch {}
|
|
703
|
+
} catch {}
|
|
704
|
+
parentPort.postMessage('done');
|
|
705
|
+
`;
|
|
706
|
+
await new Promise((resolve) => {
|
|
707
|
+
let settled = false;
|
|
708
|
+
const finish = () => {
|
|
709
|
+
if (!settled) {
|
|
710
|
+
settled = true;
|
|
711
|
+
resolve();
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
try {
|
|
715
|
+
const worker = new Worker(workerSource, { eval: true, workerData: { dbPath: this.dbPath, pragmas } });
|
|
716
|
+
worker.once('message', () => { void worker.terminate(); finish(); });
|
|
717
|
+
worker.once('error', () => { void worker.terminate(); finish(); });
|
|
718
|
+
worker.once('exit', finish);
|
|
719
|
+
}
|
|
720
|
+
catch {
|
|
721
|
+
finish();
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
catch {
|
|
726
|
+
for (const p of inlineFallback) {
|
|
727
|
+
try {
|
|
728
|
+
this.db.exec(p);
|
|
729
|
+
}
|
|
730
|
+
catch { /* ignore */ }
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Close the database connection
|
|
736
|
+
*/
|
|
737
|
+
close() {
|
|
738
|
+
this.db.close();
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Check if the database connection is open
|
|
742
|
+
*/
|
|
743
|
+
isOpen() {
|
|
744
|
+
return this.db.open;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* True when the DB file at our path has been REPLACED on disk since we opened
|
|
748
|
+
* it — a different inode now lives at the same path, so the fd we still hold
|
|
749
|
+
* points at a now-unlinked inode that can never receive new writes (#925).
|
|
750
|
+
* The trigger is removing and recreating `.codegraph/` at the same path under
|
|
751
|
+
* a long-lived process (`git worktree remove` + re-add, or `rm -rf
|
|
752
|
+
* .codegraph` + `codegraph init`). Returns false when the inode is unchanged,
|
|
753
|
+
* when the file is momentarily absent (mid-recreate — nothing to reopen onto
|
|
754
|
+
* yet), or when the platform doesn't report a usable inode (Windows can't
|
|
755
|
+
* unlink an open file and its st_ino is unreliable, so this never fires there).
|
|
756
|
+
*/
|
|
757
|
+
isReplacedOnDisk() {
|
|
758
|
+
if (this.openedInode === null)
|
|
759
|
+
return false;
|
|
760
|
+
const current = statInode(this.dbPath);
|
|
761
|
+
return current !== null && current !== this.openedInode;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
exports.DatabaseConnection = DatabaseConnection;
|
|
765
|
+
/**
|
|
766
|
+
* `dev:ino` for a path, or null if it can't be stat'd or the platform doesn't
|
|
767
|
+
* report a usable inode. Windows st_ino is unreliable across handle reopens, so
|
|
768
|
+
* we deliberately return null there — the deleted-but-open-inode hazard this
|
|
769
|
+
* guards (#925) is a POSIX file-semantics issue that doesn't arise on Windows
|
|
770
|
+
* (an open file can't be unlinked).
|
|
771
|
+
*/
|
|
772
|
+
function statInode(p) {
|
|
773
|
+
if (process.platform === 'win32')
|
|
774
|
+
return null;
|
|
775
|
+
try {
|
|
776
|
+
const s = fs.statSync(p);
|
|
777
|
+
return `${s.dev}:${s.ino}`;
|
|
778
|
+
}
|
|
779
|
+
catch {
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Default database filename
|
|
785
|
+
*/
|
|
786
|
+
exports.DATABASE_FILENAME = 'codegraph.db';
|
|
787
|
+
/**
|
|
788
|
+
* SQLite's sidecar files in WAL mode — the write-ahead log and its shared-memory
|
|
789
|
+
* index. They sit beside the main DB file and are removed alongside it when the
|
|
790
|
+
* database is discarded (see `removeDatabaseFiles`).
|
|
791
|
+
*/
|
|
792
|
+
const WAL_SIDECAR_SUFFIXES = ['-wal', '-shm'];
|
|
793
|
+
/**
|
|
794
|
+
* Get the default database path for a project
|
|
795
|
+
*/
|
|
796
|
+
function getDatabasePath(projectRoot) {
|
|
797
|
+
return path.join((0, directory_1.getCodeGraphDir)(projectRoot), exports.DATABASE_FILENAME);
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Delete a database file and its WAL sidecars (`-wal`/`-shm`).
|
|
801
|
+
*
|
|
802
|
+
* This is how a FULL re-index discards an existing database — rather than
|
|
803
|
+
* opening the old graph and DELETE-ing every row. On a large or pre-fix
|
|
804
|
+
* poisoned index (e.g. an old graph that scanned an ignored gitlink corpus into
|
|
805
|
+
* ~1.6M nodes with a multi-GB WAL, #1065) the per-row `nodes_fts` delete-trigger
|
|
806
|
+
* churn blocks the main thread long enough to trip the #850 liveness watchdog
|
|
807
|
+
* before indexing even starts, so the rebuild could never recover the bad state
|
|
808
|
+
* (#1067). Unlinking is O(1) regardless of DB size and also reclaims the disk
|
|
809
|
+
* the bloated WAL would otherwise keep.
|
|
810
|
+
*
|
|
811
|
+
* POSIX removes the directory entry even while another process (a daemon/MCP
|
|
812
|
+
* server) still holds the file open; that holder heals via `reopenIfReplaced`
|
|
813
|
+
* (#925). On Windows a live holder can make the unlink fail with EBUSY/EPERM —
|
|
814
|
+
* that is thrown for the caller to surface ("stop the other process and retry").
|
|
815
|
+
* The `-wal`/`-shm` sidecars are best-effort: SQLite recreates them on the next
|
|
816
|
+
* open, so a leftover sidecar is harmless.
|
|
817
|
+
*/
|
|
818
|
+
function removeDatabaseFiles(dbPath) {
|
|
819
|
+
// The main DB file first — its removal is the operation that must succeed (or
|
|
820
|
+
// report why it couldn't). force:true treats an already-missing file as done.
|
|
821
|
+
fs.rmSync(dbPath, { force: true });
|
|
822
|
+
for (const suffix of WAL_SIDECAR_SUFFIXES) {
|
|
823
|
+
try {
|
|
824
|
+
fs.rmSync(dbPath + suffix, { force: true });
|
|
825
|
+
}
|
|
826
|
+
catch {
|
|
827
|
+
// A sidecar still held/locked is harmless — SQLite rebuilds it on open.
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
//# sourceMappingURL=index.js.map
|