homegraph 1.2.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -11
- package/dist/bin/homegraph.js +298 -72
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +117 -11
- package/dist/context/index.js.map +1 -1
- package/dist/db/index.d.ts +207 -6
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +461 -20
- 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 +19 -1
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +157 -3
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +426 -9
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +32 -1
- 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 +119 -0
- package/dist/db/wal-valve.d.ts.map +1 -0
- package/dist/db/wal-valve.js +290 -0
- package/dist/db/wal-valve.js.map +1 -0
- package/dist/directory.d.ts +9 -5
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +210 -19
- package/dist/directory.js.map +1 -1
- package/dist/extraction/arkts-batch-worker.js +3 -2
- package/dist/extraction/arkts-batch-worker.js.map +1 -1
- 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/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/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 +52 -14
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +521 -314
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +90 -6
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1579 -128
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +42 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +369 -4
- 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/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 +27 -1
- package/dist/extraction/parse-pool.d.ts.map +1 -1
- package/dist/extraction/parse-pool.js +75 -7
- package/dist/extraction/parse-pool.js.map +1 -1
- package/dist/extraction/parse-worker.js +9 -2
- package/dist/extraction/parse-worker.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-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 +3 -1
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +38 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +801 -10
- 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/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/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +1 -1
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +74 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +436 -55
- 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.d.ts +25 -3
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +62 -8
- 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 +4 -5
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +27 -1
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +41 -6
- 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/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 +35 -4
- package/dist/mcp/query-cache.d.ts.map +1 -1
- package/dist/mcp/query-cache.js +89 -19
- package/dist/mcp/query-cache.js.map +1 -1
- package/dist/mcp/query-pool.d.ts +46 -12
- package/dist/mcp/query-pool.d.ts.map +1 -1
- package/dist/mcp/query-pool.js +100 -23
- package/dist/mcp/query-pool.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.d.ts +4 -27
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +39 -84
- 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 +104 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +2432 -217
- 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 +38 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +101 -2
- package/dist/project-config.js.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.js +178 -146
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts +54 -10
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +1299 -257
- 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/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/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/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 +9 -3
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +295 -11
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +146 -8
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +1089 -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 -4
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +793 -130
- 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/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 +32 -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/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/git-scanner.d.ts +93 -0
- package/dist/spec/build/git-scanner.d.ts.map +1 -0
- package/dist/spec/build/git-scanner.js +254 -0
- package/dist/spec/build/git-scanner.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/fts.d.ts.map +1 -1
- package/dist/spec/db/fts.js +19 -50
- 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 +175 -4
- 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 +4 -0
- package/dist/spec/db/schema.js.map +1 -1
- package/dist/spec/db/schema.sql +5 -1
- 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 +11 -5
- 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/git-utils.d.ts +8 -0
- package/dist/spec/git-utils.d.ts.map +1 -0
- package/dist/spec/git-utils.js +14 -0
- package/dist/spec/git-utils.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 +100 -50
- 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/clusterer.d.ts +63 -0
- package/dist/spec/mine/clusterer.d.ts.map +1 -0
- package/dist/spec/mine/clusterer.js +904 -0
- package/dist/spec/mine/clusterer.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/progress-handler.d.ts +22 -0
- package/dist/spec/mine/progress-handler.d.ts.map +1 -0
- package/dist/spec/mine/progress-handler.js +108 -0
- package/dist/spec/mine/progress-handler.js.map +1 -0
- package/dist/spec/mine/progress.d.ts +23 -0
- package/dist/spec/mine/progress.d.ts.map +1 -0
- package/dist/spec/mine/progress.js +12 -0
- package/dist/spec/mine/progress.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/spec/utils.d.ts +4 -16
- package/dist/spec/utils.d.ts.map +1 -1
- package/dist/spec/utils.js +6 -58
- 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 +35 -6
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +127 -17
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts.map +1 -1
- package/dist/sync/worktree.js +5 -0
- package/dist/sync/worktree.js.map +1 -1
- package/dist/telemetry/index.js +3 -3
- package/dist/telemetry/index.js.map +1 -1
- package/dist/types.d.ts +22 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +10 -0
- package/dist/types.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 +162 -14
- 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 +6 -2
- package/scripts/agent-eval/run-all.sh +6 -0
- package/scripts/build-bundle.sh +5 -0
- package/scripts/npm-shim.js +8 -1
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/data/agents.json +0 -109
- package/scripts/exp_boundary_eval/data/experiments.json +0 -140
- 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
|
@@ -85,6 +85,7 @@ exports.cFnPointerDispatchEdges = cFnPointerDispatchEdges;
|
|
|
85
85
|
* key + a real-function gate; a project with no fn-pointer dispatch is a no-op.
|
|
86
86
|
*/
|
|
87
87
|
const path = __importStar(require("node:path"));
|
|
88
|
+
const lru_cache_1 = require("./lru-cache");
|
|
88
89
|
const strip_comments_1 = require("./strip-comments");
|
|
89
90
|
const C_CPP_EXT = /\.(c|h|cc|cpp|cxx|hpp|hh|hxx|cppm|ipp|inl|tcc)$/i;
|
|
90
91
|
const FN_KINDS = new Set(['function', 'method']);
|
|
@@ -337,13 +338,30 @@ const C_TYPE_KEYWORDS = new Set([
|
|
|
337
338
|
const INCLUDE_RE = /#[ \t]*include[ \t]+"([^"\n]+)"/g;
|
|
338
339
|
/** Included files worth scanning for registration tables (e.g. a generated `.def`). */
|
|
339
340
|
const INCLUDABLE_EXT = /\.(def|inc|h|hh|hpp|hxx|c|cc|cpp|cxx|ipp|tcc|tbl)$/i;
|
|
340
|
-
function cFnPointerDispatchEdges(
|
|
341
|
+
async function cFnPointerDispatchEdges(_queries, ctx, onYield, onFraction) {
|
|
342
|
+
let scannedFiles = 0;
|
|
341
343
|
const files = ctx.getAllFiles().filter((f) => C_CPP_EXT.test(f));
|
|
342
344
|
if (files.length === 0)
|
|
343
345
|
return [];
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
|
|
346
|
+
// Within-pass progress: this is the pass that parks the "Linking dynamic
|
|
347
|
+
// dispatch" bar on C-heavy repos, so it reports a real fraction of its
|
|
348
|
+
// dominant work. `files` is swept once per file loop below (passes A, C, D,
|
|
349
|
+
// E — pass B is node-bound and comparatively brief), reported at the same
|
|
350
|
+
// per-16-files cadence as the cooperative yield.
|
|
351
|
+
const FILE_SWEEPS = 4;
|
|
352
|
+
const tick = async () => {
|
|
353
|
+
if ((++scannedFiles & 15) === 0) {
|
|
354
|
+
onFraction?.(scannedFiles / (files.length * FILE_SWEEPS));
|
|
355
|
+
await onYield();
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
// Cache raw + stripped source per file, LRU-BOUNDED. The old unbounded Maps
|
|
359
|
+
// retained every C/C++ file's raw AND stripped text for the whole pass —
|
|
360
|
+
// multiple GB on the Linux kernel, one of the two OOM culprits in #1212.
|
|
361
|
+
// Every sweep below iterates in `files` order, and node-kind scans return
|
|
362
|
+
// rows in file-commit order, so access is near-sequential and a small LRU
|
|
363
|
+
// hits; a miss just re-reads + re-strips.
|
|
364
|
+
const rawCache = new lru_cache_1.LRUCache(128);
|
|
347
365
|
const raw = (file) => {
|
|
348
366
|
if (rawCache.has(file))
|
|
349
367
|
return rawCache.get(file);
|
|
@@ -351,10 +369,14 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
351
369
|
rawCache.set(file, r);
|
|
352
370
|
return r;
|
|
353
371
|
};
|
|
354
|
-
const srcCache = new
|
|
372
|
+
const srcCache = new lru_cache_1.LRUCache(128);
|
|
355
373
|
const src = (file) => {
|
|
356
|
-
|
|
357
|
-
|
|
374
|
+
// A cached '' (empty or unreadable file) returns '' where the miss path
|
|
375
|
+
// returns null for unreadable — every caller falsy-checks, so the two are
|
|
376
|
+
// interchangeable.
|
|
377
|
+
const hit = srcCache.get(file);
|
|
378
|
+
if (hit !== undefined)
|
|
379
|
+
return hit;
|
|
358
380
|
const r = raw(file);
|
|
359
381
|
const s = r == null ? '' : (0, strip_comments_1.stripCommentsForRegex)(r, 'c');
|
|
360
382
|
srcCache.set(file, s);
|
|
@@ -380,6 +402,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
380
402
|
const fnPtrTypedefs = new Set();
|
|
381
403
|
const fnTypeTypedefs = new Set();
|
|
382
404
|
for (const file of files) {
|
|
405
|
+
await tick();
|
|
383
406
|
const s = src(file);
|
|
384
407
|
if (!s || !s.includes('typedef'))
|
|
385
408
|
continue;
|
|
@@ -472,10 +495,12 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
472
495
|
if (fields.some((f) => f.isFnPtr))
|
|
473
496
|
structLayout.set(name, fields);
|
|
474
497
|
};
|
|
475
|
-
for (const st of ctx.getNodesByKind('struct')) {
|
|
498
|
+
for (const st of (ctx.iterateNodesByKind?.('struct') ?? ctx.getNodesByKind('struct'))) {
|
|
499
|
+
if ((++scannedFiles & 255) === 0)
|
|
500
|
+
await onYield();
|
|
476
501
|
if (!C_CPP_EXT.test(st.filePath))
|
|
477
502
|
continue;
|
|
478
|
-
const s =
|
|
503
|
+
const s = src(st.filePath);
|
|
479
504
|
if (!s)
|
|
480
505
|
continue;
|
|
481
506
|
const body = sliceLines(s, st.startLine, st.endLine);
|
|
@@ -490,12 +515,9 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
490
515
|
// up by `#ifdef`) is discovered later during the unit scan. The `reg.size === 0`
|
|
491
516
|
// guard after registration still short-circuits when nothing bridges.
|
|
492
517
|
const fnPtrFieldOf = (struct, field) => !!structLayout.get(struct)?.some((f) => f.name === field && f.isFnPtr);
|
|
493
|
-
// C/C++ function + method nodes
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
if (C_CPP_EXT.test(fn.filePath))
|
|
497
|
-
cFns.push(fn);
|
|
498
|
-
}
|
|
518
|
+
// C/C++ function + method nodes are STREAMED per sweep (see passes D/E) —
|
|
519
|
+
// the old materialized `cFns` array held every function node on the repo
|
|
520
|
+
// (O(nodes) memory, part of the #1212 kernel OOM).
|
|
499
521
|
// ---- function-name → node resolution (prefer a function in the same file) ----
|
|
500
522
|
const resolveFn = (name, preferFile) => {
|
|
501
523
|
const cands = ctx.getNodesByName(name).filter((n) => FN_KINDS.has(n.kind));
|
|
@@ -511,14 +533,14 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
511
533
|
return cands[0];
|
|
512
534
|
};
|
|
513
535
|
// ---- Pass C: registrations — Map<"struct.field", Set<funcNodeId>> ----
|
|
536
|
+
// Ids only — retaining the full Node per registration (the old `idToNode`)
|
|
537
|
+
// was write-only dead weight at O(registrations) memory.
|
|
514
538
|
const reg = new Map();
|
|
515
|
-
const idToNode = new Map();
|
|
516
539
|
const addReg = (struct, field, fn) => {
|
|
517
540
|
const key = `${struct}.${field}`;
|
|
518
541
|
if (!reg.has(key))
|
|
519
542
|
reg.set(key, new Set());
|
|
520
543
|
reg.get(key).add(fn.id);
|
|
521
|
-
idToNode.set(fn.id, fn);
|
|
522
544
|
};
|
|
523
545
|
// Bare arrays-of-fn-pointers (no struct): array VARIABLE name → per-file sets
|
|
524
546
|
// of registered function ids. Multi-entry because a file-scope `static` table
|
|
@@ -537,7 +559,6 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
537
559
|
entries.push(e);
|
|
538
560
|
}
|
|
539
561
|
e.ids.add(fn.id);
|
|
540
|
-
idToNode.set(fn.id, fn);
|
|
541
562
|
};
|
|
542
563
|
// A struct value `{ … }` (one element) — register its function entries to the
|
|
543
564
|
// struct's fields, by `.field = fn` designators or by positional slot.
|
|
@@ -612,7 +633,8 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
612
633
|
}
|
|
613
634
|
};
|
|
614
635
|
// Per-file macro + include parsing (any file, indexed or not), cached.
|
|
615
|
-
|
|
636
|
+
// Derived per-file caches, LRU-bounded like the content caches (#1212).
|
|
637
|
+
const fnMacroCache = new lru_cache_1.LRUCache(256);
|
|
616
638
|
const fileFnMacros = (file) => {
|
|
617
639
|
let m = fnMacroCache.get(file);
|
|
618
640
|
if (!m) {
|
|
@@ -621,7 +643,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
621
643
|
}
|
|
622
644
|
return m;
|
|
623
645
|
};
|
|
624
|
-
const objMacroCache = new
|
|
646
|
+
const objMacroCache = new lru_cache_1.LRUCache(256);
|
|
625
647
|
const fileObjMacros = (file) => {
|
|
626
648
|
let m = objMacroCache.get(file);
|
|
627
649
|
if (!m) {
|
|
@@ -630,7 +652,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
630
652
|
}
|
|
631
653
|
return m;
|
|
632
654
|
};
|
|
633
|
-
const definedCache = new
|
|
655
|
+
const definedCache = new lru_cache_1.LRUCache(256);
|
|
634
656
|
const fileDefinedNames = (file) => {
|
|
635
657
|
let d = definedCache.get(file);
|
|
636
658
|
if (!d) {
|
|
@@ -639,7 +661,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
639
661
|
}
|
|
640
662
|
return d;
|
|
641
663
|
};
|
|
642
|
-
const includeCache = new
|
|
664
|
+
const includeCache = new lru_cache_1.LRUCache(1024);
|
|
643
665
|
const localIncludesOf = (file) => {
|
|
644
666
|
let out = includeCache.get(file);
|
|
645
667
|
if (out)
|
|
@@ -681,45 +703,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
681
703
|
buildEnv(inc, depth - 1, seen, fn, obj, def);
|
|
682
704
|
};
|
|
683
705
|
const indexedSet = new Set(files);
|
|
684
|
-
const units = [];
|
|
685
706
|
const seenInclude = new Set();
|
|
686
|
-
for (const file of files) {
|
|
687
|
-
const env = new Map();
|
|
688
|
-
const objEnv = new Map();
|
|
689
|
-
const defined = new Set();
|
|
690
|
-
buildEnv(file, 2, new Set(), env, objEnv, defined);
|
|
691
|
-
const s = src(file);
|
|
692
|
-
if (s)
|
|
693
|
-
units.push({ text: s, file, env, objEnv });
|
|
694
|
-
for (const target of localIncludesOf(file)) {
|
|
695
|
-
if (seenInclude.has(`${file}>${target}`))
|
|
696
|
-
continue;
|
|
697
|
-
const incSrc = src(target);
|
|
698
|
-
if (!incSrc)
|
|
699
|
-
continue;
|
|
700
|
-
if (indexedSet.has(target)) {
|
|
701
|
-
// Re-scan an indexed header only when this includer unlocks guarded code.
|
|
702
|
-
const ownDef = fileDefinedNames(target);
|
|
703
|
-
const adds = [...defined].some((n) => !ownDef.has(n));
|
|
704
|
-
if (!adds || !/#\s*if/.test(incSrc))
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
seenInclude.add(`${file}>${target}`);
|
|
708
|
-
// The include is pasted into the includer — evaluate its conditionals in
|
|
709
|
-
// the includer's defined set (a no-op when it has none). Re-parse the
|
|
710
|
-
// included file's OWN macros from that resolved text so a macro it defines
|
|
711
|
-
// conditionally (vim's `EXCMD`, whose plain last-wins parse picks the enum
|
|
712
|
-
// arm) overrides with the ARM THAT IS ACTUALLY ACTIVE here.
|
|
713
|
-
const text = evalConditionals(incSrc, defined);
|
|
714
|
-
const incEnv = new Map(env);
|
|
715
|
-
for (const [k, v] of parseFunctionMacros(text))
|
|
716
|
-
incEnv.set(k, v);
|
|
717
|
-
const incObjEnv = new Map(objEnv);
|
|
718
|
-
for (const [k, v] of parseObjectMacros(text))
|
|
719
|
-
incObjEnv.set(k, v);
|
|
720
|
-
units.push({ text, file: target, env: incEnv, objEnv: incObjEnv });
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
707
|
// Global variable → struct type, for resolving a dispatch through a file-scope
|
|
724
708
|
// table by subscript (`cmdnames[i].cmd_func(…)`).
|
|
725
709
|
const globalVarType = new Map();
|
|
@@ -760,10 +744,13 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
760
744
|
// (`zend_rc_dtor_func_t t[]`) needs none. The typedef-set membership gate
|
|
761
745
|
// (below) is what separates this from a plain data/struct array.
|
|
762
746
|
const ARRAY_TABLE_RE = /(?:^|[;{}])\s*(?:(?:static|const|extern|register|volatile)\s+)*(\w+)\s+(\*\s*)?(\w+)\s*\[[^\]]*\]\s*=\s*\{/g;
|
|
763
|
-
|
|
747
|
+
// Process ONE unit's text and discard it. The old shape built every unit up
|
|
748
|
+
// front (`const units: Unit[]`) — the full text of every C file plus its
|
|
749
|
+
// expanded includes held simultaneously, gigabytes on the kernel (#1212).
|
|
750
|
+
const processUnit = (unit) => {
|
|
764
751
|
const s = unit.text;
|
|
765
752
|
if (!s || !s.includes('{'))
|
|
766
|
-
|
|
753
|
+
return;
|
|
767
754
|
INLINE_STRUCT_RE.lastIndex = 0;
|
|
768
755
|
let im;
|
|
769
756
|
while ((im = INLINE_STRUCT_RE.exec(s))) {
|
|
@@ -793,7 +780,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
793
780
|
}
|
|
794
781
|
}
|
|
795
782
|
if (!s.includes('='))
|
|
796
|
-
|
|
783
|
+
return;
|
|
797
784
|
INIT_RE.lastIndex = 0;
|
|
798
785
|
let m;
|
|
799
786
|
while ((m = INIT_RE.exec(s))) {
|
|
@@ -829,6 +816,46 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
829
816
|
registerArrayValue(am[3], s.slice(open + 1, close), unit.file, unit.env);
|
|
830
817
|
ARRAY_TABLE_RE.lastIndex = close;
|
|
831
818
|
}
|
|
819
|
+
};
|
|
820
|
+
// ---- Pass C: registrations — stream each file (and its qualifying local
|
|
821
|
+
// includes) through processUnit, one at a time.
|
|
822
|
+
for (const file of files) {
|
|
823
|
+
await tick();
|
|
824
|
+
const env = new Map();
|
|
825
|
+
const objEnv = new Map();
|
|
826
|
+
const defined = new Set();
|
|
827
|
+
buildEnv(file, 2, new Set(), env, objEnv, defined);
|
|
828
|
+
const s = src(file);
|
|
829
|
+
if (s)
|
|
830
|
+
processUnit({ text: s, file, env, objEnv });
|
|
831
|
+
for (const target of localIncludesOf(file)) {
|
|
832
|
+
if (seenInclude.has(`${file}>${target}`))
|
|
833
|
+
continue;
|
|
834
|
+
const incSrc = src(target);
|
|
835
|
+
if (!incSrc)
|
|
836
|
+
continue;
|
|
837
|
+
if (indexedSet.has(target)) {
|
|
838
|
+
// Re-scan an indexed header only when this includer unlocks guarded code.
|
|
839
|
+
const ownDef = fileDefinedNames(target);
|
|
840
|
+
const adds = [...defined].some((n) => !ownDef.has(n));
|
|
841
|
+
if (!adds || !/#\s*if/.test(incSrc))
|
|
842
|
+
continue;
|
|
843
|
+
}
|
|
844
|
+
seenInclude.add(`${file}>${target}`);
|
|
845
|
+
// The include is pasted into the includer — evaluate its conditionals in
|
|
846
|
+
// the includer's defined set (a no-op when it has none). Re-parse the
|
|
847
|
+
// included file's OWN macros from that resolved text so a macro it defines
|
|
848
|
+
// conditionally (vim's `EXCMD`, whose plain last-wins parse picks the enum
|
|
849
|
+
// arm) overrides with the ARM THAT IS ACTUALLY ACTIVE here.
|
|
850
|
+
const text = evalConditionals(incSrc, defined);
|
|
851
|
+
const incEnv = new Map(env);
|
|
852
|
+
for (const [k, v] of parseFunctionMacros(text))
|
|
853
|
+
incEnv.set(k, v);
|
|
854
|
+
const incObjEnv = new Map(objEnv);
|
|
855
|
+
for (const [k, v] of parseObjectMacros(text))
|
|
856
|
+
incObjEnv.set(k, v);
|
|
857
|
+
processUnit({ text, file: target, env: incEnv, objEnv: incObjEnv });
|
|
858
|
+
}
|
|
832
859
|
}
|
|
833
860
|
// ---- receiver-type resolution within a function's source ----
|
|
834
861
|
// `(?:struct )?TYPE [*]recv` declared in the params or body → TYPE (if a known
|
|
@@ -882,21 +909,26 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
882
909
|
// a fixpoint so a hook slot inherits a registry field's handlers.
|
|
883
910
|
const FIELD_ASSIGN_RE = /(\w+)\s*(?:->|\.)\s*(\w+)\s*=\s*(\w+)\s*(?:->|\.)\s*(\w+)/g;
|
|
884
911
|
const propagations = [];
|
|
885
|
-
for (const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
const body = sliceLines(s, fn.startLine, fn.endLine);
|
|
890
|
-
if (!body.includes('='))
|
|
912
|
+
for (const file of files) {
|
|
913
|
+
await tick();
|
|
914
|
+
const s = src(file);
|
|
915
|
+
if (!s || !s.includes('='))
|
|
891
916
|
continue;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
917
|
+
for (const fn of ctx.getNodesInFile(file)) {
|
|
918
|
+
if (!FN_KINDS.has(fn.kind))
|
|
919
|
+
continue;
|
|
920
|
+
const body = sliceLines(s, fn.startLine, fn.endLine);
|
|
921
|
+
if (!body.includes('='))
|
|
922
|
+
continue;
|
|
923
|
+
FIELD_ASSIGN_RE.lastIndex = 0;
|
|
924
|
+
let m;
|
|
925
|
+
while ((m = FIELD_ASSIGN_RE.exec(body))) {
|
|
926
|
+
const [, lrecv, lfield, rrecv, rfield] = m;
|
|
927
|
+
const lt = recvTypeIn(body, lrecv);
|
|
928
|
+
const rt = recvTypeIn(body, rrecv);
|
|
929
|
+
if (lt && rt && fnPtrFieldOf(lt, lfield) && fnPtrFieldOf(rt, rfield)) {
|
|
930
|
+
propagations.push({ to: `${lt}.${lfield}`, from: `${rt}.${rfield}` });
|
|
931
|
+
}
|
|
900
932
|
}
|
|
901
933
|
}
|
|
902
934
|
}
|
|
@@ -934,76 +966,42 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
934
966
|
const ARRAY_DISPATCH_RE = /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g;
|
|
935
967
|
const edges = [];
|
|
936
968
|
const seen = new Set();
|
|
937
|
-
for (const
|
|
938
|
-
|
|
969
|
+
for (const file of files) {
|
|
970
|
+
await tick();
|
|
971
|
+
const s = src(file);
|
|
939
972
|
if (!s)
|
|
940
973
|
continue;
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
let m;
|
|
944
|
-
let added = 0;
|
|
945
|
-
while ((m = DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
946
|
-
const baseChain = m[1].replace(/\s*(?:->|\.)\s*$/, '').trim(); // receiver, minus the trailing arrow
|
|
947
|
-
const field = m[2];
|
|
948
|
-
const owners = fieldToStructs.get(field);
|
|
949
|
-
if (!owners || owners.size === 0)
|
|
950
|
-
continue;
|
|
951
|
-
// 1) resolve the receiver chain's struct type precisely (handles c->cmd->proc);
|
|
952
|
-
// 2) else the last segment as a simple local/param of a fn-pointer-bearing struct;
|
|
953
|
-
// 3) else fall back to a field name that belongs to exactly one struct.
|
|
954
|
-
let struct = resolveChainType(body, baseChain);
|
|
955
|
-
if (!struct || !owners.has(struct)) {
|
|
956
|
-
const lastSeg = baseChain.replace(/\s*\[[^\]]*\]/g, '').split(/\s*(?:->|\.)\s*/).pop();
|
|
957
|
-
const t = recvTypeIn(body, lastSeg);
|
|
958
|
-
struct = t && owners.has(t) ? t : null;
|
|
959
|
-
}
|
|
960
|
-
if (!struct || !owners.has(struct))
|
|
961
|
-
struct = owners.size === 1 ? [...owners][0] : null;
|
|
962
|
-
if (!struct)
|
|
974
|
+
for (const fn of ctx.getNodesInFile(file)) {
|
|
975
|
+
if (!FN_KINDS.has(fn.kind))
|
|
963
976
|
continue;
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
if (
|
|
977
|
+
const body = sliceLines(s, fn.startLine, fn.endLine);
|
|
978
|
+
DISPATCH_RE.lastIndex = 0;
|
|
979
|
+
let m;
|
|
980
|
+
let added = 0;
|
|
981
|
+
while ((m = DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
982
|
+
const baseChain = m[1].replace(/\s*(?:->|\.)\s*$/, '').trim(); // receiver, minus the trailing arrow
|
|
983
|
+
const field = m[2];
|
|
984
|
+
const owners = fieldToStructs.get(field);
|
|
985
|
+
if (!owners || owners.size === 0)
|
|
973
986
|
continue;
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
});
|
|
987
|
-
if (++added >= FANOUT_CAP)
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
// ---- bare array-of-fn-pointers dispatch (`tbl[i](…)`) ----
|
|
992
|
-
if (arrayReg.size && added < FANOUT_CAP) {
|
|
993
|
-
ARRAY_DISPATCH_RE.lastIndex = 0;
|
|
994
|
-
while ((m = ARRAY_DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
995
|
-
const entries = arrayReg.get(m[1]);
|
|
996
|
-
if (!entries)
|
|
987
|
+
// 1) resolve the receiver chain's struct type precisely (handles c->cmd->proc);
|
|
988
|
+
// 2) else the last segment as a simple local/param of a fn-pointer-bearing struct;
|
|
989
|
+
// 3) else fall back to a field name that belongs to exactly one struct.
|
|
990
|
+
let struct = resolveChainType(body, baseChain);
|
|
991
|
+
if (!struct || !owners.has(struct)) {
|
|
992
|
+
const lastSeg = baseChain.replace(/\s*\[[^\]]*\]/g, '').split(/\s*(?:->|\.)\s*/).pop();
|
|
993
|
+
const t = recvTypeIn(body, lastSeg);
|
|
994
|
+
struct = t && owners.has(t) ? t : null;
|
|
995
|
+
}
|
|
996
|
+
if (!struct || !owners.has(struct))
|
|
997
|
+
struct = owners.size === 1 ? [...owners][0] : null;
|
|
998
|
+
if (!struct)
|
|
997
999
|
continue;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
const ids = entries.length === 1
|
|
1001
|
-
? entries[0].ids
|
|
1002
|
-
: (entries.find((e) => e.file === fn.filePath)?.ids ?? null);
|
|
1003
|
-
if (!ids)
|
|
1000
|
+
const targets = reg.get(`${struct}.${field}`);
|
|
1001
|
+
if (!targets)
|
|
1004
1002
|
continue;
|
|
1005
1003
|
const line = fn.startLine + body.slice(0, m.index).split('\n').length - 1;
|
|
1006
|
-
for (const tid of
|
|
1004
|
+
for (const tid of targets) {
|
|
1007
1005
|
if (tid === fn.id)
|
|
1008
1006
|
continue;
|
|
1009
1007
|
const key = `${fn.id}>${tid}`;
|
|
@@ -1018,7 +1016,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
1018
1016
|
provenance: 'heuristic',
|
|
1019
1017
|
metadata: {
|
|
1020
1018
|
synthesizedBy: 'fn-pointer-dispatch',
|
|
1021
|
-
via: `${
|
|
1019
|
+
via: `${struct}.${field}`,
|
|
1022
1020
|
registeredAt: `${fn.filePath}:${line}`,
|
|
1023
1021
|
},
|
|
1024
1022
|
});
|
|
@@ -1026,13 +1024,47 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
1026
1024
|
break;
|
|
1027
1025
|
}
|
|
1028
1026
|
}
|
|
1027
|
+
// ---- bare array-of-fn-pointers dispatch (`tbl[i](…)`) ----
|
|
1028
|
+
if (arrayReg.size && added < FANOUT_CAP) {
|
|
1029
|
+
ARRAY_DISPATCH_RE.lastIndex = 0;
|
|
1030
|
+
while ((m = ARRAY_DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
1031
|
+
const entries = arrayReg.get(m[1]);
|
|
1032
|
+
if (!entries)
|
|
1033
|
+
continue;
|
|
1034
|
+
// Same-file table wins on a name collision (two file-local `opcodes`);
|
|
1035
|
+
// a unique name resolves cross-file; otherwise ambiguous — bail.
|
|
1036
|
+
const ids = entries.length === 1
|
|
1037
|
+
? entries[0].ids
|
|
1038
|
+
: (entries.find((e) => e.file === fn.filePath)?.ids ?? null);
|
|
1039
|
+
if (!ids)
|
|
1040
|
+
continue;
|
|
1041
|
+
const line = fn.startLine + body.slice(0, m.index).split('\n').length - 1;
|
|
1042
|
+
for (const tid of ids) {
|
|
1043
|
+
if (tid === fn.id)
|
|
1044
|
+
continue;
|
|
1045
|
+
const key = `${fn.id}>${tid}`;
|
|
1046
|
+
if (seen.has(key))
|
|
1047
|
+
continue;
|
|
1048
|
+
seen.add(key);
|
|
1049
|
+
edges.push({
|
|
1050
|
+
source: fn.id,
|
|
1051
|
+
target: tid,
|
|
1052
|
+
kind: 'calls',
|
|
1053
|
+
line,
|
|
1054
|
+
provenance: 'heuristic',
|
|
1055
|
+
metadata: {
|
|
1056
|
+
synthesizedBy: 'fn-pointer-dispatch',
|
|
1057
|
+
via: `${m[1]}[]`,
|
|
1058
|
+
registeredAt: `${fn.filePath}:${line}`,
|
|
1059
|
+
},
|
|
1060
|
+
});
|
|
1061
|
+
if (++added >= FANOUT_CAP)
|
|
1062
|
+
break;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1029
1066
|
}
|
|
1030
1067
|
}
|
|
1031
1068
|
return edges;
|
|
1032
1069
|
}
|
|
1033
|
-
/** C/C++ function + method nodes, streamed (memory-safe on symbol-dense repos). */
|
|
1034
|
-
function* iterateFns(queries) {
|
|
1035
|
-
yield* queries.iterateNodesByKind('function');
|
|
1036
|
-
yield* queries.iterateNodesByKind('method');
|
|
1037
|
-
}
|
|
1038
1070
|
//# sourceMappingURL=c-fnptr-synthesizer.js.map
|