@mrclrchtr/supi-code-intelligence 6.4.0 → 7.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 (129) hide show
  1. package/README.md +164 -82
  2. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  3. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +8 -1
  4. package/node_modules/@mrclrchtr/supi-core/README.md +8 -0
  5. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  6. package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +10 -3
  7. package/node_modules/@mrclrchtr/supi-core/src/index.ts +2 -0
  8. package/node_modules/@mrclrchtr/supi-core/src/llm.ts +141 -16
  9. package/node_modules/@mrclrchtr/supi-lsp/README.md +35 -13
  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/types.ts +8 -1
  12. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +8 -0
  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/footer-registry.ts +10 -3
  15. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +2 -0
  16. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/llm.ts +141 -16
  17. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.js +3 -1
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/legacy.js +3 -1
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/package.json +1 -1
  20. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  21. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +6 -0
  22. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +43 -35
  23. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +83 -17
  24. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +108 -92
  25. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +44 -82
  26. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +3 -4
  27. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +9 -68
  28. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-pull.ts +45 -58
  29. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +230 -331
  30. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +201 -1
  31. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +129 -70
  32. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-typescript.ts +395 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-waiters.ts +8 -12
  34. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +685 -183
  35. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +2 -2
  36. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +60 -60
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-request-enrollment.ts +75 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +443 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-errors.ts +30 -0
  40. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-file.ts +15 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +290 -37
  42. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +72 -16
  43. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +1 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +30 -4
  45. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +1 -1
  46. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +10 -4
  47. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-process-crash-report.ts +50 -1
  48. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +11 -7
  49. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +608 -45
  50. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +3 -1
  51. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +37 -4
  52. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +31 -11
  53. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +19 -3
  54. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  55. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +8 -1
  56. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +8 -0
  57. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  58. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +10 -3
  59. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +2 -0
  60. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/llm.ts +141 -16
  61. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  62. package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +2 -0
  63. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callee-display-name.ts +165 -0
  64. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +67 -9
  65. package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +2 -0
  66. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +19 -18
  67. package/node_modules/yaml/browser/dist/nodes/Alias.js +25 -23
  68. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +19 -18
  69. package/node_modules/yaml/dist/nodes/Alias.js +25 -23
  70. package/node_modules/yaml/package.json +1 -1
  71. package/package.json +5 -5
  72. package/src/analysis/health/diagnostics.ts +1 -2
  73. package/src/analysis/health/file-scope.ts +4 -1
  74. package/src/analysis/health/server-status.ts +1 -1
  75. package/src/analysis/relations/callees.ts +17 -8
  76. package/src/analysis/relations/implementations.ts +1 -2
  77. package/src/analysis/relations/references.ts +8 -4
  78. package/src/analysis/relations/types.ts +6 -30
  79. package/src/analysis/target/anchored.ts +9 -1
  80. package/src/analysis/target/symbol.ts +29 -11
  81. package/src/analysis/target/types.ts +14 -6
  82. package/src/api.ts +2 -0
  83. package/src/session/graph/collect.ts +18 -3
  84. package/src/session/health-refresh.ts +12 -1
  85. package/src/session/health-types.ts +18 -6
  86. package/src/session/health-workflow.ts +21 -19
  87. package/src/session/orientation-types.ts +5 -6
  88. package/src/session/orientation-workflow.ts +10 -2
  89. package/src/session/target-workflow.ts +9 -6
  90. package/src/substrate/lsp/source-tracking.ts +11 -6
  91. package/src/tool/code_find/guidance.ts +2 -2
  92. package/src/tool/code_find/spec.ts +5 -4
  93. package/src/tool/code_find/tui.ts +7 -1
  94. package/src/tool/code_graph/details.ts +32 -0
  95. package/src/tool/code_graph/display.ts +54 -0
  96. package/src/tool/code_graph/format.ts +60 -0
  97. package/src/tool/code_graph/guidance.ts +1 -1
  98. package/src/tool/code_graph/markdown.ts +76 -198
  99. package/src/tool/code_graph/read-next.ts +65 -0
  100. package/src/tool/code_graph/result.ts +118 -83
  101. package/src/tool/code_graph/tui.ts +216 -54
  102. package/src/tool/code_health/guidance.ts +2 -4
  103. package/src/tool/code_health/markdown.ts +75 -58
  104. package/src/tool/code_health/refresh-outcome.ts +41 -1
  105. package/src/tool/code_health/refresh-status.ts +114 -48
  106. package/src/tool/code_health/scope.ts +78 -0
  107. package/src/tool/code_health/spec.ts +1 -1
  108. package/src/tool/code_health/tui.ts +25 -38
  109. package/src/tool/code_inspect/tui.ts +7 -1
  110. package/src/tool/code_orientation/result.ts +31 -8
  111. package/src/tool/code_orientation/tui.ts +26 -5
  112. package/src/tool/code_refactor_apply/guidance.ts +1 -1
  113. package/src/tool/code_refactor_apply/tui.ts +7 -3
  114. package/src/tool/code_refactor_plan/guidance.ts +1 -1
  115. package/src/tool/code_refactor_plan/tui.ts +7 -1
  116. package/src/tool/code_resolve/guidance.ts +2 -4
  117. package/src/tool/code_resolve/result.ts +13 -10
  118. package/src/tool/code_resolve/tui.ts +18 -1
  119. package/src/tool/infra/truncate.ts +39 -13
  120. package/src/tool/result/candidate-row.ts +27 -0
  121. package/src/tool/result/errors.ts +21 -6
  122. package/src/tool/result/types.ts +7 -3
  123. package/src/tool/schemas.ts +5 -0
  124. package/src/types/execution.ts +2 -0
  125. package/src/types/index.ts +2 -0
  126. package/src/ui/tui/candidate-legacy-body.ts +69 -0
  127. package/src/ui/tui/candidate-selection.ts +366 -0
  128. package/src/ui/tui/common.ts +26 -31
  129. package/src/ui/tui/execution-error.ts +92 -0
