@mrclrchtr/supi-code-intelligence 13.0.0 → 14.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +3 -3
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  5. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  6. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  7. package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  8. package/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  9. package/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  10. package/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  11. package/node_modules/@mrclrchtr/supi-lsp/README.md +6 -2
  12. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  13. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  14. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  20. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  21. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +3 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +14 -1
  24. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-typescript.ts +8 -1
  25. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +4 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +7 -1
  27. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +1 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +24 -8
  29. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +5 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +3 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +64 -0
  32. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +3 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +27 -2
  34. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +16 -112
  35. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +521 -83
  36. package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-collection.ts +163 -0
  37. package/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-row-limit.ts +72 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +11 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +36 -7
  40. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  41. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  42. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  43. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  44. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  45. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  46. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  47. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  48. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  49. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
  50. package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
  51. package/package.json +5 -5
  52. package/src/analysis/health/server-status.ts +32 -9
  53. package/src/analysis/health/signals.ts +1 -0
  54. package/src/analysis/instruction-files.ts +11 -7
  55. package/src/analysis/search/exclusions.ts +18 -4
  56. package/src/analysis/target/file-outline-omissions.ts +17 -2
  57. package/src/analysis/target/symbol-selection.ts +100 -0
  58. package/src/analysis/target/symbol.ts +48 -8
  59. package/src/analysis/target/types.ts +8 -1
  60. package/src/app/app.ts +37 -21
  61. package/src/extension.ts +1 -2
  62. package/src/headless.ts +4 -2
  63. package/src/session/health-types.ts +2 -0
  64. package/src/session/orientation-types.ts +5 -0
  65. package/src/session/orientation-workflow.ts +13 -3
  66. package/src/session/target-workflow.ts +18 -12
  67. package/src/tool/code_find/render.ts +10 -11
  68. package/src/tool/code_find/result.ts +6 -1
  69. package/src/tool/code_graph/structured.ts +3 -0
  70. package/src/tool/code_health/markdown.ts +3 -1
  71. package/src/tool/code_health/structured-schema.ts +1 -0
  72. package/src/tool/code_health/structured.ts +2 -0
  73. package/src/tool/code_orientation/markdown.ts +6 -1
  74. package/src/tool/code_resolve/result.ts +2 -1
  75. package/src/tool/code_resolve/structured.ts +6 -1
  76. package/src/tool/result/candidate-selection.ts +17 -1
  77. package/src/ui/footer.ts +147 -42
  78. package/src/ui/status-overlay.ts +13 -8
@@ -1,28 +1,13 @@
1
1
  import { type Dirent, realpathSync, statSync } from "node:fs";
2
2
  import * as path from "node:path";
3
- import {
4
- type CodeQueryResult,
5
- type CodeRequestControl,
6
- completedCodeQuery,
7
- partialCodeQuery,
8
- unavailableCodeQuery,
9
- } from "@mrclrchtr/supi-code-runtime/api";
10
3
  import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
11
- import type { LspClient } from "../client/client.ts";
12
- import type {
13
- DocumentSymbol,
14
- Position,
15
- SymbolInformation,
16
- WorkspaceSymbol,
17
- } from "../config/types.ts";
4
+ import type { DocumentSymbol, Position, SymbolInformation } from "../config/types.ts";
18
5
  import {
19
6
  type AutomaticLspPathPolicy,
20
7
  createDefaultAutomaticLspPathPolicy,
21
8
  walkAutomaticLspTree,
22
9
  } from "../workspace-path-policy.ts";
23
10
 
24
- type WorkspaceSymbolLike = SymbolInformation | WorkspaceSymbol;
25
-
26
11
  const DEFAULT_WARM_FILE_DEPTH = 4;
27
12
  const DEFAULT_MARKER_SCAN_DEPTH = 6;
28
13
  /** Candidates per marker root; later candidates help only when earlier ones land outside the project. */
@@ -58,109 +43,28 @@ export function getWorkspaceSymbolWarmPosition(
58
43
  return null;
59
44
  }
60
45
 
61
- export interface WorkspaceSymbolCollection {
62
- results: WorkspaceSymbolLike[];
63
- hasSupport: boolean;
64
- completedClientCount: number;
65
- failures: string[];
66
- /** Results removed by the automatic path policy. */
67
- excludedCount?: number;
68
- /** Bounded paths removed by the automatic path policy. */
69
- excludedExamples?: string[];
70
- /** Known coverage limits: the server may not have loaded every project in scope. */
71
- coverageGap?: string;
72
- }
46
+ /** Project roots one all-roots warm-up pass opens for a route. */
47
+ const MAX_WARM_ROOTS = 96;
73
48
 
