@mrclrchtr/supi-code-intelligence 4.10.0 → 6.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 (269) hide show
  1. package/README.md +4 -3
  2. package/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
  3. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
  5. package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
  6. package/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
  8. package/node_modules/@mrclrchtr/supi-core/README.md +2 -0
  9. package/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  10. package/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  11. package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +31 -0
  12. package/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
  13. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -6
  14. package/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  15. package/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  16. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
  17. package/node_modules/@mrclrchtr/supi-lsp/README.md +111 -5
  18. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
  19. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  20. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
  21. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
  22. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
  23. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
  24. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +2 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +31 -0
  28. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
  29. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -6
  30. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  32. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
  33. package/node_modules/@mrclrchtr/supi-lsp/package.json +7 -6
  34. package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +22 -1
  35. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +245 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +78 -0
  37. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +171 -0
  38. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-evidence.ts +413 -0
  39. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +15 -0
  40. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +214 -0
  41. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-pull.ts +62 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +690 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-request.ts +9 -0
  44. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +97 -16
  45. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-waiters.ts +206 -0
  46. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +448 -298
  47. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-state.ts +70 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-document-sync.ts +231 -0
  49. package/node_modules/@mrclrchtr/supi-lsp/src/client/client-file-state.ts +25 -0
  50. package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +529 -119
  51. package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +161 -33
  52. package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +12 -3
  53. package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +5 -5
  54. package/node_modules/@mrclrchtr/supi-lsp/src/config/defaults.json +1 -1
  55. package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +3 -0
  56. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-extends.ts +68 -0
  57. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-path.ts +8 -0
  58. package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +176 -24
  59. package/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +45 -0
  60. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +42 -0
  61. package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +46 -10
  62. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +79 -9
  63. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +17 -7
  64. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +350 -26
  65. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +5 -2
  66. package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +586 -96
  67. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-refactor-provider.ts +130 -0
  68. package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +45 -329
  69. package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +57 -120
  70. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +320 -0
  71. package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +207 -0
  72. package/node_modules/@mrclrchtr/supi-lsp/src/session/readiness.ts +72 -2
  73. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +151 -26
  74. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostic-surface.ts +42 -0
  75. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +92 -0
  76. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +165 -118
  77. package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +49 -0
  78. package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +102 -0
  79. package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +17 -7
  80. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +2 -0
  81. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
  82. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +9 -0
  83. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +53 -13
  84. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/request-control.ts +47 -0
  85. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -1
  86. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +2 -0
  87. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -2
  88. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +1 -1
  89. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +31 -0
  90. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -0
  91. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +19 -6
  92. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +9 -0
  93. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +1 -1
  94. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +3 -0
  95. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/LICENSE +21 -0
  96. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/README.md +258 -0
  97. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/dist/babel.cjs +257 -0
  98. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/dist/jiti.cjs +1 -0
  99. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-cli.mjs +34 -0
  100. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
  101. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-native.mjs +121 -0
  102. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-register.d.mts +1 -0
  103. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-register.mjs +4 -0
  104. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti-static.mjs +23 -0
  105. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.cjs +30 -0
  106. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.d.cts +8 -0
  107. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.d.mts +8 -0
  108. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/jiti.mjs +29 -0
  109. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/lib/types.d.ts +420 -0
  110. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/jiti/package.json +146 -0
  111. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -3
  112. package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +0 -9
  113. package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +0 -8
  114. package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +16 -12
  115. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +65 -87
  116. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +47 -95
  117. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-timing.ts +147 -0
  118. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client-lifecycle.ts +39 -0
  119. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +561 -0
  120. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-message-size.ts +24 -0
  121. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +452 -0
  122. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +4 -2
  123. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +12 -4
  124. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +4 -2
  125. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/imports.ts +4 -2
  126. package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +5 -3
  127. package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +33 -12
  128. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/blocking-test-bootstrap.mjs +34 -0
  129. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/bootstrap.mjs +8 -0
  130. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store-helpers.ts +23 -0
  131. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store.ts +400 -0
  132. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/request-control.ts +48 -0
  133. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime-parser-helpers.ts +24 -0
  134. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime-query-helpers.ts +43 -0
  135. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +421 -0
  136. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +116 -0
  137. package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +201 -0
  138. package/package.json +5 -5
  139. package/src/analysis/health/diagnostics.ts +221 -77
  140. package/src/analysis/health/file-scope.ts +184 -0
  141. package/src/analysis/health/recovery.ts +14 -3
  142. package/src/analysis/provider.ts +58 -0
  143. package/src/analysis/readiness.ts +34 -9
  144. package/src/analysis/refactor/apply.ts +45 -1
  145. package/src/analysis/refactor/mutation-authority.ts +143 -0
  146. package/src/analysis/relations/callees.ts +9 -1
  147. package/src/analysis/relations/types.ts +5 -2
  148. package/src/analysis/search/ast-scan-timing.ts +9 -2
  149. package/src/analysis/search/ast-scan.ts +5 -2
  150. package/src/analysis/search/deadline.ts +2 -2
  151. package/src/analysis/search/pattern-analysis.ts +54 -33
  152. package/src/analysis/search/pattern.ts +18 -3
  153. package/src/analysis/target/anchored.ts +20 -11
  154. package/src/analysis/target/file.ts +18 -11
  155. package/src/analysis/target/identity.ts +19 -3
  156. package/src/analysis/target/symbol.ts +36 -15
  157. package/src/api.ts +4 -0
  158. package/src/config.ts +35 -1
  159. package/src/diagnostics/evidence.ts +51 -0
  160. package/src/extension.ts +57 -14
  161. package/src/overview/overview-data.ts +9 -2
  162. package/src/overview/overview.ts +49 -30
  163. package/src/overview/types.ts +2 -0
  164. package/src/session/capability-adapter.ts +12 -3
  165. package/src/session/find-types.ts +2 -2
  166. package/src/session/find-workflow.ts +20 -9
  167. package/src/session/graph/collect.ts +18 -2
  168. package/src/session/graph-workflow.ts +19 -12
  169. package/src/session/health-refresh.ts +175 -0
  170. package/src/session/health-types.ts +43 -15
  171. package/src/session/health-workflow.ts +69 -54
  172. package/src/session/input/workflows.ts +2 -2
  173. package/src/session/inspect/collect.ts +20 -3
  174. package/src/session/inspect-workflow.ts +12 -6
  175. package/src/session/orientation/collect.ts +12 -3
  176. package/src/session/orientation/context-facts.ts +3 -1
  177. package/src/session/orientation/context-sections.ts +20 -7
  178. package/src/session/orientation/gather.ts +17 -11
  179. package/src/session/orientation-types.ts +4 -1
  180. package/src/session/orientation-workflow.ts +23 -10
  181. package/src/session/refactor-plans.ts +2 -0
  182. package/src/session/refactor-workflow.ts +61 -15
  183. package/src/session/session.ts +29 -2
  184. package/src/session/target-workflow.ts +54 -23
  185. package/src/session/workflow-control.ts +7 -3
  186. package/src/substrate/lsp/lifecycle.ts +26 -46
  187. package/src/substrate/lsp/maintenance.ts +284 -28
  188. package/src/substrate/lsp/recovery.ts +11 -5
  189. package/src/substrate/lsp/state.ts +2 -2
  190. package/src/substrate/workspace-provider-host.ts +25 -3
  191. package/src/tool/{find → code_find}/execute.ts +2 -16
  192. package/src/tool/code_find/guidance.ts +8 -0
  193. package/src/tool/{find → code_find}/render.ts +21 -4
  194. package/src/tool/{result/find.ts → code_find/result.ts} +78 -9
  195. package/src/tool/code_find/spec.ts +37 -0
  196. package/src/tool/code_find/tui.ts +41 -0
  197. package/src/tool/code_graph/execute.ts +24 -0
  198. package/src/tool/code_graph/guidance.ts +6 -0
  199. package/src/tool/{graph → code_graph}/markdown.ts +1 -1
  200. package/src/tool/{result/graph.ts → code_graph/result.ts} +111 -3
  201. package/src/tool/code_graph/spec.ts +39 -0
  202. package/src/tool/code_graph/tui.ts +117 -0
  203. package/src/tool/{health → code_health}/execute.ts +2 -13
  204. package/src/tool/code_health/guidance.ts +8 -0
  205. package/src/tool/{health → code_health}/markdown.ts +119 -27
  206. package/src/tool/code_health/refresh-status.ts +105 -0
  207. package/src/tool/{result/health.ts → code_health/result.ts} +80 -3
  208. package/src/tool/code_health/spec.ts +41 -0
  209. package/src/tool/{health → code_health}/tui.ts +95 -98
  210. package/src/tool/{inspect → code_inspect}/execute.ts +2 -16
  211. package/src/tool/code_inspect/guidance.ts +6 -0
  212. package/src/tool/{inspect → code_inspect}/markdown.ts +1 -1
  213. package/src/tool/{result/inspect.ts → code_inspect/result.ts} +143 -2
  214. package/src/tool/code_inspect/spec.ts +25 -0
  215. package/src/tool/code_inspect/tui.ts +44 -0
  216. package/src/tool/code_orientation/execute.ts +25 -0
  217. package/src/tool/code_orientation/guidance.ts +9 -0
  218. package/src/tool/{orientation → code_orientation}/markdown.ts +1 -1
  219. package/src/tool/code_orientation/result.ts +248 -0
  220. package/src/tool/code_orientation/spec.ts +25 -0
  221. package/src/tool/{orientation → code_orientation}/tui.ts +51 -35
  222. package/src/tool/code_refactor_apply/execute.ts +17 -0
  223. package/src/tool/code_refactor_apply/guidance.ts +5 -0
  224. package/src/tool/{refactor-apply/execute.ts → code_refactor_apply/result.ts} +8 -11
  225. package/src/tool/code_refactor_apply/spec.ts +26 -0
  226. package/src/tool/code_refactor_apply/tui.ts +73 -0
  227. package/src/tool/code_refactor_plan/execute.ts +27 -0
  228. package/src/tool/code_refactor_plan/guidance.ts +8 -0
  229. package/src/tool/{refactor-plan/execute.ts → code_refactor_plan/result.ts} +13 -22
  230. package/src/tool/code_refactor_plan/spec.ts +25 -0
  231. package/src/tool/code_refactor_plan/tui.ts +54 -0
  232. package/src/tool/code_resolve/execute.ts +19 -0
  233. package/src/tool/code_resolve/guidance.ts +8 -0
  234. package/src/tool/{resolve → code_resolve}/markdown.ts +1 -1
  235. package/src/tool/{result/resolve.ts → code_resolve/result.ts} +79 -29
  236. package/src/tool/code_resolve/spec.ts +25 -0
  237. package/src/tool/code_resolve/tui.ts +60 -0
  238. package/src/tool/guidance.ts +71 -52
  239. package/src/tool/infra/truncate.ts +40 -0
  240. package/src/tool/infra/workflow-control.ts +8 -0
  241. package/src/tool/{refactor-plan/markdown.ts → refactor-markdown.ts} +4 -7
  242. package/src/tool/register.ts +105 -88
  243. package/src/tool/result/display.ts +107 -0
  244. package/src/tool/result/errors.ts +20 -17
  245. package/src/tool/result/refactor.ts +37 -8
  246. package/src/tool/result/types.ts +20 -0
  247. package/src/tool/schemas.ts +26 -157
  248. package/src/tool/specs.ts +40 -126
  249. package/src/types/execution.ts +18 -5
  250. package/src/types/index.ts +8 -1
  251. package/src/ui/status-command.ts +5 -3
  252. package/src/ui/status-overlay.ts +4 -0
  253. package/src/ui/tui/common.ts +108 -10
  254. package/src/ui/tui/display.ts +48 -0
  255. package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime.ts +0 -351
  256. package/src/tool/find/tui.ts +0 -39
  257. package/src/tool/graph/execute.ts +0 -62
  258. package/src/tool/graph/tui.ts +0 -104
  259. package/src/tool/inspect/tui.ts +0 -36
  260. package/src/tool/orientation/execute.ts +0 -62
  261. package/src/tool/refactor-apply/tui.ts +0 -55
  262. package/src/tool/refactor-plan/tui.ts +0 -41
  263. package/src/tool/resolve/execute.ts +0 -36
  264. package/src/tool/resolve/tui.ts +0 -42
  265. package/src/tool/result/orientation.ts +0 -132
  266. /package/src/tool/{find → code_find}/ast-kinds.ts +0 -0
  267. /package/src/tool/{find → code_find}/markdown.ts +0 -0
  268. /package/src/tool/{find → code_find}/modes.ts +0 -0
  269. /package/src/tool/{health → code_health}/semantic-state.ts +0 -0