@@ -10,17 +10,23 @@ import type { Diagnostic } from "../config/types.ts";
10
10
  import { effectiveDiagnosticSeverity } from "../diagnostics/diagnostic-severity.ts";
11
11
  import { relativeFilePathFromUri } from "../diagnostics/diagnostic-summary.ts";
12
12
 
13
+ /** Options for one manager-owned diagnostic request. */
14
+ interface SyncClientFileOptions {
15
+ readonly control?: CodeRequestControl;
16
+ readonly contentIsAuthoritative?: boolean;
17
+ }
18
+
13
19
  /** Sync one file and return diagnostics up to the supplied severity threshold. */
14
20
  export async function syncClientFileAndGetDiagnostics(
15
21
  client: Pick<LspClient, "syncAndWaitForDiagnostics">,
16
22
  filePath: string,
17
23
  maxSeverity: number,
18
- control?: CodeRequestControl,
24
+ options: SyncClientFileOptions = {},
19
25
  ): Promise<CodeQueryResult<Diagnostic[]>> {
20
26
  const content = readFileSync(filePath, "utf-8");
21
- const result = control
22
- ? await client.syncAndWaitForDiagnostics(filePath, content, control)
23
- : await client.syncAndWaitForDiagnostics(filePath, content);
27
+ const result = await client.syncAndWaitForDiagnostics(filePath, content, options.control, {
28
+ contentIsAuthoritative: options.contentIsAuthoritative ?? true,
29
+ });
24
30
  return mapCodeQueryResult(result, (diagnostics) =>
25
31
  filterDiagnosticsBySeverity(diagnostics, maxSeverity),
26
32
  );
@@ -5,6 +5,8 @@ import {
5
5
  type ProcessCrashRecoveryNextAction,
6
6
  type ProcessCrashRecoveryOutcome,
7
7
  type ProcessCrashRecoveryReport,
8
+ type StartupRetryEntry,
9
+ type StartupRetryReport,
8
10
  } from "../session/runtime-diagnostics.ts";
9
11
 
10
12
  /** One route result before its root is projected to a workspace-relative path. */
@@ -77,7 +79,7 @@ function nextAction(outcome: ProcessCrashRecoveryOutcome): ProcessCrashRecoveryN
77
79
  return "use-exact-file";
78
80
  case "recovery-failed":
79
81
  case "recovery-exhausted":
80
- return "reload-workspace";
82
+ return "refresh";
81
83
  case "recovered":
82
84
  return null;
83
85
  }
@@ -104,3 +106,50 @@ function countRoutes(
104
106
  ): number {
105
107
  return routes.filter((route) => route.outcome === outcome).length;
106
108
  }
