@mrclrchtr/supi-code-intelligence 9.1.1 → 10.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 (94) hide show
  1. package/README.md +24 -8
  2. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  5. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  6. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  7. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +29 -0
  8. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +25 -22
  9. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  10. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  11. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  12. package/node_modules/ignore/LICENSE-MIT +21 -0
  13. package/node_modules/ignore/README.md +501 -0
  14. package/node_modules/ignore/index.d.ts +81 -0
  15. package/node_modules/ignore/index.js +1566 -0
  16. package/node_modules/ignore/legacy.js +1346 -0
  17. package/node_modules/ignore/package.json +93 -0
  18. package/node_modules/smol-toml/LICENSE +24 -0
  19. package/node_modules/smol-toml/README.md +605 -0
  20. package/node_modules/smol-toml/dist/date.d.ts +41 -0
  21. package/node_modules/smol-toml/dist/date.js +156 -0
  22. package/node_modules/smol-toml/dist/error.d.ts +37 -0
  23. package/node_modules/smol-toml/dist/error.js +67 -0
  24. package/node_modules/smol-toml/dist/extract.js +293 -0
  25. package/node_modules/smol-toml/dist/index.cjs +771 -0
  26. package/node_modules/smol-toml/dist/index.d.ts +44 -0
  27. package/node_modules/smol-toml/dist/index.js +34 -0
  28. package/node_modules/smol-toml/dist/parse.d.ts +73 -0
  29. package/node_modules/smol-toml/dist/parse.js +164 -0
  30. package/node_modules/smol-toml/dist/primitive.js +151 -0
  31. package/node_modules/smol-toml/dist/stringify.d.ts +32 -0
  32. package/node_modules/smol-toml/dist/stringify.js +219 -0
  33. package/node_modules/smol-toml/dist/struct.js +156 -0
  34. package/node_modules/smol-toml/dist/util.d.ts +43 -0
  35. package/node_modules/smol-toml/dist/util.js +57 -0
  36. package/node_modules/smol-toml/package.json +68 -0
  37. package/package.json +9 -5
  38. package/src/analysis/evidence.ts +2 -0
  39. package/src/analysis/target/symbol.ts +19 -8
  40. package/src/analysis/target/types.ts +2 -0
  41. package/src/analysis/workspace/exclusions.ts +35 -0
  42. package/src/analysis/workspace/git.ts +130 -0
  43. package/src/analysis/workspace/go-parser.ts +330 -0
  44. package/src/analysis/workspace/go.ts +154 -0
  45. package/src/analysis/workspace/index.ts +28 -0
  46. package/src/analysis/workspace/inventory.ts +316 -0
  47. package/src/analysis/workspace/membership.ts +223 -0
  48. package/src/analysis/workspace/metadata-types.ts +56 -0
  49. package/src/analysis/workspace/metadata-utils.ts +60 -0
  50. package/src/analysis/workspace/metadata.ts +148 -0
  51. package/src/analysis/workspace/node.ts +214 -0
  52. package/src/analysis/workspace/observe.ts +161 -0
  53. package/src/analysis/workspace/paths.ts +65 -0
  54. package/src/analysis/workspace/python.ts +158 -0
  55. package/src/analysis/workspace/relationships.ts +87 -0
  56. package/src/analysis/workspace/rust.ts +238 -0
  57. package/src/analysis/workspace/safe-path.ts +20 -0
  58. package/src/analysis/workspace/types.ts +245 -0
  59. package/src/app/app.ts +1 -0
  60. package/src/config.ts +4 -4
  61. package/src/extension.ts +16 -49
  62. package/src/overview/budget.ts +23 -0
  63. package/src/overview/collect.ts +22 -0
  64. package/src/session/orientation/workspace-context.ts +166 -0
  65. package/src/session/orientation-types.ts +8 -1
  66. package/src/session/orientation-workflow.ts +16 -3
  67. package/src/session/session.ts +2 -3
  68. package/src/session/target-workflow.ts +2 -0
  69. package/src/tool/code_find/execute.ts +1 -1
  70. package/src/tool/code_find/result.ts +10 -3
  71. package/src/tool/code_graph/result.ts +7 -2
  72. package/src/tool/code_orientation/execute.ts +8 -1
  73. package/src/tool/code_orientation/markdown.ts +58 -8
  74. package/src/tool/code_orientation/result.ts +17 -5
  75. package/src/tool/code_orientation/workspace-format.ts +74 -0
  76. package/src/tool/code_orientation/workspace-instructions.ts +105 -0
  77. package/src/tool/code_orientation/workspace-output.ts +118 -0
  78. package/src/tool/code_orientation/workspace-projects.ts +177 -0
  79. package/src/tool/code_orientation/workspace-sections.ts +217 -0
  80. package/src/tool/code_resolve/execute.ts +1 -1
  81. package/src/tool/code_resolve/markdown.ts +4 -1
  82. package/src/tool/code_resolve/result.ts +14 -2
  83. package/src/tool/register.ts +2 -0
  84. package/src/tool/result/candidate-row.ts +22 -0
  85. package/src/tool/result/display.ts +6 -0
  86. package/src/tool/result/errors.ts +12 -0
  87. package/src/tool/result/types.ts +2 -0
  88. package/src/types/execution.ts +2 -0
  89. package/src/ui/tui/candidate-disclosure.ts +43 -0
  90. package/src/ui/tui/candidate-selection.ts +24 -5
  91. package/src/ui/tui/common.ts +3 -0
  92. package/src/overview/overview-data.ts +0 -154
  93. package/src/overview/overview.ts +0 -91
  94. package/src/overview/types.ts +0 -23
