@bharanidev/bhgraph-darwin-arm64 1.0.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/bin/bhgraph +19 -0
- package/lib/dist/bin/bhgraph.d.ts +26 -0
- package/lib/dist/bin/bhgraph.d.ts.map +1 -0
- package/lib/dist/bin/bhgraph.js +2207 -0
- package/lib/dist/bin/bhgraph.js.map +1 -0
- package/lib/dist/bin/command-supervision.d.ts +12 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -0
- package/lib/dist/bin/command-supervision.js +89 -0
- package/lib/dist/bin/command-supervision.js.map +1 -0
- package/lib/dist/bin/fatal-handler.d.ts +20 -0
- package/lib/dist/bin/fatal-handler.d.ts.map +1 -0
- package/lib/dist/bin/fatal-handler.js +118 -0
- package/lib/dist/bin/fatal-handler.js.map +1 -0
- package/lib/dist/bin/node-version-check.d.ts +37 -0
- package/lib/dist/bin/node-version-check.d.ts.map +1 -0
- package/lib/dist/bin/node-version-check.js +79 -0
- package/lib/dist/bin/node-version-check.js.map +1 -0
- package/lib/dist/bin/uninstall.d.ts +14 -0
- package/lib/dist/bin/uninstall.d.ts.map +1 -0
- package/lib/dist/bin/uninstall.js +36 -0
- package/lib/dist/bin/uninstall.js.map +1 -0
- package/lib/dist/context/formatter.d.ts +30 -0
- package/lib/dist/context/formatter.d.ts.map +1 -0
- package/lib/dist/context/formatter.js +263 -0
- package/lib/dist/context/formatter.js.map +1 -0
- package/lib/dist/context/index.d.ts +119 -0
- package/lib/dist/context/index.d.ts.map +1 -0
- package/lib/dist/context/index.js +1296 -0
- package/lib/dist/context/index.js.map +1 -0
- package/lib/dist/context/markers.d.ts +19 -0
- package/lib/dist/context/markers.d.ts.map +1 -0
- package/lib/dist/context/markers.js +22 -0
- package/lib/dist/context/markers.js.map +1 -0
- package/lib/dist/db/index.d.ts +142 -0
- package/lib/dist/db/index.d.ts.map +1 -0
- package/lib/dist/db/index.js +335 -0
- package/lib/dist/db/index.js.map +1 -0
- package/lib/dist/db/migrations.d.ts +44 -0
- package/lib/dist/db/migrations.d.ts.map +1 -0
- package/lib/dist/db/migrations.js +182 -0
- package/lib/dist/db/migrations.js.map +1 -0
- package/lib/dist/db/queries.d.ts +452 -0
- package/lib/dist/db/queries.d.ts.map +1 -0
- package/lib/dist/db/queries.js +1740 -0
- package/lib/dist/db/queries.js.map +1 -0
- package/lib/dist/db/schema.sql +182 -0
- package/lib/dist/db/sqlite-adapter.d.ts +53 -0
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -0
- package/lib/dist/db/sqlite-adapter.js +117 -0
- package/lib/dist/db/sqlite-adapter.js.map +1 -0
- package/lib/dist/directory.d.ts +183 -0
- package/lib/dist/directory.d.ts.map +1 -0
- package/lib/dist/directory.js +797 -0
- package/lib/dist/directory.js.map +1 -0
- package/lib/dist/errors.d.ts +136 -0
- package/lib/dist/errors.d.ts.map +1 -0
- package/lib/dist/errors.js +219 -0
- package/lib/dist/errors.js.map +1 -0
- package/lib/dist/extraction/astro-extractor.d.ts +79 -0
- package/lib/dist/extraction/astro-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/astro-extractor.js +320 -0
- package/lib/dist/extraction/astro-extractor.js.map +1 -0
- package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/cfml-extractor.js +494 -0
- package/lib/dist/extraction/cfml-extractor.js.map +1 -0
- package/lib/dist/extraction/dfm-extractor.d.ts +31 -0
- package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/dfm-extractor.js +151 -0
- package/lib/dist/extraction/dfm-extractor.js.map +1 -0
- package/lib/dist/extraction/extraction-version.d.ts +25 -0
- package/lib/dist/extraction/extraction-version.d.ts.map +1 -0
- package/lib/dist/extraction/extraction-version.js +28 -0
- package/lib/dist/extraction/extraction-version.js.map +1 -0
- package/lib/dist/extraction/function-ref.d.ts +118 -0
- package/lib/dist/extraction/function-ref.d.ts.map +1 -0
- package/lib/dist/extraction/function-ref.js +727 -0
- package/lib/dist/extraction/function-ref.js.map +1 -0
- package/lib/dist/extraction/generated-detection.d.ts +30 -0
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -0
- package/lib/dist/extraction/generated-detection.js +83 -0
- package/lib/dist/extraction/generated-detection.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +123 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -0
- package/lib/dist/extraction/grammars.js +589 -0
- package/lib/dist/extraction/grammars.js.map +1 -0
- package/lib/dist/extraction/index.d.ts +232 -0
- package/lib/dist/extraction/index.d.ts.map +1 -0
- package/lib/dist/extraction/index.js +2269 -0
- package/lib/dist/extraction/index.js.map +1 -0
- package/lib/dist/extraction/languages/arkts.d.ts +3 -0
- package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/lib/dist/extraction/languages/arkts.js +127 -0
- package/lib/dist/extraction/languages/arkts.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +110 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.js +837 -0
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -0
- package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
- package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfquery.js +28 -0
- package/lib/dist/extraction/languages/cfquery.js.map +1 -0
- package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfscript.js +73 -0
- package/lib/dist/extraction/languages/cfscript.js.map +1 -0
- package/lib/dist/extraction/languages/cobol.d.ts +33 -0
- package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cobol.js +499 -0
- package/lib/dist/extraction/languages/cobol.js.map +1 -0
- package/lib/dist/extraction/languages/csharp.d.ts +25 -0
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -0
- package/lib/dist/extraction/languages/csharp.js +175 -0
- package/lib/dist/extraction/languages/csharp.js.map +1 -0
- package/lib/dist/extraction/languages/dart.d.ts +3 -0
- package/lib/dist/extraction/languages/dart.d.ts.map +1 -0
- package/lib/dist/extraction/languages/dart.js +374 -0
- package/lib/dist/extraction/languages/dart.js.map +1 -0
- package/lib/dist/extraction/languages/erlang.d.ts +3 -0
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/lib/dist/extraction/languages/erlang.js +350 -0
- package/lib/dist/extraction/languages/erlang.js.map +1 -0
- package/lib/dist/extraction/languages/go.d.ts +3 -0
- package/lib/dist/extraction/languages/go.d.ts.map +1 -0
- package/lib/dist/extraction/languages/go.js +111 -0
- package/lib/dist/extraction/languages/go.js.map +1 -0
- package/lib/dist/extraction/languages/index.d.ts +10 -0
- package/lib/dist/extraction/languages/index.d.ts.map +1 -0
- package/lib/dist/extraction/languages/index.js +71 -0
- package/lib/dist/extraction/languages/index.js.map +1 -0
- package/lib/dist/extraction/languages/java.d.ts +3 -0
- package/lib/dist/extraction/languages/java.d.ts.map +1 -0
- package/lib/dist/extraction/languages/java.js +315 -0
- package/lib/dist/extraction/languages/java.js.map +1 -0
- package/lib/dist/extraction/languages/javascript.d.ts +3 -0
- package/lib/dist/extraction/languages/javascript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/javascript.js +106 -0
- package/lib/dist/extraction/languages/javascript.js.map +1 -0
- package/lib/dist/extraction/languages/kotlin.d.ts +3 -0
- package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -0
- package/lib/dist/extraction/languages/kotlin.js +379 -0
- package/lib/dist/extraction/languages/kotlin.js.map +1 -0
- package/lib/dist/extraction/languages/lua.d.ts +3 -0
- package/lib/dist/extraction/languages/lua.d.ts.map +1 -0
- package/lib/dist/extraction/languages/lua.js +150 -0
- package/lib/dist/extraction/languages/lua.js.map +1 -0
- package/lib/dist/extraction/languages/luau.d.ts +3 -0
- package/lib/dist/extraction/languages/luau.d.ts.map +1 -0
- package/lib/dist/extraction/languages/luau.js +37 -0
- package/lib/dist/extraction/languages/luau.js.map +1 -0
- package/lib/dist/extraction/languages/nix.d.ts +3 -0
- package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
- package/lib/dist/extraction/languages/nix.js +294 -0
- package/lib/dist/extraction/languages/nix.js.map +1 -0
- package/lib/dist/extraction/languages/objc.d.ts +3 -0
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -0
- package/lib/dist/extraction/languages/objc.js +175 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -0
- package/lib/dist/extraction/languages/pascal.d.ts +3 -0
- package/lib/dist/extraction/languages/pascal.d.ts.map +1 -0
- package/lib/dist/extraction/languages/pascal.js +77 -0
- package/lib/dist/extraction/languages/pascal.js.map +1 -0
- package/lib/dist/extraction/languages/php.d.ts +3 -0
- package/lib/dist/extraction/languages/php.d.ts.map +1 -0
- package/lib/dist/extraction/languages/php.js +196 -0
- package/lib/dist/extraction/languages/php.js.map +1 -0
- package/lib/dist/extraction/languages/python.d.ts +3 -0
- package/lib/dist/extraction/languages/python.d.ts.map +1 -0
- package/lib/dist/extraction/languages/python.js +56 -0
- package/lib/dist/extraction/languages/python.js.map +1 -0
- package/lib/dist/extraction/languages/r.d.ts +3 -0
- package/lib/dist/extraction/languages/r.d.ts.map +1 -0
- package/lib/dist/extraction/languages/r.js +314 -0
- package/lib/dist/extraction/languages/r.js.map +1 -0
- package/lib/dist/extraction/languages/ruby.d.ts +3 -0
- package/lib/dist/extraction/languages/ruby.d.ts.map +1 -0
- package/lib/dist/extraction/languages/ruby.js +149 -0
- package/lib/dist/extraction/languages/ruby.js.map +1 -0
- package/lib/dist/extraction/languages/rust.d.ts +3 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -0
- package/lib/dist/extraction/languages/rust.js +142 -0
- package/lib/dist/extraction/languages/rust.js.map +1 -0
- package/lib/dist/extraction/languages/scala.d.ts +3 -0
- package/lib/dist/extraction/languages/scala.d.ts.map +1 -0
- package/lib/dist/extraction/languages/scala.js +209 -0
- package/lib/dist/extraction/languages/scala.js.map +1 -0
- package/lib/dist/extraction/languages/solidity.d.ts +3 -0
- package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/lib/dist/extraction/languages/solidity.js +293 -0
- package/lib/dist/extraction/languages/solidity.js.map +1 -0
- package/lib/dist/extraction/languages/swift.d.ts +3 -0
- package/lib/dist/extraction/languages/swift.d.ts.map +1 -0
- package/lib/dist/extraction/languages/swift.js +152 -0
- package/lib/dist/extraction/languages/swift.js.map +1 -0
- package/lib/dist/extraction/languages/terraform.d.ts +3 -0
- package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/lib/dist/extraction/languages/terraform.js +641 -0
- package/lib/dist/extraction/languages/terraform.js.map +1 -0
- package/lib/dist/extraction/languages/typescript.d.ts +16 -0
- package/lib/dist/extraction/languages/typescript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/typescript.js +167 -0
- package/lib/dist/extraction/languages/typescript.js.map +1 -0
- package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/lib/dist/extraction/languages/vbnet.js +141 -0
- package/lib/dist/extraction/languages/vbnet.js.map +1 -0
- package/lib/dist/extraction/liquid-extractor.d.ts +59 -0
- package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/liquid-extractor.js +357 -0
- package/lib/dist/extraction/liquid-extractor.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +68 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.js +300 -0
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -0
- package/lib/dist/extraction/parse-pool.d.ts +126 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -0
- package/lib/dist/extraction/parse-pool.js +319 -0
- package/lib/dist/extraction/parse-pool.js.map +1 -0
- package/lib/dist/extraction/parse-worker.d.ts +8 -0
- package/lib/dist/extraction/parse-worker.d.ts.map +1 -0
- package/lib/dist/extraction/parse-worker.js +97 -0
- package/lib/dist/extraction/parse-worker.js.map +1 -0
- package/lib/dist/extraction/razor-extractor.d.ts +42 -0
- package/lib/dist/extraction/razor-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/razor-extractor.js +285 -0
- package/lib/dist/extraction/razor-extractor.js.map +1 -0
- package/lib/dist/extraction/svelte-extractor.d.ts +56 -0
- package/lib/dist/extraction/svelte-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/svelte-extractor.js +275 -0
- package/lib/dist/extraction/svelte-extractor.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts +28 -0
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.js +153 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts +258 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -0
- package/lib/dist/extraction/tree-sitter-types.js +10 -0
- package/lib/dist/extraction/tree-sitter-types.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts +706 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -0
- package/lib/dist/extraction/tree-sitter.js +6506 -0
- package/lib/dist/extraction/tree-sitter.js.map +1 -0
- package/lib/dist/extraction/vue-extractor.d.ts +51 -0
- package/lib/dist/extraction/vue-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/vue-extractor.js +254 -0
- package/lib/dist/extraction/vue-extractor.js.map +1 -0
- package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +38 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
- package/lib/dist/extraction/wasm-runtime-flags.js +106 -0
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -0
- package/lib/dist/graph/index.d.ts +8 -0
- package/lib/dist/graph/index.d.ts.map +1 -0
- package/lib/dist/graph/index.js +13 -0
- package/lib/dist/graph/index.js.map +1 -0
- package/lib/dist/graph/queries.d.ts +106 -0
- package/lib/dist/graph/queries.d.ts.map +1 -0
- package/lib/dist/graph/queries.js +339 -0
- package/lib/dist/graph/queries.js.map +1 -0
- package/lib/dist/graph/traversal.d.ts +127 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -0
- package/lib/dist/graph/traversal.js +599 -0
- package/lib/dist/graph/traversal.js.map +1 -0
- package/lib/dist/index.d.ts +642 -0
- package/lib/dist/index.d.ts.map +1 -0
- package/lib/dist/index.js +1387 -0
- package/lib/dist/index.js.map +1 -0
- package/lib/dist/installer/config-writer.d.ts +28 -0
- package/lib/dist/installer/config-writer.d.ts.map +1 -0
- package/lib/dist/installer/config-writer.js +91 -0
- package/lib/dist/installer/config-writer.js.map +1 -0
- package/lib/dist/installer/index.d.ts +100 -0
- package/lib/dist/installer/index.d.ts.map +1 -0
- package/lib/dist/installer/index.js +526 -0
- package/lib/dist/installer/index.js.map +1 -0
- package/lib/dist/installer/instructions-template.d.ts +41 -0
- package/lib/dist/installer/instructions-template.d.ts.map +1 -0
- package/lib/dist/installer/instructions-template.js +53 -0
- package/lib/dist/installer/instructions-template.js.map +1 -0
- package/lib/dist/installer/targets/antigravity.d.ts +57 -0
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/lib/dist/installer/targets/antigravity.js +308 -0
- package/lib/dist/installer/targets/antigravity.js.map +1 -0
- package/lib/dist/installer/targets/claude.d.ts +62 -0
- package/lib/dist/installer/targets/claude.d.ts.map +1 -0
- package/lib/dist/installer/targets/claude.js +454 -0
- package/lib/dist/installer/targets/claude.js.map +1 -0
- package/lib/dist/installer/targets/codex.d.ts +18 -0
- package/lib/dist/installer/targets/codex.d.ts.map +1 -0
- package/lib/dist/installer/targets/codex.js +185 -0
- package/lib/dist/installer/targets/codex.js.map +1 -0
- package/lib/dist/installer/targets/cursor.d.ts +35 -0
- package/lib/dist/installer/targets/cursor.d.ts.map +1 -0
- package/lib/dist/installer/targets/cursor.js +254 -0
- package/lib/dist/installer/targets/cursor.js.map +1 -0
- package/lib/dist/installer/targets/gemini.d.ts +26 -0
- package/lib/dist/installer/targets/gemini.d.ts.map +1 -0
- package/lib/dist/installer/targets/gemini.js +165 -0
- package/lib/dist/installer/targets/gemini.js.map +1 -0
- package/lib/dist/installer/targets/hermes.d.ts +18 -0
- package/lib/dist/installer/targets/hermes.d.ts.map +1 -0
- package/lib/dist/installer/targets/hermes.js +359 -0
- package/lib/dist/installer/targets/hermes.js.map +1 -0
- package/lib/dist/installer/targets/kiro.d.ts +27 -0
- package/lib/dist/installer/targets/kiro.d.ts.map +1 -0
- package/lib/dist/installer/targets/kiro.js +178 -0
- package/lib/dist/installer/targets/kiro.js.map +1 -0
- package/lib/dist/installer/targets/opencode.d.ts +38 -0
- package/lib/dist/installer/targets/opencode.d.ts.map +1 -0
- package/lib/dist/installer/targets/opencode.js +288 -0
- package/lib/dist/installer/targets/opencode.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts +35 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -0
- package/lib/dist/installer/targets/registry.js +91 -0
- package/lib/dist/installer/targets/registry.js.map +1 -0
- package/lib/dist/installer/targets/shared.d.ts +101 -0
- package/lib/dist/installer/targets/shared.d.ts.map +1 -0
- package/lib/dist/installer/targets/shared.js +264 -0
- package/lib/dist/installer/targets/shared.js.map +1 -0
- package/lib/dist/installer/targets/toml.d.ts +52 -0
- package/lib/dist/installer/targets/toml.d.ts.map +1 -0
- package/lib/dist/installer/targets/toml.js +147 -0
- package/lib/dist/installer/targets/toml.js.map +1 -0
- package/lib/dist/installer/targets/types.d.ts +108 -0
- package/lib/dist/installer/targets/types.d.ts.map +1 -0
- package/lib/dist/installer/targets/types.js +16 -0
- package/lib/dist/installer/targets/types.js.map +1 -0
- package/lib/dist/mcp/daemon-manager.d.ts +42 -0
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-manager.js +129 -0
- package/lib/dist/mcp/daemon-manager.js.map +1 -0
- package/lib/dist/mcp/daemon-paths.d.ts +73 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-paths.js +165 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -0
- package/lib/dist/mcp/daemon-registry.d.ts +47 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-registry.js +233 -0
- package/lib/dist/mcp/daemon-registry.js.map +1 -0
- package/lib/dist/mcp/daemon.d.ts +290 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -0
- package/lib/dist/mcp/daemon.js +840 -0
- package/lib/dist/mcp/daemon.js.map +1 -0
- package/lib/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/lib/dist/mcp/dynamic-boundaries.js +360 -0
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -0
- package/lib/dist/mcp/early-ppid.d.ts +26 -0
- package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
- package/lib/dist/mcp/early-ppid.js +29 -0
- package/lib/dist/mcp/early-ppid.js.map +1 -0
- package/lib/dist/mcp/engine.d.ts +122 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -0
- package/lib/dist/mcp/engine.js +350 -0
- package/lib/dist/mcp/engine.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +113 -0
- package/lib/dist/mcp/index.d.ts.map +1 -0
- package/lib/dist/mcp/index.js +498 -0
- package/lib/dist/mcp/index.js.map +1 -0
- package/lib/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/lib/dist/mcp/liveness-watchdog.js +207 -0
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -0
- package/lib/dist/mcp/ppid-watchdog.d.ts +62 -0
- package/lib/dist/mcp/ppid-watchdog.d.ts.map +1 -0
- package/lib/dist/mcp/ppid-watchdog.js +64 -0
- package/lib/dist/mcp/ppid-watchdog.js.map +1 -0
- package/lib/dist/mcp/proxy.d.ts +87 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -0
- package/lib/dist/mcp/proxy.js +659 -0
- package/lib/dist/mcp/proxy.js.map +1 -0
- package/lib/dist/mcp/query-pool.d.ts +94 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -0
- package/lib/dist/mcp/query-pool.js +297 -0
- package/lib/dist/mcp/query-pool.js.map +1 -0
- package/lib/dist/mcp/query-worker.d.ts +24 -0
- package/lib/dist/mcp/query-worker.d.ts.map +1 -0
- package/lib/dist/mcp/query-worker.js +87 -0
- package/lib/dist/mcp/query-worker.js.map +1 -0
- package/lib/dist/mcp/server-instructions.d.ts +34 -0
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -0
- package/lib/dist/mcp/server-instructions.js +106 -0
- package/lib/dist/mcp/server-instructions.js.map +1 -0
- package/lib/dist/mcp/session.d.ts +79 -0
- package/lib/dist/mcp/session.d.ts.map +1 -0
- package/lib/dist/mcp/session.js +330 -0
- package/lib/dist/mcp/session.js.map +1 -0
- package/lib/dist/mcp/startup-handshake.d.ts +44 -0
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/lib/dist/mcp/startup-handshake.js +73 -0
- package/lib/dist/mcp/startup-handshake.js.map +1 -0
- package/lib/dist/mcp/stdin-teardown.d.ts +27 -0
- package/lib/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/lib/dist/mcp/stdin-teardown.js +49 -0
- package/lib/dist/mcp/stdin-teardown.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +613 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -0
- package/lib/dist/mcp/tools.js +4424 -0
- package/lib/dist/mcp/tools.js.map +1 -0
- package/lib/dist/mcp/transport.d.ts +188 -0
- package/lib/dist/mcp/transport.d.ts.map +1 -0
- package/lib/dist/mcp/transport.js +359 -0
- package/lib/dist/mcp/transport.js.map +1 -0
- package/lib/dist/mcp/version.d.ts +19 -0
- package/lib/dist/mcp/version.d.ts.map +1 -0
- package/lib/dist/mcp/version.js +71 -0
- package/lib/dist/mcp/version.js.map +1 -0
- package/lib/dist/project-config.d.ts +94 -0
- package/lib/dist/project-config.d.ts.map +1 -0
- package/lib/dist/project-config.js +374 -0
- package/lib/dist/project-config.js.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +5 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.js +1038 -0
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +15 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.js +3658 -0
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -0
- package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +42 -0
- package/lib/dist/resolution/cooperative-yield.js.map +1 -0
- package/lib/dist/resolution/frameworks/astro.d.ts +9 -0
- package/lib/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/astro.js +169 -0
- package/lib/dist/resolution/frameworks/astro.js.map +1 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.js +225 -0
- package/lib/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
- package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cics.js +90 -0
- package/lib/dist/resolution/frameworks/cics.js.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts +8 -0
- package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/csharp.js +241 -0
- package/lib/dist/resolution/frameworks/csharp.js.map +1 -0
- package/lib/dist/resolution/frameworks/drupal.d.ts +51 -0
- package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/drupal.js +367 -0
- package/lib/dist/resolution/frameworks/drupal.js.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.js +148 -0
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/lib/dist/resolution/frameworks/express.d.ts +8 -0
- package/lib/dist/resolution/frameworks/express.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/express.js +308 -0
- package/lib/dist/resolution/frameworks/express.js.map +1 -0
- package/lib/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/fabric.js +354 -0
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -0
- package/lib/dist/resolution/frameworks/go.d.ts +8 -0
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/go.js +161 -0
- package/lib/dist/resolution/frameworks/go.js.map +1 -0
- package/lib/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/lib/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/goframe.js +112 -0
- package/lib/dist/resolution/frameworks/goframe.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts +50 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/index.js +175 -0
- package/lib/dist/resolution/frameworks/index.js.map +1 -0
- package/lib/dist/resolution/frameworks/java.d.ts +8 -0
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/java.js +517 -0
- package/lib/dist/resolution/frameworks/java.js.map +1 -0
- package/lib/dist/resolution/frameworks/laravel.d.ts +13 -0
- package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/laravel.js +257 -0
- package/lib/dist/resolution/frameworks/laravel.js.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts +26 -0
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/nestjs.js +698 -0
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -0
- package/lib/dist/resolution/frameworks/play.d.ts +19 -0
- package/lib/dist/resolution/frameworks/play.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/play.js +111 -0
- package/lib/dist/resolution/frameworks/play.js.map +1 -0
- package/lib/dist/resolution/frameworks/python.d.ts +10 -0
- package/lib/dist/resolution/frameworks/python.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/python.js +400 -0
- package/lib/dist/resolution/frameworks/python.js.map +1 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-native.js +410 -0
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -0
- package/lib/dist/resolution/frameworks/react.d.ts +8 -0
- package/lib/dist/resolution/frameworks/react.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react.js +334 -0
- package/lib/dist/resolution/frameworks/react.js.map +1 -0
- package/lib/dist/resolution/frameworks/ruby.d.ts +8 -0
- package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/ruby.js +302 -0
- package/lib/dist/resolution/frameworks/ruby.js.map +1 -0
- package/lib/dist/resolution/frameworks/rust.d.ts +8 -0
- package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/rust.js +304 -0
- package/lib/dist/resolution/frameworks/rust.js.map +1 -0
- package/lib/dist/resolution/frameworks/svelte.d.ts +9 -0
- package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/svelte.js +253 -0
- package/lib/dist/resolution/frameworks/svelte.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/lib/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/swift-objc.js +252 -0
- package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift.d.ts +10 -0
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/swift.js +400 -0
- package/lib/dist/resolution/frameworks/swift.js.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.js +277 -0
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
- package/lib/dist/resolution/frameworks/vue.d.ts +9 -0
- package/lib/dist/resolution/frameworks/vue.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/vue.js +303 -0
- package/lib/dist/resolution/frameworks/vue.js.map +1 -0
- package/lib/dist/resolution/go-module.d.ts +26 -0
- package/lib/dist/resolution/go-module.d.ts.map +1 -0
- package/lib/dist/resolution/go-module.js +78 -0
- package/lib/dist/resolution/go-module.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts +28 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.js +158 -0
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/lib/dist/resolution/import-resolver.d.ts +85 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -0
- package/lib/dist/resolution/import-resolver.js +1974 -0
- package/lib/dist/resolution/import-resolver.js.map +1 -0
- package/lib/dist/resolution/index.d.ts +238 -0
- package/lib/dist/resolution/index.d.ts.map +1 -0
- package/lib/dist/resolution/index.js +1633 -0
- package/lib/dist/resolution/index.js.map +1 -0
- package/lib/dist/resolution/lru-cache.d.ts +24 -0
- package/lib/dist/resolution/lru-cache.d.ts.map +1 -0
- package/lib/dist/resolution/lru-cache.js +62 -0
- package/lib/dist/resolution/lru-cache.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +112 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -0
- package/lib/dist/resolution/name-matcher.js +1701 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -0
- package/lib/dist/resolution/path-aliases.d.ts +68 -0
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -0
- package/lib/dist/resolution/path-aliases.js +238 -0
- package/lib/dist/resolution/path-aliases.js.map +1 -0
- package/lib/dist/resolution/strip-comments.d.ts +27 -0
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -0
- package/lib/dist/resolution/strip-comments.js +492 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -0
- package/lib/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/lib/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/lib/dist/resolution/swift-objc-bridge.js +256 -0
- package/lib/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +253 -0
- package/lib/dist/resolution/types.d.ts.map +1 -0
- package/lib/dist/resolution/types.js +8 -0
- package/lib/dist/resolution/types.js.map +1 -0
- package/lib/dist/resolution/workspace-packages.d.ts +58 -0
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -0
- package/lib/dist/resolution/workspace-packages.js +346 -0
- package/lib/dist/resolution/workspace-packages.js.map +1 -0
- package/lib/dist/search/identifier-segments.d.ts +60 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -0
- package/lib/dist/search/identifier-segments.js +176 -0
- package/lib/dist/search/identifier-segments.js.map +1 -0
- package/lib/dist/search/query-parser.d.ts +57 -0
- package/lib/dist/search/query-parser.d.ts.map +1 -0
- package/lib/dist/search/query-parser.js +177 -0
- package/lib/dist/search/query-parser.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +87 -0
- package/lib/dist/search/query-utils.d.ts.map +1 -0
- package/lib/dist/search/query-utils.js +449 -0
- package/lib/dist/search/query-utils.js.map +1 -0
- package/lib/dist/sync/git-hooks.d.ts +45 -0
- package/lib/dist/sync/git-hooks.d.ts.map +1 -0
- package/lib/dist/sync/git-hooks.js +227 -0
- package/lib/dist/sync/git-hooks.js.map +1 -0
- package/lib/dist/sync/index.d.ts +19 -0
- package/lib/dist/sync/index.d.ts.map +1 -0
- package/lib/dist/sync/index.js +35 -0
- package/lib/dist/sync/index.js.map +1 -0
- package/lib/dist/sync/watch-policy.d.ts +48 -0
- package/lib/dist/sync/watch-policy.d.ts.map +1 -0
- package/lib/dist/sync/watch-policy.js +124 -0
- package/lib/dist/sync/watch-policy.js.map +1 -0
- package/lib/dist/sync/watcher.d.ts +355 -0
- package/lib/dist/sync/watcher.d.ts.map +1 -0
- package/lib/dist/sync/watcher.js +848 -0
- package/lib/dist/sync/watcher.js.map +1 -0
- package/lib/dist/sync/worktree.d.ts +63 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -0
- package/lib/dist/sync/worktree.js +182 -0
- package/lib/dist/sync/worktree.js.map +1 -0
- package/lib/dist/telemetry/index.d.ts +143 -0
- package/lib/dist/telemetry/index.d.ts.map +1 -0
- package/lib/dist/telemetry/index.js +541 -0
- package/lib/dist/telemetry/index.js.map +1 -0
- package/lib/dist/types.d.ts +415 -0
- package/lib/dist/types.d.ts.map +1 -0
- package/lib/dist/types.js +91 -0
- package/lib/dist/types.js.map +1 -0
- package/lib/dist/ui/glyphs.d.ts +42 -0
- package/lib/dist/ui/glyphs.d.ts.map +1 -0
- package/lib/dist/ui/glyphs.js +78 -0
- package/lib/dist/ui/glyphs.js.map +1 -0
- package/lib/dist/ui/shimmer-progress.d.ts +11 -0
- package/lib/dist/ui/shimmer-progress.d.ts.map +1 -0
- package/lib/dist/ui/shimmer-progress.js +90 -0
- package/lib/dist/ui/shimmer-progress.js.map +1 -0
- package/lib/dist/ui/shimmer-worker.d.ts +2 -0
- package/lib/dist/ui/shimmer-worker.d.ts.map +1 -0
- package/lib/dist/ui/shimmer-worker.js +118 -0
- package/lib/dist/ui/shimmer-worker.js.map +1 -0
- package/lib/dist/ui/types.d.ts +17 -0
- package/lib/dist/ui/types.d.ts.map +1 -0
- package/lib/dist/ui/types.js +3 -0
- package/lib/dist/ui/types.js.map +1 -0
- package/lib/dist/upgrade/index.d.ts +132 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -0
- package/lib/dist/upgrade/index.js +498 -0
- package/lib/dist/upgrade/index.js.map +1 -0
- package/lib/dist/utils.d.ts +224 -0
- package/lib/dist/utils.d.ts.map +1 -0
- package/lib/dist/utils.js +583 -0
- package/lib/dist/utils.js.map +1 -0
- package/lib/node_modules/.package-lock.json +125 -0
- package/lib/node_modules/@clack/core/CHANGELOG.md +348 -0
- package/lib/node_modules/@clack/core/LICENSE +9 -0
- package/lib/node_modules/@clack/core/README.md +22 -0
- package/lib/node_modules/@clack/core/dist/index.d.mts +363 -0
- package/lib/node_modules/@clack/core/dist/index.mjs +17 -0
- package/lib/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/lib/node_modules/@clack/core/package.json +63 -0
- package/lib/node_modules/@clack/prompts/CHANGELOG.md +591 -0
- package/lib/node_modules/@clack/prompts/LICENSE +9 -0
- package/lib/node_modules/@clack/prompts/README.md +375 -0
- package/lib/node_modules/@clack/prompts/dist/index.d.mts +396 -0
- package/lib/node_modules/@clack/prompts/dist/index.mjs +144 -0
- package/lib/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/lib/node_modules/@clack/prompts/package.json +68 -0
- package/lib/node_modules/commander/LICENSE +22 -0
- package/lib/node_modules/commander/Readme.md +1176 -0
- package/lib/node_modules/commander/esm.mjs +16 -0
- package/lib/node_modules/commander/index.js +24 -0
- package/lib/node_modules/commander/lib/argument.js +150 -0
- package/lib/node_modules/commander/lib/command.js +2777 -0
- package/lib/node_modules/commander/lib/error.js +39 -0
- package/lib/node_modules/commander/lib/help.js +747 -0
- package/lib/node_modules/commander/lib/option.js +380 -0
- package/lib/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/lib/node_modules/commander/package-support.json +19 -0
- package/lib/node_modules/commander/package.json +82 -0
- package/lib/node_modules/commander/typings/esm.d.mts +3 -0
- package/lib/node_modules/commander/typings/index.d.ts +1113 -0
- package/lib/node_modules/fast-string-truncated-width/dist/index.d.ts +4 -0
- package/lib/node_modules/fast-string-truncated-width/dist/index.js +111 -0
- package/lib/node_modules/fast-string-truncated-width/dist/types.d.ts +19 -0
- package/lib/node_modules/fast-string-truncated-width/dist/types.js +2 -0
- package/lib/node_modules/fast-string-truncated-width/dist/utils.d.ts +4 -0
- package/lib/node_modules/fast-string-truncated-width/dist/utils.js +20 -0
- package/lib/node_modules/fast-string-truncated-width/license +21 -0
- package/lib/node_modules/fast-string-truncated-width/package.json +35 -0
- package/lib/node_modules/fast-string-truncated-width/readme.md +59 -0
- package/lib/node_modules/fast-string-width/dist/index.d.ts +4 -0
- package/lib/node_modules/fast-string-width/dist/index.js +14 -0
- package/lib/node_modules/fast-string-width/license +21 -0
- package/lib/node_modules/fast-string-width/package.json +34 -0
- package/lib/node_modules/fast-string-width/readme.md +42 -0
- package/lib/node_modules/fast-wrap-ansi/LICENSE +23 -0
- package/lib/node_modules/fast-wrap-ansi/README.md +26 -0
- package/lib/node_modules/fast-wrap-ansi/lib/main.d.ts +6 -0
- package/lib/node_modules/fast-wrap-ansi/lib/main.js +219 -0
- package/lib/node_modules/fast-wrap-ansi/lib/main.js.map +1 -0
- package/lib/node_modules/fast-wrap-ansi/package.json +51 -0
- package/lib/node_modules/ignore/LICENSE-MIT +21 -0
- package/lib/node_modules/ignore/README.md +452 -0
- package/lib/node_modules/ignore/index.d.ts +81 -0
- package/lib/node_modules/ignore/index.js +784 -0
- package/lib/node_modules/ignore/legacy.js +681 -0
- package/lib/node_modules/ignore/package.json +87 -0
- package/lib/node_modules/jsonc-parser/CHANGELOG.md +76 -0
- package/lib/node_modules/jsonc-parser/LICENSE.md +21 -0
- package/lib/node_modules/jsonc-parser/README.md +364 -0
- package/lib/node_modules/jsonc-parser/SECURITY.md +41 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/edit.js +185 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/format.js +261 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/parser.js +659 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/scanner.js +443 -0
- package/lib/node_modules/jsonc-parser/lib/esm/impl/string-intern.js +29 -0
- package/lib/node_modules/jsonc-parser/lib/esm/main.d.ts +351 -0
- package/lib/node_modules/jsonc-parser/lib/esm/main.js +178 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/edit.js +201 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/format.js +275 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/parser.js +682 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/scanner.js +456 -0
- package/lib/node_modules/jsonc-parser/lib/umd/impl/string-intern.js +42 -0
- package/lib/node_modules/jsonc-parser/lib/umd/main.d.ts +351 -0
- package/lib/node_modules/jsonc-parser/lib/umd/main.js +194 -0
- package/lib/node_modules/jsonc-parser/package.json +37 -0
- package/lib/node_modules/picomatch/LICENSE +21 -0
- package/lib/node_modules/picomatch/README.md +738 -0
- package/lib/node_modules/picomatch/index.js +17 -0
- package/lib/node_modules/picomatch/lib/constants.js +180 -0
- package/lib/node_modules/picomatch/lib/parse.js +1085 -0
- package/lib/node_modules/picomatch/lib/picomatch.js +341 -0
- package/lib/node_modules/picomatch/lib/scan.js +391 -0
- package/lib/node_modules/picomatch/lib/utils.js +72 -0
- package/lib/node_modules/picomatch/package.json +83 -0
- package/lib/node_modules/picomatch/posix.js +3 -0
- package/lib/node_modules/sisteransi/license +21 -0
- package/lib/node_modules/sisteransi/package.json +34 -0
- package/lib/node_modules/sisteransi/readme.md +113 -0
- package/lib/node_modules/sisteransi/src/index.js +58 -0
- package/lib/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/lib/node_modules/tree-sitter-wasms/LICENSE +24 -0
- package/lib/node_modules/tree-sitter-wasms/README.md +23 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-bash.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-cpp.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-css.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-dart.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elisp.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elixir.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-elm.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-embedded_template.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-html.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-json.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-lua.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-objc.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ocaml.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ql.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rescript.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-solidity.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-swift.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-systemrdl.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tlaplus.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-toml.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-vue.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-yaml.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/out/tree-sitter-zig.wasm +0 -0
- package/lib/node_modules/tree-sitter-wasms/package.json +64 -0
- package/lib/node_modules/web-tree-sitter/LICENSE +21 -0
- package/lib/node_modules/web-tree-sitter/README.md +269 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs +4558 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.cjs.map +7 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js +4516 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.js.map +7 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
- package/lib/node_modules/web-tree-sitter/debug/tree-sitter.wasm.map +31 -0
- package/lib/node_modules/web-tree-sitter/lib/alloc.c +48 -0
- package/lib/node_modules/web-tree-sitter/lib/alloc.h +41 -0
- package/lib/node_modules/web-tree-sitter/lib/array.h +291 -0
- package/lib/node_modules/web-tree-sitter/lib/atomic.h +68 -0
- package/lib/node_modules/web-tree-sitter/lib/clock.h +146 -0
- package/lib/node_modules/web-tree-sitter/lib/error_costs.h +11 -0
- package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.c +523 -0
- package/lib/node_modules/web-tree-sitter/lib/get_changed_ranges.h +36 -0
- package/lib/node_modules/web-tree-sitter/lib/host.h +21 -0
- package/lib/node_modules/web-tree-sitter/lib/language.c +293 -0
- package/lib/node_modules/web-tree-sitter/lib/language.h +293 -0
- package/lib/node_modules/web-tree-sitter/lib/length.h +52 -0
- package/lib/node_modules/web-tree-sitter/lib/lexer.c +483 -0
- package/lib/node_modules/web-tree-sitter/lib/lexer.h +54 -0
- package/lib/node_modules/web-tree-sitter/lib/lib.c +12 -0
- package/lib/node_modules/web-tree-sitter/lib/node.c +875 -0
- package/lib/node_modules/web-tree-sitter/lib/parser.c +2297 -0
- package/lib/node_modules/web-tree-sitter/lib/parser.h +286 -0
- package/lib/node_modules/web-tree-sitter/lib/point.h +48 -0
- package/lib/node_modules/web-tree-sitter/lib/query.c +4347 -0
- package/lib/node_modules/web-tree-sitter/lib/reduce_action.h +34 -0
- package/lib/node_modules/web-tree-sitter/lib/reusable_node.h +95 -0
- package/lib/node_modules/web-tree-sitter/lib/stack.c +912 -0
- package/lib/node_modules/web-tree-sitter/lib/stack.h +133 -0
- package/lib/node_modules/web-tree-sitter/lib/subtree.c +1034 -0
- package/lib/node_modules/web-tree-sitter/lib/subtree.h +399 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.c +987 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm +0 -0
- package/lib/node_modules/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
- package/lib/node_modules/web-tree-sitter/lib/tree.c +170 -0
- package/lib/node_modules/web-tree-sitter/lib/tree.h +31 -0
- package/lib/node_modules/web-tree-sitter/lib/tree_cursor.c +716 -0
- package/lib/node_modules/web-tree-sitter/lib/tree_cursor.h +48 -0
- package/lib/node_modules/web-tree-sitter/lib/ts_assert.h +11 -0
- package/lib/node_modules/web-tree-sitter/lib/unicode.h +75 -0
- package/lib/node_modules/web-tree-sitter/lib/wasm_store.c +1937 -0
- package/lib/node_modules/web-tree-sitter/lib/wasm_store.h +31 -0
- package/lib/node_modules/web-tree-sitter/package.json +98 -0
- package/lib/node_modules/web-tree-sitter/src/bindings.ts +26 -0
- package/lib/node_modules/web-tree-sitter/src/constants.ts +133 -0
- package/lib/node_modules/web-tree-sitter/src/index.ts +31 -0
- package/lib/node_modules/web-tree-sitter/src/language.ts +291 -0
- package/lib/node_modules/web-tree-sitter/src/lookahead_iterator.ts +75 -0
- package/lib/node_modules/web-tree-sitter/src/marshal.ts +176 -0
- package/lib/node_modules/web-tree-sitter/src/node.ts +646 -0
- package/lib/node_modules/web-tree-sitter/src/parser.ts +325 -0
- package/lib/node_modules/web-tree-sitter/src/query.ts +973 -0
- package/lib/node_modules/web-tree-sitter/src/tree.ts +145 -0
- package/lib/node_modules/web-tree-sitter/src/tree_cursor.ts +318 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.cjs +4031 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.cjs.map +7 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.js +3980 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.js.map +7 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
- package/lib/node_modules/web-tree-sitter/tree-sitter.wasm.map +30 -0
- package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1030 -0
- package/lib/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +56 -0
- package/lib/package.json +64 -0
- package/node +0 -0
- package/package.json +17 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Server-level instructions emitted in the MCP `initialize` response.
|
|
6
|
+
*
|
|
7
|
+
* MCP clients (Claude Code, Cursor, opencode, LangChain, OpenAI Agent
|
|
8
|
+
* SDK, …) surface this text in the agent's system prompt automatically,
|
|
9
|
+
* giving the agent a high-level playbook for the bhgraph toolset
|
|
10
|
+
* before it sees individual tool descriptions.
|
|
11
|
+
*
|
|
12
|
+
* Goals when editing this:
|
|
13
|
+
* - Lead the agent to bhgraph_explore for any structural/flow question
|
|
14
|
+
* - Reinforce "explore instead of Read/Grep" for indexed code
|
|
15
|
+
* - Anti-patterns (don't re-verify with grep; don't hand-reconstruct flows)
|
|
16
|
+
*
|
|
17
|
+
* Keep it tight. The agent reads this every session — long instructions
|
|
18
|
+
* burn tokens. The DEFAULT MCP surface is `bhgraph_explore` ALONE (see
|
|
19
|
+
* DEFAULT_MCP_TOOLS in tools.ts) — reference only that tool here. The other
|
|
20
|
+
* tools (node/search/callers/…) stay defined and are re-enablable via
|
|
21
|
+
* BHGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
|
|
22
|
+
*/
|
|
23
|
+
exports.SERVER_INSTRUCTIONS = `# BHgraph — code intelligence over an indexed knowledge graph
|
|
24
|
+
|
|
25
|
+
BHgraph is a SQLite knowledge graph of every symbol, edge, and file in
|
|
26
|
+
the workspace — pre-computed structure you would otherwise re-derive by
|
|
27
|
+
reading files (cached intelligence: thousands of parse/trace decisions you
|
|
28
|
+
don't pay to re-reason each run). Reads are sub-millisecond; the index lags
|
|
29
|
+
writes by ~1s through the file watcher. Reach for it BEFORE *and* while
|
|
30
|
+
writing or editing code — not just for questions: one call returns the
|
|
31
|
+
verbatim source PLUS who calls it and what it affects, so you edit with the
|
|
32
|
+
blast radius in view. More accurate context, in far fewer tokens and
|
|
33
|
+
round-trips than reading files yourself.
|
|
34
|
+
|
|
35
|
+
## One tool: bhgraph_explore — use it instead of reading files
|
|
36
|
+
|
|
37
|
+
There is a single tool, \`bhgraph_explore\`, and it is Read-equivalent. It
|
|
38
|
+
takes either a natural-language question or a bag of symbol/file names and
|
|
39
|
+
returns the **verbatim, line-numbered source** of the relevant symbols
|
|
40
|
+
grouped by file — the same \`<n>\\t<line>\` shape \`Read\` gives you, safe to
|
|
41
|
+
\`Edit\` from — PLUS the call path among them (including dynamic-dispatch hops
|
|
42
|
+
like callbacks, React re-render, and JSX children that grep can't follow) and
|
|
43
|
+
a blast-radius summary of what depends on them.
|
|
44
|
+
|
|
45
|
+
Whether you're answering "how does X work" or implementing a change (fixing a
|
|
46
|
+
bug, adding a feature), call \`bhgraph_explore\` before you Read. ONE call
|
|
47
|
+
usually answers the whole question. BHgraph IS the pre-built search index —
|
|
48
|
+
so running your own grep + read loop, or delegating the lookup to a separate
|
|
49
|
+
file-reading sub-task/agent, repeats work bhgraph already did and costs more
|
|
50
|
+
for the same answer. A direct bhgraph answer is typically one to a few
|
|
51
|
+
calls; a grep/read exploration is dozens.
|
|
52
|
+
|
|
53
|
+
## How to query
|
|
54
|
+
|
|
55
|
+
- **Almost any question — "how does X work", architecture, a bug, "what/where is X", or surveying an area** → \`bhgraph_explore\` with a natural-language question or the relevant names. ONE capped call returns the verbatim source grouped by file; most often the ONLY call you need.
|
|
56
|
+
- **"How does X reach/become Y? / the flow / the path from X to Y"** → \`bhgraph_explore\`, naming the symbols that span the flow (e.g. \`mutateElement renderScene\`) — it surfaces the call path among them, riding dynamic-dispatch hops, and returns their source.
|
|
57
|
+
- **Reading or editing a file/symbol you can name** → put its name or file path in the \`bhgraph_explore\` query — it returns that current line-numbered source (safe to \`Edit\` from) with the call path and blast radius attached, so you don't Read it separately. For an overloaded name it returns every matching definition's body in one call.
|
|
58
|
+
- **Need more?** Call \`bhgraph_explore\` again with more specific names — treat the source it returns as already Read.
|
|
59
|
+
|
|
60
|
+
## Anti-patterns
|
|
61
|
+
|
|
62
|
+
- **Trust bhgraph's results — don't re-verify them with grep.** They come from a full AST parse; re-checking with grep is slower, less accurate, and wastes context.
|
|
63
|
+
- **Don't grep or Read first** to find or understand indexed code — ONE \`bhgraph_explore\` returns the relevant symbols' source together in a single round-trip. Reach for raw \`Read\`/\`Grep\` only to confirm a specific detail bhgraph didn't cover, or for what bhgraph doesn't index (configs, docs).
|
|
64
|
+
- **Don't reconstruct a flow by hand** — name the endpoints in one \`bhgraph_explore\` and it surfaces the path between them, dynamic-dispatch hops included.
|
|
65
|
+
- **After editing, check the staleness banner.** When a tool response starts with "⚠️ Some files referenced below were edited since the last index sync…", the listed files are pending re-index — Read those specific files for accurate content. Every file NOT in that banner is fresh, so still trust bhgraph. A different, rarer banner — "⚠️ BHGraph auto-sync is DISABLED…" — means live watching stopped entirely (the whole index is frozen, not just a few files); until it's resolved, Read files directly to confirm anything that may have changed.
|
|
66
|
+
|
|
67
|
+
## Limitations
|
|
68
|
+
|
|
69
|
+
- If a tool reports a project isn't indexed (no \`.bhgraph/\`), stop calling bhgraph tools for that project for the rest of the session and use your built-in tools there instead. Indexing is the user's decision — mention they can run \`bhgraph init\` if it comes up, but don't run it yourself.
|
|
70
|
+
- Index lags file writes by ~1 second.
|
|
71
|
+
- Cross-file resolution is best-effort name matching; ambiguous calls may return multiple candidates.
|
|
72
|
+
- No live correctness validation — that's still the TypeScript compiler / test suite / linter's job. BHgraph supplements those with structural context they don't have.
|
|
73
|
+
`;
|
|
74
|
+
/**
|
|
75
|
+
* Instructions variant sent when the server's own root has NO bhgraph index.
|
|
76
|
+
*
|
|
77
|
+
* The tools are still exposed (gating tool availability on whether `./` has an
|
|
78
|
+
* index is the bug behind #964: it breaks monorepos where only sub-projects are
|
|
79
|
+
* indexed, and a server that started before `bhgraph init` never surfaces the
|
|
80
|
+
* tools afterward). Instead of an "inactive" note, this variant tells the agent
|
|
81
|
+
* bhgraph works **per project**: there's no default project to query, so pass
|
|
82
|
+
* a `projectPath` to any project that HAS a `.bhgraph/`. The full single-
|
|
83
|
+
* project playbook ({@link SERVER_INSTRUCTIONS}) is sent instead when the root
|
|
84
|
+
* IS indexed, so the common case stays tight.
|
|
85
|
+
*/
|
|
86
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# BHgraph — available (per-project; pass projectPath)
|
|
87
|
+
|
|
88
|
+
BHgraph is a SQLite knowledge graph of a codebase's symbols, edges, and
|
|
89
|
+
files: one \`bhgraph_explore\` call returns the verbatim, line-numbered source
|
|
90
|
+
of the relevant symbols PLUS the call paths between them and a blast-radius
|
|
91
|
+
summary — replacing a grep + Read loop with one round-trip.
|
|
92
|
+
|
|
93
|
+
This server started somewhere with no \`.bhgraph/\` of its own, so there is no
|
|
94
|
+
default project — but the tools are available and work **per project**:
|
|
95
|
+
|
|
96
|
+
- To query a project that HAS a \`.bhgraph/\` index (e.g. a service inside a
|
|
97
|
+
monorepo, or a second repo), pass its path as \`projectPath\` to
|
|
98
|
+
\`bhgraph_explore\` (and any other bhgraph tool). BHgraph resolves the
|
|
99
|
+
nearest \`.bhgraph/\` at or above that path and answers from it — for as many
|
|
100
|
+
projects as you like in one session.
|
|
101
|
+
- For a project with no \`.bhgraph/\`, use your built-in tools (Read/Grep/Glob)
|
|
102
|
+
for that project. Indexing is the user's decision — don't run it yourself, but
|
|
103
|
+
if it comes up they can run \`bhgraph init\` in a project to enable bhgraph
|
|
104
|
+
there (a new index is picked up live, no restart).
|
|
105
|
+
`;
|
|
106
|
+
//# sourceMappingURL=server-instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDlC,CAAC;AAEF;;;;;;;;;;;GAWG;AACU,QAAA,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;CAmBhD,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP per-connection session — speaks the JSON-RPC protocol (initialize,
|
|
3
|
+
* tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
|
|
4
|
+
* per-client state only (which protocol version the client asked for, whether
|
|
5
|
+
* it advertised `roots`, the one-shot roots/list latch); the heavyweight
|
|
6
|
+
* resources (BHGraph, watcher, ToolHandler) live in the shared
|
|
7
|
+
* {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
|
|
8
|
+
* to one.
|
|
9
|
+
*
|
|
10
|
+
* The state-machine itself mirrors what `MCPServer` used to do inline before
|
|
11
|
+
* issue #411 split it out — the same regression tests in
|
|
12
|
+
* `__tests__/mcp-initialize.test.ts` still drive this code path.
|
|
13
|
+
*/
|
|
14
|
+
import { JsonRpcTransport } from './transport';
|
|
15
|
+
import { MCPEngine } from './engine';
|
|
16
|
+
/**
|
|
17
|
+
* MCP Server Info — kept on the session because some clients log it. The
|
|
18
|
+
* version tracks the real package version (was a hard-coded '0.1.0').
|
|
19
|
+
*/
|
|
20
|
+
export declare const SERVER_INFO: {
|
|
21
|
+
name: string;
|
|
22
|
+
version: string;
|
|
23
|
+
};
|
|
24
|
+
/** MCP Protocol Version (latest the server claims). */
|
|
25
|
+
export declare const PROTOCOL_VERSION = "2024-11-05";
|
|
26
|
+
export interface MCPSessionOptions {
|
|
27
|
+
/**
|
|
28
|
+
* Explicit project path from the `--path` CLI flag. When set, the session
|
|
29
|
+
* will not bother asking the client for `roots/list` — we already know
|
|
30
|
+
* where the project lives.
|
|
31
|
+
*/
|
|
32
|
+
explicitProjectPath?: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One MCP client's view of the server. Created fresh per stdio launch
|
|
36
|
+
* (direct mode) or per socket connection (daemon mode).
|
|
37
|
+
*/
|
|
38
|
+
export declare class MCPSession {
|
|
39
|
+
private transport;
|
|
40
|
+
private engine;
|
|
41
|
+
private clientSupportsRoots;
|
|
42
|
+
/** From the initialize handshake — attributes usage rollups to the agent host. */
|
|
43
|
+
private clientInfo;
|
|
44
|
+
private rootsAttempted;
|
|
45
|
+
private resolvePromise;
|
|
46
|
+
private explicitProjectPath;
|
|
47
|
+
constructor(transport: JsonRpcTransport, engine: MCPEngine, opts?: MCPSessionOptions);
|
|
48
|
+
/**
|
|
49
|
+
* Start handling messages from the transport. Returns immediately — the
|
|
50
|
+
* session lives for as long as the transport is open.
|
|
51
|
+
*/
|
|
52
|
+
start(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Tear down the session. Does NOT touch the engine (the engine may serve
|
|
55
|
+
* other sessions) or call `process.exit` (the daemon decides when to exit).
|
|
56
|
+
*/
|
|
57
|
+
stop(): void;
|
|
58
|
+
/** Underlying transport — exposed for daemon-side close hooks. */
|
|
59
|
+
getTransport(): JsonRpcTransport;
|
|
60
|
+
private handleMessage;
|
|
61
|
+
private handleInitialize;
|
|
62
|
+
private handleToolsList;
|
|
63
|
+
private handleToolsCall;
|
|
64
|
+
/**
|
|
65
|
+
* Lazy default-project resolution. Three layers:
|
|
66
|
+
* 1. await the in-flight init kicked off from `handleInitialize` (if any);
|
|
67
|
+
* 2. if still uninitialized and we never asked the client for its roots,
|
|
68
|
+
* do so now (one-shot); fall back to cwd if the client lacks roots;
|
|
69
|
+
* 3. last-resort: re-walk from the best candidate — picks up projects
|
|
70
|
+
* that were `bhgraph init`'d *after* the server started.
|
|
71
|
+
*/
|
|
72
|
+
private retryInitIfNeeded;
|
|
73
|
+
/**
|
|
74
|
+
* Ask the client for its workspace root via `roots/list` and open the
|
|
75
|
+
* first one. Falls back to `process.cwd()` on timeout or empty answer.
|
|
76
|
+
*/
|
|
77
|
+
private initFromRoots;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAuC,gBAAgB,EAAc,MAAM,aAAa,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAOrC;;;GAGG;AAGH,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAmC7C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,qBAAa,UAAU;IASnB,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IAThB,OAAO,CAAC,mBAAmB,CAAS;IACpC,kFAAkF;IAClF,OAAO,CAAC,UAAU,CAAyB;IAC3C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,mBAAmB,CAAgB;gBAGjC,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,SAAS,EACzB,IAAI,GAAE,iBAAsB;IAK9B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAIZ,kEAAkE;IAClE,YAAY,IAAI,gBAAgB;YAIlB,aAAa;YA0Cb,gBAAgB;YA0DhB,eAAe;YAkBf,eAAe;IAiC7B;;;;;;;OAOG;YACW,iBAAiB;IAyB/B;;;OAGG;YACW,aAAa;CAgB5B"}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP per-connection session — speaks the JSON-RPC protocol (initialize,
|
|
4
|
+
* tools/list, tools/call) over a single {@link JsonRpcTransport}. It owns
|
|
5
|
+
* per-client state only (which protocol version the client asked for, whether
|
|
6
|
+
* it advertised `roots`, the one-shot roots/list latch); the heavyweight
|
|
7
|
+
* resources (BHGraph, watcher, ToolHandler) live in the shared
|
|
8
|
+
* {@link MCPEngine} so daemon mode can collapse N inotify sets / DB handles
|
|
9
|
+
* to one.
|
|
10
|
+
*
|
|
11
|
+
* The state-machine itself mirrors what `MCPServer` used to do inline before
|
|
12
|
+
* issue #411 split it out — the same regression tests in
|
|
13
|
+
* `__tests__/mcp-initialize.test.ts` still drive this code path.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.MCPSession = exports.PROTOCOL_VERSION = exports.SERVER_INFO = void 0;
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
const transport_1 = require("./transport");
|
|
52
|
+
const tools_1 = require("./tools");
|
|
53
|
+
const server_instructions_1 = require("./server-instructions");
|
|
54
|
+
const version_1 = require("./version");
|
|
55
|
+
const directory_1 = require("../directory");
|
|
56
|
+
const telemetry_1 = require("../telemetry");
|
|
57
|
+
/**
|
|
58
|
+
* MCP Server Info — kept on the session because some clients log it. The
|
|
59
|
+
* version tracks the real package version (was a hard-coded '0.1.0').
|
|
60
|
+
*/
|
|
61
|
+
// Exported so the proxy can answer `initialize` locally with the IDENTICAL
|
|
62
|
+
// payload the daemon would send — no drift between the two handshake paths.
|
|
63
|
+
exports.SERVER_INFO = {
|
|
64
|
+
name: 'bhgraph',
|
|
65
|
+
version: version_1.BHGraphPackageVersion,
|
|
66
|
+
};
|
|
67
|
+
/** MCP Protocol Version (latest the server claims). */
|
|
68
|
+
exports.PROTOCOL_VERSION = '2024-11-05';
|
|
69
|
+
/**
|
|
70
|
+
* How long to wait for the client's `roots/list` response before giving up
|
|
71
|
+
* and falling back to the process cwd.
|
|
72
|
+
*/
|
|
73
|
+
const ROOTS_LIST_TIMEOUT_MS = 5000;
|
|
74
|
+
/**
|
|
75
|
+
* Convert a file:// URI to a filesystem path. Handles URL encoding and
|
|
76
|
+
* Windows drive letter paths.
|
|
77
|
+
*/
|
|
78
|
+
function fileUriToPath(uri) {
|
|
79
|
+
try {
|
|
80
|
+
const url = new URL(uri);
|
|
81
|
+
let filePath = decodeURIComponent(url.pathname);
|
|
82
|
+
if (process.platform === 'win32' && /^\/[a-zA-Z]:/.test(filePath)) {
|
|
83
|
+
filePath = filePath.slice(1);
|
|
84
|
+
}
|
|
85
|
+
return path.resolve(filePath);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return uri.replace(/^file:\/\/\/?/, '');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/** First usable filesystem path from a `roots/list` result, or null. */
|
|
92
|
+
function firstRootPath(result) {
|
|
93
|
+
if (!result || typeof result !== 'object')
|
|
94
|
+
return null;
|
|
95
|
+
const roots = result.roots;
|
|
96
|
+
if (!Array.isArray(roots) || roots.length === 0)
|
|
97
|
+
return null;
|
|
98
|
+
const first = roots[0];
|
|
99
|
+
if (typeof first?.uri !== 'string')
|
|
100
|
+
return null;
|
|
101
|
+
return fileUriToPath(first.uri);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* One MCP client's view of the server. Created fresh per stdio launch
|
|
105
|
+
* (direct mode) or per socket connection (daemon mode).
|
|
106
|
+
*/
|
|
107
|
+
class MCPSession {
|
|
108
|
+
transport;
|
|
109
|
+
engine;
|
|
110
|
+
clientSupportsRoots = false;
|
|
111
|
+
/** From the initialize handshake — attributes usage rollups to the agent host. */
|
|
112
|
+
clientInfo;
|
|
113
|
+
rootsAttempted = false;
|
|
114
|
+
resolvePromise = null;
|
|
115
|
+
explicitProjectPath;
|
|
116
|
+
constructor(transport, engine, opts = {}) {
|
|
117
|
+
this.transport = transport;
|
|
118
|
+
this.engine = engine;
|
|
119
|
+
this.explicitProjectPath = opts.explicitProjectPath ?? null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Start handling messages from the transport. Returns immediately — the
|
|
123
|
+
* session lives for as long as the transport is open.
|
|
124
|
+
*/
|
|
125
|
+
start() {
|
|
126
|
+
this.transport.start(this.handleMessage.bind(this));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Tear down the session. Does NOT touch the engine (the engine may serve
|
|
130
|
+
* other sessions) or call `process.exit` (the daemon decides when to exit).
|
|
131
|
+
*/
|
|
132
|
+
stop() {
|
|
133
|
+
this.transport.stop();
|
|
134
|
+
}
|
|
135
|
+
/** Underlying transport — exposed for daemon-side close hooks. */
|
|
136
|
+
getTransport() {
|
|
137
|
+
return this.transport;
|
|
138
|
+
}
|
|
139
|
+
async handleMessage(message) {
|
|
140
|
+
const isRequest = 'id' in message;
|
|
141
|
+
switch (message.method) {
|
|
142
|
+
case 'initialize':
|
|
143
|
+
if (isRequest)
|
|
144
|
+
await this.handleInitialize(message);
|
|
145
|
+
break;
|
|
146
|
+
case 'initialized':
|
|
147
|
+
// Notification that client has finished initialization — no action needed.
|
|
148
|
+
break;
|
|
149
|
+
case 'tools/list':
|
|
150
|
+
if (isRequest)
|
|
151
|
+
await this.handleToolsList(message);
|
|
152
|
+
break;
|
|
153
|
+
case 'tools/call':
|
|
154
|
+
if (isRequest)
|
|
155
|
+
await this.handleToolsCall(message);
|
|
156
|
+
break;
|
|
157
|
+
case 'ping':
|
|
158
|
+
if (isRequest)
|
|
159
|
+
this.transport.sendResult(message.id, {});
|
|
160
|
+
break;
|
|
161
|
+
case 'resources/list':
|
|
162
|
+
// We expose no MCP resources, but some clients (opencode, Codex) probe
|
|
163
|
+
// for them on connect; reply with an empty list instead of a
|
|
164
|
+
// MethodNotFound error that surfaces as a scary `-32601` log line. (#621)
|
|
165
|
+
if (isRequest)
|
|
166
|
+
this.transport.sendResult(message.id, { resources: [] });
|
|
167
|
+
break;
|
|
168
|
+
case 'resources/templates/list':
|
|
169
|
+
if (isRequest)
|
|
170
|
+
this.transport.sendResult(message.id, { resourceTemplates: [] });
|
|
171
|
+
break;
|
|
172
|
+
case 'prompts/list':
|
|
173
|
+
// Likewise — no prompts exposed, but answer the probe cleanly. (#621)
|
|
174
|
+
if (isRequest)
|
|
175
|
+
this.transport.sendResult(message.id, { prompts: [] });
|
|
176
|
+
break;
|
|
177
|
+
default:
|
|
178
|
+
if (isRequest) {
|
|
179
|
+
this.transport.sendError(message.id, transport_1.ErrorCodes.MethodNotFound, `Method not found: ${message.method}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async handleInitialize(request) {
|
|
184
|
+
const params = request.params;
|
|
185
|
+
this.clientSupportsRoots = !!params?.capabilities?.roots;
|
|
186
|
+
if (params?.clientInfo) {
|
|
187
|
+
this.clientInfo = {
|
|
188
|
+
name: typeof params.clientInfo.name === 'string' ? params.clientInfo.name : undefined,
|
|
189
|
+
version: typeof params.clientInfo.version === 'string' ? params.clientInfo.version : undefined,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
// Explicit project signal, strongest first: client-provided rootUri /
|
|
193
|
+
// workspaceFolders (LSP-style), else the --path the server was launched
|
|
194
|
+
// with. cwd is NOT used here — we defer it so a roots/list answer can
|
|
195
|
+
// win over it. See issue #196.
|
|
196
|
+
let explicitPath = null;
|
|
197
|
+
if (params?.rootUri) {
|
|
198
|
+
explicitPath = fileUriToPath(params.rootUri);
|
|
199
|
+
}
|
|
200
|
+
else if (params?.workspaceFolders?.[0]?.uri) {
|
|
201
|
+
explicitPath = fileUriToPath(params.workspaceFolders[0].uri);
|
|
202
|
+
}
|
|
203
|
+
else if (this.explicitProjectPath) {
|
|
204
|
+
explicitPath = this.explicitProjectPath;
|
|
205
|
+
}
|
|
206
|
+
// Pick the instructions variant by the root's index state — a cheap
|
|
207
|
+
// synchronous walk-up (existsSync loop only, no DB open, so the #172
|
|
208
|
+
// respond-fast contract holds). When the root IS indexed, send the full
|
|
209
|
+
// single-project playbook. When it ISN'T, send the per-project variant
|
|
210
|
+
// (tools are still exposed — see handleToolsList): it tells the agent there
|
|
211
|
+
// is no default project and to pass `projectPath` to any project that has a
|
|
212
|
+
// `.bhgraph/`. Gating tool AVAILABILITY on whether `./` is indexed was the
|
|
213
|
+
// #964 bug — it broke monorepos (only sub-projects indexed) and never
|
|
214
|
+
// surfaced the tools after a mid-session `bhgraph init`. When no explicit
|
|
215
|
+
// path is known yet (roots/list dance pending), cwd is the best predictor of
|
|
216
|
+
// where the default project will resolve.
|
|
217
|
+
const indexed = (0, directory_1.findNearestBHGraphRoot)(explicitPath ?? process.cwd()) !== null;
|
|
218
|
+
// Respond to the handshake BEFORE doing any heavy init — see issue #172.
|
|
219
|
+
this.transport.sendResult(request.id, {
|
|
220
|
+
protocolVersion: exports.PROTOCOL_VERSION,
|
|
221
|
+
capabilities: { tools: {} },
|
|
222
|
+
serverInfo: exports.SERVER_INFO,
|
|
223
|
+
instructions: indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.SERVER_INSTRUCTIONS_NO_ROOT_INDEX,
|
|
224
|
+
});
|
|
225
|
+
if (explicitPath) {
|
|
226
|
+
// Kick off engine init in the background. If another session in the
|
|
227
|
+
// same daemon already opened the project, `ensureInitialized` is a
|
|
228
|
+
// ~free no-op — N concurrent clients pay exactly one open.
|
|
229
|
+
this.resolvePromise = this.engine.ensureInitialized(explicitPath);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async handleToolsList(request) {
|
|
233
|
+
await this.retryInitIfNeeded();
|
|
234
|
+
// Always expose the tools — even when the server root has no index. Gating
|
|
235
|
+
// availability on whether `./` is indexed (the old behavior) breaks the
|
|
236
|
+
// monorepo case where only sub-projects carry a `.bhgraph/` (the agent
|
|
237
|
+
// saw zero tools and couldn't even reach an indexed sub-project by
|
|
238
|
+
// `projectPath`), and it hides the tools from a session that started before
|
|
239
|
+
// the user ran `bhgraph init` (most hosts request the list once, so the
|
|
240
|
+
// freshly-built index never surfaces). #964. The not-indexed case is still
|
|
241
|
+
// safe: a call against an un-indexed path returns SUCCESS-shaped guidance
|
|
242
|
+
// ("pass projectPath / run bhgraph init"), never `isError`, so it can't
|
|
243
|
+
// teach the agent to abandon bhgraph. `getTools()` returns the default
|
|
244
|
+
// surface even before a project is open.
|
|
245
|
+
this.transport.sendResult(request.id, {
|
|
246
|
+
tools: this.engine.getToolHandler().getTools(),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
async handleToolsCall(request) {
|
|
250
|
+
const params = request.params;
|
|
251
|
+
if (!params || !params.name) {
|
|
252
|
+
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, 'Missing tool name');
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const toolName = params.name;
|
|
256
|
+
const toolArgs = params.arguments || {};
|
|
257
|
+
const tool = tools_1.tools.find((t) => t.name === toolName);
|
|
258
|
+
if (!tool) {
|
|
259
|
+
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${toolName}`);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
await this.retryInitIfNeeded();
|
|
263
|
+
const result = await this.engine.getToolHandler().execute(toolName, toolArgs);
|
|
264
|
+
this.transport.sendResult(request.id, result);
|
|
265
|
+
// After the reply is on the wire — telemetry must never delay a tool
|
|
266
|
+
// response (in-memory increment only; see src/telemetry).
|
|
267
|
+
(0, telemetry_1.getTelemetry)().recordUsage('mcp_tool', toolName, !result.isError, this.clientInfo);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Lazy default-project resolution. Three layers:
|
|
271
|
+
* 1. await the in-flight init kicked off from `handleInitialize` (if any);
|
|
272
|
+
* 2. if still uninitialized and we never asked the client for its roots,
|
|
273
|
+
* do so now (one-shot); fall back to cwd if the client lacks roots;
|
|
274
|
+
* 3. last-resort: re-walk from the best candidate — picks up projects
|
|
275
|
+
* that were `bhgraph init`'d *after* the server started.
|
|
276
|
+
*/
|
|
277
|
+
async retryInitIfNeeded() {
|
|
278
|
+
if (this.resolvePromise) {
|
|
279
|
+
try {
|
|
280
|
+
await this.resolvePromise;
|
|
281
|
+
}
|
|
282
|
+
catch { /* fall through to retry */ }
|
|
283
|
+
this.resolvePromise = null;
|
|
284
|
+
}
|
|
285
|
+
if (this.engine.hasDefaultBHGraph())
|
|
286
|
+
return;
|
|
287
|
+
const hint = this.explicitProjectPath ?? this.engine.getProjectPath();
|
|
288
|
+
if (!hint && !this.rootsAttempted) {
|
|
289
|
+
this.rootsAttempted = true;
|
|
290
|
+
this.resolvePromise = this.clientSupportsRoots
|
|
291
|
+
? this.initFromRoots()
|
|
292
|
+
: this.engine.ensureInitialized(process.cwd());
|
|
293
|
+
try {
|
|
294
|
+
await this.resolvePromise;
|
|
295
|
+
}
|
|
296
|
+
catch { /* fall through */ }
|
|
297
|
+
this.resolvePromise = null;
|
|
298
|
+
if (this.engine.hasDefaultBHGraph())
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
// Last resort: walk from the best candidate (sync open). Picks up
|
|
302
|
+
// projects that appeared after the server started.
|
|
303
|
+
const candidate = hint ?? process.cwd();
|
|
304
|
+
this.engine.retryInitializeSync(candidate);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Ask the client for its workspace root via `roots/list` and open the
|
|
308
|
+
* first one. Falls back to `process.cwd()` on timeout or empty answer.
|
|
309
|
+
*/
|
|
310
|
+
async initFromRoots() {
|
|
311
|
+
let target = process.cwd();
|
|
312
|
+
try {
|
|
313
|
+
const result = await this.transport.request('roots/list', undefined, ROOTS_LIST_TIMEOUT_MS);
|
|
314
|
+
const rootPath = firstRootPath(result);
|
|
315
|
+
if (rootPath) {
|
|
316
|
+
target = rootPath;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
process.stderr.write('[BHGraph MCP] Client returned no workspace roots; falling back to process cwd.\n');
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
324
|
+
process.stderr.write(`[BHGraph MCP] roots/list request failed (${msg}); falling back to process cwd.\n`);
|
|
325
|
+
}
|
|
326
|
+
await this.engine.ensureInitialized(target);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
exports.MCPSession = MCPSession;
|
|
330
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2CAAgG;AAEhG,mCAAgC;AAChC,+DAA+F;AAC/F,uCAAkD;AAClD,4CAAsD;AACtD,4CAAwD;AAExD;;;GAGG;AACH,2EAA2E;AAC3E,4EAA4E;AAC/D,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,+BAAqB;CAC/B,CAAC;AAEF,uDAAuD;AAC1C,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;GAGG;AACH,MAAM,qBAAqB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;QAClE,mDAAmD;QACnD,MAAM,SAAS,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,aAAa;QACzB,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;YAC5F,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,GAAG,QAAQ,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,kFAAkF,CAAC,CAAC;YAC3G,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,4CAA4C,GAAG,mCAAmC,CAAC,CAAC;QAC3G,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AAjPD,gCAiPC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Never-initialized backstop for `serve --mcp` (#1185).
|
|
3
|
+
*
|
|
4
|
+
* Every real MCP host sends `initialize` immediately after spawning a server.
|
|
5
|
+
* A server that has received NO bytes at all for many minutes is not serving
|
|
6
|
+
* anyone — it is the residue of an abandoned launch: the host killed the
|
|
7
|
+
* launcher chain during startup (config probe, instant cancel, initialize
|
|
8
|
+
* timeout) but kept our stdio pipe fds open, so stdin never EOFs. If the kill
|
|
9
|
+
* landed before {@link ../mcp/early-ppid} could observe the real parent, the
|
|
10
|
+
* PPID watchdog is blind too (baseline `1`), and — pre-#1185 — the orphan
|
|
11
|
+
* lived until the HOST process exited, accumulating one ~30MB node process
|
|
12
|
+
* per occurrence.
|
|
13
|
+
*
|
|
14
|
+
* This backstop closes that last hole: arm a one-shot timer at serve start
|
|
15
|
+
* and disarm it on the first byte of client traffic. If the timer fires, the
|
|
16
|
+
* caller shuts the server down. The default is deliberately generous (15
|
|
17
|
+
* minutes) — hosts initialize within milliseconds, so the only processes this
|
|
18
|
+
* ever reaps are ones nobody is talking to. It never affects a session that
|
|
19
|
+
* spoke even once: after the first byte the timer is gone for good (a
|
|
20
|
+
* quiet-but-live session is the PPID watchdog's / stdin teardown's job).
|
|
21
|
+
*
|
|
22
|
+
* IMPORTANT (callers): attaching a `'data'` listener switches the stream into
|
|
23
|
+
* flowing mode. Arm this AFTER the real stdin consumer is attached, in the
|
|
24
|
+
* same synchronous block, so no early bytes are emitted while only our
|
|
25
|
+
* listener exists. The detached daemon must never arm this — its stdin is
|
|
26
|
+
* `'ignore'` and its lifecycle is refcount/idle-based.
|
|
27
|
+
*
|
|
28
|
+
* Tune with `BHGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS`; `0` disables.
|
|
29
|
+
*/
|
|
30
|
+
/** Default wait for the first byte of MCP traffic before assuming orphaned. */
|
|
31
|
+
export declare const DEFAULT_STARTUP_HANDSHAKE_TIMEOUT_MS = 900000;
|
|
32
|
+
export declare const STARTUP_HANDSHAKE_TIMEOUT_ENV = "BHGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS";
|
|
33
|
+
/**
|
|
34
|
+
* Parse the timeout env override. Missing/invalid → default; `<= 0` → `0`
|
|
35
|
+
* (disabled), the same disable convention as `BHGRAPH_PPID_POLL_MS`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseStartupHandshakeTimeoutMs(raw: string | undefined): number;
|
|
38
|
+
/**
|
|
39
|
+
* Arm the backstop. `onAbandoned` runs at most once, only if no `'data'` event
|
|
40
|
+
* arrives on `stream` within the timeout. Returns a disarm function (idempotent;
|
|
41
|
+
* also detaches the listener). `stream`/`timeoutMs` are injectable for tests.
|
|
42
|
+
*/
|
|
43
|
+
export declare function armStartupHandshakeTimeout(onAbandoned: () => void, stream?: NodeJS.ReadableStream, timeoutMs?: number): () => void;
|
|
44
|
+
//# sourceMappingURL=startup-handshake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-handshake.d.ts","sourceRoot":"","sources":["../../src/mcp/startup-handshake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,oCAAoC,SAAU,CAAC;AAE5D,eAAO,MAAM,6BAA6B,yCAAyC,CAAC;AAEpF;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM9E;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,IAAI,EACvB,MAAM,GAAE,MAAM,CAAC,cAA8B,EAC7C,SAAS,GAAE,MAAmF,GAC7F,MAAM,IAAI,CAcZ"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Never-initialized backstop for `serve --mcp` (#1185).
|
|
4
|
+
*
|
|
5
|
+
* Every real MCP host sends `initialize` immediately after spawning a server.
|
|
6
|
+
* A server that has received NO bytes at all for many minutes is not serving
|
|
7
|
+
* anyone — it is the residue of an abandoned launch: the host killed the
|
|
8
|
+
* launcher chain during startup (config probe, instant cancel, initialize
|
|
9
|
+
* timeout) but kept our stdio pipe fds open, so stdin never EOFs. If the kill
|
|
10
|
+
* landed before {@link ../mcp/early-ppid} could observe the real parent, the
|
|
11
|
+
* PPID watchdog is blind too (baseline `1`), and — pre-#1185 — the orphan
|
|
12
|
+
* lived until the HOST process exited, accumulating one ~30MB node process
|
|
13
|
+
* per occurrence.
|
|
14
|
+
*
|
|
15
|
+
* This backstop closes that last hole: arm a one-shot timer at serve start
|
|
16
|
+
* and disarm it on the first byte of client traffic. If the timer fires, the
|
|
17
|
+
* caller shuts the server down. The default is deliberately generous (15
|
|
18
|
+
* minutes) — hosts initialize within milliseconds, so the only processes this
|
|
19
|
+
* ever reaps are ones nobody is talking to. It never affects a session that
|
|
20
|
+
* spoke even once: after the first byte the timer is gone for good (a
|
|
21
|
+
* quiet-but-live session is the PPID watchdog's / stdin teardown's job).
|
|
22
|
+
*
|
|
23
|
+
* IMPORTANT (callers): attaching a `'data'` listener switches the stream into
|
|
24
|
+
* flowing mode. Arm this AFTER the real stdin consumer is attached, in the
|
|
25
|
+
* same synchronous block, so no early bytes are emitted while only our
|
|
26
|
+
* listener exists. The detached daemon must never arm this — its stdin is
|
|
27
|
+
* `'ignore'` and its lifecycle is refcount/idle-based.
|
|
28
|
+
*
|
|
29
|
+
* Tune with `BHGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS`; `0` disables.
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.STARTUP_HANDSHAKE_TIMEOUT_ENV = exports.DEFAULT_STARTUP_HANDSHAKE_TIMEOUT_MS = void 0;
|
|
33
|
+
exports.parseStartupHandshakeTimeoutMs = parseStartupHandshakeTimeoutMs;
|
|
34
|
+
exports.armStartupHandshakeTimeout = armStartupHandshakeTimeout;
|
|
35
|
+
/** Default wait for the first byte of MCP traffic before assuming orphaned. */
|
|
36
|
+
exports.DEFAULT_STARTUP_HANDSHAKE_TIMEOUT_MS = 900_000; // 15 min
|
|
37
|
+
exports.STARTUP_HANDSHAKE_TIMEOUT_ENV = 'BHGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS';
|
|
38
|
+
/**
|
|
39
|
+
* Parse the timeout env override. Missing/invalid → default; `<= 0` → `0`
|
|
40
|
+
* (disabled), the same disable convention as `BHGRAPH_PPID_POLL_MS`.
|
|
41
|
+
*/
|
|
42
|
+
function parseStartupHandshakeTimeoutMs(raw) {
|
|
43
|
+
if (raw === undefined || raw === '')
|
|
44
|
+
return exports.DEFAULT_STARTUP_HANDSHAKE_TIMEOUT_MS;
|
|
45
|
+
const parsed = Number(raw);
|
|
46
|
+
if (!Number.isFinite(parsed))
|
|
47
|
+
return exports.DEFAULT_STARTUP_HANDSHAKE_TIMEOUT_MS;
|
|
48
|
+
if (parsed <= 0)
|
|
49
|
+
return 0;
|
|
50
|
+
return Math.floor(parsed);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Arm the backstop. `onAbandoned` runs at most once, only if no `'data'` event
|
|
54
|
+
* arrives on `stream` within the timeout. Returns a disarm function (idempotent;
|
|
55
|
+
* also detaches the listener). `stream`/`timeoutMs` are injectable for tests.
|
|
56
|
+
*/
|
|
57
|
+
function armStartupHandshakeTimeout(onAbandoned, stream = process.stdin, timeoutMs = parseStartupHandshakeTimeoutMs(process.env[exports.STARTUP_HANDSHAKE_TIMEOUT_ENV])) {
|
|
58
|
+
if (timeoutMs <= 0)
|
|
59
|
+
return () => { };
|
|
60
|
+
const onFirstData = () => { clearTimeout(timer); };
|
|
61
|
+
const timer = setTimeout(() => {
|
|
62
|
+
stream.removeListener('data', onFirstData);
|
|
63
|
+
onAbandoned();
|
|
64
|
+
}, timeoutMs);
|
|
65
|
+
// Never let the backstop itself keep an otherwise-finished process alive.
|
|
66
|
+
timer.unref?.();
|
|
67
|
+
stream.once('data', onFirstData);
|
|
68
|
+
return () => {
|
|
69
|
+
stream.removeListener('data', onFirstData);
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=startup-handshake.js.map
|