@mrclrchtr/supi-review 5.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -15
- package/node_modules/@mrclrchtr/supi-agent-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +4 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +36 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +12 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +67 -28
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +63 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +46 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +214 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +278 -79
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +29 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +101 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +19 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +49 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +73 -15
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +3 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +176 -24
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +4 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +46 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +4 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +65 -17
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +143 -21
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +43 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/diagnostics.ts +58 -126
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/file-scope.ts +184 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/recovery.ts +8 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/readiness.ts +4 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan.ts +4 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern-analysis.ts +10 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/pattern.ts +6 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/config.ts +35 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +57 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/overview/overview-data.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/overview/overview.ts +49 -30
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/overview/types.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-types.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-workflow.ts +3 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-refresh.ts +76 -49
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +7 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-workflow.ts +35 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/input/workflows.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/inspect-workflow.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation/collect.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-types.ts +2 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-workflow.ts +8 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-workflow.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/session.ts +25 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/maintenance.ts +105 -23
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/recovery.ts +11 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/execute.ts +23 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/guidance.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/render.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/find.ts → code_find/result.ts} +36 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/spec.ts +37 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/execute.ts +24 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/guidance.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{graph → code_graph}/markdown.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/graph.ts → code_graph/result.ts} +69 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/spec.ts +39 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/execute.ts +2 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/guidance.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/markdown.ts +68 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/health.ts → code_health/result.ts} +29 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/spec.ts +41 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/execute.ts +20 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/guidance.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{inspect → code_inspect}/markdown.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/inspect.ts → code_inspect/result.ts} +32 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_inspect/spec.ts +25 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/execute.ts +25 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/guidance.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{orientation → code_orientation}/markdown.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/orientation.ts → code_orientation/result.ts} +67 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/spec.ts +25 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/execute.ts +17 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/guidance.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-apply/execute.ts → code_refactor_apply/result.ts} +5 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/spec.ts +26 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/execute.ts +27 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/guidance.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-plan/execute.ts → code_refactor_plan/result.ts} +9 -22
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/spec.ts +25 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/execute.ts +19 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/guidance.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{resolve → code_resolve}/markdown.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{result/resolve.ts → code_resolve/result.ts} +37 -24
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/spec.ts +25 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/guidance.ts +71 -52
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/infra/truncate.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-plan/markdown.ts → refactor-markdown.ts} +4 -7
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/register.ts +9 -97
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/refactor.ts +1 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/schemas.ts +26 -157
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/specs.ts +40 -126
- package/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -3
- package/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/package.json +4 -4
- package/src/config.ts +2 -2
- package/src/review.ts +5 -5
- package/src/target/input.ts +90 -0
- package/src/target/resolve.ts +9 -39
- package/src/tool/output-page.ts +45 -8
- package/src/tool/page-render.ts +37 -0
- package/src/tool/page-schemas.ts +29 -0
- package/src/tool/review_audit/execute.ts +56 -0
- package/src/tool/review_audit/guidance.ts +10 -0
- package/src/tool/review_audit/register.ts +19 -0
- package/src/{tui/paged-output.ts → tool/review_audit/render.ts} +9 -72
- package/src/tool/review_audit/result.ts +144 -0
- package/src/tool/review_audit/spec.ts +44 -0
- package/src/tool/review_output/execute.ts +19 -0
- package/src/tool/review_output/guidance.ts +7 -0
- package/src/tool/review_output/register.ts +23 -0
- package/src/tool/review_output/render.ts +37 -0
- package/src/tool/review_output/result.ts +33 -0
- package/src/tool/review_output/spec.ts +29 -0
- package/src/tool/{child-failure-diagnostics.ts → review_run/child-failures.ts} +1 -1
- package/src/tool/{child-session-runner.ts → review_run/child-session.ts} +2 -2
- package/src/tool/{review-tools.ts → review_run/child-tools.ts} +43 -6
- package/src/tool/{review-debug-summary.ts → review_run/debug-summary.ts} +1 -1
- package/src/tool/{agent-review-tools.ts → review_run/execute.ts} +10 -59
- package/src/tool/{review-execution.ts → review_run/execution.ts} +6 -6
- package/src/tool/{review-format.ts → review_run/format.ts} +9 -11
- package/src/tool/review_run/guidance.ts +11 -0
- package/src/tool/{agent-review-schemas.ts → review_run/input-schema.ts} +61 -62
- package/src/tool/{planner-input.ts → review_run/planner-input.ts} +3 -3
- package/src/tool/{planner-runner.ts → review_run/planner.ts} +7 -7
- package/src/tool/{post-review-policy.ts → review_run/post-policy.ts} +4 -4
- package/src/tool/{review-recovery.ts → review_run/recovery.ts} +4 -4
- package/src/tool/review_run/register.ts +24 -0
- package/src/{tui/run.ts → tool/review_run/render.ts} +30 -23
- package/src/tool/review_run/result.ts +51 -0
- package/src/tool/{review-runner.ts → review_run/runner.ts} +7 -7
- package/src/tool/{schemas.ts → review_run/schemas.ts} +4 -4
- package/src/tool/review_run/spec.ts +11 -0
- package/src/{review-result.ts → tool/review_run/submission.ts} +7 -5
- package/src/tool/{review-system-prompt.ts → review_run/system-prompt.ts} +3 -3
- package/src/tool/{review-workflow.ts → review_run/workflow.ts} +19 -15
- package/src/tui/common.ts +2 -2
- package/src/tui/review-command.ts +4 -4
- package/src/tui/review-target-picker.ts +11 -11
- package/src/types.ts +15 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/find/execute.ts +0 -43
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/graph/execute.ts +0 -82
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/inspect/execute.ts +0 -40
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/orientation/execute.ts +0 -80
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/resolve/execute.ts +0 -53
- package/src/tool/review-audit-tool.ts +0 -181
- package/src/tool/review-output-tool.ts +0 -74
- package/src/tool/tool-specs.ts +0 -137
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/ast-kinds.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/markdown.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/modes.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{find → code_find}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{graph → code_graph}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/refresh-status.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/semantic-state.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{health → code_health}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{inspect → code_inspect}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{orientation → code_orientation}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-apply → code_refactor_apply}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{refactor-plan → code_refactor_plan}/tui.ts +0 -0
- /package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/{resolve → code_resolve}/tui.ts +0 -0
- /package/src/tool/{child-resource-loader.ts → review_run/child-resources.ts} +0 -0
|
@@ -2,6 +2,7 @@ import type { PublishDiagnosticsParams } from "../config/types.ts";
|
|
|
2
2
|
import { uriToFile } from "../utils.ts";
|
|
3
3
|
import {
|
|
4
4
|
type DiagnosticCacheEntry,
|
|
5
|
+
isTentativePushEntry,
|
|
5
6
|
isValidPublishDiagnosticsParams,
|
|
6
7
|
} from "./client-diagnostic-evidence.ts";
|
|
7
8
|
import type { ClientDiagnosticSnapshot, OpenDocumentState } from "./client-document-state.ts";
|
|
@@ -20,27 +21,44 @@ interface ApplyPushOptions {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
* Apply one valid push publication
|
|
24
|
+
* Apply one valid push publication.
|
|
24
25
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* pushes
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
26
|
+
* Returns whether the publication was accepted and whether it promoted a
|
|
27
|
+
* tentative entry to confirmed. Fail-closed policy (ADR 0020): unversioned
|
|
28
|
+
* pushes are rejected for closed and untracked URIs and for arrivals before
|
|
29
|
+
* the URI's sync moment; versioned pushes for a URI closed by a lifecycle
|
|
30
|
+
* operation are rejected because their version cannot be verified. An
|
|
31
|
+
* unversioned push that arrives after the sync moment of an open document
|
|
32
|
+
* is accepted and re-stamped with that document's current synchronization
|
|
33
|
+
* state. The first valid publication for a synchronization is tentative; a
|
|
34
|
+
* later valid publication for the same synchronization ID and evidence
|
|
35
|
+
* revision promotes the cache to confirmed (ADR 0021).
|
|
31
36
|
*/
|
|
32
|
-
export function applyPushDiagnostics(options: ApplyPushOptions):
|
|
33
|
-
|
|
37
|
+
export function applyPushDiagnostics(options: ApplyPushOptions): {
|
|
38
|
+
accepted: boolean;
|
|
39
|
+
promoted: boolean;
|
|
40
|
+
} {
|
|
41
|
+
if (!isValidPublishDiagnosticsParams(options.params)) return { accepted: false, promoted: false };
|
|
34
42
|
const openDocument = options.openDocuments.get(options.params.uri);
|
|
35
43
|
if (options.params.version !== undefined) {
|
|
36
|
-
if (!Number.isInteger(options.params.version)) return false;
|
|
37
|
-
if (openDocument && options.params.version !== openDocument.version)
|
|
38
|
-
|
|
44
|
+
if (!Number.isInteger(options.params.version)) return { accepted: false, promoted: false };
|
|
45
|
+
if (openDocument && options.params.version !== openDocument.version) {
|
|
46
|
+
return { accepted: false, promoted: false };
|
|
47
|
+
}
|
|
48
|
+
if (!openDocument && options.closedVersionedBarrier)
|
|
49
|
+
return { accepted: false, promoted: false };
|
|
39
50
|
}
|
|
40
|
-
if (!Array.isArray(options.params.diagnostics)) return false;
|
|
41
|
-
if (!acceptUnversionedPush(options, openDocument)) return false;
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
if (!Array.isArray(options.params.diagnostics)) return { accepted: false, promoted: false };
|
|
52
|
+
if (!acceptUnversionedPush(options, openDocument)) return { accepted: false, promoted: false };
|
|
53
|
+
const entry = buildPushCacheEntry(options, openDocument);
|
|
54
|
+
const previous = options.store.get(options.params.uri);
|
|
55
|
+
const promoted =
|
|
56
|
+
entry.source === "push" &&
|
|
57
|
+
entry.publications !== undefined &&
|
|
58
|
+
entry.publications >= 2 &&
|
|
59
|
+
isTentativePushEntry(previous);
|
|
60
|
+
options.store.set(options.params.uri, entry);
|
|
61
|
+
return { accepted: true, promoted };
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
/** Gate one unversioned push publication against the sync-moment policy. */
|
|
@@ -69,13 +87,27 @@ function buildPushCacheEntry(
|
|
|
69
87
|
): DiagnosticCacheEntry {
|
|
70
88
|
const currentRevision = openDocument?.evidenceRevision === options.evidenceRevision;
|
|
71
89
|
const unversioned = options.params.version === undefined && openDocument !== undefined;
|
|
90
|
+
const synchronizationId =
|
|
91
|
+
unversioned || currentRevision ? openDocument?.synchronizationId : undefined;
|
|
92
|
+
const evidenceRevision = openDocument?.evidenceRevision;
|
|
93
|
+
const previous = options.store.get(options.params.uri);
|
|
94
|
+
// A later valid publication for the same synchronization ID and evidence
|
|
95
|
+
// revision continues the entry's publication count: a confirmed pull
|
|
96
|
+
// entry keeps the synchronization confirmed, and a tentative push entry
|
|
97
|
+
// is promoted. Any other publication starts a fresh count.
|
|
98
|
+
const sameSynchronization =
|
|
99
|
+
synchronizationId !== undefined &&
|
|
100
|
+
previous?.synchronizationId === synchronizationId &&
|
|
101
|
+
previous.evidenceRevision === evidenceRevision;
|
|
102
|
+
const publications = sameSynchronization ? Math.min((previous.publications ?? 1) + 1, 2) : 1;
|
|
72
103
|
return {
|
|
73
104
|
diagnostics: options.params.diagnostics,
|
|
74
105
|
receivedAt: Date.now(),
|
|
75
106
|
source: "push",
|
|
76
|
-
synchronizationId
|
|
77
|
-
evidenceRevision
|
|
107
|
+
synchronizationId,
|
|
108
|
+
evidenceRevision,
|
|
78
109
|
version: options.params.version,
|
|
110
|
+
publications,
|
|
79
111
|
};
|
|
80
112
|
}
|
|
81
113
|
|
|
@@ -119,17 +151,18 @@ function collectOpenDocumentFreshness(options: {
|
|
|
119
151
|
const uris = new Set<string>();
|
|
120
152
|
for (const [uri, document] of options.openDocuments) {
|
|
121
153
|
uris.add(uri);
|
|
154
|
+
const entry = options.store.get(uri);
|
|
122
155
|
const fileState = getDiagnosticFileState(uriToFile(uri));
|
|
123
|
-
const current = hasCurrentDiagnosticEvidence(
|
|
124
|
-
document,
|
|
125
|
-
options.store.get(uri),
|
|
126
|
-
options.evidenceRevision,
|
|
127
|
-
);
|
|
156
|
+
const current = hasCurrentDiagnosticEvidence(document, entry, options.evidenceRevision);
|
|
128
157
|
const failed = options.failedDocuments.has(uri);
|
|
158
|
+
// A current tentative push maps to unconfirmed, not to a new public
|
|
159
|
+
// status: it matches the synchronization but cannot confirm it yet, so
|
|
160
|
+
// it must not claim current snapshot or document state (issue #351).
|
|
161
|
+
const tentative = current && isTentativePushEntry(entry);
|
|
129
162
|
documents.push({
|
|
130
163
|
uri,
|
|
131
|
-
current: fileState === "present" && current && !failed,
|
|
132
|
-
status: statusForDocument(fileState, current, failed),
|
|
164
|
+
current: fileState === "present" && current && !failed && !tentative,
|
|
165
|
+
status: statusForDocument(fileState, current, failed, tentative),
|
|
133
166
|
});
|
|
134
167
|
}
|
|
135
168
|
return { documents, uris };
|
|
@@ -174,10 +207,12 @@ function statusForDocument(
|
|
|
174
207
|
fileState: ReturnType<typeof getDiagnosticFileState>,
|
|
175
208
|
current: boolean,
|
|
176
209
|
failed: boolean,
|
|
210
|
+
tentative: boolean,
|
|
177
211
|
): "confirmed" | "unconfirmed" | "failed" | "removed" {
|
|
178
212
|
if (fileState === "removed") return "removed";
|
|
179
213
|
if (fileState === "unreadable" || failed) return "failed";
|
|
180
|
-
|
|
214
|
+
if (tentative || !current) return "unconfirmed";
|
|
215
|
+
return "confirmed";
|
|
181
216
|
}
|
|
182
217
|
|
|
183
218
|
function collectCachedDiagnostics(options: {
|
|
@@ -197,9 +232,13 @@ function collectCachedDiagnostics(options: {
|
|
|
197
232
|
entry,
|
|
198
233
|
options.evidenceRevision,
|
|
199
234
|
);
|
|
200
|
-
current
|
|
235
|
+
// A current tentative error is useful partial evidence. Keep its entry
|
|
236
|
+
// non-current so it cannot establish a clean or settled result (ADR 0021).
|
|
237
|
+
const tentative = entryCurrent && isTentativePushEntry(entry);
|
|
238
|
+
const confirmed = entryCurrent && !tentative;
|
|
239
|
+
current &&= confirmed;
|
|
201
240
|
if (entry.diagnostics.length > 0) {
|
|
202
|
-
entries.push({ uri, diagnostics: entry.diagnostics, current:
|
|
241
|
+
entries.push({ uri, diagnostics: entry.diagnostics, current: confirmed });
|
|
203
242
|
}
|
|
204
243
|
}
|
|
205
244
|
return { entries, current };
|
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
type CodeRequestControl,
|
|
4
4
|
completedCodeQuery,
|
|
5
5
|
isCodeRequestInterruption,
|
|
6
|
+
partialCodeQuery,
|
|
6
7
|
throwIfCodeRequestInterrupted,
|
|
7
8
|
unavailableCodeQuery,
|
|
8
9
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
9
10
|
import type { Diagnostic } from "../config/types.ts";
|
|
11
|
+
import { TENTATIVE_PUSH_UNAVAILABLE_REASON } from "../diagnostics/evidence.ts";
|
|
10
12
|
import {
|
|
11
13
|
type DiagnosticSynchronization,
|
|
12
14
|
incompleteDiagnosticResult,
|
|
@@ -25,6 +27,8 @@ interface FileDiagnosticCollectionOptions {
|
|
|
25
27
|
readonly waiters: DiagnosticWaitRegistry;
|
|
26
28
|
readonly current: () => boolean;
|
|
27
29
|
readonly freshPush: () => boolean;
|
|
30
|
+
/** Receive time of a current tentative push that is already cached. */
|
|
31
|
+
readonly currentPushReceivedAt: () => number | undefined;
|
|
28
32
|
readonly diagnostics: () => Diagnostic[];
|
|
29
33
|
readonly pullDiagnostics: (timeoutMs: number, signal: AbortSignal) => Promise<boolean>;
|
|
30
34
|
/** Observe the push wait outcome without finishing the observer; the caller finishes once. */
|
|
@@ -58,22 +62,75 @@ export async function collectSynchronizedFileDiagnostics(
|
|
|
58
62
|
return completedCodeQuery(options.diagnostics());
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
const push = await options
|
|
62
|
-
options.request.uri,
|
|
63
|
-
Math.max(0, options.maxWaitMs - (Date.now() - options.syncStart)),
|
|
64
|
-
control,
|
|
65
|
-
);
|
|
65
|
+
const push = await waitForConfirmedPush(options, control);
|
|
66
66
|
if (options.onPushWait) options.onPushWait(push);
|
|
67
67
|
else options.observer.pushWaitCompleted(1, push);
|
|
68
|
-
if (push === "published"
|
|
68
|
+
if (push === "published") {
|
|
69
69
|
return completedCodeQuery(options.diagnostics());
|
|
70
70
|
}
|
|
71
|
+
if (push === "tentative") {
|
|
72
|
+
// A current tentative error is useful partial evidence, but an empty
|
|
73
|
+
// publication cannot establish that the document is clean (ADR 0021).
|
|
74
|
+
const diagnostics = options.diagnostics();
|
|
75
|
+
return diagnostics.length > 0
|
|
76
|
+
? partialCodeQuery(diagnostics, TENTATIVE_PUSH_UNAVAILABLE_REASON)
|
|
77
|
+
: unavailableCodeQuery(TENTATIVE_PUSH_UNAVAILABLE_REASON);
|
|
78
|
+
}
|
|
71
79
|
return incompleteDiagnosticResult(
|
|
72
80
|
options.cachedDiagnostics,
|
|
73
81
|
push === "released" ? "released" : "timed-out",
|
|
74
82
|
);
|
|
75
83
|
}
|
|
76
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Wait until a confirmed push publication settles the synchronization.
|
|
87
|
+
*
|
|
88
|
+
* Every accepted publication releases the waiter. A confirmed push ends the
|
|
89
|
+
* wait as "published". A publication that stays tentative (no republish
|
|
90
|
+
* arrived for the same synchronization) ends as "tentative" when the budget
|
|
91
|
+
* expires. A wait with no publication at all keeps the waiter's
|
|
92
|
+
* "timed-out", and a lifecycle release stays "released".
|
|
93
|
+
*/
|
|
94
|
+
async function waitForConfirmedPush(
|
|
95
|
+
options: FileDiagnosticCollectionOptions,
|
|
96
|
+
control?: CodeRequestControl,
|
|
97
|
+
): Promise<DiagnosticPushWaitOutcome> {
|
|
98
|
+
// A tentative publication may already sit in the cache when the wait
|
|
99
|
+
// starts (ADR 0021). Do not grant repeated callers a new full wait window:
|
|
100
|
+
// bound them by the first operation window or the cached publication age.
|
|
101
|
+
const initialPushReceivedAt = options.currentPushReceivedAt();
|
|
102
|
+
const waitDeadline = Math.min(
|
|
103
|
+
options.syncStart + options.maxWaitMs,
|
|
104
|
+
initialPushReceivedAt === undefined
|
|
105
|
+
? Number.POSITIVE_INFINITY
|
|
106
|
+
: initialPushReceivedAt + options.maxWaitMs,
|
|
107
|
+
);
|
|
108
|
+
let observedPublication = initialPushReceivedAt !== undefined;
|
|
109
|
+
for (;;) {
|
|
110
|
+
throwIfCodeRequestInterrupted(control);
|
|
111
|
+
// A republish can arrive after the previous wait released but before the
|
|
112
|
+
// next waiter registers; re-check the store on every loop pass.
|
|
113
|
+
if (options.freshPush()) return "published";
|
|
114
|
+
const push = await options.waiters.waitForPush(
|
|
115
|
+
options.request.uri,
|
|
116
|
+
Math.max(0, waitDeadline - Date.now()),
|
|
117
|
+
control,
|
|
118
|
+
);
|
|
119
|
+
// A lifecycle release ends the wait definitively: a tentative
|
|
120
|
+
// publication observed earlier must not reclassify the release.
|
|
121
|
+
if (push === "released") return "released";
|
|
122
|
+
// A promotion can land while the timed-out waiter tears down; the cache
|
|
123
|
+
// must complete the wait before the timeout classifies the outcome.
|
|
124
|
+
if (options.freshPush()) return "published";
|
|
125
|
+
if (push === "timed-out") {
|
|
126
|
+
return observedPublication || options.currentPushReceivedAt() !== undefined
|
|
127
|
+
? "tentative"
|
|
128
|
+
: "timed-out";
|
|
129
|
+
}
|
|
130
|
+
observedPublication = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
77
134
|
async function collectPullEvidence(
|
|
78
135
|
options: FileDiagnosticCollectionOptions,
|
|
79
136
|
control?: CodeRequestControl,
|
|
@@ -163,6 +163,25 @@ export interface DiagnosticCacheEntry {
|
|
|
163
163
|
evidenceRevision?: number;
|
|
164
164
|
version?: number;
|
|
165
165
|
resultId?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Valid publications observed for the entry's synchronization. The first
|
|
168
|
+
* valid publication for a synchronization is tentative; a later valid
|
|
169
|
+
* publication promotes the entry to confirmed (ADR 0021). A confirmed
|
|
170
|
+
* pull entry counts as the first publication when a push continues the
|
|
171
|
+
* same synchronization, so that push keeps the confirmation. Pull
|
|
172
|
+
* entries as such carry no count and are confirmed on arrival.
|
|
173
|
+
*/
|
|
174
|
+
publications?: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Test whether one push entry is still tentative for its synchronization.
|
|
179
|
+
*
|
|
180
|
+
* A pull entry confirms on arrival; a push entry confirms only after a
|
|
181
|
+
* later valid publication for the same synchronization (ADR 0021).
|
|
182
|
+
*/
|
|
183
|
+
export function isTentativePushEntry(entry: DiagnosticCacheEntry | undefined): boolean {
|
|
184
|
+
return Boolean(entry && entry.source === "push" && (entry.publications ?? 1) < 2);
|
|
166
185
|
}
|
|
167
186
|
|
|
168
187
|
/** One document synchronization that needs current diagnostic evidence. */
|
|
@@ -204,6 +223,7 @@ export function hasFreshPush(
|
|
|
204
223
|
const entry = store.get(synchronization.uri);
|
|
205
224
|
return Boolean(
|
|
206
225
|
entry?.source === "push" &&
|
|
226
|
+
!isTentativePushEntry(entry) &&
|
|
207
227
|
entry.synchronizationId === synchronization.synchronizationId &&
|
|
208
228
|
(synchronization.evidenceRevision === undefined ||
|
|
209
229
|
entry.evidenceRevision === synchronization.evidenceRevision) &&
|
|
@@ -211,8 +231,11 @@ export function hasFreshPush(
|
|
|
211
231
|
);
|
|
212
232
|
}
|
|
213
233
|
|
|
214
|
-
/**
|
|
215
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Test whether stored evidence matches a synchronization without a
|
|
236
|
+
* confirmation gate. A tentative push matches here but cannot confirm.
|
|
237
|
+
*/
|
|
238
|
+
export function hasCurrentEvidence(
|
|
216
239
|
store: ReadonlyMap<string, DiagnosticCacheEntry>,
|
|
217
240
|
synchronization: DiagnosticSynchronization,
|
|
218
241
|
currentEvidenceRevision?: number,
|
|
@@ -227,8 +250,26 @@ export function hasFreshEvidence(
|
|
|
227
250
|
);
|
|
228
251
|
}
|
|
229
252
|
|
|
230
|
-
/**
|
|
231
|
-
export function
|
|
253
|
+
/** Test whether pull or push evidence confirms the supplied synchronization. */
|
|
254
|
+
export function hasFreshEvidence(
|
|
255
|
+
store: ReadonlyMap<string, DiagnosticCacheEntry>,
|
|
256
|
+
synchronization: DiagnosticSynchronization,
|
|
257
|
+
currentEvidenceRevision?: number,
|
|
258
|
+
): boolean {
|
|
259
|
+
return (
|
|
260
|
+
hasCurrentEvidence(store, synchronization, currentEvidenceRevision) &&
|
|
261
|
+
!isTentativePushEntry(store.get(synchronization.uri))
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Return the latest cache update that matches one of the synchronizations.
|
|
267
|
+
*
|
|
268
|
+
* Every accepted publication restarts the settle quiet period, tentative
|
|
269
|
+
* publications included, so this helper does not apply the confirmation
|
|
270
|
+
* gate (ADR 0021).
|
|
271
|
+
*/
|
|
272
|
+
export function latestCurrentEvidenceReceivedAt(
|
|
232
273
|
store: ReadonlyMap<string, DiagnosticCacheEntry>,
|
|
233
274
|
synchronizations: DiagnosticSynchronization[],
|
|
234
275
|
currentEvidenceRevision?: number,
|
|
@@ -236,7 +277,7 @@ export function latestFreshEvidenceReceivedAt(
|
|
|
236
277
|
let latest = 0;
|
|
237
278
|
for (const synchronization of synchronizations) {
|
|
238
279
|
const entry = store.get(synchronization.uri);
|
|
239
|
-
if (
|
|
280
|
+
if (hasCurrentEvidence(store, synchronization, currentEvidenceRevision)) {
|
|
240
281
|
latest = Math.max(latest, entry?.receivedAt ?? 0);
|
|
241
282
|
}
|
|
242
283
|
}
|
|
@@ -9,6 +9,7 @@ export interface ClientDiagnosticsHost {
|
|
|
9
9
|
cwd?: string;
|
|
10
10
|
isOperational(): boolean;
|
|
11
11
|
supportsPullDiagnostics(): boolean;
|
|
12
|
+
usesIncrementalDocumentSync(): boolean;
|
|
12
13
|
sendNotification(method: string, params: unknown): void;
|
|
13
14
|
pullDocumentDiagnostics(request: DiagnosticPullRequest): Promise<DocumentDiagnosticReport | null>;
|
|
14
15
|
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Bounded push-publication telemetry for one client's diagnostic state.
|
|
2
|
+
//
|
|
3
|
+
// Push-only servers can publish an early result and a later semantic result
|
|
4
|
+
// for one document synchronization (ADR 0021). This tracker records one
|
|
5
|
+
// bounded per-synchronization publication summary per diagnostic operation
|
|
6
|
+
// and one ambient event when a later publication promotes a synchronization
|
|
7
|
+
// that an earlier operation already reported unconfirmed. Events carry only
|
|
8
|
+
// bounded server, workspace, relative-file, synchronization identity, count,
|
|
9
|
+
// and timing data. They never carry diagnostic payloads or source text.
|
|
10
|
+
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import { recordDebugEvent } from "@mrclrchtr/supi-core/debug";
|
|
13
|
+
import { boundCwd, truncateIdentity } from "../debug-telemetry.ts";
|
|
14
|
+
import { uriToFile } from "../utils.ts";
|
|
15
|
+
|
|
16
|
+
/** Maximum tracked synchronizations before the oldest entry is evicted. */
|
|
17
|
+
export const MAX_TRACKED_SYNCHRONIZATIONS = 64;
|
|
18
|
+
|
|
19
|
+
/** Maximum synchronization entries in one bounded publication summary. */
|
|
20
|
+
export const MAX_SUMMARY_SYNCHRONIZATIONS = 16;
|
|
21
|
+
|
|
22
|
+
/** Maximum publication count retained for telemetry; 2 means two or more. */
|
|
23
|
+
const MAX_PUBLICATIONS = 2;
|
|
24
|
+
|
|
25
|
+
/** Bounded identity for one publication telemetry observation. */
|
|
26
|
+
export interface DiagnosticPublicationIdentity {
|
|
27
|
+
/** Configured server name. */
|
|
28
|
+
readonly server?: string;
|
|
29
|
+
/** Absolute workspace root. */
|
|
30
|
+
readonly cwd?: string;
|
|
31
|
+
/** Workspace-relative file path; sync-file operations only. */
|
|
32
|
+
readonly file?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** One awaited synchronization of a completed diagnostic operation. */
|
|
36
|
+
export interface DiagnosticPublicationSynchronization {
|
|
37
|
+
readonly uri: string;
|
|
38
|
+
readonly synchronizationId: number;
|
|
39
|
+
readonly evidenceRevision: number;
|
|
40
|
+
readonly confirmed: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** One bounded per-synchronization publication summary entry. */
|
|
44
|
+
export interface DiagnosticPublicationSummaryEntry {
|
|
45
|
+
readonly synchronizationId: number;
|
|
46
|
+
readonly publications: number;
|
|
47
|
+
readonly firstReceivedAt: number;
|
|
48
|
+
readonly lastReceivedAt: number;
|
|
49
|
+
readonly confirmed: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface SynchronizationPublicationState {
|
|
53
|
+
readonly uri: string;
|
|
54
|
+
readonly synchronizationId: number;
|
|
55
|
+
readonly evidenceRevision: number;
|
|
56
|
+
publications: number;
|
|
57
|
+
firstReceivedAt: number;
|
|
58
|
+
lastReceivedAt: number;
|
|
59
|
+
/** When a finished operation first reported this synchronization unconfirmed. */
|
|
60
|
+
unconfirmedAt?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function synchronizationKey(
|
|
64
|
+
uri: string,
|
|
65
|
+
synchronizationId: number,
|
|
66
|
+
evidenceRevision: number,
|
|
67
|
+
): string {
|
|
68
|
+
return `${uri}|${synchronizationId}|${evidenceRevision}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Track bounded push-publication counts for one LSP client. */
|
|
72
|
+
export class DiagnosticPublicationTracker {
|
|
73
|
+
readonly #states = new Map<string, SynchronizationPublicationState>();
|
|
74
|
+
|
|
75
|
+
constructor(
|
|
76
|
+
private readonly identity: { server?: string; cwd?: string },
|
|
77
|
+
private readonly fileFor: (uri: string) => string | undefined,
|
|
78
|
+
) {}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Record one accepted push publication for a synchronization.
|
|
82
|
+
*
|
|
83
|
+
* The state map is bounded to {@link MAX_TRACKED_SYNCHRONIZATIONS}; the
|
|
84
|
+
* oldest tracked synchronization is evicted when the bound is exceeded.
|
|
85
|
+
*/
|
|
86
|
+
record(
|
|
87
|
+
uri: string,
|
|
88
|
+
synchronizationId: number,
|
|
89
|
+
evidenceRevision: number,
|
|
90
|
+
receivedAt: number = Date.now(),
|
|
91
|
+
): void {
|
|
92
|
+
const key = synchronizationKey(uri, synchronizationId, evidenceRevision);
|
|
93
|
+
const existing = this.#states.get(key);
|
|
94
|
+
if (existing) {
|
|
95
|
+
existing.publications = Math.min(existing.publications + 1, MAX_PUBLICATIONS);
|
|
96
|
+
existing.lastReceivedAt = receivedAt;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.#states.set(key, {
|
|
100
|
+
uri,
|
|
101
|
+
synchronizationId,
|
|
102
|
+
evidenceRevision,
|
|
103
|
+
publications: 1,
|
|
104
|
+
firstReceivedAt: receivedAt,
|
|
105
|
+
lastReceivedAt: receivedAt,
|
|
106
|
+
});
|
|
107
|
+
if (this.#states.size > MAX_TRACKED_SYNCHRONIZATIONS) {
|
|
108
|
+
const oldest = this.#states.keys().next().value;
|
|
109
|
+
if (oldest !== undefined) this.#states.delete(oldest);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Emit one bounded per-synchronization publication summary.
|
|
115
|
+
*
|
|
116
|
+
* Synchronizations with no observed push publication are omitted. A
|
|
117
|
+
* synchronization that ends unconfirmed is marked so a later promotion can
|
|
118
|
+
* emit the ambient late-republish event.
|
|
119
|
+
*/
|
|
120
|
+
emitSummary(options: {
|
|
121
|
+
readonly operation: "refresh-open" | "sync-file";
|
|
122
|
+
readonly identity: DiagnosticPublicationIdentity;
|
|
123
|
+
readonly synchronizations: readonly DiagnosticPublicationSynchronization[];
|
|
124
|
+
readonly operationId?: string;
|
|
125
|
+
}): void {
|
|
126
|
+
const entries: DiagnosticPublicationSummaryEntry[] = [];
|
|
127
|
+
const now = Date.now();
|
|
128
|
+
for (const synchronization of options.synchronizations) {
|
|
129
|
+
const state = this.#states.get(
|
|
130
|
+
synchronizationKey(
|
|
131
|
+
synchronization.uri,
|
|
132
|
+
synchronization.synchronizationId,
|
|
133
|
+
synchronization.evidenceRevision,
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
if (!state) continue;
|
|
137
|
+
entries.push({
|
|
138
|
+
synchronizationId: state.synchronizationId,
|
|
139
|
+
publications: state.publications,
|
|
140
|
+
firstReceivedAt: state.firstReceivedAt,
|
|
141
|
+
lastReceivedAt: state.lastReceivedAt,
|
|
142
|
+
confirmed: synchronization.confirmed,
|
|
143
|
+
});
|
|
144
|
+
if (!synchronization.confirmed) state.unconfirmedAt ??= now;
|
|
145
|
+
else state.unconfirmedAt = undefined;
|
|
146
|
+
}
|
|
147
|
+
if (entries.length === 0) return;
|
|
148
|
+
recordDebugEvent({
|
|
149
|
+
operationId: options.operationId,
|
|
150
|
+
source: "lsp",
|
|
151
|
+
level: "debug",
|
|
152
|
+
category: "diagnostics.publication",
|
|
153
|
+
message: "LSP diagnostic publication summary",
|
|
154
|
+
cwd: boundCwd(options.identity.cwd),
|
|
155
|
+
data: {
|
|
156
|
+
operation: options.operation,
|
|
157
|
+
synchronizations: entries.slice(0, MAX_SUMMARY_SYNCHRONIZATIONS),
|
|
158
|
+
...(options.identity.server !== undefined
|
|
159
|
+
? { server: truncateIdentity(options.identity.server) }
|
|
160
|
+
: {}),
|
|
161
|
+
...(options.identity.file !== undefined
|
|
162
|
+
? { file: truncateIdentity(options.identity.file) }
|
|
163
|
+
: {}),
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Observe one promotion of a synchronization by a later publication.
|
|
170
|
+
*
|
|
171
|
+
* The ambient late-republish event fires only when a finished operation
|
|
172
|
+
* previously reported the synchronization unconfirmed. The mark is cleared
|
|
173
|
+
* so one promotion emits at most one event.
|
|
174
|
+
*/
|
|
175
|
+
promoted(
|
|
176
|
+
uri: string,
|
|
177
|
+
synchronizationId: number,
|
|
178
|
+
evidenceRevision: number,
|
|
179
|
+
receivedAt: number = Date.now(),
|
|
180
|
+
): void {
|
|
181
|
+
const state = this.#states.get(synchronizationKey(uri, synchronizationId, evidenceRevision));
|
|
182
|
+
const unconfirmedAt = state?.unconfirmedAt;
|
|
183
|
+
if (!state || state.publications < 2 || unconfirmedAt === undefined) return;
|
|
184
|
+
state.unconfirmedAt = undefined;
|
|
185
|
+
const file = this.fileFor(uri);
|
|
186
|
+
recordDebugEvent({
|
|
187
|
+
source: "lsp",
|
|
188
|
+
level: "debug",
|
|
189
|
+
category: "diagnostics.publication",
|
|
190
|
+
message: "LSP diagnostic late republish",
|
|
191
|
+
cwd: boundCwd(this.identity.cwd),
|
|
192
|
+
data: {
|
|
193
|
+
synchronizationId,
|
|
194
|
+
publications: state.publications,
|
|
195
|
+
receivedAt,
|
|
196
|
+
delayMs: Math.max(0, receivedAt - unconfirmedAt),
|
|
197
|
+
...(this.identity.server !== undefined
|
|
198
|
+
? { server: truncateIdentity(this.identity.server) }
|
|
199
|
+
: {}),
|
|
200
|
+
...(file !== undefined ? { file: truncateIdentity(file) } : {}),
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** Return a workspace-relative diagnostic file path for telemetry identity. */
|
|
207
|
+
export function trackerFileIdentityFor(
|
|
208
|
+
cwd: string | undefined,
|
|
209
|
+
): (uri: string) => string | undefined {
|
|
210
|
+
return (uri) => {
|
|
211
|
+
if (cwd === undefined) return undefined;
|
|
212
|
+
return path.relative(cwd, path.resolve(cwd, uriToFile(uri)));
|
|
213
|
+
};
|
|
214
|
+
}
|