package/README.md CHANGED
@@ -32,11 +32,11 @@ Under Bun, including compiled applications such as Pi-Bolt, structural analysis
32
32
 
33
33
  - **Language Server Protocol (LSP) tools** for types, definitions, references, implementations, diagnostics, workspace symbols, and semantic refactoring.
34
34
  - **Tree-sitter tools** for syntax, declarations, structural search, and calls as written in source code. These calls are not a semantic call graph.
35
- - **Workspace orientation** from files, manifests, and declared package relationships. Directory orientation can also show local instruction files.
35
+ - **Workspace orientation** from included files and explicit project declarations. It works without package metadata. Directory orientation can also show configured instruction files and Mermaid diagrams of declared relationships.
36
36
  - **Visible evidence limits** that distinguish no matches from incomplete or unavailable analysis. Search modes do not silently switch to each other or to text search.
37
- - **An optional first-turn overview** with discovered modules, manifest descriptions, declared entrypoints, dependencies, and detected languages. It is enabled by default and labeled as untrusted repository evidence, not instructions.
37
+ - **An optional first-turn overview** with observed names, paths, file-extension counts, and project declarations. It is enabled by default. Repository descriptions retain their source fields and are untrusted evidence, not instructions.
38
38
 
39
- The overview is a hidden Pi message, not a live architecture graph. It is not repeated when the active session branch already contains it. All discovered modules are included: 1,000 estimated tokens is a warning threshold, not a size cap.
39
+ The overview is a hidden Pi message, not a live architecture graph. It is not repeated when the active session branch already contains it. It works in source-only projects. Names and paths have priority over descriptions. Omitted collected facts remain in a temporary captured-result file.
40
40
 
41
41
  ## Usage
42
42
 
@@ -76,18 +76,34 @@ code_health({ scope: "packages/api/src/index.ts", refresh: true })
76
76
 
77
77
  Important tool rules:
78
78
 
