@greppleai/grip 0.0.0-stage → 0.0.1

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 (1057) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +725 -2
  3. package/dist/bun/cli.d.ts +3 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +11 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/register-bedrock.d.ts +2 -0
  8. package/dist/bun/register-bedrock.d.ts.map +1 -0
  9. package/dist/bun/register-bedrock.js +4 -0
  10. package/dist/bun/register-bedrock.js.map +1 -0
  11. package/dist/bun/restore-sandbox-env.d.ts +13 -0
  12. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  13. package/dist/bun/restore-sandbox-env.js +32 -0
  14. package/dist/bun/restore-sandbox-env.js.map +1 -0
  15. package/dist/cli/args.d.ts +70 -0
  16. package/dist/cli/args.d.ts.map +1 -0
  17. package/dist/cli/args.js +441 -0
  18. package/dist/cli/args.js.map +1 -0
  19. package/dist/cli/config-selector.d.ts +14 -0
  20. package/dist/cli/config-selector.d.ts.map +1 -0
  21. package/dist/cli/config-selector.js +31 -0
  22. package/dist/cli/config-selector.js.map +1 -0
  23. package/dist/cli/file-processor.d.ts +15 -0
  24. package/dist/cli/file-processor.d.ts.map +1 -0
  25. package/dist/cli/file-processor.js +60 -0
  26. package/dist/cli/file-processor.js.map +1 -0
  27. package/dist/cli/initial-message.d.ts +18 -0
  28. package/dist/cli/initial-message.d.ts.map +1 -0
  29. package/dist/cli/initial-message.js +22 -0
  30. package/dist/cli/initial-message.js.map +1 -0
  31. package/dist/cli/list-models.d.ts +9 -0
  32. package/dist/cli/list-models.d.ts.map +1 -0
  33. package/dist/cli/list-models.js +98 -0
  34. package/dist/cli/list-models.js.map +1 -0
  35. package/dist/cli/session-picker.d.ts +9 -0
  36. package/dist/cli/session-picker.d.ts.map +1 -0
  37. package/dist/cli/session-picker.js +35 -0
  38. package/dist/cli/session-picker.js.map +1 -0
  39. package/dist/cli.d.ts +3 -0
  40. package/dist/cli.d.ts.map +1 -0
  41. package/dist/cli.js +14 -0
  42. package/dist/cli.js.map +1 -0
  43. package/dist/config.d.ts +82 -0
  44. package/dist/config.d.ts.map +1 -0
  45. package/dist/config.js +406 -0
  46. package/dist/config.js.map +1 -0
  47. package/dist/core/agent-session.d.ts +970 -0
  48. package/dist/core/agent-session.d.ts.map +1 -0
  49. package/dist/core/agent-session.js +5176 -0
  50. package/dist/core/agent-session.js.map +1 -0
  51. package/dist/core/auth-guidance.d.ts +5 -0
  52. package/dist/core/auth-guidance.d.ts.map +1 -0
  53. package/dist/core/auth-guidance.js +21 -0
  54. package/dist/core/auth-guidance.js.map +1 -0
  55. package/dist/core/auth-storage.d.ts +150 -0
  56. package/dist/core/auth-storage.d.ts.map +1 -0
  57. package/dist/core/auth-storage.js +557 -0
  58. package/dist/core/auth-storage.js.map +1 -0
  59. package/dist/core/bash-executor.d.ts +26 -0
  60. package/dist/core/bash-executor.d.ts.map +1 -0
  61. package/dist/core/bash-executor.js +99 -0
  62. package/dist/core/bash-executor.js.map +1 -0
  63. package/dist/core/compaction/branch-summarization.d.ts +83 -0
  64. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  65. package/dist/core/compaction/branch-summarization.js +220 -0
  66. package/dist/core/compaction/branch-summarization.js.map +1 -0
  67. package/dist/core/compaction/compaction.d.ts +65 -0
  68. package/dist/core/compaction/compaction.d.ts.map +1 -0
  69. package/dist/core/compaction/compaction.js +550 -0
  70. package/dist/core/compaction/compaction.js.map +1 -0
  71. package/dist/core/compaction/compression-detection-ledger.d.ts +34 -0
  72. package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -0
  73. package/dist/core/compaction/compression-detection-ledger.js +52 -0
  74. package/dist/core/compaction/compression-detection-ledger.js.map +1 -0
  75. package/dist/core/compaction/compression-detector.d.ts +71 -0
  76. package/dist/core/compaction/compression-detector.d.ts.map +1 -0
  77. package/dist/core/compaction/compression-detector.js +407 -0
  78. package/dist/core/compaction/compression-detector.js.map +1 -0
  79. package/dist/core/compaction/compression-economics.d.ts +55 -0
  80. package/dist/core/compaction/compression-economics.d.ts.map +1 -0
  81. package/dist/core/compaction/compression-economics.js +151 -0
  82. package/dist/core/compaction/compression-economics.js.map +1 -0
  83. package/dist/core/compaction/utils.d.ts +28 -0
  84. package/dist/core/compaction/utils.d.ts.map +1 -0
  85. package/dist/core/compaction/utils.js +165 -0
  86. package/dist/core/compaction/utils.js.map +1 -0
  87. package/dist/core/defaults.d.ts +3 -0
  88. package/dist/core/defaults.d.ts.map +1 -0
  89. package/dist/core/defaults.js +2 -0
  90. package/dist/core/defaults.js.map +1 -0
  91. package/dist/core/diagnostics.d.ts +18 -0
  92. package/dist/core/diagnostics.d.ts.map +1 -0
  93. package/dist/core/diagnostics.js +2 -0
  94. package/dist/core/diagnostics.js.map +1 -0
  95. package/dist/core/event-bus.d.ts +9 -0
  96. package/dist/core/event-bus.d.ts.map +1 -0
  97. package/dist/core/event-bus.js +25 -0
  98. package/dist/core/event-bus.js.map +1 -0
  99. package/dist/core/exec.d.ts +29 -0
  100. package/dist/core/exec.d.ts.map +1 -0
  101. package/dist/core/exec.js +75 -0
  102. package/dist/core/exec.js.map +1 -0
  103. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  104. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  105. package/dist/core/export-html/ansi-to-html.js +245 -0
  106. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  107. package/dist/core/export-html/index.d.ts +21 -0
  108. package/dist/core/export-html/index.d.ts.map +1 -0
  109. package/dist/core/export-html/index.js +230 -0
  110. package/dist/core/export-html/index.js.map +1 -0
  111. package/dist/core/export-html/template.css +1066 -0
  112. package/dist/core/export-html/template.html +55 -0
  113. package/dist/core/export-html/template.js +1864 -0
  114. package/dist/core/export-html/tool-renderer.d.ts +32 -0
  115. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  116. package/dist/core/export-html/tool-renderer.js +108 -0
  117. package/dist/core/export-html/tool-renderer.js.map +1 -0
  118. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  119. package/dist/core/export-html/vendor/marked.min.js +78 -0
  120. package/dist/core/extensions/loader.d.ts +24 -0
  121. package/dist/core/extensions/loader.d.ts.map +1 -0
  122. package/dist/core/extensions/loader.js +613 -0
  123. package/dist/core/extensions/loader.js.map +1 -0
  124. package/dist/core/extensions/runner.d.ts +160 -0
  125. package/dist/core/extensions/runner.d.ts.map +1 -0
  126. package/dist/core/extensions/runner.js +962 -0
  127. package/dist/core/extensions/runner.js.map +1 -0
  128. package/dist/core/extensions/types.d.ts +1311 -0
  129. package/dist/core/extensions/types.d.ts.map +1 -0
  130. package/dist/core/extensions/types.js +51 -0
  131. package/dist/core/extensions/types.js.map +1 -0
  132. package/dist/core/extensions/wrapper.d.ts +20 -0
  133. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  134. package/dist/core/extensions/wrapper.js +22 -0
  135. package/dist/core/extensions/wrapper.js.map +1 -0
  136. package/dist/core/footer-data-provider.d.ts +52 -0
  137. package/dist/core/footer-data-provider.d.ts.map +1 -0
  138. package/dist/core/footer-data-provider.js +318 -0
  139. package/dist/core/footer-data-provider.js.map +1 -0
  140. package/dist/core/grip-agent.d.ts +240 -0
  141. package/dist/core/grip-agent.d.ts.map +1 -0
  142. package/dist/core/grip-agent.js +1243 -0
  143. package/dist/core/grip-agent.js.map +1 -0
  144. package/dist/core/grip-manifest.d.ts +9 -0
  145. package/dist/core/grip-manifest.d.ts.map +1 -0
  146. package/dist/core/grip-manifest.js +25 -0
  147. package/dist/core/grip-manifest.js.map +1 -0
  148. package/dist/core/hooks/aggregate.d.ts +5 -0
  149. package/dist/core/hooks/aggregate.d.ts.map +1 -0
  150. package/dist/core/hooks/aggregate.js +226 -0
  151. package/dist/core/hooks/aggregate.js.map +1 -0
  152. package/dist/core/hooks/config.d.ts +14 -0
  153. package/dist/core/hooks/config.d.ts.map +1 -0
  154. package/dist/core/hooks/config.js +372 -0
  155. package/dist/core/hooks/config.js.map +1 -0
  156. package/dist/core/hooks/executor.d.ts +12 -0
  157. package/dist/core/hooks/executor.d.ts.map +1 -0
  158. package/dist/core/hooks/executor.js +708 -0
  159. package/dist/core/hooks/executor.js.map +1 -0
  160. package/dist/core/hooks/index.d.ts +9 -0
  161. package/dist/core/hooks/index.d.ts.map +1 -0
  162. package/dist/core/hooks/index.js +14 -0
  163. package/dist/core/hooks/index.js.map +1 -0
  164. package/dist/core/hooks/matcher.d.ts +10 -0
  165. package/dist/core/hooks/matcher.d.ts.map +1 -0
  166. package/dist/core/hooks/matcher.js +70 -0
  167. package/dist/core/hooks/matcher.js.map +1 -0
  168. package/dist/core/hooks/trust-store.d.ts +38 -0
  169. package/dist/core/hooks/trust-store.d.ts.map +1 -0
  170. package/dist/core/hooks/trust-store.js +167 -0
  171. package/dist/core/hooks/trust-store.js.map +1 -0
  172. package/dist/core/hooks/types.d.ts +234 -0
  173. package/dist/core/hooks/types.d.ts.map +1 -0
  174. package/dist/core/hooks/types.js +52 -0
  175. package/dist/core/hooks/types.js.map +1 -0
  176. package/dist/core/http-dispatcher.d.ts +21 -0
  177. package/dist/core/http-dispatcher.d.ts.map +1 -0
  178. package/dist/core/http-dispatcher.js +82 -0
  179. package/dist/core/http-dispatcher.js.map +1 -0
  180. package/dist/core/instruction-resource-loader.d.ts +81 -0
  181. package/dist/core/instruction-resource-loader.d.ts.map +1 -0
  182. package/dist/core/instruction-resource-loader.js +574 -0
  183. package/dist/core/instruction-resource-loader.js.map +1 -0
  184. package/dist/core/keybindings.d.ts +399 -0
  185. package/dist/core/keybindings.d.ts.map +1 -0
  186. package/dist/core/keybindings.js +299 -0
  187. package/dist/core/keybindings.js.map +1 -0
  188. package/dist/core/lsp/abort.d.ts +3 -0
  189. package/dist/core/lsp/abort.d.ts.map +1 -0
  190. package/dist/core/lsp/abort.js +28 -0
  191. package/dist/core/lsp/abort.js.map +1 -0
  192. package/dist/core/lsp/client.d.ts +108 -0
  193. package/dist/core/lsp/client.d.ts.map +1 -0
  194. package/dist/core/lsp/client.js +586 -0
  195. package/dist/core/lsp/client.js.map +1 -0
  196. package/dist/core/lsp/config-loader.d.ts +44 -0
  197. package/dist/core/lsp/config-loader.d.ts.map +1 -0
  198. package/dist/core/lsp/config-loader.js +223 -0
  199. package/dist/core/lsp/config-loader.js.map +1 -0
  200. package/dist/core/lsp/config.d.ts +134 -0
  201. package/dist/core/lsp/config.d.ts.map +1 -0
  202. package/dist/core/lsp/config.js +682 -0
  203. package/dist/core/lsp/config.js.map +1 -0
  204. package/dist/core/lsp/diagnostics.d.ts +18 -0
  205. package/dist/core/lsp/diagnostics.d.ts.map +1 -0
  206. package/dist/core/lsp/diagnostics.js +311 -0
  207. package/dist/core/lsp/diagnostics.js.map +1 -0
  208. package/dist/core/lsp/file-sync.d.ts +58 -0
  209. package/dist/core/lsp/file-sync.d.ts.map +1 -0
  210. package/dist/core/lsp/file-sync.js +432 -0
  211. package/dist/core/lsp/file-sync.js.map +1 -0
  212. package/dist/core/lsp/integration.d.ts +62 -0
  213. package/dist/core/lsp/integration.d.ts.map +1 -0
  214. package/dist/core/lsp/integration.js +145 -0
  215. package/dist/core/lsp/integration.js.map +1 -0
  216. package/dist/core/lsp/language-map.d.ts +54 -0
  217. package/dist/core/lsp/language-map.d.ts.map +1 -0
  218. package/dist/core/lsp/language-map.js +300 -0
  219. package/dist/core/lsp/language-map.js.map +1 -0
  220. package/dist/core/lsp/manager.d.ts +120 -0
  221. package/dist/core/lsp/manager.d.ts.map +1 -0
  222. package/dist/core/lsp/manager.js +636 -0
  223. package/dist/core/lsp/manager.js.map +1 -0
  224. package/dist/core/lsp/navigation.d.ts +32 -0
  225. package/dist/core/lsp/navigation.d.ts.map +1 -0
  226. package/dist/core/lsp/navigation.js +327 -0
  227. package/dist/core/lsp/navigation.js.map +1 -0
  228. package/dist/core/lsp/portable-path.d.ts +18 -0
  229. package/dist/core/lsp/portable-path.d.ts.map +1 -0
  230. package/dist/core/lsp/portable-path.js +83 -0
  231. package/dist/core/lsp/portable-path.js.map +1 -0
  232. package/dist/core/lsp/refactor.d.ts +32 -0
  233. package/dist/core/lsp/refactor.d.ts.map +1 -0
  234. package/dist/core/lsp/refactor.js +519 -0
  235. package/dist/core/lsp/refactor.js.map +1 -0
  236. package/dist/core/lsp/transport.d.ts +39 -0
  237. package/dist/core/lsp/transport.d.ts.map +1 -0
  238. package/dist/core/lsp/transport.js +261 -0
  239. package/dist/core/lsp/transport.js.map +1 -0
  240. package/dist/core/messages.d.ts +34 -0
  241. package/dist/core/messages.d.ts.map +1 -0
  242. package/dist/core/messages.js +140 -0
  243. package/dist/core/messages.js.map +1 -0
  244. package/dist/core/model-registry.d.ts +148 -0
  245. package/dist/core/model-registry.d.ts.map +1 -0
  246. package/dist/core/model-registry.js +812 -0
  247. package/dist/core/model-registry.js.map +1 -0
  248. package/dist/core/model-resolver.d.ts +115 -0
  249. package/dist/core/model-resolver.d.ts.map +1 -0
  250. package/dist/core/model-resolver.js +498 -0
  251. package/dist/core/model-resolver.js.map +1 -0
  252. package/dist/core/output-guard.d.ts +7 -0
  253. package/dist/core/output-guard.d.ts.map +1 -0
  254. package/dist/core/output-guard.js +89 -0
  255. package/dist/core/output-guard.js.map +1 -0
  256. package/dist/core/package-manager.d.ts +209 -0
  257. package/dist/core/package-manager.d.ts.map +1 -0
  258. package/dist/core/package-manager.js +2341 -0
  259. package/dist/core/package-manager.js.map +1 -0
  260. package/dist/core/prompt-templates.d.ts +57 -0
  261. package/dist/core/prompt-templates.d.ts.map +1 -0
  262. package/dist/core/prompt-templates.js +353 -0
  263. package/dist/core/prompt-templates.js.map +1 -0
  264. package/dist/core/provider-display-names.d.ts +2 -0
  265. package/dist/core/provider-display-names.d.ts.map +1 -0
  266. package/dist/core/provider-display-names.js +33 -0
  267. package/dist/core/provider-display-names.js.map +1 -0
  268. package/dist/core/remote-workspace-protocol/contract.d.ts +456 -0
  269. package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -0
  270. package/dist/core/remote-workspace-protocol/contract.js +809 -0
  271. package/dist/core/remote-workspace-protocol/contract.js.map +1 -0
  272. package/dist/core/remote-workspace-protocol/session.d.ts +247 -0
  273. package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -0
  274. package/dist/core/remote-workspace-protocol/session.js +1839 -0
  275. package/dist/core/remote-workspace-protocol/session.js.map +1 -0
  276. package/dist/core/resolve-config-value.d.ts +32 -0
  277. package/dist/core/resolve-config-value.d.ts.map +1 -0
  278. package/dist/core/resolve-config-value.js +257 -0
  279. package/dist/core/resolve-config-value.js.map +1 -0
  280. package/dist/core/resource-loader.d.ts +200 -0
  281. package/dist/core/resource-loader.d.ts.map +1 -0
  282. package/dist/core/resource-loader.js +1209 -0
  283. package/dist/core/resource-loader.js.map +1 -0
  284. package/dist/core/rules.d.ts +40 -0
  285. package/dist/core/rules.d.ts.map +1 -0
  286. package/dist/core/rules.js +57 -0
  287. package/dist/core/rules.js.map +1 -0
  288. package/dist/core/sandbox/command.d.ts +27 -0
  289. package/dist/core/sandbox/command.d.ts.map +1 -0
  290. package/dist/core/sandbox/command.js +124 -0
  291. package/dist/core/sandbox/command.js.map +1 -0
  292. package/dist/core/sandbox/docker.d.ts +169 -0
  293. package/dist/core/sandbox/docker.d.ts.map +1 -0
  294. package/dist/core/sandbox/docker.js +633 -0
  295. package/dist/core/sandbox/docker.js.map +1 -0
  296. package/dist/core/sandbox/lima.d.ts +38 -0
  297. package/dist/core/sandbox/lima.d.ts.map +1 -0
  298. package/dist/core/sandbox/lima.js +324 -0
  299. package/dist/core/sandbox/lima.js.map +1 -0
  300. package/dist/core/session/constants.d.ts +2 -0
  301. package/dist/core/session/constants.d.ts.map +1 -0
  302. package/dist/core/session/constants.js +2 -0
  303. package/dist/core/session/constants.js.map +1 -0
  304. package/dist/core/session/context-metadata.d.ts +5 -0
  305. package/dist/core/session/context-metadata.d.ts.map +1 -0
  306. package/dist/core/session/context-metadata.js +55 -0
  307. package/dist/core/session/context-metadata.js.map +1 -0
  308. package/dist/core/session/context.d.ts +14 -0
  309. package/dist/core/session/context.d.ts.map +1 -0
  310. package/dist/core/session/context.js +117 -0
  311. package/dist/core/session/context.js.map +1 -0
  312. package/dist/core/session/ids.d.ts +9 -0
  313. package/dist/core/session/ids.d.ts.map +1 -0
  314. package/dist/core/session/ids.js +21 -0
  315. package/dist/core/session/ids.js.map +1 -0
  316. package/dist/core/session/in-memory-session-manager.d.ts +17 -0
  317. package/dist/core/session/in-memory-session-manager.d.ts.map +1 -0
  318. package/dist/core/session/in-memory-session-manager.js +40 -0
  319. package/dist/core/session/in-memory-session-manager.js.map +1 -0
  320. package/dist/core/session/in-memory-session.d.ts +7 -0
  321. package/dist/core/session/in-memory-session.d.ts.map +1 -0
  322. package/dist/core/session/in-memory-session.js +11 -0
  323. package/dist/core/session/in-memory-session.js.map +1 -0
  324. package/dist/core/session/jsonl-errors.d.ts +36 -0
  325. package/dist/core/session/jsonl-errors.d.ts.map +1 -0
  326. package/dist/core/session/jsonl-errors.js +49 -0
  327. package/dist/core/session/jsonl-errors.js.map +1 -0
  328. package/dist/core/session/jsonl-helpers.d.ts +20 -0
  329. package/dist/core/session/jsonl-helpers.d.ts.map +1 -0
  330. package/dist/core/session/jsonl-helpers.js +21 -0
  331. package/dist/core/session/jsonl-helpers.js.map +1 -0
  332. package/dist/core/session/local-session-manager.d.ts +30 -0
  333. package/dist/core/session/local-session-manager.d.ts.map +1 -0
  334. package/dist/core/session/local-session-manager.js +205 -0
  335. package/dist/core/session/local-session-manager.js.map +1 -0
  336. package/dist/core/session/local-session.d.ts +9 -0
  337. package/dist/core/session/local-session.d.ts.map +1 -0
  338. package/dist/core/session/local-session.js +15 -0
  339. package/dist/core/session/local-session.js.map +1 -0
  340. package/dist/core/session/migrations.d.ts +11 -0
  341. package/dist/core/session/migrations.d.ts.map +1 -0
  342. package/dist/core/session/migrations.js +78 -0
  343. package/dist/core/session/migrations.js.map +1 -0
  344. package/dist/core/session/remote-session-client.d.ts +83 -0
  345. package/dist/core/session/remote-session-client.d.ts.map +1 -0
  346. package/dist/core/session/remote-session-client.js +224 -0
  347. package/dist/core/session/remote-session-client.js.map +1 -0
  348. package/dist/core/session/remote-session-manager.d.ts +32 -0
  349. package/dist/core/session/remote-session-manager.d.ts.map +1 -0
  350. package/dist/core/session/remote-session-manager.js +124 -0
  351. package/dist/core/session/remote-session-manager.js.map +1 -0
  352. package/dist/core/session/remote-session.d.ts +20 -0
  353. package/dist/core/session/remote-session.d.ts.map +1 -0
  354. package/dist/core/session/remote-session.js +33 -0
  355. package/dist/core/session/remote-session.js.map +1 -0
  356. package/dist/core/session/session-manager.d.ts +18 -0
  357. package/dist/core/session/session-manager.d.ts.map +1 -0
  358. package/dist/core/session/session-manager.js +2 -0
  359. package/dist/core/session/session-manager.js.map +1 -0
  360. package/dist/core/session/session.d.ts +140 -0
  361. package/dist/core/session/session.d.ts.map +1 -0
  362. package/dist/core/session/session.js +461 -0
  363. package/dist/core/session/session.js.map +1 -0
  364. package/dist/core/session/stores/in-memory-session-store.d.ts +39 -0
  365. package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -0
  366. package/dist/core/session/stores/in-memory-session-store.js +168 -0
  367. package/dist/core/session/stores/in-memory-session-store.js.map +1 -0
  368. package/dist/core/session/stores/jsonl-session-store.d.ts +97 -0
  369. package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -0
  370. package/dist/core/session/stores/jsonl-session-store.js +1140 -0
  371. package/dist/core/session/stores/jsonl-session-store.js.map +1 -0
  372. package/dist/core/session/stores/remote-session-store.d.ts +44 -0
  373. package/dist/core/session/stores/remote-session-store.d.ts.map +1 -0
  374. package/dist/core/session/stores/remote-session-store.js +159 -0
  375. package/dist/core/session/stores/remote-session-store.js.map +1 -0
  376. package/dist/core/session/stores/session-store.d.ts +42 -0
  377. package/dist/core/session/stores/session-store.d.ts.map +1 -0
  378. package/dist/core/session/stores/session-store.js +2 -0
  379. package/dist/core/session/stores/session-store.js.map +1 -0
  380. package/dist/core/session/types.d.ts +141 -0
  381. package/dist/core/session/types.d.ts.map +1 -0
  382. package/dist/core/session/types.js +2 -0
  383. package/dist/core/session/types.js.map +1 -0
  384. package/dist/core/session/usage-ledger.d.ts +18 -0
  385. package/dist/core/session/usage-ledger.d.ts.map +1 -0
  386. package/dist/core/session/usage-ledger.js +68 -0
  387. package/dist/core/session/usage-ledger.js.map +1 -0
  388. package/dist/core/session-cwd.d.ts +19 -0
  389. package/dist/core/session-cwd.d.ts.map +1 -0
  390. package/dist/core/session-cwd.js +38 -0
  391. package/dist/core/session-cwd.js.map +1 -0
  392. package/dist/core/settings-manager.d.ts +318 -0
  393. package/dist/core/settings-manager.d.ts.map +1 -0
  394. package/dist/core/settings-manager.js +991 -0
  395. package/dist/core/settings-manager.js.map +1 -0
  396. package/dist/core/skills.d.ts +40 -0
  397. package/dist/core/skills.d.ts.map +1 -0
  398. package/dist/core/skills.js +57 -0
  399. package/dist/core/skills.js.map +1 -0
  400. package/dist/core/slash-commands.d.ts +15 -0
  401. package/dist/core/slash-commands.d.ts.map +1 -0
  402. package/dist/core/slash-commands.js +36 -0
  403. package/dist/core/slash-commands.js.map +1 -0
  404. package/dist/core/source-info.d.ts +26 -0
  405. package/dist/core/source-info.d.ts.map +1 -0
  406. package/dist/core/source-info.js +27 -0
  407. package/dist/core/source-info.js.map +1 -0
  408. package/dist/core/system-prompt.d.ts +32 -0
  409. package/dist/core/system-prompt.d.ts.map +1 -0
  410. package/dist/core/system-prompt.js +131 -0
  411. package/dist/core/system-prompt.js.map +1 -0
  412. package/dist/core/telemetry.d.ts +3 -0
  413. package/dist/core/telemetry.d.ts.map +1 -0
  414. package/dist/core/telemetry.js +9 -0
  415. package/dist/core/telemetry.js.map +1 -0
  416. package/dist/core/timings.d.ts +10 -0
  417. package/dist/core/timings.d.ts.map +1 -0
  418. package/dist/core/timings.js +41 -0
  419. package/dist/core/timings.js.map +1 -0
  420. package/dist/core/tools/bash.d.ts +51 -0
  421. package/dist/core/tools/bash.d.ts.map +1 -0
  422. package/dist/core/tools/bash.js +310 -0
  423. package/dist/core/tools/bash.js.map +1 -0
  424. package/dist/core/tools/compress-context.d.ts +27 -0
  425. package/dist/core/tools/compress-context.d.ts.map +1 -0
  426. package/dist/core/tools/compress-context.js +142 -0
  427. package/dist/core/tools/compress-context.js.map +1 -0
  428. package/dist/core/tools/edit-diff.d.ts +82 -0
  429. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  430. package/dist/core/tools/edit-diff.js +327 -0
  431. package/dist/core/tools/edit-diff.js.map +1 -0
  432. package/dist/core/tools/edit.d.ts +50 -0
  433. package/dist/core/tools/edit.d.ts.map +1 -0
  434. package/dist/core/tools/edit.js +324 -0
  435. package/dist/core/tools/edit.js.map +1 -0
  436. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  437. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  438. package/dist/core/tools/file-mutation-queue.js +60 -0
  439. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  440. package/dist/core/tools/find.d.ts +22 -0
  441. package/dist/core/tools/find.d.ts.map +1 -0
  442. package/dist/core/tools/find.js +268 -0
  443. package/dist/core/tools/find.js.map +1 -0
  444. package/dist/core/tools/grep.d.ts +27 -0
  445. package/dist/core/tools/grep.d.ts.map +1 -0
  446. package/dist/core/tools/grep.js +332 -0
  447. package/dist/core/tools/grep.js.map +1 -0
  448. package/dist/core/tools/hash-store.d.ts +12 -0
  449. package/dist/core/tools/hash-store.d.ts.map +1 -0
  450. package/dist/core/tools/hash-store.js +48 -0
  451. package/dist/core/tools/hash-store.js.map +1 -0
  452. package/dist/core/tools/hashline/apply.d.ts +40 -0
  453. package/dist/core/tools/hashline/apply.d.ts.map +1 -0
  454. package/dist/core/tools/hashline/apply.js +261 -0
  455. package/dist/core/tools/hashline/apply.js.map +1 -0
  456. package/dist/core/tools/hashline/hash.d.ts +56 -0
  457. package/dist/core/tools/hashline/hash.d.ts.map +1 -0
  458. package/dist/core/tools/hashline/hash.js +196 -0
  459. package/dist/core/tools/hashline/hash.js.map +1 -0
  460. package/dist/core/tools/hashline/parse.d.ts +8 -0
  461. package/dist/core/tools/hashline/parse.d.ts.map +1 -0
  462. package/dist/core/tools/hashline/parse.js +41 -0
  463. package/dist/core/tools/hashline/parse.js.map +1 -0
  464. package/dist/core/tools/hashline/resolve.d.ts +51 -0
  465. package/dist/core/tools/hashline/resolve.d.ts.map +1 -0
  466. package/dist/core/tools/hashline/resolve.js +187 -0
  467. package/dist/core/tools/hashline/resolve.js.map +1 -0
  468. package/dist/core/tools/hashline-utils.d.ts +6 -0
  469. package/dist/core/tools/hashline-utils.d.ts.map +1 -0
  470. package/dist/core/tools/hashline-utils.js +23 -0
  471. package/dist/core/tools/hashline-utils.js.map +1 -0
  472. package/dist/core/tools/index.d.ts +36 -0
  473. package/dist/core/tools/index.d.ts.map +1 -0
  474. package/dist/core/tools/index.js +141 -0
  475. package/dist/core/tools/index.js.map +1 -0
  476. package/dist/core/tools/ls.d.ts +21 -0
  477. package/dist/core/tools/ls.d.ts.map +1 -0
  478. package/dist/core/tools/ls.js +156 -0
  479. package/dist/core/tools/ls.js.map +1 -0
  480. package/dist/core/tools/operations.d.ts +201 -0
  481. package/dist/core/tools/operations.d.ts.map +1 -0
  482. package/dist/core/tools/operations.js +697 -0
  483. package/dist/core/tools/operations.js.map +1 -0
  484. package/dist/core/tools/output-accumulator.d.ts +54 -0
  485. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  486. package/dist/core/tools/output-accumulator.js +184 -0
  487. package/dist/core/tools/output-accumulator.js.map +1 -0
  488. package/dist/core/tools/path-utils.d.ts +9 -0
  489. package/dist/core/tools/path-utils.d.ts.map +1 -0
  490. package/dist/core/tools/path-utils.js +99 -0
  491. package/dist/core/tools/path-utils.js.map +1 -0
  492. package/dist/core/tools/read.d.ts +32 -0
  493. package/dist/core/tools/read.d.ts.map +1 -0
  494. package/dist/core/tools/read.js +318 -0
  495. package/dist/core/tools/read.js.map +1 -0
  496. package/dist/core/tools/render-utils.d.ts +33 -0
  497. package/dist/core/tools/render-utils.d.ts.map +1 -0
  498. package/dist/core/tools/render-utils.js +61 -0
  499. package/dist/core/tools/render-utils.js.map +1 -0
  500. package/dist/core/tools/replace-diff.d.ts +16 -0
  501. package/dist/core/tools/replace-diff.d.ts.map +1 -0
  502. package/dist/core/tools/replace-diff.js +117 -0
  503. package/dist/core/tools/replace-diff.js.map +1 -0
  504. package/dist/core/tools/replace-normalize.d.ts +2 -0
  505. package/dist/core/tools/replace-normalize.d.ts.map +1 -0
  506. package/dist/core/tools/replace-normalize.js +73 -0
  507. package/dist/core/tools/replace-normalize.js.map +1 -0
  508. package/dist/core/tools/replace-render.d.ts +51 -0
  509. package/dist/core/tools/replace-render.d.ts.map +1 -0
  510. package/dist/core/tools/replace-render.js +162 -0
  511. package/dist/core/tools/replace-render.js.map +1 -0
  512. package/dist/core/tools/runtime.d.ts +2 -0
  513. package/dist/core/tools/runtime.d.ts.map +1 -0
  514. package/dist/core/tools/runtime.js +6 -0
  515. package/dist/core/tools/runtime.js.map +1 -0
  516. package/dist/core/tools/session-history.d.ts +55 -0
  517. package/dist/core/tools/session-history.d.ts.map +1 -0
  518. package/dist/core/tools/session-history.js +649 -0
  519. package/dist/core/tools/session-history.js.map +1 -0
  520. package/dist/core/tools/subagent-agents.d.ts +29 -0
  521. package/dist/core/tools/subagent-agents.d.ts.map +1 -0
  522. package/dist/core/tools/subagent-agents.js +223 -0
  523. package/dist/core/tools/subagent-agents.js.map +1 -0
  524. package/dist/core/tools/subagent.d.ts +185 -0
  525. package/dist/core/tools/subagent.d.ts.map +1 -0
  526. package/dist/core/tools/subagent.js +1309 -0
  527. package/dist/core/tools/subagent.js.map +1 -0
  528. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  529. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  530. package/dist/core/tools/tool-definition-wrapper.js +34 -0
  531. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  532. package/dist/core/tools/truncate.d.ts +39 -0
  533. package/dist/core/tools/truncate.d.ts.map +1 -0
  534. package/dist/core/tools/truncate.js +215 -0
  535. package/dist/core/tools/truncate.js.map +1 -0
  536. package/dist/core/tools/websearch.d.ts +33 -0
  537. package/dist/core/tools/websearch.d.ts.map +1 -0
  538. package/dist/core/tools/websearch.js +341 -0
  539. package/dist/core/tools/websearch.js.map +1 -0
  540. package/dist/core/tools/workspace-tool-host.d.ts +102 -0
  541. package/dist/core/tools/workspace-tool-host.d.ts.map +1 -0
  542. package/dist/core/tools/workspace-tool-host.js +348 -0
  543. package/dist/core/tools/workspace-tool-host.js.map +1 -0
  544. package/dist/core/tools/write.d.ts +16 -0
  545. package/dist/core/tools/write.d.ts.map +1 -0
  546. package/dist/core/tools/write.js +204 -0
  547. package/dist/core/tools/write.js.map +1 -0
  548. package/dist/core/workspace-identity.d.ts +7 -0
  549. package/dist/core/workspace-identity.d.ts.map +1 -0
  550. package/dist/core/workspace-identity.js +2 -0
  551. package/dist/core/workspace-identity.js.map +1 -0
  552. package/dist/daemon/command.d.ts +6 -0
  553. package/dist/daemon/command.d.ts.map +1 -0
  554. package/dist/daemon/command.js +58 -0
  555. package/dist/daemon/command.js.map +1 -0
  556. package/dist/daemon/config.d.ts +43 -0
  557. package/dist/daemon/config.d.ts.map +1 -0
  558. package/dist/daemon/config.js +304 -0
  559. package/dist/daemon/config.js.map +1 -0
  560. package/dist/daemon/help.d.ts +2 -0
  561. package/dist/daemon/help.d.ts.map +1 -0
  562. package/dist/daemon/help.js +42 -0
  563. package/dist/daemon/help.js.map +1 -0
  564. package/dist/daemon/lsp-config.d.ts +4 -0
  565. package/dist/daemon/lsp-config.d.ts.map +1 -0
  566. package/dist/daemon/lsp-config.js +155 -0
  567. package/dist/daemon/lsp-config.js.map +1 -0
  568. package/dist/daemon/security.d.ts +19 -0
  569. package/dist/daemon/security.d.ts.map +1 -0
  570. package/dist/daemon/security.js +175 -0
  571. package/dist/daemon/security.js.map +1 -0
  572. package/dist/daemon/server.d.ts +20 -0
  573. package/dist/daemon/server.d.ts.map +1 -0
  574. package/dist/daemon/server.js +400 -0
  575. package/dist/daemon/server.js.map +1 -0
  576. package/dist/daemon/workspace-runtime.d.ts +46 -0
  577. package/dist/daemon/workspace-runtime.d.ts.map +1 -0
  578. package/dist/daemon/workspace-runtime.js +673 -0
  579. package/dist/daemon/workspace-runtime.js.map +1 -0
  580. package/dist/index.d.ts +109 -0
  581. package/dist/index.d.ts.map +1 -0
  582. package/dist/index.js +107 -0
  583. package/dist/index.js.map +1 -0
  584. package/dist/main.d.ts +39 -0
  585. package/dist/main.d.ts.map +1 -0
  586. package/dist/main.js +763 -0
  587. package/dist/main.js.map +1 -0
  588. package/dist/migrations.d.ts +35 -0
  589. package/dist/migrations.d.ts.map +1 -0
  590. package/dist/migrations.js +412 -0
  591. package/dist/migrations.js.map +1 -0
  592. package/dist/modes/interactive/components/assistant-message.d.ts +29 -0
  593. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  594. package/dist/modes/interactive/components/assistant-message.js +149 -0
  595. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  596. package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
  597. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  598. package/dist/modes/interactive/components/bash-execution.js +173 -0
  599. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  600. package/dist/modes/interactive/components/bordered-loader.d.ts +18 -0
  601. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  602. package/dist/modes/interactive/components/bordered-loader.js +54 -0
  603. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  604. package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  605. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  606. package/dist/modes/interactive/components/branch-summary-message.js +44 -0
  607. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  608. package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  609. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  610. package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  611. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  612. package/dist/modes/interactive/components/config-selector.d.ts +74 -0
  613. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  614. package/dist/modes/interactive/components/config-selector.js +514 -0
  615. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  616. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  617. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  618. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  619. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  620. package/dist/modes/interactive/components/custom-editor.d.ts +25 -0
  621. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  622. package/dist/modes/interactive/components/custom-editor.js +85 -0
  623. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  624. package/dist/modes/interactive/components/custom-message.d.ts +20 -0
  625. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  626. package/dist/modes/interactive/components/custom-message.js +80 -0
  627. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  628. package/dist/modes/interactive/components/diff.d.ts +12 -0
  629. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  630. package/dist/modes/interactive/components/diff.js +118 -0
  631. package/dist/modes/interactive/components/diff.js.map +1 -0
  632. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  633. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  634. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  635. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  636. package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
  637. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  638. package/dist/modes/interactive/components/extension-editor.js +128 -0
  639. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  640. package/dist/modes/interactive/components/extension-input.d.ts +23 -0
  641. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  642. package/dist/modes/interactive/components/extension-input.js +61 -0
  643. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  644. package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  645. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  646. package/dist/modes/interactive/components/extension-selector.js +83 -0
  647. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  648. package/dist/modes/interactive/components/footer.d.ts +36 -0
  649. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  650. package/dist/modes/interactive/components/footer.js +227 -0
  651. package/dist/modes/interactive/components/footer.js.map +1 -0
  652. package/dist/modes/interactive/components/hook-execution.d.ts +19 -0
  653. package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -0
  654. package/dist/modes/interactive/components/hook-execution.js +184 -0
  655. package/dist/modes/interactive/components/hook-execution.js.map +1 -0
  656. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  657. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  658. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  659. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  660. package/dist/modes/interactive/components/login-dialog.d.ts +55 -0
  661. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  662. package/dist/modes/interactive/components/login-dialog.js +176 -0
  663. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  664. package/dist/modes/interactive/components/markdown-transform.d.ts +4 -0
  665. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  666. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  667. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  668. package/dist/modes/interactive/components/mermaid.d.ts +14 -0
  669. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  670. package/dist/modes/interactive/components/mermaid.js +228 -0
  671. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  672. package/dist/modes/interactive/components/model-selector.d.ts +52 -0
  673. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  674. package/dist/modes/interactive/components/model-selector.js +296 -0
  675. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  676. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  677. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  678. package/dist/modes/interactive/components/oauth-selector.js +165 -0
  679. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  680. package/dist/modes/interactive/components/scoped-models-selector.d.ts +50 -0
  681. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  682. package/dist/modes/interactive/components/scoped-models-selector.js +300 -0
  683. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  684. package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
  685. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  686. package/dist/modes/interactive/components/session-selector-search.js +144 -0
  687. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  688. package/dist/modes/interactive/components/session-selector.d.ts +108 -0
  689. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  690. package/dist/modes/interactive/components/session-selector.js +835 -0
  691. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  692. package/dist/modes/interactive/components/settings-selector.d.ts +81 -0
  693. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  694. package/dist/modes/interactive/components/settings-selector.js +455 -0
  695. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  696. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  697. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  698. package/dist/modes/interactive/components/show-images-selector.js +39 -0
  699. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  700. package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  701. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  702. package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  703. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  704. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  705. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  706. package/dist/modes/interactive/components/theme-selector.js +50 -0
  707. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  708. package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  709. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  710. package/dist/modes/interactive/components/thinking-selector.js +51 -0
  711. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  712. package/dist/modes/interactive/components/tool-execution.d.ts +67 -0
  713. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  714. package/dist/modes/interactive/components/tool-execution.js +306 -0
  715. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  716. package/dist/modes/interactive/components/tree-selector.d.ts +127 -0
  717. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  718. package/dist/modes/interactive/components/tree-selector.js +1098 -0
  719. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  720. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  721. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  722. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  723. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  724. package/dist/modes/interactive/components/user-message.d.ts +16 -0
  725. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  726. package/dist/modes/interactive/components/user-message.js +49 -0
  727. package/dist/modes/interactive/components/user-message.js.map +1 -0
  728. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  729. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  730. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  731. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  732. package/dist/modes/interactive/interactive-mode.d.ts +557 -0
  733. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  734. package/dist/modes/interactive/interactive-mode.js +5859 -0
  735. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  736. package/dist/modes/interactive/theme/dark.json +86 -0
  737. package/dist/modes/interactive/theme/light.json +85 -0
  738. package/dist/modes/interactive/theme/theme-schema.json +335 -0
  739. package/dist/modes/interactive/theme/theme.d.ts +106 -0
  740. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  741. package/dist/modes/interactive/theme/theme.js +1030 -0
  742. package/dist/modes/interactive/theme/theme.js.map +1 -0
  743. package/dist/modes/json-event.d.ts +28 -0
  744. package/dist/modes/json-event.d.ts.map +1 -0
  745. package/dist/modes/json-event.js +12 -0
  746. package/dist/modes/json-event.js.map +1 -0
  747. package/dist/modes/print-mode.d.ts +29 -0
  748. package/dist/modes/print-mode.d.ts.map +1 -0
  749. package/dist/modes/print-mode.js +142 -0
  750. package/dist/modes/print-mode.js.map +1 -0
  751. package/dist/modes/rpc/jsonl.d.ts +17 -0
  752. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  753. package/dist/modes/rpc/jsonl.js +49 -0
  754. package/dist/modes/rpc/jsonl.js.map +1 -0
  755. package/dist/modes/rpc/rpc-client.d.ts +321 -0
  756. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  757. package/dist/modes/rpc/rpc-client.js +755 -0
  758. package/dist/modes/rpc/rpc-client.js.map +1 -0
  759. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  760. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  761. package/dist/modes/rpc/rpc-mode.js +963 -0
  762. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  763. package/dist/modes/rpc/rpc-types.d.ts +652 -0
  764. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  765. package/dist/modes/rpc/rpc-types.js +8 -0
  766. package/dist/modes/rpc/rpc-types.js.map +1 -0
  767. package/dist/package-manager-cli.d.ts +4 -0
  768. package/dist/package-manager-cli.d.ts.map +1 -0
  769. package/dist/package-manager-cli.js +488 -0
  770. package/dist/package-manager-cli.js.map +1 -0
  771. package/dist/utils/ansi.d.ts +2 -0
  772. package/dist/utils/ansi.d.ts.map +1 -0
  773. package/dist/utils/ansi.js +25 -0
  774. package/dist/utils/ansi.js.map +1 -0
  775. package/dist/utils/changelog.d.ts +23 -0
  776. package/dist/utils/changelog.d.ts.map +1 -0
  777. package/dist/utils/changelog.js +74 -0
  778. package/dist/utils/changelog.js.map +1 -0
  779. package/dist/utils/child-process.d.ts +15 -0
  780. package/dist/utils/child-process.d.ts.map +1 -0
  781. package/dist/utils/child-process.js +88 -0
  782. package/dist/utils/child-process.js.map +1 -0
  783. package/dist/utils/clipboard-image.d.ts +13 -0
  784. package/dist/utils/clipboard-image.d.ts.map +1 -0
  785. package/dist/utils/clipboard-image.js +248 -0
  786. package/dist/utils/clipboard-image.js.map +1 -0
  787. package/dist/utils/clipboard-native.d.ts +11 -0
  788. package/dist/utils/clipboard-native.d.ts.map +1 -0
  789. package/dist/utils/clipboard-native.js +20 -0
  790. package/dist/utils/clipboard-native.js.map +1 -0
  791. package/dist/utils/clipboard.d.ts +4 -0
  792. package/dist/utils/clipboard.d.ts.map +1 -0
  793. package/dist/utils/clipboard.js +171 -0
  794. package/dist/utils/clipboard.js.map +1 -0
  795. package/dist/utils/deprecation.d.ts +4 -0
  796. package/dist/utils/deprecation.d.ts.map +1 -0
  797. package/dist/utils/deprecation.js +13 -0
  798. package/dist/utils/deprecation.js.map +1 -0
  799. package/dist/utils/directory-completions.d.ts +5 -0
  800. package/dist/utils/directory-completions.d.ts.map +1 -0
  801. package/dist/utils/directory-completions.js +64 -0
  802. package/dist/utils/directory-completions.js.map +1 -0
  803. package/dist/utils/exif-orientation.d.ts +6 -0
  804. package/dist/utils/exif-orientation.d.ts.map +1 -0
  805. package/dist/utils/exif-orientation.js +166 -0
  806. package/dist/utils/exif-orientation.js.map +1 -0
  807. package/dist/utils/frontmatter.d.ts +8 -0
  808. package/dist/utils/frontmatter.d.ts.map +1 -0
  809. package/dist/utils/frontmatter.js +26 -0
  810. package/dist/utils/frontmatter.js.map +1 -0
  811. package/dist/utils/fs-watch.d.ts +5 -0
  812. package/dist/utils/fs-watch.d.ts.map +1 -0
  813. package/dist/utils/fs-watch.js +25 -0
  814. package/dist/utils/fs-watch.js.map +1 -0
  815. package/dist/utils/git.d.ts +27 -0
  816. package/dist/utils/git.d.ts.map +1 -0
  817. package/dist/utils/git.js +237 -0
  818. package/dist/utils/git.js.map +1 -0
  819. package/dist/utils/grip-user-agent.d.ts +2 -0
  820. package/dist/utils/grip-user-agent.d.ts.map +1 -0
  821. package/dist/utils/grip-user-agent.js +5 -0
  822. package/dist/utils/grip-user-agent.js.map +1 -0
  823. package/dist/utils/html.d.ts +7 -0
  824. package/dist/utils/html.d.ts.map +1 -0
  825. package/dist/utils/html.js +40 -0
  826. package/dist/utils/html.js.map +1 -0
  827. package/dist/utils/image-convert.d.ts +12 -0
  828. package/dist/utils/image-convert.d.ts.map +1 -0
  829. package/dist/utils/image-convert.js +43 -0
  830. package/dist/utils/image-convert.js.map +1 -0
  831. package/dist/utils/image-process.d.ts +18 -0
  832. package/dist/utils/image-process.d.ts.map +1 -0
  833. package/dist/utils/image-process.js +83 -0
  834. package/dist/utils/image-process.js.map +1 -0
  835. package/dist/utils/image-resize-core.d.ts +30 -0
  836. package/dist/utils/image-resize-core.d.ts.map +1 -0
  837. package/dist/utils/image-resize-core.js +133 -0
  838. package/dist/utils/image-resize-core.js.map +1 -0
  839. package/dist/utils/image-resize-worker.d.ts +2 -0
  840. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  841. package/dist/utils/image-resize-worker.js +31 -0
  842. package/dist/utils/image-resize-worker.js.map +1 -0
  843. package/dist/utils/image-resize.d.ts +19 -0
  844. package/dist/utils/image-resize.d.ts.map +1 -0
  845. package/dist/utils/image-resize.js +81 -0
  846. package/dist/utils/image-resize.js.map +1 -0
  847. package/dist/utils/json.d.ts +3 -0
  848. package/dist/utils/json.d.ts.map +1 -0
  849. package/dist/utils/json.js +7 -0
  850. package/dist/utils/json.js.map +1 -0
  851. package/dist/utils/mime.d.ts +3 -0
  852. package/dist/utils/mime.d.ts.map +1 -0
  853. package/dist/utils/mime.js +110 -0
  854. package/dist/utils/mime.js.map +1 -0
  855. package/dist/utils/open-browser.d.ts +9 -0
  856. package/dist/utils/open-browser.d.ts.map +1 -0
  857. package/dist/utils/open-browser.js +22 -0
  858. package/dist/utils/open-browser.js.map +1 -0
  859. package/dist/utils/paths.d.ts +31 -0
  860. package/dist/utils/paths.d.ts.map +1 -0
  861. package/dist/utils/paths.js +87 -0
  862. package/dist/utils/paths.js.map +1 -0
  863. package/dist/utils/photon.d.ts +22 -0
  864. package/dist/utils/photon.d.ts.map +1 -0
  865. package/dist/utils/photon.js +125 -0
  866. package/dist/utils/photon.js.map +1 -0
  867. package/dist/utils/shell.d.ts +28 -0
  868. package/dist/utils/shell.d.ts.map +1 -0
  869. package/dist/utils/shell.js +188 -0
  870. package/dist/utils/shell.js.map +1 -0
  871. package/dist/utils/sleep.d.ts +5 -0
  872. package/dist/utils/sleep.d.ts.map +1 -0
  873. package/dist/utils/sleep.js +17 -0
  874. package/dist/utils/sleep.js.map +1 -0
  875. package/dist/utils/syntax-highlight.d.ts +12 -0
  876. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  877. package/dist/utils/syntax-highlight.js +125 -0
  878. package/dist/utils/syntax-highlight.js.map +1 -0
  879. package/dist/utils/tools-manager.d.ts +5 -0
  880. package/dist/utils/tools-manager.d.ts.map +1 -0
  881. package/dist/utils/tools-manager.js +329 -0
  882. package/dist/utils/tools-manager.js.map +1 -0
  883. package/dist/utils/version-check.d.ts +14 -0
  884. package/dist/utils/version-check.d.ts.map +1 -0
  885. package/dist/utils/version-check.js +91 -0
  886. package/dist/utils/version-check.js.map +1 -0
  887. package/dist/utils/windows-self-update.d.ts +3 -0
  888. package/dist/utils/windows-self-update.d.ts.map +1 -0
  889. package/dist/utils/windows-self-update.js +77 -0
  890. package/dist/utils/windows-self-update.js.map +1 -0
  891. package/docs/compaction.md +408 -0
  892. package/docs/custom-provider.md +714 -0
  893. package/docs/daemon-architecture.md +399 -0
  894. package/docs/daemon.md +110 -0
  895. package/docs/development.md +72 -0
  896. package/docs/docs.json +164 -0
  897. package/docs/extensions.md +2745 -0
  898. package/docs/hooks.md +85 -0
  899. package/docs/images/doom-extension.png +0 -0
  900. package/docs/images/exy.png +0 -0
  901. package/docs/images/interactive-mode.png +0 -0
  902. package/docs/images/tree-view.png +0 -0
  903. package/docs/index.md +81 -0
  904. package/docs/json.md +89 -0
  905. package/docs/keybindings.md +230 -0
  906. package/docs/lsp.md +499 -0
  907. package/docs/migrating-to-grip.md +18 -0
  908. package/docs/models.md +496 -0
  909. package/docs/packages.md +228 -0
  910. package/docs/prompt-templates.md +88 -0
  911. package/docs/providers.md +251 -0
  912. package/docs/quickstart.md +167 -0
  913. package/docs/rpc.md +1492 -0
  914. package/docs/rules.md +117 -0
  915. package/docs/sandbox.md +181 -0
  916. package/docs/sdk.md +360 -0
  917. package/docs/session-format.md +414 -0
  918. package/docs/sessions.md +137 -0
  919. package/docs/settings.md +371 -0
  920. package/docs/shell-aliases.md +13 -0
  921. package/docs/skills.md +246 -0
  922. package/docs/terminal-setup.md +112 -0
  923. package/docs/termux.md +129 -0
  924. package/docs/themes.md +295 -0
  925. package/docs/tmux.md +61 -0
  926. package/docs/tui.md +918 -0
  927. package/docs/usage.md +304 -0
  928. package/docs/windows.md +17 -0
  929. package/examples/README.md +31 -0
  930. package/examples/daemon-docker/Dockerfile +43 -0
  931. package/examples/daemon-docker/README.md +45 -0
  932. package/examples/extensions/README.md +208 -0
  933. package/examples/extensions/auto-commit-on-exit.ts +46 -0
  934. package/examples/extensions/bash-spawn-hook.ts +30 -0
  935. package/examples/extensions/bookmark.ts +50 -0
  936. package/examples/extensions/border-status-editor.ts +145 -0
  937. package/examples/extensions/built-in-tool-renderer.ts +259 -0
  938. package/examples/extensions/claude-rules.ts +86 -0
  939. package/examples/extensions/commands.ts +82 -0
  940. package/examples/extensions/confirm-destructive.ts +59 -0
  941. package/examples/extensions/custom-compaction.ts +131 -0
  942. package/examples/extensions/custom-footer.ts +79 -0
  943. package/examples/extensions/custom-header.ts +73 -0
  944. package/examples/extensions/custom-provider-anthropic/index.ts +707 -0
  945. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  946. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  947. package/examples/extensions/custom-provider-gitlab-duo/index.ts +402 -0
  948. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  949. package/examples/extensions/custom-provider-gitlab-duo/test.ts +104 -0
  950. package/examples/extensions/dirty-repo-guard.ts +59 -0
  951. package/examples/extensions/doom-overlay/README.md +46 -0
  952. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  953. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  954. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  955. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  956. package/examples/extensions/doom-overlay/doom-component.ts +133 -0
  957. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  958. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  959. package/examples/extensions/doom-overlay/index.ts +74 -0
  960. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  961. package/examples/extensions/dynamic-resources/RULES.md +8 -0
  962. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  963. package/examples/extensions/dynamic-resources/dynamic.json +79 -0
  964. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  965. package/examples/extensions/dynamic-resources/index.ts +16 -0
  966. package/examples/extensions/dynamic-tools.ts +74 -0
  967. package/examples/extensions/event-bus.ts +43 -0
  968. package/examples/extensions/file-trigger.ts +41 -0
  969. package/examples/extensions/git-checkpoint.ts +53 -0
  970. package/examples/extensions/git-merge-and-resolve.ts +125 -0
  971. package/examples/extensions/github-issue-autocomplete.ts +191 -0
  972. package/examples/extensions/handoff.ts +191 -0
  973. package/examples/extensions/hello.ts +26 -0
  974. package/examples/extensions/hidden-thinking-label.ts +53 -0
  975. package/examples/extensions/inline-bash.ts +104 -0
  976. package/examples/extensions/input-transform.ts +43 -0
  977. package/examples/extensions/interactive-shell.ts +194 -0
  978. package/examples/extensions/mac-system-theme.ts +47 -0
  979. package/examples/extensions/message-renderer.ts +59 -0
  980. package/examples/extensions/minimal-mode.ts +428 -0
  981. package/examples/extensions/modal-editor.ts +86 -0
  982. package/examples/extensions/model-status.ts +31 -0
  983. package/examples/extensions/notify.ts +55 -0
  984. package/examples/extensions/overlay-qa-tests.ts +1374 -0
  985. package/examples/extensions/overlay-test.ts +171 -0
  986. package/examples/extensions/permission-gate.ts +34 -0
  987. package/examples/extensions/pirate.ts +47 -0
  988. package/examples/extensions/plan-mode/README.md +65 -0
  989. package/examples/extensions/plan-mode/index.ts +346 -0
  990. package/examples/extensions/plan-mode/utils.ts +172 -0
  991. package/examples/extensions/preset.ts +426 -0
  992. package/examples/extensions/prompt-customizer.ts +97 -0
  993. package/examples/extensions/protected-paths.ts +29 -0
  994. package/examples/extensions/provider-payload.ts +18 -0
  995. package/examples/extensions/qna.ts +125 -0
  996. package/examples/extensions/question.ts +294 -0
  997. package/examples/extensions/questionnaire.ts +459 -0
  998. package/examples/extensions/rainbow-editor.ts +88 -0
  999. package/examples/extensions/reload-runtime.ts +37 -0
  1000. package/examples/extensions/rpc-demo.ts +118 -0
  1001. package/examples/extensions/sandbox/index.ts +320 -0
  1002. package/examples/extensions/sandbox/package-lock.json +92 -0
  1003. package/examples/extensions/sandbox/package.json +19 -0
  1004. package/examples/extensions/send-user-message.ts +97 -0
  1005. package/examples/extensions/session-name.ts +27 -0
  1006. package/examples/extensions/shutdown-command.ts +63 -0
  1007. package/examples/extensions/snake.ts +381 -0
  1008. package/examples/extensions/space-invaders.ts +597 -0
  1009. package/examples/extensions/status-line.ts +32 -0
  1010. package/examples/extensions/structured-output.ts +65 -0
  1011. package/examples/extensions/subagent/README.md +175 -0
  1012. package/examples/extensions/subagent/agents/planner.md +37 -0
  1013. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  1014. package/examples/extensions/subagent/agents/scout.md +50 -0
  1015. package/examples/extensions/subagent/agents/worker.md +24 -0
  1016. package/examples/extensions/subagent/agents.ts +126 -0
  1017. package/examples/extensions/subagent/index.ts +1083 -0
  1018. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  1019. package/examples/extensions/subagent/prompts/implement.md +10 -0
  1020. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  1021. package/examples/extensions/summarize.ts +186 -0
  1022. package/examples/extensions/system-prompt-header.ts +17 -0
  1023. package/examples/extensions/tic-tac-toe.ts +1091 -0
  1024. package/examples/extensions/timed-confirm.ts +70 -0
  1025. package/examples/extensions/titlebar-spinner.ts +58 -0
  1026. package/examples/extensions/todo.ts +306 -0
  1027. package/examples/extensions/tool-override.ts +144 -0
  1028. package/examples/extensions/tools.ts +141 -0
  1029. package/examples/extensions/trigger-compact.ts +50 -0
  1030. package/examples/extensions/truncated-tool.ts +200 -0
  1031. package/examples/extensions/widget-placement.ts +9 -0
  1032. package/examples/extensions/with-deps/index.ts +32 -0
  1033. package/examples/extensions/with-deps/package-lock.json +31 -0
  1034. package/examples/extensions/with-deps/package.json +22 -0
  1035. package/examples/extensions/working-indicator.ts +123 -0
  1036. package/examples/extensions/working-message-test.ts +25 -0
  1037. package/examples/remote-session-server/README.md +71 -0
  1038. package/examples/remote-session-server/server.ts +353 -0
  1039. package/examples/rpc-extension-ui.ts +642 -0
  1040. package/examples/sandbox-docker/Dockerfile +274 -0
  1041. package/examples/sandbox-docker/README.md +88 -0
  1042. package/examples/sdk/01-minimal.ts +27 -0
  1043. package/examples/sdk/02-custom-model.ts +54 -0
  1044. package/examples/sdk/03-custom-prompt.ts +76 -0
  1045. package/examples/sdk/04-skills.ts +60 -0
  1046. package/examples/sdk/05-tools.ts +55 -0
  1047. package/examples/sdk/06-extensions.ts +94 -0
  1048. package/examples/sdk/07-context-files.ts +47 -0
  1049. package/examples/sdk/08-prompt-templates.ts +56 -0
  1050. package/examples/sdk/09-api-keys-and-oauth.ts +50 -0
  1051. package/examples/sdk/10-settings.ts +58 -0
  1052. package/examples/sdk/11-sessions.ts +54 -0
  1053. package/examples/sdk/12-full-control.ts +79 -0
  1054. package/examples/sdk/13-session-runtime.ts +49 -0
  1055. package/examples/sdk/README.md +94 -0
  1056. package/npm-shrinkwrap.json +1878 -0
  1057. package/package.json +102 -5
