@sudocode-ai/local-server 0.1.6 → 0.1.8

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 (361) hide show
  1. package/README.md +6 -0
  2. package/dist/errors/agent-errors.d.ts +43 -0
  3. package/dist/errors/agent-errors.d.ts.map +1 -0
  4. package/dist/errors/agent-errors.js +69 -0
  5. package/dist/errors/agent-errors.js.map +1 -0
  6. package/dist/execution/adapters/claude-adapter.d.ts +63 -0
  7. package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
  8. package/dist/execution/adapters/claude-adapter.js +82 -0
  9. package/dist/execution/adapters/claude-adapter.js.map +1 -0
  10. package/dist/execution/adapters/codex-adapter.d.ts +67 -0
  11. package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
  12. package/dist/execution/adapters/codex-adapter.js +183 -0
  13. package/dist/execution/adapters/codex-adapter.js.map +1 -0
  14. package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
  15. package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
  16. package/dist/execution/adapters/codex-config-builder.js +110 -0
  17. package/dist/execution/adapters/codex-config-builder.js.map +1 -0
  18. package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
  19. package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
  20. package/dist/execution/adapters/copilot-adapter.js +163 -0
  21. package/dist/execution/adapters/copilot-adapter.js.map +1 -0
  22. package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
  23. package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
  24. package/dist/execution/adapters/copilot-config-builder.js +125 -0
  25. package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
  26. package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
  27. package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
  28. package/dist/execution/adapters/cursor-adapter.js +121 -0
  29. package/dist/execution/adapters/cursor-adapter.js.map +1 -0
  30. package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
  31. package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
  32. package/dist/execution/adapters/cursor-config-builder.js +49 -0
  33. package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
  34. package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
  35. package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
  36. package/dist/execution/adapters/shared/config-presets.js +205 -0
  37. package/dist/execution/adapters/shared/config-presets.js.map +1 -0
  38. package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
  39. package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
  40. package/dist/execution/adapters/shared/config-utils.js +163 -0
  41. package/dist/execution/adapters/shared/config-utils.js.map +1 -0
  42. package/dist/execution/adapters/shared/index.d.ts +8 -0
  43. package/dist/execution/adapters/shared/index.d.ts.map +1 -0
  44. package/dist/execution/adapters/shared/index.js +8 -0
  45. package/dist/execution/adapters/shared/index.js.map +1 -0
  46. package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
  47. package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
  48. package/dist/execution/executors/agent-executor-wrapper.js +652 -0
  49. package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
  50. package/dist/execution/executors/executor-factory.d.ts +95 -0
  51. package/dist/execution/executors/executor-factory.d.ts.map +1 -0
  52. package/dist/execution/executors/executor-factory.js +120 -0
  53. package/dist/execution/executors/executor-factory.js.map +1 -0
  54. package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
  55. package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
  56. package/dist/execution/output/ag-ui-adapter.js +0 -2
  57. package/dist/execution/output/ag-ui-adapter.js.map +1 -1
  58. package/dist/execution/output/index.d.ts +0 -3
  59. package/dist/execution/output/index.d.ts.map +1 -1
  60. package/dist/execution/output/index.js +0 -2
  61. package/dist/execution/output/index.js.map +1 -1
  62. package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
  63. package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
  64. package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
  65. package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
  66. package/dist/execution/process/builders/claude.d.ts +25 -58
  67. package/dist/execution/process/builders/claude.d.ts.map +1 -1
  68. package/dist/execution/process/builders/claude.js +153 -19
  69. package/dist/execution/process/builders/claude.js.map +1 -1
  70. package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
  71. package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
  72. package/dist/execution/transport/ipc-transport-manager.js +104 -0
  73. package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
  74. package/dist/execution/transport/transport-manager.d.ts.map +1 -1
  75. package/dist/execution/transport/transport-manager.js +3 -0
  76. package/dist/execution/transport/transport-manager.js.map +1 -1
  77. package/dist/execution/worktree/conflict-detector.d.ts +85 -0
  78. package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
  79. package/dist/execution/worktree/conflict-detector.js +129 -0
  80. package/dist/execution/worktree/conflict-detector.js.map +1 -0
  81. package/dist/execution/worktree/git-cli.d.ts +9 -0
  82. package/dist/execution/worktree/git-cli.d.ts.map +1 -1
  83. package/dist/execution/worktree/git-cli.js +10 -0
  84. package/dist/execution/worktree/git-cli.js.map +1 -1
  85. package/dist/execution/worktree/git-sync-cli.d.ts +187 -0
  86. package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
  87. package/dist/execution/worktree/git-sync-cli.js +350 -0
  88. package/dist/execution/worktree/git-sync-cli.js.map +1 -0
  89. package/dist/execution/worktree/manager.d.ts +18 -0
  90. package/dist/execution/worktree/manager.d.ts.map +1 -1
  91. package/dist/execution/worktree/manager.js +9 -3
  92. package/dist/execution/worktree/manager.js.map +1 -1
  93. package/dist/index.d.ts +1 -3
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +175 -195
  96. package/dist/index.js.map +1 -1
  97. package/dist/middleware/project-context.d.ts +37 -0
  98. package/dist/middleware/project-context.d.ts.map +1 -0
  99. package/dist/middleware/project-context.js +91 -0
  100. package/dist/middleware/project-context.js.map +1 -0
  101. package/dist/public/assets/index-Bb_W5bUr.css +1 -0
  102. package/dist/public/assets/index-CFKL113G.js +710 -0
  103. package/dist/public/assets/index-CFKL113G.js.map +1 -0
  104. package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
  105. package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
  106. package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
  107. package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
  108. package/dist/public/index.html +4 -4
  109. package/dist/routes/agents.d.ts +3 -0
  110. package/dist/routes/agents.d.ts.map +1 -0
  111. package/dist/routes/agents.js +62 -0
  112. package/dist/routes/agents.js.map +1 -0
  113. package/dist/routes/config.d.ts +3 -0
  114. package/dist/routes/config.d.ts.map +1 -0
  115. package/dist/routes/config.js +25 -0
  116. package/dist/routes/config.js.map +1 -0
  117. package/dist/routes/editors.d.ts +15 -0
  118. package/dist/routes/editors.d.ts.map +1 -0
  119. package/dist/routes/editors.js +98 -0
  120. package/dist/routes/editors.js.map +1 -0
  121. package/dist/routes/executions-stream.d.ts +8 -5
  122. package/dist/routes/executions-stream.d.ts.map +1 -1
  123. package/dist/routes/executions-stream.js +10 -6
  124. package/dist/routes/executions-stream.js.map +1 -1
  125. package/dist/routes/executions.d.ts +6 -10
  126. package/dist/routes/executions.d.ts.map +1 -1
  127. package/dist/routes/executions.js +506 -54
  128. package/dist/routes/executions.js.map +1 -1
  129. package/dist/routes/feedback.d.ts +3 -2
  130. package/dist/routes/feedback.d.ts.map +1 -1
  131. package/dist/routes/feedback.js +32 -22
  132. package/dist/routes/feedback.js.map +1 -1
  133. package/dist/routes/files.d.ts +18 -0
  134. package/dist/routes/files.d.ts.map +1 -0
  135. package/dist/routes/files.js +89 -0
  136. package/dist/routes/files.js.map +1 -0
  137. package/dist/routes/issues.d.ts +3 -2
  138. package/dist/routes/issues.d.ts.map +1 -1
  139. package/dist/routes/issues.js +19 -18
  140. package/dist/routes/issues.js.map +1 -1
  141. package/dist/routes/projects.d.ts +11 -0
  142. package/dist/routes/projects.d.ts.map +1 -0
  143. package/dist/routes/projects.js +447 -0
  144. package/dist/routes/projects.js.map +1 -0
  145. package/dist/routes/relationships.d.ts +3 -2
  146. package/dist/routes/relationships.d.ts.map +1 -1
  147. package/dist/routes/relationships.js +12 -10
  148. package/dist/routes/relationships.js.map +1 -1
  149. package/dist/routes/repo-info.d.ts +3 -0
  150. package/dist/routes/repo-info.d.ts.map +1 -0
  151. package/dist/routes/repo-info.js +126 -0
  152. package/dist/routes/repo-info.js.map +1 -0
  153. package/dist/routes/specs.d.ts +3 -2
  154. package/dist/routes/specs.d.ts.map +1 -1
  155. package/dist/routes/specs.js +19 -18
  156. package/dist/routes/specs.js.map +1 -1
  157. package/dist/services/agent-registry.d.ts +140 -0
  158. package/dist/services/agent-registry.d.ts.map +1 -0
  159. package/dist/services/agent-registry.js +272 -0
  160. package/dist/services/agent-registry.js.map +1 -0
  161. package/dist/services/db.d.ts.map +1 -1
  162. package/dist/services/db.js +19 -14
  163. package/dist/services/db.js.map +1 -1
  164. package/dist/services/editor-service.d.ts +57 -0
  165. package/dist/services/editor-service.d.ts.map +1 -0
  166. package/dist/services/editor-service.js +204 -0
  167. package/dist/services/editor-service.js.map +1 -0
  168. package/dist/services/execution-changes-service.d.ts +92 -0
  169. package/dist/services/execution-changes-service.d.ts.map +1 -0
  170. package/dist/services/execution-changes-service.js +546 -0
  171. package/dist/services/execution-changes-service.js.map +1 -0
  172. package/dist/services/execution-lifecycle.d.ts +1 -0
  173. package/dist/services/execution-lifecycle.d.ts.map +1 -1
  174. package/dist/services/execution-lifecycle.js +37 -7
  175. package/dist/services/execution-lifecycle.js.map +1 -1
  176. package/dist/services/execution-logs-store.d.ts +75 -0
  177. package/dist/services/execution-logs-store.d.ts.map +1 -1
  178. package/dist/services/execution-logs-store.js +142 -2
  179. package/dist/services/execution-logs-store.js.map +1 -1
  180. package/dist/services/execution-service.d.ts +50 -58
  181. package/dist/services/execution-service.d.ts.map +1 -1
  182. package/dist/services/execution-service.js +433 -448
  183. package/dist/services/execution-service.js.map +1 -1
  184. package/dist/services/execution-worker-pool.d.ts +116 -0
  185. package/dist/services/execution-worker-pool.d.ts.map +1 -0
  186. package/dist/services/execution-worker-pool.js +326 -0
  187. package/dist/services/execution-worker-pool.js.map +1 -0
  188. package/dist/services/executions.d.ts +3 -0
  189. package/dist/services/executions.d.ts.map +1 -1
  190. package/dist/services/executions.js +11 -2
  191. package/dist/services/executions.js.map +1 -1
  192. package/dist/services/export.d.ts +8 -2
  193. package/dist/services/export.d.ts.map +1 -1
  194. package/dist/services/export.js +29 -23
  195. package/dist/services/export.js.map +1 -1
  196. package/dist/services/feedback.d.ts +16 -0
  197. package/dist/services/feedback.d.ts.map +1 -1
  198. package/dist/services/feedback.js +25 -1
  199. package/dist/services/feedback.js.map +1 -1
  200. package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
  201. package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
  202. package/dist/services/file-search/git-ls-files-strategy.js +176 -0
  203. package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
  204. package/dist/services/file-search/index.d.ts +9 -0
  205. package/dist/services/file-search/index.d.ts.map +1 -0
  206. package/dist/services/file-search/index.js +10 -0
  207. package/dist/services/file-search/index.js.map +1 -0
  208. package/dist/services/file-search/registry.d.ts +97 -0
  209. package/dist/services/file-search/registry.d.ts.map +1 -0
  210. package/dist/services/file-search/registry.js +140 -0
  211. package/dist/services/file-search/registry.js.map +1 -0
  212. package/dist/services/file-search/strategy.d.ts +58 -0
  213. package/dist/services/file-search/strategy.d.ts.map +1 -0
  214. package/dist/services/file-search/strategy.js +8 -0
  215. package/dist/services/file-search/strategy.js.map +1 -0
  216. package/dist/services/project-context.d.ts +69 -0
  217. package/dist/services/project-context.d.ts.map +1 -0
  218. package/dist/services/project-context.js +113 -0
  219. package/dist/services/project-context.js.map +1 -0
  220. package/dist/services/project-manager.d.ts +95 -0
  221. package/dist/services/project-manager.d.ts.map +1 -0
  222. package/dist/services/project-manager.js +388 -0
  223. package/dist/services/project-manager.js.map +1 -0
  224. package/dist/services/project-registry.d.ts +98 -0
  225. package/dist/services/project-registry.d.ts.map +1 -0
  226. package/dist/services/project-registry.js +289 -0
  227. package/dist/services/project-registry.js.map +1 -0
  228. package/dist/services/prompt-resolver.d.ts +97 -0
  229. package/dist/services/prompt-resolver.d.ts.map +1 -0
  230. package/dist/services/prompt-resolver.js +377 -0
  231. package/dist/services/prompt-resolver.js.map +1 -0
  232. package/dist/services/repo-info.d.ts +29 -0
  233. package/dist/services/repo-info.d.ts.map +1 -0
  234. package/dist/services/repo-info.js +99 -0
  235. package/dist/services/repo-info.js.map +1 -0
  236. package/dist/services/watcher.d.ts +3 -4
  237. package/dist/services/watcher.d.ts.map +1 -1
  238. package/dist/services/watcher.js +18 -35
  239. package/dist/services/watcher.js.map +1 -1
  240. package/dist/services/websocket.d.ts +51 -15
  241. package/dist/services/websocket.d.ts.map +1 -1
  242. package/dist/services/websocket.js +169 -40
  243. package/dist/services/websocket.js.map +1 -1
  244. package/dist/services/worktree-sync-service.d.ts +228 -0
  245. package/dist/services/worktree-sync-service.d.ts.map +1 -0
  246. package/dist/services/worktree-sync-service.js +563 -0
  247. package/dist/services/worktree-sync-service.js.map +1 -0
  248. package/dist/types/editor.d.ts +49 -0
  249. package/dist/types/editor.d.ts.map +1 -0
  250. package/dist/types/editor.js +50 -0
  251. package/dist/types/editor.js.map +1 -0
  252. package/dist/types/project.d.ts +58 -0
  253. package/dist/types/project.d.ts.map +1 -0
  254. package/dist/types/project.js +10 -0
  255. package/dist/types/project.js.map +1 -0
  256. package/dist/utils/executable-check.d.ts +36 -0
  257. package/dist/utils/executable-check.d.ts.map +1 -0
  258. package/dist/utils/executable-check.js +79 -0
  259. package/dist/utils/executable-check.js.map +1 -0
  260. package/dist/workers/execution-worker.d.ts +18 -0
  261. package/dist/workers/execution-worker.d.ts.map +1 -0
  262. package/dist/workers/execution-worker.js +340 -0
  263. package/dist/workers/execution-worker.js.map +1 -0
  264. package/dist/workers/worker-ipc.d.ts +84 -0
  265. package/dist/workers/worker-ipc.d.ts.map +1 -0
  266. package/dist/workers/worker-ipc.js +29 -0
  267. package/dist/workers/worker-ipc.js.map +1 -0
  268. package/package.json +6 -4
  269. package/dist/execution/engine/engine.d.ts +0 -103
  270. package/dist/execution/engine/engine.d.ts.map +0 -1
  271. package/dist/execution/engine/engine.js +0 -10
  272. package/dist/execution/engine/engine.js.map +0 -1
  273. package/dist/execution/engine/simple-engine.d.ts +0 -190
  274. package/dist/execution/engine/simple-engine.d.ts.map +0 -1
  275. package/dist/execution/engine/simple-engine.js +0 -611
  276. package/dist/execution/engine/simple-engine.js.map +0 -1
  277. package/dist/execution/engine/types.d.ts +0 -116
  278. package/dist/execution/engine/types.d.ts.map +0 -1
  279. package/dist/execution/engine/types.js +0 -10
  280. package/dist/execution/engine/types.js.map +0 -1
  281. package/dist/execution/output/ag-ui-integration.d.ts +0 -96
  282. package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
  283. package/dist/execution/output/ag-ui-integration.js +0 -96
  284. package/dist/execution/output/ag-ui-integration.js.map +0 -1
  285. package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
  286. package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
  287. package/dist/execution/output/claude-code-output-processor.js +0 -769
  288. package/dist/execution/output/claude-code-output-processor.js.map +0 -1
  289. package/dist/execution/process/index.d.ts +0 -15
  290. package/dist/execution/process/index.d.ts.map +0 -1
  291. package/dist/execution/process/index.js +0 -15
  292. package/dist/execution/process/index.js.map +0 -1
  293. package/dist/execution/process/manager.d.ts +0 -133
  294. package/dist/execution/process/manager.d.ts.map +0 -1
  295. package/dist/execution/process/manager.js +0 -10
  296. package/dist/execution/process/manager.js.map +0 -1
  297. package/dist/execution/process/simple-manager.d.ts +0 -102
  298. package/dist/execution/process/simple-manager.d.ts.map +0 -1
  299. package/dist/execution/process/simple-manager.js +0 -336
  300. package/dist/execution/process/simple-manager.js.map +0 -1
  301. package/dist/execution/process/types.d.ts +0 -105
  302. package/dist/execution/process/types.d.ts.map +0 -1
  303. package/dist/execution/process/types.js +0 -10
  304. package/dist/execution/process/types.js.map +0 -1
  305. package/dist/execution/process/utils.d.ts +0 -53
  306. package/dist/execution/process/utils.d.ts.map +0 -1
  307. package/dist/execution/process/utils.js +0 -97
  308. package/dist/execution/process/utils.js.map +0 -1
  309. package/dist/execution/resilience/circuit-breaker.d.ts +0 -170
  310. package/dist/execution/resilience/circuit-breaker.d.ts.map +0 -1
  311. package/dist/execution/resilience/circuit-breaker.js +0 -291
  312. package/dist/execution/resilience/circuit-breaker.js.map +0 -1
  313. package/dist/execution/resilience/executor.d.ts +0 -109
  314. package/dist/execution/resilience/executor.d.ts.map +0 -1
  315. package/dist/execution/resilience/executor.js +0 -10
  316. package/dist/execution/resilience/executor.js.map +0 -1
  317. package/dist/execution/resilience/index.d.ts +0 -14
  318. package/dist/execution/resilience/index.d.ts.map +0 -1
  319. package/dist/execution/resilience/index.js +0 -15
  320. package/dist/execution/resilience/index.js.map +0 -1
  321. package/dist/execution/resilience/resilient-executor.d.ts +0 -86
  322. package/dist/execution/resilience/resilient-executor.d.ts.map +0 -1
  323. package/dist/execution/resilience/resilient-executor.js +0 -261
  324. package/dist/execution/resilience/resilient-executor.js.map +0 -1
  325. package/dist/execution/resilience/retry.d.ts +0 -161
  326. package/dist/execution/resilience/retry.d.ts.map +0 -1
  327. package/dist/execution/resilience/retry.js +0 -234
  328. package/dist/execution/resilience/retry.js.map +0 -1
  329. package/dist/execution/resilience/types.d.ts +0 -226
  330. package/dist/execution/resilience/types.d.ts.map +0 -1
  331. package/dist/execution/resilience/types.js +0 -30
  332. package/dist/execution/resilience/types.js.map +0 -1
  333. package/dist/execution/workflow/index.d.ts +0 -13
  334. package/dist/execution/workflow/index.d.ts.map +0 -1
  335. package/dist/execution/workflow/index.js +0 -13
  336. package/dist/execution/workflow/index.js.map +0 -1
  337. package/dist/execution/workflow/linear-orchestrator.d.ts +0 -216
  338. package/dist/execution/workflow/linear-orchestrator.d.ts.map +0 -1
  339. package/dist/execution/workflow/linear-orchestrator.js +0 -683
  340. package/dist/execution/workflow/linear-orchestrator.js.map +0 -1
  341. package/dist/execution/workflow/memory-storage.d.ts +0 -54
  342. package/dist/execution/workflow/memory-storage.d.ts.map +0 -1
  343. package/dist/execution/workflow/memory-storage.js +0 -68
  344. package/dist/execution/workflow/memory-storage.js.map +0 -1
  345. package/dist/execution/workflow/orchestrator.d.ts +0 -158
  346. package/dist/execution/workflow/orchestrator.d.ts.map +0 -1
  347. package/dist/execution/workflow/orchestrator.js +0 -9
  348. package/dist/execution/workflow/orchestrator.js.map +0 -1
  349. package/dist/execution/workflow/types.d.ts +0 -172
  350. package/dist/execution/workflow/types.d.ts.map +0 -1
  351. package/dist/execution/workflow/types.js +0 -9
  352. package/dist/execution/workflow/types.js.map +0 -1
  353. package/dist/execution/workflow/utils.d.ts +0 -89
  354. package/dist/execution/workflow/utils.d.ts.map +0 -1
  355. package/dist/execution/workflow/utils.js +0 -152
  356. package/dist/execution/workflow/utils.js.map +0 -1
  357. package/dist/public/assets/index-BvlblDHK.js +0 -570
  358. package/dist/public/assets/index-BvlblDHK.js.map +0 -1
  359. package/dist/public/assets/index-BwuKdLgN.css +0 -1
  360. package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
  361. package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
