homegraph 0.9.10 → 1.1.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 +243 -193
- package/dist/bin/fatal-handler.d.ts +20 -0
- package/dist/bin/fatal-handler.d.ts.map +1 -0
- package/dist/bin/fatal-handler.js +118 -0
- package/dist/bin/fatal-handler.js.map +1 -0
- package/dist/bin/homegraph.d.ts +6 -6
- package/dist/bin/homegraph.js +532 -109
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/bin/node-version-check.d.ts +4 -4
- package/dist/bin/node-version-check.js +12 -12
- package/dist/bin/uninstall.d.ts +1 -1
- package/dist/bin/uninstall.js +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +8 -1
- package/dist/context/index.js.map +1 -1
- package/dist/db/index.d.ts +22 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +48 -2
- 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 +26 -17
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +21 -1
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +180 -137
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +152 -151
- package/dist/db/sqlite-adapter.d.ts +1 -1
- package/dist/db/sqlite-adapter.js +3 -3
- package/dist/directory.d.ts +87 -6
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +319 -57
- package/dist/directory.js.map +1 -1
- package/dist/errors.d.ts +15 -15
- package/dist/errors.js +20 -20
- package/dist/extraction/astro-extractor.d.ts +79 -0
- package/dist/extraction/astro-extractor.d.ts.map +1 -0
- package/dist/extraction/astro-extractor.js +320 -0
- package/dist/extraction/astro-extractor.js.map +1 -0
- package/dist/extraction/context.d.ts +1 -1
- package/dist/extraction/context.js +1 -1
- package/dist/extraction/extraction-version.d.ts +2 -2
- package/dist/extraction/extraction-version.d.ts.map +1 -1
- package/dist/extraction/extraction-version.js +2 -2
- package/dist/extraction/extraction-version.js.map +1 -1
- package/dist/extraction/function-ref.d.ts +118 -0
- package/dist/extraction/function-ref.d.ts.map +1 -0
- package/dist/extraction/function-ref.js +727 -0
- package/dist/extraction/function-ref.js.map +1 -0
- package/dist/extraction/generated-detection.d.ts.map +1 -1
- package/dist/extraction/generated-detection.js +3 -0
- package/dist/extraction/generated-detection.js.map +1 -1
- package/dist/extraction/grammars.d.ts +15 -5
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +44 -10
- package/dist/extraction/grammars.js.map +1 -1
- package/dist/extraction/index.d.ts +37 -0
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +562 -70
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.d.ts +22 -0
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -0
- package/dist/extraction/languages/arkts-viewtree.js +133 -0
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -0
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +211 -20
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +8 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +104 -2
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/dist/extraction/languages/csharp.js +58 -3
- package/dist/extraction/languages/csharp.js.map +1 -1
- package/dist/extraction/languages/dart.d.ts.map +1 -1
- package/dist/extraction/languages/dart.js +183 -1
- package/dist/extraction/languages/dart.js.map +1 -1
- package/dist/extraction/languages/go.d.ts.map +1 -1
- package/dist/extraction/languages/go.js +37 -0
- package/dist/extraction/languages/go.js.map +1 -1
- package/dist/extraction/languages/index.d.ts.map +1 -1
- package/dist/extraction/languages/index.js +2 -0
- package/dist/extraction/languages/index.js.map +1 -1
- package/dist/extraction/languages/java.d.ts.map +1 -1
- package/dist/extraction/languages/java.js +241 -0
- package/dist/extraction/languages/java.js.map +1 -1
- package/dist/extraction/languages/javascript.d.ts.map +1 -1
- package/dist/extraction/languages/javascript.js +16 -0
- package/dist/extraction/languages/javascript.js.map +1 -1
- package/dist/extraction/languages/kotlin.d.ts.map +1 -1
- package/dist/extraction/languages/kotlin.js +94 -0
- package/dist/extraction/languages/kotlin.js.map +1 -1
- package/dist/extraction/languages/objc.d.ts.map +1 -1
- package/dist/extraction/languages/objc.js +42 -0
- package/dist/extraction/languages/objc.js.map +1 -1
- package/dist/extraction/languages/pascal.d.ts.map +1 -1
- package/dist/extraction/languages/pascal.js +11 -0
- package/dist/extraction/languages/pascal.js.map +1 -1
- package/dist/extraction/languages/php.d.ts.map +1 -1
- package/dist/extraction/languages/php.js +77 -1
- package/dist/extraction/languages/php.js.map +1 -1
- package/dist/extraction/languages/r.d.ts +3 -0
- package/dist/extraction/languages/r.d.ts.map +1 -0
- package/dist/extraction/languages/r.js +314 -0
- package/dist/extraction/languages/r.js.map +1 -0
- package/dist/extraction/languages/rust.d.ts.map +1 -1
- package/dist/extraction/languages/rust.js +29 -0
- package/dist/extraction/languages/rust.js.map +1 -1
- package/dist/extraction/languages/scala.d.ts.map +1 -1
- package/dist/extraction/languages/scala.js +44 -9
- package/dist/extraction/languages/scala.js.map +1 -1
- package/dist/extraction/languages/swift.d.ts.map +1 -1
- package/dist/extraction/languages/swift.js +61 -0
- package/dist/extraction/languages/swift.js.map +1 -1
- package/dist/extraction/languages/typescript.d.ts +13 -0
- package/dist/extraction/languages/typescript.d.ts.map +1 -1
- package/dist/extraction/languages/typescript.js +38 -0
- package/dist/extraction/languages/typescript.js.map +1 -1
- package/dist/extraction/liquid-extractor.d.ts.map +1 -1
- package/dist/extraction/liquid-extractor.js +4 -1
- package/dist/extraction/liquid-extractor.js.map +1 -1
- package/dist/extraction/parse-worker.js +4 -1
- package/dist/extraction/parse-worker.js.map +1 -1
- package/dist/extraction/svelte-extractor.d.ts.map +1 -1
- package/dist/extraction/svelte-extractor.js +6 -3
- package/dist/extraction/svelte-extractor.js.map +1 -1
- package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/dist/extraction/tree-sitter-helpers.js +59 -10
- package/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/dist/extraction/tree-sitter-types.d.ts +29 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +192 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +1553 -45
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/vue-extractor.d.ts.map +1 -1
- package/dist/extraction/vue-extractor.js +6 -3
- package/dist/extraction/vue-extractor.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +11 -2
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +64 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +137 -41
- package/dist/index.js.map +1 -1
- package/dist/installer/config-writer.d.ts +1 -1
- package/dist/installer/config-writer.js +1 -1
- package/dist/installer/index.d.ts +4 -4
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +100 -73
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/instructions-template.d.ts +34 -11
- package/dist/installer/instructions-template.d.ts.map +1 -1
- package/dist/installer/instructions-template.js +44 -12
- package/dist/installer/instructions-template.js.map +1 -1
- package/dist/installer/targets/antigravity.d.ts +6 -6
- package/dist/installer/targets/antigravity.js +14 -14
- package/dist/installer/targets/claude.d.ts +19 -13
- package/dist/installer/targets/claude.d.ts.map +1 -1
- package/dist/installer/targets/claude.js +97 -29
- package/dist/installer/targets/claude.js.map +1 -1
- package/dist/installer/targets/codebuddy.d.ts +17 -0
- package/dist/installer/targets/codebuddy.d.ts.map +1 -0
- package/dist/installer/targets/codebuddy.js +150 -0
- package/dist/installer/targets/codebuddy.js.map +1 -0
- package/dist/installer/targets/codex.js +5 -7
- package/dist/installer/targets/codex.js.map +1 -1
- package/dist/installer/targets/cursor.d.ts +1 -1
- package/dist/installer/targets/cursor.js +7 -7
- package/dist/installer/targets/deveco.d.ts +23 -0
- package/dist/installer/targets/deveco.d.ts.map +1 -0
- package/dist/installer/targets/deveco.js +217 -0
- package/dist/installer/targets/deveco.js.map +1 -0
- package/dist/installer/targets/gemini.js +5 -7
- package/dist/installer/targets/gemini.js.map +1 -1
- package/dist/installer/targets/hermes.js +15 -15
- package/dist/installer/targets/kiro.d.ts +1 -1
- package/dist/installer/targets/kiro.js +4 -4
- package/dist/installer/targets/opencode.d.ts +9 -1
- package/dist/installer/targets/opencode.d.ts.map +1 -1
- package/dist/installer/targets/opencode.js +92 -41
- package/dist/installer/targets/opencode.js.map +1 -1
- package/dist/installer/targets/registry.d.ts.map +1 -1
- package/dist/installer/targets/registry.js +4 -0
- package/dist/installer/targets/registry.js.map +1 -1
- package/dist/installer/targets/shared.d.ts +28 -4
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +32 -15
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/installer/targets/types.d.ts +9 -2
- package/dist/installer/targets/types.d.ts.map +1 -1
- package/dist/mcp/daemon-manager.d.ts +42 -0
- package/dist/mcp/daemon-manager.d.ts.map +1 -0
- package/dist/mcp/daemon-manager.js +129 -0
- package/dist/mcp/daemon-manager.js.map +1 -0
- package/dist/mcp/daemon-paths.d.ts +1 -1
- package/dist/mcp/daemon-paths.js +3 -3
- package/dist/mcp/daemon-registry.d.ts +47 -0
- package/dist/mcp/daemon-registry.d.ts.map +1 -0
- package/dist/mcp/daemon-registry.js +229 -0
- package/dist/mcp/daemon-registry.js.map +1 -0
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +27 -6
- package/dist/mcp/daemon.js.map +1 -1
- package/dist/mcp/dynamic-boundaries.d.ts +41 -0
- package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
- package/dist/mcp/dynamic-boundaries.js +359 -0
- package/dist/mcp/dynamic-boundaries.js.map +1 -0
- package/dist/mcp/engine.d.ts +4 -4
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +32 -24
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts +8 -7
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +39 -18
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
- package/dist/mcp/liveness-watchdog.js +207 -0
- package/dist/mcp/liveness-watchdog.js.map +1 -0
- package/dist/mcp/proxy.d.ts +6 -0
- package/dist/mcp/proxy.d.ts.map +1 -1
- package/dist/mcp/proxy.js +75 -18
- package/dist/mcp/proxy.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +22 -7
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +91 -59
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/session.d.ts +3 -1
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +43 -7
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/stdin-teardown.d.ts +27 -0
- package/dist/mcp/stdin-teardown.d.ts.map +1 -0
- package/dist/mcp/stdin-teardown.js +49 -0
- package/dist/mcp/stdin-teardown.js.map +1 -0
- package/dist/mcp/tools.d.ts +137 -16
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1271 -219
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/transport.d.ts +1 -1
- package/dist/mcp/transport.d.ts.map +1 -1
- package/dist/mcp/transport.js +20 -4
- package/dist/mcp/transport.js.map +1 -1
- package/dist/mcp/version.d.ts +1 -1
- package/dist/mcp/version.js +2 -2
- package/dist/project-config.d.ts +36 -0
- package/dist/project-config.d.ts.map +1 -0
- package/dist/project-config.js +235 -0
- package/dist/project-config.js.map +1 -0
- package/dist/reasoning/config.d.ts +45 -0
- package/dist/reasoning/config.d.ts.map +1 -0
- package/dist/reasoning/config.js +171 -0
- package/dist/reasoning/config.js.map +1 -0
- package/dist/reasoning/credentials.d.ts +5 -0
- package/dist/reasoning/credentials.d.ts.map +1 -0
- package/dist/reasoning/credentials.js +83 -0
- package/dist/reasoning/credentials.js.map +1 -0
- package/dist/reasoning/login.d.ts +21 -0
- package/dist/reasoning/login.d.ts.map +1 -0
- package/dist/reasoning/login.js +85 -0
- package/dist/reasoning/login.js.map +1 -0
- package/dist/reasoning/reasoner.d.ts +43 -0
- package/dist/reasoning/reasoner.d.ts.map +1 -0
- package/dist/reasoning/reasoner.js +308 -0
- package/dist/reasoning/reasoner.js.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +33 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
- package/dist/resolution/c-fnptr-synthesizer.js +352 -0
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
- package/dist/resolution/callback-synthesizer.d.ts +6 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +1197 -1
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/frameworks/arkts-entry.d.ts +12 -0
- package/dist/resolution/frameworks/arkts-entry.d.ts.map +1 -0
- package/dist/resolution/frameworks/arkts-entry.js +214 -0
- package/dist/resolution/frameworks/arkts-entry.js.map +1 -0
- package/dist/resolution/frameworks/arkts-napi.d.ts +3 -0
- package/dist/resolution/frameworks/arkts-napi.d.ts.map +1 -0
- package/dist/resolution/frameworks/arkts-napi.js +166 -0
- package/dist/resolution/frameworks/arkts-napi.js.map +1 -0
- package/dist/resolution/frameworks/astro.d.ts +9 -0
- package/dist/resolution/frameworks/astro.d.ts.map +1 -0
- package/dist/resolution/frameworks/astro.js +169 -0
- package/dist/resolution/frameworks/astro.js.map +1 -0
- package/dist/resolution/frameworks/goframe.d.ts +41 -0
- package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
- package/dist/resolution/frameworks/goframe.js +112 -0
- package/dist/resolution/frameworks/goframe.js.map +1 -0
- package/dist/resolution/frameworks/index.d.ts +3 -0
- package/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/dist/resolution/frameworks/index.js +17 -1
- package/dist/resolution/frameworks/index.js.map +1 -1
- package/dist/resolution/frameworks/java.js +6 -1
- package/dist/resolution/frameworks/java.js.map +1 -1
- package/dist/resolution/frameworks/react.d.ts.map +1 -1
- package/dist/resolution/frameworks/react.js +32 -63
- package/dist/resolution/frameworks/react.js.map +1 -1
- package/dist/resolution/frameworks/svelte.js +6 -2
- package/dist/resolution/frameworks/svelte.js.map +1 -1
- package/dist/resolution/frameworks/vue.js +24 -27
- package/dist/resolution/frameworks/vue.js.map +1 -1
- package/dist/resolution/goframe-synthesizer.d.ts +28 -0
- package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
- package/dist/resolution/goframe-synthesizer.js +158 -0
- package/dist/resolution/goframe-synthesizer.js.map +1 -0
- package/dist/resolution/import-resolver.d.ts +10 -0
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +125 -2
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +37 -0
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +306 -3
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts +41 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +519 -14
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/strip-comments.d.ts +1 -1
- package/dist/resolution/strip-comments.d.ts.map +1 -1
- package/dist/resolution/strip-comments.js +2 -0
- package/dist/resolution/strip-comments.js.map +1 -1
- package/dist/resolution/types.d.ts +20 -3
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/search/query-utils.d.ts +17 -1
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +79 -10
- package/dist/search/query-utils.js.map +1 -1
- package/dist/sync/git-hooks.d.ts +4 -4
- package/dist/sync/git-hooks.js +5 -5
- package/dist/sync/watcher.d.ts +69 -2
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +226 -21
- package/dist/sync/watcher.js.map +1 -1
- package/dist/sync/worktree.d.ts +3 -3
- package/dist/sync/worktree.js +5 -5
- package/dist/telemetry/index.d.ts +143 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +541 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/types.d.ts +18 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/dist/upgrade/index.d.ts.map +1 -1
- package/dist/upgrade/index.js +46 -10
- package/dist/upgrade/index.js.map +1 -1
- package/dist/utils.d.ts +46 -27
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +87 -53
- package/dist/utils.js.map +1 -1
- package/package.json +57 -57
- 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 -0
- package/scripts/agent-eval/ab-hook.sh +86 -0
- package/scripts/agent-eval/ab-impl.sh +78 -0
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
- package/scripts/agent-eval/ab-sufficiency.sh +78 -0
- 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 -0
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
- package/scripts/agent-eval/offload-eval-setup.sh +24 -0
- package/scripts/agent-eval/offload-eval-styles.sh +72 -0
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
- package/scripts/agent-eval/offload-eval.md +76 -0
- 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 -0
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +69 -67
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/build-bundle.sh +118 -118
- 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 +246 -246
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/qa_eval/README.md +400 -0
- package/scripts/qa_eval/agent_runner.py +526 -0
- package/scripts/qa_eval/data/.gitignore +4 -0
- package/scripts/qa_eval/data/test-set.jsonl +22 -0
- package/scripts/qa_eval/eval_metrics.py +233 -0
- package/scripts/qa_eval/external_agent.py +577 -0
- package/scripts/qa_eval/llm_config.py +92 -0
- package/scripts/qa_eval/memory_monitor.py +132 -0
- package/scripts/qa_eval/my_answer_accuracy.py +187 -0
- package/scripts/qa_eval/requirements.txt +2 -0
- package/scripts/qa_eval/run_pipeline.py +702 -0
- package/scripts/qa_eval/stats_efficiency.py +279 -0
- package/scripts/qa_eval/stats_scores.py +207 -0
- package/dist/bin/codegraph.d.ts +0 -26
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1572
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/extraction/arkanalyzer-extractor.d.ts +0 -6
- package/dist/extraction/arkanalyzer-extractor.d.ts.map +0 -1
- package/dist/extraction/arkanalyzer-extractor.js +0 -11
- package/dist/extraction/arkanalyzer-extractor.js.map +0 -1
- package/dist/extraction/arkanalyzer-project.d.ts +0 -20
- package/dist/extraction/arkanalyzer-project.d.ts.map +0 -1
- package/dist/extraction/arkanalyzer-project.js +0 -596
- package/dist/extraction/arkanalyzer-project.js.map +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Stage 4 — 从 Agent 日志统计效率指标(首响应、轮次、总耗时、总 Token)。
|
|
4
|
+
|
|
5
|
+
「首响应」= 从 Evaluate 开始到第一次 LLM API 返回的耗时(日志行 `first token`)。
|
|
6
|
+
|
|
7
|
+
兼容 CodeGenie / Trae 等 Agent 日志格式:
|
|
8
|
+
- Evaluate N:
|
|
9
|
+
- first token
|
|
10
|
+
- the N turn
|
|
11
|
+
- totalTokenCount = N
|
|
12
|
+
|
|
13
|
+
Usage:
|
|
14
|
+
python scripts/qa_eval/stats_efficiency.py -l scripts/qa_eval/log/agent-with-builtin.log
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import argparse
|
|
20
|
+
import re
|
|
21
|
+
import sys
|
|
22
|
+
from datetime import datetime
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from statistics import mean
|
|
25
|
+
|
|
26
|
+
_SCRIPT_DIR = Path(__file__).resolve().parent
|
|
27
|
+
DEFAULT_LOG = _SCRIPT_DIR / "log" / "agent-with-builtin.log"
|
|
28
|
+
|
|
29
|
+
TIME_FMT = "%Y-%m-%d %H:%M:%S.%f"
|
|
30
|
+
|
|
31
|
+
TIME_PATTERN = re.compile(r"^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+)")
|
|
32
|
+
EVALUATE_PATTERN = re.compile(r"Evaluate\s+(\d+):")
|
|
33
|
+
FIRST_TOKEN_PATTERN = re.compile(r"first token")
|
|
34
|
+
TURN_PATTERN = re.compile(r"the\s+(\d+)\s+turn")
|
|
35
|
+
TOKEN_PATTERN = re.compile(r"totalTokenCount\s*=\s*(\d+)")
|
|
36
|
+
PEAK_RSS_PATTERN = re.compile(r"peakRssMb\s*=\s*([\d.]+)")
|
|
37
|
+
AVG_RSS_PATTERN = re.compile(r"avgRssMb\s*=\s*([\d.]+)")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def parse_agent_log(log_file: Path) -> list[dict]:
|
|
41
|
+
tasks: list[dict] = []
|
|
42
|
+
current_task: dict | None = None
|
|
43
|
+
last_log_time: datetime | None = None
|
|
44
|
+
|
|
45
|
+
with log_file.open("r", encoding="utf-8", errors="replace") as f:
|
|
46
|
+
for line in f:
|
|
47
|
+
line = line.strip()
|
|
48
|
+
if not line:
|
|
49
|
+
continue
|
|
50
|
+
|
|
51
|
+
time_match = TIME_PATTERN.search(line)
|
|
52
|
+
if not time_match:
|
|
53
|
+
continue
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
log_time = datetime.strptime(time_match.group(1), TIME_FMT)
|
|
57
|
+
except ValueError:
|
|
58
|
+
continue
|
|
59
|
+
|
|
60
|
+
last_log_time = log_time
|
|
61
|
+
|
|
62
|
+
eval_match = EVALUATE_PATTERN.search(line)
|
|
63
|
+
if eval_match:
|
|
64
|
+
if current_task:
|
|
65
|
+
current_task["end_time"] = log_time
|
|
66
|
+
tasks.append(current_task)
|
|
67
|
+
|
|
68
|
+
current_task = {
|
|
69
|
+
"id": int(eval_match.group(1)),
|
|
70
|
+
"start_time": log_time,
|
|
71
|
+
"first_token_time": None,
|
|
72
|
+
"first_api_response_time": None,
|
|
73
|
+
"max_turn": 0,
|
|
74
|
+
"end_time": None,
|
|
75
|
+
"total_tokens": 0,
|
|
76
|
+
"peak_rss_mb": None,
|
|
77
|
+
"avg_rss_mb": None,
|
|
78
|
+
}
|
|
79
|
+
continue
|
|
80
|
+
|
|
81
|
+
if current_task is None:
|
|
82
|
+
continue
|
|
83
|
+
|
|
84
|
+
if FIRST_TOKEN_PATTERN.search(line):
|
|
85
|
+
current_task["first_token_time"] = log_time
|
|
86
|
+
continue
|
|
87
|
+
|
|
88
|
+
turn_match = TURN_PATTERN.search(line)
|
|
89
|
+
if turn_match:
|
|
90
|
+
turn = int(turn_match.group(1))
|
|
91
|
+
current_task["max_turn"] = max(current_task["max_turn"], turn)
|
|
92
|
+
|
|
93
|
+
token_match = TOKEN_PATTERN.search(line)
|
|
94
|
+
if token_match:
|
|
95
|
+
if current_task["first_api_response_time"] is None:
|
|
96
|
+
current_task["first_api_response_time"] = log_time
|
|
97
|
+
current_task["total_tokens"] += int(token_match.group(1))
|
|
98
|
+
|
|
99
|
+
peak_match = PEAK_RSS_PATTERN.search(line)
|
|
100
|
+
if peak_match:
|
|
101
|
+
current_task["peak_rss_mb"] = float(peak_match.group(1))
|
|
102
|
+
|
|
103
|
+
avg_match = AVG_RSS_PATTERN.search(line)
|
|
104
|
+
if avg_match:
|
|
105
|
+
current_task["avg_rss_mb"] = float(avg_match.group(1))
|
|
106
|
+
|
|
107
|
+
if current_task:
|
|
108
|
+
current_task["end_time"] = last_log_time
|
|
109
|
+
tasks.append(current_task)
|
|
110
|
+
|
|
111
|
+
return tasks
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _memory_from_rows(rows: list[dict]) -> tuple[list[float], list[float]]:
|
|
115
|
+
peaks: list[float] = []
|
|
116
|
+
avgs: list[float] = []
|
|
117
|
+
for row in rows:
|
|
118
|
+
mem = row.get("agent_memory_mb") or {}
|
|
119
|
+
if mem.get("peak_rss_mb") is not None:
|
|
120
|
+
peaks.append(float(mem["peak_rss_mb"]))
|
|
121
|
+
if mem.get("avg_rss_mb") is not None:
|
|
122
|
+
avgs.append(float(mem["avg_rss_mb"]))
|
|
123
|
+
return peaks, avgs
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def summarize_jsonl_usage(rows: list[dict]) -> dict:
|
|
127
|
+
"""Fallback when agent .log is missing: aggregate agent_usage from JSONL rows."""
|
|
128
|
+
tokens: list[int] = []
|
|
129
|
+
for row in rows:
|
|
130
|
+
usage = row.get("agent_usage") or {}
|
|
131
|
+
total = usage.get("total_tokens")
|
|
132
|
+
if isinstance(total, (int, float)):
|
|
133
|
+
tokens.append(int(total))
|
|
134
|
+
peaks, avgs = _memory_from_rows(rows)
|
|
135
|
+
return {
|
|
136
|
+
"task_count": len(rows),
|
|
137
|
+
"avg_first_token_s": None,
|
|
138
|
+
"avg_turns": None,
|
|
139
|
+
"avg_duration_s": None,
|
|
140
|
+
"avg_tokens": mean(tokens) if tokens else None,
|
|
141
|
+
"total_tokens": sum(tokens),
|
|
142
|
+
"avg_peak_rss_mb": mean(peaks) if peaks else None,
|
|
143
|
+
"max_peak_rss_mb": max(peaks) if peaks else None,
|
|
144
|
+
"avg_avg_rss_mb": mean(avgs) if avgs else None,
|
|
145
|
+
"source": "jsonl",
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
FIRST_TOKEN_MIN_S = 0.05
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def effective_first_response_time(task: dict) -> datetime | None:
|
|
153
|
+
"""首响应时间:优先用 first token 行;若与 Evaluate 几乎同时(旧日志 bug)则回退到首次 API 返回。"""
|
|
154
|
+
start = task.get("start_time")
|
|
155
|
+
ft = task.get("first_token_time")
|
|
156
|
+
if start and ft:
|
|
157
|
+
if (ft - start).total_seconds() >= FIRST_TOKEN_MIN_S:
|
|
158
|
+
return ft
|
|
159
|
+
return task.get("first_api_response_time") or ft
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def summarize_tasks(tasks: list[dict], *, print_report: bool = True) -> dict:
|
|
163
|
+
first_token_costs: list[float] = []
|
|
164
|
+
turns: list[int] = []
|
|
165
|
+
durations: list[float] = []
|
|
166
|
+
tokens_list: list[int] = []
|
|
167
|
+
peak_rss: list[float] = []
|
|
168
|
+
avg_rss: list[float] = []
|
|
169
|
+
|
|
170
|
+
if print_report:
|
|
171
|
+
print("=" * 100)
|
|
172
|
+
print("任务明细")
|
|
173
|
+
print("=" * 100)
|
|
174
|
+
|
|
175
|
+
for task in tasks:
|
|
176
|
+
first_token_seconds = None
|
|
177
|
+
response_time = effective_first_response_time(task)
|
|
178
|
+
if response_time and task["start_time"]:
|
|
179
|
+
first_token_seconds = (response_time - task["start_time"]).total_seconds()
|
|
180
|
+
first_token_costs.append(first_token_seconds)
|
|
181
|
+
|
|
182
|
+
turns.append(task["max_turn"])
|
|
183
|
+
|
|
184
|
+
duration_seconds = 0.0
|
|
185
|
+
if task["end_time"] and task["start_time"]:
|
|
186
|
+
duration_seconds = (task["end_time"] - task["start_time"]).total_seconds()
|
|
187
|
+
durations.append(duration_seconds)
|
|
188
|
+
|
|
189
|
+
tokens_list.append(task["total_tokens"])
|
|
190
|
+
if task.get("peak_rss_mb") is not None:
|
|
191
|
+
peak_rss.append(float(task["peak_rss_mb"]))
|
|
192
|
+
if task.get("avg_rss_mb") is not None:
|
|
193
|
+
avg_rss.append(float(task["avg_rss_mb"]))
|
|
194
|
+
|
|
195
|
+
if print_report:
|
|
196
|
+
first_display = f"{first_token_seconds:.2f}s" if first_token_seconds is not None else "N/A"
|
|
197
|
+
mem_display = (
|
|
198
|
+
f"{task['peak_rss_mb']:.0f}MB"
|
|
199
|
+
if task.get("peak_rss_mb") is not None
|
|
200
|
+
else "N/A"
|
|
201
|
+
)
|
|
202
|
+
print(
|
|
203
|
+
f"任务 {task['id']:>3} | "
|
|
204
|
+
f"首响应: {first_display:<8} | "
|
|
205
|
+
f"轮次: {task['max_turn']:>3} | "
|
|
206
|
+
f"总时间: {duration_seconds:.2f}s | "
|
|
207
|
+
f"总Token: {task['total_tokens']:<6} | "
|
|
208
|
+
f"峰值内存: {mem_display}"
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
summary = {
|
|
212
|
+
"task_count": len(tasks),
|
|
213
|
+
"avg_first_token_s": mean(first_token_costs) if first_token_costs else None,
|
|
214
|
+
"avg_turns": mean(turns) if turns else None,
|
|
215
|
+
"avg_duration_s": mean(durations) if durations else None,
|
|
216
|
+
"avg_tokens": mean(tokens_list) if tokens_list else None,
|
|
217
|
+
"total_tokens": sum(tokens_list),
|
|
218
|
+
"avg_peak_rss_mb": mean(peak_rss) if peak_rss else None,
|
|
219
|
+
"max_peak_rss_mb": max(peak_rss) if peak_rss else None,
|
|
220
|
+
"avg_avg_rss_mb": mean(avg_rss) if avg_rss else None,
|
|
221
|
+
"source": "log",
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if print_report:
|
|
225
|
+
print("\n" + "=" * 100)
|
|
226
|
+
print("统计结果")
|
|
227
|
+
print("=" * 100)
|
|
228
|
+
print(f"任务总数: {summary['task_count']}")
|
|
229
|
+
|
|
230
|
+
if summary["avg_first_token_s"] is not None:
|
|
231
|
+
print(f"平均首响应时间: {summary['avg_first_token_s']:.2f} 秒")
|
|
232
|
+
if summary["avg_turns"] is not None:
|
|
233
|
+
print(f"平均轮次: {summary['avg_turns']:.2f}")
|
|
234
|
+
if summary["avg_duration_s"] is not None:
|
|
235
|
+
print(f"平均总时间: {summary['avg_duration_s'] / 60:.2f} min ({summary['avg_duration_s']:.2f} s)")
|
|
236
|
+
if summary["avg_tokens"] is not None:
|
|
237
|
+
print(f"平均总 Token: {summary['avg_tokens'] / 1000:.2f} k")
|
|
238
|
+
print(f"合计总 Token: {summary['total_tokens']}")
|
|
239
|
+
if summary["avg_peak_rss_mb"] is not None:
|
|
240
|
+
print(f"平均峰值内存: {summary['avg_peak_rss_mb']:.1f} MB")
|
|
241
|
+
if summary["max_peak_rss_mb"] is not None:
|
|
242
|
+
print(f"最大峰值内存: {summary['max_peak_rss_mb']:.1f} MB")
|
|
243
|
+
if summary["avg_avg_rss_mb"] is not None:
|
|
244
|
+
print(f"平均内存占用: {summary['avg_avg_rss_mb']:.1f} MB")
|
|
245
|
+
|
|
246
|
+
print("=" * 100)
|
|
247
|
+
return summary
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def summarize_log(log_file: Path, *, print_report: bool = True) -> dict | None:
|
|
251
|
+
if not log_file.is_file():
|
|
252
|
+
return None
|
|
253
|
+
tasks = parse_agent_log(log_file)
|
|
254
|
+
if not tasks:
|
|
255
|
+
return None
|
|
256
|
+
return summarize_tasks(tasks, print_report=print_report)
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def main() -> int:
|
|
260
|
+
parser = argparse.ArgumentParser(description="Agent 日志效率统计")
|
|
261
|
+
parser.add_argument("--log", "-l", type=str, default=str(DEFAULT_LOG), help="Agent 日志路径")
|
|
262
|
+
args = parser.parse_args()
|
|
263
|
+
|
|
264
|
+
log_file = Path(args.log)
|
|
265
|
+
if not log_file.is_file():
|
|
266
|
+
print(f"错误: 日志文件 {log_file} 不存在")
|
|
267
|
+
return 1
|
|
268
|
+
|
|
269
|
+
tasks = parse_agent_log(log_file)
|
|
270
|
+
if not tasks:
|
|
271
|
+
print("警告: 日志中未解析到任何 Evaluate 任务段")
|
|
272
|
+
return 1
|
|
273
|
+
|
|
274
|
+
summarize_tasks(tasks)
|
|
275
|
+
return 0
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
if __name__ == "__main__":
|
|
279
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Stage 3 — Answer Accuracy Score 统计。
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python scripts/qa_eval/stats_scores.py -i scripts/qa_eval/log/result-with-builtin-scored.jsonl
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import statistics
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
_SCRIPT_DIR = Path(__file__).resolve().parent
|
|
18
|
+
DEFAULT_INPUT = _SCRIPT_DIR / "log" / "result-with-builtin-scored.jsonl"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def calculate_answer_accuracy_statistics(file_path: Path) -> dict | None:
|
|
22
|
+
scores: list[float] = []
|
|
23
|
+
total_samples = 0
|
|
24
|
+
success_samples = 0
|
|
25
|
+
failed_samples = 0
|
|
26
|
+
|
|
27
|
+
print(f"正在读取文件: {file_path}")
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
with file_path.open("r", encoding="utf-8") as f:
|
|
31
|
+
for line_num, line in enumerate(f, 1):
|
|
32
|
+
if not line.strip():
|
|
33
|
+
continue
|
|
34
|
+
try:
|
|
35
|
+
data = json.loads(line)
|
|
36
|
+
total_samples += 1
|
|
37
|
+
|
|
38
|
+
if "answer_accuracy_score" not in data:
|
|
39
|
+
failed_samples += 1
|
|
40
|
+
print(f" 第{line_num}行: 缺少 answer_accuracy_score 字段")
|
|
41
|
+
continue
|
|
42
|
+
|
|
43
|
+
score = data["answer_accuracy_score"]
|
|
44
|
+
eval_status = data.get("evaluation_status", "unknown")
|
|
45
|
+
|
|
46
|
+
if (
|
|
47
|
+
eval_status == "success"
|
|
48
|
+
and isinstance(score, (int, float))
|
|
49
|
+
and not (isinstance(score, float) and str(score).lower() == "nan")
|
|
50
|
+
):
|
|
51
|
+
scores.append(float(score))
|
|
52
|
+
success_samples += 1
|
|
53
|
+
else:
|
|
54
|
+
failed_samples += 1
|
|
55
|
+
print(f" 第{line_num}行: 评估失败或无效分数 - 状态: {eval_status}, 分数: {score}")
|
|
56
|
+
|
|
57
|
+
except json.JSONDecodeError as e:
|
|
58
|
+
print(f" 第{line_num}行: JSON 解析错误 - {e}")
|
|
59
|
+
failed_samples += 1
|
|
60
|
+
|
|
61
|
+
except FileNotFoundError:
|
|
62
|
+
print(f"错误: 文件 {file_path} 不存在")
|
|
63
|
+
return None
|
|
64
|
+
except OSError as e:
|
|
65
|
+
print(f"读取文件时出错: {e}")
|
|
66
|
+
return None
|
|
67
|
+
|
|
68
|
+
if not scores:
|
|
69
|
+
print("警告: 没有找到有效的 answer_accuracy_score 数据")
|
|
70
|
+
return {
|
|
71
|
+
"total_samples": total_samples,
|
|
72
|
+
"success_samples": success_samples,
|
|
73
|
+
"failed_samples": failed_samples,
|
|
74
|
+
"valid_scores": 0,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
stats = {
|
|
78
|
+
"total_samples": total_samples,
|
|
79
|
+
"success_samples": success_samples,
|
|
80
|
+
"failed_samples": failed_samples,
|
|
81
|
+
"valid_scores": len(scores),
|
|
82
|
+
"mean": statistics.mean(scores),
|
|
83
|
+
"median": statistics.median(scores),
|
|
84
|
+
"min": min(scores),
|
|
85
|
+
"max": max(scores),
|
|
86
|
+
"std_dev": statistics.stdev(scores) if len(scores) > 1 else 0.0,
|
|
87
|
+
"variance": statistics.variance(scores) if len(scores) > 1 else 0.0,
|
|
88
|
+
"_scores": scores,
|
|
89
|
+
}
|
|
90
|
+
return stats
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def compute_stats_from_rows(rows: list[dict]) -> dict | None:
|
|
94
|
+
"""Same stats as calculate_answer_accuracy_statistics, from in-memory rows."""
|
|
95
|
+
scores: list[float] = []
|
|
96
|
+
total_samples = len(rows)
|
|
97
|
+
success_samples = 0
|
|
98
|
+
failed_samples = 0
|
|
99
|
+
|
|
100
|
+
for data in rows:
|
|
101
|
+
if "answer_accuracy_score" not in data:
|
|
102
|
+
failed_samples += 1
|
|
103
|
+
continue
|
|
104
|
+
score = data["answer_accuracy_score"]
|
|
105
|
+
eval_status = data.get("evaluation_status", "unknown")
|
|
106
|
+
if (
|
|
107
|
+
eval_status == "success"
|
|
108
|
+
and isinstance(score, (int, float))
|
|
109
|
+
and not (isinstance(score, float) and str(score).lower() == "nan")
|
|
110
|
+
):
|
|
111
|
+
scores.append(float(score))
|
|
112
|
+
success_samples += 1
|
|
113
|
+
else:
|
|
114
|
+
failed_samples += 1
|
|
115
|
+
|
|
116
|
+
if not scores:
|
|
117
|
+
return {
|
|
118
|
+
"total_samples": total_samples,
|
|
119
|
+
"success_samples": success_samples,
|
|
120
|
+
"failed_samples": failed_samples,
|
|
121
|
+
"valid_scores": 0,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
"total_samples": total_samples,
|
|
126
|
+
"success_samples": success_samples,
|
|
127
|
+
"failed_samples": failed_samples,
|
|
128
|
+
"valid_scores": len(scores),
|
|
129
|
+
"mean": statistics.mean(scores),
|
|
130
|
+
"median": statistics.median(scores),
|
|
131
|
+
"min": min(scores),
|
|
132
|
+
"max": max(scores),
|
|
133
|
+
"std_dev": statistics.stdev(scores) if len(scores) > 1 else 0.0,
|
|
134
|
+
"variance": statistics.variance(scores) if len(scores) > 1 else 0.0,
|
|
135
|
+
"_scores": scores,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def print_statistics(stats: dict | None, file_path: Path | None = None, *, title: str | None = None) -> None:
|
|
140
|
+
if not stats:
|
|
141
|
+
return
|
|
142
|
+
|
|
143
|
+
print("\n" + "=" * 60)
|
|
144
|
+
print(title or "Answer Accuracy Score 统计结果")
|
|
145
|
+
print("=" * 60)
|
|
146
|
+
if file_path:
|
|
147
|
+
print(f"文件: {file_path}")
|
|
148
|
+
|
|
149
|
+
print(f"总样本数: {stats['total_samples']}")
|
|
150
|
+
print(f"成功评估样本数: {stats['success_samples']}")
|
|
151
|
+
print(f"失败评估样本数: {stats['failed_samples']}")
|
|
152
|
+
print(f"有效分数数量: {stats['valid_scores']}")
|
|
153
|
+
|
|
154
|
+
if stats["valid_scores"] > 0:
|
|
155
|
+
print("\n分数统计:")
|
|
156
|
+
print(f" 平均值 (Mean): {stats['mean']:.4f}")
|
|
157
|
+
print(f" 中位数 (Median): {stats['median']:.4f}")
|
|
158
|
+
print(f" 最小值 (Min): {stats['min']:.4f}")
|
|
159
|
+
print(f" 最大值 (Max): {stats['max']:.4f}")
|
|
160
|
+
if stats["valid_scores"] > 1:
|
|
161
|
+
print(f" 标准差 (Std Dev): {stats['std_dev']:.4f}")
|
|
162
|
+
print(f" 方差 (Variance): {stats['variance']:.4f}")
|
|
163
|
+
|
|
164
|
+
scores = stats.get("_scores") or []
|
|
165
|
+
print("\n分数分布:")
|
|
166
|
+
ranges = [
|
|
167
|
+
(0.0, 0.2, "很低 (0.0-0.2)"),
|
|
168
|
+
(0.2, 0.4, "低 (0.2-0.4)"),
|
|
169
|
+
(0.4, 0.6, "中等 (0.4-0.6)"),
|
|
170
|
+
(0.6, 0.8, "高 (0.6-0.8)"),
|
|
171
|
+
(0.8, 1.0, "很高 (0.8-1.0)"),
|
|
172
|
+
]
|
|
173
|
+
for min_val, max_val, label in ranges:
|
|
174
|
+
count = sum(
|
|
175
|
+
1
|
|
176
|
+
for score in scores
|
|
177
|
+
if min_val <= score < max_val or (max_val == 1.0 and score == 1.0)
|
|
178
|
+
)
|
|
179
|
+
pct = (count / len(scores)) * 100 if scores else 0
|
|
180
|
+
print(f" {label}: {count} ({pct:.1f}%)")
|
|
181
|
+
|
|
182
|
+
print("=" * 60)
|
|
183
|
+
|
|
184
|
+
if stats["valid_scores"] > 0:
|
|
185
|
+
success_rate = (stats["success_samples"] / stats["total_samples"]) * 100 if stats["total_samples"] else 0
|
|
186
|
+
print(f"\n简要报告: {stats['total_samples']} 个样本,{stats['success_samples']} 个成功评估")
|
|
187
|
+
print(f"Answer Accuracy Score 平均值: {stats['mean']:.4f}")
|
|
188
|
+
print(f"评估成功率: {success_rate:.1f}%")
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def main() -> int:
|
|
192
|
+
parser = argparse.ArgumentParser(description="Answer Accuracy Score 统计")
|
|
193
|
+
parser.add_argument("--input", "-i", type=str, default=str(DEFAULT_INPUT), help="打分后的 JSONL")
|
|
194
|
+
args = parser.parse_args()
|
|
195
|
+
|
|
196
|
+
file_path = Path(args.input)
|
|
197
|
+
if not file_path.is_file():
|
|
198
|
+
print(f"错误: 文件 {file_path} 不存在")
|
|
199
|
+
return 1
|
|
200
|
+
|
|
201
|
+
stats = calculate_answer_accuracy_statistics(file_path)
|
|
202
|
+
print_statistics(stats, file_path)
|
|
203
|
+
return 0 if stats else 1
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if __name__ == "__main__":
|
|
207
|
+
raise SystemExit(main())
|
package/dist/bin/codegraph.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* CodeGraph CLI
|
|
4
|
-
*
|
|
5
|
-
* Command-line interface for CodeGraph code intelligence.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* codegraph Run interactive installer (when no args)
|
|
9
|
-
* codegraph install Run interactive installer
|
|
10
|
-
* codegraph uninstall Remove CodeGraph from your agents
|
|
11
|
-
* codegraph init [path] Initialize CodeGraph in a project
|
|
12
|
-
* codegraph uninit [path] Remove CodeGraph from a project
|
|
13
|
-
* codegraph index [path] Index all files in the project
|
|
14
|
-
* codegraph sync [path] Sync changes since last index
|
|
15
|
-
* codegraph status [path] Show index status
|
|
16
|
-
* codegraph query <search> Search for symbols
|
|
17
|
-
* codegraph files [options] Show project file structure
|
|
18
|
-
* codegraph context <task> Build context for a task
|
|
19
|
-
* codegraph callers <symbol> Find what calls a function/method
|
|
20
|
-
* codegraph callees <symbol> Find what a function/method calls
|
|
21
|
-
* codegraph impact <symbol> Analyze what code is affected by changing a symbol
|
|
22
|
-
* codegraph affected [files] Find test files affected by changes
|
|
23
|
-
* codegraph upgrade [version] Update CodeGraph to the latest release
|
|
24
|
-
*/
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=codegraph.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codegraph.d.ts","sourceRoot":"","sources":["../../src/bin/codegraph.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|