@@ -0,0 +1,18 @@
1
+ import { posix, win32 } from "node:path";
2
+ export type PortablePathFlavor = "posix" | "windows";
3
+ type PathApi = typeof posix | typeof win32;
4
+ export declare function absolutePathFlavor(value: string): PortablePathFlavor | undefined;
5
+ export declare function pathFlavor(value: string, fallback?: PortablePathFlavor): PortablePathFlavor;
6
+ export declare function pathApi(flavor: PortablePathFlavor): PathApi;
7
+ export declare function isPortableAbsolute(value: string): boolean;
8
+ export declare function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string;
9
+ export declare function resolvePortablePath(baseDir: string, value: string): string;
10
+ export declare function joinPortablePath(basePath: string, ...parts: string[]): string;
11
+ export declare function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string;
12
+ export declare function pathComparisonValue(value: string, flavor?: PortablePathFlavor): string;
13
+ export declare function portablePathToFileUri(filePath: string): string;
14
+ export declare function relativePortablePath(from: string, to: string): string;
15
+ /** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */
16
+ export declare function relativeWithin(root: string, candidate: string): string | undefined;
17
+ export {};
18
+ //# sourceMappingURL=portable-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable-path.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/portable-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,KAAK,OAAO,GAAG,OAAO,KAAK,GAAG,OAAO,KAAK,CAAC;AAE3C,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAIhF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,kBAA4B,GAAG,kBAAkB,CAEpG;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAE3D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAE1F;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAE7E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAExF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAoB,GAAG,MAAM,CAGrF;AAUD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY9D;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAIrE;AAED,0GAA0G;AAC1G,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAYlF","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}
@@ -0,0 +1,83 @@
1
+ import { posix, win32 } from "node:path";
2
+ export function absolutePathFlavor(value) {
3
+ if (/^[A-Za-z]:[\\/]/.test(value) || /^[\\/]{2}[^\\/]+[\\/][^\\/]+/.test(value))
4
+ return "windows";
5
+ if (value.startsWith("/"))
6
+ return "posix";
7
+ return undefined;
8
+ }
9
+ export function pathFlavor(value, fallback = "posix") {
10
+ return absolutePathFlavor(value) ?? fallback;
11
+ }
12
+ export function pathApi(flavor) {
13
+ return flavor === "windows" ? win32 : posix;
14
+ }
15
+ export function isPortableAbsolute(value) {
16
+ return absolutePathFlavor(value) !== undefined;
17
+ }
18
+ export function normalizePortablePath(value, fallback) {
19
+ return pathApi(pathFlavor(value, fallback)).normalize(value);
20
+ }
21
+ export function resolvePortablePath(baseDir, value) {
22
+ const absoluteFlavor = absolutePathFlavor(value);
23
+ if (absoluteFlavor)
24
+ return pathApi(absoluteFlavor).normalize(value);
25
+ const baseFlavor = pathFlavor(baseDir);
26
+ return pathApi(baseFlavor).resolve(baseDir, value);
27
+ }
28
+ export function joinPortablePath(basePath, ...parts) {
29
+ return pathApi(pathFlavor(basePath)).join(basePath, ...parts);
30
+ }
31
+ export function dirnamePortablePath(value, fallback) {
32
+ return pathApi(pathFlavor(value, fallback)).dirname(value);
33
+ }
34
+ export function pathComparisonValue(value, flavor = pathFlavor(value)) {
35
+ const normalized = pathApi(flavor).normalize(value);
36
+ return flavor === "windows" ? normalized.toLowerCase() : normalized;
37
+ }
38
+ function encodePathSegments(value, flavor) {
39
+ return value
40
+ .split(flavor === "windows" ? /[\\/]/ : "/")
41
+ .filter(Boolean)
42
+ .map((segment) => encodeURIComponent(segment))
43
+ .join("/");
44
+ }
45
+ export function portablePathToFileUri(filePath) {
46
+ const flavor = pathFlavor(filePath);
47
+ const normalized = normalizePortablePath(filePath, flavor);
48
+ if (flavor === "posix")
49
+ return `file:///${encodePathSegments(normalized, flavor)}`;
50
+ if (normalized.startsWith("\\\\")) {
51
+ const parts = normalized.slice(2).split("\\");
52
+ const host = parts.shift();
53
+ if (!host)
54
+ throw new Error(`Invalid UNC path: ${filePath}`);
55
+ return `file://${host}/${encodePathSegments(parts.join("/"), flavor)}`;
56
+ }
57
+ const drive = normalized.slice(0, 2);
58
+ return `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;
59
+ }
60
+ export function relativePortablePath(from, to) {
61
+ const flavor = pathFlavor(from);
62
+ if (absolutePathFlavor(to) !== flavor)
63
+ return to;
64
+ return pathApi(flavor).relative(from, to);
65
+ }
66
+ /** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */
67
+ export function relativeWithin(root, candidate) {
68
+ const flavor = pathFlavor(root);
69
+ if (absolutePathFlavor(candidate) !== flavor)
70
+ return undefined;
71
+ const api = pathApi(flavor);
72
+ const normalizedRoot = api.normalize(root);
73
+ const normalizedCandidate = api.normalize(candidate);
74
+ const comparableRoot = pathComparisonValue(normalizedRoot, flavor);
75
+ const comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);
76
+ if (comparableRoot === comparableCandidate)
77
+ return "";
78
+ const prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;
79
+ if (!comparableCandidate.startsWith(prefix))
80
+ return undefined;
81
+ return normalizedCandidate.slice(prefix.length);
82
+ }
83
+ //# sourceMappingURL=portable-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable-path.js","sourceRoot":"","sources":["../../../src/core/lsp/portable-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAMzC,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAkC;IACjF,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAClG,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAC1C,OAAO,SAAS,CAAC;AAAA,CACjB;AAED,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,QAAQ,GAAuB,OAAO,EAAsB;IACrG,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC;AAAA,CAC7C;AAED,MAAM,UAAU,OAAO,CAAC,MAA0B,EAAW;IAC5D,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAAA,CAC5C;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAW;IAC1D,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AAAA,CAC/C;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAE,QAA6B,EAAU;IAC3F,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAAA,CAC7D;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,KAAa,EAAU;IAC3E,MAAM,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,cAAc;QAAE,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAAA,CACnD;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAgB,EAAE,GAAG,KAAe,EAAU;IAC9E,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC;AAAA,CAC9D;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,QAA6B,EAAU;IACzF,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC3D;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,EAAU;IACtF,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAAA,CACpE;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,MAA0B,EAAU;IAC9E,OAAO,KAAK;SACV,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;SAC3C,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;SAC7C,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,CACZ;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAgB,EAAU;IAC/D,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,WAAW,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,CAAC;IACnF,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,EAAE,CAAC,CAAC;QAC5D,OAAO,UAAU,IAAI,IAAI,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;IACxE,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrC,OAAO,WAAW,KAAK,IAAI,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC;AAAA,CAC7E;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,EAAU,EAAU;IACtE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,kBAAkB,CAAC,EAAE,CAAC,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IACjD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAAA,CAC1C;AAED,0GAA0G;AAC1G,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,SAAiB,EAAsB;IACnF,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,kBAAkB,CAAC,SAAS,CAAC,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,mBAAmB,GAAG,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,mBAAmB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACnE,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,cAAc,KAAK,mBAAmB;QAAE,OAAO,EAAE,CAAC;IACtD,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;IACjG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,OAAO,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAAA,CAChD","sourcesContent":["import { posix, win32 } from \"node:path\";\n\nexport type PortablePathFlavor = \"posix\" | \"windows\";\n\ntype PathApi = typeof posix | typeof win32;\n\nexport function absolutePathFlavor(value: string): PortablePathFlavor | undefined {\n\tif (/^[A-Za-z]:[\\\\/]/.test(value) || /^[\\\\/]{2}[^\\\\/]+[\\\\/][^\\\\/]+/.test(value)) return \"windows\";\n\tif (value.startsWith(\"/\")) return \"posix\";\n\treturn undefined;\n}\n\nexport function pathFlavor(value: string, fallback: PortablePathFlavor = \"posix\"): PortablePathFlavor {\n\treturn absolutePathFlavor(value) ?? fallback;\n}\n\nexport function pathApi(flavor: PortablePathFlavor): PathApi {\n\treturn flavor === \"windows\" ? win32 : posix;\n}\n\nexport function isPortableAbsolute(value: string): boolean {\n\treturn absolutePathFlavor(value) !== undefined;\n}\n\nexport function normalizePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).normalize(value);\n}\n\nexport function resolvePortablePath(baseDir: string, value: string): string {\n\tconst absoluteFlavor = absolutePathFlavor(value);\n\tif (absoluteFlavor) return pathApi(absoluteFlavor).normalize(value);\n\tconst baseFlavor = pathFlavor(baseDir);\n\treturn pathApi(baseFlavor).resolve(baseDir, value);\n}\n\nexport function joinPortablePath(basePath: string, ...parts: string[]): string {\n\treturn pathApi(pathFlavor(basePath)).join(basePath, ...parts);\n}\n\nexport function dirnamePortablePath(value: string, fallback?: PortablePathFlavor): string {\n\treturn pathApi(pathFlavor(value, fallback)).dirname(value);\n}\n\nexport function pathComparisonValue(value: string, flavor = pathFlavor(value)): string {\n\tconst normalized = pathApi(flavor).normalize(value);\n\treturn flavor === \"windows\" ? normalized.toLowerCase() : normalized;\n}\n\nfunction encodePathSegments(value: string, flavor: PortablePathFlavor): string {\n\treturn value\n\t\t.split(flavor === \"windows\" ? /[\\\\/]/ : \"/\")\n\t\t.filter(Boolean)\n\t\t.map((segment) => encodeURIComponent(segment))\n\t\t.join(\"/\");\n}\n\nexport function portablePathToFileUri(filePath: string): string {\n\tconst flavor = pathFlavor(filePath);\n\tconst normalized = normalizePortablePath(filePath, flavor);\n\tif (flavor === \"posix\") return `file:///${encodePathSegments(normalized, flavor)}`;\n\tif (normalized.startsWith(\"\\\\\\\\\")) {\n\t\tconst parts = normalized.slice(2).split(\"\\\\\");\n\t\tconst host = parts.shift();\n\t\tif (!host) throw new Error(`Invalid UNC path: ${filePath}`);\n\t\treturn `file://${host}/${encodePathSegments(parts.join(\"/\"), flavor)}`;\n\t}\n\tconst drive = normalized.slice(0, 2);\n\treturn `file:///${drive}/${encodePathSegments(normalized.slice(2), flavor)}`;\n}\n\nexport function relativePortablePath(from: string, to: string): string {\n\tconst flavor = pathFlavor(from);\n\tif (absolutePathFlavor(to) !== flavor) return to;\n\treturn pathApi(flavor).relative(from, to);\n}\n\n/** Compare with Windows case folding while deriving the suffix from the original normalized candidate. */\nexport function relativeWithin(root: string, candidate: string): string | undefined {\n\tconst flavor = pathFlavor(root);\n\tif (absolutePathFlavor(candidate) !== flavor) return undefined;\n\tconst api = pathApi(flavor);\n\tconst normalizedRoot = api.normalize(root);\n\tconst normalizedCandidate = api.normalize(candidate);\n\tconst comparableRoot = pathComparisonValue(normalizedRoot, flavor);\n\tconst comparableCandidate = pathComparisonValue(normalizedCandidate, flavor);\n\tif (comparableRoot === comparableCandidate) return \"\";\n\tconst prefix = comparableRoot.endsWith(api.sep) ? comparableRoot : `${comparableRoot}${api.sep}`;\n\tif (!comparableCandidate.startsWith(prefix)) return undefined;\n\treturn normalizedCandidate.slice(prefix.length);\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { Type } from "typebox";
2
+ import type { ToolDefinition } from "../extensions/types.ts";
3
+ import type { ToolOperations } from "../tools/operations.ts";
4
+ import type { LspRuntimeState } from "./integration.ts";
5
+ declare const renameSchema: Type.TObject<{
6
+ path: Type.TString;
7
+ line: Type.TInteger;
8
+ character: Type.TInteger;
9
+ newName: Type.TString;
10
+ }>;
11
+ declare const codeActionsSchema: Type.TObject<{
12
+ path: Type.TString;
13
+ line: Type.TInteger;
14
+ character: Type.TInteger;
15
+ endLine: Type.TOptional<Type.TInteger>;
16
+ endCharacter: Type.TOptional<Type.TInteger>;
17
+ kind: Type.TOptional<Type.TString>;
18
+ }>;
19
+ export interface LspRenameDetails {
20
+ fileCount: number;
21
+ editCount: number;
22
+ truncated?: boolean;
23
+ conflict?: boolean;
24
+ }
25
+ export interface LspCodeActionsDetails {
26
+ count: number;
27
+ preferredCount: number;
28
+ }
29
+ export declare function createLspRenameTool(getState: () => LspRuntimeState, getOperations?: () => ToolOperations): ToolDefinition<typeof renameSchema, LspRenameDetails>;
30
+ export declare function createLspCodeActionsTool(getState: () => LspRuntimeState, getOperations?: () => ToolOperations): ToolDefinition<typeof codeActionsSchema, LspCodeActionsDetails>;
31
+ export {};
32
+ //# sourceMappingURL=refactor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refactor.d.ts","sourceRoot":"","sources":["../../../src/core/lsp/refactor.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAU5C,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAaxD,QAAA,MAAM,YAAY;;;;;EAGhB,CAAC;AAEH,QAAA,MAAM,iBAAiB;;;;;;;EASrB,CAAC;AAcH,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACvB;AAifD,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,YAAY,EAAE,gBAAgB,CAAC,CAmGvD;AAED,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,MAAM,eAAe,EAC/B,aAAa,CAAC,EAAE,MAAM,cAAc,GAClC,cAAc,CAAC,OAAO,iBAAiB,EAAE,qBAAqB,CAAC,CAqEjE","sourcesContent":["import { Text } from \"@greppleai/grip-tui\";\nimport { type Static, Type } from \"typebox\";\nimport type {\n\tCodeAction,\n\tCommand,\n\tDiagnostic,\n\tPosition,\n\tRange,\n\tTextEdit,\n\tWorkspaceEdit,\n} from \"vscode-languageserver-protocol\";\nimport type { AgentToolResult, ToolDefinition } from \"../extensions/types.ts\";\nimport type { ToolOperations } from \"../tools/operations.ts\";\nimport { throwIfAborted } from \"./abort.ts\";\nimport type { LspRuntimeState } from \"./integration.ts\";\nimport type { LspClientRoute, LspClientRouteCollection, LspClientRouteFailure, LspToolFeature } from \"./manager.ts\";\nimport { relativePortablePath } from \"./portable-path.ts\";\n\nconst MAX_ACTIONS = 40;\nconst MAX_EDIT_LINES = 80;\n\nconst positionFields = {\n\tpath: Type.String({ description: \"File path\" }),\n\tline: Type.Integer({ minimum: 1, description: \"Line number, 1-indexed\" }),\n\tcharacter: Type.Integer({ minimum: 1, description: \"Column number, 1-indexed\" }),\n};\n\nconst renameSchema = Type.Object({\n\t...positionFields,\n\tnewName: Type.String({ description: \"New name for the symbol\" }),\n});\n\nconst codeActionsSchema = Type.Object({\n\t...positionFields,\n\tendLine: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"End line for a range selection, 1-indexed. Defaults to line.\" }),\n\t),\n\tendCharacter: Type.Optional(\n\t\tType.Integer({ minimum: 1, description: \"End column for a range selection, 1-indexed. Defaults to character.\" }),\n\t),\n\tkind: Type.Optional(Type.String({ description: \"Optional action kind filter, e.g. quickfix, refactor, source.\" })),\n});\n\ntype RenameInput = Static<typeof renameSchema>;\ntype CodeActionsInput = Static<typeof codeActionsSchema>;\n\ninterface OneBasedPosition {\n\tline: number;\n\tcharacter: number;\n}\n\ninterface LspFileInput {\n\tpath: string;\n}\n\nexport interface LspRenameDetails {\n\tfileCount: number;\n\teditCount: number;\n\ttruncated?: boolean;\n\tconflict?: boolean;\n}\n\nexport interface LspCodeActionsDetails {\n\tcount: number;\n\tpreferredCount: number;\n}\n\ntype CodeActionResponse = (CodeAction | Command)[] | null;\n\ninterface TextDocumentEditReference {\n\turi: string;\n\tversion?: number | null;\n}\n\ntype TextDocumentEditLike = {\n\ttextDocument: TextDocumentEditReference;\n\tedits: TextEdit[];\n};\n\ninterface WorkspaceEditEntry {\n\tpath: string;\n\tedit: TextEdit;\n\tversion?: number | null;\n}\n\ninterface WorkspaceEditCollection {\n\tentries: WorkspaceEditEntry[];\n\tresourceOperations: ResourceOperationPreview[];\n\tversionErrors: string[];\n}\n\ninterface WorkspaceEditCollectionContext {\n\tstate: LspRuntimeState;\n\troute: LspClientRoute;\n\tvalidateDocumentVersions: boolean;\n}\n\ninterface WorkspaceEditPreview {\n\tlines: string[];\n\tfileCount: number;\n\teditCount: number;\n\ttruncated: boolean;\n\tsignature: string;\n\tversionErrors: string[];\n}\n\ninterface RenamePreviewResult {\n\tserverId: string;\n\tpreview: WorkspaceEditPreview;\n}\n\ninterface AggregatedAction {\n\titem: CodeAction | Command;\n\troute: LspClientRoute;\n\tserverIds: string[];\n\tpreferred: boolean;\n}\n\ninterface CodeActionRouteOutcome {\n\troute: LspClientRoute;\n\titems: (CodeAction | Command)[];\n\tfailure?: LspClientRouteFailure;\n}\n\nfunction toPosition(input: OneBasedPosition): Position {\n\treturn { line: input.line - 1, character: input.character - 1 };\n}\n\nfunction relativeUriPath(state: LspRuntimeState, route: LspClientRoute, uri: string): string {\n\tconst mapped = route.target.mapper.serverUriToAgentPath(uri);\n\treturn mapped.ok ? relativePortablePath(state.manager.cwd, mapped.value) : `[unmapped URI: ${mapped.reason}]`;\n}\n\nfunction formatTextEdit(edit: TextEdit): string {\n\tconst startLine = edit.range.start.line + 1;\n\tconst startColumn = edit.range.start.character + 1;\n\tconst endLine = edit.range.end.line + 1;\n\tconst endColumn = edit.range.end.character + 1;\n\tconst replacement = edit.newText.replace(/\\n/g, \"\\\\n\");\n\tconst clipped = replacement.length > 120 ? `${replacement.slice(0, 117)}...` : replacement;\n\treturn `${startLine}:${startColumn}-${endLine}:${endColumn} -> ${JSON.stringify(clipped)}`;\n}\n\nfunction isTextDocumentEditLike(value: unknown): value is TextDocumentEditLike {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"textDocument\" in value &&\n\t\t\"edits\" in value &&\n\t\tArray.isArray((value as { edits?: unknown }).edits)\n\t);\n}\n\nfunction stableSerialize(value: unknown, ancestors = new Set<object>()): string {\n\tif (value === null || typeof value !== \"object\") return JSON.stringify(value) ?? String(value);\n\tif (ancestors.has(value)) return '\"[circular]\"';\n\tancestors.add(value);\n\tlet output: string;\n\tif (Array.isArray(value)) {\n\t\toutput = `[${value.map((item) => stableSerialize(item, ancestors)).join(\",\")}]`;\n\t} else {\n\t\tconst entries = Object.entries(value).sort(([left], [right]) => left.localeCompare(right));\n\t\toutput = `{${entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item, ancestors)}`).join(\",\")}}`;\n\t}\n\tancestors.delete(value);\n\treturn output;\n}\n\ninterface ResourceOperationPreview {\n\tline: string;\n\tpaths: string[];\n\tsignature: string;\n}\n\nfunction normalizeResourceOperation(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tvalue: unknown,\n): ResourceOperationPreview {\n\tif (typeof value !== \"object\" || value === null || !(\"kind\" in value) || typeof value.kind !== \"string\") {\n\t\tconst signature = stableSerialize(value);\n\t\treturn { line: `[unknown workspace operation: ${signature}]`, paths: [], signature };\n\t}\n\tif ((value.kind === \"create\" || value.kind === \"delete\") && \"uri\" in value && typeof value.uri === \"string\") {\n\t\tconst path = relativeUriPath(state, route, value.uri);\n\t\tconst options = \"options\" in value ? value.options : undefined;\n\t\tconst signature = stableSerialize({ kind: value.kind, path, options });\n\t\treturn { line: `[workspace ${value.kind}: ${path}]`, paths: [path], signature };\n\t}\n\tif (\n\t\tvalue.kind === \"rename\" &&\n\t\t\"oldUri\" in value &&\n\t\ttypeof value.oldUri === \"string\" &&\n\t\t\"newUri\" in value &&\n\t\ttypeof value.newUri === \"string\"\n\t) {\n\t\tconst oldPath = relativeUriPath(state, route, value.oldUri);\n\t\tconst newPath = relativeUriPath(state, route, value.newUri);\n\t\tconst options = \"options\" in value ? value.options : undefined;\n\t\tconst signature = stableSerialize({ kind: value.kind, oldPath, newPath, options });\n\t\treturn { line: `[workspace rename: ${oldPath} -> ${newPath}]`, paths: [oldPath, newPath], signature };\n\t}\n\tconst signature = stableSerialize(value);\n\treturn { line: `[unknown workspace operation: ${signature}]`, paths: [], signature };\n}\n\nfunction documentVersionError(\n\tcontext: WorkspaceEditCollectionContext,\n\turi: string,\n\tpath: string,\n\tversion: number | null | undefined,\n): string | undefined {\n\tif (!context.validateDocumentVersions || typeof version !== \"number\") return undefined;\n\tconst trackedVersion = context.state.fileSync.getTrackedVersion(uri, context.route.target.instanceKey);\n\tif (trackedVersion === undefined) {\n\t\treturn `unknown tracked version for ${path}; response requires document version ${version}`;\n\t}\n\tif (trackedVersion !== version) {\n\t\treturn `stale document version ${version}; tracked version is ${trackedVersion} for ${path}`;\n\t}\n\treturn undefined;\n}\n\nfunction collectDocumentChanges(\n\tcontext: WorkspaceEditCollectionContext,\n\tedit: WorkspaceEdit,\n\tcollection: WorkspaceEditCollection,\n): void {\n\tfor (const change of edit.documentChanges ?? []) {\n\t\tif (!isTextDocumentEditLike(change)) {\n\t\t\tcollection.resourceOperations.push(normalizeResourceOperation(context.state, context.route, change));\n\t\t\tcontinue;\n\t\t}\n\t\tconst path = relativeUriPath(context.state, context.route, change.textDocument.uri);\n\t\tconst version = change.textDocument.version;\n\t\tconst versionError = documentVersionError(context, change.textDocument.uri, path, version);\n\t\tif (versionError) collection.versionErrors.push(versionError);\n\t\tfor (const textEdit of change.edits) collection.entries.push({ path, edit: textEdit, version });\n\t}\n}\n\nfunction collectUriTextEdits(\n\tcontext: WorkspaceEditCollectionContext,\n\tedit: WorkspaceEdit,\n\tcollection: WorkspaceEditCollection,\n): void {\n\tfor (const [uri, edits] of Object.entries(edit.changes ?? {})) {\n\t\tconst path = relativeUriPath(context.state, context.route, uri);\n\t\tfor (const textEdit of edits) collection.entries.push({ path, edit: textEdit });\n\t}\n}\n\nfunction sortWorkspaceEditCollection(collection: WorkspaceEditCollection): void {\n\tcollection.entries.sort(\n\t\t(left, right) =>\n\t\t\tleft.path.localeCompare(right.path) ||\n\t\t\tleft.edit.range.start.line - right.edit.range.start.line ||\n\t\t\tleft.edit.range.start.character - right.edit.range.start.character ||\n\t\t\tleft.edit.range.end.line - right.edit.range.end.line ||\n\t\t\tleft.edit.range.end.character - right.edit.range.end.character ||\n\t\t\tleft.edit.newText.localeCompare(right.edit.newText),\n\t);\n\tcollection.resourceOperations.sort((left, right) => left.signature.localeCompare(right.signature));\n}\n\nfunction renderWorkspaceEditLines(collection: WorkspaceEditCollection): string[] {\n\tconst lines: string[] = [];\n\tlet previousDocument: string | undefined;\n\tfor (const entry of collection.entries) {\n\t\tconst versionLabel =\n\t\t\tentry.version === undefined\n\t\t\t\t? \"\"\n\t\t\t\t: entry.version === null\n\t\t\t\t\t? \" (document version: unversioned)\"\n\t\t\t\t\t: ` (document version ${entry.version})`;\n\t\tconst document = `${entry.path}\\u0000${versionLabel}`;\n\t\tif (document !== previousDocument) {\n\t\t\tlines.push(`${entry.path}${versionLabel}:`);\n\t\t\tpreviousDocument = document;\n\t\t}\n\t\tlines.push(` ${formatTextEdit(entry.edit)}`);\n\t}\n\tfor (const operation of collection.resourceOperations) lines.push(operation.line);\n\treturn lines;\n}\n\nfunction workspaceEditSignature(collection: WorkspaceEditCollection): string {\n\tif (collection.entries.length === 0 && collection.resourceOperations.length === 0) return \"[]\";\n\treturn stableSerialize({\n\t\tentries: collection.entries.map((entry) => ({\n\t\t\tpath: entry.path,\n\t\t\trange: entry.edit.range,\n\t\t\tnewText: entry.edit.newText,\n\t\t})),\n\t\tresourceOperations: collection.resourceOperations.map((operation) => operation.signature),\n\t});\n}\n\nfunction collectWorkspaceEditPreview(\n\tstate: LspRuntimeState,\n\troute: LspClientRoute,\n\tedit: WorkspaceEdit | undefined,\n\tvalidateDocumentVersions = false,\n): WorkspaceEditPreview {\n\tif (!edit) {\n\t\treturn { lines: [], fileCount: 0, editCount: 0, truncated: false, signature: \"[]\", versionErrors: [] };\n\t}\n\tconst context: WorkspaceEditCollectionContext = { state, route, validateDocumentVersions };\n\tconst collection: WorkspaceEditCollection = { entries: [], resourceOperations: [], versionErrors: [] };\n\tcollectDocumentChanges(context, edit, collection);\n\tcollectUriTextEdits(context, edit, collection);\n\tsortWorkspaceEditCollection(collection);\n\tconst lines = renderWorkspaceEditLines(collection);\n\tconst shown = lines.slice(0, MAX_EDIT_LINES);\n\treturn {\n\t\tlines: shown,\n\t\tfileCount: new Set([\n\t\t\t...collection.entries.map((entry) => entry.path),\n\t\t\t...collection.resourceOperations.flatMap((operation) => operation.paths),\n\t\t]).size,\n\t\teditCount: collection.entries.length + collection.resourceOperations.length,\n\t\ttruncated: shown.length < lines.length,\n\t\tsignature: workspaceEditSignature(collection),\n\t\tversionErrors: collection.versionErrors,\n\t};\n}\n\nfunction isCodeAction(item: CodeAction | Command): item is CodeAction {\n\treturn typeof item.command !== \"string\";\n}\n\nfunction comparePosition(left: Position, right: Position): number {\n\treturn left.line - right.line || left.character - right.character;\n}\n\nfunction rangesOverlap(left: Range, right: Range): boolean {\n\treturn comparePosition(left.end, right.start) >= 0 && comparePosition(right.end, left.start) >= 0;\n}\n\nfunction failureText(failures: readonly LspClientRouteFailure[]): string {\n\tconst unique = [\n\t\t...new Map(failures.map((failure) => [`${failure.serverId}\\u0000${failure.reason}`, failure])).values(),\n\t];\n\treturn unique.length === 0\n\t\t? \"\"\n\t\t: `\\n\\nUnavailable or unsupported servers:\\n${unique.map((failure) => `- ${failure.serverId}: ${failure.reason}`).join(\"\\n\")}`;\n}\n\nasync function getClientsAndSync(\n\tstate: LspRuntimeState,\n\tinput: LspFileInput,\n\toperations: ToolOperations,\n\tfeature: LspToolFeature,\n\tsignal?: AbortSignal,\n): Promise<LspClientRouteCollection> {\n\tawait state.manager.setToolOperations(operations, signal);\n\tconst collection = await state.manager.getClientRoutesForFeature(input.path, feature, signal);\n\tif (collection.routes.length > 0) {\n\t\tconst result = await state.fileSync.synchronizeFileRead(input.path, operations, signal);\n\t\tif (result.lifecycleCancelled) {\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: [],\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...collection.routes.map((route) => ({\n\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\treason: \"synchronization was cancelled by an LSP lifecycle change\",\n\t\t\t\t\t})),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\tif (result.failures.length > 0) {\n\t\t\tconst failedInstances = new Set(result.failures.map((failure) => failure.instanceKey));\n\t\t\treturn {\n\t\t\t\t...collection,\n\t\t\t\troutes: collection.routes.filter((route) => !failedInstances.has(route.target.instanceKey)),\n\t\t\t\tfailures: [\n\t\t\t\t\t...collection.failures,\n\t\t\t\t\t...result.failures.map((failure) => ({ serverId: failure.serverId, reason: failure.reason })),\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t}\n\treturn collection;\n}\n\nasync function noCapableResult(\n\tstate: LspRuntimeState,\n\tpath: string,\n\tfeature: LspToolFeature,\n\tcollection: LspClientRouteCollection,\n\tsignal?: AbortSignal,\n): Promise<string> {\n\tif (collection.matchedServerCount === 0) return state.manager.getUnavailableReason(path, signal);\n\treturn `No capable LSP server is available for ${feature}.${failureText(collection.failures)}`;\n}\n\nfunction rethrowIfAborted(signal: AbortSignal | undefined): void {\n\tthrowIfAborted(signal);\n}\n\nfunction actionKey(item: CodeAction | Command, preview: WorkspaceEditPreview): string {\n\tif (isCodeAction(item)) {\n\t\treturn stableSerialize({\n\t\t\ttitle: item.title,\n\t\t\tkind: item.kind,\n\t\t\tcommand: item.command,\n\t\t\tdata: item.data,\n\t\t\tedit: preview.signature,\n\t\t});\n\t}\n\treturn stableSerialize({ title: item.title, command: item.command, arguments: item.arguments });\n}\n\nasync function requestCodeActions(\n\troute: LspClientRoute,\n\tinput: CodeActionsInput,\n\trange: Range,\n\tsignal: AbortSignal | undefined,\n): Promise<CodeActionRouteOutcome> {\n\ttry {\n\t\tconst uri = route.target.serverUri;\n\t\tconst diagnostics = route.client\n\n\t\t\t.getDiagnostics(uri)\n\n\t\t\t.filter((diagnostic: Diagnostic) => rangesOverlap(diagnostic.range, range));\n\t\tconst response = await route.client.sendRequest<CodeActionResponse>(\n\t\t\t\"textDocument/codeAction\",\n\t\t\t{\n\t\t\t\ttextDocument: { uri },\n\t\t\t\trange,\n\t\t\t\tcontext: { diagnostics, only: input.kind ? [input.kind] : undefined },\n\t\t\t},\n\t\t\tsignal,\n\t\t);\n\t\treturn { route, items: response ?? [] };\n\t} catch (error) {\n\t\trethrowIfAborted(signal);\n\t\treturn {\n\t\t\troute,\n\t\t\titems: [],\n\t\t\tfailure: {\n\t\t\t\tserverId: route.target.serverId,\n\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction aggregateCodeActions(state: LspRuntimeState, outcomes: readonly CodeActionRouteOutcome[]): AggregatedAction[] {\n\tconst aggregated = new Map<string, AggregatedAction>();\n\tfor (const outcome of outcomes) {\n\t\tfor (const item of outcome.items) {\n\t\t\tconst preview = collectWorkspaceEditPreview(state, outcome.route, isCodeAction(item) ? item.edit : undefined);\n\t\t\tconst key = actionKey(item, preview);\n\t\t\tconst existing = aggregated.get(key);\n\t\t\tif (existing) {\n\t\t\t\tif (!existing.serverIds.includes(outcome.route.target.serverId)) {\n\t\t\t\t\texisting.serverIds.push(outcome.route.target.serverId);\n\t\t\t\t}\n\t\t\t\texisting.preferred ||= isCodeAction(item) && item.isPreferred === true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\taggregated.set(key, {\n\t\t\t\titem,\n\t\t\t\troute: outcome.route,\n\t\t\t\tserverIds: [outcome.route.target.serverId],\n\t\t\t\tpreferred: isCodeAction(item) && item.isPreferred === true,\n\t\t\t});\n\t\t}\n\t}\n\treturn [...aggregated.values()];\n}\n\nfunction renderCodeActionLines(\n\tstate: LspRuntimeState,\n\tactions: readonly AggregatedAction[],\n\tattribute: boolean,\n): string[] {\n\tconst lines: string[] = [];\n\tfor (const [index, action] of actions.slice(0, MAX_ACTIONS).entries()) {\n\t\tconst provider = attribute ? `[${action.serverIds.join(\", \")}] ` : \"\";\n\t\tif (!isCodeAction(action.item)) {\n\t\t\tlines.push(`${index + 1}. ${provider}${action.item.title} [command-only: ${action.item.command}]`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst kind = action.item.kind ? ` [${action.item.kind}]` : \"\";\n\t\tconst preferred = action.preferred ? \" preferred\" : \"\";\n\t\tlines.push(`${index + 1}. ${provider}${action.item.title}${kind}${preferred}`);\n\t\tconst preview = collectWorkspaceEditPreview(state, action.route, action.item.edit);\n\t\tfor (const line of preview.lines.slice(0, 8)) lines.push(` ${line}`);\n\t\tif (preview.truncated) lines.push(\" [edit preview truncated]\");\n\t}\n\tif (actions.length > MAX_ACTIONS) lines.push(`[Showing ${MAX_ACTIONS} of ${actions.length} actions.]`);\n\treturn lines;\n}\n\nfunction consensusRenamePreview(\n\tnewName: string,\n\tpreviews: RenamePreviewResult[],\n\tfailures: readonly LspClientRouteFailure[],\n\tmatchedServerCount: number,\n): AgentToolResult<LspRenameDetails> {\n\tconst bySignature = new Map<string, RenamePreviewResult[]>();\n\tfor (const preview of previews) {\n\t\tbySignature.set(preview.preview.signature, [...(bySignature.get(preview.preview.signature) ?? []), preview]);\n\t}\n\tif (bySignature.size > 1) {\n\t\tconst sections = [...bySignature.values()].map((group) => {\n\t\t\tconst first = group[0];\n\t\t\treturn first.preview.editCount === 0\n\t\t\t\t? `[${group.map((entry) => entry.serverId).join(\", \")}] no edits`\n\t\t\t\t: `[${group.map((entry) => entry.serverId).join(\", \")}] ${first.preview.editCount} edit(s):\\n${first.preview.lines.join(\"\\n\")}`;\n\t\t});\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: `Conflicting rename previews for ${JSON.stringify(newName)}. No preview was selected and no changes were applied.\\n\\n${sections.join(\"\\n\\n\")}${failureText(failures)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: {\n\t\t\t\tfileCount: Math.max(...previews.map((entry) => entry.preview.fileCount)),\n\t\t\t\teditCount: Math.max(...previews.map((entry) => entry.preview.editCount)),\n\t\t\t\tconflict: true,\n\t\t\t},\n\t\t};\n\t}\n\tconst matching = [...bySignature.values()][0];\n\tconst selected = matching[0];\n\tif (selected.preview.editCount === 0) {\n\t\tconst providers = matching.map((entry) => entry.serverId).join(\", \");\n\t\treturn {\n\t\t\tcontent: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: `Rename preview: no edits. Successful provider(s): ${providers}. No changes were applied.${failureText(failures)}`,\n\t\t\t\t},\n\t\t\t],\n\t\t\tdetails: { fileCount: 0, editCount: 0 },\n\t\t};\n\t}\n\tconst attribution =\n\t\tmatchedServerCount > 1 ? ` Selected provider(s): ${matching.map((entry) => entry.serverId).join(\", \")}.` : \"\";\n\tconst suffix = selected.preview.truncated ? `\\n[Showing ${selected.preview.lines.length} edit preview lines.]` : \"\";\n\treturn {\n\t\tcontent: [\n\t\t\t{\n\t\t\t\ttype: \"text\",\n\t\t\t\ttext: `Rename preview for ${JSON.stringify(newName)}: ${selected.preview.editCount} edit(s) across ${selected.preview.fileCount} file(s).${attribution} No changes were applied.\\n\\n${selected.preview.lines.join(\"\\n\")}${suffix}${failureText(failures)}`,\n\t\t\t},\n\t\t],\n\t\tdetails: {\n\t\t\tfileCount: selected.preview.fileCount,\n\t\t\teditCount: selected.preview.editCount,\n\t\t\t...(selected.preview.truncated ? { truncated: true } : {}),\n\t\t},\n\t};\n}\n\nexport function createLspRenameTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof renameSchema, LspRenameDetails> {\n\treturn {\n\t\tname: \"lsp_rename\",\n\t\tlabel: \"lsp_rename\",\n\t\tdescription:\n\t\t\t\"Preview a rename from all capable matching LSP servers. A preview is selected only when every successful response agrees, including empty responses, and document versions are current. Conflicting or stale edits are reported without choosing one. No changes are applied.\",\n\t\tpromptSnippet: \"Preview a symbol rename via LSP without applying changes\",\n\t\tpromptGuidelines: [\"lsp_rename is preview-only. Apply reviewed changes with read/edit using hashline anchors.\"],\n\t\tparameters: renameSchema,\n\t\tasync execute(_toolCallId, input: RenameInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"rename\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"rename\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { fileCount: 0, editCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map(async (route) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst result = await route.client.sendRequest<WorkspaceEdit | null>(\n\t\t\t\t\t\t\t\"textDocument/rename\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttextDocument: { uri: route.target.serverUri },\n\t\t\t\t\t\t\t\tposition: toPosition(input),\n\t\t\t\t\t\t\t\tnewName: input.newName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\tpreview: collectWorkspaceEditPreview(state, route, result ?? undefined, true),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\trethrowIfAborted(signal);\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tfailure: {\n\t\t\t\t\t\t\t\tserverId: route.target.serverId,\n\t\t\t\t\t\t\t\treason: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\t} satisfies LspClientRouteFailure,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst previews = outcomes.flatMap((outcome) => (outcome.result ? [outcome.result] : []));\n\t\t\tif (previews.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `No LSP server returned a rename preview. No changes were applied.${failureText(failures)}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { fileCount: 0, editCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst unsafeVersions = previews.flatMap((entry) =>\n\t\t\t\tentry.preview.versionErrors.map((reason) => `[${entry.serverId}] ${reason}`),\n\t\t\t);\n\t\t\tif (unsafeVersions.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\ttext: `Unsafe rename preview for ${JSON.stringify(input.newName)} due to stale or unknown document versions. No preview was selected and no changes were applied.\\n\\n${unsafeVersions.join(\"\\n\")}${failureText(failures)}`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tfileCount: Math.max(...previews.map((entry) => entry.preview.fileCount)),\n\t\t\t\t\t\teditCount: Math.max(...previews.map((entry) => entry.preview.editCount)),\n\t\t\t\t\t\tconflict: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn consensusRenamePreview(input.newName, previews, failures, collection.matchedServerCount);\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_rename\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)} -> ${theme.fg(\"muted\", args.newName)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n\nexport function createLspCodeActionsTool(\n\tgetState: () => LspRuntimeState,\n\tgetOperations?: () => ToolOperations,\n): ToolDefinition<typeof codeActionsSchema, LspCodeActionsDetails> {\n\treturn {\n\t\tname: \"lsp_code_actions\",\n\t\tlabel: \"lsp_code_actions\",\n\t\tdescription:\n\t\t\t\"List code actions from all capable matching LSP servers. Identical actions are deduplicated, distinct actions are attributed, and edit previews are never applied.\",\n\t\tpromptSnippet: \"List available LSP code actions and refactorings\",\n\t\tpromptGuidelines: [\n\t\t\t\"lsp_code_actions is preview-only. Apply reviewed edits with read/edit using hashline anchors.\",\n\t\t],\n\t\tparameters: codeActionsSchema,\n\t\tasync execute(_toolCallId, input: CodeActionsInput, signal, _onUpdate, ctx) {\n\t\t\tconst state = getState();\n\t\t\tconst collection = await getClientsAndSync(\n\t\t\t\tstate,\n\t\t\t\tinput,\n\t\t\t\tgetOperations?.() ?? ctx.toolOperations,\n\t\t\t\t\"codeActions\",\n\t\t\t\tsignal,\n\t\t\t);\n\t\t\tif (collection.routes.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{ type: \"text\", text: await noCapableResult(state, input.path, \"codeActions\", collection, signal) },\n\t\t\t\t\t],\n\t\t\t\t\tdetails: { count: 0, preferredCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst range: Range = {\n\t\t\t\tstart: toPosition(input),\n\t\t\t\tend: {\n\t\t\t\t\tline: (input.endLine ?? input.line) - 1,\n\t\t\t\t\tcharacter: (input.endCharacter ?? input.character) - 1,\n\t\t\t\t},\n\t\t\t};\n\t\t\tconst outcomes = await Promise.all(\n\t\t\t\tcollection.routes.map((route) => requestCodeActions(route, input, range, signal)),\n\t\t\t);\n\t\t\tconst failures = [\n\t\t\t\t...collection.failures,\n\t\t\t\t...outcomes.flatMap((outcome) => (outcome.failure ? [outcome.failure] : [])),\n\t\t\t];\n\t\t\tconst actions = aggregateCodeActions(state, outcomes);\n\t\t\tif (actions.length === 0) {\n\t\t\t\treturn {\n\t\t\t\t\tcontent: [{ type: \"text\", text: `No code actions available.${failureText(failures)}` }],\n\t\t\t\t\tdetails: { count: 0, preferredCount: 0 },\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst preferredCount = actions.filter((action) => action.preferred).length;\n\t\t\tconst lines = renderCodeActionLines(state, actions, collection.matchedServerCount > 1);\n\t\t\treturn {\n\t\t\t\tcontent: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\ttext: `${actions.length} code action(s). No changes were applied.\\n\\n${lines.join(\"\\n\")}${failureText(failures)}`,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdetails: { count: actions.length, preferredCount },\n\t\t\t};\n\t\t},\n\t\trenderCall(args, theme) {\n\t\t\treturn new Text(\n\t\t\t\t`${theme.fg(\"toolTitle\", theme.bold(\"lsp_code_actions\"))} ${theme.fg(\"accent\", `${args.path}:${args.line}:${args.character}`)}`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t);\n\t\t},\n\t};\n}\n"]}