79
- - **Resolve:** new target handles require semantic readiness. A comment or whitespace point is not a symbol; use `code_inspect` there. Handles are session-local and become stale when file contents change. Resolve the symbol again rather than reuse a stale handle.
79
+ - **Resolve:** new target handles require semantic readiness. A comment or whitespace point is not a symbol; use `code_inspect` there. Handles are session-local and become stale when file contents change. Resolve the symbol again rather than reuse a stale handle. Symbol queries put case-sensitive exact-name matches first, before the display cap. Provider order stays unchanged within exact-name and other matches. An incomplete provider result never selects a target automatically.
80
80
  - **Graph:** relations are `references` (default), `callees`, and `implements`. Use `["all"]` for all three. Callee depth is `direct` by default; `deep` includes nested scopes, not transitive calls. Callees match source shape, not symbol identity. Counts include each distinct call site; repeated expressions share one agent-output row with all shown line/column coordinates. Each relation reports its counts and limits once. Provider-limited results have unknown totals; invalid locations are disclosed separately. Callee previews shorten receiver argument lists from syntax without changing grouping by the full expression. Matching previews get local expression numbers so distinct source expressions remain clear. Unavailable references retain the provider reason, including an exhausted enrollment retry. Unavailable callees retain the provider reason and a source-inspection next step. Ambiguous targets ask for candidate selection, not input correction. Candidate limits retain exact totals, or unknown totals when the provider returns partial data. Agent output and both transcript views disclose omissions. Only shown candidates receive target handles. The human transcript shows the resolved target and per-relation evidence types and status. The expanded view groups up to 20 sites per relation by file, without a duplicate Markdown body. If this display limit hides returned sites, the transcript links to a temporary file with all returned evidence. This file does not include evidence beyond `maxResults`, and its path does not add text to an otherwise complete agent result. Merged read ranges use neutral guidance.
81
81
  - **Find:** AST mode requires `kind`: `definition`, `import`, `export`, `call`, `type`, `interface`, `class`, `method`, or `enum`. Semantic mode does not accept `kind`. A supplied `scope` is a non-empty array.
82
82
  - **Health:** `include` accepts `diagnostics` and `servers` (both by default); `level` is `summary` (default) or `detailed`. Server inventory and route counts remain workspace-wide, even with a diagnostic scope. A diagnostic snapshot does not prove that the whole workspace is clean. Tsconfig and jsconfig coverage applies only to TypeScript and JavaScript-family files; other-language files have no `Tsconfig` label.
83
83
 
84
84
  `code_health({ refresh: true })` retries failed startup and exhausted process-crash routes in scope, with at most one attempt per route per call. It collects fresh diagnostic evidence and reports recovery separately from diagnostic confirmation. A broad maintenance attempt can include active tracked files outside a requested directory, but the diagnostic result keeps the requested directory and tracked-file boundary. The report labels maintenance evidence separately from result coverage. A later refresh can retry a failed route. Reports show up to 16 route entries per recovery list and disclose omitted entries. Use an exact file scope when a route reports `use-exact-file`.
85
85
 
86
+ ### Workspace and directory observations
87
+
88
+ Automatic collection stays within the session working directory. Ancestor Git roots and workspace manifests do not expand that boundary. An explicit directory focus can select a different root. Each tool call makes a new observation; its output does not depend on an earlier overview.
89
+
90
+ - Git inventories contain tracked and non-ignored untracked files. Tracked files remain eligible when ignore rules match them. Configured exclusions still apply.
91
+ - Without Git, collection uses accessible files and configured exclusions. Directory names do not determine project roles or generated-file status.
92
+ - Symbolic links are recorded, not followed. An explicit ignored or excluded directory can be observed separately. This does not change automatic inclusion elsewhere.
93
+ - Metadata readers cover Node `package.json` and workspace declarations, Python `[project]` in `pyproject.toml`, Rust `Cargo.toml`, and Go `go.mod` / `go.work`. They do not run build tools or project code.
94
+ - Unsupported, dynamic, inherited, malformed, and unresolved declarations are disclosed. Go replacement directives and unsupported quoted-string escapes are not interpreted. Native project kinds remain separate; nearby Python or Rust projects do not become Node workspace members.
95
+ - Directory diagrams retain separate dependency categories and declared values. Unique declared-name matches do not prove installed dependency resolution or runtime architecture.
96
+ - The inventory retains at most 10,000 entries. An explicit in-root directory is collected before unrelated paths use that budget. External directory focus uses its own observation. Metadata files have a 1 MiB read limit. The first-turn collector has a 10-second deadline; tool calls use their request control. Results disclose incomplete collection.
97
+
98
+ Estimated tokens are `ceil(characters / 4)`. The overview warns above 1,000 and has a 2,000-token hard cap. Workspace and directory navigation warn above 2,000 and have a 4,000-token hard cap. Warnings go to UI and debug only. `maxResults` can reduce a list, but cannot bypass the total cap.
99
+
100
+ Captured-result files contain the complete collected observation, not just the selected rows. Reading them does not refresh facts or establish that every possible fact was collected. Instruction snippets have a separate budget and still respect Pi's final output safety limit. Unread instruction text is identified and is not recorded as supplied. File- and symbol-focused navigation retain their existing output.
101
+
86
102
  ### Transcript failures