@@ -0,0 +1,272 @@
1
+ /**
2
+ * Agent Registry Service
3
+ *
4
+ * Centralized service for managing agent adapters and providing agent discovery.
5
+ * Wraps the agent-execution-engine's AgentRegistry with sudocode-specific logic.
6
+ */
7
+ import { AgentRegistry } from "agent-execution-engine/agents";
8
+ import { ClaudeCodeAdapter } from "../execution/adapters/claude-adapter.js";
9
+ import { CodexAdapter } from "../execution/adapters/codex-adapter.js";
10
+ import { CursorAdapter } from "../execution/adapters/cursor-adapter.js";
11
+ import { copilotAdapter } from "../execution/adapters/copilot-adapter.js";
12
+ import { verifyExecutable, } from "../utils/executable-check.js";
13
+ /**
14
+ * Error thrown when an agent is not found in the registry
15
+ */
16
+ export class AgentNotFoundError extends Error {
17
+ constructor(agentType) {
18
+ super(`Agent '${agentType}' not found in registry`);
19
+ this.name = "AgentNotFoundError";
20
+ }
21
+ }
22
+ /**
23
+ * Error thrown when attempting to use an unimplemented agent
24
+ */
25
+ export class AgentNotImplementedError extends Error {
26
+ constructor(agentType) {
27
+ super(`Agent '${agentType}' is not yet implemented`);
28
+ this.name = "AgentNotImplementedError";
29
+ }
30
+ }
31
+ export class AgentRegistryService {
32
+ registry;
33
+ implementedAgents = new Set([
34
+ "claude-code",
35
+ "codex",
36
+ "cursor",
37
+ "copilot",
38
+ ]);
39
+ initialized = false;
40
+ /**
41
+ * Map of agent types to their default executable names
42
+ */
43
+ agentExecutables = {
44
+ "claude-code": "claude",
45
+ codex: "codex",
46
+ cursor: "cursor-agent",
47
+ copilot: "copilot",
48
+ };
49
+ /**
50
+ * Cache for verification results
51
+ * Key: agent type, Value: cached verification result with timestamp
52
+ */
53
+ verificationCache = new Map();
54
+ /**
55
+ * Cache TTL in milliseconds (default: 24 hours)
56
+ * Set to a very long duration since agent installations rarely change
57
+ */
58
+ cacheTTL = 24 * 60 * 60 * 1000; // 24 hours
59
+ constructor() {
60
+ this.registry = new AgentRegistry();
61
+ }
62
+ /**
63
+ * Initialize the registry by registering all agent adapters
64
+ * Called automatically on first use (lazy initialization)
65
+ */
66
+ initialize() {
67
+ if (this.initialized) {
68
+ return;
69
+ }
70
+ // Register fully implemented adapters
71
+ this.registry.register(new ClaudeCodeAdapter());
72
+ this.registry.register(new CodexAdapter());
73
+ this.registry.register(new CursorAdapter());
74
+ this.registry.register(copilotAdapter);
75
+ this.initialized = true;
76
+ }
77
+ /**
78
+ * Get all available agents with their metadata and implementation status
79
+ *
80
+ * @returns Array of agent information
81
+ */
82
+ getAvailableAgents() {
83
+ this.initialize();
84
+ return this.registry.getAll().map((adapter) => ({
85
+ ...adapter.metadata,
86
+ implemented: this.implementedAgents.has(adapter.metadata.name),
87
+ }));
88
+ }
89
+ /**
90
+ * Get an agent adapter by type
91
+ *
92
+ * @param agentType - The agent type to retrieve
93
+ * @returns The agent adapter
94
+ * @throws {AgentNotFoundError} If agent is not registered
95
+ */
96
+ getAdapter(agentType) {
97
+ this.initialize();
98
+ const adapter = this.registry.get(agentType);
99
+ if (!adapter) {
100
+ throw new AgentNotFoundError(agentType);
101
+ }
102
+ return adapter;
103
+ }
104
+ /**
105
+ * Check if an agent is fully implemented
106
+ *
107
+ * @param agentType - The agent type to check
108
+ * @returns True if the agent is implemented, false if it's a stub
109
+ */
110
+ isAgentImplemented(agentType) {
111
+ this.initialize();
112
+ return this.implementedAgents.has(agentType);
113
+ }
114
+ /**
115
+ * Check if an agent is registered in the registry
116
+ *
117
+ * @param agentType - The agent type to check
118
+ * @returns True if the agent is registered
119
+ */
120
+ hasAgent(agentType) {
121
+ this.initialize();
122
+ return this.registry.has(agentType);
123
+ }
124
+ /**
125
+ * Mark an agent as implemented
126
+ * Used when upgrading a stub adapter to a full implementation
127
+ *
128
+ * @param agentType - The agent type to mark as implemented
129
+ */
130
+ markAsImplemented(agentType) {
131
+ this.initialize();
132
+ if (!this.hasAgent(agentType)) {
133
+ throw new AgentNotFoundError(agentType);
134
+ }
135
+ this.implementedAgents.add(agentType);
136
+ }
137
+ /**
138
+ * Check if cached verification is still valid
139
+ *
140
+ * @param agentType - The agent type to check
141
+ * @returns Cached result if valid, undefined otherwise
142
+ */
143
+ getCachedVerification(agentType) {
144
+ const cached = this.verificationCache.get(agentType);
145
+ if (!cached) {
146
+ return undefined;
147
+ }
148
+ const age = Date.now() - cached.timestamp;
149
+ if (age > this.cacheTTL) {
150
+ // Cache expired, remove it
151
+ this.verificationCache.delete(agentType);
152
+ return undefined;
153
+ }
154
+ return cached.result;
155
+ }
156
+ /**
157
+ * Cache a verification result
158
+ *
159
+ * @param agentType - The agent type
160
+ * @param result - The verification result to cache
161
+ */
162
+ cacheVerification(agentType, result) {
163
+ this.verificationCache.set(agentType, {
164
+ result,
165
+ timestamp: Date.now(),
166
+ });
167
+ }
168
+ /**
169
+ * Clear verification cache for a specific agent or all agents
170
+ *
171
+ * @param agentType - Optional agent type to clear. If not provided, clears all cache.
172
+ */
173
+ clearVerificationCache(agentType) {
174
+ if (agentType) {
175
+ this.verificationCache.delete(agentType);
176
+ }
177
+ else {
178
+ this.verificationCache.clear();
179
+ }
180
+ }
181
+ /**
182
+ * Verify if a specific agent's executable is available on the system
183
+ * Results are cached for performance
184
+ *
185
+ * @param agentType - The agent type to verify
186
+ * @param skipCache - If true, bypass cache and perform fresh verification
187
+ * @returns Promise<VerificationResult>
188
+ */
189
+ async verifyAgent(agentType, skipCache = false) {
190
+ this.initialize();
191
+ // Check cache first unless skipCache is true
192
+ if (!skipCache) {
193
+ const cached = this.getCachedVerification(agentType);
194
+ if (cached) {
195
+ return cached;
196
+ }
197
+ }
198
+ // Check if agent is registered
199
+ if (!this.hasAgent(agentType)) {
200
+ const result = {
201
+ available: false,
202
+ error: `Agent '${agentType}' not found in registry`,
203
+ };
204
+ this.cacheVerification(agentType, result);
205
+ return result;
206
+ }
207
+ // Check if agent is implemented
208
+ if (!this.isAgentImplemented(agentType)) {
209
+ const result = {
210
+ available: false,
211
+ error: `Agent '${agentType}' is not yet implemented`,
212
+ };
213
+ this.cacheVerification(agentType, result);
214
+ return result;
215
+ }
216
+ // Get the default executable name for this agent
217
+ const executableName = this.agentExecutables[agentType];
218
+ if (!executableName) {
219
+ const result = {
220
+ available: false,
221
+ error: `No executable mapping found for agent '${agentType}'`,
222
+ };
223
+ this.cacheVerification(agentType, result);
224
+ return result;
225
+ }
226
+ // Verify the executable exists
227
+ const result = await verifyExecutable(executableName);
228
+ this.cacheVerification(agentType, result);
229
+ return result;
230
+ }
231
+ /**
232
+ * Verify all implemented agents and return their availability status
233
+ *
234
+ * @returns Promise<Map<string, VerificationResult>>
235
+ */
236
+ async verifyAllAgents() {
237
+ this.initialize();
238
+ const results = new Map();
239
+ // Get all implemented agents
240
+ const agents = this.getAvailableAgents().filter((agent) => agent.implemented);
241
+ // Verify each agent in parallel
242
+ await Promise.all(agents.map(async (agent) => {
243
+ const result = await this.verifyAgent(agent.name);
244
+ results.set(agent.name, result);
245
+ }));
246
+ return results;
247
+ }
248
+ /**
249
+ * Get all available agents with their verification status included
250
+ *
251
+ * @returns Promise<AgentInfo[]> - Array of agent information with availability status
252
+ */
253
+ async getAvailableAgentsWithVerification() {
254
+ this.initialize();
255
+ const agents = this.getAvailableAgents();
256
+ const verificationResults = await this.verifyAllAgents();
257
+ return agents.map((agent) => {
258
+ const verification = verificationResults.get(agent.name);
259
+ return {
260
+ ...agent,
261
+ available: verification?.available,
262
+ executablePath: verification?.path,
263
+ verificationError: verification?.error,
264
+ };
265
+ });
266
+ }
267
+ }
268
+ /**
269
+ * Global agent registry service instance
270
+ */
271
+ export const agentRegistryService = new AgentRegistryService();
272
+ //# sourceMappingURL=agent-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-registry.js","sourceRoot":"","sources":["../../src/services/agent-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EACL,gBAAgB,GAEjB,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,M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AEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAatC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAwCtE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAa3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ;;;;EAqBpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAEzD"}
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/services/db.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAOtC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CAAC,QAAQ,CA8CtE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAa3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ;;;;EAqBpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAEzD"}
@@ -5,7 +5,8 @@
5
5
  import Database from "better-sqlite3";
