@mrclrchtr/supi-review 13.0.0 → 14.1.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 (145) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -2
  3. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  5. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  6. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  7. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  8. package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  9. package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
  10. package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/agent-run-registry.ts +1 -1
  11. package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-format.ts +3 -1
  12. package/node_modules/@mrclrchtr/supi-agent-runtime/src/session/transcript-store.ts +25 -10
  13. package/node_modules/@mrclrchtr/supi-code-intelligence/CHANGELOG.md +30 -0
  14. package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +4 -4
  15. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  16. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  17. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  18. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  19. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  20. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  21. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  22. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  23. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +6 -2
  24. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  25. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  26. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  27. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  28. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  29. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  30. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  31. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  32. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  33. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +5 -0
  34. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +3 -0
  35. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +14 -1
  36. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-typescript.ts +8 -1
  37. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +4 -0
  38. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +7 -1
  39. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +1 -0
  40. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +24 -8
  41. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +5 -0
  42. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +3 -0
  43. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +64 -0
  44. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +3 -0
  45. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +27 -2
  46. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +16 -112
  47. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +521 -83
  48. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-collection.ts +163 -0
  49. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/workspace-symbol-row-limit.ts +72 -0
  50. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +11 -0
  51. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +36 -7
  52. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  53. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +10 -0
  54. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  55. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  56. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  57. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  58. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  59. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  60. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  61. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
  62. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
  63. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/CHANGELOG.md +6 -0
  64. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
  65. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
  66. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  67. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  68. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  69. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  70. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  71. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxvalidator.min.js +1 -1
  72. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
  73. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/CHANGELOG.md +4 -0
  74. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.cjs +1 -1
  75. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js +1 -1
  76. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -1
  77. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/package.json +1 -1
  78. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/fxb.js +13 -28
  79. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/orderedJs2Xml.js +11 -26
  80. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/util.js +31 -0
  81. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/package.json +2 -2
  82. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/src/validator.js +4 -5
  83. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +15 -9
  84. package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +6 -6
  85. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/server-status.ts +32 -9
  86. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/health/signals.ts +1 -0
  87. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/instruction-files.ts +11 -7
  88. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/relations/source-lines.ts +31 -0
  89. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/relations/types.ts +4 -0
  90. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/exclusions.ts +18 -4
  91. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/file-merge.ts +46 -1
  92. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/file-outline-omissions.ts +17 -2
  93. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/identity.ts +9 -3
  94. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/symbol-selection.ts +100 -0
  95. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/symbol.ts +48 -8
  96. package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/target/types.ts +8 -1
  97. package/node_modules/@mrclrchtr/supi-code-intelligence/src/app/app.ts +37 -21
  98. package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +1 -2
  99. package/node_modules/@mrclrchtr/supi-code-intelligence/src/headless.ts +4 -2
  100. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/find-workflow.ts +7 -1
  101. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/graph-workflow.ts +7 -1
  102. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +2 -0
  103. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-types.ts +5 -0
  104. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/orientation-workflow.ts +13 -3
  105. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/target-store.ts +38 -5
  106. package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/target-workflow.ts +35 -14
  107. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/guidance.ts +1 -1
  108. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/render.ts +10 -11
  109. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_find/result.ts +6 -1
  110. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/display.ts +4 -1
  111. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/guidance.ts +5 -2
  112. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/markdown.ts +26 -5
  113. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/section.ts +15 -13
  114. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_graph/structured.ts +10 -0
  115. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/markdown.ts +3 -1
  116. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured-schema.ts +1 -0
  117. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/structured.ts +2 -0
  118. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_orientation/markdown.ts +6 -1
  119. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/guidance.ts +3 -1
  120. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/guidance.ts +3 -1
  121. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/result.ts +2 -1
  122. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_resolve/structured.ts +6 -1
  123. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/infra/arguments.ts +53 -0
  124. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/register.ts +3 -0
  125. package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/result/candidate-selection.ts +17 -1
  126. package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/footer.ts +147 -42
  127. package/node_modules/@mrclrchtr/supi-code-intelligence/src/ui/status-overlay.ts +13 -8
  128. package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
  129. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +59 -13
  130. package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +41 -9
  131. package/node_modules/@mrclrchtr/supi-core/src/session.ts +2 -0
  132. package/node_modules/@mrclrchtr/supi-core/src/side-run.ts +46 -0
  133. package/node_modules/@mrclrchtr/supi-core/src/spill.ts +2 -2
  134. package/package.json +4 -4
  135. package/src/target/file-manifest.ts +8 -4
  136. package/src/target/packet.ts +48 -3
  137. package/src/target/resolve.ts +30 -4
  138. package/src/tool/review_run/format.ts +17 -0
  139. package/src/tool/review_run/input-schema.ts +1 -1
  140. package/src/tool/review_run/render.ts +3 -0
  141. package/src/tool/review_run/schemas.ts +2 -1
  142. package/src/tool/review_run/system-prompt.ts +1 -0
  143. package/src/types.ts +5 -0
  144. package/src/workspace/cleanup-command.ts +43 -2
  145. package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/fast-xml-parser/node_modules/fast-xml-builder/src/prettifyJs2Xml.js +0 -0