87
103
 
88
104
  All Code Intelligence tools show PI execution failures with the tool name and the available reason. Structured failure text takes priority; a failure without details uses PI's plain error text. The transcript removes terminal controls and keeps up to 4096 characters. Collapsed output keeps two wrapped rows; expanded output keeps 20. A notice discloses further display limits. These limits do not change agent output or saved results.
89
105
 
90
- Candidate selection for Graph, Resolve, and Orientation uses one structured transcript view. The collapsed view shows `Choose a target` and one count summary. The expanded view shows one candidate section and selection guidance; it does not repeat raw Markdown when candidate rows are available. Older results use structured evidence when available. When candidate rows are unavailable, or structured reason or guidance is missing, the renderer uses a bounded raw detail view with up to 4096 source characters and 40 wrapped body rows. It shows a truncation notice and keeps any existing full-output link.
106
+ Candidate selection for Graph, Resolve, and Orientation uses one structured transcript view. The collapsed view shows `Choose a target` and one count summary. Incomplete symbol-query results retain the provider reason and distinguish collected candidates from display omissions in agent output and both transcript views. The transcript removes terminal controls from this disclosure and limits it to 4096 source characters and 3 collapsed or 10 expanded body rows, plus a notice when text is hidden. These display limits do not change agent output or saved details. The expanded view shows one candidate section and selection guidance; it does not repeat raw Markdown when candidate rows are available. Older results use structured evidence when available. When candidate rows are unavailable, or structured reason or guidance is missing, the renderer uses a bounded raw detail view with up to 4096 source characters and 40 wrapped body rows. It shows a truncation notice and keeps any existing full-output link.
91
107
 
92
108
  ### Refactor checks
93
109
 
@@ -151,7 +167,7 @@ Project values override global values, which override defaults. Project configur
151
167
  |---|---|---|
152
168
  | `code-intelligence.overviewEnabled` | `true` | Add the hidden overview; the choice is fixed for the session |
153
169
  | `code-intelligence.instructionFileNames` | `["CLAUDE.md", "AGENTS.md"]` | Ordered plain filenames for directory instruction discovery |
154
- | `code-intelligence.exclude` | `[]` | Gitignore-style patterns for automatic LSP and broad AST work, not exact requests |
170
+ | `code-intelligence.exclude` | `[]` | Gitignore-style patterns for automatic workspace navigation, LSP work, and broad AST searches; not an access control |
155
171
  | `lsp.servers.<language>.enabled` | Enabled unless `false` | Disable a language server |
156
172
 
157
173
  Example `.pi/supi/config.json`:
@@ -171,7 +187,7 @@ Example `.pi/supi/config.json`:
171
187
  }
