@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,228 @@
1
+ /**
2
+ * Worktree Sync Service
3
+ *
4
+ * Orchestrates worktree sync operations including conflict detection,
5
+ * JSONL resolution, git operations, and database updates.
6
+ *
7
+ * @module services/worktree-sync-service
8
+ */
9
+ import type Database from "better-sqlite3";
10
+ import type { Execution, ExecutionStatus } from "@sudocode-ai/types";
11
+ import { type DiffResult, type Commit } from "../execution/worktree/git-sync-cli.js";
12
+ import { type ConflictReport, type JSONLConflict } from "../execution/worktree/conflict-detector.js";
13
+ /**
14
+ * Worktree sync error codes
15
+ */
16
+ export declare enum WorktreeSyncErrorCode {
17
+ NO_WORKTREE = "NO_WORKTREE",
18
+ WORKTREE_MISSING = "WORKTREE_MISSING",
19
+ BRANCH_MISSING = "BRANCH_MISSING",
20
+ DIRTY_WORKING_TREE = "DIRTY_WORKING_TREE",
21
+ TARGET_BRANCH_MISSING = "TARGET_BRANCH_MISSING",
22
+ NO_COMMON_BASE = "NO_COMMON_BASE",
23
+ CODE_CONFLICTS = "CODE_CONFLICTS",
24
+ MERGE_FAILED = "MERGE_FAILED",
25
+ JSONL_RESOLUTION_FAILED = "JSONL_RESOLUTION_FAILED",
26
+ DATABASE_SYNC_FAILED = "DATABASE_SYNC_FAILED",
27
+ EXECUTION_NOT_FOUND = "EXECUTION_NOT_FOUND"
28
+ }
29
+ /**
30
+ * Worktree sync error class
31
+ */
32
+ export declare class WorktreeSyncError extends Error {
33
+ code: WorktreeSyncErrorCode;
34
+ cause?: Error | undefined;
35
+ constructor(message: string, code: WorktreeSyncErrorCode, cause?: Error | undefined);
36
+ }
37
+ /**
38
+ * Sync preview result
39
+ */
40
+ export interface SyncPreviewResult {
41
+ canSync: boolean;
42
+ conflicts: ConflictReport;
43
+ diff: DiffResult;
44
+ commits: Commit[];
45
+ mergeBase: string;
46
+ uncommittedJSONLChanges: string[];
47
+ executionStatus: ExecutionStatus;
48
+ warnings: string[];
49
+ }
50
+ /**
51
+ * Squash sync result
52
+ */
53
+ export interface SyncResult {
54
+ success: boolean;
55
+ finalCommit?: string;
56
+ filesChanged: number;
57
+ conflictsResolved: number;
58
+ uncommittedJSONLIncluded: boolean;
59
+ error?: string;
60
+ cleanupOffered?: boolean;
61
+ }
62
+ /**
63
+ * WorktreeSyncService
64
+ *
65
+ * Main service class for orchestrating worktree sync operations
66
+ */
67
+ export declare class WorktreeSyncService {
68
+ private db;
69
+ private repoPath;
70
+ private gitSync;
71
+ private conflictDetector;
72
+ constructor(db: Database.Database, repoPath: string);
73
+ /**
74
+ * Preview sync without making changes
75
+ *
76
+ * @param executionId - Execution ID to preview sync for
77
+ * @returns Preview result with conflicts, diff, and warnings
78
+ */
79
+ previewSync(executionId: string): Promise<SyncPreviewResult>;
80
+ /**
81
+ * Load execution from database and validate it exists
82
+ *
83
+ * Used by previewSync() and will be used in i-9gz4 (squash sync)
84
+ *
85
+ * @param executionId - Execution ID to load
86
+ * @returns Execution record
87
+ * @throws WorktreeSyncError if execution not found
88
+ */
89
+ private _loadAndValidateExecution;
90
+ /**
91
+ * Validate preconditions for sync
92
+ *
93
+ * Used by previewSync() and will be used in i-9gz4 (squash sync)
94
+ *
95
+ * Checks:
96
+ * - Worktree exists
97
+ * - Worktree branch exists
98
+ * - Local working tree is clean
99
+ * - Target branch exists
100
+ * - Branches have common base
101
+ *
102
+ * @param execution - Execution to validate
103
+ * @throws WorktreeSyncError if any precondition fails
104
+ */
105
+ private _validateSyncPreconditions;
106
+ /**
107
+ * Create safety snapshot before sync
108
+ *
109
+ * Creates a git tag pointing to current target branch HEAD
110
+ * for rollback capability
111
+ *
112
+ * @param executionId - Execution ID
113
+ * @param targetBranch - Target branch name
114
+ * @returns Tag name created
115
+ */
116
+ private _createSafetySnapshot;
117
+ /**
118
+ * Get uncommitted JSONL files from worktree
119
+ *
120
+ * Used by previewSync() and will be used in i-3wmx (JSONL conflict resolution)
121
+ *
122
+ * @param worktreePath - Path to worktree
123
+ * @returns Array of uncommitted JSONL file paths
124
+ */
125
+ private _getUncommittedJSONLFiles;
126
+ /**
127
+ * Check if local working tree is clean
128
+ *
129
+ * TODO: Will be used in i-7ya6 (sync preview)
130
+ *
131
+ * @returns true if clean, false if dirty
132
+ */
133
+ private _isLocalTreeClean;
134
+ /**
135
+ * Get list of branches in repository
136
+ *
137
+ * @returns Array of branch names
138
+ */
139
+ private _getBranches;
140
+ /**
141
+ * Get current commit SHA for a branch
142
+ *
143
+ * @param branchName - Branch name
144
+ * @returns Commit SHA
145
+ */
146
+ private _getCurrentCommit;
147
+ /**
148
+ * Escape shell argument for safe command execution
149
+ *
150
+ * @param arg - Argument to escape
151
+ * @returns Escaped argument
152
+ */
153
+ private _escapeShellArg;
154
+ /**
155
+ * Resolve JSONL conflicts using three-way merge
156
+ *
157
+ * Used in squash sync to auto-resolve JSONL conflicts
158
+ *
159
+ * @param execution - Execution record
160
+ * @param jsonlConflicts - List of JSONL conflicts to resolve
161
+ * @throws WorktreeSyncError if resolution fails
162
+ */
163
+ resolveJSONLConflicts(execution: Execution, jsonlConflicts: JSONLConflict[]): Promise<void>;
164
+ /**
165
+ * Read JSONL file at a specific git revision
166
+ *
167
+ * @param filePath - Relative path to JSONL file
168
+ * @param revision - Git revision (commit SHA or branch name)
169
+ * @returns Array of JSONL entities
170
+ */
171
+ private _readJSONLVersion;
172
+ /**
173
+ * Commit uncommitted JSONL files in worktree
174
+ *
175
+ * Used during sync to include uncommitted JSONL changes
176
+ *
177
+ * @param worktreePath - Path to worktree
178
+ * @param uncommittedFiles - List of uncommitted JSONL file paths
179
+ * @throws WorktreeSyncError if commit fails
180
+ */
181
+ commitUncommittedJSONL(worktreePath: string, uncommittedFiles: string[]): Promise<void>;
182
+ /**
183
+ * Perform git merge --squash operation
184
+ *
185
+ * @param sourceBranch - Branch to merge from (worktree branch)
186
+ * @param targetBranch - Branch to merge into
187
+ * @returns Object with filesChanged count
188
+ * @throws WorktreeSyncError if merge fails
189
+ */
190
+ private _performSquashMerge;
191
+ /**
192
+ * Generate commit message for squash sync
193
+ *
194
+ * @param execution - Execution record
195
+ * @param commitCount - Number of commits being squashed
196
+ * @returns Generated commit message
197
+ */
198
+ private _generateCommitMessage;
199
+ /**
200
+ * Create commit with staged changes
201
+ *
202
+ * @param message - Commit message
203
+ * @returns Commit SHA
204
+ * @throws WorktreeSyncError if commit fails
205
+ */
206
+ private _createCommit;
207
+ /**
208
+ * Rollback to safety snapshot
209
+ *
210
+ * @param targetBranch - Target branch to reset
211
+ * @param tagName - Safety tag to rollback to
212
+ * @throws WorktreeSyncError if rollback fails
213
+ */
214
+ private _rollbackToSnapshot;
215
+ /**
216
+ * Perform squash sync operation
217
+ *
218
+ * Squashes all worktree commits into a single commit on the target branch.
219
+ * Auto-resolves JSONL conflicts but blocks on code conflicts.
220
+ *
221
+ * @param executionId - Execution ID to sync
222
+ * @param customCommitMessage - Optional custom commit message
223
+ * @returns Sync result with details
224
+ * @throws WorktreeSyncError if sync fails
225
+ */
226
+ squashSync(executionId: string, customCommitMessage?: string): Promise<SyncResult>;
227
+ }
228
+ //# sourceMappingURL=worktree-sync-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree-sync-service.d.ts","sourceRoot":"","sources":["../../src/services/worktree-sync-service.ts"],"names":[],"mappings":"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"}