@@ -138,6 +138,8 @@ export class WorkspaceCodeIntelligenceSession {
138
138
 
139
139
  /** Whether the hidden architecture overview has been injected. */
140
140
  #hasInjectedOverview = false;
141
+ /** Pinned overview setting; null until resolved once per session. */
142
+ #overviewEnabled: boolean | null = null;
141
143
 
142
144
  /** Most recent explicit diagnostic refresh attempt, including its established outcome. */
143
145
  #lastHealthRefreshAttempt: HealthRefreshAttempt | null = null;
@@ -166,6 +168,9 @@ export class WorkspaceCodeIntelligenceSession {
166
168
  /** Whether the project owning this session is trusted for config loading. */
167
169
  #projectTrusted = false;
168
170
 
171
+ /** Global config home for hermetic config reads; undefined uses os.homedir(). */
172
+ #homeDir: string | undefined;
173
+
169
174
  constructor(cwd: string, capability?: CapabilityAdapter) {
170
175
  this.cwd = cwd;
171
176
  this.#capability = capability ?? new WorkspaceCapabilityAdapter();
@@ -176,6 +181,11 @@ export class WorkspaceCodeIntelligenceSession {
176
181
  this.#projectTrusted = trusted;
177
182
  }
178
183
 
184
+ /** Record the global-config home used for session config reads. */
185
+ setHomeDir(homeDir?: string): void {
186
+ this.#homeDir = homeDir;
187
+ }
188
+
179
189
  /** Attach lifecycle-owned LSP state without exposing it to Tool adapters. */
180
190
  attachLspController(controller: LspRuntimeController | null): void {
181
191
  this.#lspController = controller;
@@ -194,9 +204,22 @@ export class WorkspaceCodeIntelligenceSession {
194
204
  this.#hasInjectedOverview = true;
195
205
  }
196
206
 
207
+ /**
208
+ * Pin the overview setting resolved once per session. The first resolution
209
+ * wins; later config changes never toggle the setting mid-session.
210
+ */
211
+ setOverviewEnabledOnce(enabled: boolean): void {
212
+ this.#overviewEnabled ??= enabled;
213
+ }
214
+
215
+ /** Whether the overview setting has been pinned for this session. */
216
+ hasPinnedOverview(): boolean {
217
+ return this.#overviewEnabled !== null;
218
+ }
219
+
197
220
  /** Atomically claim first-turn overview injection for this workspace session. */
198
221
  claimOverviewInjection(): boolean {
199
- if (this.#hasInjectedOverview) return false;
222
+ if (this.#overviewEnabled === false || this.#hasInjectedOverview) return false;
200
223
  this.#hasInjectedOverview = true;
201
224
  return true;
202
225
  }
@@ -231,7 +254,7 @@ export class WorkspaceCodeIntelligenceSession {
231
254
  phase: "target",
232
255
  message: "Resolving target evidence",
233
256
  });
234
- return resolveTargetWorkflow(
257
+ const outcome = await resolveTargetWorkflow(
235
258
  request.target,
236
259
  {
237
260
  fileLevelAllowed: true,
@@ -239,7 +262,10 @@ export class WorkspaceCodeIntelligenceSession {
239
262
  maxResults: request.maxResults,
240
263
  },
241
264
  this.targetWorkflowDeps(),
265
+ control,
242
266
  );
267
+ throwIfAborted(control);
268
+ return outcome;
243
269
  }
244
270
 
245
271
  /** Collect evidence-backed workspace health facts. */
@@ -281,6 +307,7 @@ export class WorkspaceCodeIntelligenceSession {
281
307
  surfacedInstructionDirs: this.#surfacedInstructionDirs,
282
308
  markInstructionDirsSurfaced: (directories) => this.markInstructionDirsSurfaced(directories),
283
309
  projectTrusted: this.#projectTrusted,
310
+ homeDir: this.#homeDir,
284
311
  },
285
312
  control,
286
313
  );
@@ -4,8 +4,10 @@
4
4
  * Turns one exact target selector into immutable resolved-target facts before
5
5
  * graph, Orientation, resolve, or refactor analysis begins.
6
6
  */
7
-
7
+ // biome-ignore lint/style/noExcessiveLinesPerFile: target workflow keeps anchored, symbol, and file resolution together.
8
8
  import { existsSync } from "node:fs";
9
+ import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
10
+ import { withSemanticRequestControl, withStructuralRequestControl } from "../analysis/provider.ts";
9
11
  import { normalizePath, resolveScope } from "../analysis/search/paths.ts";
10
12
  import { resolveAnchoredSymbolTarget } from "../analysis/target/anchored.ts";
11
13
  import { resolveFileTargetGroup, validateFileTargetDiscovery } from "../analysis/target/file.ts";
@@ -87,6 +89,7 @@ export async function resolveTargetWorkflow(
87
89
  input: TargetInput,
88
90
  policy: TargetWorkflowPolicy,
89
91
  deps: TargetWorkflowDeps,
92
+ control?: CodeRequestControl,
90
93
  ): Promise<TargetWorkflowOutcome> {
91
94
  const parsed = parseTargetInput(input, ["handle", "anchor", "symbol", "file"]);
92
95
  if (parsed.kind === "invalid-input") return parsed;
@@ -96,10 +99,10 @@ export async function resolveTargetWorkflow(
96
99
  return resolveHandle(target.handle, policy, deps);
97
100
  }
98
101
  if ("anchor" in target) {
99
- return resolveAnchoredWorkflow(target.anchor, policy, deps);
102
+ return resolveAnchoredWorkflow(target.anchor, policy, deps, control);
100
103
  }
101
104
  if ("symbol" in target) {
102
- return resolveSymbolWorkflow(target.symbol, policy, deps);
105
+ return resolveSymbolWorkflow(target.symbol, policy, deps, control);
103
106
  }
104
107
  if (!policy.fileLevelAllowed) {
105
108
  return {
@@ -107,7 +110,7 @@ export async function resolveTargetWorkflow(
107
110
  message: "This workflow requires a handle, anchored point, or symbol target.",
108
111
  };
109
112
  }
110
- return resolveFileOnlyWorkflow(target.file, policy.maxResults ?? 10, deps);
113
+ return resolveFileOnlyWorkflow(target.file, policy.maxResults ?? 10, deps, control);
111
114
  }
112
115
 
113
116
  function resolveHandle(
@@ -134,16 +137,18 @@ async function resolveAnchoredWorkflow(
134
137
  anchor: { file: string; line: number; character: number },
135
138
  policy: TargetWorkflowPolicy,
136
139
  deps: TargetWorkflowDeps,
140
+ control?: CodeRequestControl,
137
141
  ): Promise<TargetWorkflowOutcome> {
138
142
  const file = normalizePath(anchor.file, deps.cwd);
139
143
  if (!existsSync(file)) {
140
144
  return { kind: "invalid-input", message: `File not found: \`${anchor.file}\`` };
141
145
  }
142
146
 
143
- const readiness = await deps.capability.ensureSemanticReadiness(deps.cwd, {
144
- kind: "file",
145
- file,
146
- });
147
+ const readiness = await deps.capability.ensureSemanticReadiness(
148
+ deps.cwd,
149
+ { kind: "file", file },
150
+ control,
151
+ );
147
152
  if (readiness.kind === "timeout") {
148
153
  return {
149
154
  kind: "unavailable",
@@ -158,13 +163,19 @@ async function resolveAnchoredWorkflow(
158
163
  file,
159
164
  anchor.line,
160
165
  anchor.character,
161
- deps.capability.getProvider(deps.cwd),
166
+ withSemanticRequestControl(
167
+ withStructuralRequestControl(deps.capability.getProvider(deps.cwd), control),
168
+ control,
169
+ ),
170
+ control,
162
171
  );
163
172
  return toWorkflowOutcome(
164
173
  await refineTargetOutcomeIdentity(
165
174
  outcome,
166
175
  deps.cwd,
167
- deps.capability.getStructuralProvider(deps.cwd) ?? undefined,
176
+ withStructuralRequestControl(deps.capability.getStructuralProvider(deps.cwd), control) ??
177
+ undefined,
178
+ control,
168
179
  ),
169
180
  policy,
170
181
  deps,
@@ -175,6 +186,7 @@ async function resolveSymbolWorkflow(
175
186
  symbol: { query: string; scope?: string; symbolKind?: TargetSymbolKind },
176
187
  policy: TargetWorkflowPolicy,
177
188
  deps: TargetWorkflowDeps,
189
+ control?: CodeRequestControl,
178
190
  ): Promise<TargetWorkflowOutcome> {
179
191
  if (!symbol.query.trim()) {
180
192
  return { kind: "invalid-input", message: "Symbol query must not be empty." };
@@ -189,9 +201,11 @@ async function resolveSymbolWorkflow(
189
201
  scope = resolved.path;
190
202
  }
191
203
 
192
- const readiness = await deps.capability.ensureSemanticReadiness(deps.cwd, {
193
- kind: "workspace",
194
- });
204
+ const readiness = await deps.capability.ensureSemanticReadiness(
205
+ deps.cwd,
206
+ { kind: "workspace" },
207
+ control,
208
+ );
195
209
  if (readiness.kind === "timeout") {
196
210
  return { kind: "unavailable", reason: "LSP readiness timed out. Retry shortly." };
197
211
  }
@@ -199,7 +213,10 @@ async function resolveSymbolWorkflow(
199
213
  return { kind: "unavailable", reason: readiness.reason };
200
214
  }
201
215
 
202
- const provider = deps.capability.getSemanticProvider(deps.cwd);
216
+ const provider = withSemanticRequestControl(
217
+ deps.capability.getSemanticProvider(deps.cwd),
218
+ control,
219
+ );
203
220
  if (!provider) {
204
221
  return {
205
222
  kind: "unavailable",
@@ -211,12 +228,15 @@ async function resolveSymbolWorkflow(
211
228
  path: scope,
212
229
  kind: symbol.symbolKind,
213
230
  maxResults: policy.maxResults,
231
+ control,
214
232
  });
215
233
  return toWorkflowOutcome(
216
234
  await refineTargetOutcomeIdentity(
217
235
  outcome,
218
236
  deps.cwd,
219
- deps.capability.getStructuralProvider(deps.cwd) ?? undefined,
237
+ withStructuralRequestControl(deps.capability.getStructuralProvider(deps.cwd), control) ??
238
+ undefined,
239
+ control,
220
240
  ),
221
241
  policy,
222
242
  deps,
@@ -227,15 +247,17 @@ async function resolveFileOnlyWorkflow(
227
247
  requestedFile: string,
228
248
  maxResults: number,
229
249
  deps: TargetWorkflowDeps,
250
+ control?: CodeRequestControl,
230
251
  ): Promise<TargetWorkflowOutcome> {
231
252
  const validation = validateFileTargetDiscovery(requestedFile, deps.cwd);
232
253
  if (validation.kind === "invalid-input") return validation;
233
254
  const file = validation.file;
234
255
 
235
- const readiness = await deps.capability.ensureSemanticReadiness(deps.cwd, {
236
- kind: "file",
237
- file,
238
- });
256
+ const readiness = await deps.capability.ensureSemanticReadiness(
257
+ deps.cwd,
258
+ { kind: "file", file },
259
+ control,
260
+ );
239
261
  if (readiness.kind === "timeout") {
240
262
  return { kind: "unavailable", reason: "LSP readiness timed out. Retry shortly." };
241
263
  }
@@ -243,10 +265,19 @@ async function resolveFileOnlyWorkflow(
243
265
  return { kind: "unavailable", reason: readiness.reason };
244
266
  }
245
267
 
246
- const result = await resolveFileTargetGroup(file, deps.cwd, {
247
- semantic: deps.capability.getSemanticProvider(deps.cwd) ?? undefined,
248
- structural: deps.capability.getStructuralProvider(deps.cwd) ?? undefined,
249
- });
268
+ const result = await resolveFileTargetGroup(
269
+ file,
270
+ deps.cwd,
271
+ {
272
+ semantic:
273
+ withSemanticRequestControl(deps.capability.getSemanticProvider(deps.cwd), control) ??
274
+ undefined,
275
+ structural:
276
+ withStructuralRequestControl(deps.capability.getStructuralProvider(deps.cwd), control) ??
277
+ undefined,
278
+ },
279
+ control,
280
+ );
250
281
  if (result.kind === "invalid-input") return result;
251
282
  if (result.kind === "unavailable") {
252
283
  return { kind: "unavailable", reason: result.message };
@@ -1,3 +1,8 @@
1
+ import {
2
+ type CodeRequestControl,
3
+ throwIfCodeRequestInterrupted,
4
+ } from "@mrclrchtr/supi-code-runtime/api";
5
+
1
6
  /** Execution controls shared by Workspace code-intelligence session workflows. */
2
7
 
3
8
  /** Stable progress event emitted by a session-owned workflow. */
@@ -16,8 +21,7 @@ export interface WorkflowProgressEvent {
16
21
  }
17
22
 
18
23
  /** Per-call cancellation and progress controls. */
19
- export interface WorkflowControl {
20
- readonly signal?: AbortSignal;
24
+ export interface WorkflowControl extends CodeRequestControl {
21
25
  readonly progress?: (event: WorkflowProgressEvent) => void;
22
26
  }
23
27
 
@@ -31,5 +35,5 @@ export function reportProgress(
31
35
 
32
36
  /** Throw the platform-standard cancellation reason before starting a phase. */
33
37
  export function throwIfAborted(control: WorkflowControl | undefined): void {
34
- control?.signal?.throwIfAborted();
38
+ throwIfCodeRequestInterrupted(control);
35
39
  }
@@ -4,66 +4,49 @@ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-a
4
4
  import { acquireWorkspaceProviderHost } from "../workspace-provider-host.ts";
5
5
  import { LSP_STATE_CHANGE_EVENT, type LspAdapterState } from "./state.ts";
6
6
 
7
- const STATE_CHANGE_EVENT = new Event(LSP_STATE_CHANGE_EVENT);
8
-
9
- /** Poll interval (ms) for detecting server readiness transitions in the footer. */
10
- const READINESS_POLL_MS = 2_000;
11
-
12
7
  /** Acquire providers once per workspace and release them after the final Pi session ends. */
13
8
  export function registerLspSessionLifecycle(
14
9
  pi: ExtensionAPI,
15
10
  state: LspAdapterState,
16
11
  onStarted?: (ctx: ExtensionContext) => void | Promise<void>,
17
12
  ): void {
18
- let readinessTimer: ReturnType<typeof setInterval> | null = null;
19
- let lastFingerprint = "";
13
+ let disposeLifecycle: (() => void) | null = null;
14
+ let subscriptionGeneration = 0;
20
15
 
21
- function fingerprint(): string {
22
- const servers = state.controller?.workspaceRuntime?.getProjectServers();
23
- if (!servers) return "";
24
- let ready = 0;
25
- let starting = 0;
26
- let error = 0;
27
- let unavailable = 0;
28
- let openFiles = 0;
29
- for (const s of servers) {
30
- openFiles += s.openFiles.length;
31
- if (s.status === "running" && s.ready) ready++;
32
- else if (s.status === "running") starting++;
33
- else if (s.status === "error") error++;
34
- else unavailable++;
35
- }
36
- return `${ready}:${starting}:${error}:${unavailable}:${openFiles}`;
16
+ function dispatchStateChange(): void {
17
+ state.stateChanges.dispatchEvent(new Event(LSP_STATE_CHANGE_EVENT));
37
18
  }
38
19
 
39
- function startReadinessPolling(): void {
40
- stopReadinessPolling();
41
- lastFingerprint = fingerprint();
42
- readinessTimer = setInterval(() => {
43
- if (state.controller?.kind !== "ready") return;
44
- const current = fingerprint();
45
- if (current === lastFingerprint) return;
46
- lastFingerprint = current;
47
- state.stateChanges.dispatchEvent(STATE_CHANGE_EVENT);
48
- }, READINESS_POLL_MS);
49
- readinessTimer.unref?.();
20
+ function stopLifecycleSubscription(): void {
21
+ subscriptionGeneration++;
22
+ disposeLifecycle?.();
23
+ disposeLifecycle = null;
50
24
  }
51
25
 
52
- function stopReadinessPolling(): void {
53
- if (readinessTimer) {
54
- clearInterval(readinessTimer);
55
- readinessTimer = null;
26
+ function startLifecycleSubscription(): void {
27
+ stopLifecycleSubscription();
28
+ const controller = state.controller;
29
+ if (!controller) {
30
+ dispatchStateChange();
31
+ return;
56
32
  }
57
- lastFingerprint = "";
33
+ const generation = subscriptionGeneration;
34
+ let receivedInitialTransition = false;
35
+ disposeLifecycle = controller.subscribeLifecycle(() => {
36
+ if (generation !== subscriptionGeneration) return;
37
+ receivedInitialTransition = true;
38
+ dispatchStateChange();
39
+ });
40
+ if (!receivedInitialTransition) dispatchStateChange();
58
41
  }
59
42
 
60
43
  pi.on("session_start", async (_event, ctx: ExtensionContext) => {
44
+ stopLifecycleSubscription();
61
45
  await state.providerLease?.release();
62
46
  state.providerLease = null;
63
47
  state.controller = null;
64
48
  state.lspActive = false;
65
49
  state.sentinelSnapshot = new Map();
66
- stopReadinessPolling();
67
50
 
68
51
  const lease = await acquireWorkspaceProviderHost(ctx.cwd, {
69
52
  projectTrusted: ctx.isProjectTrusted(),
@@ -73,19 +56,16 @@ export function registerLspSessionLifecycle(
73
56
  state.lspActive = lease.lspController?.kind === "ready";
74
57
  state.sentinelSnapshot = lease.sentinelSnapshot;
75
58
  await onStarted?.(ctx);
76
-
77
- // Dispatch initial server list so the footer shows starting servers immediately.
78
- state.stateChanges.dispatchEvent(STATE_CHANGE_EVENT);
79
- // Poll for readiness transitions (running → ready, errors, etc.).
80
- startReadinessPolling();
59
+ startLifecycleSubscription();
81
60
  });
82
61
 
83
62
  pi.on("session_shutdown", async () => {
84
- stopReadinessPolling();
63
+ stopLifecycleSubscription();
85
64
  await state.providerLease?.release();
86
65
  state.providerLease = null;
87
66
  state.controller = null;
88
67
  state.lspActive = false;
89
68
  state.sentinelSnapshot = new Map();
69
+ dispatchStateChange();
90
70
  });
91
71
  }