@mrclrchtr/supi-code-intelligence 4.10.0 → 6.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/README.md +4 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
- package/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
- 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/config/config.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -6
- package/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +111 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -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-code-runtime/src/api.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -6
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +7 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +22 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +245 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +78 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +171 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +413 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +15 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-pull.ts +62 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +690 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +97 -16
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-waiters.ts +206 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +448 -298
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +70 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +231 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +25 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +529 -119
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +161 -33
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +12 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +5 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/defaults.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +176 -24
- package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +45 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +46 -10
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +79 -9
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +17 -7
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +350 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +5 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +586 -96
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +130 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +45 -329
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +57 -120
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +207 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/readiness.ts +72 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +151 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +92 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +165 -118
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +49 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +102 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +17 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +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-code-runtime/src/api.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/README.md +258 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/dist/babel.cjs +257 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/dist/jiti.cjs +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.cjs +30 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.mjs +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/types.d.ts +420 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/package.json +146 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +0 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +0 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +16 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +65 -87
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +47 -95
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-timing.ts +147 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client-lifecycle.ts +39 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +561 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-message-size.ts +24 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +452 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +4 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +12 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +4 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/imports.ts +4 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +5 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +33 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/blocking-test-bootstrap.mjs +34 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/bootstrap.mjs +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store-helpers.ts +23 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store.ts +400 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/request-control.ts +48 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime-parser-helpers.ts +24 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime-query-helpers.ts +43 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +421 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +116 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +201 -0
- package/package.json +5 -5
- package/src/analysis/health/diagnostics.ts +221 -77
- package/src/analysis/health/file-scope.ts +184 -0
- package/src/analysis/health/recovery.ts +14 -3
- package/src/analysis/provider.ts +58 -0
- package/src/analysis/readiness.ts +34 -9
- package/src/analysis/refactor/apply.ts +45 -1
- package/src/analysis/refactor/mutation-authority.ts +143 -0
- package/src/analysis/relations/callees.ts +9 -1
- package/src/analysis/relations/types.ts +5 -2
- package/src/analysis/search/ast-scan-timing.ts +9 -2
- package/src/analysis/search/ast-scan.ts +5 -2
- package/src/analysis/search/deadline.ts +2 -2
- package/src/analysis/search/pattern-analysis.ts +54 -33
- package/src/analysis/search/pattern.ts +18 -3
- package/src/analysis/target/anchored.ts +20 -11
- package/src/analysis/target/file.ts +18 -11
- package/src/analysis/target/identity.ts +19 -3
- package/src/analysis/target/symbol.ts +36 -15
- package/src/api.ts +4 -0
- package/src/config.ts +35 -1
- package/src/diagnostics/evidence.ts +51 -0
- package/src/extension.ts +57 -14
- package/src/overview/overview-data.ts +9 -2
- package/src/overview/overview.ts +49 -30
- package/src/overview/types.ts +2 -0
- package/src/session/capability-adapter.ts +12 -3
- package/src/session/find-types.ts +2 -2
- package/src/session/find-workflow.ts +20 -9
- package/src/session/graph/collect.ts +18 -2
- package/src/session/graph-workflow.ts +19 -12
- package/src/session/health-refresh.ts +175 -0
- package/src/session/health-types.ts +43 -15
- package/src/session/health-workflow.ts +69 -54
- package/src/session/input/workflows.ts +2 -2
- package/src/session/inspect/collect.ts +20 -3
- package/src/session/inspect-workflow.ts +12 -6
- package/src/session/orientation/collect.ts +12 -3
- package/src/session/orientation/context-facts.ts +3 -1
- package/src/session/orientation/context-sections.ts +20 -7
- package/src/session/orientation/gather.ts +17 -11
- package/src/session/orientation-types.ts +4 -1
- package/src/session/orientation-workflow.ts +23 -10
- package/src/session/refactor-plans.ts +2 -0
- package/src/session/refactor-workflow.ts +61 -15
- package/src/session/session.ts +29 -2
- package/src/session/target-workflow.ts +54 -23
- package/src/session/workflow-control.ts +7 -3
- package/src/substrate/lsp/lifecycle.ts +26 -46
- package/src/substrate/lsp/maintenance.ts +284 -28
- package/src/substrate/lsp/recovery.ts +11 -5
- package/src/substrate/lsp/state.ts +2 -2
- package/src/substrate/workspace-provider-host.ts +25 -3
- package/src/tool/{find → code_find}/execute.ts +2 -16
- package/src/tool/code_find/guidance.ts +8 -0
- package/src/tool/{find → code_find}/render.ts +21 -4
- package/src/tool/{result/find.ts → code_find/result.ts} +78 -9
- package/src/tool/code_find/spec.ts +37 -0
- package/src/tool/code_find/tui.ts +41 -0
- package/src/tool/code_graph/execute.ts +24 -0
- package/src/tool/code_graph/guidance.ts +6 -0
- package/src/tool/{graph → code_graph}/markdown.ts +1 -1
- package/src/tool/{result/graph.ts → code_graph/result.ts} +111 -3
- package/src/tool/code_graph/spec.ts +39 -0
- package/src/tool/code_graph/tui.ts +117 -0
- package/src/tool/{health → code_health}/execute.ts +2 -13
- package/src/tool/code_health/guidance.ts +8 -0
- package/src/tool/{health → code_health}/markdown.ts +119 -27
- package/src/tool/code_health/refresh-status.ts +105 -0
- package/src/tool/{result/health.ts → code_health/result.ts} +80 -3
- package/src/tool/code_health/spec.ts +41 -0
- package/src/tool/{health → code_health}/tui.ts +95 -98
- package/src/tool/{inspect → code_inspect}/execute.ts +2 -16
- package/src/tool/code_inspect/guidance.ts +6 -0
- package/src/tool/{inspect → code_inspect}/markdown.ts +1 -1
- package/src/tool/{result/inspect.ts → code_inspect/result.ts} +143 -2
- package/src/tool/code_inspect/spec.ts +25 -0
- package/src/tool/code_inspect/tui.ts +44 -0
- package/src/tool/code_orientation/execute.ts +25 -0
- package/src/tool/code_orientation/guidance.ts +9 -0
- package/src/tool/{orientation → code_orientation}/markdown.ts +1 -1
- package/src/tool/code_orientation/result.ts +248 -0
- package/src/tool/code_orientation/spec.ts +25 -0
- package/src/tool/{orientation → code_orientation}/tui.ts +51 -35
- package/src/tool/code_refactor_apply/execute.ts +17 -0
- package/src/tool/code_refactor_apply/guidance.ts +5 -0
- package/src/tool/{refactor-apply/execute.ts → code_refactor_apply/result.ts} +8 -11
- package/src/tool/code_refactor_apply/spec.ts +26 -0
- package/src/tool/code_refactor_apply/tui.ts +73 -0
- package/src/tool/code_refactor_plan/execute.ts +27 -0
- package/src/tool/code_refactor_plan/guidance.ts +8 -0
- package/src/tool/{refactor-plan/execute.ts → code_refactor_plan/result.ts} +13 -22
- package/src/tool/code_refactor_plan/spec.ts +25 -0
- package/src/tool/code_refactor_plan/tui.ts +54 -0
- package/src/tool/code_resolve/execute.ts +19 -0
- package/src/tool/code_resolve/guidance.ts +8 -0
- package/src/tool/{resolve → code_resolve}/markdown.ts +1 -1
- package/src/tool/{result/resolve.ts → code_resolve/result.ts} +79 -29
- package/src/tool/code_resolve/spec.ts +25 -0
- package/src/tool/code_resolve/tui.ts +60 -0
- package/src/tool/guidance.ts +71 -52
- package/src/tool/infra/truncate.ts +40 -0
- package/src/tool/infra/workflow-control.ts +8 -0
- package/src/tool/{refactor-plan/markdown.ts → refactor-markdown.ts} +4 -7
- package/src/tool/register.ts +105 -88
- package/src/tool/result/display.ts +107 -0
- package/src/tool/result/errors.ts +20 -17
- package/src/tool/result/refactor.ts +37 -8
- package/src/tool/result/types.ts +20 -0
- package/src/tool/schemas.ts +26 -157
- package/src/tool/specs.ts +40 -126
- package/src/types/execution.ts +18 -5
- package/src/types/index.ts +8 -1
- package/src/ui/status-command.ts +5 -3
- package/src/ui/status-overlay.ts +4 -0
- package/src/ui/tui/common.ts +108 -10
- package/src/ui/tui/display.ts +48 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime.ts +0 -351
- package/src/tool/find/tui.ts +0 -39
- package/src/tool/graph/execute.ts +0 -62
- package/src/tool/graph/tui.ts +0 -104
- package/src/tool/inspect/tui.ts +0 -36
- package/src/tool/orientation/execute.ts +0 -62
- package/src/tool/refactor-apply/tui.ts +0 -55
- package/src/tool/refactor-plan/tui.ts +0 -41
- package/src/tool/resolve/execute.ts +0 -36
- package/src/tool/resolve/tui.ts +0 -42
- package/src/tool/result/orientation.ts +0 -132
- /package/src/tool/{find → code_find}/ast-kinds.ts +0 -0
- /package/src/tool/{find → code_find}/markdown.ts +0 -0
- /package/src/tool/{find → code_find}/modes.ts +0 -0
- /package/src/tool/{health → code_health}/semantic-state.ts +0 -0
|
@@ -1,21 +1,35 @@
|
|
|
1
|
+
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
1
2
|
import { startDebugTimer } from "@mrclrchtr/supi-core/debug";
|
|
3
|
+
import { boundCwd, truncateIdentity } from "../debug-telemetry.ts";
|
|
2
4
|
|
|
3
|
-
type DiagnosticCollection = "fallback" | "none" | "pull" | "push";
|
|
5
|
+
type DiagnosticCollection = "cache" | "fallback" | "none" | "pull" | "push";
|
|
4
6
|
type DiagnosticFreshness = "not-observed" | "observed";
|
|
5
|
-
type DiagnosticOutcome = "completed" | "skipped" | "timed-out";
|
|
7
|
+
type DiagnosticOutcome = "completed" | "incomplete" | "skipped" | "timed-out";
|
|
6
8
|
type DiagnosticPullOutcome = "completed" | "failed" | "not-supported" | "not-used" | "timed-out";
|
|
7
|
-
type DiagnosticPushOutcome =
|
|
8
|
-
|
|
9
|
+
type DiagnosticPushOutcome =
|
|
10
|
+
| "not-used"
|
|
11
|
+
| "published"
|
|
12
|
+
| "tentative"
|
|
13
|
+
| "released"
|
|
14
|
+
| "settled"
|
|
15
|
+
| "timed-out";
|
|
16
|
+
type DiagnosticSettleOutcome =
|
|
17
|
+
| "not-used"
|
|
18
|
+
| "published"
|
|
19
|
+
| "tentative"
|
|
20
|
+
| "quiet"
|
|
21
|
+
| "released"
|
|
22
|
+
| "timed-out";
|
|
9
23
|
type DiagnosticTimingOperation = "refresh-open" | "sync-file";
|
|
10
24
|
|
|
11
25
|
/** Result of waiting for a quiet push-diagnostic window. */
|
|
12
26
|
export interface DiagnosticSettleResult {
|
|
13
|
-
readonly outcome: "quiet" | "timed-out";
|
|
27
|
+
readonly outcome: "quiet" | "released" | "timed-out";
|
|
14
28
|
readonly freshness: DiagnosticFreshness;
|
|
15
29
|
}
|
|
16
30
|
|
|
17
31
|
/** Result of waiting for one file's push diagnostics. */
|
|
18
|
-
export type DiagnosticPushWaitOutcome = "published" | "released" | "timed-out";
|
|
32
|
+
export type DiagnosticPushWaitOutcome = "published" | "tentative" | "released" | "timed-out";
|
|
19
33
|
|
|
20
34
|
interface DiagnosticTimingData {
|
|
21
35
|
readonly collection: DiagnosticCollection;
|
|
@@ -25,30 +39,47 @@ interface DiagnosticTimingData {
|
|
|
25
39
|
readonly outcome: DiagnosticOutcome;
|
|
26
40
|
readonly pull: DiagnosticPullOutcome;
|
|
27
41
|
readonly push: DiagnosticPushOutcome;
|
|
42
|
+
readonly reopen: number;
|
|
28
43
|
readonly settle: DiagnosticSettleOutcome;
|
|
29
44
|
readonly timedOut: boolean;
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
/** Internal pull failure that retains
|
|
47
|
+
/** Internal pull failure that retains timeout state and failed document URIs. */
|
|
33
48
|
export class DiagnosticPullError extends Error {
|
|
34
|
-
constructor(
|
|
49
|
+
constructor(
|
|
50
|
+
readonly timedOut: boolean,
|
|
51
|
+
readonly failedUris: readonly string[] = [],
|
|
52
|
+
) {
|
|
35
53
|
super("pull diagnostics incomplete");
|
|
36
54
|
}
|
|
37
55
|
}
|
|
38
56
|
|
|
57
|
+
/** Bounded identity for one diagnostic timing observation. */
|
|
58
|
+
export interface DiagnosticTimingIdentity {
|
|
59
|
+
/** Configured server name. */
|
|
60
|
+
readonly server?: string;
|
|
61
|
+
/** Absolute workspace root. */
|
|
62
|
+
readonly cwd?: string;
|
|
63
|
+
/** Workspace-relative file path; sync-file operations only. */
|
|
64
|
+
readonly file?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
39
67
|
/**
|
|
40
|
-
* Record one diagnostic operation without
|
|
68
|
+
* Record one diagnostic operation without diagnostic text or document content.
|
|
41
69
|
*
|
|
42
70
|
* The observer owns result classification so diagnostic control flow does not
|
|
43
|
-
* duplicate the event shape.
|
|
71
|
+
* duplicate the event shape. Identity is bounded and workspace-relative.
|
|
44
72
|
*/
|
|
45
73
|
export class DiagnosticObserver {
|
|
46
74
|
readonly #timer = startDebugTimer();
|
|
47
75
|
#pull: "failed" | "not-supported" | "timed-out";
|
|
76
|
+
#reopened = 0;
|
|
48
77
|
|
|
49
78
|
constructor(
|
|
50
79
|
readonly operation: DiagnosticTimingOperation,
|
|
51
80
|
readonly supportsPull: boolean,
|
|
81
|
+
readonly control?: CodeRequestControl,
|
|
82
|
+
readonly identity?: DiagnosticTimingIdentity,
|
|
52
83
|
) {
|
|
53
84
|
this.#pull = supportsPull ? "failed" : "not-supported";
|
|
54
85
|
}
|
|
@@ -66,6 +97,22 @@ export class DiagnosticObserver {
|
|
|
66
97
|
outcome: "skipped",
|
|
67
98
|
pull: "not-used",
|
|
68
99
|
push: "not-used",
|
|
100
|
+
reopen: 0,
|
|
101
|
+
settle: "not-used",
|
|
102
|
+
timedOut: false,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
cacheReused(documentCount: number): void {
|
|
107
|
+
this.#finish({
|
|
108
|
+
collection: "cache",
|
|
109
|
+
documentCount,
|
|
110
|
+
fallback: false,
|
|
111
|
+
freshness: "observed",
|
|
112
|
+
outcome: "completed",
|
|
113
|
+
pull: "not-used",
|
|
114
|
+
push: "not-used",
|
|
115
|
+
reopen: 0,
|
|
69
116
|
settle: "not-used",
|
|
70
117
|
timedOut: false,
|
|
71
118
|
});
|
|
@@ -81,6 +128,7 @@ export class DiagnosticObserver {
|
|
|
81
128
|
outcome: "completed",
|
|
82
129
|
pull: "completed",
|
|
83
130
|
push: "not-used",
|
|
131
|
+
reopen: 0,
|
|
84
132
|
settle: "not-used",
|
|
85
133
|
timedOut: false,
|
|
86
134
|
},
|
|
@@ -98,17 +146,30 @@ export class DiagnosticObserver {
|
|
|
98
146
|
this.#timer.mark("pull");
|
|
99
147
|
}
|
|
100
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Record that the reopen-resync fallback re-opened unconfirmed documents.
|
|
151
|
+
*
|
|
152
|
+
* The mark fires when the second settle window starts, so the measured
|
|
153
|
+
* phase is the preceding first settle window, not the reopen work.
|
|
154
|
+
*/
|
|
155
|
+
reopened(count: number): void {
|
|
156
|
+
this.#reopened += count;
|
|
157
|
+
this.#timer.mark("first-settle");
|
|
158
|
+
}
|
|
159
|
+
|
|
101
160
|
pushSettled(documentCount: number, settle: DiagnosticSettleResult): void {
|
|
102
161
|
const timedOut = settle.outcome === "timed-out";
|
|
162
|
+
const completed = settle.outcome === "quiet" && settle.freshness === "observed";
|
|
103
163
|
this.#finish(
|
|
104
164
|
{
|
|
105
165
|
collection: this.supportsPull ? "fallback" : "push",
|
|
106
166
|
documentCount,
|
|
107
167
|
fallback: this.supportsPull,
|
|
108
168
|
freshness: settle.freshness,
|
|
109
|
-
outcome: timedOut ? "timed-out" : "
|
|
169
|
+
outcome: completed ? "completed" : timedOut ? "timed-out" : "incomplete",
|
|
110
170
|
pull: this.#pull,
|
|
111
|
-
push: timedOut ? "timed-out" : "settled",
|
|
171
|
+
push: timedOut ? "timed-out" : settle.outcome === "released" ? "released" : "settled",
|
|
172
|
+
reopen: this.#reopened,
|
|
112
173
|
settle: settle.outcome,
|
|
113
174
|
timedOut: timedOut || this.#pull === "timed-out",
|
|
114
175
|
},
|
|
@@ -117,16 +178,21 @@ export class DiagnosticObserver {
|
|
|
117
178
|
}
|
|
118
179
|
|
|
119
180
|
pushWaitCompleted(documentCount: number, push: DiagnosticPushWaitOutcome): void {
|
|
120
|
-
const
|
|
181
|
+
const confirmed = push === "published";
|
|
182
|
+
// A tentative result used the full wait budget without a confirming
|
|
183
|
+
// republish. Keep its distinct push value and report the budget expiry.
|
|
184
|
+
const timedOut = push === "tentative" || push === "timed-out";
|
|
185
|
+
const observed = push === "published" || push === "tentative";
|
|
121
186
|
this.#finish(
|
|
122
187
|
{
|
|
123
188
|
collection: this.supportsPull ? "fallback" : "push",
|
|
124
189
|
documentCount,
|
|
125
190
|
fallback: this.supportsPull,
|
|
126
|
-
freshness:
|
|
127
|
-
outcome: timedOut ? "timed-out" : "
|
|
191
|
+
freshness: observed ? "observed" : "not-observed",
|
|
192
|
+
outcome: confirmed ? "completed" : timedOut ? "timed-out" : "incomplete",
|
|
128
193
|
pull: this.#pull,
|
|
129
194
|
push,
|
|
195
|
+
reopen: this.#reopened,
|
|
130
196
|
settle: push,
|
|
131
197
|
timedOut: timedOut || this.#pull === "timed-out",
|
|
132
198
|
},
|
|
@@ -135,13 +201,28 @@ export class DiagnosticObserver {
|
|
|
135
201
|
}
|
|
136
202
|
|
|
137
203
|
#finish(data: DiagnosticTimingData, finalPhase?: "pull" | "push-settle" | "synchronize"): void {
|
|
204
|
+
const { reopen, ...observation } = data;
|
|
138
205
|
this.#timer.finish(
|
|
139
206
|
() => ({
|
|
207
|
+
operationId: this.control?.operationId,
|
|
140
208
|
source: "lsp",
|
|
141
209
|
level: "debug",
|
|
142
210
|
category: "diagnostics.timing",
|
|
143
211
|
message: `LSP diagnostic ${this.operation} ${data.outcome}`,
|
|
144
|
-
|
|
212
|
+
cwd: boundCwd(this.identity?.cwd),
|
|
213
|
+
data: {
|
|
214
|
+
operation: this.operation,
|
|
215
|
+
...observation,
|
|
216
|
+
// Reopen fallback usage is recorded only when it happened; the
|
|
217
|
+
// default event shape stays stable for consumers of #322 telemetry.
|
|
218
|
+
...(reopen > 0 ? { reopen } : {}),
|
|
219
|
+
...(this.identity?.server !== undefined
|
|
220
|
+
? { server: truncateIdentity(this.identity.server) }
|
|
221
|
+
: {}),
|
|
222
|
+
...(this.identity?.file !== undefined
|
|
223
|
+
? { file: truncateIdentity(this.identity.file) }
|
|
224
|
+
: {}),
|
|
225
|
+
},
|
|
145
226
|
}),
|
|
146
227
|
finalPhase,
|
|
147
228
|
);
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CodeRequestControl,
|
|
3
|
+
CodeRequestDeadlineError,
|
|
4
|
+
throwIfCodeRequestInterrupted,
|
|
5
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
6
|
+
import type {
|
|
7
|
+
DiagnosticPushWaitOutcome,
|
|
8
|
+
DiagnosticSettleResult,
|
|
9
|
+
} from "./client-diagnostic-timing.ts";
|
|
10
|
+
|
|
11
|
+
type DiagnosticWaiter = (outcome: "published" | "released") => void;
|
|
12
|
+
|
|
13
|
+
/** One cancellable wait for diagnostic state change. */
|
|
14
|
+
export interface DiagnosticStateWait {
|
|
15
|
+
readonly promise: Promise<void>;
|
|
16
|
+
cancel(): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface DiagnosticSettleOptions {
|
|
20
|
+
readonly syncStart: number;
|
|
21
|
+
readonly maxWaitMs: number;
|
|
22
|
+
readonly quietMs: number;
|
|
23
|
+
readonly settleEpoch: number;
|
|
24
|
+
readonly isComplete: () => boolean;
|
|
25
|
+
readonly latestReceived: () => number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Own diagnostic waiters and their timers for one LSP client. */
|
|
29
|
+
export class DiagnosticWaitRegistry {
|
|
30
|
+
readonly #pushWaiters = new Map<string, DiagnosticWaiter[]>();
|
|
31
|
+
readonly #stateWaiters = new Set<() => void>();
|
|
32
|
+
readonly #settleWaiters = new Set<() => void>();
|
|
33
|
+
#settleEpoch = 0;
|
|
34
|
+
|
|
35
|
+
get settleEpoch(): number {
|
|
36
|
+
return this.#settleEpoch;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Wait for a diagnostic publication or a lifecycle release for one URI. */
|
|
40
|
+
waitForPush(
|
|
41
|
+
uri: string,
|
|
42
|
+
timeoutMs: number,
|
|
43
|
+
control?: CodeRequestControl,
|
|
44
|
+
): Promise<DiagnosticPushWaitOutcome> {
|
|
45
|
+
const deadlineRemaining =
|
|
46
|
+
control?.deadline === undefined ? undefined : control.deadline - Date.now();
|
|
47
|
+
const bindMs =
|
|
48
|
+
deadlineRemaining === undefined ? timeoutMs : Math.min(timeoutMs, deadlineRemaining);
|
|
49
|
+
if (control?.signal?.aborted) {
|
|
50
|
+
return Promise.reject(control.signal.reason ?? new Error("Diagnostic push wait cancelled"));
|
|
51
|
+
}
|
|
52
|
+
if (bindMs <= 0) {
|
|
53
|
+
if (deadlineRemaining !== undefined && deadlineRemaining < timeoutMs) {
|
|
54
|
+
return Promise.reject(new CodeRequestDeadlineError());
|
|
55
|
+
}
|
|
56
|
+
return Promise.resolve("timed-out");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return new Promise<DiagnosticPushWaitOutcome>((resolve, reject) => {
|
|
60
|
+
const cleanup = () => {
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
if (abortHandler) control?.signal?.removeEventListener("abort", abortHandler);
|
|
63
|
+
};
|
|
64
|
+
const waiter: DiagnosticWaiter = (outcome) => {
|
|
65
|
+
cleanup();
|
|
66
|
+
this.#removePushWaiter(uri, waiter);
|
|
67
|
+
resolve(outcome);
|
|
68
|
+
};
|
|
69
|
+
const timer = setTimeout(() => {
|
|
70
|
+
this.#removePushWaiter(uri, waiter);
|
|
71
|
+
cleanup();
|
|
72
|
+
if (deadlineRemaining !== undefined && deadlineRemaining < timeoutMs) {
|
|
73
|
+
reject(new CodeRequestDeadlineError());
|
|
74
|
+
} else {
|
|
75
|
+
resolve("timed-out");
|
|
76
|
+
}
|
|
77
|
+
}, bindMs);
|
|
78
|
+
let abortHandler: (() => void) | undefined;
|
|
79
|
+
abortHandler = () => {
|
|
80
|
+
cleanup();
|
|
81
|
+
this.#removePushWaiter(uri, waiter);
|
|
82
|
+
reject(control?.signal?.reason ?? new Error("Diagnostic push wait cancelled"));
|
|
83
|
+
};
|
|
84
|
+
if (control?.signal?.aborted) abortHandler();
|
|
85
|
+
else control?.signal?.addEventListener("abort", abortHandler, { once: true });
|
|
86
|
+
const waiters = this.#pushWaiters.get(uri) ?? [];
|
|
87
|
+
waiters.push(waiter);
|
|
88
|
+
this.#pushWaiters.set(uri, waiters);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Wait until any diagnostic or lifecycle state changes. */
|
|
93
|
+
waitForChange(): DiagnosticStateWait {
|
|
94
|
+
let finish = () => {};
|
|
95
|
+
const promise = new Promise<void>((resolve) => {
|
|
96
|
+
finish = () => {
|
|
97
|
+
this.#stateWaiters.delete(finish);
|
|
98
|
+
resolve();
|
|
99
|
+
};
|
|
100
|
+
this.#stateWaiters.add(finish);
|
|
101
|
+
});
|
|
102
|
+
return { promise, cancel: finish };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Release pending push waiters for one URI. */
|
|
106
|
+
releaseFile(uri: string, outcome: "published" | "released" = "released"): void {
|
|
107
|
+
const waiters = this.#pushWaiters.get(uri);
|
|
108
|
+
if (waiters) {
|
|
109
|
+
this.#pushWaiters.delete(uri);
|
|
110
|
+
for (const waiter of waiters) waiter(outcome);
|
|
111
|
+
}
|
|
112
|
+
this.#notifyStateWaiters();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Release all pending push waiters. */
|
|
116
|
+
releaseAll(): void {
|
|
117
|
+
for (const uri of Array.from(this.#pushWaiters.keys())) this.releaseFile(uri);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Cancel the active settle generation and release its timers. */
|
|
121
|
+
cancelSettle(): void {
|
|
122
|
+
this.#settleEpoch++;
|
|
123
|
+
this.notifySettle();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Notify settle operations that diagnostic state changed. */
|
|
127
|
+
notifySettle(): void {
|
|
128
|
+
for (const release of Array.from(this.#settleWaiters)) release();
|
|
129
|
+
this.#notifyStateWaiters();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Wait for fresh diagnostic state to become quiet or reach its deadline. */
|
|
133
|
+
async waitForSettle(
|
|
134
|
+
options: DiagnosticSettleOptions,
|
|
135
|
+
control?: CodeRequestControl,
|
|
136
|
+
): Promise<DiagnosticSettleResult> {
|
|
137
|
+
const { syncStart, maxWaitMs, quietMs, settleEpoch, isComplete, latestReceived } = options;
|
|
138
|
+
const deadlineRemaining =
|
|
139
|
+
control?.deadline === undefined ? undefined : control.deadline - Date.now();
|
|
140
|
+
const deadline =
|
|
141
|
+
deadlineRemaining === undefined
|
|
142
|
+
? syncStart + maxWaitMs
|
|
143
|
+
: Math.min(syncStart + maxWaitMs, control?.deadline ?? syncStart + maxWaitMs);
|
|
144
|
+
while (Date.now() < deadline) {
|
|
145
|
+
throwIfCodeRequestInterrupted(control);
|
|
146
|
+
if (this.#settleEpoch !== settleEpoch) {
|
|
147
|
+
return { outcome: "released", freshness: "not-observed" };
|
|
148
|
+
}
|
|
149
|
+
const observedAt = latestReceived();
|
|
150
|
+
const elapsed = Date.now() - observedAt;
|
|
151
|
+
const complete = isComplete();
|
|
152
|
+
if (observedAt > 0 && complete && elapsed >= quietMs) {
|
|
153
|
+
return { outcome: "quiet", freshness: "observed" };
|
|
154
|
+
}
|
|
155
|
+
const waitMs =
|
|
156
|
+
observedAt > 0 && complete
|
|
157
|
+
? Math.min(quietMs - elapsed, deadline - Date.now())
|
|
158
|
+
: deadline - Date.now();
|
|
159
|
+
await this.#waitForStateChange(waitMs, control);
|
|
160
|
+
}
|
|
161
|
+
// A bound absolute deadline makes the settle outcome a deadline
|
|
162
|
+
// interruption instead of an ordinary relative timeout.
|
|
163
|
+
throwIfCodeRequestInterrupted(control);
|
|
164
|
+
return {
|
|
165
|
+
outcome: "timed-out",
|
|
166
|
+
freshness: latestReceived() > 0 ? "observed" : "not-observed",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Wait until diagnostic state changes or the timeout expires. */
|
|
171
|
+
#waitForStateChange(timeoutMs: number, control?: CodeRequestControl): Promise<void> {
|
|
172
|
+
if (timeoutMs <= 0) return Promise.resolve();
|
|
173
|
+
if (control?.signal?.aborted) {
|
|
174
|
+
return Promise.reject(control.signal.reason ?? new Error("Settle wait cancelled"));
|
|
175
|
+
}
|
|
176
|
+
return new Promise((resolve, reject) => {
|
|
177
|
+
let abortHandler: (() => void) | undefined;
|
|
178
|
+
const finish = () => {
|
|
179
|
+
clearTimeout(timer);
|
|
180
|
+
if (abortHandler) control?.signal?.removeEventListener("abort", abortHandler);
|
|
181
|
+
this.#settleWaiters.delete(finish);
|
|
182
|
+
resolve();
|
|
183
|
+
};
|
|
184
|
+
const timer = setTimeout(finish, timeoutMs);
|
|
185
|
+
abortHandler = () => {
|
|
186
|
+
clearTimeout(timer);
|
|
187
|
+
this.#settleWaiters.delete(finish);
|
|
188
|
+
reject(control?.signal?.reason ?? new Error("Settle wait cancelled"));
|
|
189
|
+
};
|
|
190
|
+
control?.signal?.addEventListener("abort", abortHandler, { once: true });
|
|
191
|
+
this.#settleWaiters.add(finish);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#notifyStateWaiters(): void {
|
|
196
|
+
for (const release of Array.from(this.#stateWaiters)) release();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
#removePushWaiter(uri: string, waiter: DiagnosticWaiter): void {
|
|
200
|
+
const waiters = this.#pushWaiters.get(uri);
|
|
201
|
+
if (!waiters) return;
|
|
202
|
+
const next = waiters.filter((entry) => entry !== waiter);
|
|
203
|
+
if (next.length > 0) this.#pushWaiters.set(uri, next);
|
|
204
|
+
else this.#pushWaiters.delete(uri);
|
|
205
|
+
}
|
|
206
|
+
}
|