homegraph 1.1.3 → 1.4.1
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/README.md +43 -18
- package/dist/arkts/ohos-api-index.d.ts +15 -0
- package/dist/arkts/ohos-api-index.d.ts.map +1 -0
- package/dist/arkts/ohos-api-index.js +190 -0
- package/dist/arkts/ohos-api-index.js.map +1 -0
- package/dist/arkts/ohos-sdk-input.d.ts +36 -0
- package/dist/arkts/ohos-sdk-input.d.ts.map +1 -0
- package/dist/arkts/ohos-sdk-input.js +214 -0
- package/dist/arkts/ohos-sdk-input.js.map +1 -0
- package/dist/bin/command-supervision.d.ts +12 -0
- package/dist/bin/command-supervision.d.ts.map +1 -0
- package/dist/bin/command-supervision.js +86 -0
- package/dist/bin/command-supervision.js.map +1 -0
- package/dist/bin/homegraph.d.ts +1 -1
- package/dist/bin/homegraph.js +709 -168
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +85 -0
- package/dist/context/index.js.map +1 -1
- package/dist/db/index.d.ts +84 -5
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +217 -14
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +58 -1
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +131 -2
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +473 -9
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +52 -1
- package/dist/db/wal-valve.d.ts +106 -0
- package/dist/db/wal-valve.d.ts.map +1 -0
- package/dist/db/wal-valve.js +208 -0
- package/dist/db/wal-valve.js.map +1 -0
- package/dist/directory.d.ts +36 -0
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +274 -0
- package/dist/directory.js.map +1 -1
- package/dist/extraction/arkts-batch-worker.d.ts +2 -0
- package/dist/extraction/arkts-batch-worker.d.ts.map +1 -0
- package/dist/extraction/arkts-batch-worker.js +28 -0
- package/dist/extraction/arkts-batch-worker.js.map +1 -0
- package/dist/extraction/cfml-extractor.d.ts +107 -0
- package/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/dist/extraction/cfml-extractor.js +494 -0
- package/dist/extraction/cfml-extractor.js.map +1 -0
- package/dist/extraction/context.d.ts +11 -0
- package/dist/extraction/context.d.ts.map +1 -1
- package/dist/extraction/context.js +20 -0
- package/dist/extraction/context.js.map +1 -1
- package/dist/extraction/grammars.d.ts +25 -1
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +177 -24
- package/dist/extraction/grammars.js.map +1 -1
- package/dist/extraction/index.d.ts +55 -2
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +923 -381
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +13 -0
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +1 -0
- package/dist/extraction/languages/arkts-state-decorators.js +26 -0
- package/dist/extraction/languages/arkts-state-decorators.js.map +1 -0
- package/dist/extraction/languages/arkts-viewtree.d.ts +4 -2
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +21 -6
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +98 -2
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1290 -61
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +98 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +563 -1
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/cfquery.d.ts +12 -0
- package/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/dist/extraction/languages/cfquery.js +28 -0
- package/dist/extraction/languages/cfquery.js.map +1 -0
- package/dist/extraction/languages/cfscript.d.ts +3 -0
- package/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/dist/extraction/languages/cfscript.js +73 -0
- package/dist/extraction/languages/cfscript.js.map +1 -0
- package/dist/extraction/languages/cobol.d.ts +33 -0
- package/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/dist/extraction/languages/cobol.js +499 -0
- package/dist/extraction/languages/cobol.js.map +1 -0
- package/dist/extraction/languages/erlang.d.ts +3 -0
- package/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/dist/extraction/languages/erlang.js +350 -0
- package/dist/extraction/languages/erlang.js.map +1 -0
- package/dist/extraction/languages/index.d.ts.map +1 -1
- package/dist/extraction/languages/index.js +16 -0
- package/dist/extraction/languages/index.js.map +1 -1
- package/dist/extraction/languages/nix.d.ts +3 -0
- package/dist/extraction/languages/nix.d.ts.map +1 -0
- package/dist/extraction/languages/nix.js +294 -0
- package/dist/extraction/languages/nix.js.map +1 -0
- package/dist/extraction/languages/ohos-api-consumer.d.ts +34 -0
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +1 -0
- package/dist/extraction/languages/ohos-api-consumer.js +283 -0
- package/dist/extraction/languages/ohos-api-consumer.js.map +1 -0
- package/dist/extraction/languages/solidity.d.ts +3 -0
- package/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/dist/extraction/languages/solidity.js +293 -0
- package/dist/extraction/languages/solidity.js.map +1 -0
- package/dist/extraction/languages/terraform.d.ts +3 -0
- package/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/dist/extraction/languages/terraform.js +641 -0
- package/dist/extraction/languages/terraform.js.map +1 -0
- package/dist/extraction/languages/vbnet.d.ts +11 -0
- package/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/dist/extraction/languages/vbnet.js +141 -0
- package/dist/extraction/languages/vbnet.js.map +1 -0
- package/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/dist/extraction/mybatis-extractor.js +140 -38
- package/dist/extraction/mybatis-extractor.js.map +1 -1
- package/dist/extraction/parse-pool.d.ts +152 -0
- package/dist/extraction/parse-pool.d.ts.map +1 -0
- package/dist/extraction/parse-pool.js +387 -0
- package/dist/extraction/parse-pool.js.map +1 -0
- package/dist/extraction/parse-worker.js +9 -2
- package/dist/extraction/parse-worker.js.map +1 -1
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/dist/extraction/tree-sitter-helpers.js +1 -0
- package/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/dist/extraction/tree-sitter-types.d.ts +20 -1
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +59 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +952 -37
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +77 -18
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +85 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +426 -9
- package/dist/index.js.map +1 -1
- package/dist/installer/index.d.ts +42 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +97 -2
- package/dist/installer/index.js.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +30 -3
- package/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.js +50 -10
- package/dist/mcp/daemon-paths.js.map +1 -1
- package/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/dist/mcp/daemon-registry.js +7 -3
- package/dist/mcp/daemon-registry.js.map +1 -1
- package/dist/mcp/daemon.d.ts +73 -3
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +258 -40
- package/dist/mcp/daemon.js.map +1 -1
- package/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/dist/mcp/dynamic-boundaries.js +2 -1
- package/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/dist/mcp/early-ppid.d.ts +26 -0
- package/dist/mcp/early-ppid.d.ts.map +1 -0
- package/dist/mcp/early-ppid.js +29 -0
- package/dist/mcp/early-ppid.js.map +1 -0
- package/dist/mcp/engine.d.ts +16 -0
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +100 -2
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +66 -49
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/dist/mcp/liveness-watchdog.js +73 -13
- package/dist/mcp/liveness-watchdog.js.map +1 -1
- package/dist/mcp/memory-budget.d.ts +30 -0
- package/dist/mcp/memory-budget.d.ts.map +1 -0
- package/dist/mcp/memory-budget.js +123 -0
- package/dist/mcp/memory-budget.js.map +1 -0
- package/dist/mcp/ppid-watchdog.d.ts +18 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -1
- package/dist/mcp/ppid-watchdog.js +37 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -1
- package/dist/mcp/proxy.d.ts.map +1 -1
- package/dist/mcp/proxy.js +88 -4
- package/dist/mcp/proxy.js.map +1 -1
- package/dist/mcp/query-cache.d.ts +56 -0
- package/dist/mcp/query-cache.d.ts.map +1 -0
- package/dist/mcp/query-cache.js +261 -0
- package/dist/mcp/query-cache.js.map +1 -0
- package/dist/mcp/query-pool.d.ts +128 -0
- package/dist/mcp/query-pool.d.ts.map +1 -0
- package/dist/mcp/query-pool.js +374 -0
- package/dist/mcp/query-pool.js.map +1 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/query-worker.d.ts.map +1 -0
- package/dist/mcp/query-worker.js +87 -0
- package/dist/mcp/query-worker.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +4 -29
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +39 -86
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/session.d.ts +14 -0
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +28 -1
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/startup-handshake.d.ts +44 -0
- package/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/dist/mcp/startup-handshake.js +73 -0
- package/dist/mcp/startup-handshake.js.map +1 -0
- package/dist/mcp/tools.d.ts +179 -2
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +3027 -192
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transport.d.ts.map +1 -1
- package/dist/mcp/transport.js +18 -0
- package/dist/mcp/transport.js.map +1 -1
- package/dist/project-config.d.ts +58 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +141 -2
- package/dist/project-config.js.map +1 -1
- package/dist/reasoning/login.js +1 -1
- package/dist/reasoning/login.js.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts +2 -29
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.js +866 -148
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts +9 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +1232 -183
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +32 -0
- package/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/dist/resolution/cooperative-yield.js +42 -0
- package/dist/resolution/cooperative-yield.js.map +1 -0
- package/dist/resolution/frameworks/cics.d.ts +20 -0
- package/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/dist/resolution/frameworks/cics.js +90 -0
- package/dist/resolution/frameworks/cics.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/dist/resolution/frameworks/index.js +3 -0
- package/dist/resolution/frameworks/index.js.map +1 -1
- package/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/dist/resolution/frameworks/java.js +14 -6
- package/dist/resolution/frameworks/java.js.map +1 -1
- package/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/dist/resolution/frameworks/terraform.js +277 -0
- package/dist/resolution/frameworks/terraform.js.map +1 -0
- package/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/dist/resolution/goframe-synthesizer.js +8 -3
- package/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/dist/resolution/import-resolver.d.ts +7 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +129 -4
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +65 -3
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +477 -59
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts +22 -3
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +657 -39
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/strip-comments.d.ts +1 -1
- package/dist/resolution/strip-comments.d.ts.map +1 -1
- package/dist/resolution/strip-comments.js +49 -0
- package/dist/resolution/strip-comments.js.map +1 -1
- package/dist/resolution/types.d.ts +29 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.d.ts +10 -0
- package/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/dist/resolution/workspace-packages.js +142 -4
- package/dist/resolution/workspace-packages.js.map +1 -1
- package/dist/search/identifier-segments.d.ts +60 -0
- package/dist/search/identifier-segments.d.ts.map +1 -0
- package/dist/search/identifier-segments.js +176 -0
- package/dist/search/identifier-segments.js.map +1 -0
- package/dist/search/query-utils.d.ts +201 -0
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +919 -2
- package/dist/search/query-utils.js.map +1 -1
- package/dist/spec/config.d.ts +7 -11
- package/dist/spec/config.d.ts.map +1 -1
- package/dist/spec/config.js +77 -48
- package/dist/spec/config.js.map +1 -1
- package/dist/spec/db/fragment-node.d.ts +1 -0
- package/dist/spec/db/fragment-node.d.ts.map +1 -1
- package/dist/spec/db/fragment-node.js +8 -0
- package/dist/spec/db/fragment-node.js.map +1 -1
- package/dist/spec/db/fts.d.ts +14 -0
- package/dist/spec/db/fts.d.ts.map +1 -1
- package/dist/spec/db/fts.js +43 -4
- package/dist/spec/db/fts.js.map +1 -1
- package/dist/spec/db/schema.d.ts +6 -3
- package/dist/spec/db/schema.d.ts.map +1 -1
- package/dist/spec/db/schema.js +36 -4
- package/dist/spec/db/schema.js.map +1 -1
- package/dist/spec/db/schema.sql +11 -1
- package/dist/spec/evolve/logic-checker.d.ts +2 -2
- package/dist/spec/evolve/logic-checker.d.ts.map +1 -1
- package/dist/spec/evolve/logic-checker.js +3 -27
- package/dist/spec/evolve/logic-checker.js.map +1 -1
- package/dist/spec/evolve/pipeline.d.ts +21 -19
- package/dist/spec/evolve/pipeline.d.ts.map +1 -1
- package/dist/spec/evolve/pipeline.js +284 -31
- package/dist/spec/evolve/pipeline.js.map +1 -1
- package/dist/spec/evolve/spec-rewriter.d.ts +2 -2
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -1
- package/dist/spec/evolve/spec-rewriter.js +7 -31
- package/dist/spec/evolve/spec-rewriter.js.map +1 -1
- package/dist/spec/graph/queries.d.ts +97 -0
- package/dist/spec/graph/queries.d.ts.map +1 -1
- package/dist/spec/graph/queries.js +225 -0
- package/dist/spec/graph/queries.js.map +1 -1
- package/dist/spec/llm/client.d.ts +29 -0
- package/dist/spec/llm/client.d.ts.map +1 -0
- package/dist/spec/llm/client.js +123 -0
- package/dist/spec/llm/client.js.map +1 -0
- package/dist/spec/llm/index.d.ts +3 -0
- package/dist/spec/llm/index.d.ts.map +1 -0
- package/dist/spec/llm/index.js +11 -0
- package/dist/spec/llm/index.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +13 -0
- package/dist/spec/llm/prompts.d.ts.map +1 -0
- package/dist/spec/llm/prompts.js +75 -0
- package/dist/spec/llm/prompts.js.map +1 -0
- package/dist/spec/mining/git-scanner.d.ts +12 -0
- package/dist/spec/mining/git-scanner.d.ts.map +1 -1
- package/dist/spec/mining/git-scanner.js +41 -0
- package/dist/spec/mining/git-scanner.js.map +1 -1
- package/dist/spec/mining/pipeline.d.ts.map +1 -1
- package/dist/spec/mining/pipeline.js +14 -1
- package/dist/spec/mining/pipeline.js.map +1 -1
- package/dist/spec/utils.d.ts +2 -1
- package/dist/spec/utils.d.ts.map +1 -1
- package/dist/spec/utils.js +3 -1
- package/dist/spec/utils.js.map +1 -1
- package/dist/sync/git-hooks.d.ts.map +1 -1
- package/dist/sync/git-hooks.js +2 -0
- package/dist/sync/git-hooks.js.map +1 -1
- package/dist/sync/watcher.d.ts +10 -5
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +51 -14
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts +9 -0
- package/dist/sync/worktree.d.ts.map +1 -1
- package/dist/sync/worktree.js +45 -0
- package/dist/sync/worktree.js.map +1 -1
- package/dist/types.d.ts +25 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -1
- package/dist/ui/shimmer-progress.d.ts +2 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.js +19 -2
- package/dist/ui/shimmer-progress.js.map +1 -1
- package/dist/upgrade/index.d.ts +32 -0
- package/dist/upgrade/index.d.ts.map +1 -1
- package/dist/upgrade/index.js +163 -15
- package/dist/upgrade/index.js.map +1 -1
- package/dist/upgrade/remove-binary.d.ts +87 -0
- package/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/dist/upgrade/remove-binary.js +289 -0
- package/dist/upgrade/remove-binary.js.map +1 -0
- package/dist/upgrade/update-check.d.ts +92 -0
- package/dist/upgrade/update-check.d.ts.map +1 -0
- package/dist/upgrade/update-check.js +258 -0
- package/dist/upgrade/update-check.js.map +1 -0
- package/package.json +4 -4
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-all.sh +6 -0
- package/scripts/build-bundle.sh +5 -0
- package/scripts/exp_boundary_eval/README.md +247 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -0
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -0
- package/scripts/exp_boundary_eval/_utils.py +1116 -0
- package/scripts/exp_boundary_eval/analyze.py +1313 -0
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -0
- package/scripts/exp_boundary_eval/run_all.py +378 -0
- package/scripts/exp_boundary_eval/run_one.py +165 -0
- package/scripts/exp_boundary_eval/run_session.py +158 -0
- package/scripts/exp_boundary_eval/setup.py +120 -0
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -0
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -0
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -0
- package/scripts/npm-shim.js +32 -3
- package/scripts/ohos-sdk-publish.mjs +133 -0
- package/scripts/qa_eval/README.md +0 -407
- package/scripts/qa_eval/_test_deveco_probe.py +0 -41
- package/scripts/qa_eval/agent_runner.py +0 -526
- package/scripts/qa_eval/data/.gitignore +0 -4
- package/scripts/qa_eval/data/test-set.jsonl +0 -2
- package/scripts/qa_eval/eval_metrics.py +0 -274
- package/scripts/qa_eval/external_agent.py +0 -976
- package/scripts/qa_eval/llm_config.py +0 -92
- package/scripts/qa_eval/memory_monitor.py +0 -132
- package/scripts/qa_eval/my_answer_accuracy.py +0 -187
- package/scripts/qa_eval/requirements.txt +0 -2
- package/scripts/qa_eval/run_pipeline.py +0 -804
- package/scripts/qa_eval/stats_efficiency.py +0 -279
- package/scripts/qa_eval/stats_scores.py +0 -207
|
@@ -1,106 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* Server-level instructions emitted in the MCP `initialize` response.
|
|
6
4
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* giving the agent a high-level playbook for the homegraph toolset
|
|
10
|
-
* before it sees individual tool descriptions.
|
|
11
|
-
*
|
|
12
|
-
* Goals when editing this:
|
|
13
|
-
* - Lead the agent to homegraph_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 `homegraph_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
|
-
* HOMEGRAPH_MCP_TOOLS, but they are NOT listed to agents, so don't name them.
|
|
5
|
+
* Single source of truth for agent-facing tool guidance (issue #529).
|
|
6
|
+
* Edit here — not installer prompts or eval harness prompts.
|
|
22
7
|
*/
|
|
23
|
-
exports
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
10
|
+
exports.SERVER_INSTRUCTIONS = `# HomeGraph — when to call
|
|
24
11
|
|
|
25
|
-
|
|
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.
|
|
12
|
+
HomeGraph is a **local structural index of THIS repo**: symbols + call/import/extends edges + files. Use it only when the answer needs that graph.
|
|
34
13
|
|
|
35
|
-
##
|
|
14
|
+
## Call HomeGraph (closed set)
|
|
36
15
|
|
|
37
|
-
|
|
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.
|
|
16
|
+
Use \`homegraph_explore\` (primary) when **all** of these hold:
|
|
44
17
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
so running your own grep + read loop, or delegating the lookup to a separate
|
|
49
|
-
file-reading sub-task/agent, repeats work homegraph already did and costs more
|
|
50
|
-
for the same answer. A direct homegraph answer is typically one to a few
|
|
51
|
-
calls; a grep/read exploration is dozens.
|
|
18
|
+
1. The evidence lives **in this repository's source** (not an external SDK manual).
|
|
19
|
+
2. You need **structure**: definition location, who calls whom, how A reaches B, multi-file wiring, or in-repo import/usage of a named API/\`@kit\` module.
|
|
20
|
+
3. You can put **concrete names** in \`query\` — symbol, \`Type.member\`, file basename, or \`@kit…\` (skip \`homegraph_search\` when names are already known).
|
|
52
21
|
|
|
53
|
-
|
|
22
|
+
Typical fits:
|
|
54
23
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
24
|
+
- How a **feature in this repo** is wired (mechanism / cross-file / click→handler flow)
|
|
25
|
+
- Callers / callees / blast radius of a **named** symbol
|
|
26
|
+
- What a **named component/method** does (include the name; one explore is enough)
|
|
27
|
+
- In-repo usages of an imported API (not the official feature catalog)
|
|
59
28
|
|
|
60
|
-
|
|
29
|
+
**One explore with names** beats search→explore→node→grep→read. Treat returned line-numbered source as already Read. After a full explore — **answer**; do not re-verify with grep/read/node for the same symbols. Busy/partial → retry that **same** explore once.
|
|
61
30
|
|
|
62
|
-
|
|
63
|
-
- **Don't grep or Read first** to find or understand indexed code — ONE \`homegraph_explore\` returns the relevant symbols' source together in a single round-trip. Reach for raw \`Read\`/\`Grep\` only to confirm a specific detail homegraph didn't cover, or for what homegraph doesn't index (configs, docs).
|
|
64
|
-
- **Don't reconstruct a flow by hand** — name the endpoints in one \`homegraph_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 homegraph. A different, rarer banner — "⚠️ HomeGraph 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.
|
|
31
|
+
## Do not call HomeGraph otherwise
|
|
66
32
|
|
|
67
|
-
|
|
33
|
+
If the question is **outside the set above**, do **not** open any \`homegraph_*\` tool — use Read / Grep / Glob / SDK docs. HomeGraph is not a general Q&A layer; forcing it on the wrong shape costs time and tokens and often lowers quality.
|
|
68
34
|
|
|
69
|
-
|
|
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. Codegraph supplements those with structural context they don't have.
|
|
73
|
-
`;
|
|
74
|
-
/**
|
|
75
|
-
* Instructions variant sent when the server's own root has NO homegraph 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 `homegraph init` never surfaces the
|
|
80
|
-
* tools afterward). Instead of an "inactive" note, this variant tells the agent
|
|
81
|
-
* homegraph works **per project**: there's no default project to query, so pass
|
|
82
|
-
* a `projectPath` to any project that HAS a `.homegraph/`. 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 = `# Codegraph — available (per-project; pass projectPath)
|
|
35
|
+
## Tool roles
|
|
87
36
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
37
|
+
| Tool | Role |
|
|
38
|
+
|------|------|
|
|
39
|
+
| **homegraph_explore** | Primary for the closed set above |
|
|
40
|
+
| homegraph_node | One known symbol body (or indexed file) after explore named it |
|
|
41
|
+
| homegraph_callers / callees | Compact edge lists for a named symbol |
|
|
42
|
+
| homegraph_search | Rare — unknown spelling only |
|
|
43
|
+
| homegraph_files | Folder tree only |
|
|
44
|
+
|
|
45
|
+
## Tips
|
|
46
|
+
|
|
47
|
+
- **Deadline / partial** — success-shaped; retry ONE explore with the same names. Do not abandon to grep for those symbols.
|
|
48
|
+
- **Staleness banner** — Read only the listed edited files.
|
|
49
|
+
- **Not indexed** — built-in tools; user runs \`homegraph init\` — you do not.
|
|
50
|
+
`;
|
|
51
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# HomeGraph — per-project (pass projectPath)
|
|
92
52
|
|
|
93
|
-
|
|
94
|
-
default project — but the tools are available and work **per project**:
|
|
53
|
+
HomeGraph indexes a codebase into a symbol graph. Call it **only** for in-repo structural / flow / usage questions on a project that has \`.homegraph/\`. Pass that project as \`projectPath\`.
|
|
95
54
|
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
nearest \`.homegraph/\` 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 \`.homegraph/\`, 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 \`homegraph init\` in a project to enable homegraph
|
|
104
|
-
there (a new index is picked up live, no restart).
|
|
55
|
+
- Fits the closed set (structure, callers, wiring, named symbol/file) → \`homegraph_explore\`
|
|
56
|
+
- Anything else → Read/Grep/Glob — **do not call homegraph_***
|
|
57
|
+
- No index → Read/Grep/Glob; user runs \`homegraph init\` if they want indexing
|
|
105
58
|
`;
|
|
106
59
|
//# sourceMappingURL=server-instructions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"server-instructions.js","sourceRoot":"","sources":["../../src/mcp/server-instructions.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwClC,CAAC;AAEW,QAAA,iCAAiC,GAAG;;;;;;;CAOhD,CAAC"}
|
package/dist/mcp/session.d.ts
CHANGED
|
@@ -21,6 +21,20 @@ export declare const SERVER_INFO: {
|
|
|
21
21
|
name: string;
|
|
22
22
|
version: string;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Instructions for the `initialize` response, with the update-availability
|
|
26
|
+
* notice appended when one is known (#1243). Exported so the proxy's local
|
|
27
|
+
* handshake sends the IDENTICAL payload — same convention as SERVER_INFO.
|
|
28
|
+
* `getUpdateNotice` is a memoized synchronous cache read, so the #172
|
|
29
|
+
* respond-fast contract holds; when no notice exists the instructions are
|
|
30
|
+
* byte-identical to the bare constants.
|
|
31
|
+
*
|
|
32
|
+
* Test-authoring note: on a machine whose real `~/.homegraph` cache knows a
|
|
33
|
+
* newer release, spawned servers append the notice — a test asserting exact
|
|
34
|
+
* instructions equality must set `HOMEGRAPH_NO_UPDATE_CHECK=1` in the spawn
|
|
35
|
+
* env or it will fail only in the weeks after a release ships.
|
|
36
|
+
*/
|
|
37
|
+
export declare function initializeInstructions(base: string, notice?: string | null): string;
|
|
24
38
|
/** MCP Protocol Version (latest the server claims). */
|
|
25
39
|
export declare const PROTOCOL_VERSION = "2024-11-05";
|
|
26
40
|
export interface MCPSessionOptions {
|
|
@@ -1 +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;
|
|
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;AAQrC;;;GAGG;AAGH,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAwB,GAAG,MAAM,CAMtG;AAED,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;IAoC7B;;;;;;;OAOG;YACW,iBAAiB;IAyB/B;;;OAGG;YACW,aAAa;CAgB5B"}
|
package/dist/mcp/session.js
CHANGED
|
@@ -47,6 +47,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
47
47
|
})();
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
exports.MCPSession = exports.PROTOCOL_VERSION = exports.SERVER_INFO = void 0;
|
|
50
|
+
exports.initializeInstructions = initializeInstructions;
|
|
50
51
|
const path = __importStar(require("path"));
|
|
51
52
|
const transport_1 = require("./transport");
|
|
52
53
|
const tools_1 = require("./tools");
|
|
@@ -54,6 +55,7 @@ const server_instructions_1 = require("./server-instructions");
|
|
|
54
55
|
const version_1 = require("./version");
|
|
55
56
|
const directory_1 = require("../directory");
|
|
56
57
|
const telemetry_1 = require("../telemetry");
|
|
58
|
+
const update_check_1 = require("../upgrade/update-check");
|
|
57
59
|
/**
|
|
58
60
|
* MCP Server Info — kept on the session because some clients log it. The
|
|
59
61
|
* version tracks the real package version (was a hard-coded '0.1.0').
|
|
@@ -64,6 +66,25 @@ exports.SERVER_INFO = {
|
|
|
64
66
|
name: 'homegraph',
|
|
65
67
|
version: version_1.HomeGraphPackageVersion,
|
|
66
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Instructions for the `initialize` response, with the update-availability
|
|
71
|
+
* notice appended when one is known (#1243). Exported so the proxy's local
|
|
72
|
+
* handshake sends the IDENTICAL payload — same convention as SERVER_INFO.
|
|
73
|
+
* `getUpdateNotice` is a memoized synchronous cache read, so the #172
|
|
74
|
+
* respond-fast contract holds; when no notice exists the instructions are
|
|
75
|
+
* byte-identical to the bare constants.
|
|
76
|
+
*
|
|
77
|
+
* Test-authoring note: on a machine whose real `~/.homegraph` cache knows a
|
|
78
|
+
* newer release, spawned servers append the notice — a test asserting exact
|
|
79
|
+
* instructions equality must set `HOMEGRAPH_NO_UPDATE_CHECK=1` in the spawn
|
|
80
|
+
* env or it will fail only in the weeks after a release ships.
|
|
81
|
+
*/
|
|
82
|
+
function initializeInstructions(base, notice = (0, update_check_1.getUpdateNotice)()) {
|
|
83
|
+
if (!notice)
|
|
84
|
+
return base;
|
|
85
|
+
return (`${base}\n\n---\n${notice} This server keeps running the old version until ` +
|
|
86
|
+
`the user upgrades — mention it when convenient; do not run the upgrade yourself.`);
|
|
87
|
+
}
|
|
67
88
|
/** MCP Protocol Version (latest the server claims). */
|
|
68
89
|
exports.PROTOCOL_VERSION = '2024-11-05';
|
|
69
90
|
/**
|
|
@@ -220,7 +241,7 @@ class MCPSession {
|
|
|
220
241
|
protocolVersion: exports.PROTOCOL_VERSION,
|
|
221
242
|
capabilities: { tools: {} },
|
|
222
243
|
serverInfo: exports.SERVER_INFO,
|
|
223
|
-
instructions: indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.SERVER_INSTRUCTIONS_NO_ROOT_INDEX,
|
|
244
|
+
instructions: initializeInstructions(indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.SERVER_INSTRUCTIONS_NO_ROOT_INDEX),
|
|
224
245
|
});
|
|
225
246
|
if (explicitPath) {
|
|
226
247
|
// Kick off engine init in the background. If another session in the
|
|
@@ -259,8 +280,14 @@ class MCPSession {
|
|
|
259
280
|
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${toolName}`);
|
|
260
281
|
return;
|
|
261
282
|
}
|
|
283
|
+
if (process.env.HOMEGRAPH_MCP_DEBUG)
|
|
284
|
+
process.stderr.write(`[mcp-debug] toolsCall ${toolName} id=${String(request.id)} pre-init\n`);
|
|
262
285
|
await this.retryInitIfNeeded();
|
|
286
|
+
if (process.env.HOMEGRAPH_MCP_DEBUG)
|
|
287
|
+
process.stderr.write(`[mcp-debug] toolsCall ${toolName} id=${String(request.id)} dispatch\n`);
|
|
263
288
|
const result = await this.engine.getToolHandler().execute(toolName, toolArgs);
|
|
289
|
+
if (process.env.HOMEGRAPH_MCP_DEBUG)
|
|
290
|
+
process.stderr.write(`[mcp-debug] toolsCall ${toolName} id=${String(request.id)} done\n`);
|
|
264
291
|
this.transport.sendResult(request.id, result);
|
|
265
292
|
// After the reply is on the wire — telemetry must never delay a tool
|
|
266
293
|
// response (in-memory increment only; see src/telemetry).
|
package/dist/mcp/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/mcp/session.ts"],"names":[],"mappings":";AA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,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,oFAAoF,CAAC,CAAC;YAC7G,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,8CAA8C,GAAG,mCAAmC,CAAC,CAAC;QAC7G,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AApPD,gCAoPC"}
|
|
@@ -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 `HOMEGRAPH_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 = "HOMEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS";
|
|
33
|
+
/**
|
|
34
|
+
* Parse the timeout env override. Missing/invalid → default; `<= 0` → `0`
|
|
35
|
+
* (disabled), the same disable convention as `HOMEGRAPH_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,2CAA2C,CAAC;AAEtF;;;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 `HOMEGRAPH_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 = 'HOMEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS';
|
|
38
|
+
/**
|
|
39
|
+
* Parse the timeout env override. Missing/invalid → default; `<= 0` → `0`
|
|
40
|
+
* (disabled), the same disable convention as `HOMEGRAPH_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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-handshake.js","sourceRoot":"","sources":["../../src/mcp/startup-handshake.ts"],"names":[],"mappings":";AAAA;;;;;;;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