@mrclrchtr/supi-code-intelligence 7.3.1 → 8.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 (74) hide show
  1. package/README.md +6 -6
  2. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
  5. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  6. package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  7. package/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  8. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  9. package/node_modules/@mrclrchtr/supi-lsp/README.md +29 -6
  10. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  11. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -1
  12. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
  13. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  14. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  17. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  18. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +25 -3
  19. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +2 -1
  20. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -2
  21. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +39 -6
  22. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +82 -12
  23. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +28 -5
  24. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +606 -30
  25. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +9 -0
  26. package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +69 -8
  27. package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +196 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +15 -0
  29. package/node_modules/@mrclrchtr/supi-lsp/src/config/types.ts +9 -1
  30. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +31 -2
  32. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +72 -2
  33. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +9 -43
  34. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +102 -50
  35. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +49 -3
  36. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +78 -18
  37. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +46 -2
  38. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +14 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +30 -4
  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/api.ts +1 -1
  42. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +22 -4
  43. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  44. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +110 -0
  45. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +6 -1
  46. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +2 -1
  47. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  48. package/package.json +5 -5
  49. package/src/analysis/capability/capability-warnings.ts +64 -25
  50. package/src/analysis/health/server-status.ts +23 -1
  51. package/src/analysis/health/signals.ts +1 -0
  52. package/src/analysis/search/ast-scan.ts +42 -8
  53. package/src/analysis/search/pattern.ts +4 -0
  54. package/src/config.ts +64 -34
  55. package/src/extension.ts +29 -10
  56. package/src/headless.ts +1 -0
  57. package/src/session/find-types.ts +2 -1
  58. package/src/session/find-workflow.ts +5 -0
  59. package/src/session/health-types.ts +3 -0
  60. package/src/session/health-workflow.ts +10 -1
  61. package/src/session/session.ts +34 -2
  62. package/src/substrate/lsp/lifecycle.ts +2 -0
  63. package/src/substrate/lsp/recovery.ts +3 -3
  64. package/src/substrate/lsp/settings.ts +191 -108
  65. package/src/substrate/workspace-provider-host.ts +50 -12
  66. package/src/tool/code_find/markdown.ts +12 -0
  67. package/src/tool/code_find/render.ts +20 -0
  68. package/src/tool/code_find/result.ts +3 -0
  69. package/src/tool/code_health/markdown.ts +3 -0
  70. package/src/tool/code_health/result.ts +3 -1
  71. package/src/tool/result/types.ts +3 -1
  72. package/src/ui/status-command.ts +54 -6
  73. package/src/ui/status-overlay.ts +5 -0
  74. package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +0 -22
@@ -1,4 +1,5 @@
1
1
  import type { StructuralProvider as StructuralSubstrate } from "@mrclrchtr/supi-code-runtime/api";
2
+ import type { AutomaticLspPathPolicy } from "@mrclrchtr/supi-lsp/api";
2
3
  import type { StructuralSearchOperation } from "@mrclrchtr/supi-tree-sitter/api";
3
4
  import type { CodeFindAstKind } from "../../tool/code_find/ast-kinds.ts";
4
5
  import type { EvidencePartialReason } from "../evidence.ts";
@@ -74,6 +75,8 @@ export interface StructuredPatternSearchOptions {
74
75
  readonly roots: string | readonly string[];
75
76
  readonly cwd: string;
76
77
  readonly structural: StructuralSubstrate;
78
+ /** Snapshot used for configured exclusions below broad AST roots. */
79
+ readonly automaticPathPolicy?: AutomaticLspPathPolicy;
77
80
  readonly control?: StructuredPatternControl;
78
81
  }
79
82
 
@@ -107,6 +110,7 @@ export async function getStructuredPatternMatches(
107
110
  now,
108
111
  schedule: options.control?.schedule,
109
112
  operations: options.control?.operations,
113
+ automaticPathPolicy: options.automaticPathPolicy,
110
114
  });
