@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
@@ -1,104 +0,0 @@
1
- /**
2
- * TUI renderer for code_graph — renderCall + renderResult.
3
- *
4
- * Dual-surface rendering: chrome built from details, markdown body
5
- * available as a collapsible detail view.
6
- */
7
-
8
- import type { Theme } from "@earendil-works/pi-coding-agent";
9
- import { Container, Spacer, Text } from "@earendil-works/pi-tui";
10
- import {
11
- buildSimpleCompact,
12
- buildSimpleHeader,
13
- type EvidenceEntry,
14
- type ResultOptios,
15
- renderEvidenceLines,
16
- renderMarkdownDetail,
17
- renderPartial,
18
- renderStructuredDetailBody,
19
- type ToolResult,
20
- } from "../../ui/tui/common.ts";
21
- import type { CodeGraphToolParams, GraphRelation } from "./execute.ts";
22
-
23
- /** ── renderCall ────────────────────────────────────────────────── */
24
-
25
- export function renderGraphCall(args: unknown, theme: Theme, _context: unknown): Text {
26
- const params = (args ?? {}) as CodeGraphToolParams;
27
- const relations = params.relations ?? ["references"];
28
- const relationLabel = formatRelations(relations);
29
-
30
- let content = theme.fg("toolTitle", "code_graph");
31
-
32
- if (relationLabel) {
33
- content += ` ${theme.fg("accent", relationLabel)}`;
34
- }
35
-
36
- const target = formatTarget(params);
37
- if (target) {
38
- content += ` ${theme.fg("muted", target)}`;
39
- }
40
-
41
- return new Text(content, 0, 0);
42
- }
43
-
44
- /** ── renderResult ──────────────────────────────────────────────── */
45
-
46
- export function renderGraphResult(
47
- result: ToolResult,
48
- options: ResultOptios,
49
- theme: Theme,
50
- _context: unknown,
51
- ): Container | Text {
52
- if (options.isPartial) {
53
- return renderPartial("Collecting relations…", theme);
54
- }
55
-
56
- const container = new Container();
57
- const details =
58
- result.details?.type === "search" ? (result.details.data as Record<string, unknown>) : null;
59
-
60
- if (result.isError) {
61
- container.addChild(new Text(theme.fg("error", "code_graph failed"), 0, 0));
62
- return container;
63
- }
64
-
65
- if (!options.expanded) {
66
- container.addChild(buildSimpleCompact(details ?? undefined, theme));
67
- return container;
68
- }
69
-
70
- // Expanded view
71
- const header = buildSimpleHeader(details ?? undefined, theme);
72
- if (header) container.addChild(header);
73
-
74
- const evidenceLists = details?.evidenceLists as EvidenceEntry[] | undefined;
75
- if (evidenceLists && evidenceLists.length > 0) {
76
- container.addChild(new Spacer(1));
77
- renderEvidenceLines(container, evidenceLists, theme);
78
- }
79
-
80
- renderStructuredDetailBody(container, details ?? undefined, theme);
81
- renderMarkdownDetail(container, result, theme);
82
-
83
- return container;
84
- }
85
-
86
- /** ── Helpers ───────────────────────────────────────────────────── */
87
-
88
- function formatRelations(relations: GraphRelation[]): string {
89
- if (relations.length === 0) return "";
90
- if (relations.length === 1) return `→ ${relations[0]}`;
91
- if (relations.length <= 3) return `→ ${relations.join(", ")}`;
92
- return `→ ${relations.slice(0, 2).join(", ")} +${relations.length - 2}`;
93
- }
94
-
95
- function formatTarget(params: CodeGraphToolParams): string {
96
- if ("symbol" in params.target) return `of ${params.target.symbol.query}`;
97
- if ("anchor" in params.target) {
98
- const point = params.target.anchor;
99
- const file = point.file.split("/").pop() ?? point.file;
100
- return `at ${file}:${point.line}`;
101
- }
102
- if ("handle" in params.target) return `of ${params.target.handle}`;
103
- return "";
104
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * TUI renderer for code_inspect — renderCall + renderResult.
3
- */
4
- import type { Theme } from "@earendil-works/pi-coding-agent";
5
- import { Text } from "@earendil-works/pi-tui";
6
- import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
7
-
8
- /** ── renderCall ────────────────────────────────────────────────── */
9
-
10
- export function renderInspectCall(args: unknown, theme: Theme, _context: unknown): Text {
11
- const params = (args ?? {}) as {
12
- point?: { file: string; line: number; character: number };
13
- };
14
-
15
- let content = theme.fg("toolTitle", "code_inspect");
16
-
17
- if (params.point) {
18
- const file = params.point.file.split("/").pop() ?? params.point.file;
19
- content += ` ${theme.fg("accent", file)}`;
20
- content += theme.fg("warning", `:${params.point.line}`);
21
- content += theme.fg("dim", `:${params.point.character}`);
22
- }
23
-
24
- return new Text(content, 0, 0);
25
- }
26
-
27
- /** ── renderResult ──────────────────────────────────────────────── */
28
-
29
- export function renderInspectResult(
30
- result: ToolResult,
31
- options: ResultOptios,
32
- theme: Theme,
33
- _context: unknown,
34
- ): ReturnType<typeof renderSimpleResult> {
35
- return renderSimpleResult(result, options, theme, "Inspecting…");
36
- }
@@ -1,62 +0,0 @@
1
- /** Thin Pi adapter for the session-owned Orientation workflow. */
2
-
3
- import type {
4
- OrientationFocusInput,
5
- OrientationWorkflowInput,
6
- } from "../../session/orientation-types.ts";
7
- import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
8
- import { toWorkflowControl } from "../infra/workflow-control.ts";
9
- import { contextErrorResult } from "../result/errors.ts";
10
- import { assembleOrientationDetails, assembleOrientationResult } from "../result/orientation.ts";
11
- import { renderOrientationResult } from "./markdown.ts";
12
-
13
- export interface CodeOrientationToolParams {
14
- focus?: OrientationFocusInput;
15
- maxResults?: number;
16
- }
17
-
18
- export async function executeOrientationTool(
19
- params: CodeOrientationToolParams,
20
- ctx: CodeIntelToolExecCtx,
21
- ): Promise<CodeIntelResult> {
22
- const outcome = await ctx.session.orient(
23
- params as OrientationWorkflowInput,
24
- toWorkflowControl(ctx),
25
- );
26
- if (outcome.kind === "unavailable") throw new Error(outcome.reason);
27
- if (outcome.kind === "invalid-input") {
28
- return contextErrorResult(`**Error:** ${outcome.message}`, {
29
- nextQueries: ["Choose an existing path, module, or precise target"],
30
- });
31
- }
32
- if (outcome.kind === "disambiguation" || outcome.kind === "kind-mismatch") {
33
- const candidates = outcome.candidates ?? [];
34
- const lines = [
35
- outcome.kind === "kind-mismatch"
36
- ? `# No Orientation target matched provider kind \`${outcome.requestedKind}\``
37
- : "# Multiple Orientation targets",
38
- "",
39
- ];
40
- for (const candidate of candidates) {
41
- lines.push(
42
- `${candidate.rank}. **${candidate.name}** (\`${candidate.kind ?? "unknown"}\`) — \`${candidate.file}\`:${candidate.line}:${candidate.character} — \`${candidate.targetId}\``,
43
- );
44
- }
45
- const nextQueries =
46
- outcome.kind === "kind-mismatch"
47
- ? ["Retry without symbolKind, use an observed provider kind, or focus one handle"]
48
- : ["Use one candidate handle as focus.target.handle"];
49
- const details = assembleOrientationDetails({
50
- confidence: "semantic",
51
- omittedCount: outcome.omittedCount,
52
- candidates,
53
- nextQueries,
54
- });
55
- return { content: lines.join("\n"), details: { type: "context", data: details } };
56
- }
57
- const assembly = assembleOrientationResult(outcome.data);
58
- return {
59
- content: renderOrientationResult(assembly),
60
- details: { type: "context", data: assembly.details },
61
- };
62
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * TUI renderer for code_refactor_apply — renderCall + renderResult.
3
- *
4
- * Has a custom result renderer (not using renderSimpleResult) because
5
- * its compact view shows success/error status rather than a count badge.
6
- */
7
- import type { Theme } from "@earendil-works/pi-coding-agent";
8
- import { Container, Text } from "@earendil-works/pi-tui";
9
- import {
10
- type ResultOptios,
11
- renderMarkdownDetail,
12
- renderPartial,
13
- type ToolResult,
14
- } from "../../ui/tui/common.ts";
15
-
16
- /** ── renderCall ────────────────────────────────────────────────── */
17
-
18
- export function renderRefactorApplyCall(_args: unknown, theme: Theme, _context: unknown): Text {
19
- return new Text(
20
- `${theme.fg("toolTitle", "code_refactor_apply")} ${theme.fg("accent", "apply plan")}`,
21
- 0,
22
- 0,
23
- );
24
- }
25
-
26
- /** ── renderResult ──────────────────────────────────────────────── */
27
-
28
- export function renderRefactorApplyResult(
29
- result: ToolResult,
30
- options: ResultOptios,
31
- theme: Theme,
32
- _context: unknown,
33
- ): Container | Text {
34
- if (options.isPartial) {
35
- return renderPartial("Applying…", theme);
36
- }
37
-
38
- if (!options.expanded) {
39
- const applied =
40
- !result.isError &&
41
- result.details?.type === "search" &&
42
- result.details.data.confidence === "semantic";
43
- return new Text(
44
- applied
45
- ? theme.fg("success", theme.bold("Plan applied"))
46
- : theme.fg("error", "Refactor apply failed"),
47
- 0,
48
- 0,
49
- );
50
- }
51
-
52
- const container = new Container();
53
- renderMarkdownDetail(container, result, theme);
54
- return container;
55
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * TUI renderer for code_refactor_plan — renderCall + renderResult.
3
- */
4
- import type { Theme } from "@earendil-works/pi-coding-agent";
5
- import { Text } from "@earendil-works/pi-tui";
6
- import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
7
-
8
- /** ── renderCall ────────────────────────────────────────────────── */
9
-
10
- export function renderRefactorPlanCall(args: unknown, theme: Theme, _context: unknown): Text {
11
- const params = (args ?? {}) as {
12
- operation?: Record<string, { newName?: string }>;
13
- target?: { anchor?: { file: string }; handle?: string };
14
- };
15
-
16
- let content = theme.fg("toolTitle", "code_refactor_plan");
17
- const operation = params.operation ? Object.entries(params.operation)[0] : undefined;
18
- if (operation) {
19
- content += ` ${theme.fg("accent", operation[0])}`;
20
- if (operation[1].newName) content += ` ${theme.fg("muted", operation[1].newName)}`;
21
- }
22
- if (params.target?.anchor) {
23
- const file = params.target.anchor.file.split("/").pop() ?? params.target.anchor.file;
24
- content += ` ${theme.fg("muted", file)}`;
25
- } else if (params.target?.handle) {
26
- content += ` ${theme.fg("muted", params.target.handle)}`;
27
- }
28
-
29
- return new Text(content, 0, 0);
30
- }
31
-
32
- /** ── renderResult ──────────────────────────────────────────────── */
33
-
34
- export function renderRefactorPlanResult(
35
- result: ToolResult,
36
- options: ResultOptios,
37
- theme: Theme,
38
- _context: unknown,
39
- ): ReturnType<typeof renderSimpleResult> {
40
- return renderSimpleResult(result, options, theme, "Planning…");
41
- }
@@ -1,36 +0,0 @@
1
- /** Thin Pi adapter for code_resolve. */
2
-
3
- import type { ResolveTargetInput } from "../../session/target-input.ts";
4
- import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
5
- import { toWorkflowControl } from "../infra/workflow-control.ts";
6
- import { assembleResolveResult, suggestedResolveRelations } from "../result/resolve.ts";
7
- import { renderResolveResult } from "./markdown.ts";
8
-
9
- export interface CodeResolveToolParams {
10
- target: ResolveTargetInput;
11
- maxResults?: number;
12
- }
13
-
14
- export async function executeResolveTool(
15
- params: CodeResolveToolParams,
16
- ctx: CodeIntelToolExecCtx,
17
- ): Promise<CodeIntelResult> {
18
- const outcome = await ctx.session.resolve(params, toWorkflowControl(ctx));
19
- if (outcome.kind === "unavailable") {
20
- throw new Error(outcome.reason);
21
- }
22
-
23
- const assembly = assembleResolveResult(outcome, ctx.cwd);
24
- let content = renderResolveResult(assembly);
25
- if (outcome.kind === "resolved") {
26
- const relations = suggestedResolveRelations(outcome.entry.kind);
27
- content +=
28
- `\n\nChain next: \`code_graph({ target: { handle: "${outcome.entry.targetId}" }, ` +
29
- `relations: ${JSON.stringify(relations)} })\``;
30
- }
31
-
32
- return {
33
- content,
34
- details: { type: "resolve", data: assembly.details },
35
- };
36
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * TUI renderer for code_resolve — renderCall + renderResult.
3
- */
4
- import type { Theme } from "@earendil-works/pi-coding-agent";
5
- import { Text } from "@earendil-works/pi-tui";
6
- import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
7
- import type { CodeResolveToolParams } from "./execute.ts";
8
-
9
- /** ── renderCall ────────────────────────────────────────────────── */
10
-
11
- export function renderResolveCall(args: unknown, theme: Theme, _context: unknown): Text {
12
- const params = (args ?? {}) as CodeResolveToolParams;
13
-
14
- let content = theme.fg("toolTitle", "code_resolve");
15
-
16
- if ("symbol" in params.target) {
17
- content += ` ${theme.fg("accent", params.target.symbol.query)}`;
18
- if (params.target.symbol.symbolKind) {
19
- content += theme.fg("dim", ` [${params.target.symbol.symbolKind}]`);
20
- }
21
- } else if ("anchor" in params.target) {
22
- const point = params.target.anchor;
23
- const file = point.file.split("/").pop() ?? point.file;
24
- content += ` ${theme.fg("accent", file)}${theme.fg("warning", `:${point.line}`)}`;
25
- } else if ("file" in params.target) {
26
- const file = params.target.file.split("/").pop() ?? params.target.file;
27
- content += ` ${theme.fg("accent", file)}`;
28
- }
29
-
30
- return new Text(content, 0, 0);
31
- }
32
-
33
- /** ── renderResult ──────────────────────────────────────────────── */
34
-
35
- export function renderResolveResult(
36
- result: ToolResult,
37
- options: ResultOptios,
38
- theme: Theme,
39
- _context: unknown,
40
- ): ReturnType<typeof renderSimpleResult> {
41
- return renderSimpleResult(result, options, theme, "Resolving…");
42
- }
@@ -1,132 +0,0 @@
1
- import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
- import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
3
- import type { ReadNextItem } from "../../analysis/read-next.ts";
4
- import type {
5
- OrientationCandidate,
6
- OrientationResultData,
7
- OrientationSectionData,
8
- } from "../../session/orientation-types.ts";
9
- import type { TargetStoreEntry } from "../../session/target-store.ts";
10
- import {
11
- assembledNextQueries,
12
- assembledReadNext,
13
- assembleToolResult,
14
- type ResultSection,
15
- type ToolResultAssembly,
16
- } from "./assembly.ts";
17
- import type { ContextDetails, OrientationSectionDetails } from "./types.ts";
18
-
19
- export interface OrientationDetailsInput {
20
- readonly confidence: ConfidenceMode;
21
- readonly task?: string | null;
22
- readonly focusTarget?: string | null;
23
- readonly requestedSections?: readonly string[];
24
- readonly renderedSections?: readonly string[];
25
- readonly omittedCount?: number;
26
- readonly evidenceLists?: readonly EvidenceListMetadata[];
27
- readonly sections?: readonly OrientationSectionData[];
28
- readonly nextQueries: readonly string[];
29
- readonly readNext?: readonly ReadNextItem[];
30
- readonly target?: Readonly<TargetStoreEntry>;
31
- readonly candidates?: readonly OrientationCandidate[];
32
- readonly instructions?: OrientationResultData["instructions"];
33
- }
34
-
35
- export interface OrientationResultAssembly {
36
- readonly assembled: ToolResultAssembly<OrientationResultData>;
37
- readonly details: ContextDetails;
38
- }
39
-
40
- /** Assemble Orientation facts and shared result policy before rendering. */
41
- export function assembleOrientationResult(data: OrientationResultData): OrientationResultAssembly {
42
- const sections = data.sections.map(toResultSection);
43
- const evidenceLists = data.sections.flatMap((section) => section.evidenceLists);
44
- const assembled = assembleToolResult({
45
- data,
46
- sections,
47
- evidenceLists,
48
- nextQueries: data.nextQueries,
49
- readNext: data.readNext,
50
- confidence: data.confidence,
51
- provenance: uniqueProvenance(data.sections),
52
- });
53
- return {
54
- assembled,
55
- details: assembleOrientationDetails({
56
- confidence: assembled.confidence,
57
- focusTarget: assembled.data.focusTarget,
58
- requestedSections: assembled.data.requestedSections,
59
- renderedSections: assembled.data.renderedSections,
60
- omittedCount: assembled.totals.omittedCount,
61
- evidenceLists: assembled.evidenceLists,
62
- sections: assembled.data.sections,
63
- nextQueries: assembledNextQueries(assembled),
64
- readNext: assembledReadNext(assembled),
65
- target: assembled.data.target,
66
- instructions: assembled.data.instructions,
67
- }),
68
- };
69
- }
70
-
71
- /** Project canonical Orientation facts into structured Tool details. */
72
- export function assembleOrientationDetails(input: OrientationDetailsInput): ContextDetails {
73
- return {
74
- confidence: input.confidence,
75
- task: input.task ?? null,
76
- focusTarget: input.focusTarget ?? null,
77
- requestedSections: [...(input.requestedSections ?? [])],
78
- renderedSections: [...(input.renderedSections ?? [])],
79
- omittedCount: input.omittedCount ?? 0,
80
- evidenceLists: input.evidenceLists ? [...input.evidenceLists] : undefined,
81
- sections: input.sections?.map(toDetailsSection),
82
- nextQueries: [...input.nextQueries],
83
- readNext: input.readNext ? [...input.readNext] : undefined,
84
- target: input.target ? { ...input.target } : undefined,
85
- instructions: input.instructions,
86
- candidates: input.candidates?.map((candidate) => ({
87
- targetId: candidate.targetId,
88
- name: candidate.name,
89
- kind: candidate.kind,
90
- container: candidate.container,
91
- file: candidate.file,
92
- line: candidate.line,
93
- character: candidate.character,
94
- rank: candidate.rank,
95
- })),
96
- };
97
- }
98
-
99
- function toResultSection(section: OrientationSectionData): ResultSection {
100
- return {
101
- key: section.key,
102
- title: section.title,
103
- status: section.status,
104
- items: [section.key],
105
- confidence: section.confidence,
106
- provenance: section.provenance,
107
- };
108
- }
109
-
110
- function toDetailsSection(section: OrientationSectionData): OrientationSectionDetails {
111
- return {
112
- key: section.key,
113
- title: section.title,
114
- status: section.status,
115
- reason: section.reason,
116
- confidence: section.confidence,
117
- provenance: section.provenance.map((provenance) => ({ ...provenance })),
118
- evidenceLists: section.evidenceLists.map((evidence) => ({ ...evidence })),
119
- };
120
- }
121
-
122
- function uniqueProvenance(sections: readonly OrientationSectionData[]) {
123
- const seen = new Set<string>();
124
- return sections.flatMap((section) =>
125
- section.provenance.filter((provenance) => {
126
- const key = `${provenance.source}:${provenance.capability ?? ""}:${provenance.detail ?? ""}`;
127
- if (seen.has(key)) return false;
128
- seen.add(key);
129
- return true;
130
- }),
131
- );
132
- }
File without changes
File without changes
File without changes