homegraph 1.4.1 → 1.5.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/LICENSE +21 -21
- package/README.md +305 -268
- package/dist/bin/command-supervision.d.ts.map +1 -1
- package/dist/bin/command-supervision.js +7 -4
- package/dist/bin/command-supervision.js.map +1 -1
- package/dist/bin/homegraph.js +304 -81
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +32 -11
- package/dist/context/index.js.map +1 -1
- package/dist/db/index.d.ts +143 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +305 -28
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.js +37 -37
- package/dist/db/queries.d.ts +43 -4
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +294 -170
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +203 -203
- package/dist/db/sqlite-adapter.d.ts +24 -17
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +292 -36
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/db/wal-valve.d.ts +15 -2
- package/dist/db/wal-valve.d.ts.map +1 -1
- package/dist/db/wal-valve.js +88 -6
- package/dist/db/wal-valve.js.map +1 -1
- package/dist/directory.js +5 -5
- package/dist/extraction/arkts-batch-worker.js +3 -2
- package/dist/extraction/arkts-batch-worker.js.map +1 -1
- package/dist/extraction/default-ignore.d.ts +39 -0
- package/dist/extraction/default-ignore.d.ts.map +1 -0
- package/dist/extraction/default-ignore.js +221 -0
- package/dist/extraction/default-ignore.js.map +1 -0
- package/dist/extraction/index.d.ts +9 -10
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +227 -323
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.d.ts +2 -4
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +6 -21
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +100 -6
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1777 -173
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/store-worker.d.ts +20 -0
- package/dist/extraction/store-worker.d.ts.map +1 -0
- package/dist/extraction/store-worker.js +102 -0
- package/dist/extraction/store-worker.js.map +1 -0
- package/dist/extraction/store-writer.d.ts +48 -0
- package/dist/extraction/store-writer.d.ts.map +1 -0
- package/dist/extraction/store-writer.js +167 -0
- package/dist/extraction/store-writer.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +47 -0
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +14 -4
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/dist/extraction/wasm-runtime-flags.js +55 -7
- package/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/dist/index.d.ts +16 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -97
- package/dist/index.js.map +1 -1
- package/dist/installer/instructions-template.js +9 -9
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/dist/mcp/liveness-watchdog.js +185 -73
- package/dist/mcp/liveness-watchdog.js.map +1 -1
- package/dist/mcp/query-worker.d.ts +2 -2
- package/dist/mcp/query-worker.js +2 -2
- package/dist/mcp/server-instructions.js +47 -47
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +42 -26
- package/dist/mcp/tools.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/resolution/callback-synthesizer.d.ts +52 -16
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +234 -180
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +10 -2
- package/dist/resolution/cooperative-yield.d.ts.map +1 -1
- package/dist/resolution/cooperative-yield.js +6 -4
- package/dist/resolution/cooperative-yield.js.map +1 -1
- package/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/dist/resolution/frameworks/go.js +29 -6
- package/dist/resolution/frameworks/go.js.map +1 -1
- package/dist/resolution/import-resolver.d.ts +2 -3
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +166 -7
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +87 -2
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +739 -131
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/memory-budget.d.ts +48 -0
- package/dist/resolution/memory-budget.d.ts.map +1 -0
- package/dist/resolution/memory-budget.js +162 -0
- package/dist/resolution/memory-budget.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +12 -1
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +439 -97
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/resolver-pool.d.ts +106 -0
- package/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/dist/resolution/resolver-pool.js +344 -0
- package/dist/resolution/resolver-pool.js.map +1 -0
- package/dist/resolution/resolver-worker.d.ts +17 -0
- package/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/dist/resolution/resolver-worker.js +141 -0
- package/dist/resolution/resolver-worker.js.map +1 -0
- package/dist/resolution/types.d.ts +3 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/spec/build/diff-parser.d.ts +55 -0
- package/dist/spec/build/diff-parser.d.ts.map +1 -0
- package/dist/spec/build/diff-parser.js +205 -0
- package/dist/spec/build/diff-parser.js.map +1 -0
- package/dist/spec/build/pipeline.d.ts +54 -0
- package/dist/spec/build/pipeline.d.ts.map +1 -0
- package/dist/spec/build/pipeline.js +170 -0
- package/dist/spec/build/pipeline.js.map +1 -0
- package/dist/spec/build/scan.d.ts +48 -0
- package/dist/spec/build/scan.d.ts.map +1 -0
- package/dist/spec/build/scan.js +89 -0
- package/dist/spec/build/scan.js.map +1 -0
- package/dist/spec/build/scope-resolver.d.ts +50 -0
- package/dist/spec/build/scope-resolver.d.ts.map +1 -0
- package/dist/spec/build/scope-resolver.js +105 -0
- package/dist/spec/build/scope-resolver.js.map +1 -0
- package/dist/spec/build/spec-extractor.d.ts +74 -0
- package/dist/spec/build/spec-extractor.d.ts.map +1 -0
- package/dist/spec/build/spec-extractor.js +344 -0
- package/dist/spec/build/spec-extractor.js.map +1 -0
- package/dist/spec/config.d.ts +35 -1
- package/dist/spec/config.d.ts.map +1 -1
- package/dist/spec/config.js +30 -5
- package/dist/spec/config.js.map +1 -1
- package/dist/spec/db/commit-node.js +4 -4
- package/dist/spec/db/fragment-node.js +10 -10
- package/dist/spec/db/fts.d.ts.map +1 -1
- package/dist/spec/db/fts.js +27 -58
- package/dist/spec/db/fts.js.map +1 -1
- package/dist/spec/db/index.d.ts +5 -3
- package/dist/spec/db/index.d.ts.map +1 -1
- package/dist/spec/db/index.js +16 -1
- package/dist/spec/db/index.js.map +1 -1
- package/dist/spec/db/persist.d.ts +45 -0
- package/dist/spec/db/persist.d.ts.map +1 -0
- package/dist/spec/db/persist.js +66 -0
- package/dist/spec/db/persist.js.map +1 -0
- package/dist/spec/db/relations.d.ts +80 -1
- package/dist/spec/db/relations.d.ts.map +1 -1
- package/dist/spec/db/relations.js +218 -47
- package/dist/spec/db/relations.js.map +1 -1
- package/dist/spec/db/schema.d.ts +4 -0
- package/dist/spec/db/schema.d.ts.map +1 -1
- package/dist/spec/db/schema.js +10 -6
- package/dist/spec/db/schema.js.map +1 -1
- package/dist/spec/db/schema.sql +121 -117
- package/dist/spec/db/spec-node.d.ts +5 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -1
- package/dist/spec/db/spec-node.js +15 -9
- package/dist/spec/db/spec-node.js.map +1 -1
- package/dist/spec/db/sql-utils.d.ts +11 -0
- package/dist/spec/db/sql-utils.d.ts.map +1 -0
- package/dist/spec/db/sql-utils.js +19 -0
- package/dist/spec/db/sql-utils.js.map +1 -0
- package/dist/spec/evolve/cluster-context.d.ts +30 -0
- package/dist/spec/evolve/cluster-context.d.ts.map +1 -0
- package/dist/spec/evolve/cluster-context.js +78 -0
- package/dist/spec/evolve/cluster-context.js.map +1 -0
- package/dist/spec/evolve/commit-spec-analyzer.d.ts +51 -0
- package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +1 -0
- package/dist/spec/evolve/commit-spec-analyzer.js +88 -0
- package/dist/spec/evolve/commit-spec-analyzer.js.map +1 -0
- package/dist/spec/evolve/commit-spec-persister.d.ts +53 -0
- package/dist/spec/evolve/commit-spec-persister.d.ts.map +1 -0
- package/dist/spec/evolve/commit-spec-persister.js +93 -0
- package/dist/spec/evolve/commit-spec-persister.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +23 -7
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -1
- package/dist/spec/evolve/impact-locator.js +58 -14
- package/dist/spec/evolve/impact-locator.js.map +1 -1
- package/dist/spec/evolve/pipeline.d.ts +62 -25
- package/dist/spec/evolve/pipeline.d.ts.map +1 -1
- package/dist/spec/evolve/pipeline.js +436 -457
- package/dist/spec/evolve/pipeline.js.map +1 -1
- package/dist/spec/evolve/spec-rewriter.d.ts +13 -13
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -1
- package/dist/spec/evolve/spec-rewriter.js +45 -45
- package/dist/spec/evolve/spec-rewriter.js.map +1 -1
- package/dist/spec/git/commits.d.ts +85 -0
- package/dist/spec/git/commits.d.ts.map +1 -0
- package/dist/spec/git/commits.js +218 -0
- package/dist/spec/git/commits.js.map +1 -0
- package/dist/spec/git/exec.d.ts +13 -0
- package/dist/spec/git/exec.d.ts.map +1 -0
- package/dist/spec/git/exec.js +19 -0
- package/dist/spec/git/exec.js.map +1 -0
- package/dist/spec/git/index.d.ts +9 -0
- package/dist/spec/git/index.d.ts.map +1 -0
- package/dist/spec/git/index.js +22 -0
- package/dist/spec/git/index.js.map +1 -0
- package/dist/spec/graph/index.d.ts +8 -0
- package/dist/spec/graph/index.d.ts.map +1 -0
- package/dist/spec/graph/index.js +17 -0
- package/dist/spec/graph/index.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +6 -35
- package/dist/spec/graph/queries.d.ts.map +1 -1
- package/dist/spec/graph/queries.js +71 -248
- package/dist/spec/graph/queries.js.map +1 -1
- package/dist/spec/llm/agent-client.d.ts +59 -0
- package/dist/spec/llm/agent-client.d.ts.map +1 -0
- package/dist/spec/llm/agent-client.js +213 -0
- package/dist/spec/llm/agent-client.js.map +1 -0
- package/dist/spec/llm/agents/claude-code.d.ts +32 -0
- package/dist/spec/llm/agents/claude-code.d.ts.map +1 -0
- package/dist/spec/llm/agents/claude-code.js +125 -0
- package/dist/spec/llm/agents/claude-code.js.map +1 -0
- package/dist/spec/llm/agents/codex.d.ts +32 -0
- package/dist/spec/llm/agents/codex.d.ts.map +1 -0
- package/dist/spec/llm/agents/codex.js +145 -0
- package/dist/spec/llm/agents/codex.js.map +1 -0
- package/dist/spec/llm/agents/detect-utils.d.ts +28 -0
- package/dist/spec/llm/agents/detect-utils.d.ts.map +1 -0
- package/dist/spec/llm/agents/detect-utils.js +91 -0
- package/dist/spec/llm/agents/detect-utils.js.map +1 -0
- package/dist/spec/llm/agents/deveco-code.d.ts +33 -0
- package/dist/spec/llm/agents/deveco-code.d.ts.map +1 -0
- package/dist/spec/llm/agents/deveco-code.js +165 -0
- package/dist/spec/llm/agents/deveco-code.js.map +1 -0
- package/dist/spec/llm/agents/index.d.ts +31 -0
- package/dist/spec/llm/agents/index.d.ts.map +1 -0
- package/dist/spec/llm/agents/index.js +65 -0
- package/dist/spec/llm/agents/index.js.map +1 -0
- package/dist/spec/llm/agents/types.d.ts +76 -0
- package/dist/spec/llm/agents/types.d.ts.map +1 -0
- package/dist/spec/llm/agents/types.js +15 -0
- package/dist/spec/llm/agents/types.js.map +1 -0
- package/dist/spec/llm/client.d.ts +31 -11
- package/dist/spec/llm/client.d.ts.map +1 -1
- package/dist/spec/llm/client.js +143 -81
- package/dist/spec/llm/client.js.map +1 -1
- package/dist/spec/llm/factory.d.ts +41 -0
- package/dist/spec/llm/factory.d.ts.map +1 -0
- package/dist/spec/llm/factory.js +80 -0
- package/dist/spec/llm/factory.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +24 -8
- package/dist/spec/llm/prompts.d.ts.map +1 -1
- package/dist/spec/llm/prompts.js +112 -62
- package/dist/spec/llm/prompts.js.map +1 -1
- package/dist/spec/llm/retry.d.ts +53 -0
- package/dist/spec/llm/retry.d.ts.map +1 -0
- package/dist/spec/llm/retry.js +153 -0
- package/dist/spec/llm/retry.js.map +1 -0
- package/dist/spec/mine/clustering/features.d.ts +38 -0
- package/dist/spec/mine/clustering/features.d.ts.map +1 -0
- package/dist/spec/mine/clustering/features.js +108 -0
- package/dist/spec/mine/clustering/features.js.map +1 -0
- package/dist/spec/mine/clustering/index.d.ts +62 -0
- package/dist/spec/mine/clustering/index.d.ts.map +1 -0
- package/dist/spec/mine/clustering/index.js +259 -0
- package/dist/spec/mine/clustering/index.js.map +1 -0
- package/dist/spec/mine/clustering/leiden.d.ts +61 -0
- package/dist/spec/mine/clustering/leiden.d.ts.map +1 -0
- package/dist/spec/mine/clustering/leiden.js +489 -0
- package/dist/spec/mine/clustering/leiden.js.map +1 -0
- package/dist/spec/mine/clustering/text-similarity.d.ts +22 -0
- package/dist/spec/mine/clustering/text-similarity.d.ts.map +1 -0
- package/dist/spec/mine/clustering/text-similarity.js +98 -0
- package/dist/spec/mine/clustering/text-similarity.js.map +1 -0
- package/dist/spec/mine/generator.d.ts +54 -0
- package/dist/spec/mine/generator.d.ts.map +1 -0
- package/dist/spec/mine/generator.js +267 -0
- package/dist/spec/mine/generator.js.map +1 -0
- package/dist/spec/mine/persist.d.ts +37 -0
- package/dist/spec/mine/persist.d.ts.map +1 -0
- package/dist/spec/mine/persist.js +170 -0
- package/dist/spec/mine/persist.js.map +1 -0
- package/dist/spec/mine/pipeline.d.ts +41 -0
- package/dist/spec/mine/pipeline.d.ts.map +1 -0
- package/dist/spec/mine/pipeline.js +236 -0
- package/dist/spec/mine/pipeline.js.map +1 -0
- package/dist/spec/mine/scanner.d.ts +59 -0
- package/dist/spec/mine/scanner.d.ts.map +1 -0
- package/dist/spec/mine/scanner.js +383 -0
- package/dist/spec/mine/scanner.js.map +1 -0
- package/dist/spec/types.d.ts +32 -0
- package/dist/spec/types.d.ts.map +1 -1
- package/dist/spec/ui/index.d.ts +9 -0
- package/dist/spec/ui/index.d.ts.map +1 -0
- package/dist/spec/ui/index.js +16 -0
- package/dist/spec/ui/index.js.map +1 -0
- package/dist/spec/ui/progress-handler.d.ts +33 -0
- package/dist/spec/ui/progress-handler.d.ts.map +1 -0
- package/dist/spec/ui/progress-handler.js +132 -0
- package/dist/spec/ui/progress-handler.js.map +1 -0
- package/dist/spec/ui/progress.d.ts +24 -0
- package/dist/spec/ui/progress.d.ts.map +1 -0
- package/dist/spec/ui/progress.js +13 -0
- package/dist/spec/ui/progress.js.map +1 -0
- package/dist/spec/utils/fs.d.ts +45 -0
- package/dist/spec/utils/fs.d.ts.map +1 -0
- package/dist/spec/utils/fs.js +163 -0
- package/dist/spec/utils/fs.js.map +1 -0
- package/dist/spec/utils/index.d.ts +12 -0
- package/dist/spec/utils/index.d.ts.map +1 -0
- package/dist/spec/utils/index.js +26 -0
- package/dist/spec/utils/index.js.map +1 -0
- package/dist/spec/utils/meta.d.ts +32 -0
- package/dist/spec/utils/meta.d.ts.map +1 -0
- package/dist/spec/utils/meta.js +122 -0
- package/dist/spec/utils/meta.js.map +1 -0
- package/dist/spec/utils/truncate.d.ts +86 -0
- package/dist/spec/utils/truncate.d.ts.map +1 -0
- package/dist/spec/utils/truncate.js +172 -0
- package/dist/spec/utils/truncate.js.map +1 -0
- package/dist/sync/watcher.d.ts +25 -1
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +76 -3
- package/dist/sync/watcher.js.map +1 -1
- package/dist/telemetry/index.js +3 -3
- package/dist/telemetry/index.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +62 -58
- package/scripts/_tmp-cfwk-resolve.log +0 -0
- package/scripts/_tmp-cfwk-sig.log +0 -0
- package/scripts/_tmp-cfwk-vt.log +0 -0
- package/scripts/add-lang/bench.sh +60 -60
- package/scripts/add-lang/check-grammar.mjs +75 -75
- package/scripts/add-lang/dump-ast.mjs +103 -103
- package/scripts/add-lang/verify-extraction.mjs +70 -70
- package/scripts/agent-eval/ab-adoption.sh +91 -91
- package/scripts/agent-eval/ab-hook.sh +86 -86
- package/scripts/agent-eval/ab-impl.sh +78 -78
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
- package/scripts/agent-eval/ab-sufficiency.sh +78 -78
- package/scripts/agent-eval/arms-F.sh +21 -21
- package/scripts/agent-eval/arms-matrix.sh +37 -37
- package/scripts/agent-eval/audit.sh +68 -68
- package/scripts/agent-eval/bench-readme.sh +28 -28
- package/scripts/agent-eval/bench-why-repo.sh +22 -22
- package/scripts/agent-eval/block-read-hook.sh +19 -19
- package/scripts/agent-eval/hook-settings.json +15 -15
- package/scripts/agent-eval/itrun.sh +120 -120
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
- package/scripts/agent-eval/offload-eval-setup.sh +24 -24
- package/scripts/agent-eval/offload-eval-styles.sh +71 -71
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
- package/scripts/agent-eval/offload-eval.md +76 -76
- package/scripts/agent-eval/parse-arms.mjs +116 -116
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
- package/scripts/agent-eval/parse-run.mjs +45 -45
- package/scripts/agent-eval/parse-session.mjs +93 -93
- package/scripts/agent-eval/probe-context.mjs +21 -21
- package/scripts/agent-eval/probe-explore.mjs +40 -40
- package/scripts/agent-eval/probe-node.mjs +20 -20
- package/scripts/agent-eval/probe-sweep.mjs +119 -119
- package/scripts/agent-eval/probe-trace.mjs +20 -20
- package/scripts/agent-eval/redirect-read-hook.sh +38 -38
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -119
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -125
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +75 -75
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/bench-arkts-init-rss.log +0 -0
- package/scripts/build-bundle.sh +123 -123
- package/scripts/exp_boundary_eval/README.md +247 -247
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/win_mcp_launcher.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -78
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -8
- package/scripts/exp_boundary_eval/_utils.py +1116 -1116
- package/scripts/exp_boundary_eval/analyze.py +1313 -1313
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -519
- package/scripts/exp_boundary_eval/run_all.py +378 -378
- package/scripts/exp_boundary_eval/run_one.py +165 -165
- package/scripts/exp_boundary_eval/run_session.py +158 -158
- package/scripts/exp_boundary_eval/setup.py +120 -120
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -73
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -36
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -24
- package/scripts/extract-release-notes.mjs +130 -130
- package/scripts/local-install.sh +41 -41
- package/scripts/npm-sdk.js +75 -75
- package/scripts/npm-shim.js +275 -275
- package/scripts/ohos-sdk-publish.mjs +133 -133
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/probe-arkts-mem-why-run.log +0 -0
- package/scripts/probe-banner-livecard-ir.log +0 -0
- package/scripts/probe-cfwk-ast.stderr.log +0 -0
- package/scripts/probe-cfwk-ast.stdout.log +0 -0
- package/scripts/probe-cfwk-attr-shape.log +0 -0
- package/scripts/probe-cfwk-cfgdump.stderr.log +0 -0
- package/scripts/probe-cfwk-cfgdump.stdout.log +0 -0
- package/scripts/probe-cfwk-cvc.stderr.log +0 -0
- package/scripts/probe-cfwk-cvc.stdout.log +0 -0
- package/scripts/probe-cfwk-diag2.log +0 -0
- package/scripts/probe-cfwk-diag3.log +0 -0
- package/scripts/probe-cfwk-fedbg.stderr.log +0 -0
- package/scripts/probe-cfwk-fedbg.stdout.log +0 -0
- package/scripts/probe-cfwk-fileresult.log +0 -0
- package/scripts/probe-cfwk-fix.stderr.log +0 -0
- package/scripts/probe-cfwk-fix.stdout.log +0 -0
- package/scripts/probe-cfwk-fix2.stderr.log +0 -0
- package/scripts/probe-cfwk-fix2.stdout.log +0 -0
- package/scripts/probe-cfwk-fix3.stderr.log +0 -0
- package/scripts/probe-cfwk-fix3.stdout.log +0 -0
- package/scripts/probe-cfwk-foreach.log +0 -0
- package/scripts/probe-cfwk-getmethod-throw.log +0 -0
- package/scripts/probe-cfwk-hg-extract.log +0 -0
- package/scripts/probe-cfwk-pr1003-noprior.stderr.log +0 -0
- package/scripts/probe-cfwk-pr1003-noprior.stdout.log +0 -0
- package/scripts/probe-cfwk-pr1003.stderr.log +0 -0
- package/scripts/probe-cfwk-pr1003.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-noprior.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-noprior.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-prior.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-prior.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-skipstate.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-skipstate.stdout.log +0 -0
- package/scripts/probe-cfwk-resolve-sim.log +0 -0
- package/scripts/probe-cfwk-tree-shape.log +0 -0
- package/scripts/probe-cfwk-walk-abort.log +0 -0
- package/scripts/probe-cfwk.log +0 -0
- package/scripts/probe-force-index.log +0 -0
- package/scripts/probe-no-force-index.log +0 -0
- package/scripts/probe-samefile-ir.stderr.log +0 -0
- package/scripts/probe-samefile-ir.stdout.log +224 -0
- package/scripts/probe-sdk-vs-project.log +0 -0
- package/scripts/probe-viewtree-downgrade.log +0 -0
- package/dist/arkts/ohos-api-index.d.ts +0 -15
- package/dist/arkts/ohos-api-index.d.ts.map +0 -1
- package/dist/arkts/ohos-api-index.js +0 -190
- package/dist/arkts/ohos-api-index.js.map +0 -1
- package/dist/arkts/ohos-sdk-input.d.ts +0 -36
- package/dist/arkts/ohos-sdk-input.d.ts.map +0 -1
- package/dist/arkts/ohos-sdk-input.js +0 -214
- package/dist/arkts/ohos-sdk-input.js.map +0 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +0 -13
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +0 -1
- package/dist/extraction/languages/arkts-state-decorators.js +0 -26
- package/dist/extraction/languages/arkts-state-decorators.js.map +0 -1
- package/dist/extraction/languages/ohos-api-consumer.d.ts +0 -34
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +0 -1
- package/dist/extraction/languages/ohos-api-consumer.js +0 -283
- package/dist/extraction/languages/ohos-api-consumer.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Probe homegraph_trace against an index using the built dist.
|
|
3
|
-
// Usage: node probe-trace.mjs <repo-with-.homegraph> <from> <to>
|
|
4
|
-
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { resolve } from 'node:path';
|
|
6
|
-
|
|
7
|
-
const [, , repo, from, to] = process.argv;
|
|
8
|
-
if (!repo || !from || !to) { console.error('usage: probe-trace.mjs <repo> <from> <to>'); process.exit(1); }
|
|
9
|
-
|
|
10
|
-
const load = async (rel) => import(pathToFileURL(resolve(rel)).href);
|
|
11
|
-
const idx = await load('dist/index.js');
|
|
12
|
-
const tools = await load('dist/mcp/tools.js');
|
|
13
|
-
const HomeGraph = idx.default?.default ?? idx.default ?? idx.HomeGraph;
|
|
14
|
-
const ToolHandler = tools.ToolHandler ?? tools.default?.ToolHandler;
|
|
15
|
-
|
|
16
|
-
const cg = HomeGraph.openSync(repo);
|
|
17
|
-
const h = new ToolHandler(cg);
|
|
18
|
-
const res = await h.execute('homegraph_trace', { from, to });
|
|
19
|
-
console.log(res.content?.[0]?.text ?? '(no text)');
|
|
20
|
-
try { cg.close?.(); } catch {}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Probe homegraph_trace against an index using the built dist.
|
|
3
|
+
// Usage: node probe-trace.mjs <repo-with-.homegraph> <from> <to>
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
|
|
7
|
+
const [, , repo, from, to] = process.argv;
|
|
8
|
+
if (!repo || !from || !to) { console.error('usage: probe-trace.mjs <repo> <from> <to>'); process.exit(1); }
|
|
9
|
+
|
|
10
|
+
const load = async (rel) => import(pathToFileURL(resolve(rel)).href);
|
|
11
|
+
const idx = await load('dist/index.js');
|
|
12
|
+
const tools = await load('dist/mcp/tools.js');
|
|
13
|
+
const HomeGraph = idx.default?.default ?? idx.default ?? idx.HomeGraph;
|
|
14
|
+
const ToolHandler = tools.ToolHandler ?? tools.default?.ToolHandler;
|
|
15
|
+
|
|
16
|
+
const cg = HomeGraph.openSync(repo);
|
|
17
|
+
const h = new ToolHandler(cg);
|
|
18
|
+
const res = await h.execute('homegraph_trace', { from, to });
|
|
19
|
+
console.log(res.content?.[0]?.text ?? '(no text)');
|
|
20
|
+
try { cg.close?.(); } catch {}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# PreToolUse(Read) REDIRECT hook — prototype for A/B (P1: get agents off Read and
|
|
3
|
-
# onto homegraph_node during implementation, not just for Q&A).
|
|
4
|
-
#
|
|
5
|
-
# When the agent Reads a SOURCE file, deny it and steer to homegraph_node's
|
|
6
|
-
# file-view, which (as of the Lever-1 change) returns the WHOLE file verbatim
|
|
7
|
-
# WITH line numbers — imports, top-level code, comments and all — PLUS the file's
|
|
8
|
-
# blast radius, in one call. That output is a strict superset of Read, so the
|
|
9
|
-
# redirect is lossless: the agent loses nothing by taking it, and gains who-
|
|
10
|
-
# depends-on-this for the edit it's about to make.
|
|
11
|
-
#
|
|
12
|
-
# Differs from block-read-hook.sh (which steers to explore/node-by-symbol): this
|
|
13
|
-
# names the FILE-VIEW path explicitly (file:"<base>" + includeCode:true), the
|
|
14
|
-
# 1:1 Read replacement we're trying to get picked during implementation.
|
|
15
|
-
#
|
|
16
|
-
# Non-source files (configs, docs, lockfiles, .env) pass through to a real Read.
|
|
17
|
-
# A redirect to a file homegraph hasn't indexed SELF-CORRECTS: the file-view
|
|
18
|
-
# replies "No indexed file matches … Read it directly", so a just-created file
|
|
19
|
-
# never dead-ends — the agent Reads it on the next turn.
|
|
20
|
-
#
|
|
21
|
-
# Wire via: claude ... --settings <settings-with-this-as-PreToolUse(Read)>
|
|
22
|
-
# Eval artifact only. The production version is an indexed-aware `homegraph`
|
|
23
|
-
# subcommand (cross-platform — no bash/jq — and queries the index so it never
|
|
24
|
-
# bounces a new/un-indexed file), wired opt-in by the installer.
|
|
25
|
-
set -uo pipefail
|
|
26
|
-
input="$(cat)"
|
|
27
|
-
fp="$(printf '%s' "$input" | jq -r '.tool_input.file_path // empty' 2>/dev/null)"
|
|
28
|
-
[ -n "$fp" ] || exit 0
|
|
29
|
-
base="$(basename "$fp")"
|
|
30
|
-
|
|
31
|
-
case "$fp" in
|
|
32
|
-
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.go|*.rs|*.java|*.rb|*.php|*.swift|*.kt|*.kts|*.scala|*.c|*.cc|*.cpp|*.h|*.hpp|*.cs|*.lua|*.vue|*.svelte|*.m|*.mm)
|
|
33
|
-
msg="homegraph has this file indexed (kept in sync on every edit). Call homegraph_node with file:\"$base\" and includeCode:true instead of Read — it returns the WHOLE file verbatim WITH line numbers (imports, top-level code and all — safe to base an Edit on) PLUS which files depend on it, in one call. Treat its output as already-Read; do not Read this file. (If it answers that the file isn't indexed — e.g. you just created it — then Read it directly.)"
|
|
34
|
-
jq -n --arg m "$msg" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$m}}'
|
|
35
|
-
exit 0
|
|
36
|
-
;;
|
|
37
|
-
esac
|
|
38
|
-
exit 0
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse(Read) REDIRECT hook — prototype for A/B (P1: get agents off Read and
|
|
3
|
+
# onto homegraph_node during implementation, not just for Q&A).
|
|
4
|
+
#
|
|
5
|
+
# When the agent Reads a SOURCE file, deny it and steer to homegraph_node's
|
|
6
|
+
# file-view, which (as of the Lever-1 change) returns the WHOLE file verbatim
|
|
7
|
+
# WITH line numbers — imports, top-level code, comments and all — PLUS the file's
|
|
8
|
+
# blast radius, in one call. That output is a strict superset of Read, so the
|
|
9
|
+
# redirect is lossless: the agent loses nothing by taking it, and gains who-
|
|
10
|
+
# depends-on-this for the edit it's about to make.
|
|
11
|
+
#
|
|
12
|
+
# Differs from block-read-hook.sh (which steers to explore/node-by-symbol): this
|
|
13
|
+
# names the FILE-VIEW path explicitly (file:"<base>" + includeCode:true), the
|
|
14
|
+
# 1:1 Read replacement we're trying to get picked during implementation.
|
|
15
|
+
#
|
|
16
|
+
# Non-source files (configs, docs, lockfiles, .env) pass through to a real Read.
|
|
17
|
+
# A redirect to a file homegraph hasn't indexed SELF-CORRECTS: the file-view
|
|
18
|
+
# replies "No indexed file matches … Read it directly", so a just-created file
|
|
19
|
+
# never dead-ends — the agent Reads it on the next turn.
|
|
20
|
+
#
|
|
21
|
+
# Wire via: claude ... --settings <settings-with-this-as-PreToolUse(Read)>
|
|
22
|
+
# Eval artifact only. The production version is an indexed-aware `homegraph`
|
|
23
|
+
# subcommand (cross-platform — no bash/jq — and queries the index so it never
|
|
24
|
+
# bounces a new/un-indexed file), wired opt-in by the installer.
|
|
25
|
+
set -uo pipefail
|
|
26
|
+
input="$(cat)"
|
|
27
|
+
fp="$(printf '%s' "$input" | jq -r '.tool_input.file_path // empty' 2>/dev/null)"
|
|
28
|
+
[ -n "$fp" ] || exit 0
|
|
29
|
+
base="$(basename "$fp")"
|
|
30
|
+
|
|
31
|
+
case "$fp" in
|
|
32
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.py|*.go|*.rs|*.java|*.rb|*.php|*.swift|*.kt|*.kts|*.scala|*.c|*.cc|*.cpp|*.h|*.hpp|*.cs|*.lua|*.vue|*.svelte|*.m|*.mm)
|
|
33
|
+
msg="homegraph has this file indexed (kept in sync on every edit). Call homegraph_node with file:\"$base\" and includeCode:true instead of Read — it returns the WHOLE file verbatim WITH line numbers (imports, top-level code and all — safe to base an Edit on) PLUS which files depend on it, in one call. Treat its output as already-Read; do not Read this file. (If it answers that the file isn't indexed — e.g. you just created it — then Read it directly.)"
|
|
34
|
+
jq -n --arg m "$msg" '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$m}}'
|
|
35
|
+
exit 0
|
|
36
|
+
;;
|
|
37
|
+
esac
|
|
38
|
+
exit 0
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Reproduction harness A — does the shared daemon serialize concurrent explore?
|
|
3
|
-
//
|
|
4
|
-
// Mirrors the daemon's reality: ONE CodeGraph + ONE ToolHandler (as MCPEngine
|
|
5
|
-
// shares across all sessions), then fires N concurrent codegraph_explore calls
|
|
6
|
-
// and measures:
|
|
7
|
-
// - each call's wall-clock latency + completion order
|
|
8
|
-
// - an event-loop HEARTBEAT (setInterval 50ms): the max gap between ticks is a
|
|
9
|
-
// direct measure of how long synchronous compute blocked the loop. In the
|
|
10
|
-
// real daemon a blocked loop can't flush a finished response or read the
|
|
11
|
-
// next request, so this gap is what starves the MCP transport.
|
|
12
|
-
//
|
|
13
|
-
// Usage: node repro-concurrent-explore.mjs <repo-with-.codegraph> <N> [timeoutMs]
|
|
14
|
-
import { pathToFileURL } from 'node:url';
|
|
15
|
-
import { resolve } from 'node:path';
|
|
16
|
-
import { performance } from 'node:perf_hooks';
|
|
17
|
-
|
|
18
|
-
const [, , repo, nRaw, timeoutRaw] = process.argv;
|
|
19
|
-
if (!repo) {
|
|
20
|
-
console.error('usage: repro-concurrent-explore.mjs <repo> <N=10> [timeoutMs=60000]');
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
const N = Number(nRaw) || 10;
|
|
24
|
-
const TIMEOUT_MS = Number(timeoutRaw) || 60000; // ~ MCP SDK default request timeout
|
|
25
|
-
|
|
26
|
-
const load = async (rel) => import(pathToFileURL(resolve(rel)).href);
|
|
27
|
-
const idx = await load('dist/index.js');
|
|
28
|
-
const tools = await load('dist/mcp/tools.js');
|
|
29
|
-
const CodeGraph = idx.default?.default ?? idx.default ?? idx.CodeGraph;
|
|
30
|
-
const ToolHandler = tools.ToolHandler ?? tools.default?.ToolHandler;
|
|
31
|
-
|
|
32
|
-
// Distinct queries so no two calls are trivially identical. Mix of NL questions
|
|
33
|
-
// (exercise FTS + RWR over the whole graph) — the expensive explore path.
|
|
34
|
-
const QUERIES = [
|
|
35
|
-
'how does the text model handle edits and undo',
|
|
36
|
-
'how does the file service watch for changes on disk',
|
|
37
|
-
'how does the keybinding service resolve a chord to a command',
|
|
38
|
-
'how does the extension host activate an extension',
|
|
39
|
-
'how does the editor render decorations in the viewport',
|
|
40
|
-
'how does the search service stream results to the UI',
|
|
41
|
-
'how does the terminal process manager spawn a shell',
|
|
42
|
-
'how does the configuration service merge user and workspace settings',
|
|
43
|
-
'how does the debug adapter forward breakpoints to the runtime',
|
|
44
|
-
'how does the quick input widget filter its items',
|
|
45
|
-
'how does the notification service queue and show toasts',
|
|
46
|
-
'how does the git extension compute the diff for a file',
|
|
47
|
-
'how does the language features registry dispatch a hover request',
|
|
48
|
-
'how does the workbench layout restore editor groups on reload',
|
|
49
|
-
'how does the storage service persist state between sessions',
|
|
50
|
-
'how does the menu service build a context menu from contributions',
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const cg = CodeGraph.openSync(repo);
|
|
54
|
-
let fileCount = 0;
|
|
55
|
-
try { fileCount = cg.getStats().fileCount; } catch {}
|
|
56
|
-
const handler = new ToolHandler(cg);
|
|
57
|
-
|
|
58
|
-
// --- event-loop heartbeat ---
|
|
59
|
-
let lastTick = performance.now();
|
|
60
|
-
let maxGap = 0;
|
|
61
|
-
const gaps = [];
|
|
62
|
-
const hb = setInterval(() => {
|
|
63
|
-
const now = performance.now();
|
|
64
|
-
const gap = now - lastTick;
|
|
65
|
-
lastTick = now;
|
|
66
|
-
if (gap > 60) gaps.push(Math.round(gap)); // expected ~50ms; record stalls
|
|
67
|
-
if (gap > maxGap) maxGap = gap;
|
|
68
|
-
}, 50);
|
|
69
|
-
|
|
70
|
-
function runOne(i) {
|
|
71
|
-
const q = QUERIES[i % QUERIES.length];
|
|
72
|
-
const startedAt = performance.now();
|
|
73
|
-
let timer;
|
|
74
|
-
const timeout = new Promise((res) => {
|
|
75
|
-
timer = setTimeout(() => res({ timedOut: true }), TIMEOUT_MS);
|
|
76
|
-
});
|
|
77
|
-
const work = handler
|
|
78
|
-
.execute('codegraph_explore', { query: q })
|
|
79
|
-
.then((r) => ({ ok: !r.isError, chars: r.content?.[0]?.text?.length ?? 0 }))
|
|
80
|
-
.catch((e) => ({ ok: false, err: String(e?.message ?? e) }));
|
|
81
|
-
return Promise.race([work, timeout]).then((r) => {
|
|
82
|
-
clearTimeout(timer);
|
|
83
|
-
return { i, q, ms: Math.round(performance.now() - startedAt), ...r };
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Baseline: one warm single call (so the first-call cold paths don't skew N).
|
|
88
|
-
const warmStart = performance.now();
|
|
89
|
-
await runOne(0);
|
|
90
|
-
const warmMs = Math.round(performance.now() - warmStart);
|
|
91
|
-
|
|
92
|
-
// Reset heartbeat stats for the concurrent run.
|
|
93
|
-
gaps.length = 0; maxGap = 0; lastTick = performance.now();
|
|
94
|
-
|
|
95
|
-
const batchStart = performance.now();
|
|
96
|
-
const results = await Promise.all(Array.from({ length: N }, (_, i) => runOne(i)));
|
|
97
|
-
const batchMs = Math.round(performance.now() - batchStart);
|
|
98
|
-
clearInterval(hb);
|
|
99
|
-
|
|
100
|
-
const lat = results.map((r) => r.ms).sort((a, b) => a - b);
|
|
101
|
-
const timeouts = results.filter((r) => r.timedOut).length;
|
|
102
|
-
const p = (q) => lat[Math.min(lat.length - 1, Math.floor(q * lat.length))];
|
|
103
|
-
|
|
104
|
-
console.log('='.repeat(64));
|
|
105
|
-
console.log(`repo=${repo}`);
|
|
106
|
-
console.log(`fileCount=${fileCount} N=${N} perCallTimeout=${TIMEOUT_MS}ms`);
|
|
107
|
-
console.log(`single warm explore: ${warmMs}ms`);
|
|
108
|
-
console.log('-'.repeat(64));
|
|
109
|
-
console.log(`concurrent batch wall-clock: ${batchMs}ms`);
|
|
110
|
-
console.log(`per-call latency min=${lat[0]} p50=${p(0.5)} p90=${p(0.9)} max=${lat[lat.length - 1]} (ms)`);
|
|
111
|
-
console.log(`TIMEOUTS (>${TIMEOUT_MS}ms): ${timeouts} / ${N}`);
|
|
112
|
-
console.log(`event-loop max stall: ${Math.round(maxGap)}ms stalls>60ms: ${gaps.length}`);
|
|
113
|
-
console.log(` sum of stalls: ${gaps.reduce((a, b) => a + b, 0)}ms biggest 5: ${gaps.sort((a,b)=>b-a).slice(0,5).join(', ')}`);
|
|
114
|
-
console.log('-'.repeat(64));
|
|
115
|
-
console.log('SERIALIZATION CHECK:');
|
|
116
|
-
console.log(` if serialized, batch ≈ N×single = ~${N * warmMs}ms; actual=${batchMs}ms (ratio ${(batchMs / (N * warmMs)).toFixed(2)})`);
|
|
117
|
-
console.log(` max latency / single = ${(lat[lat.length - 1] / warmMs).toFixed(1)}× (≈N means last call waited for all others)`);
|
|
118
|
-
console.log('='.repeat(64));
|
|
119
|
-
try { cg.close?.(); } catch {}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Reproduction harness A — does the shared daemon serialize concurrent explore?
|
|
3
|
+
//
|
|
4
|
+
// Mirrors the daemon's reality: ONE CodeGraph + ONE ToolHandler (as MCPEngine
|
|
5
|
+
// shares across all sessions), then fires N concurrent codegraph_explore calls
|
|
6
|
+
// and measures:
|
|
7
|
+
// - each call's wall-clock latency + completion order
|
|
8
|
+
// - an event-loop HEARTBEAT (setInterval 50ms): the max gap between ticks is a
|
|
9
|
+
// direct measure of how long synchronous compute blocked the loop. In the
|
|
10
|
+
// real daemon a blocked loop can't flush a finished response or read the
|
|
11
|
+
// next request, so this gap is what starves the MCP transport.
|
|
12
|
+
//
|
|
13
|
+
// Usage: node repro-concurrent-explore.mjs <repo-with-.codegraph> <N> [timeoutMs]
|
|
14
|
+
import { pathToFileURL } from 'node:url';
|
|
15
|
+
import { resolve } from 'node:path';
|
|
16
|
+
import { performance } from 'node:perf_hooks';
|
|
17
|
+
|
|
18
|
+
const [, , repo, nRaw, timeoutRaw] = process.argv;
|
|
19
|
+
if (!repo) {
|
|
20
|
+
console.error('usage: repro-concurrent-explore.mjs <repo> <N=10> [timeoutMs=60000]');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const N = Number(nRaw) || 10;
|
|
24
|
+
const TIMEOUT_MS = Number(timeoutRaw) || 60000; // ~ MCP SDK default request timeout
|
|
25
|
+
|
|
26
|
+
const load = async (rel) => import(pathToFileURL(resolve(rel)).href);
|
|
27
|
+
const idx = await load('dist/index.js');
|
|
28
|
+
const tools = await load('dist/mcp/tools.js');
|
|
29
|
+
const CodeGraph = idx.default?.default ?? idx.default ?? idx.CodeGraph;
|
|
30
|
+
const ToolHandler = tools.ToolHandler ?? tools.default?.ToolHandler;
|
|
31
|
+
|
|
32
|
+
// Distinct queries so no two calls are trivially identical. Mix of NL questions
|
|
33
|
+
// (exercise FTS + RWR over the whole graph) — the expensive explore path.
|
|
34
|
+
const QUERIES = [
|
|
35
|
+
'how does the text model handle edits and undo',
|
|
36
|
+
'how does the file service watch for changes on disk',
|
|
37
|
+
'how does the keybinding service resolve a chord to a command',
|
|
38
|
+
'how does the extension host activate an extension',
|
|
39
|
+
'how does the editor render decorations in the viewport',
|
|
40
|
+
'how does the search service stream results to the UI',
|
|
41
|
+
'how does the terminal process manager spawn a shell',
|
|
42
|
+
'how does the configuration service merge user and workspace settings',
|
|
43
|
+
'how does the debug adapter forward breakpoints to the runtime',
|
|
44
|
+
'how does the quick input widget filter its items',
|
|
45
|
+
'how does the notification service queue and show toasts',
|
|
46
|
+
'how does the git extension compute the diff for a file',
|
|
47
|
+
'how does the language features registry dispatch a hover request',
|
|
48
|
+
'how does the workbench layout restore editor groups on reload',
|
|
49
|
+
'how does the storage service persist state between sessions',
|
|
50
|
+
'how does the menu service build a context menu from contributions',
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const cg = CodeGraph.openSync(repo);
|
|
54
|
+
let fileCount = 0;
|
|
55
|
+
try { fileCount = cg.getStats().fileCount; } catch {}
|
|
56
|
+
const handler = new ToolHandler(cg);
|
|
57
|
+
|
|
58
|
+
// --- event-loop heartbeat ---
|
|
59
|
+
let lastTick = performance.now();
|
|
60
|
+
let maxGap = 0;
|
|
61
|
+
const gaps = [];
|
|
62
|
+
const hb = setInterval(() => {
|
|
63
|
+
const now = performance.now();
|
|
64
|
+
const gap = now - lastTick;
|
|
65
|
+
lastTick = now;
|
|
66
|
+
if (gap > 60) gaps.push(Math.round(gap)); // expected ~50ms; record stalls
|
|
67
|
+
if (gap > maxGap) maxGap = gap;
|
|
68
|
+
}, 50);
|
|
69
|
+
|
|
70
|
+
function runOne(i) {
|
|
71
|
+
const q = QUERIES[i % QUERIES.length];
|
|
72
|
+
const startedAt = performance.now();
|
|
73
|
+
let timer;
|
|
74
|
+
const timeout = new Promise((res) => {
|
|
75
|
+
timer = setTimeout(() => res({ timedOut: true }), TIMEOUT_MS);
|
|
76
|
+
});
|
|
77
|
+
const work = handler
|
|
78
|
+
.execute('codegraph_explore', { query: q })
|
|
79
|
+
.then((r) => ({ ok: !r.isError, chars: r.content?.[0]?.text?.length ?? 0 }))
|
|
80
|
+
.catch((e) => ({ ok: false, err: String(e?.message ?? e) }));
|
|
81
|
+
return Promise.race([work, timeout]).then((r) => {
|
|
82
|
+
clearTimeout(timer);
|
|
83
|
+
return { i, q, ms: Math.round(performance.now() - startedAt), ...r };
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Baseline: one warm single call (so the first-call cold paths don't skew N).
|
|
88
|
+
const warmStart = performance.now();
|
|
89
|
+
await runOne(0);
|
|
90
|
+
const warmMs = Math.round(performance.now() - warmStart);
|
|
91
|
+
|
|
92
|
+
// Reset heartbeat stats for the concurrent run.
|
|
93
|
+
gaps.length = 0; maxGap = 0; lastTick = performance.now();
|
|
94
|
+
|
|
95
|
+
const batchStart = performance.now();
|
|
96
|
+
const results = await Promise.all(Array.from({ length: N }, (_, i) => runOne(i)));
|
|
97
|
+
const batchMs = Math.round(performance.now() - batchStart);
|
|
98
|
+
clearInterval(hb);
|
|
99
|
+
|
|
100
|
+
const lat = results.map((r) => r.ms).sort((a, b) => a - b);
|
|
101
|
+
const timeouts = results.filter((r) => r.timedOut).length;
|
|
102
|
+
const p = (q) => lat[Math.min(lat.length - 1, Math.floor(q * lat.length))];
|
|
103
|
+
|
|
104
|
+
console.log('='.repeat(64));
|
|
105
|
+
console.log(`repo=${repo}`);
|
|
106
|
+
console.log(`fileCount=${fileCount} N=${N} perCallTimeout=${TIMEOUT_MS}ms`);
|
|
107
|
+
console.log(`single warm explore: ${warmMs}ms`);
|
|
108
|
+
console.log('-'.repeat(64));
|
|
109
|
+
console.log(`concurrent batch wall-clock: ${batchMs}ms`);
|
|
110
|
+
console.log(`per-call latency min=${lat[0]} p50=${p(0.5)} p90=${p(0.9)} max=${lat[lat.length - 1]} (ms)`);
|
|
111
|
+
console.log(`TIMEOUTS (>${TIMEOUT_MS}ms): ${timeouts} / ${N}`);
|
|
112
|
+
console.log(`event-loop max stall: ${Math.round(maxGap)}ms stalls>60ms: ${gaps.length}`);
|
|
113
|
+
console.log(` sum of stalls: ${gaps.reduce((a, b) => a + b, 0)}ms biggest 5: ${gaps.sort((a,b)=>b-a).slice(0,5).join(', ')}`);
|
|
114
|
+
console.log('-'.repeat(64));
|
|
115
|
+
console.log('SERIALIZATION CHECK:');
|
|
116
|
+
console.log(` if serialized, batch ≈ N×single = ~${N * warmMs}ms; actual=${batchMs}ms (ratio ${(batchMs / (N * warmMs)).toFixed(2)})`);
|
|
117
|
+
console.log(` max latency / single = ${(lat[lat.length - 1] / warmMs).toFixed(1)}× (≈N means last call waited for all others)`);
|
|
118
|
+
console.log('='.repeat(64));
|
|
119
|
+
try { cg.close?.(); } catch {}
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Reproduction harness B — the FAITHFUL opencode scenario.
|
|
3
|
-
//
|
|
4
|
-
// Spawns N real `codegraph serve --mcp --path <repo>` processes (each becomes a
|
|
5
|
-
// proxy that attaches to ONE shared daemon — exactly what opencode does with N
|
|
6
|
-
// subagents), drives clean MCP JSON-RPC over each child's stdio, then fires ONE
|
|
7
|
-
// concurrent wave of codegraph_explore tools/call across all N and measures
|
|
8
|
-
// end-to-end latency + timeouts. This captures transport-flush starvation: a
|
|
9
|
-
// daemon event-loop blocked in synchronous explore compute can neither read the
|
|
10
|
-
// next request nor flush a finished response.
|
|
11
|
-
//
|
|
12
|
-
// Usage: node repro-daemon-clients.mjs <repo> <N=10> [perCallTimeoutMs=60000] [warm=1]
|
|
13
|
-
import { spawn } from 'node:child_process';
|
|
14
|
-
import { performance } from 'node:perf_hooks';
|
|
15
|
-
import { resolve } from 'node:path';
|
|
16
|
-
|
|
17
|
-
const [, , repoRaw, nRaw, timeoutRaw, warmRaw] = process.argv;
|
|
18
|
-
const repo = resolve(repoRaw || '.');
|
|
19
|
-
const N = Number(nRaw) || 10;
|
|
20
|
-
const TIMEOUT_MS = Number(timeoutRaw) || 60000;
|
|
21
|
-
const WARM = warmRaw === undefined ? true : warmRaw !== '0';
|
|
22
|
-
const CLI = resolve('dist/bin/codegraph.js');
|
|
23
|
-
|
|
24
|
-
const QUERIES = [
|
|
25
|
-
'how does the text model handle edits and undo',
|
|
26
|
-
'how does the file service watch for changes on disk',
|
|
27
|
-
'how does the keybinding service resolve a chord to a command',
|
|
28
|
-
'how does the extension host activate an extension',
|
|
29
|
-
'how does the editor render decorations in the viewport',
|
|
30
|
-
'how does the search service stream results to the UI',
|
|
31
|
-
'how does the terminal process manager spawn a shell',
|
|
32
|
-
'how does the configuration service merge user and workspace settings',
|
|
33
|
-
'how does the debug adapter forward breakpoints to the runtime',
|
|
34
|
-
'how does the quick input widget filter its items',
|
|
35
|
-
'how does the notification service queue and show toasts',
|
|
36
|
-
'how does the git extension compute the diff for a file',
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
function makeClient(id) {
|
|
40
|
-
const child = spawn('node', [CLI, 'serve', '--mcp', '--path', repo], {
|
|
41
|
-
env: { ...process.env, CODEGRAPH_TELEMETRY: '0', DO_NOT_TRACK: '1', CODEGRAPH_MCP_LOG_ATTACH: '0' },
|
|
42
|
-
stdio: ['pipe', 'pipe', 'inherit'],
|
|
43
|
-
});
|
|
44
|
-
let buf = '';
|
|
45
|
-
const waiters = new Map(); // id -> resolve
|
|
46
|
-
child.stdout.setEncoding('utf8');
|
|
47
|
-
child.stdout.on('data', (chunk) => {
|
|
48
|
-
buf += chunk;
|
|
49
|
-
let idx;
|
|
50
|
-
while ((idx = buf.indexOf('\n')) !== -1) {
|
|
51
|
-
const line = buf.slice(0, idx).trim();
|
|
52
|
-
buf = buf.slice(idx + 1);
|
|
53
|
-
if (!line) continue;
|
|
54
|
-
let msg; try { msg = JSON.parse(line); } catch { continue; }
|
|
55
|
-
if (msg.id !== undefined && waiters.has(msg.id)) {
|
|
56
|
-
waiters.get(msg.id)(msg);
|
|
57
|
-
waiters.delete(msg.id);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const send = (obj) => child.stdin.write(JSON.stringify(obj) + '\n');
|
|
62
|
-
const request = (method, params, rpcId, timeoutMs) =>
|
|
63
|
-
new Promise((res) => {
|
|
64
|
-
let timer;
|
|
65
|
-
if (timeoutMs) timer = setTimeout(() => { waiters.delete(rpcId); res({ __timeout: true }); }, timeoutMs);
|
|
66
|
-
waiters.set(rpcId, (m) => { if (timer) clearTimeout(timer); res(m); });
|
|
67
|
-
send({ jsonrpc: '2.0', id: rpcId, method, params });
|
|
68
|
-
});
|
|
69
|
-
return { id, child, send, request };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
73
|
-
|
|
74
|
-
const clients = Array.from({ length: N }, (_, i) => makeClient(i));
|
|
75
|
-
|
|
76
|
-
// Initialize every client (handshake is answered locally by each proxy, instant).
|
|
77
|
-
await Promise.all(clients.map((c) =>
|
|
78
|
-
c.request('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'repro', version: '1' } }, `init-${c.id}`, 10000)
|
|
79
|
-
.then(() => c.send({ jsonrpc: '2.0', method: 'initialized' }))
|
|
80
|
-
));
|
|
81
|
-
|
|
82
|
-
// Warm the daemon: one explore through client 0 forces daemon spawn + project
|
|
83
|
-
// open + catch-up gate to complete, so the concurrent wave measures the STEADY
|
|
84
|
-
// state (the user's real scenario after the first call), not cold start.
|
|
85
|
-
if (WARM) {
|
|
86
|
-
process.stderr.write('[repro] warming daemon (first explore triggers spawn+open+catchup)...\n');
|
|
87
|
-
const t0 = performance.now();
|
|
88
|
-
const r = await clients[0].request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[0] } }, 'warm-0', 120000);
|
|
89
|
-
process.stderr.write(`[repro] warm explore took ${Math.round(performance.now() - t0)}ms (timeout=${!!r.__timeout})\n`);
|
|
90
|
-
await sleep(500);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// THE WAVE: fire one explore on every client as simultaneously as possible.
|
|
94
|
-
process.stderr.write(`[repro] firing ${N} concurrent explores...\n`);
|
|
95
|
-
const waveStart = performance.now();
|
|
96
|
-
const results = await Promise.all(clients.map((c, i) => {
|
|
97
|
-
const started = performance.now();
|
|
98
|
-
return c.request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[i % QUERIES.length] } }, `call-${c.id}`, TIMEOUT_MS)
|
|
99
|
-
.then((m) => ({
|
|
100
|
-
id: c.id,
|
|
101
|
-
ms: Math.round(performance.now() - started),
|
|
102
|
-
timedOut: !!m.__timeout,
|
|
103
|
-
ok: !!m.result && !m.result.isError,
|
|
104
|
-
chars: m.result?.content?.[0]?.text?.length ?? 0,
|
|
105
|
-
}));
|
|
106
|
-
}));
|
|
107
|
-
const waveMs = Math.round(performance.now() - waveStart);
|
|
108
|
-
|
|
109
|
-
const lat = results.map((r) => r.ms).sort((a, b) => a - b);
|
|
110
|
-
const timeouts = results.filter((r) => r.timedOut).length;
|
|
111
|
-
const p = (q) => lat[Math.min(lat.length - 1, Math.floor(q * lat.length))];
|
|
112
|
-
|
|
113
|
-
console.log('='.repeat(64));
|
|
114
|
-
console.log(`HARNESS B (real daemon + ${N} proxies) repo=${repo}`);
|
|
115
|
-
console.log(`warm=${WARM} perCallTimeout=${TIMEOUT_MS}ms`);
|
|
116
|
-
console.log('-'.repeat(64));
|
|
117
|
-
console.log(`wave wall-clock: ${waveMs}ms`);
|
|
118
|
-
console.log(`per-call latency min=${lat[0]} p50=${p(0.5)} p90=${p(0.9)} max=${lat[lat.length - 1]} (ms)`);
|
|
119
|
-
console.log(`TIMEOUTS (>${TIMEOUT_MS}ms): ${timeouts} / ${N}`);
|
|
120
|
-
console.log(`completion order (id:ms): ${results.slice().sort((a,b)=>a.ms-b.ms).map(r=>`${r.id}:${r.ms}`).join(' ')}`);
|
|
121
|
-
console.log('='.repeat(64));
|
|
122
|
-
|
|
123
|
-
for (const c of clients) { try { c.child.stdin.end(); c.child.kill('SIGTERM'); } catch {} }
|
|
124
|
-
await sleep(300);
|
|
125
|
-
process.exit(0);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Reproduction harness B — the FAITHFUL opencode scenario.
|
|
3
|
+
//
|
|
4
|
+
// Spawns N real `codegraph serve --mcp --path <repo>` processes (each becomes a
|
|
5
|
+
// proxy that attaches to ONE shared daemon — exactly what opencode does with N
|
|
6
|
+
// subagents), drives clean MCP JSON-RPC over each child's stdio, then fires ONE
|
|
7
|
+
// concurrent wave of codegraph_explore tools/call across all N and measures
|
|
8
|
+
// end-to-end latency + timeouts. This captures transport-flush starvation: a
|
|
9
|
+
// daemon event-loop blocked in synchronous explore compute can neither read the
|
|
10
|
+
// next request nor flush a finished response.
|
|
11
|
+
//
|
|
12
|
+
// Usage: node repro-daemon-clients.mjs <repo> <N=10> [perCallTimeoutMs=60000] [warm=1]
|
|
13
|
+
import { spawn } from 'node:child_process';
|
|
14
|
+
import { performance } from 'node:perf_hooks';
|
|
15
|
+
import { resolve } from 'node:path';
|
|
16
|
+
|
|
17
|
+
const [, , repoRaw, nRaw, timeoutRaw, warmRaw] = process.argv;
|
|
18
|
+
const repo = resolve(repoRaw || '.');
|
|
19
|
+
const N = Number(nRaw) || 10;
|
|
20
|
+
const TIMEOUT_MS = Number(timeoutRaw) || 60000;
|
|
21
|
+
const WARM = warmRaw === undefined ? true : warmRaw !== '0';
|
|
22
|
+
const CLI = resolve('dist/bin/codegraph.js');
|
|
23
|
+
|
|
24
|
+
const QUERIES = [
|
|
25
|
+
'how does the text model handle edits and undo',
|
|
26
|
+
'how does the file service watch for changes on disk',
|
|
27
|
+
'how does the keybinding service resolve a chord to a command',
|
|
28
|
+
'how does the extension host activate an extension',
|
|
29
|
+
'how does the editor render decorations in the viewport',
|
|
30
|
+
'how does the search service stream results to the UI',
|
|
31
|
+
'how does the terminal process manager spawn a shell',
|
|
32
|
+
'how does the configuration service merge user and workspace settings',
|
|
33
|
+
'how does the debug adapter forward breakpoints to the runtime',
|
|
34
|
+
'how does the quick input widget filter its items',
|
|
35
|
+
'how does the notification service queue and show toasts',
|
|
36
|
+
'how does the git extension compute the diff for a file',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
function makeClient(id) {
|
|
40
|
+
const child = spawn('node', [CLI, 'serve', '--mcp', '--path', repo], {
|
|
41
|
+
env: { ...process.env, CODEGRAPH_TELEMETRY: '0', DO_NOT_TRACK: '1', CODEGRAPH_MCP_LOG_ATTACH: '0' },
|
|
42
|
+
stdio: ['pipe', 'pipe', 'inherit'],
|
|
43
|
+
});
|
|
44
|
+
let buf = '';
|
|
45
|
+
const waiters = new Map(); // id -> resolve
|
|
46
|
+
child.stdout.setEncoding('utf8');
|
|
47
|
+
child.stdout.on('data', (chunk) => {
|
|
48
|
+
buf += chunk;
|
|
49
|
+
let idx;
|
|
50
|
+
while ((idx = buf.indexOf('\n')) !== -1) {
|
|
51
|
+
const line = buf.slice(0, idx).trim();
|
|
52
|
+
buf = buf.slice(idx + 1);
|
|
53
|
+
if (!line) continue;
|
|
54
|
+
let msg; try { msg = JSON.parse(line); } catch { continue; }
|
|
55
|
+
if (msg.id !== undefined && waiters.has(msg.id)) {
|
|
56
|
+
waiters.get(msg.id)(msg);
|
|
57
|
+
waiters.delete(msg.id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const send = (obj) => child.stdin.write(JSON.stringify(obj) + '\n');
|
|
62
|
+
const request = (method, params, rpcId, timeoutMs) =>
|
|
63
|
+
new Promise((res) => {
|
|
64
|
+
let timer;
|
|
65
|
+
if (timeoutMs) timer = setTimeout(() => { waiters.delete(rpcId); res({ __timeout: true }); }, timeoutMs);
|
|
66
|
+
waiters.set(rpcId, (m) => { if (timer) clearTimeout(timer); res(m); });
|
|
67
|
+
send({ jsonrpc: '2.0', id: rpcId, method, params });
|
|
68
|
+
});
|
|
69
|
+
return { id, child, send, request };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
73
|
+
|
|
74
|
+
const clients = Array.from({ length: N }, (_, i) => makeClient(i));
|
|
75
|
+
|
|
76
|
+
// Initialize every client (handshake is answered locally by each proxy, instant).
|
|
77
|
+
await Promise.all(clients.map((c) =>
|
|
78
|
+
c.request('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'repro', version: '1' } }, `init-${c.id}`, 10000)
|
|
79
|
+
.then(() => c.send({ jsonrpc: '2.0', method: 'initialized' }))
|
|
80
|
+
));
|
|
81
|
+
|
|
82
|
+
// Warm the daemon: one explore through client 0 forces daemon spawn + project
|
|
83
|
+
// open + catch-up gate to complete, so the concurrent wave measures the STEADY
|
|
84
|
+
// state (the user's real scenario after the first call), not cold start.
|
|
85
|
+
if (WARM) {
|
|
86
|
+
process.stderr.write('[repro] warming daemon (first explore triggers spawn+open+catchup)...\n');
|
|
87
|
+
const t0 = performance.now();
|
|
88
|
+
const r = await clients[0].request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[0] } }, 'warm-0', 120000);
|
|
89
|
+
process.stderr.write(`[repro] warm explore took ${Math.round(performance.now() - t0)}ms (timeout=${!!r.__timeout})\n`);
|
|
90
|
+
await sleep(500);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// THE WAVE: fire one explore on every client as simultaneously as possible.
|
|
94
|
+
process.stderr.write(`[repro] firing ${N} concurrent explores...\n`);
|
|
95
|
+
const waveStart = performance.now();
|
|
96
|
+
const results = await Promise.all(clients.map((c, i) => {
|
|
97
|
+
const started = performance.now();
|
|
98
|
+
return c.request('tools/call', { name: 'codegraph_explore', arguments: { query: QUERIES[i % QUERIES.length] } }, `call-${c.id}`, TIMEOUT_MS)
|
|
99
|
+
.then((m) => ({
|
|
100
|
+
id: c.id,
|
|
101
|
+
ms: Math.round(performance.now() - started),
|
|
102
|
+
timedOut: !!m.__timeout,
|
|
103
|
+
ok: !!m.result && !m.result.isError,
|
|
104
|
+
chars: m.result?.content?.[0]?.text?.length ?? 0,
|
|
105
|
+
}));
|
|
106
|
+
}));
|
|
107
|
+
const waveMs = Math.round(performance.now() - waveStart);
|
|
108
|
+
|
|
109
|
+
const lat = results.map((r) => r.ms).sort((a, b) => a - b);
|
|
110
|
+
const timeouts = results.filter((r) => r.timedOut).length;
|
|
111
|
+
const p = (q) => lat[Math.min(lat.length - 1, Math.floor(q * lat.length))];
|
|
112
|
+
|
|
113
|
+
console.log('='.repeat(64));
|
|
114
|
+
console.log(`HARNESS B (real daemon + ${N} proxies) repo=${repo}`);
|
|
115
|
+
console.log(`warm=${WARM} perCallTimeout=${TIMEOUT_MS}ms`);
|
|
116
|
+
console.log('-'.repeat(64));
|
|
117
|
+
console.log(`wave wall-clock: ${waveMs}ms`);
|
|
118
|
+
console.log(`per-call latency min=${lat[0]} p50=${p(0.5)} p90=${p(0.9)} max=${lat[lat.length - 1]} (ms)`);
|
|
119
|
+
console.log(`TIMEOUTS (>${TIMEOUT_MS}ms): ${timeouts} / ${N}`);
|
|
120
|
+
console.log(`completion order (id:ms): ${results.slice().sort((a,b)=>a.ms-b.ms).map(r=>`${r.id}:${r.ms}`).join(' ')}`);
|
|
121
|
+
console.log('='.repeat(64));
|
|
122
|
+
|
|
123
|
+
for (const c of clients) { try { c.child.stdin.end(); c.child.kill('SIGTERM'); } catch {} }
|
|
124
|
+
await sleep(300);
|
|
125
|
+
process.exit(0);
|