172
188
  ```
173
189
 
174
- Use `typescript`, `python`, `rust`, `go`, `c`, `ruby`, `java`, `kotlin`, `bash`, `html`, `sql`, `r`, or `latex` for built-in server keys (`cpp` aliases `c`). Server command and routing overrides are defined in the [LSP configuration reference](../supi-lsp/README.md#custom-server-configuration). `.pi-lsp.json` is not read. Only the boolean `true` enables the overview; non-boolean values do not enable it. The shared exclusion list uses gitignore syntax and project-over-global replacement. An explicit project `[]` clears configured patterns. `/supi-settings` shows the config path and says to reload or restart Pi after saving. Saved exclusions apply after reload or restart; exact file and explicitly selected directory requests remain available. An old `lsp.exclude` value reports a migration error and is not used.
190
+ Use `typescript`, `python`, `rust`, `go`, `c`, `ruby`, `java`, `kotlin`, `bash`, `html`, `sql`, `r`, or `latex` for built-in server keys (`cpp` aliases `c`). Server command and routing overrides are defined in the [LSP configuration reference](../supi-lsp/README.md#custom-server-configuration). `.pi-lsp.json` is not read. Only the boolean `true` enables the overview; non-boolean values do not enable it. The shared exclusion list uses gitignore syntax and project-over-global replacement. An explicit project `[]` clears configured patterns. `/supi-settings` shows the config path and says to reload or restart Pi after saving. LSP and AST work use saved exclusions after reload or restart. New workspace observations read the current exclusions. Exact file and explicitly selected directory requests remain available. An old `lsp.exclude` value reports a migration error and is not used.
175
191
 
176
192
  Directory orientation checks the path from the workspace root to the focused directory. It selects the first valid configured instruction file per directory, skips files already loaded by Pi or shown on the active branch, and shows at most 200 lines per file. Resolved instruction paths must stay inside the workspace. These snippets are tool output, not additions to Pi's system prompt.
177
193
 
@@ -179,7 +195,7 @@ Directory orientation checks the path from the workspace root to the focused dir
179
195
 
180
196
  Pi extensions run with your system permissions; this package is not a sandbox. Language servers run as local processes and receive source files. Review server commands and project configuration before trusting a project. `code-intelligence.exclude` and AST scan exclusions are not access controls.
181
197
 
182
- Tool results and the hidden overview enter Pi's model context and can be saved in session history. They can contain source text, paths, manifest data, diagnostics, and instruction-file contents. Truncated tool results and graph display overflow also leave full returned text in local temporary files. These files are not durable session storage and can be removed by system cleanup. “Hidden” means not displayed in the transcript, not hidden from the model.
198
+ Tool results and the hidden overview enter Pi's model context and can be saved in session history. They can contain source text, paths, manifest data, diagnostics, and instruction-file contents. Truncated tool results, orientation captures, and graph display overflow also leave collected text in local temporary files. These files are not durable session storage and can be removed by system cleanup. “Hidden” means not displayed in the transcript, not hidden from the model.
183
199
 
184
200
  ## Public entrypoints
185
201
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-lsp",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Language Server Protocol runtime for SuPi code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -37,8 +37,8 @@
37
37
  "vscode-jsonrpc": "^9.0.0",
38
38
  "vscode-languageserver-protocol": "^3.18.0",
39
39
  "vscode-languageserver-types": "^3.18.0",
40
- "@mrclrchtr/supi-code-runtime": "9.1.1",
41
- "@mrclrchtr/supi-core": "9.1.1"
40
+ "@mrclrchtr/supi-code-runtime": "10.0.0",
41
+ "@mrclrchtr/supi-core": "10.0.0"
42
42
  },
43
43
  "bundledDependencies": [
44
44
  "@mrclrchtr/supi-code-runtime",
@@ -1,3 +1,4 @@
1
+ import { statSync } from "node:fs";
1
2
  import * as path from "node:path";
2
3
  import {
3
4
  type CodeQueryResult,
@@ -6,6 +7,7 @@ import {
6
7
  partialCodeQuery,
7
8
  unavailableCodeQuery,
8
9
  } from "@mrclrchtr/supi-code-runtime/api";
10
+ import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
9
11
  import type { LspClient } from "../client/client.ts";
10
12
  import type {
11
13
  DocumentSymbol,
@@ -34,6 +36,8 @@ export interface WorkspaceSymbolWarmOptions {
34
36
  maxMarkerDepth?: number;
35
37
  /** Runtime-owned automatic path policy. */
36
38
  policy?: AutomaticLspPathPolicy;
39
+ /** Absolute request scopes. Search only their intersection with the route root. */
40
+ scopes?: readonly string[];
37
41
  }
38
42
 
39
43
  export function getWorkspaceSymbolWarmPosition(
@@ -144,6 +148,31 @@ export function findWorkspaceSymbolWarmTargets(
144
148
  const policy = options.policy ?? createDefaultAutomaticLspPathPolicy(resolvedRoot);
145
149
  if (allowed.size === 0) return [];
146
150
 
151
+ if (options.scopes?.length) {
152
+ const targets = options.scopes.flatMap((scope) => {
153
+ const searchRoot = isWithinOrEqual(resolvedRoot, scope)
154
+ ? scope
155
+ : isWithinOrEqual(scope, resolvedRoot)
156
+ ? resolvedRoot
157
+ : null;
158
+ return searchRoot
159
+ ? findWorkspaceSymbolWarmTargets(searchRoot, rootMarkers, fileTypes, {
160
+ ...options,
161
+ policy,
162
+ scopes: undefined,
163
+ })
164
+ : [];
165
+ });
166
+ return [...new Map(targets.map((target) => [target.file, target])).values()];
167
+ }
168
+
169
+ if (statSync(resolvedRoot, { throwIfNoEntry: false })?.isFile()) {
170
+ return allowed.has(path.extname(resolvedRoot).slice(1).toLowerCase()) &&
171
+ policy.isEligible(resolvedRoot, "file")
172
+ ? [{ projectRoot: path.dirname(resolvedRoot), file: resolvedRoot }]
173
+ : [];
174
+ }
175
+
147
176
  const markerRoots = collectMarkerRoots(resolvedRoot, rootMarkers, maxMarkerDepth, policy);
148
177
  const targets = markerRoots
149
178
  .map((entry) => {
@@ -334,8 +334,8 @@ export class LspManager {
334
334
  private invalidationEpoch = 0;
335
335
  /** Invalidation generation in which each route last received a recovery restart. */
336
336
  private recoveryRestartEpochs = new Map<string, number>();
337
- /** Project roots already warmed for workspace-symbol queries. */
338
- private warmedWorkspaceSymbolProjects = new Set<string>();
337
+ /** Files already probed for workspace-symbol warm-up. */
338
+ private warmedWorkspaceSymbolFiles = new Set<string>();
339
339
  /** Project roots whose semantic state was warmed with a readiness probe. */
340
340
  private warmedSemanticProjects = new Set<string>();
341
341
  /** In-flight warm-up probes keyed by project key so concurrent callers share one probe. */
@@ -527,7 +527,7 @@ export class LspManager {
527
527
  root,
528
528
  failureMessage: "The LSP client is not running.",
529
529
  });
530
- this.clearWarmedWorkspaceSymbolProjects(existing.name, existing.root);
530
+ this.clearWarmedWorkspaceSymbolFiles(existing.name, existing.root);
531
531
  this.clearWarmedSemanticProjects(existing.name, existing.root);
532
532
  this.clearPendingWarmProbes(existing.name, existing.root);
533
533
  if (!retryFailedStart) return null;
@@ -1246,7 +1246,7 @@ export class LspManager {
1246
1246
  ): LspClient {
1247
1247
  const key = route.key;
1248
1248
  if (this.clients.get(key) === recovery.failedClient) this.clients.delete(key);
1249
- this.clearWarmedWorkspaceSymbolProjects(route.serverName, route.root);
1249
+ this.clearWarmedWorkspaceSymbolFiles(route.serverName, route.root);
1250
1250
  this.clearWarmedSemanticProjects(route.serverName, route.root);
1251
1251
  this.clearPendingWarmProbes(route.serverName, route.root);
1252
1252
 
@@ -1402,7 +1402,7 @@ export class LspManager {
1402
1402
 
1403
1403
  // Spawn new client
1404
1404
  const client = this.createClient(serverName, serverConfig, root, key);
1405
- this.clearWarmedWorkspaceSymbolProjects(serverName, root);
1405
+ this.clearWarmedWorkspaceSymbolFiles(serverName, root);
1406
1406
  this.clearWarmedSemanticProjects(serverName, root);
1407
1407
  this.clearPendingWarmProbes(serverName, root);
1408
1408
  this.clients.set(key, client);
@@ -1532,7 +1532,7 @@ export class LspManager {
1532
1532
  if (this.clients.get(key) !== client) return { files, restarted: false };
1533
1533
  this.clients.delete(key);
1534
1534
  this.unavailable.delete(key);
1535
- this.clearWarmedWorkspaceSymbolProjects(client.name, client.root);
1535
+ this.clearWarmedWorkspaceSymbolFiles(client.name, client.root);
1536
1536
  this.clearWarmedSemanticProjects(client.name, client.root);
1537
1537
  this.clearPendingWarmProbes(client.name, client.root);
1538
1538
 
@@ -2307,7 +2307,7 @@ export class LspManager {
2307
2307
  this.recoveryRestartEpochs.clear();
2308
2308
  this.unavailable.clear();
2309
2309
  this.knownRoots.clear();
2310
- this.warmedWorkspaceSymbolProjects.clear();
2310
+ this.warmedWorkspaceSymbolFiles.clear();
2311
2311
  this.warmedSemanticProjects.clear();
2312
2312
  this.pendingWarmProbes.clear();
2313
2313
  this.pendingRestarts.clear();
@@ -2671,6 +2671,7 @@ export class LspManager {
2671
2671
  findWarmTargets: (root, rootMarkers, fileTypes) =>
2672
2672
  findWorkspaceSymbolWarmTargets(root, rootMarkers, fileTypes, {
2673
2673
  policy: this.automaticPathPolicy,
2674
+ scopes: resolvedScopes,
2674
2675
  }),
2675
2676
  getWarmPosition: getWorkspaceSymbolWarmPosition,
2676
2677
  collect,
@@ -2696,22 +2697,21 @@ export class LspManager {
2696
2697
  collection: WorkspaceSymbolCollection,
2697
2698
  scopes: readonly string[] | undefined,
2698
2699
  ): WorkspaceSymbolCollection {
2699
- const excludedExamples: string[] = [];
2700
+ const excludedExamples = new Set(collection.excludedExamples ?? []);
2700
2701
  let excludedCount = 0;
2701
2702
  const results = collection.results.filter((result) => {
2702
2703
  const file = uriToFile(result.location.uri);
2703
2704
  if (this.isWorkspaceSymbolResultAllowed(file, scopes)) return true;
2704
2705
  excludedCount++;
2705
- if (excludedExamples.length < 5) {
2706
- excludedExamples.push(displayRelativeFilePath(file, this.cwd));
2707
- }
2706
+ const example = displayRelativeFilePath(file, this.cwd);
2707
+ if (excludedExamples.size < 5) excludedExamples.add(example);
2708
2708
  return false;
2709
2709
  });
2710
2710
  return {
2711
2711
  ...collection,
2712
2712
  results,
2713
2713
  excludedCount: (collection.excludedCount ?? 0) + excludedCount,
2714
- excludedExamples: [...(collection.excludedExamples ?? []), ...excludedExamples].slice(0, 5),
2714
+ excludedExamples: [...excludedExamples].slice(0, 5),
2715
2715
  };
2716
2716
  }
2717
2717
 
@@ -2803,6 +2803,7 @@ export class LspManager {
2803
2803
  }): Promise<{ warmedAny: boolean; collection: WorkspaceSymbolCollection | null }> {
2804
2804
  const { findWarmTargets, getWarmPosition, collect, routeMatches, query, control } = options;
2805
2805
  let warmedAny = false;
2806
+ let latestCollection: WorkspaceSymbolCollection | null = null;
2806
2807
 
2807
2808
  for (const client of Array.from(this.clients.values())) {
2808
2809
  if (routeMatches && !routeMatches(client)) continue;
@@ -2819,8 +2820,9 @@ export class LspManager {
2819
2820
  ).slice(0, 24);
2820
2821
 
2821
2822
  for (const target of warmTargets) {
2822
- const projectKey = this.workspaceSymbolProjectKey(client.name, target.projectRoot);
2823
- if (this.warmedWorkspaceSymbolProjects.has(projectKey)) continue;
2823
+ // A file probe does not load every program under the route root.
2824
+ const fileKey = `${client.name}:${path.resolve(target.file)}`;
2825
+ if (this.warmedWorkspaceSymbolFiles.has(fileKey)) continue;
2824
2826
 
2825
2827
  const openedClient = await this.ensureFileOpen(target.file);
2826
2828
  if (!openedClient) continue;
@@ -2834,18 +2836,19 @@ export class LspManager {
2834
2836
  control,
2835
2837
  );
2836
2838
  if (available) {
2837
- this.warmedWorkspaceSymbolProjects.add(projectKey);
2839
+ this.warmedWorkspaceSymbolFiles.add(fileKey);
2838
2840
  warmedAny = true;
2839
2841
  }
2840
2842
 
2841
- const collected = await collect(this.clients.values(), query);
2842
- if (collected.hasSupport && collected.results.length > 0) {
2843
- return { warmedAny, collection: collected };
2843
+ latestCollection = await collect(this.clients.values(), query);
2844
+ if (latestCollection.hasSupport && latestCollection.results.length > 0) {
2845
+ return { warmedAny, collection: latestCollection };
2844
2846
  }
2845
2847
  }
2846
2848
  }
2847
2849
 
2848
- return { warmedAny, collection: null };
2850
+ // A completed-empty retry replaces an earlier failure too.
2851
+ return { warmedAny, collection: latestCollection };
2849
2852
  }
2850
2853
 
2851
2854
  private async warmSemanticProject(
@@ -2936,11 +2939,11 @@ export class LspManager {
2936
2939
  return `${serverName}:${path.resolve(projectRoot)}`;
2937
2940
  }
2938
2941
 
2939
- private clearWarmedWorkspaceSymbolProjects(serverName: string, root: string): void {
2942
+ private clearWarmedWorkspaceSymbolFiles(serverName: string, root: string): void {
2940
2943
  const prefix = `${serverName}:${path.resolve(root)}`;
2941
- for (const key of Array.from(this.warmedWorkspaceSymbolProjects)) {
2944
+ for (const key of Array.from(this.warmedWorkspaceSymbolFiles)) {
2942
2945
  if (key === prefix || key.startsWith(`${prefix}${path.sep}`)) {
2943
- this.warmedWorkspaceSymbolProjects.delete(key);
2946
+ this.warmedWorkspaceSymbolFiles.delete(key);
2944
2947
  }
2945
2948
  }
2946
2949
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-code-runtime",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared workspace context and capability contracts for code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Shared settings, configuration, reporting, and session infrastructure",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-tree-sitter",
3
- "version": "9.1.1",
3
+ "version": "10.0.0",
4
4
  "description": "Structural AST analysis for SuPi code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,8 +36,8 @@
36
36
  "dependencies": {
37
37
  "jiti": "^2.7.0",
38
38
  "web-tree-sitter": "^0.27.0",
39
- "@mrclrchtr/supi-code-runtime": "9.1.1",
40
- "@mrclrchtr/supi-core": "9.1.1"
39
+ "@mrclrchtr/supi-code-runtime": "10.0.0",
40
+ "@mrclrchtr/supi-core": "10.0.0"
41
41
  },
42
42
  "bundledDependencies": [
43
43
  "@mrclrchtr/supi-code-runtime",
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2013 Kael Zhang <i@kael.me>, contributors
2
+ http://kael.me/
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.