6
6
  import * as path from "path";
7
7
  import * as fs from "fs";
8
- import { EXECUTIONS_TABLE, EXECUTIONS_INDEXES, PROMPT_TEMPLATES_TABLE, PROMPT_TEMPLATES_INDEXES, EXECUTION_LOGS_TABLE, EXECUTION_LOGS_INDEXES, } from "@sudocode-ai/types/schema";
8
+ import * as schema from "@sudocode-ai/types/schema";
9
+ import { runMigrations } from "@sudocode-ai/types/migrations";
9
10
  import { initializeDefaultTemplates } from "./prompt-templates.js";
10
11
  /**
11
12
  * Initialize database with CLI schema + server extensions
@@ -26,19 +27,23 @@ export function initDatabase(config) {
26
27
  if (readOnly) {
27
28
  return db;
28
29
  }
29
- // Configure database
30
- db.pragma("journal_mode = WAL");
31
- db.pragma("foreign_keys = ON");
32
- db.pragma("synchronous = NORMAL");
33
- db.pragma("temp_store = MEMORY");
34
- // Create server-specific tables
35
- db.exec(EXECUTIONS_TABLE);
36
- db.exec(PROMPT_TEMPLATES_TABLE);
37
- db.exec(EXECUTION_LOGS_TABLE);
38
- // Create indexes
39
- db.exec(EXECUTIONS_INDEXES);
40
- db.exec(PROMPT_TEMPLATES_INDEXES);
41
- db.exec(EXECUTION_LOGS_INDEXES);
30
+ // Apply database configuration
31
+ db.exec(schema.DB_CONFIG);
32
+ // Create all tables (CLI + server-specific)
33
+ for (const table of schema.ALL_TABLES) {
34
+ db.exec(table);
35
+ }
36
+ // Run any pending migrations BEFORE creating indexes
37
+ // (migrations might alter table schemas that indexes depend on)
38
+ runMigrations(db);
39
+ // Create all indexes (CLI + server-specific)
40
+ for (const indexes of schema.ALL_INDEXES) {
41
+ db.exec(indexes);
42
+ }
43
+ // Create all views
44
+ for (const view of schema.ALL_VIEWS) {
45
+ db.exec(view);
46
+ }
42
47
  // Initialize default prompt templates
43
48
  initializeDefaultTemplates(db);
44
49
  return db;
@@ -1 +1 @@
1
- {"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/services/db.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;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C;IAE/B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,EAAqB;IAChD,MAAM,MAAM,GAAG,EAAE;SACd,OAAO,CACN;;;;;GAKH,CACE;SACA,GAAG,EAAuB,CAAC;IAE9B,OAAO,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,EAAqB;IACnD,MAAM,MAAM,GAAG,EAAE;SACd,OAAO,CACN;;;;;GAKH,CACE;SACA,GAAG,EAAwB,CAAC;IAE/B,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,GAAG,EAEpD,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACjC,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC;KAC/B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAAqB;IACjD,EAAE,CAAC,KAAK,EAAE,CAAC;AACb,CAAC"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * EditorService - Manages IDE opening functionality
3
+ */
4
+ import { EditorType, EditorConfig } from "../types/editor.js";
5
+ /**
6
+ * EditorService handles IDE opening operations
7
+ */
8
+ export declare class EditorService {
9
+ private repoPath;
10
+ private configCache;
11
+ private configCacheTime;
12
+ private readonly CONFIG_CACHE_TTL;
13
+ constructor(repoPath: string);
14
+ /**
15
+ * Load editor configuration from .sudocode/config.local.json
16
+ * Falls back to default (VS Code) if file doesn't exist
17
+ */
18
+ loadConfig(): Promise<EditorConfig>;
19
+ /**
20
+ * Get command name for editor type
21
+ */
22
+ getCommand(editorType: EditorType, customCommand?: string): string;
23
+ /**
24
+ * Check if editor command is available using 'which' package
25
+ */
26
+ checkAvailability(command: string): Promise<boolean>;
27
+ /**
28
+ * Spawn editor process with worktree path
29
+ *
30
+ * @param worktreePath - Absolute path to worktree directory
31
+ * @param config - Editor configuration
32
+ * @throws EditorOpenError if spawn fails
33
+ */
34
+ spawnEditor(worktreePath: string, config: EditorConfig): Promise<void>;
35
+ /**
36
+ * Open worktree in IDE using configured editor
37
+ *
38
+ * @param worktreePath - Absolute path to worktree directory
39
+ * @param editorTypeOverride - Optional editor type override for this operation
40
+ */
41
+ openWorktree(worktreePath: string, editorTypeOverride?: EditorType): Promise<void>;
42
+ /**
43
+ * Check availability of all supported editors
44
+ * Useful for settings UI to show which editors are installed
45
+ */
46
+ checkAllAvailability(): Promise<Record<EditorType, boolean>>;
47
+ /**
48
+ * Get human-readable editor name for error messages
49
+ */
50
+ private getEditorName;
51
+ /**
52
+ * Clear the config cache
53
+ * Useful for testing or when config file is updated
54
+ */
55
+ clearCache(): void;
56
+ }
57
+ //# sourceMappingURL=editor-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-service.d.ts","sourceRoot":"","sources":["../../src/services/editor-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAsB/E;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,eAAe,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAiB;gBAEtC,QAAQ,EAAE,MAAM;IAI5B;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,YAAY,CAAC;IAkDzC;;OAEG;IACH,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM;IAOlE;;OAEG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1D;;;;;;OAMG;IACG,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAoE5E;;;;;OAKG;IACG,YAAY,CAChB,YAAY,EAAE,MAAM,EACpB,kBAAkB,CAAC,EAAE,UAAU,GAC9B,OAAO,CAAC,IAAI,CAAC;IAehB;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAiBlE;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;;OAGG;IACH,UAAU,IAAI,IAAI;CAInB"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * EditorService - Manages IDE opening functionality
3
+ */
4
+ import { spawn } from "child_process";
5
+ import * as fs from "fs/promises";
6
+ import * as path from "path";
7
+ import which from "which";
8
+ import { EditorType, EditorOpenError } from "../types/editor.js";
9
+ /**
10
+ * Command mapping for each editor type
11
+ */
12
+ const EDITOR_COMMANDS = {
13
+ [EditorType.VS_CODE]: "code",
14
+ [EditorType.CURSOR]: "cursor",
15
+ [EditorType.WINDSURF]: "windsurf",
16
+ [EditorType.INTELLIJ]: "idea",
17
+ [EditorType.ZED]: "zed",
18
+ [EditorType.XCODE]: "xed",
19
+ [EditorType.CUSTOM]: "", // Handled specially via customCommand
20
+ };
21
+ /**
22
+ * Default editor configuration
23
+ */
24
+ const DEFAULT_CONFIG = {
25
+ editorType: EditorType.VS_CODE,
26
+ };
27
+ /**
28
+ * EditorService handles IDE opening operations
29
+ */
30
+ export class EditorService {
31
+ repoPath;
32
+ configCache = null;
33
+ configCacheTime = 0;
34
+ CONFIG_CACHE_TTL = 5 * 60 * 1000; // 5 minutes
35
+ constructor(repoPath) {
36
+ this.repoPath = repoPath;
37
+ }
38
+ /**
39
+ * Load editor configuration from .sudocode/config.local.json
40
+ * Falls back to default (VS Code) if file doesn't exist
41
+ */
42
+ async loadConfig() {
43
+ // Check cache
44
+ const now = Date.now();
45
+ if (this.configCache &&
46
+ now - this.configCacheTime < this.CONFIG_CACHE_TTL) {
47
+ return this.configCache;
48
+ }
49
+ const configPath = path.join(this.repoPath, ".sudocode", "config.local.json");
50
+ try {
51
+ const content = await fs.readFile(configPath, "utf-8");
52
+ const parsed = JSON.parse(content);
53
+ if (parsed.editor && typeof parsed.editor.editorType === "string") {
54
+ const config = {
55
+ editorType: parsed.editor.editorType,
56
+ customCommand: parsed.editor.customCommand,
57
+ };
58
+ // Validate editor type
59
+ if (!Object.values(EditorType).includes(config.editorType)) {
60
+ console.warn(`Invalid editor type in config: ${config.editorType}, using default`);
61
+ return DEFAULT_CONFIG;
62
+ }
63
+ // Cache the config
64
+ this.configCache = config;
65
+ this.configCacheTime = now;
66
+ return config;
67
+ }
68
+ }
69
+ catch (error) {
70
+ // Config file doesn't exist or is invalid, use default
71
+ if (error.code !== "ENOENT") {
72
+ console.warn("Failed to load editor config:", error);
73
+ }
74
+ }
75
+ return DEFAULT_CONFIG;
76
+ }
77
+ /**
78
+ * Get command name for editor type
79
+ */
80
+ getCommand(editorType, customCommand) {
81
+ if (editorType === EditorType.CUSTOM) {
82
+ return customCommand || EDITOR_COMMANDS[EditorType.VS_CODE];
83
+ }
84
+ return EDITOR_COMMANDS[editorType];
85
+ }
86
+ /**
87
+ * Check if editor command is available using 'which' package
88
+ */
89
+ async checkAvailability(command) {
90
+ try {
91
+ await which(command);
92
+ return true;
93
+ }
94
+ catch {
95
+ return false;
96
+ }
97
+ }
98
+ /**
99
+ * Spawn editor process with worktree path
100
+ *
101
+ * @param worktreePath - Absolute path to worktree directory
102
+ * @param config - Editor configuration
103
+ * @throws EditorOpenError if spawn fails
104
+ */
105
+ async spawnEditor(worktreePath, config) {
106
+ const command = this.getCommand(config.editorType, config.customCommand);
107
+ // Check if command is available
108
+ const isAvailable = await this.checkAvailability(command);
109
+ if (!isAvailable) {
110
+ throw new EditorOpenError("EDITOR_NOT_FOUND", config.editorType, `Editor '${command}' not found in PATH`, `Please install ${this.getEditorName(config.editorType)} or configure a different editor`);
111
+ }
112
+ // Check if worktree path exists
113
+ try {
114
+ await fs.access(worktreePath);
115
+ const stats = await fs.stat(worktreePath);
116
+ if (!stats.isDirectory()) {
117
+ throw new EditorOpenError("WORKTREE_MISSING", config.editorType, `Worktree path is not a directory: ${worktreePath}`, "The worktree path must be a valid directory");
118
+ }
119
+ }
120
+ catch (error) {
121
+ if (error.code === "ENOENT") {
122
+ throw new EditorOpenError("WORKTREE_MISSING", config.editorType, `Worktree directory not found: ${worktreePath}`, "The worktree may have been deleted or the path is incorrect");
123
+ }
124
+ // If it's already an EditorOpenError, re-throw it
125
+ if (error instanceof EditorOpenError) {
126
+ throw error;
127
+ }
128
+ // For other filesystem errors, wrap them
129
+ throw new EditorOpenError("WORKTREE_MISSING", config.editorType, `Cannot access worktree directory: ${worktreePath}`, error instanceof Error ? error.message : String(error));
130
+ }
131
+ try {
132
+ // Spawn in detached mode
133
+ const child = spawn(command, [worktreePath], {
134
+ detached: true,
135
+ stdio: "ignore",
136
+ cwd: worktreePath,
137
+ });
138
+ // Unref so parent process doesn't wait for child
139
+ child.unref();
140
+ }
141
+ catch (error) {
142
+ throw new EditorOpenError("SPAWN_FAILED", config.editorType, `Failed to launch editor '${command}'`, error instanceof Error ? error.message : String(error));
143
+ }
144
+ }
145
+ /**
146
+ * Open worktree in IDE using configured editor
147
+ *
148
+ * @param worktreePath - Absolute path to worktree directory
149
+ * @param editorTypeOverride - Optional editor type override for this operation
150
+ */
151
+ async openWorktree(worktreePath, editorTypeOverride) {
152
+ // Load config
153
+ let config = await this.loadConfig();
154
+ // Apply override if provided
155
+ if (editorTypeOverride) {
156
+ config = {
157
+ ...config,
158
+ editorType: editorTypeOverride,
159
+ };
160
+ }
161
+ await this.spawnEditor(worktreePath, config);
162
+ }
163
+ /**
164
+ * Check availability of all supported editors
165
+ * Useful for settings UI to show which editors are installed
166
+ */
167
+ async checkAllAvailability() {
168
+ const results = {};
169
+ for (const editorType of Object.values(EditorType)) {
170
+ if (editorType === EditorType.CUSTOM) {
171
+ // Custom editors can't be checked without knowing the command
172
+ results[editorType] = false;
173
+ continue;
174
+ }
175
+ const command = this.getCommand(editorType);
176
+ results[editorType] = await this.checkAvailability(command);
177
+ }
178
+ return results;
179
+ }
180
+ /**
181
+ * Get human-readable editor name for error messages
182
+ */
183
+ getEditorName(editorType) {
184
+ const names = {
185
+ [EditorType.VS_CODE]: "Visual Studio Code",
186
+ [EditorType.CURSOR]: "Cursor",
187
+ [EditorType.WINDSURF]: "Windsurf",
188
+ [EditorType.INTELLIJ]: "IntelliJ IDEA",
189
+ [EditorType.ZED]: "Zed",
190
+ [EditorType.XCODE]: "Xcode",
191
+ [EditorType.CUSTOM]: "Custom Editor",
192
+ };
193
+ return names[editorType];
194
+ }
195
+ /**
196
+ * Clear the config cache
197
+ * Useful for testing or when config file is updated
198
+ */
199
+ clearCache() {
200
+ this.configCache = null;
201
+ this.configCacheTime = 0;
202
+ }
203
+ }
204
+ //# sourceMappingURL=editor-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-service.js","sourceRoot":"","sources":["../../src/services/editor-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAgB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE/E;;GAEG;AACH,MAAM,eAAe,GAA+B;IAClD,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM;IAC5B,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ;IAC7B,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU;IACjC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM;IAC7B,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK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