homegraph 1.5.7 → 1.5.8
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/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/dist/bin/homegraph.js +16 -14
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +11 -25
- package/dist/db/queries.d.ts +5 -1
- package/dist/db/queries.js +31 -2
- package/dist/db/sqlite-adapter.d.ts +6 -12
- package/dist/db/sqlite-adapter.js +13 -41
- package/dist/directory.d.ts +1 -1
- package/dist/directory.js +25 -1
- package/dist/extraction/grammars.d.ts +2 -0
- package/dist/extraction/grammars.js +7 -7
- package/dist/graph/evidence-paths.d.ts +63 -0
- package/dist/graph/evidence-paths.js +245 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +55 -17
- package/dist/mcp/arkts-evidence-packs.d.ts +67 -0
- package/dist/mcp/arkts-evidence-packs.js +352 -0
- package/dist/mcp/daemon.js +1 -1
- package/dist/mcp/engine.d.ts +20 -7
- package/dist/mcp/engine.js +113 -106
- package/dist/mcp/index-availability.d.ts +23 -0
- package/dist/mcp/index-availability.js +78 -0
- package/dist/mcp/index.js +5 -4
- package/dist/mcp/query-cache.d.ts +1 -1
- package/dist/mcp/query-cache.js +6 -2
- package/dist/mcp/query-worker.d.ts +1 -1
- package/dist/mcp/query-worker.js +1 -1
- package/dist/mcp/server-instructions.d.ts +4 -9
- package/dist/mcp/server-instructions.js +34 -74
- package/dist/mcp/session.js +12 -4
- package/dist/mcp/source-slice-identity.d.ts +3 -0
- package/dist/mcp/source-slice-identity.js +11 -0
- package/dist/mcp/tools.d.ts +24 -6
- package/dist/mcp/tools.js +201 -80
- package/dist/spec/llm/client.js +3 -15
- package/dist/spec/llm/openai-sdk.d.ts +14 -0
- package/dist/spec/llm/openai-sdk.js +37 -0
- package/dist/spec/llm/retry.js +8 -9
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +24 -0
- package/package.json +3 -5
- package/dist/addons/dynamic-import.d.ts.map +0 -1
- package/dist/addons/dynamic-import.js.map +0 -1
- package/dist/addons/init-template.d.ts.map +0 -1
- package/dist/addons/init-template.js.map +0 -1
- package/dist/addons/loader.d.ts.map +0 -1
- package/dist/addons/loader.js.map +0 -1
- package/dist/addons/manager.d.ts.map +0 -1
- package/dist/addons/manager.js.map +0 -1
- package/dist/addons/paths.d.ts.map +0 -1
- package/dist/addons/paths.js.map +0 -1
- package/dist/addons/registry.d.ts.map +0 -1
- package/dist/addons/registry.js.map +0 -1
- package/dist/addons/semver.d.ts.map +0 -1
- package/dist/addons/semver.js.map +0 -1
- package/dist/addons/types.d.ts.map +0 -1
- package/dist/addons/types.js.map +0 -1
- package/dist/addons/validate.d.ts.map +0 -1
- package/dist/addons/validate.js.map +0 -1
- package/dist/arkui/index.d.ts.map +0 -1
- package/dist/arkui/index.js.map +0 -1
- package/dist/arkui/migrate-passage.d.ts.map +0 -1
- package/dist/arkui/migrate-passage.js.map +0 -1
- package/dist/arkui/migrate-semantics.d.ts.map +0 -1
- package/dist/arkui/migrate-semantics.js.map +0 -1
- package/dist/arkui/migrate-snapshot.d.ts.map +0 -1
- package/dist/arkui/migrate-snapshot.js.map +0 -1
- package/dist/bin/addon-commands.d.ts.map +0 -1
- package/dist/bin/addon-commands.js.map +0 -1
- package/dist/bin/command-supervision.d.ts.map +0 -1
- package/dist/bin/command-supervision.js.map +0 -1
- package/dist/bin/fatal-handler.d.ts.map +0 -1
- package/dist/bin/fatal-handler.js.map +0 -1
- package/dist/bin/homegraph.d.ts.map +0 -1
- package/dist/bin/homegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js.map +0 -1
- package/dist/context/markers.d.ts.map +0 -1
- package/dist/context/markers.js.map +0 -1
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js.map +0 -1
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/db/wal-valve.d.ts.map +0 -1
- package/dist/db/wal-valve.js.map +0 -1
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/extraction/arkts-batch-worker.d.ts.map +0 -1
- package/dist/extraction/arkts-batch-worker.js.map +0 -1
- package/dist/extraction/astro-extractor.d.ts.map +0 -1
- package/dist/extraction/astro-extractor.js.map +0 -1
- package/dist/extraction/cfml-extractor.d.ts.map +0 -1
- package/dist/extraction/cfml-extractor.js.map +0 -1
- package/dist/extraction/context.d.ts.map +0 -1
- package/dist/extraction/context.js.map +0 -1
- package/dist/extraction/default-ignore.d.ts.map +0 -1
- package/dist/extraction/default-ignore.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/extraction-version.d.ts.map +0 -1
- package/dist/extraction/extraction-version.js.map +0 -1
- package/dist/extraction/function-ref.d.ts.map +0 -1
- package/dist/extraction/function-ref.js.map +0 -1
- package/dist/extraction/generated-detection.d.ts.map +0 -1
- package/dist/extraction/generated-detection.js.map +0 -1
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/arkts.d.ts.map +0 -1
- package/dist/extraction/languages/arkts.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/cfquery.d.ts.map +0 -1
- package/dist/extraction/languages/cfquery.js.map +0 -1
- package/dist/extraction/languages/cfscript.d.ts.map +0 -1
- package/dist/extraction/languages/cfscript.js.map +0 -1
- package/dist/extraction/languages/cobol.d.ts.map +0 -1
- package/dist/extraction/languages/cobol.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/erlang.d.ts.map +0 -1
- package/dist/extraction/languages/erlang.js.map +0 -1
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/lua.d.ts.map +0 -1
- package/dist/extraction/languages/lua.js.map +0 -1
- package/dist/extraction/languages/luau.d.ts.map +0 -1
- package/dist/extraction/languages/luau.js.map +0 -1
- package/dist/extraction/languages/nix.d.ts.map +0 -1
- package/dist/extraction/languages/nix.js.map +0 -1
- package/dist/extraction/languages/objc.d.ts.map +0 -1
- package/dist/extraction/languages/objc.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/r.d.ts.map +0 -1
- package/dist/extraction/languages/r.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/solidity.d.ts.map +0 -1
- package/dist/extraction/languages/solidity.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/terraform.d.ts.map +0 -1
- package/dist/extraction/languages/terraform.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/languages/vbnet.d.ts.map +0 -1
- package/dist/extraction/languages/vbnet.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/mybatis-extractor.d.ts.map +0 -1
- package/dist/extraction/mybatis-extractor.js.map +0 -1
- package/dist/extraction/parse-pool.d.ts.map +0 -1
- package/dist/extraction/parse-pool.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/razor-extractor.d.ts.map +0 -1
- package/dist/extraction/razor-extractor.js.map +0 -1
- package/dist/extraction/store-worker.d.ts.map +0 -1
- package/dist/extraction/store-worker.js.map +0 -1
- package/dist/extraction/store-writer.d.ts.map +0 -1
- package/dist/extraction/store-writer.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts.map +0 -1
- package/dist/extraction/wasm-runtime-flags.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js.map +0 -1
- package/dist/graph-sources.d.ts.map +0 -1
- package/dist/graph-sources.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/antigravity.d.ts.map +0 -1
- package/dist/installer/targets/antigravity.js.map +0 -1
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codebuddy.d.ts.map +0 -1
- package/dist/installer/targets/codebuddy.js.map +0 -1
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/deveco.d.ts.map +0 -1
- package/dist/installer/targets/deveco.js.map +0 -1
- package/dist/installer/targets/gemini.d.ts.map +0 -1
- package/dist/installer/targets/gemini.js.map +0 -1
- package/dist/installer/targets/hermes.d.ts.map +0 -1
- package/dist/installer/targets/hermes.js.map +0 -1
- package/dist/installer/targets/kiro.d.ts.map +0 -1
- package/dist/installer/targets/kiro.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/daemon-manager.d.ts.map +0 -1
- package/dist/mcp/daemon-manager.js.map +0 -1
- package/dist/mcp/daemon-paths.d.ts.map +0 -1
- package/dist/mcp/daemon-paths.js.map +0 -1
- package/dist/mcp/daemon-registry.d.ts.map +0 -1
- package/dist/mcp/daemon-registry.js.map +0 -1
- package/dist/mcp/daemon.d.ts.map +0 -1
- package/dist/mcp/daemon.js.map +0 -1
- package/dist/mcp/diff-impact.d.ts.map +0 -1
- package/dist/mcp/diff-impact.js.map +0 -1
- package/dist/mcp/dynamic-boundaries.d.ts.map +0 -1
- package/dist/mcp/dynamic-boundaries.js.map +0 -1
- package/dist/mcp/early-ppid.d.ts.map +0 -1
- package/dist/mcp/early-ppid.js.map +0 -1
- package/dist/mcp/engine.d.ts.map +0 -1
- package/dist/mcp/engine.js.map +0 -1
- package/dist/mcp/evidence-rendering.d.ts.map +0 -1
- package/dist/mcp/evidence-rendering.js.map +0 -1
- package/dist/mcp/explore-dedup.d.ts.map +0 -1
- package/dist/mcp/explore-dedup.js.map +0 -1
- package/dist/mcp/explore-repeat-guard.d.ts.map +0 -1
- package/dist/mcp/explore-repeat-guard.js.map +0 -1
- package/dist/mcp/explore-session-state.d.ts.map +0 -1
- package/dist/mcp/explore-session-state.js.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/liveness-watchdog.d.ts.map +0 -1
- package/dist/mcp/liveness-watchdog.js.map +0 -1
- package/dist/mcp/memory-budget.d.ts.map +0 -1
- package/dist/mcp/memory-budget.js.map +0 -1
- package/dist/mcp/ppid-watchdog.d.ts.map +0 -1
- package/dist/mcp/ppid-watchdog.js.map +0 -1
- package/dist/mcp/proxy.d.ts.map +0 -1
- package/dist/mcp/proxy.js.map +0 -1
- package/dist/mcp/query-cache.d.ts.map +0 -1
- package/dist/mcp/query-cache.js.map +0 -1
- package/dist/mcp/query-pool.d.ts.map +0 -1
- package/dist/mcp/query-pool.js.map +0 -1
- package/dist/mcp/query-worker.d.ts.map +0 -1
- package/dist/mcp/query-worker.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/session.d.ts.map +0 -1
- package/dist/mcp/session.js.map +0 -1
- package/dist/mcp/startup-handshake.d.ts.map +0 -1
- package/dist/mcp/startup-handshake.js.map +0 -1
- package/dist/mcp/stdin-teardown.d.ts.map +0 -1
- package/dist/mcp/stdin-teardown.js.map +0 -1
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js.map +0 -1
- package/dist/mcp/version.d.ts.map +0 -1
- package/dist/mcp/version.js.map +0 -1
- package/dist/project-config.d.ts.map +0 -1
- package/dist/project-config.js.map +0 -1
- package/dist/project-map/index.d.ts.map +0 -1
- package/dist/project-map/index.js.map +0 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +0 -1
- package/dist/resolution/c-fnptr-synthesizer.js.map +0 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +0 -1
- package/dist/resolution/callback-synthesizer.js.map +0 -1
- package/dist/resolution/cooperative-yield.d.ts.map +0 -1
- package/dist/resolution/cooperative-yield.js.map +0 -1
- package/dist/resolution/frameworks/arkts-entry.d.ts.map +0 -1
- package/dist/resolution/frameworks/arkts-entry.js.map +0 -1
- package/dist/resolution/frameworks/arkts-napi.d.ts.map +0 -1
- package/dist/resolution/frameworks/arkts-napi.js.map +0 -1
- package/dist/resolution/frameworks/astro.d.ts.map +0 -1
- package/dist/resolution/frameworks/astro.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/cics.d.ts.map +0 -1
- package/dist/resolution/frameworks/cics.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/drupal.d.ts.map +0 -1
- package/dist/resolution/frameworks/drupal.js.map +0 -1
- package/dist/resolution/frameworks/expo-modules.d.ts.map +0 -1
- package/dist/resolution/frameworks/expo-modules.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/fabric.d.ts.map +0 -1
- package/dist/resolution/frameworks/fabric.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/goframe.d.ts.map +0 -1
- package/dist/resolution/frameworks/goframe.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/nestjs.d.ts.map +0 -1
- package/dist/resolution/frameworks/nestjs.js.map +0 -1
- package/dist/resolution/frameworks/play.d.ts.map +0 -1
- package/dist/resolution/frameworks/play.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react-native.d.ts.map +0 -1
- package/dist/resolution/frameworks/react-native.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift-objc.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift-objc.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/terraform.d.ts.map +0 -1
- package/dist/resolution/frameworks/terraform.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/go-module.d.ts.map +0 -1
- package/dist/resolution/go-module.js.map +0 -1
- package/dist/resolution/goframe-synthesizer.d.ts.map +0 -1
- package/dist/resolution/goframe-synthesizer.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/lru-cache.d.ts.map +0 -1
- package/dist/resolution/lru-cache.js.map +0 -1
- package/dist/resolution/memory-budget.d.ts.map +0 -1
- package/dist/resolution/memory-budget.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/resolver-pool.d.ts.map +0 -1
- package/dist/resolution/resolver-pool.js.map +0 -1
- package/dist/resolution/resolver-worker.d.ts.map +0 -1
- package/dist/resolution/resolver-worker.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/swift-objc-bridge.d.ts.map +0 -1
- package/dist/resolution/swift-objc-bridge.js.map +0 -1
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js.map +0 -1
- package/dist/resolution/workspace-packages.d.ts.map +0 -1
- package/dist/resolution/workspace-packages.js.map +0 -1
- package/dist/search/identifier-segments.d.ts.map +0 -1
- package/dist/search/identifier-segments.js.map +0 -1
- package/dist/search/literal-evidence.d.ts.map +0 -1
- package/dist/search/literal-evidence.js.map +0 -1
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-plan-provider.d.ts.map +0 -1
- package/dist/search/query-plan-provider.js.map +0 -1
- package/dist/search/query-plan.d.ts.map +0 -1
- package/dist/search/query-plan.js.map +0 -1
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js.map +0 -1
- package/dist/spec/build/diff-parser.d.ts.map +0 -1
- package/dist/spec/build/diff-parser.js.map +0 -1
- package/dist/spec/build/pipeline.d.ts.map +0 -1
- package/dist/spec/build/pipeline.js.map +0 -1
- package/dist/spec/build/scan.d.ts.map +0 -1
- package/dist/spec/build/scan.js.map +0 -1
- package/dist/spec/build/scope-resolver.d.ts.map +0 -1
- package/dist/spec/build/scope-resolver.js.map +0 -1
- package/dist/spec/build/spec-extractor.d.ts.map +0 -1
- package/dist/spec/build/spec-extractor.js.map +0 -1
- package/dist/spec/config.d.ts.map +0 -1
- package/dist/spec/config.js.map +0 -1
- package/dist/spec/db/commit-node.d.ts.map +0 -1
- package/dist/spec/db/commit-node.js.map +0 -1
- package/dist/spec/db/fragment-node.d.ts.map +0 -1
- package/dist/spec/db/fragment-node.js.map +0 -1
- package/dist/spec/db/fts.d.ts.map +0 -1
- package/dist/spec/db/fts.js.map +0 -1
- package/dist/spec/db/index.d.ts.map +0 -1
- package/dist/spec/db/index.js.map +0 -1
- package/dist/spec/db/persist.d.ts.map +0 -1
- package/dist/spec/db/persist.js.map +0 -1
- package/dist/spec/db/relations.d.ts.map +0 -1
- package/dist/spec/db/relations.js.map +0 -1
- package/dist/spec/db/schema.d.ts.map +0 -1
- package/dist/spec/db/schema.js.map +0 -1
- package/dist/spec/db/spec-node.d.ts.map +0 -1
- package/dist/spec/db/spec-node.js.map +0 -1
- package/dist/spec/db/sql-utils.d.ts.map +0 -1
- package/dist/spec/db/sql-utils.js.map +0 -1
- package/dist/spec/evolve/cluster-context.d.ts.map +0 -1
- package/dist/spec/evolve/cluster-context.js.map +0 -1
- package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +0 -1
- package/dist/spec/evolve/commit-spec-analyzer.js.map +0 -1
- package/dist/spec/evolve/commit-spec-persister.d.ts.map +0 -1
- package/dist/spec/evolve/commit-spec-persister.js.map +0 -1
- package/dist/spec/evolve/impact-locator.d.ts.map +0 -1
- package/dist/spec/evolve/impact-locator.js.map +0 -1
- package/dist/spec/evolve/pipeline.d.ts.map +0 -1
- package/dist/spec/evolve/pipeline.js.map +0 -1
- package/dist/spec/evolve/spec-rewriter.d.ts.map +0 -1
- package/dist/spec/evolve/spec-rewriter.js.map +0 -1
- package/dist/spec/git/commits.d.ts.map +0 -1
- package/dist/spec/git/commits.js.map +0 -1
- package/dist/spec/git/exec.d.ts.map +0 -1
- package/dist/spec/git/exec.js.map +0 -1
- package/dist/spec/git/index.d.ts.map +0 -1
- package/dist/spec/git/index.js.map +0 -1
- package/dist/spec/graph/index.d.ts.map +0 -1
- package/dist/spec/graph/index.js.map +0 -1
- package/dist/spec/graph/queries.d.ts.map +0 -1
- package/dist/spec/graph/queries.js.map +0 -1
- package/dist/spec/llm/agent-client.d.ts.map +0 -1
- package/dist/spec/llm/agent-client.js.map +0 -1
- package/dist/spec/llm/agents/claude-code.d.ts.map +0 -1
- package/dist/spec/llm/agents/claude-code.js.map +0 -1
- package/dist/spec/llm/agents/codex.d.ts.map +0 -1
- package/dist/spec/llm/agents/codex.js.map +0 -1
- package/dist/spec/llm/agents/detect-utils.d.ts.map +0 -1
- package/dist/spec/llm/agents/detect-utils.js.map +0 -1
- package/dist/spec/llm/agents/deveco-code.d.ts.map +0 -1
- package/dist/spec/llm/agents/deveco-code.js.map +0 -1
- package/dist/spec/llm/agents/index.d.ts.map +0 -1
- package/dist/spec/llm/agents/index.js.map +0 -1
- package/dist/spec/llm/agents/types.d.ts.map +0 -1
- package/dist/spec/llm/agents/types.js.map +0 -1
- package/dist/spec/llm/client.d.ts.map +0 -1
- package/dist/spec/llm/client.js.map +0 -1
- package/dist/spec/llm/factory.d.ts.map +0 -1
- package/dist/spec/llm/factory.js.map +0 -1
- package/dist/spec/llm/prompts.d.ts.map +0 -1
- package/dist/spec/llm/prompts.js.map +0 -1
- package/dist/spec/llm/retry.d.ts.map +0 -1
- package/dist/spec/llm/retry.js.map +0 -1
- package/dist/spec/mine/addon/adapter.d.ts.map +0 -1
- package/dist/spec/mine/addon/adapter.js.map +0 -1
- package/dist/spec/mine/addon/render.d.ts.map +0 -1
- package/dist/spec/mine/addon/render.js.map +0 -1
- package/dist/spec/mine/addon/types.d.ts.map +0 -1
- package/dist/spec/mine/addon/types.js.map +0 -1
- package/dist/spec/mine/clustering/features.d.ts.map +0 -1
- package/dist/spec/mine/clustering/features.js.map +0 -1
- package/dist/spec/mine/clustering/index.d.ts.map +0 -1
- package/dist/spec/mine/clustering/index.js.map +0 -1
- package/dist/spec/mine/clustering/leiden.d.ts.map +0 -1
- package/dist/spec/mine/clustering/leiden.js.map +0 -1
- package/dist/spec/mine/clustering/text-similarity.d.ts.map +0 -1
- package/dist/spec/mine/clustering/text-similarity.js.map +0 -1
- package/dist/spec/mine/generator.d.ts.map +0 -1
- package/dist/spec/mine/generator.js.map +0 -1
- package/dist/spec/mine/persist.d.ts.map +0 -1
- package/dist/spec/mine/persist.js.map +0 -1
- package/dist/spec/mine/pipeline.d.ts.map +0 -1
- package/dist/spec/mine/pipeline.js.map +0 -1
- package/dist/spec/mine/scanner.d.ts.map +0 -1
- package/dist/spec/mine/scanner.js.map +0 -1
- package/dist/spec/types.d.ts.map +0 -1
- package/dist/spec/types.js.map +0 -1
- package/dist/spec/ui/index.d.ts.map +0 -1
- package/dist/spec/ui/index.js.map +0 -1
- package/dist/spec/ui/progress-handler.d.ts.map +0 -1
- package/dist/spec/ui/progress-handler.js.map +0 -1
- package/dist/spec/ui/progress.d.ts.map +0 -1
- package/dist/spec/ui/progress.js.map +0 -1
- package/dist/spec/utils/fs.d.ts.map +0 -1
- package/dist/spec/utils/fs.js.map +0 -1
- package/dist/spec/utils/index.d.ts.map +0 -1
- package/dist/spec/utils/index.js.map +0 -1
- package/dist/spec/utils/meta.d.ts.map +0 -1
- package/dist/spec/utils/meta.js.map +0 -1
- package/dist/spec/utils/truncate.d.ts.map +0 -1
- package/dist/spec/utils/truncate.js.map +0 -1
- package/dist/sync/git-hooks.d.ts.map +0 -1
- package/dist/sync/git-hooks.js.map +0 -1
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watch-policy.d.ts.map +0 -1
- package/dist/sync/watch-policy.js.map +0 -1
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js.map +0 -1
- package/dist/sync/worktree.d.ts.map +0 -1
- package/dist/sync/worktree.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js.map +0 -1
- package/dist/upgrade/index.d.ts.map +0 -1
- package/dist/upgrade/index.js.map +0 -1
- package/dist/upgrade/remove-binary.d.ts.map +0 -1
- package/dist/upgrade/remove-binary.js.map +0 -1
- package/dist/upgrade/update-check.d.ts.map +0 -1
- package/dist/upgrade/update-check.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,21 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
## [1.5.8] - 2026-09-15
|
|
14
|
+
|
|
15
|
+
### Improvements
|
|
16
|
+
|
|
17
|
+
- SQLite no longer depends on optional `better-sqlite3`. Backends are **`node:sqlite`** (Node ≥22.5 with FTS5) then **`node-sqlite3-wasm`**. Install trees drop ~10 MiB of unused native-addon source when vendor/offline packaging skips `prebuild-install`. `HOMEGRAPH_SQLITE_BACKEND=native` is ignored (use `node-sqlite` or `wasm`). Prefer Node 22.5+ for WAL (Spec 0033).
|
|
18
|
+
- Published `dist/` no longer includes source maps; vendored tree-sitter grammars are copied from an explicit list (unlisted files such as leftover wasm are not shipped). The `openai` package is an optional dependency used only by spec LLM commands — install it when running `homegraph spec` against an API (`npm install openai`). MCP `serve mcp` does not require it (Spec 0031).
|
|
19
|
+
- MCP product hosts get a unified **four-state** index readiness in tool results (`empty` / `fast` / `full` / `syncing`): deep tools and `homegraph_project` return success-shaped guidance with `status=…` instead of ambiguous phase prose; `tools/list` stays fully exposed. Auto-init cold start sets `building_fast` immediately after creating the empty DB, serializes empty-DB creation with `homegraph.lock`, and opens an existing index when a concurrent init wins. **Fast build** runs in-process; **full build** continues in the same MCP/daemon process in the background (`indexAll` yields between batches — no sibling `homegraph index` CLI, so there is no second writer to lock against). SQLite busy / write-lock contention maps to `syncing` rather than `isError`. The file watcher starts after the full build finishes (Spec 0032).
|
|
20
|
+
- ArkTS exploration now finds bounded directed paths between named anchors, selecting intermediate declarations and registration sources together. Typed state/event goals, exact qualified-name recovery, ambiguity gaps and explicit stop reasons reduce missing connections without treating shared callees as a path. `HOMEGRAPH_ARKTS_QUERY_PATHS=0` restores the first-batch evidence strategy for comparison; indexing and external tool interfaces are unchanged (Spec 0030).
|
|
21
|
+
- ArkTS symbol/flow exploration now selects complete source declarations and the dependencies of static relation evidence together. Explicit gaps identify omitted, stale and unindexed evidence; output and planner budgets no longer cut these packs mid-body. Virtual ArkAnalyzer entries are excluded, cache hits validate source fingerprints, and `HOMEGRAPH_ARKTS_EVIDENCE_PACKS=0` restores legacy rendering for comparison (Spec 0029). Literal/resource and focused usages/modules/native routes retain their existing behavior.
|
|
22
|
+
|
|
23
|
+
### Fixes
|
|
24
|
+
|
|
25
|
+
- An MCP host's explicit project declaration (`--path`, or the client's `rootUri`/`workspaceFolders`) is now a **floor** for root resolution: a stray ancestor `.homegraph/` above it is never adopted. Previously a nested server walked up unbounded and could latch onto an unrelated ancestor index — observed live as a DevEco evaluation session creating `.homegraph` at a benchmark harness root, after which every nested project's daemon tried to index the entire result tree (OOM at 3.5GB in 48s) while its server was SIGKILL'd by the 60s liveness watchdog with every tool call hanging as `Connection closed`. Bare `serve mcp` and CLI commands keep the git-style unbounded walk-up; tool-level `projectPath` resolution is unchanged (Spec 0028).
|
|
26
|
+
- `homegraph_explore`'s description no longer reports `Budget: make at most 1 calls for this project (0 files indexed)` while auto-init is still building. Hosts snapshot `tools/list` once at connect, so that transient "0 files" read as terminal and agents abandoned HomeGraph for the whole session even though the index completed seconds later. The 0-file description now matches what a call actually returns: a failed build asks the agent to relay `homegraph index` to the user, an in-flight build points at `homegraph_project` and says to retry once indexing finishes, and a genuinely empty project says so honestly. Indexed repos keep the usual call-budget note unchanged (Spec 0027).
|
|
27
|
+
|
|
13
28
|
## [1.5.7] - 2026-09-09
|
|
14
29
|
|
|
15
30
|
### Fixes
|
|
@@ -19,12 +34,17 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
19
34
|
|
|
20
35
|
### Improvements
|
|
21
36
|
|
|
37
|
+
- Prefer ordinary bash/search/read for source localization and use graph tools only for an unresolved relation. Remove mandatory explore-first guidance in both MCP initialization and tool descriptions; retain indexing, query schemas and validation requirements (Spec 0028).
|
|
38
|
+
- Preserve the action and constraints in explore queries, use repository-relative paths, and optionally label node source excerpts with a content identity for trace analysis (`HOMEGRAPH_SOURCE_RECEIPTS=1`, Spec 0027).
|
|
39
|
+
|
|
22
40
|
- MCP `initialize` instructions: **single-file path-pinned edits → Read + edit, skip `homegraph_*`**; explore only when locate/cross-file is needed.
|
|
23
41
|
- Explore **defers** (`Skip HomeGraph`, kind `path-pinned-edit`) when the query names one `…/File.ext` and is a code-change shape — avoids explore context tax on 082-style tasks.
|
|
24
42
|
- Path scaffolding (`features/.../Foo.ets` + basename-as-Type) no longer counts as multi-anchor; `.ets`/`.ts`/… are not parsed as member access.
|
|
25
43
|
|
|
26
44
|
### New Features
|
|
27
45
|
|
|
46
|
+
- Standard-library Python retrieval debugger with an original-source Spatial Upscale demo, interactive steps, rules/LLM comparison, and persistent MCP/Planner evidence and error records (Spec 0025).
|
|
47
|
+
|
|
28
48
|
- Experimental structured query planning for explore (Spec 0022): shared local routing features; optional, explicitly configured one-call model intent/decomposition/rephrase; bounded dependent retrieval with a shared deadline/output budget, validated anchors, worker propagation, context hints and direction-aware cache keys. Model failures fall back locally; compact diagnostic metadata includes planning usage/time and per-step coverage. No remote model calls by default.
|
|
29
49
|
|
|
30
50
|
### Fixes
|
|
@@ -219,3 +239,4 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
219
239
|
[1.4.1]: https://gitcode.com/ProgramAnalysis/homegraph/tags/v1.4.1
|
|
220
240
|
[1.5.6]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.6
|
|
221
241
|
[1.5.7]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.7
|
|
242
|
+
[1.5.8]: https://github.com/fujiaxin-coder/homegraph/releases/tag/v1.5.8
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
### 1. 安装 CLI
|
|
17
17
|
|
|
18
|
-
需要 **Node.js 22+**(推荐 22.5+ 或 24)。SQLite 优先用内置 `node:sqlite`(≥22.5
|
|
18
|
+
需要 **Node.js 22+**(推荐 22.5+ 或 24)。SQLite 优先用内置 `node:sqlite`(≥22.5 且含 FTS5),否则回退 `node-sqlite3-wasm`。
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
npm install -g homegraph
|
|
@@ -356,7 +356,7 @@ Cursor 等项目级配置写入 `./.cursor/mcp.json`,格式相同。推荐使
|
|
|
356
356
|
|
|
357
357
|
## 环境要求
|
|
358
358
|
|
|
359
|
-
- Node.js **22+**(推荐 22.5+ 或 24;SQLite:`node:sqlite` →
|
|
359
|
+
- Node.js **22+**(推荐 22.5+ 或 24;SQLite:`node:sqlite` → wasm)
|
|
360
360
|
- 首次索引时会对项目源码做 AST 解析,大型仓库首次 `init -i` 可能需要数分钟
|
|
361
361
|
- WSL2 下若项目位于 Windows 盘符(`/mnt/c` 等)且 MCP 连接不稳定,可设置 `HOMEGRAPH_NO_DAEMON=1` 跳过共享后台服务,每个会话独立运行
|
|
362
362
|
|
package/dist/bin/homegraph.js
CHANGED
|
@@ -573,6 +573,7 @@ function main() {
|
|
|
573
573
|
.option('-f, --force', 'Index even if the path looks like your home directory or a filesystem root')
|
|
574
574
|
.option('-q, --quiet', 'Suppress progress output')
|
|
575
575
|
.option('-v, --verbose', 'Show detailed worker lifecycle and memory info')
|
|
576
|
+
.option('--inplace', 'Index into the existing database without recreating it (MCP auto-init; DB may already be open by the parent)')
|
|
576
577
|
.action(async (pathArg, options) => {
|
|
577
578
|
const projectPath = resolveProjectPath(pathArg);
|
|
578
579
|
try {
|
|
@@ -589,16 +590,13 @@ function main() {
|
|
|
589
590
|
process.exit(1);
|
|
590
591
|
}
|
|
591
592
|
const { default: HomeGraph } = await loadHomeGraph();
|
|
592
|
-
// `index` is a FULL re-index
|
|
593
|
-
//
|
|
594
|
-
//
|
|
595
|
-
//
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
// recreate() hands back a fresh, empty instance — no clear() needed. For
|
|
600
|
-
// fast incremental updates use `sync`.
|
|
601
|
-
const cg = await HomeGraph.recreate(projectPath);
|
|
593
|
+
// Default `index` is a FULL re-index via recreate(). MCP auto-init already
|
|
594
|
+
// created an empty DB and keeps it open in the parent — recreate() cannot
|
|
595
|
+
// unlink the file on Windows (EPERM) and the detached child exits with 0
|
|
596
|
+
// files (Spec 0032). `--inplace` opens the existing DB and indexAll()s.
|
|
597
|
+
const cg = options.inplace
|
|
598
|
+
? await HomeGraph.open(projectPath, { sources: 'both' })
|
|
599
|
+
: await HomeGraph.recreate(projectPath);
|
|
602
600
|
// Supervise the indexer: self-terminate if orphaned (parent shim killed)
|
|
603
601
|
// or if the main thread wedges — neither was guarded on this path (#999).
|
|
604
602
|
const supervision = (0, command_supervision_1.installCommandSupervision)('index');
|
|
@@ -809,10 +807,9 @@ function main() {
|
|
|
809
807
|
warn('The write-ahead log is larger than the database — killed sessions left it behind. It is reclaimed automatically on open; if it persists across runs, another live HomeGraph process is holding it.');
|
|
810
808
|
}
|
|
811
809
|
}
|
|
812
|
-
// Prefer node:sqlite
|
|
810
|
+
// Prefer node:sqlite; wasm is last-resort (no WAL).
|
|
813
811
|
const backendLabel = backend === 'node-sqlite' ? chalk.green('node-sqlite')
|
|
814
|
-
:
|
|
815
|
-
: chalk.yellow(`wasm ${(0, glyphs_1.getGlyphs)().dash} slower fallback; use Node 22.5+ or \`npm rebuild better-sqlite3\``);
|
|
812
|
+
: chalk.yellow(`wasm ${(0, glyphs_1.getGlyphs)().dash} slower fallback; use Node 22.5+ for built-in node:sqlite`);
|
|
816
813
|
console.log(` Backend: ${backendLabel}`);
|
|
817
814
|
const journalLabel = journalMode === 'wal'
|
|
818
815
|
? chalk.green('wal')
|
|
@@ -1415,7 +1412,12 @@ function main() {
|
|
|
1415
1412
|
* explains this to anyone who runs it by hand.
|
|
1416
1413
|
*/
|
|
1417
1414
|
async function runServeMcp(options) {
|
|
1418
|
-
|
|
1415
|
+
// An MCP host's --path is a DECLARATION of the project root, not a search
|
|
1416
|
+
// hint: resolve it literally and never walk up past it (spec 0028). A stray
|
|
1417
|
+
// ancestor .homegraph above the declared root otherwise hijacks the session
|
|
1418
|
+
// (observed as a harness-root index poisoning every nested bench project).
|
|
1419
|
+
// resolveProjectPath keeps its subdir walk-up for the human CLI subcommands.
|
|
1420
|
+
const projectPath = options.path ? path.resolve(options.path) : undefined;
|
|
1419
1421
|
// Commander sets watch=false when --no-watch is passed. Route it through
|
|
1420
1422
|
// the same env-var chokepoint the watcher and MCP server already honor.
|
|
1421
1423
|
if (options.watch === false) {
|
package/dist/db/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { SqliteDatabase, SqliteBackend } from './sqlite-adapter';
|
|
7
7
|
import { SchemaVersion } from '../types';
|
|
8
|
-
export { SqliteDatabase, SqliteBackend, WASM_FALLBACK_FIX_RECIPE, isNodeSqliteAvailable, isNodeSqliteFts5Available,
|
|
8
|
+
export { SqliteDatabase, SqliteBackend, WASM_FALLBACK_FIX_RECIPE, isNodeSqliteAvailable, isNodeSqliteFts5Available, } from './sqlite-adapter';
|
|
9
9
|
/**
|
|
10
10
|
* WAL size past which `healOversizedWal` (run at every `open`) checkpoints and
|
|
11
11
|
* truncates the file, and to which `journal_size_limit` clips the WAL after any
|
package/dist/db/index.js
CHANGED
|
@@ -38,7 +38,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
};
|
|
39
39
|
})();
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.DATABASE_FILENAME = exports.DatabaseConnection = exports.WAL_HEAL_THRESHOLD_BYTES = exports.
|
|
41
|
+
exports.DATABASE_FILENAME = exports.DatabaseConnection = exports.WAL_HEAL_THRESHOLD_BYTES = exports.isNodeSqliteFts5Available = exports.isNodeSqliteAvailable = exports.WASM_FALLBACK_FIX_RECIPE = void 0;
|
|
42
42
|
exports.resolveWalHealBytes = resolveWalHealBytes;
|
|
43
43
|
exports.getDatabasePath = getDatabasePath;
|
|
44
44
|
exports.removeDatabaseFiles = removeDatabaseFiles;
|
|
@@ -51,7 +51,6 @@ var sqlite_adapter_2 = require("./sqlite-adapter");
|
|
|
51
51
|
Object.defineProperty(exports, "WASM_FALLBACK_FIX_RECIPE", { enumerable: true, get: function () { return sqlite_adapter_2.WASM_FALLBACK_FIX_RECIPE; } });
|
|
52
52
|
Object.defineProperty(exports, "isNodeSqliteAvailable", { enumerable: true, get: function () { return sqlite_adapter_2.isNodeSqliteAvailable; } });
|
|
53
53
|
Object.defineProperty(exports, "isNodeSqliteFts5Available", { enumerable: true, get: function () { return sqlite_adapter_2.isNodeSqliteFts5Available; } });
|
|
54
|
-
Object.defineProperty(exports, "isNativeSqliteAvailable", { enumerable: true, get: function () { return sqlite_adapter_2.isNativeSqliteAvailable; } });
|
|
55
54
|
/**
|
|
56
55
|
* Apply connection-level PRAGMAs. Shared by `initialize` and `open` so the two
|
|
57
56
|
* paths can't drift.
|
|
@@ -62,9 +61,9 @@ Object.defineProperty(exports, "isNativeSqliteAvailable", { enumerable: true, ge
|
|
|
62
61
|
* the lock instead of throwing "database is locked" immediately. See issue #238.
|
|
63
62
|
*
|
|
64
63
|
* The 5s window (was 120s) rides out a normal incremental sync; the old
|
|
65
|
-
* 2-minute wait presented as a frozen, hung agent. With WAL (node:sqlite
|
|
66
|
-
*
|
|
67
|
-
*
|
|
64
|
+
* 2-minute wait presented as a frozen, hung agent. With WAL (node:sqlite),
|
|
65
|
+
* reads never block on a writer, so this timeout only governs cross-process
|
|
66
|
+
* write contention. The WASM fallback remaps WAL → DELETE.
|
|
68
67
|
*/
|
|
69
68
|
function configureConnection(db) {
|
|
70
69
|
db.pragma('busy_timeout = 5000'); // MUST be first — see above
|
|
@@ -593,9 +592,8 @@ class DatabaseConnection {
|
|
|
593
592
|
return null;
|
|
594
593
|
}
|
|
595
594
|
}
|
|
596
|
-
// WASM has no real WAL
|
|
597
|
-
|
|
598
|
-
if (this.backend !== 'node-sqlite' && this.backend !== 'native') {
|
|
595
|
+
// WASM has no real WAL — only checkpoint node:sqlite connections.
|
|
596
|
+
if (this.backend !== 'node-sqlite') {
|
|
599
597
|
return null;
|
|
600
598
|
}
|
|
601
599
|
try {
|
|
@@ -605,14 +603,8 @@ class DatabaseConnection {
|
|
|
605
603
|
let row = null;
|
|
606
604
|
let err = null;
|
|
607
605
|
try {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const Database = require('better-sqlite3');
|
|
611
|
-
db = new Database(workerData.dbPath);
|
|
612
|
-
} else {
|
|
613
|
-
const { DatabaseSync } = require('node:sqlite');
|
|
614
|
-
db = new DatabaseSync(workerData.dbPath);
|
|
615
|
-
}
|
|
606
|
+
const { DatabaseSync } = require('node:sqlite');
|
|
607
|
+
const db = new DatabaseSync(workerData.dbPath);
|
|
616
608
|
const mode = workerData.mode === 'TRUNCATE' ? 'TRUNCATE' : 'PASSIVE';
|
|
617
609
|
try {
|
|
618
610
|
if (mode === 'TRUNCATE') db.exec('PRAGMA busy_timeout = 2000');
|
|
@@ -633,7 +625,7 @@ class DatabaseConnection {
|
|
|
633
625
|
try {
|
|
634
626
|
const worker = new Worker(workerSource, {
|
|
635
627
|
eval: true,
|
|
636
|
-
workerData: { dbPath: this.dbPath, mode
|
|
628
|
+
workerData: { dbPath: this.dbPath, mode },
|
|
637
629
|
});
|
|
638
630
|
worker.once('message', (m) => {
|
|
639
631
|
if (m?.err && process.env.HOMEGRAPH_WAL_VALVE_DEBUG) {
|
|
@@ -721,14 +713,8 @@ class DatabaseConnection {
|
|
|
721
713
|
const workerSource = `
|
|
722
714
|
const { workerData, parentPort } = require('node:worker_threads');
|
|
723
715
|
try {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
const { DatabaseSync } = require('node:sqlite');
|
|
727
|
-
db = new DatabaseSync(workerData.dbPath);
|
|
728
|
-
} catch {
|
|
729
|
-
const Database = require('better-sqlite3');
|
|
730
|
-
db = new Database(workerData.dbPath);
|
|
731
|
-
}
|
|
716
|
+
const { DatabaseSync } = require('node:sqlite');
|
|
717
|
+
const db = new DatabaseSync(workerData.dbPath);
|
|
732
718
|
for (const p of workerData.pragmas) { try { db.exec(p); } catch {} }
|
|
733
719
|
try { db.close(); } catch {}
|
|
734
720
|
} catch {}
|
package/dist/db/queries.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ export declare class QueryBuilder {
|
|
|
268
268
|
/**
|
|
269
269
|
* Get nodes by exact qualified name match (uses idx_nodes_qualified_name index)
|
|
270
270
|
*/
|
|
271
|
-
getNodesByQualifiedNameExact(qualifiedName: string): Node[];
|
|
271
|
+
getNodesByQualifiedNameExact(qualifiedName: string, limit?: number): Node[];
|
|
272
272
|
/**
|
|
273
273
|
* Get nodes by lowercase name match (uses idx_nodes_lower_name expression index)
|
|
274
274
|
*/
|
|
@@ -349,6 +349,10 @@ export declare class QueryBuilder {
|
|
|
349
349
|
* Get incoming edges to a node
|
|
350
350
|
*/
|
|
351
351
|
getIncomingEdges(targetId: string, kinds?: EdgeKind[], limit?: number): Edge[];
|
|
352
|
+
/** Bounded local adjacency for evidence search; never load a whole hub into JS.
|
|
353
|
+
* Known endpoints get a small indexed lookup before the bounded neighbor scan.
|
|
354
|
+
*/
|
|
355
|
+
getEvidenceEdges(nodeId: string, direction: 'outgoing' | 'incoming', kinds: EdgeKind[], limit: number, preferredIds?: string[]): Edge[];
|
|
352
356
|
/**
|
|
353
357
|
* Find all edges where both source and target are in the given node set.
|
|
354
358
|
* Useful for recovering inter-node connectivity after BFS.
|
package/dist/db/queries.js
CHANGED
|
@@ -626,7 +626,7 @@ class QueryBuilder {
|
|
|
626
626
|
if (misses.length === 0)
|
|
627
627
|
return out;
|
|
628
628
|
// Chunk under SQLite's parameter limit (default 999, raised to 32766
|
|
629
|
-
//
|
|
629
|
+
// across node:sqlite / wasm builds — chunk at 500 for safety across both
|
|
630
630
|
// backends and to keep the query plan simple).
|
|
631
631
|
for (let i = 0; i < misses.length; i += SQLITE_PARAM_CHUNK_SIZE) {
|
|
632
632
|
const chunk = misses.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
|
|
@@ -921,7 +921,12 @@ class QueryBuilder {
|
|
|
921
921
|
/**
|
|
922
922
|
* Get nodes by exact qualified name match (uses idx_nodes_qualified_name index)
|
|
923
923
|
*/
|
|
924
|
-
getNodesByQualifiedNameExact(qualifiedName) {
|
|
924
|
+
getNodesByQualifiedNameExact(qualifiedName, limit) {
|
|
925
|
+
if (limit !== undefined) {
|
|
926
|
+
const cap = Number.isFinite(limit) ? Math.max(1, Math.min(100, Math.floor(limit))) : 25;
|
|
927
|
+
return this.db.prepare('SELECT * FROM nodes WHERE qualified_name = ? LIMIT ?')
|
|
928
|
+
.all(qualifiedName, cap).map(rowToNode);
|
|
929
|
+
}
|
|
925
930
|
if (!this.stmts.getNodesByQualifiedNameExact) {
|
|
926
931
|
this.stmts.getNodesByQualifiedNameExact = this.db.prepare('SELECT * FROM nodes WHERE qualified_name = ?');
|
|
927
932
|
}
|
|
@@ -1571,6 +1576,30 @@ class QueryBuilder {
|
|
|
1571
1576
|
const rows = this.stmts.getEdgesByTarget.all(targetId);
|
|
1572
1577
|
return rows.map(rowToEdge);
|
|
1573
1578
|
}
|
|
1579
|
+
/** Bounded local adjacency for evidence search; never load a whole hub into JS.
|
|
1580
|
+
* Known endpoints get a small indexed lookup before the bounded neighbor scan.
|
|
1581
|
+
*/
|
|
1582
|
+
getEvidenceEdges(nodeId, direction, kinds, limit, preferredIds = []) {
|
|
1583
|
+
if (!kinds.length)
|
|
1584
|
+
return [];
|
|
1585
|
+
const cap = Number.isFinite(limit) ? Math.max(1, Math.min(100, Math.floor(limit))) : 25;
|
|
1586
|
+
const column = direction === 'incoming' ? 'target' : 'source';
|
|
1587
|
+
const opposite = direction === 'incoming' ? 'source' : 'target';
|
|
1588
|
+
const kindsSql = kinds.map(() => '?').join(',');
|
|
1589
|
+
const preferred = [...new Set(preferredIds)].slice(0, 4);
|
|
1590
|
+
const base = `SELECT * FROM edges WHERE ${column} = ? AND kind IN (${kindsSql})`;
|
|
1591
|
+
const rows = [];
|
|
1592
|
+
if (preferred.length) {
|
|
1593
|
+
rows.push(...this.db.prepare(`${base} AND ${opposite} IN (${preferred.map(() => '?').join(',')}) LIMIT ?`)
|
|
1594
|
+
.all(nodeId, ...kinds, ...preferred, cap));
|
|
1595
|
+
}
|
|
1596
|
+
if (rows.length < cap) {
|
|
1597
|
+
const omitPreferred = preferred.length ? ` AND ${opposite} NOT IN (${preferred.map(() => '?').join(',')})` : '';
|
|
1598
|
+
rows.push(...this.db.prepare(`${base}${omitPreferred} LIMIT ?`)
|
|
1599
|
+
.all(nodeId, ...kinds, ...preferred, cap - rows.length));
|
|
1600
|
+
}
|
|
1601
|
+
return rows.map(rowToEdge);
|
|
1602
|
+
}
|
|
1574
1603
|
/**
|
|
1575
1604
|
* Find all edges where both source and target are in the given node set.
|
|
1576
1605
|
* Useful for recovering inter-node connectivity after BFS.
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SQLite Adapter
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Two-tier selection (first success wins):
|
|
5
5
|
* 1. `node:sqlite` (`DatabaseSync`) — real SQLite + WAL + FTS5, Node ≥22.5
|
|
6
6
|
* (skipped when the build lacks FTS5 — e.g. some Node 23.x official builds)
|
|
7
|
-
* 2. `
|
|
8
|
-
* 3. `node-sqlite3-wasm` — last-resort fallback (no WAL; slower / lock-prone)
|
|
7
|
+
* 2. `node-sqlite3-wasm` — cross-platform fallback (no WAL; slower / lock-prone)
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
* FTS5 is present and skips the native build. Override with
|
|
12
|
-
* `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|native|wasm`.
|
|
13
|
-
* optionalDependency `better-sqlite3` is 12.x (Node 22+); wasm remains the last resort.
|
|
9
|
+
* Override with `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|wasm`.
|
|
14
10
|
*/
|
|
15
11
|
export interface SqliteStatement {
|
|
16
12
|
run(...params: any[]): {
|
|
@@ -37,11 +33,11 @@ export interface SqliteDatabase {
|
|
|
37
33
|
readonly open: boolean;
|
|
38
34
|
}
|
|
39
35
|
/** Active SQLite backend after {@link createDatabase}. */
|
|
40
|
-
export type SqliteBackend = 'node-sqlite' | '
|
|
36
|
+
export type SqliteBackend = 'node-sqlite' | 'wasm';
|
|
41
37
|
/**
|
|
42
38
|
* One-line recovery hint when WASM is active (no WAL — slower / lock-prone).
|
|
43
39
|
*/
|
|
44
|
-
export declare const WASM_FALLBACK_FIX_RECIPE:
|
|
40
|
+
export declare const WASM_FALLBACK_FIX_RECIPE = "upgrade to Node.js 22.5+ (uses built-in node:sqlite with FTS5), then restart homegraph";
|
|
45
41
|
/**
|
|
46
42
|
* Banner shown to stderr when falling back to WASM.
|
|
47
43
|
*/
|
|
@@ -49,11 +45,9 @@ export declare function buildWasmFallbackBanner(priorErrors?: string): string;
|
|
|
49
45
|
/** True when `require('node:sqlite').DatabaseSync` succeeds. */
|
|
50
46
|
export declare function isNodeSqliteAvailable(): boolean;
|
|
51
47
|
export declare function isNodeSqliteFts5Available(): boolean;
|
|
52
|
-
/** True when `require('better-sqlite3')` succeeds. */
|
|
53
|
-
export declare function isNativeSqliteAvailable(): boolean;
|
|
54
48
|
/**
|
|
55
49
|
* Create a database connection.
|
|
56
|
-
* Order: node:sqlite (with FTS5) →
|
|
50
|
+
* Order: node:sqlite (with FTS5) → node-sqlite3-wasm (unless overridden).
|
|
57
51
|
*/
|
|
58
52
|
export declare function createDatabase(dbPath: string, opts?: {
|
|
59
53
|
readOnly?: boolean;
|
|
@@ -2,30 +2,23 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* SQLite Adapter
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Two-tier selection (first success wins):
|
|
6
6
|
* 1. `node:sqlite` (`DatabaseSync`) — real SQLite + WAL + FTS5, Node ≥22.5
|
|
7
7
|
* (skipped when the build lacks FTS5 — e.g. some Node 23.x official builds)
|
|
8
|
-
* 2. `
|
|
9
|
-
* 3. `node-sqlite3-wasm` — last-resort fallback (no WAL; slower / lock-prone)
|
|
8
|
+
* 2. `node-sqlite3-wasm` — cross-platform fallback (no WAL; slower / lock-prone)
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
* FTS5 is present and skips the native build. Override with
|
|
13
|
-
* `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|native|wasm`.
|
|
14
|
-
* optionalDependency `better-sqlite3` is 12.x (Node 22+); wasm remains the last resort.
|
|
10
|
+
* Override with `HOMEGRAPH_SQLITE_BACKEND=node-sqlite|wasm`.
|
|
15
11
|
*/
|
|
16
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
13
|
exports.WASM_FALLBACK_FIX_RECIPE = void 0;
|
|
18
14
|
exports.buildWasmFallbackBanner = buildWasmFallbackBanner;
|
|
19
15
|
exports.isNodeSqliteAvailable = isNodeSqliteAvailable;
|
|
20
16
|
exports.isNodeSqliteFts5Available = isNodeSqliteFts5Available;
|
|
21
|
-
exports.isNativeSqliteAvailable = isNativeSqliteAvailable;
|
|
22
17
|
exports.createDatabase = createDatabase;
|
|
23
18
|
/**
|
|
24
19
|
* One-line recovery hint when WASM is active (no WAL — slower / lock-prone).
|
|
25
20
|
*/
|
|
26
|
-
exports.WASM_FALLBACK_FIX_RECIPE = 'upgrade to Node.js 22.5+ (uses built-in node:sqlite),
|
|
27
|
-
'`xcode-select --install` (macOS) / `apt install build-essential` (Debian/Ubuntu) ' +
|
|
28
|
-
'then `npm rebuild better-sqlite3`.';
|
|
21
|
+
exports.WASM_FALLBACK_FIX_RECIPE = 'upgrade to Node.js 22.5+ (uses built-in node:sqlite with FTS5), then restart homegraph';
|
|
29
22
|
/**
|
|
30
23
|
* Banner shown to stderr when falling back to WASM.
|
|
31
24
|
*/
|
|
@@ -33,20 +26,15 @@ function buildWasmFallbackBanner(priorErrors) {
|
|
|
33
26
|
const sep = '─'.repeat(72);
|
|
34
27
|
const lines = [
|
|
35
28
|
sep,
|
|
36
|
-
'[HomeGraph] WASM SQLite fallback active (node:sqlite
|
|
29
|
+
'[HomeGraph] WASM SQLite fallback active (node:sqlite unavailable or lacks FTS5)',
|
|
37
30
|
sep,
|
|
38
31
|
'Indexing and sync will be 5-10x slower than a WAL backend, and concurrent',
|
|
39
|
-
'reads can hit "database is locked". Prefer Node 22.5
|
|
32
|
+
'reads can hit "database is locked". Prefer Node.js 22.5 or newer.',
|
|
40
33
|
'',
|
|
41
|
-
'Fix — use built-in SQLite
|
|
34
|
+
'Fix — use built-in SQLite:',
|
|
42
35
|
' Use Node.js 22.5 or newer, then restart homegraph',
|
|
43
36
|
'',
|
|
44
|
-
'
|
|
45
|
-
' macOS: xcode-select --install && npm rebuild better-sqlite3',
|
|
46
|
-
' Linux: sudo apt install build-essential python3 make && npm rebuild better-sqlite3',
|
|
47
|
-
' Any: npm install better-sqlite3 --save',
|
|
48
|
-
'',
|
|
49
|
-
'Verify after fix: `homegraph status` should show Backend: node-sqlite or native.',
|
|
37
|
+
'Verify after fix: `homegraph status` should show Backend: node-sqlite.',
|
|
50
38
|
];
|
|
51
39
|
if (priorErrors) {
|
|
52
40
|
lines.push('', `Prior load errors: ${priorErrors}`);
|
|
@@ -155,20 +143,9 @@ function isNodeSqliteFts5Available() {
|
|
|
155
143
|
}
|
|
156
144
|
return cachedNodeSqliteFts5;
|
|
157
145
|
}
|
|
158
|
-
/** True when `require('better-sqlite3')` succeeds. */
|
|
159
|
-
function isNativeSqliteAvailable() {
|
|
160
|
-
try {
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
162
|
-
require('better-sqlite3');
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
146
|
/**
|
|
170
147
|
* Wraps Node's built-in `node:sqlite` (`DatabaseSync`) to match the
|
|
171
|
-
*
|
|
148
|
+
* statement/database interface the rest of the code expects.
|
|
172
149
|
*/
|
|
173
150
|
class NodeSqliteAdapter {
|
|
174
151
|
_db;
|
|
@@ -362,10 +339,11 @@ class WasmDatabaseAdapter {
|
|
|
362
339
|
}
|
|
363
340
|
function resolveBackendOrder() {
|
|
364
341
|
const raw = process.env.HOMEGRAPH_SQLITE_BACKEND?.trim().toLowerCase();
|
|
365
|
-
if (raw === 'node-sqlite' || raw === '
|
|
342
|
+
if (raw === 'node-sqlite' || raw === 'wasm') {
|
|
366
343
|
return [raw];
|
|
367
344
|
}
|
|
368
|
-
|
|
345
|
+
// Unknown values (including legacy `native`) fall through to the default order.
|
|
346
|
+
return ['node-sqlite', 'wasm'];
|
|
369
347
|
}
|
|
370
348
|
function tryOpenBackend(backend, dbPath, opts) {
|
|
371
349
|
try {
|
|
@@ -379,12 +357,6 @@ function tryOpenBackend(backend, dbPath, opts) {
|
|
|
379
357
|
}
|
|
380
358
|
return { db: new NodeSqliteAdapter(dbPath, opts), backend: 'node-sqlite' };
|
|
381
359
|
}
|
|
382
|
-
if (backend === 'native') {
|
|
383
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
384
|
-
const Database = require('better-sqlite3');
|
|
385
|
-
const db = opts?.readOnly ? new Database(dbPath, { readonly: true }) : new Database(dbPath);
|
|
386
|
-
return { db: db, backend: 'native' };
|
|
387
|
-
}
|
|
388
360
|
return { db: new WasmDatabaseAdapter(dbPath, opts), backend: 'wasm' };
|
|
389
361
|
}
|
|
390
362
|
catch (error) {
|
|
@@ -393,7 +365,7 @@ function tryOpenBackend(backend, dbPath, opts) {
|
|
|
393
365
|
}
|
|
394
366
|
/**
|
|
395
367
|
* Create a database connection.
|
|
396
|
-
* Order: node:sqlite (with FTS5) →
|
|
368
|
+
* Order: node:sqlite (with FTS5) → node-sqlite3-wasm (unless overridden).
|
|
397
369
|
*/
|
|
398
370
|
function createDatabase(dbPath, opts) {
|
|
399
371
|
const order = resolveBackendOrder();
|
package/dist/directory.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export declare function isInitialized(projectRoot: string): boolean;
|
|
|
63
63
|
* The returned string is a human phrase that slots into "… looks like {reason}".
|
|
64
64
|
*/
|
|
65
65
|
export declare function unsafeIndexRootReason(projectRoot: string): string | null;
|
|
66
|
-
export declare function findNearestHomeGraphRoot(startPath: string): string | null;
|
|
66
|
+
export declare function findNearestHomeGraphRoot(startPath: string, floor?: string): string | null;
|
|
67
67
|
/**
|
|
68
68
|
* Indexed sub-project roots beneath `root` (bounded breadth-first scan). For
|
|
69
69
|
* the monorepo case behind #964: the index lives in a CHILD
|
package/dist/directory.js
CHANGED
|
@@ -183,17 +183,41 @@ function unsafeIndexRootReason(projectRoot) {
|
|
|
183
183
|
}
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
186
|
-
function findNearestHomeGraphRoot(startPath) {
|
|
186
|
+
function findNearestHomeGraphRoot(startPath, floor) {
|
|
187
|
+
// A floor (an MCP host's explicit --path / rootUri) bounds the walk: an
|
|
188
|
+
// ancestor .homegraph above it must not be adopted — a stray ancestor index
|
|
189
|
+
// hijacks every nested server, whose daemon then indexes the wrong (often
|
|
190
|
+
// huge) tree and OOMs (spec 0028). Only honored when it contains the start;
|
|
191
|
+
// a misconfigured floor must not break discovery.
|
|
192
|
+
const resolveBestEffort = (p) => {
|
|
193
|
+
try {
|
|
194
|
+
return fs.realpathSync(path.resolve(p));
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return path.resolve(p);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
// Walk the literal chain (returned to the caller in ITS coordinate system);
|
|
201
|
+
// track the realpath chain in parallel only for the boundary comparison, so
|
|
202
|
+
// a symlinked prefix (macOS /var vs /private/var) cannot desync the floor.
|
|
187
203
|
let current = path.resolve(startPath);
|
|
204
|
+
let currentReal = resolveBestEffort(current);
|
|
188
205
|
const root = path.parse(current).root;
|
|
206
|
+
const floorDir = floor ? resolveBestEffort(floor) : null;
|
|
207
|
+
const clamped = floorDir !== null &&
|
|
208
|
+
(currentReal === floorDir || currentReal.startsWith(floorDir + path.sep));
|
|
189
209
|
while (current !== root) {
|
|
190
210
|
if (isInitialized(current)) {
|
|
191
211
|
return current;
|
|
192
212
|
}
|
|
213
|
+
if (clamped && currentReal === floorDir) {
|
|
214
|
+
return null; // the floor itself has no index — stop, never look above
|
|
215
|
+
}
|
|
193
216
|
const parent = path.dirname(current);
|
|
194
217
|
if (parent === current)
|
|
195
218
|
break; // Reached filesystem root
|
|
196
219
|
current = parent;
|
|
220
|
+
currentReal = path.dirname(currentReal);
|
|
197
221
|
}
|
|
198
222
|
// Check root as well
|
|
199
223
|
if (isInitialized(current)) {
|
|
@@ -51,6 +51,8 @@ export declare function isArkModuleJson5(filePath: string): boolean;
|
|
|
51
51
|
* Idempotent — safe to call multiple times.
|
|
52
52
|
*/
|
|
53
53
|
export declare function initGrammars(): Promise<void>;
|
|
54
|
+
/** Filenames copy-assets must ship under dist/extraction/wasm/ (Spec 0031). */
|
|
55
|
+
export declare function vendoredWasmFilenames(): string[];
|
|
54
56
|
/**
|
|
55
57
|
* Pre-read the grammar WASM bytes for an index set, keyed by language. The
|
|
56
58
|
* orchestrator reads each grammar ONCE and hands the bytes to every parse
|
|
@@ -47,6 +47,7 @@ exports.isErlangAppFile = isErlangAppFile;
|
|
|
47
47
|
exports.isPlayRoutesFile = isPlayRoutesFile;
|
|
48
48
|
exports.isArkModuleJson5 = isArkModuleJson5;
|
|
49
49
|
exports.initGrammars = initGrammars;
|
|
50
|
+
exports.vendoredWasmFilenames = vendoredWasmFilenames;
|
|
50
51
|
exports.readGrammarWasmBytes = readGrammarWasmBytes;
|
|
51
52
|
exports.loadGrammarsForLanguages = loadGrammarsForLanguages;
|
|
52
53
|
exports.loadAllGrammars = loadAllGrammars;
|
|
@@ -309,13 +310,8 @@ async function initGrammars() {
|
|
|
309
310
|
* primary constructors natively. Terraform: tree-sitter-wasms does not ship
|
|
310
311
|
* HCL/Terraform at all, so we vendor the prebuilt tree-sitter-terraform.wasm
|
|
311
312
|
* from @tree-sitter-grammars/tree-sitter-hcl 1.2.0 (Apache-2.0) —
|
|
312
|
-
* byte-identical to the npm package's artifact.
|
|
313
|
-
*
|
|
314
|
-
* the tree-sitter-arkts 0.2.0 npm package (harmony-contrib/tree-sitter-arkts,
|
|
315
|
-
* MIT) — byte-identical to the npm tarball's artifact. It extends the
|
|
316
|
-
* tree-sitter-javascript grammar the same way tree-sitter-typescript does,
|
|
317
|
-
* adding `struct_declaration` and the `arkui_component_expression` build()
|
|
318
|
-
* DSL. Nix: tree-sitter-wasms doesn't ship it; we vendor a wasm built from
|
|
313
|
+
* byte-identical to the npm package's artifact. Nix: tree-sitter-wasms doesn't
|
|
314
|
+
* ship it; we vendor a wasm built from
|
|
319
315
|
* nix-community/tree-sitter-nix @ 3d0173d (MIT) with tree-sitter-cli 0.25.10
|
|
320
316
|
* (`generate` + `build --wasm`, ABI 15 — upstream's checked-in parser.c is
|
|
321
317
|
* still ABI 13; all 54 upstream corpus tests pass on the regenerated parser).
|
|
@@ -324,6 +320,10 @@ const VENDORED_WASM_LANGS = new Set([
|
|
|
324
320
|
'pascal', 'scala', 'lua', 'luau', 'csharp', 'r', 'cfml', 'cfscript', 'cfquery',
|
|
325
321
|
'cobol', 'vbnet', 'erlang', 'terraform', 'nix',
|
|
326
322
|
]);
|
|
323
|
+
/** Filenames copy-assets must ship under dist/extraction/wasm/ (Spec 0031). */
|
|
324
|
+
function vendoredWasmFilenames() {
|
|
325
|
+
return [...new Set([...VENDORED_WASM_LANGS].map((lang) => WASM_GRAMMAR_FILES[lang]))].sort();
|
|
326
|
+
}
|
|
327
327
|
/** Absolute path of a language's grammar WASM (vendored or tree-sitter-wasms). */
|
|
328
328
|
function resolveWasmPath(lang) {
|
|
329
329
|
const wasmFile = WASM_GRAMMAR_FILES[lang];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Edge, EdgeKind, Node } from '../types';
|
|
2
|
+
import type { QueryPlan } from '../search/query-plan';
|
|
3
|
+
export type EvidencePathKind = 'calls' | 'events' | 'state' | 'structure';
|
|
4
|
+
export type EvidenceDirection = 'outgoing' | 'incoming' | 'either';
|
|
5
|
+
export interface EvidencePathGoal {
|
|
6
|
+
kind: EvidencePathKind;
|
|
7
|
+
direction: EvidenceDirection;
|
|
8
|
+
anchorIds: string[];
|
|
9
|
+
ambiguous: string[];
|
|
10
|
+
limited: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface EvidencePath {
|
|
13
|
+
id: string;
|
|
14
|
+
nodeIds: string[];
|
|
15
|
+
edges: Edge[];
|
|
16
|
+
cost: number;
|
|
17
|
+
/** Search orientation only; nodeIds and edges always retain actual graph direction. */
|
|
18
|
+
orientation: 'outgoing' | 'incoming';
|
|
19
|
+
}
|
|
20
|
+
export interface EvidencePathSearch {
|
|
21
|
+
goal: EvidencePathGoal;
|
|
22
|
+
paths: EvidencePath[];
|
|
23
|
+
neighbors: Edge[];
|
|
24
|
+
missing: Array<{
|
|
25
|
+
from: string;
|
|
26
|
+
to: string;
|
|
27
|
+
}>;
|
|
28
|
+
stopReason: 'supported' | 'neighbors_only' | 'no_path_in_scope' | 'budget_exhausted' | 'ambiguous_anchors' | 'insufficient_anchors';
|
|
29
|
+
limitsHit: string[];
|
|
30
|
+
stats: {
|
|
31
|
+
adjacencyReads: number;
|
|
32
|
+
rowsRead: number;
|
|
33
|
+
nodesVisited: number;
|
|
34
|
+
durationMs: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface EvidencePathGraph {
|
|
38
|
+
getNode(id: string): Node | null | undefined;
|
|
39
|
+
getEdges(id: string, direction: 'outgoing' | 'incoming', kinds: EdgeKind[], limit: number, preferred: string[]): Edge[];
|
|
40
|
+
}
|
|
41
|
+
export declare const EVIDENCE_PATH_LIMITS: {
|
|
42
|
+
anchors: number;
|
|
43
|
+
hops: number;
|
|
44
|
+
reads: number;
|
|
45
|
+
perNode: number;
|
|
46
|
+
nodes: number;
|
|
47
|
+
milliseconds: number;
|
|
48
|
+
};
|
|
49
|
+
export declare function isEvidencePathNode(n: Node): boolean;
|
|
50
|
+
/** Exact names may have been removed by generic search stopwords (e.g. Type.start).
|
|
51
|
+
* Resolve through the qualified-name index, never by picking a bare-name overload.
|
|
52
|
+
*/
|
|
53
|
+
export declare function completeEvidencePathCandidates(query: string, nodes: Node[], lookup: (qualifiedName: string, limit: number) => Node[], plan?: QueryPlan): Node[];
|
|
54
|
+
/** Resolve only actual candidate identities; a bare homonym never selects the first hit. */
|
|
55
|
+
export declare function resolveEvidencePathGoal(query: string, nodes: Node[], focusIds: Set<string>, plan?: QueryPlan): EvidencePathGoal;
|
|
56
|
+
export declare function evidenceEdgeCost(edge: Edge, goal: EvidencePathGoal): number | null;
|
|
57
|
+
export declare function evidenceEdgeKey(edge: Edge): string;
|
|
58
|
+
/** One bounded search per request. Each orientation follows directed edges throughout. */
|
|
59
|
+
export declare function searchEvidencePaths(graph: EvidencePathGraph, goal: EvidencePathGoal, options?: {
|
|
60
|
+
now?: () => number;
|
|
61
|
+
limits?: Partial<typeof EVIDENCE_PATH_LIMITS>;
|
|
62
|
+
}): EvidencePathSearch;
|
|
63
|
+
//# sourceMappingURL=evidence-paths.d.ts.map
|