@mrclrchtr/supi-code-intelligence 12.0.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +4 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -8
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +102 -47
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +15 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +46 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-disk-stamp.ts +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +21 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +17 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +53 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +11 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +14 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-module.ts +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +2 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-removal-ledger.ts +52 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +40 -20
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +13 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +17 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +11 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +22 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/retired-packages.ts +152 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/shell-hints.ts +46 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +93 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +6 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +7 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +7 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +50 -75
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +5 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/latex/tree-sitter-latex.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +1 -1
- package/node_modules/fast-xml-parser/CHANGELOG.md +886 -0
- package/node_modules/fast-xml-parser/LICENSE +21 -0
- package/node_modules/fast-xml-parser/README.md +204 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/node_modules/fast-xml-parser/lib/fxp.d.cts +774 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
- package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/README.md +92 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/package.json +57 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityDecoder.js +644 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/EntityEncoder.js +239 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/all-entities.js +53 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entities.js +1139 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/entityTries.js +60 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.d.ts +358 -0
- package/node_modules/fast-xml-parser/node_modules/@nodable/entities/src/index.js +29 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +52 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/README.md +77 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.d.cts +270 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +77 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.d.ts +270 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +609 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +360 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
- package/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +23 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/README.md +632 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/package.json +56 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/html.js +102 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/log.js +98 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/nosql.js +114 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/redos.js +60 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/shell.js +105 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql-strict.js +47 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/sql.js +95 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/svg.js +81 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/contexts/xml.js +79 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.cjs +27 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.d.ts +103 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/index.js +292 -0
- package/node_modules/fast-xml-parser/node_modules/is-unsafe/src/util/decode-entities.js +48 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/README.md +947 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.d.cts +725 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/package.json +79 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js +232 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js +225 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js +663 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.d.ts +589 -0
- package/node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/index.js +30 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/CHANGELOG.md +63 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/README.md +113 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/README.md +142 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/anynum.js +135 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/digitTable.js +116 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/node_modules/anynum/package.json +42 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/package.json +36 -0
- package/node_modules/fast-xml-parser/node_modules/strnum/strnum.js +176 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/LICENSE +21 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/README.md +287 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/package.json +56 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.d.ts +108 -0
- package/node_modules/fast-xml-parser/node_modules/xml-naming/src/index.js +382 -0
- package/node_modules/fast-xml-parser/package.json +93 -0
- package/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
- package/node_modules/fast-xml-parser/src/cli/man.js +17 -0
- package/node_modules/fast-xml-parser/src/cli/read.js +43 -0
- package/node_modules/fast-xml-parser/src/fxp.d.ts +754 -0
- package/node_modules/fast-xml-parser/src/fxp.js +14 -0
- package/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
- package/node_modules/fast-xml-parser/src/util.js +61 -0
- package/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
- package/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +106 -0
- package/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
- package/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
- package/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
- package/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
- package/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
- package/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
- package/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
- package/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
- package/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
- package/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
- package/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
- package/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
- package/node_modules/fast-xml-parser/src/validator.js +518 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +6 -0
- package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +426 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +164 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +907 -0
- package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +77 -0
- package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +177 -0
- package/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +54 -0
- package/package.json +10 -8
- package/src/analysis/evidence.ts +331 -73
- package/src/analysis/health/diagnostics.ts +66 -18
- package/src/analysis/health/evidence-reason.ts +44 -0
- package/src/analysis/search/pattern.ts +3 -3
- package/src/analysis/target/anchored.ts +3 -6
- package/src/analysis/target/symbol.ts +41 -47
- package/src/analysis/target/types.ts +4 -9
- package/src/analysis/workspace/cmake-parser.ts +207 -0
- package/src/analysis/workspace/cmake.ts +141 -0
- package/src/analysis/workspace/maven.ts +310 -0
- package/src/analysis/workspace/membership.ts +100 -26
- package/src/analysis/workspace/metadata.ts +6 -1
- package/src/analysis/workspace/observe.ts +6 -0
- package/src/analysis/workspace/types.ts +11 -3
- package/src/diagnostics/coverage.ts +49 -0
- package/src/diagnostics/evidence.ts +10 -2
- package/src/session/health-workflow.ts +6 -0
- package/src/session/input/common.ts +1 -1
- package/src/session/orientation/collect.ts +42 -7
- package/src/session/orientation/context-facts.ts +3 -3
- package/src/session/orientation/context-sections.ts +13 -15
- package/src/session/orientation/facts.ts +5 -8
- package/src/session/orientation-workflow.ts +4 -19
- package/src/session/target-workflow.ts +25 -18
- package/src/tool/code_find/result.ts +5 -7
- package/src/tool/code_graph/display.ts +5 -6
- package/src/tool/code_graph/format.ts +8 -24
- package/src/tool/code_graph/result.ts +16 -75
- package/src/tool/code_graph/section.ts +21 -33
- package/src/tool/code_graph/tui.ts +10 -5
- package/src/tool/code_health/diagnostic-tui.ts +49 -0
- package/src/tool/code_health/guidance.ts +27 -0
- package/src/tool/code_health/markdown.ts +60 -8
- package/src/tool/code_health/result.ts +20 -9
- package/src/tool/code_health/structured-schema.ts +14 -0
- package/src/tool/code_health/structured.ts +7 -1
- package/src/tool/code_health/tui.ts +33 -40
- package/src/tool/code_inspect/result.ts +23 -18
- package/src/tool/code_inspect/structured.ts +2 -19
- package/src/tool/code_orientation/result.ts +53 -100
- package/src/tool/code_orientation/structured-schema.ts +16 -12
- package/src/tool/code_orientation/structured-workspace.ts +13 -7
- package/src/tool/code_orientation/structured.ts +31 -39
- package/src/tool/code_orientation/workspace-format.ts +4 -10
- package/src/tool/code_orientation/workspace-instructions.ts +4 -5
- package/src/tool/code_orientation/workspace-observations.ts +2 -2
- package/src/tool/code_orientation/workspace-output.ts +16 -7
- package/src/tool/code_orientation/workspace-projects.ts +7 -10
- package/src/tool/code_orientation/workspace-sections.ts +13 -19
- package/src/tool/code_resolve/markdown.ts +4 -46
- package/src/tool/code_resolve/result.ts +43 -72
- package/src/tool/infra/truncate.ts +2 -16
- package/src/tool/result/candidate-selection.ts +141 -0
- package/src/tool/result/display.ts +41 -45
- package/src/tool/result/errors.ts +1 -0
- package/src/tool/result/model-budget.ts +26 -1
- package/src/tool/result/refactor.ts +11 -8
- package/src/tool/result/structured.ts +2 -1
- package/src/tool/result/types.ts +9 -8
- package/src/tool/schemas.ts +15 -20
- package/src/ui/footer.ts +2 -4
- package/src/ui/status-presentation.ts +4 -7
- package/src/ui/tui/candidate-selection.ts +40 -95
- package/src/ui/tui/common.ts +16 -70
- package/src/ui/tui/display.ts +6 -24
- package/src/tool/result/candidate-row.ts +0 -49
package/src/analysis/evidence.ts
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Evidence
|
|
3
|
-
* collections
|
|
2
|
+
* Evidence list module — the sole producer of bounded Tool-evidence
|
|
3
|
+
* collections and their completeness metadata (code-intelligence ADR 0004).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* Every Evidence list is built by one of three constructors:
|
|
6
|
+
* - {@link createEvidenceList}: all collected items are in hand; a Result cap
|
|
7
|
+
* selects the shown items and the total is exact.
|
|
8
|
+
* - {@link createBoundedEvidenceList}: items were already bounded upstream and
|
|
9
|
+
* a provider counted the exact total.
|
|
10
|
+
* - {@link createPartialEvidenceList}: collection is incomplete, so the total
|
|
11
|
+
* is unknown.
|
|
12
|
+
*
|
|
13
|
+
* Each list publishes its Evidence completeness state and derived counts.
|
|
14
|
+
* Readers never recompute `total − shown` or infer completeness from a null
|
|
15
|
+
* total; they read the metadata and use {@link describeEvidenceList} or
|
|
16
|
+
* {@link renderEvidenceListMetadataDisclosure} for canonical wording.
|
|
17
|
+
*
|
|
18
|
+
* Metadata is a branded readonly type, so object literals cannot pose as
|
|
19
|
+
* Evidence list metadata. Inconsistent counts are programmer errors and throw.
|
|
20
|
+
*
|
|
21
|
+
* The module lives below `tool/` so session collectors and tool adapters can
|
|
22
|
+
* both depend on it without `analysis/` importing upward.
|
|
12
23
|
*/
|
|
13
24
|
|
|
14
25
|
export type EvidencePartialReason =
|
|
@@ -20,104 +31,351 @@ export type EvidencePartialReason =
|
|
|
20
31
|
| "configuration-error"
|
|
21
32
|
| "invalid-provider-location";
|
|
22
33
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
/** Reasons a collection itself was incomplete; invalid locations are counted separately. */
|
|
35
|
+
export type CollectionPartialReason = Exclude<EvidencePartialReason, "invalid-provider-location">;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Evidence completeness state of one Evidence list.
|
|
39
|
+
*
|
|
40
|
+
* - `complete`: every collected Evidence atom is shown and collection finished.
|
|
41
|
+
* - `capped`: exact total; a Result cap omitted some atoms.
|
|
42
|
+
* - `partial`: collection is incomplete, or invalid provider locations were
|
|
43
|
+
* excluded beside an exact valid total; hidden collected atoms are counted.
|
|
44
|
+
* - `unbounded`: collection is incomplete; hidden collected atoms are not counted.
|
|
45
|
+
*/
|
|
46
|
+
export type EvidenceCompleteness = "complete" | "capped" | "partial" | "unbounded";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Plain completeness facts of one Evidence list, as serialized in Tool details.
|
|
50
|
+
* Readers of persisted details parse into this shape; only this module produces
|
|
51
|
+
* the branded {@link EvidenceListMetadata}.
|
|
52
|
+
*/
|
|
53
|
+
export interface EvidenceListFacts {
|
|
54
|
+
readonly key: string;
|
|
55
|
+
readonly completeness: EvidenceCompleteness;
|
|
56
|
+
/** Exact Evidence atom total; null when collection is incomplete. */
|
|
57
|
+
readonly totalCount: number | null;
|
|
58
|
+
readonly shownCount: number;
|
|
59
|
+
/** Collected atoms hidden by a Result cap; null only for `unbounded` lists. */
|
|
60
|
+
readonly omittedCount: number | null;
|
|
61
|
+
readonly partialReason: EvidencePartialReason | null;
|
|
30
62
|
/** Provider explanation for incomplete collection, when available. */
|
|
31
|
-
partialMessage?: string;
|
|
63
|
+
readonly partialMessage?: string;
|
|
32
64
|
/** Unusable semantic-provider locations excluded from valid evidence totals. */
|
|
33
|
-
invalidLocationCount?: number;
|
|
65
|
+
readonly invalidLocationCount?: number;
|
|
34
66
|
}
|
|
35
67
|
|
|
68
|
+
declare const evidenceListBrand: unique symbol;
|
|
69
|
+
|
|
70
|
+
/** Evidence list metadata produced only by this module's constructors. */
|
|
71
|
+
export type EvidenceListMetadata = EvidenceListFacts & { readonly [evidenceListBrand]: true };
|
|
72
|
+
|
|
36
73
|
export interface EvidenceList<T> {
|
|
37
|
-
key: string;
|
|
38
|
-
items: T[];
|
|
39
|
-
metadata: EvidenceListMetadata;
|
|
74
|
+
readonly key: string;
|
|
75
|
+
readonly items: T[];
|
|
76
|
+
readonly metadata: EvidenceListMetadata;
|
|
40
77
|
}
|
|
41
78
|
|
|
42
|
-
|
|
79
|
+
interface CommonEvidenceListParams<T> {
|
|
43
80
|
key: string;
|
|
44
|
-
items: T[];
|
|
45
|
-
|
|
46
|
-
|
|
81
|
+
items: readonly T[];
|
|
82
|
+
/** Provider explanation for incomplete collection. */
|
|
83
|
+
partialMessage?: string;
|
|
84
|
+
/** Unusable provider locations excluded from the valid items. */
|
|
85
|
+
invalidLocationCount?: number;
|
|
47
86
|
}
|
|
48
87
|
|
|
49
|
-
export interface
|
|
50
|
-
|
|
51
|
-
items: T[];
|
|
52
|
-
partialReason: EvidencePartialReason;
|
|
53
|
-
/** Optional display cap; the overall evidence total remains unknown. */
|
|
88
|
+
export interface CreateEvidenceListParams<T> extends CommonEvidenceListParams<T> {
|
|
89
|
+
/** Result cap; the total stays exact. */
|
|
54
90
|
maxResults?: number;
|
|
91
|
+
/** Evidence ordering applied before the cap. */
|
|
92
|
+
sort?: (a: T, b: T) => number;
|
|
55
93
|
}
|
|
56
94
|
|
|
57
|
-
export interface
|
|
58
|
-
|
|
59
|
-
|
|
95
|
+
export interface CreateBoundedEvidenceListParams<T> extends CommonEvidenceListParams<T> {
|
|
96
|
+
/** Exact provider-counted total, including atoms not passed as items. */
|
|
97
|
+
totalCount: number;
|
|
60
98
|
}
|
|
61
99
|
|
|
100
|
+
export type CreatePartialEvidenceListParams<T> = CommonEvidenceListParams<T> & {
|
|
101
|
+
partialReason: CollectionPartialReason;
|
|
102
|
+
} & (
|
|
103
|
+
| {
|
|
104
|
+
/** Result cap over the collected items. */
|
|
105
|
+
maxResults?: number;
|
|
106
|
+
collectedCount?: never;
|
|
107
|
+
}
|
|
108
|
+
| {
|
|
109
|
+
/**
|
|
110
|
+
* Atoms collected before `items` were bounded upstream; null when the
|
|
111
|
+
* hidden collected atoms were not counted.
|
|
112
|
+
*/
|
|
113
|
+
collectedCount: number | null;
|
|
114
|
+
maxResults?: never;
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
/** Build a list from every collected item; a Result cap keeps the total exact. */
|
|
62
119
|
export function createEvidenceList<T>(params: CreateEvidenceListParams<T>): EvidenceList<T> {
|
|
63
120
|
const ordered = params.sort ? [...params.items].sort(params.sort) : [...params.items];
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
121
|
+
const items = ordered.slice(0, checkedCap(params.key, params.maxResults, ordered.length));
|
|
122
|
+
return list(params, { items, totalCount: ordered.length, collectedCount: ordered.length });
|
|
123
|
+
}
|
|
67
124
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
shownCount: items.length,
|
|
75
|
-
omittedCount,
|
|
76
|
-
partialReason: null,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
125
|
+
/** Build a list from pre-bounded items whose exact total a provider counted. */
|
|
126
|
+
export function createBoundedEvidenceList<T>(
|
|
127
|
+
params: CreateBoundedEvidenceListParams<T>,
|
|
128
|
+
): EvidenceList<T> {
|
|
129
|
+
const { totalCount } = params;
|
|
130
|
+
return list(params, { items: [...params.items], totalCount, collectedCount: totalCount });
|
|
79
131
|
}
|
|
80
132
|
|
|
133
|
+
/** Build a list for incomplete collection; the overall total stays unknown. */
|
|
81
134
|
export function createPartialEvidenceList<T>(
|
|
82
135
|
params: CreatePartialEvidenceListParams<T>,
|
|
83
136
|
): EvidenceList<T> {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
key: params.key,
|
|
88
|
-
items,
|
|
89
|
-
metadata: {
|
|
90
|
-
key: params.key,
|
|
137
|
+
if (params.collectedCount !== undefined) {
|
|
138
|
+
return list(params, {
|
|
139
|
+
items: [...params.items],
|
|
91
140
|
totalCount: null,
|
|
92
|
-
|
|
93
|
-
omittedCount:
|
|
94
|
-
params.maxResults === undefined ? null : Math.max(0, params.items.length - items.length),
|
|
141
|
+
collectedCount: params.collectedCount,
|
|
95
142
|
partialReason: params.partialReason,
|
|
96
|
-
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const items = params.items.slice(
|
|
146
|
+
0,
|
|
147
|
+
checkedCap(params.key, params.maxResults, params.items.length),
|
|
148
|
+
);
|
|
149
|
+
return list(params, {
|
|
150
|
+
items,
|
|
151
|
+
totalCount: null,
|
|
152
|
+
collectedCount: params.items.length,
|
|
153
|
+
partialReason: params.partialReason,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Reuse established metadata under another public evidence key. */
|
|
158
|
+
export function rekeyEvidence(metadata: EvidenceListMetadata, key: string): EvidenceListMetadata {
|
|
159
|
+
return Object.freeze({ ...metadata, key });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Plain serializable copy of list metadata for structured Tool details. */
|
|
163
|
+
export function toEvidenceListFacts(metadata: EvidenceListFacts): EvidenceListFacts {
|
|
164
|
+
return {
|
|
165
|
+
key: metadata.key,
|
|
166
|
+
completeness: metadata.completeness,
|
|
167
|
+
totalCount: metadata.totalCount,
|
|
168
|
+
shownCount: metadata.shownCount,
|
|
169
|
+
omittedCount: metadata.omittedCount,
|
|
170
|
+
partialReason: metadata.partialReason,
|
|
171
|
+
...(metadata.partialMessage === undefined ? {} : { partialMessage: metadata.partialMessage }),
|
|
172
|
+
...(metadata.invalidLocationCount === undefined
|
|
173
|
+
? {}
|
|
174
|
+
: { invalidLocationCount: metadata.invalidLocationCount }),
|
|
97
175
|
};
|
|
98
176
|
}
|
|
99
177
|
|
|
100
|
-
|
|
101
|
-
|
|
178
|
+
const PARTIAL_REASONS: ReadonlySet<string> = new Set<EvidencePartialReason>([
|
|
179
|
+
"timeout",
|
|
180
|
+
"safety-limit",
|
|
181
|
+
"interrupted",
|
|
182
|
+
"provider-limited",
|
|
183
|
+
"filesystem-error",
|
|
184
|
+
"configuration-error",
|
|
185
|
+
"invalid-provider-location",
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Parse persisted Tool details back into Evidence list facts. Returns null for
|
|
190
|
+
* malformed or internally inconsistent entries; renderers never repair them.
|
|
191
|
+
*/
|
|
192
|
+
export function readEvidenceListFacts(value: unknown): EvidenceListFacts | null {
|
|
193
|
+
const facts = readFactsShape(value);
|
|
194
|
+
return facts && isConsistent(facts) ? toEvidenceListFacts(facts) : null;
|
|
102
195
|
}
|
|
103
196
|
|
|
104
|
-
|
|
197
|
+
/** Field-level validation only; consistency is checked separately. */
|
|
198
|
+
function readFactsShape(value: unknown): EvidenceListFacts | null {
|
|
199
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
200
|
+
const record = value as Record<string, unknown>;
|
|
201
|
+
const { key, completeness, totalCount, shownCount, omittedCount, partialReason } = record;
|
|
202
|
+
const { partialMessage, invalidLocationCount } = record;
|
|
203
|
+
const valid =
|
|
204
|
+
typeof key === "string" &&
|
|
205
|
+
typeof completeness === "string" &&
|
|
206
|
+
isCount(shownCount) &&
|
|
207
|
+
isNullableCount(totalCount) &&
|
|
208
|
+
isNullableCount(omittedCount) &&
|
|
209
|
+
(partialReason === null || PARTIAL_REASONS.has(partialReason as string)) &&
|
|
210
|
+
(partialMessage === undefined || typeof partialMessage === "string") &&
|
|
211
|
+
(invalidLocationCount === undefined || isCount(invalidLocationCount));
|
|
212
|
+
return valid ? (record as unknown as EvidenceListFacts) : null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** The invariants every constructor guarantees. */
|
|
216
|
+
function isConsistent(facts: EvidenceListFacts): boolean {
|
|
217
|
+
const { totalCount, shownCount, omittedCount, partialReason } = facts;
|
|
218
|
+
const invalidReason = partialReason === "invalid-provider-location";
|
|
219
|
+
const invalidCount = facts.invalidLocationCount ?? 0;
|
|
220
|
+
// Only invalid provider locations keep an exact total beside a partial reason.
|
|
221
|
+
const exactTotal = partialReason === null || invalidReason;
|
|
222
|
+
return (
|
|
223
|
+
facts.completeness === completenessOf(partialReason, omittedCount) &&
|
|
224
|
+
exactTotal === (totalCount !== null) &&
|
|
225
|
+
(totalCount === null || totalCount === shownCount + (omittedCount ?? -1)) &&
|
|
226
|
+
// Invalid locations always carry a reason; it may be a collection reason such as
|
|
227
|
+
// provider-limited, whose metadata still records the invalid count.
|
|
228
|
+
(invalidReason ? invalidCount > 0 : invalidCount === 0 || partialReason !== null)
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Mark a constructed list incomplete after its upstream collection was
|
|
234
|
+
* interrupted. Counts are kept; the total becomes unknown. Lists carrying
|
|
235
|
+
* invalid provider locations cannot be re-marked.
|
|
236
|
+
*/
|
|
237
|
+
export function markEvidencePartial(
|
|
105
238
|
metadata: EvidenceListMetadata,
|
|
239
|
+
partialReason: CollectionPartialReason,
|
|
240
|
+
partialMessage?: string,
|
|
241
|
+
): EvidenceListMetadata {
|
|
242
|
+
if (metadata.invalidLocationCount) {
|
|
243
|
+
throw new Error(`Evidence list ${metadata.key}: cannot re-mark a list with invalid locations`);
|
|
244
|
+
}
|
|
245
|
+
return freeze({
|
|
246
|
+
...metadata,
|
|
247
|
+
completeness: completenessOf(partialReason, metadata.omittedCount),
|
|
248
|
+
totalCount: null,
|
|
249
|
+
partialReason,
|
|
250
|
+
...(partialMessage === undefined ? {} : { partialMessage }),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Evidence atoms this list establishes: the exact total, or for incomplete
|
|
256
|
+
* collection the shown plus counted hidden atoms. Never a completeness claim.
|
|
257
|
+
*/
|
|
258
|
+
export function knownEvidenceCount(facts: EvidenceListFacts): number {
|
|
259
|
+
return facts.totalCount ?? facts.shownCount + (facts.omittedCount ?? 0);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Optional atom noun for {@link describeEvidenceList}. */
|
|
263
|
+
export type EvidenceNoun = string | { readonly one: string; readonly other: string };
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Canonical Truncation-disclosure phrase for one Evidence list, without
|
|
267
|
+
* surrounding markup. Every presentation surface uses this wording.
|
|
268
|
+
*/
|
|
269
|
+
export function describeEvidenceList(facts: EvidenceListFacts, noun?: EvidenceNoun): string {
|
|
270
|
+
const label = nounFor(noun, facts.totalCount ?? facts.shownCount);
|
|
271
|
+
const parts: string[] = [];
|
|
272
|
+
if (facts.totalCount === null) {
|
|
273
|
+
parts.push(`${facts.shownCount}${label}`);
|
|
274
|
+
if (facts.omittedCount) parts.push(`${facts.omittedCount} collected omitted`);
|
|
275
|
+
parts.push(`more may exist — ${facts.partialReason ?? "partial"}`);
|
|
276
|
+
if (facts.partialMessage) parts.push(facts.partialMessage);
|
|
277
|
+
} else if (facts.omittedCount) {
|
|
278
|
+
parts.push(
|
|
279
|
+
`${facts.shownCount} of ${facts.totalCount}${label}`,
|
|
280
|
+
`${facts.omittedCount} omitted`,
|
|
281
|
+
);
|
|
282
|
+
} else {
|
|
283
|
+
parts.push(`${facts.totalCount}${label}`);
|
|
284
|
+
}
|
|
285
|
+
if (facts.invalidLocationCount) {
|
|
286
|
+
const locations = facts.invalidLocationCount === 1 ? "location" : "locations";
|
|
287
|
+
parts.push(
|
|
288
|
+
`${facts.invalidLocationCount} invalid provider ${locations} omitted (invalid-provider-location)`,
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return parts.join("; ");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** Markdown Truncation disclosure; null when the list is complete. */
|
|
295
|
+
export function renderEvidenceListMetadataDisclosure(
|
|
296
|
+
facts: EvidenceListFacts,
|
|
297
|
+
noun?: EvidenceNoun,
|
|
106
298
|
): string | null {
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
299
|
+
if (facts.completeness === "complete") return null;
|
|
300
|
+
return `_(showing ${describeEvidenceList(facts, noun)})_`;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Markdown Truncation disclosure for one list; null when the list is complete. */
|
|
304
|
+
export function renderEvidenceListDisclosure<T>(list: EvidenceList<T>): string | null {
|
|
305
|
+
return renderEvidenceListMetadataDisclosure(list.metadata);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function list<T>(
|
|
309
|
+
params: CommonEvidenceListParams<T>,
|
|
310
|
+
counts: {
|
|
311
|
+
items: T[];
|
|
312
|
+
totalCount: number | null;
|
|
313
|
+
collectedCount: number | null;
|
|
314
|
+
partialReason?: CollectionPartialReason;
|
|
315
|
+
},
|
|
316
|
+
): EvidenceList<T> {
|
|
317
|
+
const { items, totalCount, collectedCount } = counts;
|
|
318
|
+
const partialReason = counts.partialReason ?? null;
|
|
319
|
+
const shownCount = items.length;
|
|
320
|
+
const invalid = params.invalidLocationCount ?? 0;
|
|
321
|
+
assertCount(params.key, "invalid location count", invalid);
|
|
322
|
+
if (collectedCount !== null) {
|
|
323
|
+
assertCount(params.key, "collected count", collectedCount);
|
|
324
|
+
if (shownCount > collectedCount) {
|
|
325
|
+
throw new Error(
|
|
326
|
+
`Evidence list ${params.key}: shown count ${shownCount} exceeds collected count ${collectedCount}`,
|
|
327
|
+
);
|
|
328
|
+
}
|
|
112
329
|
}
|
|
330
|
+
const omittedCount = collectedCount === null ? null : collectedCount - shownCount;
|
|
331
|
+
const reason = partialReason ?? (invalid > 0 ? "invalid-provider-location" : null);
|
|
332
|
+
const metadata = freeze({
|
|
333
|
+
key: params.key,
|
|
334
|
+
completeness: completenessOf(reason, omittedCount),
|
|
335
|
+
totalCount,
|
|
336
|
+
shownCount,
|
|
337
|
+
omittedCount,
|
|
338
|
+
partialReason: reason,
|
|
339
|
+
...(params.partialMessage === undefined ? {} : { partialMessage: params.partialMessage }),
|
|
340
|
+
...(invalid > 0 ? { invalidLocationCount: invalid } : {}),
|
|
341
|
+
});
|
|
342
|
+
return { key: params.key, items, metadata };
|
|
343
|
+
}
|
|
113
344
|
|
|
114
|
-
|
|
115
|
-
|
|
345
|
+
function completenessOf(
|
|
346
|
+
partialReason: EvidencePartialReason | null,
|
|
347
|
+
omittedCount: number | null,
|
|
348
|
+
): EvidenceCompleteness {
|
|
349
|
+
if (partialReason !== null) return omittedCount === null ? "unbounded" : "partial";
|
|
350
|
+
return omittedCount ? "capped" : "complete";
|
|
116
351
|
}
|
|
117
352
|
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
353
|
+
function freeze(facts: EvidenceListFacts): EvidenceListMetadata {
|
|
354
|
+
return Object.freeze(facts) as EvidenceListMetadata;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function isCount(value: unknown): value is number {
|
|
358
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function isNullableCount(value: unknown): value is number | null {
|
|
362
|
+
return value === null || isCount(value);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function checkedCap(key: string, maxResults: number | undefined, fallback: number): number {
|
|
366
|
+
if (maxResults === undefined) return fallback;
|
|
367
|
+
assertCount(key, "result cap", maxResults);
|
|
368
|
+
return maxResults;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function assertCount(key: string, name: string, value: number): void {
|
|
372
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
373
|
+
throw new Error(`Evidence list ${key}: ${name} must be a non-negative integer, got ${value}`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function nounFor(noun: EvidenceNoun | undefined, count: number): string {
|
|
378
|
+
if (noun === undefined) return "";
|
|
379
|
+
if (typeof noun === "string") return ` ${noun}`;
|
|
380
|
+
return ` ${count === 1 ? noun.one : noun.other}`;
|
|
123
381
|
}
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
WorkspaceDiagnosticReport,
|
|
12
12
|
WorkspaceLspRuntime,
|
|
13
13
|
} from "@mrclrchtr/supi-lsp/api";
|
|
14
|
+
import { allRequestedFilesConfirmed } from "../../diagnostics/coverage.ts";
|
|
14
15
|
import { mergeDiagnosticEvidence } from "../../diagnostics/evidence.ts";
|
|
15
16
|
import type {
|
|
16
17
|
HealthDiagnosticEntry,
|
|
@@ -18,6 +19,7 @@ import type {
|
|
|
18
19
|
HealthDiagnosticScope,
|
|
19
20
|
HealthSection,
|
|
20
21
|
} from "../../session/health-types.ts";
|
|
22
|
+
import { diagnosticEvidenceReason } from "./evidence-reason.ts";
|
|
21
23
|
import {
|
|
22
24
|
collectScopedFileDiagnostics,
|
|
23
25
|
fileScopeStatus,
|
|
@@ -107,9 +109,14 @@ function collectTrackedFileDiagnostics(
|
|
|
107
109
|
? collectWorkspaceDiagnosticsDetailed(service, scope.filter, cwd, refreshReport)
|
|
108
110
|
: collectWorkspaceDiagnostics(service, scope.filter, cwd, refreshReport);
|
|
109
111
|
const sourceEvidence = refreshReport
|
|
110
|
-
? snapshot.evidence
|
|
112
|
+
? withRefreshRemovals(snapshot.evidence, refreshEvidence, cwd)
|
|
111
113
|
: mergeEvidence(refreshEvidence, snapshot.evidence, cwd);
|
|
112
|
-
const
|
|
114
|
+
const retainedEvidence = withRetainedRemovals(
|
|
115
|
+
sourceEvidence,
|
|
116
|
+
service.peekRemovedTrackedFiles(scope.filter),
|
|
117
|
+
cwd,
|
|
118
|
+
);
|
|
119
|
+
const scopedEvidence = selectTrackedFileEvidence(retainedEvidence, scope.filter, cwd);
|
|
113
120
|
const evidence = ensureEvidenceCoversEntries(scopedEvidence, snapshot.entries, cwd);
|
|
114
121
|
return evidenceIsComplete(evidence, snapshot.entries.length > 0, snapshot.current)
|
|
115
122
|
? { kind: "completed", scope, entries: snapshot.entries, evidence }
|
|
@@ -250,6 +257,62 @@ function mergeEvidence(
|
|
|
250
257
|
: snapshotEvidence;
|
|
251
258
|
}
|
|
252
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Carry removed documents from refresh evidence into a coherent refresh report.
|
|
262
|
+
*
|
|
263
|
+
* The report is captured after `pruneMissingFiles()`, so files deleted before the refresh are
|
|
264
|
+
* absent from it; only the refresh evidence records them. Removal is terminal, so adding those
|
|
265
|
+
* documents cannot mix report generations. Files the report still tracks keep their report status.
|
|
266
|
+
*/
|
|
267
|
+
function withRefreshRemovals(
|
|
268
|
+
reportEvidence: DiagnosticEvidenceSummary,
|
|
269
|
+
refreshEvidence: DiagnosticEvidenceSummary | undefined,
|
|
270
|
+
cwd: string,
|
|
271
|
+
): DiagnosticEvidenceSummary {
|
|
272
|
+
const removed = refreshEvidence?.documents.filter((document) => document.status === "removed");
|
|
273
|
+
if (!removed || removed.length === 0) return reportEvidence;
|
|
274
|
+
const reported = new Set(reportEvidence.documents.map((document) => resolve(cwd, document.file)));
|
|
275
|
+
const added = removed.filter((document) => !reported.has(resolve(cwd, document.file)));
|
|
276
|
+
if (added.length === 0) return reportEvidence;
|
|
277
|
+
return {
|
|
278
|
+
...reportEvidence,
|
|
279
|
+
requested: reportEvidence.requested + added.length,
|
|
280
|
+
removed: reportEvidence.removed + added.length,
|
|
281
|
+
documents: [...reportEvidence.documents, ...added],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Add tracked files that the runtime retained as removed since a report last showed them.
|
|
287
|
+
*
|
|
288
|
+
* Passive reads and background server refreshes clear deleted files from the live snapshot, so
|
|
289
|
+
* the retained record is what keeps a removal visible until a report delivers it (#606).
|
|
290
|
+
*/
|
|
291
|
+
function withRetainedRemovals(
|
|
292
|
+
evidence: DiagnosticEvidenceSummary,
|
|
293
|
+
removedFiles: readonly string[],
|
|
294
|
+
cwd: string,
|
|
295
|
+
): DiagnosticEvidenceSummary {
|
|
296
|
+
if (removedFiles.length === 0) return evidence;
|
|
297
|
+
const reported = new Set(evidence.documents.map((document) => resolve(cwd, document.file)));
|
|
298
|
+
const added = removedFiles
|
|
299
|
+
.filter((file) => !reported.has(resolve(cwd, file)))
|
|
300
|
+
.map((file) => ({ file: relative(cwd, resolve(cwd, file)), status: "removed" as const }));
|
|
301
|
+
if (added.length === 0) return evidence;
|
|
302
|
+
return summarizeEvidence([...evidence.documents, ...added]);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** Return absolute paths of files an observation reported as removed. */
|
|
306
|
+
export function reportedRemovedFiles(
|
|
307
|
+
observation: HealthDiagnosticObservation,
|
|
308
|
+
cwd: string,
|
|
309
|
+
): string[] {
|
|
310
|
+
if (observation.kind === "not-requested") return [];
|
|
311
|
+
return observation.evidence.documents
|
|
312
|
+
.filter((document) => document.status === "removed")
|
|
313
|
+
.map((document) => resolve(cwd, document.file));
|
|
314
|
+
}
|
|
315
|
+
|
|
253
316
|
function selectTrackedFileEvidence(
|
|
254
317
|
evidence: DiagnosticEvidenceSummary,
|
|
255
318
|
scopeFilter: string | null,
|
|
@@ -302,22 +365,7 @@ function evidenceIsComplete(
|
|
|
302
365
|
): boolean {
|
|
303
366
|
if (!snapshotCurrent && evidence.requested === 0) return false;
|
|
304
367
|
if (evidence.requested === 0) return !hasDiagnosticEntries;
|
|
305
|
-
return (
|
|
306
|
-
evidence.confirmed + evidence.removed === evidence.requested &&
|
|
307
|
-
evidence.unconfirmed === 0 &&
|
|
308
|
-
evidence.failed === 0
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function diagnosticEvidenceReason(evidence: DiagnosticEvidenceSummary): string {
|
|
313
|
-
if (evidence.requested === 0) {
|
|
314
|
-
return "No document-level diagnostic evidence was collected for this scope. An empty result does not establish that the scope is clean. Request diagnostics for an exact file.";
|
|
315
|
-
}
|
|
316
|
-
let reason = `Diagnostic evidence is partial: ${evidence.requested} requested, ${evidence.confirmed} confirmed, ${evidence.unconfirmed} unconfirmed, ${evidence.failed} failed, ${evidence.removed} removed.`;
|
|
317
|
-
if (evidence.unconfirmed > 0) {
|
|
318
|
-
reason += " Unconfirmed documents have no request-based confirmation.";
|
|
319
|
-
}
|
|
320
|
-
return reason;
|
|
368
|
+
return allRequestedFilesConfirmed(evidence);
|
|
321
369
|
}
|
|
322
370
|
|
|
323
371
|
export function isDirectory(filePath: string): boolean {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DiagnosticEvidenceDocument,
|
|
3
|
+
DiagnosticEvidenceSummary,
|
|
4
|
+
} from "@mrclrchtr/supi-lsp/api";
|
|
5
|
+
|
|
6
|
+
const EVIDENCE_FILE_NAME_LIMIT = 3;
|
|
7
|
+
|
|
8
|
+
/** Explain why tracked-file evidence is partial, naming removed and disk-changed files. */
|
|
9
|
+
export function diagnosticEvidenceReason(evidence: DiagnosticEvidenceSummary): string {
|
|
10
|
+
if (evidence.requested === 0) {
|
|
11
|
+
return "No document-level diagnostic evidence was collected for this scope. An empty result does not establish that the scope is clean. Request diagnostics for an exact file.";
|
|
12
|
+
}
|
|
13
|
+
let reason = `Diagnostic evidence is partial: ${evidence.requested} requested, ${evidence.confirmed} confirmed, ${evidence.unconfirmed} unconfirmed, ${evidence.failed} failed, ${evidence.removed} removed.`;
|
|
14
|
+
if (evidence.unconfirmed > 0) {
|
|
15
|
+
reason += " Unconfirmed documents have no request-based confirmation.";
|
|
16
|
+
}
|
|
17
|
+
const diskChanged = fileListWhere(evidence, (document) => document.reason === "disk-changed");
|
|
18
|
+
if (diskChanged) {
|
|
19
|
+
reason += ` Changed on disk after their last diagnosis: ${diskChanged}. Their listed diagnostics may be stale; run code_health again with refresh: true.`;
|
|
20
|
+
}
|
|
21
|
+
if (evidence.removed > 0) {
|
|
22
|
+
reason += ` Removed since last tracked: ${removedFileList(evidence)}. Files that imported them may not be re-checked yet; run code_health again with refresh: true to confirm the remaining files.`;
|
|
23
|
+
}
|
|
24
|
+
return reason;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function removedFileList(evidence: DiagnosticEvidenceSummary): string {
|
|
28
|
+
return (
|
|
29
|
+
fileListWhere(evidence, (document) => document.status === "removed") ??
|
|
30
|
+
`${evidence.removed} file${evidence.removed === 1 ? "" : "s"}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Bounded, quoted list of matching document files; undefined when none match. */
|
|
35
|
+
function fileListWhere(
|
|
36
|
+
evidence: DiagnosticEvidenceSummary,
|
|
37
|
+
matches: (document: DiagnosticEvidenceDocument) => boolean,
|
|
38
|
+
): string | undefined {
|
|
39
|
+
const files = evidence.documents.filter(matches).map((document) => `\`${document.file}\``);
|
|
40
|
+
if (files.length === 0) return undefined;
|
|
41
|
+
const shown = files.slice(0, EVIDENCE_FILE_NAME_LIMIT).join(", ");
|
|
42
|
+
const more = files.length - EVIDENCE_FILE_NAME_LIMIT;
|
|
43
|
+
return more > 0 ? `${shown} (+${more} more)` : shown;
|
|
44
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { StructuralProvider as StructuralSubstrate } from "@mrclrchtr/supi-
|
|
|
2
2
|
import type { AutomaticLspPathPolicy } from "@mrclrchtr/supi-lsp/api";
|
|
3
3
|
import type { StructuralSearchOperation } from "@mrclrchtr/supi-tree-sitter/api";
|
|
4
4
|
import type { CodeFindAstKind } from "../../tool/code_find/ast-kinds.ts";
|
|
5
|
-
import type {
|
|
5
|
+
import type { CollectionPartialReason } from "../evidence.ts";
|
|
6
6
|
import {
|
|
7
7
|
type AstScanExclusion,
|
|
8
8
|
type AstScanOperations,
|
|
@@ -46,7 +46,7 @@ export interface StructuredScanSummary {
|
|
|
46
46
|
|
|
47
47
|
export interface StructuredPatternResult {
|
|
48
48
|
readonly matches: readonly StructuredMatch[];
|
|
49
|
-
readonly partialReason:
|
|
49
|
+
readonly partialReason: CollectionPartialReason | null;
|
|
50
50
|
/** Per-file parse/analysis failures surfaced to the agent. */
|
|
51
51
|
readonly failures: readonly StructuredFailure[];
|
|
52
52
|
readonly scan: StructuredScanSummary;
|
|
@@ -190,7 +190,7 @@ export async function getStructuredPatternMatches(
|
|
|
190
190
|
|
|
191
191
|
function primaryPartialReason(
|
|
192
192
|
limitations: readonly StructuredScanLimitation[],
|
|
193
|
-
):
|
|
193
|
+
): CollectionPartialReason {
|
|
194
194
|
if (limitations.some((limitation) => limitation.reason === "timeout")) return "timeout";
|
|
195
195
|
if (limitations.some((limitation) => limitation.reason === "safety-limit")) {
|
|
196
196
|
return "safety-limit";
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
19
19
|
import type { AnchorKind } from "../../session/target-store.ts";
|
|
20
20
|
import type { AnchoredResolutionSource } from "../../types/index.ts";
|
|
21
|
+
import { createEvidenceList, type EvidenceListMetadata } from "../evidence.ts";
|
|
21
22
|
import { resolveFromStructural } from "./anchored-structural.ts";
|
|
22
23
|
import {
|
|
23
24
|
canonicalFileDeclarationKind,
|
|
@@ -133,9 +134,7 @@ async function candidatesFromSymbols(
|
|
|
133
134
|
): Promise<{
|
|
134
135
|
kind: "disambiguation";
|
|
135
136
|
candidates: DisambiguationCandidateData[];
|
|
136
|
-
|
|
137
|
-
omittedCount: number;
|
|
138
|
-
partialReason: null;
|
|
137
|
+
candidateEvidence: EvidenceListMetadata;
|
|
139
138
|
}> {
|
|
140
139
|
const candidates = await Promise.all(
|
|
141
140
|
matched.map(async (s, idx) => {
|
|
@@ -162,9 +161,7 @@ async function candidatesFromSymbols(
|
|
|
162
161
|
return {
|
|
163
162
|
kind: "disambiguation",
|
|
164
163
|
candidates,
|
|
165
|
-
|
|
166
|
-
omittedCount: 0,
|
|
167
|
-
partialReason: null,
|
|
164
|
+
candidateEvidence: createEvidenceList({ key: "target.candidates", items: candidates }).metadata,
|
|
168
165
|
};
|
|
169
166
|
}
|
|
170
167
|
|