109
+
110
+ /** One initial-start route result before its root is projected. */
111
+ export interface StartupRetryRouteResult {
112
+ readonly name: string;
113
+ readonly root: string;
114
+ readonly outcome: StartupRetryEntry["outcome"];
115
+ readonly failureMessage?: string;
116
+ }
117
+
118
+ /** Build a bounded, deterministic report for initial-start retries. */
119
+ export function buildStartupRetryReport(
120
+ routes: readonly StartupRetryRouteResult[],
121
+ cwd: string,
122
+ ): StartupRetryReport {
123
+ const entries = routes
124
+ .map(
125
+ (route): StartupRetryEntry => ({
126
+ name: route.name,
127
+ root: relativeRoot(cwd, route.root),
128
+ outcome: route.outcome,
129
+ ...(route.outcome === "retry-failed"
130
+ ? {
131
+ nextAction: "refresh" as const,
132
+ ...(route.failureMessage
133
+ ? { failureMessage: boundProcessCrashFailureMessage(route.failureMessage) }
134
+ : {}),
135
+ }
136
+ : {}),
137
+ }),
138
+ )
139
+ .sort(compareStartupEntries);
140
+ const visibleEntries = entries.slice(0, MAX_PROCESS_CRASH_RECOVERY_ENTRIES);
141
+ return {
142
+ recoveredRoutes: routes.filter((route) => route.outcome === "recovered").length,
143
+ failedRoutes: routes.filter((route) => route.outcome === "retry-failed").length,
144
+ entries: visibleEntries,
145
+ omittedEntries: Math.max(0, entries.length - visibleEntries.length),
146
+ };
147
+ }
148
+
149
+ function compareStartupEntries(first: StartupRetryEntry, second: StartupRetryEntry): number {
150
+ return (
151
+ Number(first.outcome !== "retry-failed") - Number(second.outcome !== "retry-failed") ||
152
+ compareStrings(first.root, second.root) ||
153
+ compareStrings(first.name, second.name)
154
+ );
155
+ }
@@ -18,7 +18,9 @@ import {
18
18
  } from "../diagnostics/stale-diagnostics.ts";
19
19
  import {
20
20
  emptyProcessCrashRecoveryReport,
21
+ emptyStartupRetryReport,
21
22
  type ProcessCrashRecoveryReport,
23
+ type StartupRetryReport,
22
24
  type WorkspaceDiagnosticReport,
23
25
  } from "../session/runtime-diagnostics.ts";
24
26
 
@@ -29,6 +31,8 @@ export interface WorkspaceRecoveryResult {
29
31
  restartedClients: number;
30
32
  /** No process-crash demand is handled by this generic recovery pass. */
31
33
  processCrashRecovery: ProcessCrashRecoveryReport;
34
+ /** No initial-start retry is handled by this generic recovery pass. */
35
+ startupRetry: StartupRetryReport;
32
36
  /** Server names of the active clients targeted by this pass, for telemetry identity. */
33
37
  attemptedServers: string[];
34
38
  /** Server names of the clients restarted during this pass, for telemetry identity. */
@@ -49,8 +53,8 @@ export interface WorkspaceRecoveryResult {
49
53
  /** One client route's diagnostic evidence capability for recovery targeting. */
50
54
  export interface WorkspaceDiagnosticRoute {
51
55
  key: string;
52
- /** False for push-only clients, which cannot confirm freshness by pull. */
53
- supportsPull: boolean;
56
+ /** False for push-only clients, which have no request adapter. */
57
+ hasDiagnosticRequestAdapter: boolean;
54
58
  /** Files tracked by the route whose evidence is unconfirmed. */
55
59
  unconfirmedFiles: string[];
56
60
  /** Protocol-stall signal observed on the route, or null when healthy. */
@@ -165,6 +169,7 @@ export async function recoverWorkspaceDiagnostics(
165
169
  attemptedClients,
166
170
  restartedClients,
167
171
  processCrashRecovery: emptyProcessCrashRecoveryReport(),
172
+ startupRetry: emptyStartupRetryReport(),
168
173
  attemptedServers,
169
174
  restartedServers: restartServerNames,
170
175
  ...(restartReason ? { restartReason } : {}),
@@ -232,15 +237,14 @@ async function collectInitialEvidence(
232
237
  /**
233
238
  * Collect restart targets: push-only routes with a protocol-stall signal.
234
239
  *
235
- * Unconfirmed evidence alone never restarts a client: the reopen-resync
236
- * fallback handles unconfirmed push-only documents without discarding
237
- * server state (ADR 0020). Restarts require a readiness stall or repeated
238
- * protocol failures, and stay limited to push-only routes.
240
+ * Unconfirmed evidence alone never restarts a client. Restarts require a
241
+ * readiness stall or repeated protocol failures, and stay limited to routes
242
+ * without a diagnostic request adapter.
239
243
  */
240
244
  function collectRecoveryRestartTargets(host: WorkspaceRecoveryHost): RecoveryRestartTarget[] {
241
245
  const targets: RecoveryRestartTarget[] = [];
242
246
  for (const route of host.getClientDiagnosticRoutes()) {
243
- if (route.supportsPull) continue;
247
+ if (route.hasDiagnosticRequestAdapter) continue;
244
248
  if (!route.stallSignal) continue;
245
249
  if (route.unconfirmedFiles.length === 0) continue;
246
250
  targets.push({