74
49
  /**
75
- * Mark a collection whose warm-up never reached a configured project.
76
- * The server answered only from inferred projects of the opened probe files,
77
- * so an empty or short result does not prove a symbol is absent.
50
+ * Bound an all-roots warm-up pass. Roots past the limit stay unopened, and the
51
+ * returned gap says so: their symbols may be missing from the result.
78
52
  */
79
- export function workspaceSymbolCoverageGap(
80
- collection: WorkspaceSymbolCollection,
81
- inferredProbeCount: number,
82
- ): WorkspaceSymbolCollection {
83
- const noun = `file${inferredProbeCount === 1 ? "" : "s"}`;
53
+ export function limitWorkspaceSymbolWarmRoots(targets: readonly WorkspaceSymbolWarmTarget[]): {
54
+ targets: WorkspaceSymbolWarmTarget[];
55
+ gap: string | null;
56
+ } {
57
+ const roots = [...new Set(targets.map((target) => target.projectRoot))];
58
+ if (roots.length <= MAX_WARM_ROOTS) return { targets: [...targets], gap: null };
59
+ const kept = new Set(roots.slice(0, MAX_WARM_ROOTS));
84
60
  return {
85
- ...collection,
86
- coverageGap:
87
- `Workspace-symbol coverage is limited: ${inferredProbeCount} opened warm-up ${noun} ` +
88
- "loaded only inferred projects, not a configured project. Open a project source file and retry.",
61
+ targets: targets.filter((target) => kept.has(target.projectRoot)),
62
+ gap:
63
+ `Workspace-symbol coverage is limited: ${roots.length - MAX_WARM_ROOTS} of ${roots.length} ` +
64
+ "project roots were not opened. Pass a narrower scope and retry.",
89
65
  };
90
66
  }
91
67
 
92
- export async function collectWorkspaceSymbols(
93
- clients: Iterable<LspClient>,
94
- query: string,
95
- control?: CodeRequestControl,
96
- ): Promise<WorkspaceSymbolCollection> {
97
- const results: WorkspaceSymbolLike[] = [];
98
- const failures: string[] = [];
99
- let hasSupport = false;
100
- let completedClientCount = 0;
101
-
102
- for (const client of clients) {
103
- if (client.status !== "running") continue;
104
- if (!client.serverCapabilities?.workspaceSymbolProvider) continue;
105
- hasSupport = true;
106
- const result = await client.workspaceSymbol(query, control);
107
- if (result.kind === "unavailable") {
108
- failures.push(result.reason);
109
- continue;
110
- }
111
- completedClientCount++;
112
- results.push(...(result.data ?? []));
113
- if (result.kind === "partial") failures.push(result.reason);
114
- }
115
-
116
- return { results, hasSupport, completedClientCount, failures };
117
- }
118
-
119
- function workspaceSymbolExclusionReason(collection: WorkspaceSymbolCollection): string | null {
120
- const excludedCount = collection.excludedCount ?? 0;
121
- if (excludedCount === 0) return null;
122
- const noun = `workspace-symbol result${excludedCount === 1 ? "" : "s"}`;
123
- // Paths belong to typed metadata so consumers can distinguish observed aliases from navigation.
124
- return `Automatic path policy excluded ${excludedCount} ${noun}.`;
125
- }
126
-
127
- /** Project one multi-client collection into the shared typed query contract. */
128
- export function workspaceSymbolCollectionResult(
129
- collection: WorkspaceSymbolCollection,
130
- ): CodeQueryResult<WorkspaceSymbolLike[]> {
131
- if (!collection.hasSupport) {
132
- return unavailableCodeQuery("No active LSP client supports workspace-symbol requests.");
133
- }
134
- if (collection.completedClientCount === 0) {
135
- return unavailableCodeQuery(
136
- collection.failures.join("; ") || "No workspace-symbol request completed.",
137
- );
138
- }
139
- const exclusion = workspaceSymbolExclusionReason(collection);
140
- if (collection.failures.length > 0 || exclusion || collection.coverageGap) {
141
- const excludedCount = collection.excludedCount ?? 0;
142
- const exclusionOnly = collection.failures.length === 0 && !collection.coverageGap;
143
- const metadata =
144
- excludedCount > 0
145
- ? {
146
- automaticPathExclusion: {
147
- excludedCount,
148
- examples: [...(collection.excludedExamples ?? [])],
149
- },
150
- ...(exclusionOnly ? { exclusionOnly: true } : {}),
151
- }
152
- : undefined;
153
- return partialCodeQuery(
154
- collection.results,
155
- [collection.failures.join("; "), collection.coverageGap, exclusion]
156
- .filter(Boolean)
157
- .join("; "),
158
- metadata,
159
- );
160
- }
161
- return completedCodeQuery(collection.results);
162
- }
163
-
164
68
  /**
165
69
  * Choose files to open so a workspace-symbol server loads the projects under `root`.
166
70
  *