111
115
  if (enumeration.kind === "invalid-root") {
112
116
  return {
package/src/config.ts CHANGED
@@ -1,8 +1,16 @@
1
1
  // Code Intelligence configuration and settings registration.
2
2
 
3
3
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
- import { loadSupiConfig, loadSupiConfigForScope } from "@mrclrchtr/supi-core/config";
5
- import { defineConfigSettings, registerSettings } from "@mrclrchtr/supi-core/settings";
4
+ import {
5
+ loadAutomaticExclusionPatterns,
6
+ loadSupiConfig,
7
+ loadSupiConfigForScope,
8
+ } from "@mrclrchtr/supi-core/config";
9
+ import {
10
+ defineConfigSettings,
11
+ registerSettings,
12
+ type SettingsModule,
13
+ } from "@mrclrchtr/supi-core/settings";
6
14
 
7
15
  const CODE_INTELLIGENCE_SECTION = "code-intelligence";
8
16
 
@@ -12,17 +20,30 @@ export interface CodeIntelligenceConfig extends Record<string, unknown> {
12
20
  instructionFileNames: string[];
13
21
  /** Inject the hidden first-turn workspace architecture overview when enabled. */
14
22
  overviewEnabled: boolean;
23
+ /** Gitignore-style paths excluded from automatic LSP and broad AST work. */
24
+ exclude: string[];
15
25
  }
16
26
 
17
27
  /** Default code-intelligence configuration. */
18
28
  export const CODE_INTELLIGENCE_DEFAULTS: CodeIntelligenceConfig = {
19
29
  instructionFileNames: ["CLAUDE.md", "AGENTS.md"],
20
30
  overviewEnabled: true,
31
+ exclude: [],
21
32
  };
22
33
 
23
34
  /** Load merged code-intelligence configuration for a workspace. */
24
- export function loadCodeIntelligenceConfig(cwd: string, homeDir?: string): CodeIntelligenceConfig {
25
- return loadSupiConfig(CODE_INTELLIGENCE_SECTION, cwd, CODE_INTELLIGENCE_DEFAULTS, { homeDir });
35
+ export function loadCodeIntelligenceConfig(
36
+ cwd: string,
37
+ homeDir?: string,
38
+ projectTrusted = true,
39
+ ): CodeIntelligenceConfig {
40
+ const loaded = projectTrusted
41
+ ? loadSupiConfig(CODE_INTELLIGENCE_SECTION, cwd, CODE_INTELLIGENCE_DEFAULTS, { homeDir })
42
+ : loadSupiConfigForScope(CODE_INTELLIGENCE_SECTION, cwd, CODE_INTELLIGENCE_DEFAULTS, {
43
+ scope: "global",
44
+ homeDir,
45
+ });
46
+ return loaded;
26
47
  }
27
48
 
28
49
  /**
@@ -41,39 +62,48 @@ export function resolveOverviewEnabled(
41
62
  projectTrusted: boolean,
42
63
  homeDir?: string,
43
64
  ): boolean {
44
- const config = projectTrusted
45
- ? loadCodeIntelligenceConfig(cwd, homeDir)
46
- : loadSupiConfigForScope(CODE_INTELLIGENCE_SECTION, cwd, CODE_INTELLIGENCE_DEFAULTS, {
47
- scope: "global",
48
- homeDir,
49
- });
65
+ const config = loadCodeIntelligenceConfig(cwd, homeDir, projectTrusted);
50
66
  return config.overviewEnabled === true;
51
67
  }
52
68
 
53
69
  /** Register code-intelligence settings with the shared SuPi settings registry. */
54
70
  export function registerCodeIntelligenceSettings(pi: ExtensionAPI, homeDir?: string): void {
55
- registerSettings(
56
- pi,
57
- defineConfigSettings({
58
- id: CODE_INTELLIGENCE_SECTION,
59
- label: "Code Intelligence",
60
- section: CODE_INTELLIGENCE_SECTION,
61
- defaults: CODE_INTELLIGENCE_DEFAULTS,
62
- fields: [
63
- {
64
- kind: "stringList" as const,
65
- key: "instructionFileNames",
66
- label: "Instruction File Names",
67
- description: "Directory-local instruction file names shown by directory orientation",
68
- },
69
- {
70
- kind: "boolean" as const,
71
- key: "overviewEnabled",
72
- label: "Overview Enabled",
73
- description: "Inject the hidden first-turn workspace architecture overview",
74
- },
75
- ],
76
- ...(homeDir ? { homeDir } : {}),
77
- }),
78
- );
71
+ const module = defineConfigSettings({
72
+ id: CODE_INTELLIGENCE_SECTION,
73
+ label: "Code Intelligence",
74
+ section: CODE_INTELLIGENCE_SECTION,
75
+ defaults: CODE_INTELLIGENCE_DEFAULTS,
76
+ fields: [
77
+ {
78
+ kind: "stringList" as const,
79
+ key: "instructionFileNames",
80
+ label: "Instruction File Names",
81
+ description: "Directory-local instruction file names shown by directory orientation",
82
+ },
83
+ {
84
+ kind: "boolean" as const,
85
+ key: "overviewEnabled",
86
+ label: "Overview Enabled",
87
+ description: "Inject the hidden first-turn workspace architecture overview",
88
+ },
89
+ {
90
+ kind: "stringList" as const,
91
+ key: "exclude",
92
+ label: "Automatic Exclusions",
93
+ description:
94
+ "Gitignore-style patterns for automatic LSP and broad AST work. Edit the project or global config, then reload or restart Pi; exact requests stay available.",
95
+ },
96
+ ],
97
+ ...(homeDir ? { homeDir } : {}),
98
+ });
99
+ registerSettings(pi, {
100
+ ...module,
101
+ async read(context: Parameters<SettingsModule["read"]>[0]) {
102
+ loadAutomaticExclusionPatterns(context.cwd, {
103
+ homeDir,
104
+ projectTrusted: context.ctx?.isProjectTrusted() ?? true,
105
+ });
106
+ return module.read(context);
107
+ },
108
+ });
79
109
  }
package/src/extension.ts CHANGED
@@ -57,24 +57,43 @@ export default function codeIntelligenceExtension(
57
57
  const lspState = createLspAdapterState();
58
58
 
59
59
  registerCodeIntelligenceSettings(pi, homeDir);
60
- registerLspSettings(pi);
61
- registerLspSessionLifecycle(pi, lspState, (ctx) => {
62
- const session = app.getSession(ctx.cwd);
63
- if (!session) return;
64
- session.attachLspController(lspState.controller);
65
- session.seedSentinelSnapshot(lspState.sentinelSnapshot);
66
- session.setProjectTrusted(ctx.isProjectTrusted());
67
- session.setHomeDir(homeDir);
68
- });
60
+ registerLspSettings(pi, homeDir);
61
+ registerLspSessionLifecycle(
62
+ pi,
63
+ lspState,
64
+ (ctx) => {
65
+ const session = app.getSession(ctx.cwd);
66
+ if (!session) return;
67
+ session.attachLspController(lspState.controller);
68
+ session.seedSentinelSnapshot(lspState.sentinelSnapshot);
69
+ session.setProjectTrusted(ctx.isProjectTrusted());
70
+ session.setHomeDir(homeDir);
71
+ session.setAutomaticPathPolicy(lspState.providerLease?.automaticPathPolicy ?? null);
72
+ },
73
+ homeDir,
74
+ );
69
75
  registerWorkspaceRecoveryHandler(pi, lspState);
70
76
 
71
77
  registerCodeIntelligenceTools(pi, (cwd) => {
72
78
  const session = getOrCreateSession?.(cwd) ?? app.getSession(cwd) ?? app.createSession(cwd);
79
+ const lease = lspState.providerLease;
80
+ if (lease?.cwd === cwd) {
81
+ session.attachLspController(lspState.controller);
82
+ session.setAutomaticPathPolicy(lease.automaticPathPolicy);
83
+ }
73
84
  session.setHomeDir(homeDir);
74
85
  return session;
75
86
  });
76
87
 
77
- registerCiStatusCommand(pi);
88
+ registerCiStatusCommand(pi, homeDir, {
89
+ get: (cwd) =>
90
+ lspState.providerLease?.cwd === cwd
91
+ ? {
92
+ lspController: lspState.controller,
93
+ automaticPathPolicy: lspState.providerLease.automaticPathPolicy,
94
+ }
95
+ : { lspController: null, automaticPathPolicy: null },
96
+ });
78
97
  const lspFooter = registerLspFooterContribution(pi, lspState);
79
98
 
80
99
  pi.on("session_shutdown", () => {
package/src/headless.ts CHANGED
@@ -29,6 +29,7 @@ export default function headlessInspectionProfile(pi: ExtensionAPI): void {
29
29
  session.attachLspController(lspState.controller);
30
30
  session.seedSentinelSnapshot(lspState.sentinelSnapshot);
31
31
  session.setProjectTrusted(ctx.isProjectTrusted());
32
+ session.setAutomaticPathPolicy(lspState.providerLease?.automaticPathPolicy ?? null);
32
33
  });
33
34
  pi.on("session_shutdown", () => sessions.clear());
34
35
 
@@ -1,4 +1,4 @@
1
- import type { CodeSymbol } from "@mrclrchtr/supi-code-runtime/api";
1
+ import type { CodeQueryPartialMetadata, CodeSymbol } from "@mrclrchtr/supi-code-runtime/api";
2
2
  import type { StructuredPatternResult } from "../analysis/search/pattern.ts";
3
3
  import type { CodeFindAstKind } from "../tool/code_find/ast-kinds.ts";
4
4
  import type { CodeFindMode } from "../tool/code_find/modes.ts";
@@ -23,6 +23,7 @@ export type FindWorkflowData =
23
23
  readonly kind: "semantic";
24
24
  readonly symbols: readonly CodeSymbol[];
25
25
  readonly partialReason: string | null;
26
+ readonly partialMetadata?: CodeQueryPartialMetadata;
26
27
  };
27
28
 
28
29
  export type FindWorkflowOutcome =
@@ -2,6 +2,7 @@
2
2
 
3
3
  import type { CodeSymbol } from "@mrclrchtr/supi-code-runtime/api";
4
4
  import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
5
+ import type { AutomaticLspPathPolicy } from "@mrclrchtr/supi-lsp/api";
5
6
  import { SEMANTIC_READINESS_TIMEOUT_REASON } from "../analysis/readiness.ts";
6
7
  import { resolveScopeSet } from "../analysis/search/paths.ts";
7
8
  import { getStructuredPatternMatches } from "../analysis/search/pattern.ts";
@@ -15,6 +16,8 @@ import { reportProgress, throwIfAborted, type WorkflowControl } from "./workflow
15
16
  export interface FindWorkflowDeps {
16
17
  readonly cwd: string;
17
18
  readonly capability: CapabilityAdapter;
19
+ /** Session-owned automatic path snapshot for broad AST work. */
20
+ readonly automaticPathPolicy?: AutomaticLspPathPolicy;
18
21
  }
19
22
 
20
23
  /** Search one explicit substrate without silently falling back to another mode. */
@@ -99,6 +102,7 @@ async function runSemanticSearch(options: {
99
102
  kind: "semantic",
100
103
  symbols: scopedSymbols,
101
104
  partialReason: result.kind === "partial" ? result.reason : null,
105
+ ...(result.kind === "partial" && result.metadata ? { partialMetadata: result.metadata } : {}),
102
106
  },
103
107
  };
104
108
  }
@@ -126,6 +130,7 @@ async function runAstSearch(options: {
126
130
  roots: scopePaths,
127
131
  cwd: deps.cwd,
128
132
  structural: provider,
133
+ automaticPathPolicy: deps.automaticPathPolicy,
129
134
  control: {
130
135
  operationId: control?.operationId,
131
136
  signal: control?.signal,
@@ -4,6 +4,7 @@ import type {
4
4
  ProcessCrashRecoveryReport,
5
5
  ProjectServerInfo,
6
6
  ProjectServerStatusReason,
7
+ ServerOperationSupportMap,
7
8
  StartupRetryReport,
8
9
  } from "@mrclrchtr/supi-lsp/api";
9
10
  import type { CapabilityWarningReport } from "../analysis/capability/capability-warnings.ts";
@@ -33,6 +34,8 @@ export interface HealthServerInfo {
33
34
  readonly status: ProjectServerInfo["status"];
34
35
  readonly statusReason?: ProjectServerStatusReason;
35
36
  readonly ready: boolean;
37
+ /** Negotiated operation support and SuPi planning limitations. */
38
+ readonly operationSupport?: ServerOperationSupportMap;
36
39
  }
37
40
 
38
41
  /** A single diagnostic message extracted for detailed health output. */
@@ -3,6 +3,7 @@
3
3
  import type { CapabilityState } from "@mrclrchtr/supi-code-runtime/api";
4
4
  import { isCodeRequestInterruption } from "@mrclrchtr/supi-code-runtime/api";
5
5
  import type {
6
+ AutomaticLspPathPolicy,
6
7
  LspRuntimeController,
7
8
  SemanticReadinessResult,
8
9
  WorkspaceDiagnosticReport,
@@ -45,6 +46,10 @@ export interface HealthWorkflowDeps {
45
46
  readonly cwd: string;
46
47
  readonly capability: CapabilityAdapter;
47
48
  readonly lspController: LspRuntimeController | null;
49
+ /** Project trust and global config home for fallback warning reads. */
50
+ readonly projectTrusted?: boolean;
51
+ readonly homeDir?: string;
52
+ readonly automaticPathPolicy?: AutomaticLspPathPolicy;
48
53
  readonly lastRefreshAttempt: HealthRefreshAttempt | null;
49
54
  readonly trackRefreshAttempt: (attempt: HealthRefreshAttempt) => void;
50
55
  /** Typed sentinel, source-baseline, and created-source queue state. */
@@ -227,7 +232,11 @@ function collectCapabilityWarnings(
227
232
  ): HealthData["capabilityWarnings"] {
228
233
  if (!semanticRequested) return undefined;
229
234
  const report = evaluateCapabilityWarnings(
230
- gatherCapabilityWarningInput(deps.cwd, deps.lspController),
235
+ gatherCapabilityWarningInput(deps.cwd, deps.lspController, {
236
+ projectTrusted: deps.projectTrusted,
237
+ homeDir: deps.homeDir,
238
+ automaticPathPolicy: deps.automaticPathPolicy,
239
+ }),
231
240
  );
232
241
  return report.hasWarnings ? report : undefined;
233
242
  }
@@ -19,7 +19,11 @@
19
19
  import { realpathSync } from "node:fs";
20
20
  import * as path from "node:path";
21
21
  import type { SessionEntry } from "@earendil-works/pi-coding-agent";
22
- import type { LspRuntimeController } from "@mrclrchtr/supi-lsp/api";
22
+ import {
23
+ type AutomaticLspPathPolicy,
24
+ createDefaultAutomaticLspPathPolicy,
25
+ type LspRuntimeController,
26
+ } from "@mrclrchtr/supi-lsp/api";
23
27
  import {
24
28
  createLspMaintenanceState,
25
29
  type LspMaintenanceState,
@@ -175,6 +179,9 @@ export class WorkspaceCodeIntelligenceSession {
175
179
  /** Global config home for hermetic config reads; undefined uses os.homedir(). */
176
180
  #homeDir: string | undefined;
177
181
 
182
+ /** One automatic exclusion snapshot shared by this session's broad searches. */
183
+ #automaticPathPolicy: AutomaticLspPathPolicy | null = null;
184
+
178
185
  constructor(cwd: string, capability?: CapabilityAdapter) {
179
186
  this.cwd = cwd;
180
187
  this.#capability = capability ?? new WorkspaceCapabilityAdapter();
@@ -190,6 +197,11 @@ export class WorkspaceCodeIntelligenceSession {
190
197
  this.#homeDir = homeDir;
191
198
  }
192
199
 
200
+ /** Attach the lifecycle-owned automatic exclusion snapshot to this session. */
201
+ setAutomaticPathPolicy(policy: AutomaticLspPathPolicy | null): void {
202
+ this.#automaticPathPolicy = policy;
203
+ }
204
+
193
205
  /** Attach lifecycle-owned LSP state without exposing it to Tool adapters. */
194
206
  attachLspController(controller: LspRuntimeController | null): void {
195
207
  this.#lspController = controller;
@@ -283,6 +295,9 @@ export class WorkspaceCodeIntelligenceSession {
283
295
  cwd: this.cwd,
284
296
  capability: this.#capability,
285
297
  lspController: this.#lspController,
298
+ projectTrusted: this.#projectTrusted,
299
+ homeDir: this.#homeDir,
300
+ automaticPathPolicy: this.#automaticPathPolicy ?? undefined,
286
301
  lastRefreshAttempt: this.#lastHealthRefreshAttempt,
287
302
  trackRefreshAttempt: (attempt) => {
288
303
  this.#lastHealthRefreshAttempt = attempt;
@@ -298,7 +313,23 @@ export class WorkspaceCodeIntelligenceSession {
298
313
 
299
314
  /** Search one explicit structural or semantic substrate. */
300
315
  async find(input: FindWorkflowInput, control?: WorkflowControl): Promise<FindWorkflowOutcome> {
301
- return runFindWorkflow(input, { cwd: this.cwd, capability: this.#capability }, control);
316
+ let automaticPathPolicy: AutomaticLspPathPolicy;
317
+ try {
318
+ automaticPathPolicy = this.#automaticPathPolicy ??= createDefaultAutomaticLspPathPolicy(
319
+ this.cwd,
320
+ { projectTrusted: this.#projectTrusted, homeDir: this.#homeDir },
321
+ );
322
+ } catch (error) {
323
+ return {
324
+ kind: "unavailable",
325
+ reason: error instanceof Error ? error.message : String(error),
326
+ };
327
+ }
328
+ return runFindWorkflow(
329
+ input,
330
+ { cwd: this.cwd, capability: this.#capability, automaticPathPolicy },
331
+ control,
332
+ );
302
333
  }
303
334
 
304
335
  /** Orient around the workspace or one exact focus. */
@@ -438,6 +469,7 @@ export class WorkspaceCodeIntelligenceSession {
438
469
  this.#nativeInstructionPaths.clear();
439
470
  this.#maintenanceState = createLspMaintenanceState();
440
471
  this.#lspController = null;
472
+ this.#automaticPathPolicy = null;
441
473
  this.#projectTrusted = false;
442
474
  }
443
475
  }
@@ -9,6 +9,7 @@ export function registerLspSessionLifecycle(
9
9
  pi: ExtensionAPI,
10
10
  state: LspAdapterState,
11
11
  onStarted?: (ctx: ExtensionContext) => void | Promise<void>,
12
+ homeDir?: string,
12
13
  ): void {
13
14
  let disposeLifecycle: (() => void) | null = null;
14
15
  let subscriptionGeneration = 0;
@@ -49,6 +50,7 @@ export function registerLspSessionLifecycle(
49
50
 
50
51
  const lease = await acquireWorkspaceProviderHost(ctx.cwd, {
51
52
  projectTrusted: ctx.isProjectTrusted(),
53
+ homeDir,
52
54
  });
53
55
  state.providerLease = lease;
54
56
  state.controller = lease.lspController;
@@ -1,8 +1,8 @@
1
1
  // Workspace recovery handler — tool_result event that recovers LSP state after
2
2
  // file-mutating tool calls.
3
3
  //
4
- // Notifies the workspace LSP runtime about file changes so diagnostics stay fresh
5
- // for explicit code_health and semantic tool queries.
4
+ // Notifies the workspace LSP runtime about file writes so document state and
5
+ // diagnostics stay fresh for explicit code_health and semantic tool queries.
6
6
 
7
7
  import * as nodePath from "node:path";
8
8
  import type {
@@ -49,7 +49,7 @@ export function registerWorkspaceRecoveryHandler(pi: ExtensionAPI, state: LspAda
49
49
  invalidateTsconfigCacheForConfigDir(nodePath.dirname(resolved));
50
50
  }
51
51
 
52
- runtime.noteWorkspaceChanges([{ uri: fileToUri(resolved), type: 2 }]);
52
+ runtime.noteWorkspaceWrites([{ uri: fileToUri(resolved), type: 2 }]);
53
53
  }
54
54
  });
55
55
  }