@@ -3,6 +3,7 @@ import {
3
3
  throwIfCodeRequestInterrupted,
4
4
  } from "@mrclrchtr/supi-code-runtime/api";
5
5
  import type { DocumentDiagnosticReport } from "../config/types.ts";
6
+ import type { RequestTimingBatch } from "../debug-telemetry.ts";
6
7
  import { raceRequestControl } from "../session/readiness.ts";
7
8
 
8
9
  /** Evidence source used by an explicit diagnostic request. */
@@ -30,6 +31,8 @@ export interface DiagnosticPullRequest {
30
31
  /** Adapter cancellation stops adapter work, not the owned transport. */
31
32
  readonly signal?: AbortSignal;
32
33
  readonly operationId?: string;
34
+ /** Batch that collects this request's completed protocol timings. */
35
+ readonly requestTimings?: RequestTimingBatch;
33
36
  }
34
37
 
35
38
  /** Result returned by one request adapter. */
@@ -3,7 +3,7 @@ import {
3
3
  startDebugTimer,
4
4
  truncateDebugIdentity as truncateIdentity,
5
5
  } from "@mrclrchtr/supi-core/debug";
6
- import { boundCwd } from "../debug-telemetry.ts";
6
+ import { boundCwd, RequestTimingBatch } from "../debug-telemetry.ts";
7
7
 
8
8
  type DiagnosticCollection =
9
9
  | "cache"
@@ -63,6 +63,12 @@ export interface DiagnosticTimingIdentity {
63
63
  */
64
64
  export class DiagnosticObserver {
65
65
  readonly #timer = startDebugTimer();
66
+ /**
67
+ * Completed protocol requests of a `refresh-open` pass. The pass sends one
68
+ * request per open document, so its event reports them as `requests` totals
69
+ * instead of one `request.timing` event each.
70
+ */
71
+ readonly requestTimings: RequestTimingBatch | undefined;
66
72
  #pull: "failed" | "not-supported" | "timed-out";
67
73
  #requestSource: DiagnosticRequestSource | undefined;
68
74
  #request: "failed" | "timed-out" | undefined;
@@ -74,6 +80,7 @@ export class DiagnosticObserver {
74
80
  readonly identity?: DiagnosticTimingIdentity,
75
81
  ) {
76
82
  this.#pull = hasDiagnosticRequestAdapter ? "failed" : "not-supported";
83
+ this.requestTimings = operation === "refresh-open" ? new RequestTimingBatch() : undefined;
77
84
  }
78
85
 
79
86
  synchronized(): void {
@@ -279,6 +286,7 @@ export class DiagnosticObserver {
279
286
  data: {
280
287
  operation: this.operation,
281
288
  ...data,
289
+ ...requestTotals(this.requestTimings),
282
290
  ...(this.identity?.server !== undefined
283
291
  ? { server: truncateIdentity(this.identity.server) }
284
292
  : {}),
@@ -292,6 +300,11 @@ export class DiagnosticObserver {
292
300
  }
293
301
  }
294
302
 
303
+ function requestTotals(batch: RequestTimingBatch | undefined): { requests?: object } {
304
+ const requests = batch?.snapshot();
305
+ return requests ? { requests } : {};
306
+ }
307
+
295
308
  /** Return whether a diagnostic failure represents a timeout without retaining its message. */
296
309
  export function isDiagnosticTimeout(error: unknown): boolean {
297
310
  return error instanceof Error && /\btimed? ?out\b|\btimeout\b/i.test(error.message);
@@ -6,6 +6,7 @@ import {
6
6
  } from "@mrclrchtr/supi-code-runtime/api";
7
7
  import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
8
8
  import type { Diagnostic, Position } from "../config/types.ts";
9
+ import type { RequestTimingBatch } from "../debug-telemetry.ts";
9
10
  import { raceRequestControl } from "../session/readiness.ts";
10
11
  import type {
11
12
  DiagnosticPullRequest,
@@ -38,7 +39,12 @@ export interface TypeScriptDiagnosticAdapterOptions {
38
39
  readonly sendRequestOwned: (
39
40
  method: string,
40
41
  params: unknown,
41
- options: { timeoutMs: number; deadline?: number; operationId?: string },
42
+ options: {
43
+ timeoutMs: number;
44
+ deadline?: number;
45
+ operationId?: string;
46
+ requestTimings?: RequestTimingBatch;
47
+ },
42
48
  ) => OwnedRequest;
43
49
  }
44
50
 
@@ -242,6 +248,7 @@ async function collectTypeScriptPhase(options: TypeScriptPhaseOptions): Promise<
242
248
  timeoutMs: remaining,
243
249
  deadline: collectionDeadline,
244
250
  ...(request.operationId !== undefined ? { operationId: request.operationId } : {}),
251
+ ...(request.requestTimings ? { requestTimings: request.requestTimings } : {}),
245
252
  },
246
253
  );
247
254
  options.setActiveSettled(execution.settled);
@@ -11,6 +11,7 @@ import {
11
11
  } from "@mrclrchtr/supi-code-runtime/api";
12
12
  import { fileToUri, uriToFile } from "@mrclrchtr/supi-core/path";
13
13
  import type { Diagnostic, TextDocumentItem } from "../config/types.ts";
14
+ import type { RequestTimingBatch } from "../debug-telemetry.ts";
14
15
  import type { DiagnosticEvidenceSummary } from "../diagnostics/evidence.ts";
15
16
  import { detectLanguageId } from "../utils.ts";
16
17
  import { applyPushDiagnostics, buildClientDiagnosticSnapshot } from "./client-diagnostic-cache.ts";
@@ -722,6 +723,7 @@ export class ClientDiagnostics {
722
723
  },
723
724
  deadline: requestOptions.deadline,
724
725
  operationId: requestOptions.operationId,
726
+ requestTimings: requestOptions.requestTimings,
725
727
  }),
726
728
  options,
727
729
  publications: {
@@ -1082,6 +1084,7 @@ export class ClientDiagnostics {
1082
1084
  control?: CodeRequestControl;
1083
1085
  deadline?: number;
1084
1086
  operationId?: string;
1087
+ requestTimings?: RequestTimingBatch;
1085
1088
  }): Promise<boolean> {
1086
1089
  const adapter = this.host.diagnosticRequestAdapter;
1087
1090
  if (!adapter?.supports(options.request.uri)) return Promise.resolve(false);
@@ -1118,6 +1121,7 @@ export class ClientDiagnostics {
1118
1121
  timeoutMs: ownerTimeoutMs,
1119
1122
  signal: controller.signal,
1120
1123
  operationId: options.operationId,
1124
+ requestTimings: options.requestTimings,
1121
1125
  };
1122
1126
  const execution = startDiagnosticEvidenceFromAdapter({
1123
1127
  adapter,
@@ -4,7 +4,13 @@ import {
4
4
  throwIfCodeRequestInterrupted,
5
5
  } from "@mrclrchtr/supi-code-runtime/api";
6
6
 
7
- const MAX_PENDING_INPUT_OPERATIONS = 32;
7
+ /**
8
+ * Waiting operations per client. First opens dispatch one at a time, so the
9
+ * bound limits memory for a stalled server, not server load. It must exceed
10
+ * the first opens of several concurrent tool calls: candidate lists open one
11
+ * file per candidate.
12
+ */
13
+ export const MAX_PENDING_INPUT_OPERATIONS = 1024;
8
14
 
9
15
  type InputOperationKind = "request" | "enrollment" | "request-enrollment";
10
16
 
@@ -1133,6 +1133,7 @@ export class LspClient {
1133
1133
  timeoutMs: request.timeoutMs,
1134
1134
  deadline: ownerDeadline,
1135
1135
  ...(request.operationId !== undefined ? { operationId: request.operationId } : {}),
1136
+ ...(request.requestTimings ? { requestTimings: request.requestTimings } : {}),
1136
1137
  },
1137
1138
  );
1138
1139
  activeSettled = owned.settled;
@@ -3,11 +3,9 @@
3
3
  // and notification/request dispatching through vscode-jsonrpc's MessageConnection.
4
4
  // biome-ignore-all lint/style/noExcessiveLinesPerFile: Transport lifetime and protocol handling stay together.
5
5
 
6
+ import { performance } from "node:perf_hooks";
6
7
  import type { Readable, Writable } from "node:stream";
7
- import {
8
- type CodeRequestControl,
9
- CodeRequestDeadlineError,
10
- } from "@mrclrchtr/supi-code-runtime/api";
8
+ import { CodeRequestDeadlineError } from "@mrclrchtr/supi-code-runtime/api";
11
9
  import {
12
10
  startDebugTimer,
13
11
  truncateDebugIdentity as truncateIdentity,
@@ -22,7 +20,11 @@ import {
22
20
  StreamMessageReader,
23
21
  StreamMessageWriter,
24
22
  } from "vscode-jsonrpc/node";
25
- import { boundCwd, LSP_REQUEST_TIMEOUT_ERROR_CODE } from "../debug-telemetry.ts";
23
+ import {
24
+ type BatchedRequestControl,
25
+ boundCwd,
26
+ LSP_REQUEST_TIMEOUT_ERROR_CODE,
27
+ } from "../debug-telemetry.ts";
26
28
 
27
29
  const DEFAULT_TIMEOUT_MS = 30_000;
28
30
 
@@ -112,7 +114,7 @@ export class JsonRpcClient {
112
114
  sendRequestOwned(
113
115
  method: string,
114
116
  params?: unknown,
115
- options?: { timeoutMs?: number } & CodeRequestControl,
117
+ options?: { timeoutMs?: number } & BatchedRequestControl,
116
118
  ): { result: Promise<unknown>; settled: Promise<void> } {
117
119
  let settle!: () => void;
118
120
  const settled = new Promise<void>((resolve) => {
@@ -133,12 +135,20 @@ export class JsonRpcClient {
133
135
  return { result, settled };
134
136
  }
135
137
 
136
- /** Send a request and wait for the correlated response, optionally overriding the timeout. */
138
+ /**
139
+ * Send a request and wait for the correlated response, optionally overriding
140
+ * the timeout. With `requestTimings`, a completed request adds its duration
141
+ * to that batch instead of recording its own `request.timing` event.
142
+ */
137
143
  // biome-ignore lint/complexity/noExcessiveLinesPerFunction: Request timeout and cancellation races stay together.
138
144
  sendRequest(
139
145
  method: string,
140
146
  params?: unknown,
141
- options?: { timeoutMs?: number; onSettled?: () => void; owned?: boolean } & CodeRequestControl,
147
+ options?: {
148
+ timeoutMs?: number;
149
+ onSettled?: () => void;
150
+ owned?: boolean;
151
+ } & BatchedRequestControl,
142
152
  ): Promise<unknown> {
143
153
  const timeoutMs = options?.timeoutMs ?? this.timeoutMs;
144
154
  const owned = options?.owned === true;
@@ -147,6 +157,8 @@ export class JsonRpcClient {
147
157
  const methodClass = classifyRequestMethod(method);
148
158
  const boundedMethod = truncateIdentity(method);
149
159
  const timer = startDebugTimer();
160
+ const requestTimings = timer.enabled ? options?.requestTimings : undefined;
161
+ const startedAt = requestTimings ? performance.now() : 0;
150
162
  // A request cancelled before dispatch must not produce protocol traffic.
151
163
  if (signal?.aborted) {
152
164
  const result = rejectUndispatchedRequest(
@@ -259,6 +271,10 @@ export class JsonRpcClient {
259
271
  ])
260
272
  .then(
261
273
  (result) => {
274
+ if (requestTimings) {
275
+ requestTimings.add(boundedMethod, performance.now() - startedAt);
276
+ return result;
277
+ }
262
278
  recordRequestTiming(
263
279
  timer,
264
280
  options?.operationId,
@@ -70,6 +70,11 @@ export interface ProjectServerInfo extends DetectedProjectServer {
70
70
  openFiles: string[];
71
71
  /** Whether the LSP server is currently not indexing and ready to serve queries. */
72
72
  ready: boolean;
73
+ /**
74
+ * Present while the background warm-up loads the route's projects. The route
75
+ * answers queries; a symbol query waits for the pass.
76
+ */
77
+ loadingProjects?: true;
73
78
  /** Negotiated operation support, when the route has a capability snapshot. */
74
79
  operationSupport?: ServerOperationSupportMap;
75
80
  }
@@ -177,6 +177,9 @@ export function projectConfigIncludesFile(configPath: string, filePath: string):
177
177
  return parsed !== null && decideFileScope(parsed, path.resolve(filePath)).included;
178
178
  }
179
179
 
180
+ /** Normalized paths of the files in a project config's program; undefined when it cannot be parsed. */
181
+ export const projectFileNames = (config: string) => parseProjectConfig(config)?.fileNames;
182
+
180
183
  function isOutOfTree(cwd: string, absolutePath: string): boolean {
181
184
  const relative = path.relative(path.resolve(cwd), absolutePath);
182
185
  return relative.startsWith(`..${path.sep}`) || relative === "..";
@@ -4,6 +4,7 @@
4
4
  // identity for local protocol diagnosis. Each identity string and list uses
5
5
  // the shared bounds.
6
6
 
7
+ import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
7
8
  import { truncateDebugIdentity } from "@mrclrchtr/supi-core/debug";
8
9
 
9
10
  /** Maximum number of server entries in one bounded LSP debug payload. */
@@ -29,3 +30,66 @@ export function boundCwd(cwd: string | undefined): string | undefined {
29
30
  export function boundServerNames(names: readonly string[]): string[] {
30
31
  return names.slice(0, MAX_SERVERS).map(truncateDebugIdentity);
31
32
  }
33
+
34
+ /** Maximum number of distinct methods one batch reports by name. */
35
+ const MAX_BATCH_METHODS = 16;
36
+ const OTHER_BATCH_METHODS = "other";
37
+
38
+ /** Completed-request totals for one method of a batch operation. */
39
+ export interface RequestTimingTotals {
40
+ readonly count: number;
41
+ readonly totalMs: number;
42
+ readonly maxMs: number;
43
+ }
44
+
45
+ /**
46
+ * Completed-request timings of one batch operation, such as a diagnostic
47
+ * refresh over every open document or a workspace-symbol warm-up pass.
48
+ *
49
+ * A batch sends one request per document. Recording each as its own
50
+ * `request.timing` event fills the Debug buffer with near-identical events, so
51
+ * the transport adds completed requests here instead and the batch's summary
52
+ * event reports them through `snapshot()`. Failed, timed-out, and cancelled
53
+ * requests still record their own event. A request that completes after its
54
+ * batch reported is not recorded.
55
+ */
56
+ export class RequestTimingBatch {
57
+ readonly #methods = new Map<string, { count: number; totalMs: number; maxMs: number }>();
58
+
59
+ /** Add one completed request. */
60
+ add(method: string, durationMs: number): void {
61
+ const known = this.#methods.has(method) || this.#methods.size < MAX_BATCH_METHODS;
62
+ const key = known ? method : OTHER_BATCH_METHODS;
63
+ const totals = this.#methods.get(key) ?? { count: 0, totalMs: 0, maxMs: 0 };
64
+ const elapsed = Number.isFinite(durationMs) ? Math.max(0, durationMs) : 0;
65
+ totals.count++;
66
+ totals.totalMs += elapsed;
67
+ totals.maxMs = Math.max(totals.maxMs, elapsed);
68
+ this.#methods.set(key, totals);
69
+ }
70
+
71
+ /** Totals by method, or `undefined` when no request completed. */
72
+ snapshot(): Record<string, RequestTimingTotals> | undefined {
73
+ if (this.#methods.size === 0) return undefined;
74
+ return Object.fromEntries(
75
+ Array.from(this.#methods, ([method, totals]) => [
76
+ method,
77
+ {
78
+ count: totals.count,
79
+ totalMs: roundDuration(totals.totalMs),
80
+ maxMs: roundDuration(totals.maxMs),
81
+ },
82
+ ]),
83
+ );
84
+ }
85
+ }
86
+
87
+ /** Request control that also routes completed-request timings into a batch. */
88
+ export interface BatchedRequestControl extends CodeRequestControl {
89
+ /** Collects completed request timings instead of one event per request. */
90
+ readonly requestTimings?: RequestTimingBatch;
91
+ }
92
+
93
+ function roundDuration(value: number): number {
94
+ return Math.round(value * 10) / 10;
95
+ }
@@ -16,6 +16,8 @@ interface ProjectServerInfoInput {
16
16
  statusReason?: ProjectServerStatusReason;
17
17
  typescript?: TypeScriptSelection;
18
18
  failureMessage?: string;
19
+ /** The background warm-up is loading this route's projects. */
20
+ loadingProjects?: boolean;
19
21
  /** Filter files from ambient project status without changing explicit routing. */
20
22
  includeOpenFile?: (file: string) => boolean;
21
23
  }
@@ -51,6 +53,7 @@ export function buildProjectServerInfo(
51
53
  .filter((file) => input.includeOpenFile?.(file) ?? true)
52
54
  .map((file) => displayRelativeFilePath(file, cwd)) ?? [],
53
55
  ready: input.client?.ready ?? false,
56
+ ...(input.loadingProjects ? { loadingProjects: true as const } : {}),
54
57
  operationSupport: getServerOperationSupport(input.client?.serverCapabilities ?? null),
55
58
  };
56
59
  }
@@ -1,7 +1,11 @@
1
1
  import * as path from "node:path";
2
2
  import { collectExtendedProjectConfigs } from "../config/tsconfig-extends.ts";
3
3
  import { normalizeTsconfigPath } from "../config/tsconfig-path.ts";
4
- import { getFileScopeDecision, projectConfigIncludesFile } from "../config/tsconfig-scope.ts";
4
+ import {
5
+ getFileScopeDecision,
6
+ projectConfigIncludesFile,
7
+ projectFileNames,
8
+ } from "../config/tsconfig-scope.ts";
5
9
  import { type AutomaticLspPathPolicy, walkAutomaticLspTree } from "../workspace-path-policy.ts";
6
10
 
7
11
  /** Directory depth searched for project configs below a TypeScript route root. */
@@ -43,6 +47,9 @@ export function discoverTypeScriptProjectConfigs(
43
47
  * Base configs extended by another discovered config are skipped: their
44
48
  * default include usually spans the whole tree while they own only root
45
49
  * tooling files, so counting them would mark nearly every answer partial.
50
+ *
51
+ * Projects that own no file are skipped too: their program holds only files of
52
+ * other projects, and no open file or answer could ever show them as loaded.
46
53
  */
47
54
  export function findUnloadedTypeScriptProjects(options: {
48
55
  readonly file: string;
@@ -64,11 +71,29 @@ export function findUnloadedTypeScriptProjects(options: {
64
71
  return options.configs.filter((config) => {
65
72
  const key = normalizeTsconfigPath(config);
66
73
  return (
67
- !loaded.has(key) && !baseConfigs.has(key) && projectConfigIncludesFile(config, options.file)
74
+ !loaded.has(key) &&
75
+ !baseConfigs.has(key) &&
76
+ projectConfigIncludesFile(config, options.file) &&
77
+ ownsProgramFile(config, options.cwd)
68
78
  );
69
79
  });
70
80
  }
71
81
 
82
+ /**
83
+ * Whether a project config is the nearest config of a file in its own program.
84
+ * A test config that includes `../src` before any test exists owns none.
85
+ */
86
+ function ownsProgramFile(config: string, cwd: string): boolean {
87
+ const key = normalizeTsconfigPath(config);
88
+ // Program file names are normalized, so the tree root must be too.
89
+ const root = normalizeTsconfigPath(cwd);
90
+ for (const file of projectFileNames(config) ?? []) {
91
+ const nearest = getFileScopeDecision(file, root).configPath;
92
+ if (nearest && normalizeTsconfigPath(nearest) === key) return true;
93
+ }
94
+ return false;
95
+ }
96
+
72
97
  /**
73
98
  * Other projects that tsserver's implementation search skips for `file`.
74
99
  *
@@ -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
  *