@cleocode/cleo 2026.4.161 → 2026.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (857) hide show
  1. package/dist/backfill/audit-columns.d.ts +105 -0
  2. package/dist/backfill/audit-columns.d.ts.map +1 -0
  3. package/dist/backfill/audit-columns.js +258 -0
  4. package/dist/backfill/audit-columns.js.map +1 -0
  5. package/dist/cli/commands/adapter.d.ts +28 -0
  6. package/dist/cli/commands/adapter.d.ts.map +1 -0
  7. package/dist/cli/commands/adapter.js +119 -0
  8. package/dist/cli/commands/adapter.js.map +1 -0
  9. package/dist/cli/commands/add-batch.d.ts +33 -0
  10. package/dist/cli/commands/add-batch.d.ts.map +1 -0
  11. package/dist/cli/commands/add-batch.js +148 -0
  12. package/dist/cli/commands/add-batch.js.map +1 -0
  13. package/dist/cli/commands/add.d.ts +162 -0
  14. package/dist/cli/commands/add.d.ts.map +1 -0
  15. package/dist/cli/commands/add.js +279 -0
  16. package/dist/cli/commands/add.js.map +1 -0
  17. package/dist/cli/commands/admin.d.ts +24 -0
  18. package/dist/cli/commands/admin.d.ts.map +1 -0
  19. package/dist/cli/commands/admin.js +283 -0
  20. package/dist/cli/commands/admin.js.map +1 -0
  21. package/dist/cli/commands/adr.d.ts +33 -0
  22. package/dist/cli/commands/adr.d.ts.map +1 -0
  23. package/dist/cli/commands/adr.js +147 -0
  24. package/dist/cli/commands/adr.js.map +1 -0
  25. package/dist/cli/commands/agent-profile-status.d.ts +98 -0
  26. package/dist/cli/commands/agent-profile-status.d.ts.map +1 -0
  27. package/dist/cli/commands/agent-profile-status.js +71 -0
  28. package/dist/cli/commands/agent-profile-status.js.map +1 -0
  29. package/dist/cli/commands/agent.d.ts +47 -0
  30. package/dist/cli/commands/agent.d.ts.map +1 -0
  31. package/dist/cli/commands/agent.js +2976 -0
  32. package/dist/cli/commands/agent.js.map +1 -0
  33. package/dist/cli/commands/analyze.d.ts +21 -0
  34. package/dist/cli/commands/analyze.d.ts.map +1 -0
  35. package/dist/cli/commands/analyze.js +32 -0
  36. package/dist/cli/commands/analyze.js.map +1 -0
  37. package/dist/cli/commands/archive-stats.d.ts +66 -0
  38. package/dist/cli/commands/archive-stats.d.ts.map +1 -0
  39. package/dist/cli/commands/archive-stats.js +93 -0
  40. package/dist/cli/commands/archive-stats.js.map +1 -0
  41. package/dist/cli/commands/archive.d.ts +42 -0
  42. package/dist/cli/commands/archive.d.ts.map +1 -0
  43. package/dist/cli/commands/archive.js +59 -0
  44. package/dist/cli/commands/archive.js.map +1 -0
  45. package/dist/cli/commands/audit.d.ts +22 -0
  46. package/dist/cli/commands/audit.d.ts.map +1 -0
  47. package/dist/cli/commands/audit.js +137 -0
  48. package/dist/cli/commands/audit.js.map +1 -0
  49. package/dist/cli/commands/backfill.d.ts +56 -0
  50. package/dist/cli/commands/backfill.d.ts.map +1 -0
  51. package/dist/cli/commands/backfill.js +161 -0
  52. package/dist/cli/commands/backfill.js.map +1 -0
  53. package/dist/cli/commands/backup-inspect.d.ts +33 -0
  54. package/dist/cli/commands/backup-inspect.d.ts.map +1 -0
  55. package/dist/cli/commands/backup-inspect.js +430 -0
  56. package/dist/cli/commands/backup-inspect.js.map +1 -0
  57. package/dist/cli/commands/backup.d.ts +23 -0
  58. package/dist/cli/commands/backup.d.ts.map +1 -0
  59. package/dist/cli/commands/backup.js +564 -0
  60. package/dist/cli/commands/backup.js.map +1 -0
  61. package/dist/cli/commands/blockers.d.ts +20 -0
  62. package/dist/cli/commands/blockers.d.ts.map +1 -0
  63. package/dist/cli/commands/blockers.js +31 -0
  64. package/dist/cli/commands/blockers.js.map +1 -0
  65. package/dist/cli/commands/brain.d.ts +37 -0
  66. package/dist/cli/commands/brain.d.ts.map +1 -0
  67. package/dist/cli/commands/brain.js +445 -0
  68. package/dist/cli/commands/brain.js.map +1 -0
  69. package/dist/cli/commands/briefing.d.ts +52 -0
  70. package/dist/cli/commands/briefing.d.ts.map +1 -0
  71. package/dist/cli/commands/briefing.js +69 -0
  72. package/dist/cli/commands/briefing.js.map +1 -0
  73. package/dist/cli/commands/bug.d.ts +61 -0
  74. package/dist/cli/commands/bug.d.ts.map +1 -0
  75. package/dist/cli/commands/bug.js +198 -0
  76. package/dist/cli/commands/bug.js.map +1 -0
  77. package/dist/cli/commands/cancel.d.ts +26 -0
  78. package/dist/cli/commands/cancel.d.ts.map +1 -0
  79. package/dist/cli/commands/cancel.js +40 -0
  80. package/dist/cli/commands/cancel.js.map +1 -0
  81. package/dist/cli/commands/cant.d.ts +13 -0
  82. package/dist/cli/commands/cant.d.ts.map +1 -0
  83. package/dist/cli/commands/cant.js +245 -0
  84. package/dist/cli/commands/cant.js.map +1 -0
  85. package/dist/cli/commands/chain.d.ts +24 -0
  86. package/dist/cli/commands/chain.d.ts.map +1 -0
  87. package/dist/cli/commands/chain.js +116 -0
  88. package/dist/cli/commands/chain.js.map +1 -0
  89. package/dist/cli/commands/check.d.ts +18 -0
  90. package/dist/cli/commands/check.d.ts.map +1 -0
  91. package/dist/cli/commands/check.js +280 -0
  92. package/dist/cli/commands/check.js.map +1 -0
  93. package/dist/cli/commands/checkpoint.d.ts +27 -0
  94. package/dist/cli/commands/checkpoint.d.ts.map +1 -0
  95. package/dist/cli/commands/checkpoint.js +105 -0
  96. package/dist/cli/commands/checkpoint.js.map +1 -0
  97. package/dist/cli/commands/claim.d.ts +35 -0
  98. package/dist/cli/commands/claim.d.ts.map +1 -0
  99. package/dist/cli/commands/claim.js +35 -0
  100. package/dist/cli/commands/claim.js.map +1 -0
  101. package/dist/cli/commands/code.d.ts +22 -0
  102. package/dist/cli/commands/code.d.ts.map +1 -0
  103. package/dist/cli/commands/code.js +161 -0
  104. package/dist/cli/commands/code.js.map +1 -0
  105. package/dist/cli/commands/complete.d.ts +49 -0
  106. package/dist/cli/commands/complete.d.ts.map +1 -0
  107. package/dist/cli/commands/complete.js +83 -0
  108. package/dist/cli/commands/complete.js.map +1 -0
  109. package/dist/cli/commands/complexity.d.ts +13 -0
  110. package/dist/cli/commands/complexity.d.ts.map +1 -0
  111. package/dist/cli/commands/complexity.js +32 -0
  112. package/dist/cli/commands/complexity.js.map +1 -0
  113. package/dist/cli/commands/compliance.d.ts +27 -0
  114. package/dist/cli/commands/compliance.d.ts.map +1 -0
  115. package/dist/cli/commands/compliance.js +233 -0
  116. package/dist/cli/commands/compliance.js.map +1 -0
  117. package/dist/cli/commands/conduit.d.ts +28 -0
  118. package/dist/cli/commands/conduit.d.ts.map +1 -0
  119. package/dist/cli/commands/conduit.js +279 -0
  120. package/dist/cli/commands/conduit.js.map +1 -0
  121. package/dist/cli/commands/config.d.ts +25 -0
  122. package/dist/cli/commands/config.d.ts.map +1 -0
  123. package/dist/cli/commands/config.js +132 -0
  124. package/dist/cli/commands/config.js.map +1 -0
  125. package/dist/cli/commands/consensus.d.ts +21 -0
  126. package/dist/cli/commands/consensus.d.ts.map +1 -0
  127. package/dist/cli/commands/consensus.js +100 -0
  128. package/dist/cli/commands/consensus.js.map +1 -0
  129. package/dist/cli/commands/context.d.ts +19 -0
  130. package/dist/cli/commands/context.d.ts.map +1 -0
  131. package/dist/cli/commands/context.js +111 -0
  132. package/dist/cli/commands/context.js.map +1 -0
  133. package/dist/cli/commands/contribution.d.ts +21 -0
  134. package/dist/cli/commands/contribution.d.ts.map +1 -0
  135. package/dist/cli/commands/contribution.js +90 -0
  136. package/dist/cli/commands/contribution.js.map +1 -0
  137. package/dist/cli/commands/current.d.ts +18 -0
  138. package/dist/cli/commands/current.d.ts.map +1 -0
  139. package/dist/cli/commands/current.js +28 -0
  140. package/dist/cli/commands/current.js.map +1 -0
  141. package/dist/cli/commands/daemon.d.ts +36 -0
  142. package/dist/cli/commands/daemon.d.ts.map +1 -0
  143. package/dist/cli/commands/daemon.js +223 -0
  144. package/dist/cli/commands/daemon.js.map +1 -0
  145. package/dist/cli/commands/dash.d.ts +23 -0
  146. package/dist/cli/commands/dash.d.ts.map +1 -0
  147. package/dist/cli/commands/dash.js +38 -0
  148. package/dist/cli/commands/dash.js.map +1 -0
  149. package/dist/cli/commands/decomposition.d.ts +13 -0
  150. package/dist/cli/commands/decomposition.d.ts.map +1 -0
  151. package/dist/cli/commands/decomposition.js +92 -0
  152. package/dist/cli/commands/decomposition.js.map +1 -0
  153. package/dist/cli/commands/delete.d.ts +29 -0
  154. package/dist/cli/commands/delete.d.ts.map +1 -0
  155. package/dist/cli/commands/delete.js +55 -0
  156. package/dist/cli/commands/delete.js.map +1 -0
  157. package/dist/cli/commands/deps.d.ts +45 -0
  158. package/dist/cli/commands/deps.d.ts.map +1 -0
  159. package/dist/cli/commands/deps.js +170 -0
  160. package/dist/cli/commands/deps.js.map +1 -0
  161. package/dist/cli/commands/detect-drift.d.ts +23 -0
  162. package/dist/cli/commands/detect-drift.d.ts.map +1 -0
  163. package/dist/cli/commands/detect-drift.js +440 -0
  164. package/dist/cli/commands/detect-drift.js.map +1 -0
  165. package/dist/cli/commands/detect.d.ts +3 -0
  166. package/dist/cli/commands/detect.d.ts.map +1 -0
  167. package/dist/cli/commands/detect.js +14 -0
  168. package/dist/cli/commands/detect.js.map +1 -0
  169. package/dist/cli/commands/diagnostics.d.ts +19 -0
  170. package/dist/cli/commands/diagnostics.d.ts.map +1 -0
  171. package/dist/cli/commands/diagnostics.js +109 -0
  172. package/dist/cli/commands/diagnostics.js.map +1 -0
  173. package/dist/cli/commands/docs.d.ts +25 -0
  174. package/dist/cli/commands/docs.d.ts.map +1 -0
  175. package/dist/cli/commands/docs.js +798 -0
  176. package/dist/cli/commands/docs.js.map +1 -0
  177. package/dist/cli/commands/doctor-projects.d.ts +101 -0
  178. package/dist/cli/commands/doctor-projects.d.ts.map +1 -0
  179. package/dist/cli/commands/doctor-projects.js +188 -0
  180. package/dist/cli/commands/doctor-projects.js.map +1 -0
  181. package/dist/cli/commands/doctor.d.ts +66 -0
  182. package/dist/cli/commands/doctor.d.ts.map +1 -0
  183. package/dist/cli/commands/doctor.js +178 -0
  184. package/dist/cli/commands/doctor.js.map +1 -0
  185. package/dist/cli/commands/dynamic.d.ts +15 -0
  186. package/dist/cli/commands/dynamic.d.ts.map +1 -0
  187. package/dist/cli/commands/dynamic.js +21 -0
  188. package/dist/cli/commands/dynamic.js.map +1 -0
  189. package/dist/cli/commands/exists.d.ts +13 -0
  190. package/dist/cli/commands/exists.d.ts.map +1 -0
  191. package/dist/cli/commands/exists.js +40 -0
  192. package/dist/cli/commands/exists.js.map +1 -0
  193. package/dist/cli/commands/export-tasks.d.ts +46 -0
  194. package/dist/cli/commands/export-tasks.d.ts.map +1 -0
  195. package/dist/cli/commands/export-tasks.js +81 -0
  196. package/dist/cli/commands/export-tasks.js.map +1 -0
  197. package/dist/cli/commands/export.d.ts +35 -0
  198. package/dist/cli/commands/export.d.ts.map +1 -0
  199. package/dist/cli/commands/export.js +68 -0
  200. package/dist/cli/commands/export.js.map +1 -0
  201. package/dist/cli/commands/find.d.ts +54 -0
  202. package/dist/cli/commands/find.d.ts.map +1 -0
  203. package/dist/cli/commands/find.js +92 -0
  204. package/dist/cli/commands/find.js.map +1 -0
  205. package/dist/cli/commands/gc.d.ts +25 -0
  206. package/dist/cli/commands/gc.d.ts.map +1 -0
  207. package/dist/cli/commands/gc.js +165 -0
  208. package/dist/cli/commands/gc.js.map +1 -0
  209. package/dist/cli/commands/generate-changelog.d.ts +30 -0
  210. package/dist/cli/commands/generate-changelog.d.ts.map +1 -0
  211. package/dist/cli/commands/generate-changelog.js +270 -0
  212. package/dist/cli/commands/generate-changelog.js.map +1 -0
  213. package/dist/cli/commands/grade.d.ts +13 -0
  214. package/dist/cli/commands/grade.d.ts.map +1 -0
  215. package/dist/cli/commands/grade.js +27 -0
  216. package/dist/cli/commands/grade.js.map +1 -0
  217. package/dist/cli/commands/history.d.ts +13 -0
  218. package/dist/cli/commands/history.d.ts.map +1 -0
  219. package/dist/cli/commands/history.js +65 -0
  220. package/dist/cli/commands/history.js.map +1 -0
  221. package/dist/cli/commands/import-tasks.d.ts +60 -0
  222. package/dist/cli/commands/import-tasks.d.ts.map +1 -0
  223. package/dist/cli/commands/import-tasks.js +83 -0
  224. package/dist/cli/commands/import-tasks.js.map +1 -0
  225. package/dist/cli/commands/import.d.ts +42 -0
  226. package/dist/cli/commands/import.d.ts.map +1 -0
  227. package/dist/cli/commands/import.js +64 -0
  228. package/dist/cli/commands/import.js.map +1 -0
  229. package/dist/cli/commands/init.d.ts +65 -0
  230. package/dist/cli/commands/init.d.ts.map +1 -0
  231. package/dist/cli/commands/init.js +122 -0
  232. package/dist/cli/commands/init.js.map +1 -0
  233. package/dist/cli/commands/inject.d.ts +41 -0
  234. package/dist/cli/commands/inject.d.ts.map +1 -0
  235. package/dist/cli/commands/inject.js +56 -0
  236. package/dist/cli/commands/inject.js.map +1 -0
  237. package/dist/cli/commands/install-global.d.ts +48 -0
  238. package/dist/cli/commands/install-global.d.ts.map +1 -0
  239. package/dist/cli/commands/install-global.js +104 -0
  240. package/dist/cli/commands/install-global.js.map +1 -0
  241. package/dist/cli/commands/intelligence.d.ts +21 -0
  242. package/dist/cli/commands/intelligence.d.ts.map +1 -0
  243. package/dist/cli/commands/intelligence.js +145 -0
  244. package/dist/cli/commands/intelligence.js.map +1 -0
  245. package/dist/cli/commands/issue.d.ts +23 -0
  246. package/dist/cli/commands/issue.d.ts.map +1 -0
  247. package/dist/cli/commands/issue.js +152 -0
  248. package/dist/cli/commands/issue.js.map +1 -0
  249. package/dist/cli/commands/labels.d.ts +21 -0
  250. package/dist/cli/commands/labels.d.ts.map +1 -0
  251. package/dist/cli/commands/labels.js +65 -0
  252. package/dist/cli/commands/labels.js.map +1 -0
  253. package/dist/cli/commands/lifecycle.d.ts +25 -0
  254. package/dist/cli/commands/lifecycle.d.ts.map +1 -0
  255. package/dist/cli/commands/lifecycle.js +221 -0
  256. package/dist/cli/commands/lifecycle.js.map +1 -0
  257. package/dist/cli/commands/list.d.ts +28 -0
  258. package/dist/cli/commands/list.d.ts.map +1 -0
  259. package/dist/cli/commands/list.js +81 -0
  260. package/dist/cli/commands/list.js.map +1 -0
  261. package/dist/cli/commands/log.d.ts +36 -0
  262. package/dist/cli/commands/log.d.ts.map +1 -0
  263. package/dist/cli/commands/log.js +50 -0
  264. package/dist/cli/commands/log.js.map +1 -0
  265. package/dist/cli/commands/manifest.d.ts +15 -0
  266. package/dist/cli/commands/manifest.d.ts.map +1 -0
  267. package/dist/cli/commands/manifest.js +334 -0
  268. package/dist/cli/commands/manifest.js.map +1 -0
  269. package/dist/cli/commands/map.d.ts +25 -0
  270. package/dist/cli/commands/map.d.ts.map +1 -0
  271. package/dist/cli/commands/map.js +37 -0
  272. package/dist/cli/commands/map.js.map +1 -0
  273. package/dist/cli/commands/memory.d.ts +48 -0
  274. package/dist/cli/commands/memory.d.ts.map +1 -0
  275. package/dist/cli/commands/memory.js +2439 -0
  276. package/dist/cli/commands/memory.js.map +1 -0
  277. package/dist/cli/commands/migrate-claude-mem.d.ts +23 -0
  278. package/dist/cli/commands/migrate-claude-mem.d.ts.map +1 -0
  279. package/dist/cli/commands/migrate-claude-mem.js +181 -0
  280. package/dist/cli/commands/migrate-claude-mem.js.map +1 -0
  281. package/dist/cli/commands/next.d.ts +27 -0
  282. package/dist/cli/commands/next.d.ts.map +1 -0
  283. package/dist/cli/commands/next.js +40 -0
  284. package/dist/cli/commands/next.js.map +1 -0
  285. package/dist/cli/commands/nexus.d.ts +15 -0
  286. package/dist/cli/commands/nexus.d.ts.map +1 -0
  287. package/dist/cli/commands/nexus.js +3377 -0
  288. package/dist/cli/commands/nexus.js.map +1 -0
  289. package/dist/cli/commands/ops.d.ts +23 -0
  290. package/dist/cli/commands/ops.d.ts.map +1 -0
  291. package/dist/cli/commands/ops.js +35 -0
  292. package/dist/cli/commands/ops.js.map +1 -0
  293. package/dist/cli/commands/orchestrate.d.ts +48 -0
  294. package/dist/cli/commands/orchestrate.d.ts.map +1 -0
  295. package/dist/cli/commands/orchestrate.js +774 -0
  296. package/dist/cli/commands/orchestrate.js.map +1 -0
  297. package/dist/cli/commands/otel.d.ts +30 -0
  298. package/dist/cli/commands/otel.d.ts.map +1 -0
  299. package/dist/cli/commands/otel.js +193 -0
  300. package/dist/cli/commands/otel.js.map +1 -0
  301. package/dist/cli/commands/phase.d.ts +29 -0
  302. package/dist/cli/commands/phase.d.ts.map +1 -0
  303. package/dist/cli/commands/phase.js +189 -0
  304. package/dist/cli/commands/phase.js.map +1 -0
  305. package/dist/cli/commands/pivot.d.ts +34 -0
  306. package/dist/cli/commands/pivot.d.ts.map +1 -0
  307. package/dist/cli/commands/pivot.js +50 -0
  308. package/dist/cli/commands/pivot.js.map +1 -0
  309. package/dist/cli/commands/plan.d.ts +17 -0
  310. package/dist/cli/commands/plan.d.ts.map +1 -0
  311. package/dist/cli/commands/plan.js +27 -0
  312. package/dist/cli/commands/plan.js.map +1 -0
  313. package/dist/cli/commands/playbook.d.ts +26 -0
  314. package/dist/cli/commands/playbook.d.ts.map +1 -0
  315. package/dist/cli/commands/playbook.js +220 -0
  316. package/dist/cli/commands/playbook.js.map +1 -0
  317. package/dist/cli/commands/promote.d.ts +19 -0
  318. package/dist/cli/commands/promote.d.ts.map +1 -0
  319. package/dist/cli/commands/promote.js +27 -0
  320. package/dist/cli/commands/promote.js.map +1 -0
  321. package/dist/cli/commands/provider.d.ts +23 -0
  322. package/dist/cli/commands/provider.d.ts.map +1 -0
  323. package/dist/cli/commands/provider.js +168 -0
  324. package/dist/cli/commands/provider.js.map +1 -0
  325. package/dist/cli/commands/reason.d.ts +18 -0
  326. package/dist/cli/commands/reason.d.ts.map +1 -0
  327. package/dist/cli/commands/reason.js +102 -0
  328. package/dist/cli/commands/reason.js.map +1 -0
  329. package/dist/cli/commands/reconcile.d.ts +35 -0
  330. package/dist/cli/commands/reconcile.d.ts.map +1 -0
  331. package/dist/cli/commands/reconcile.js +102 -0
  332. package/dist/cli/commands/reconcile.js.map +1 -0
  333. package/dist/cli/commands/refresh-memory.d.ts +16 -0
  334. package/dist/cli/commands/refresh-memory.d.ts.map +1 -0
  335. package/dist/cli/commands/refresh-memory.js +34 -0
  336. package/dist/cli/commands/refresh-memory.js.map +1 -0
  337. package/dist/cli/commands/relates.d.ts +19 -0
  338. package/dist/cli/commands/relates.d.ts.map +1 -0
  339. package/dist/cli/commands/relates.js +129 -0
  340. package/dist/cli/commands/relates.js.map +1 -0
  341. package/dist/cli/commands/release.d.ts +27 -0
  342. package/dist/cli/commands/release.d.ts.map +1 -0
  343. package/dist/cli/commands/release.js +300 -0
  344. package/dist/cli/commands/release.js.map +1 -0
  345. package/dist/cli/commands/remote.d.ts +49 -0
  346. package/dist/cli/commands/remote.d.ts.map +1 -0
  347. package/dist/cli/commands/remote.js +265 -0
  348. package/dist/cli/commands/remote.js.map +1 -0
  349. package/dist/cli/commands/reorder.d.ts +31 -0
  350. package/dist/cli/commands/reorder.d.ts.map +1 -0
  351. package/dist/cli/commands/reorder.js +57 -0
  352. package/dist/cli/commands/reorder.js.map +1 -0
  353. package/dist/cli/commands/reparent.d.ts +27 -0
  354. package/dist/cli/commands/reparent.d.ts.map +1 -0
  355. package/dist/cli/commands/reparent.js +36 -0
  356. package/dist/cli/commands/reparent.js.map +1 -0
  357. package/dist/cli/commands/req.d.ts +37 -0
  358. package/dist/cli/commands/req.d.ts.map +1 -0
  359. package/dist/cli/commands/req.js +121 -0
  360. package/dist/cli/commands/req.js.map +1 -0
  361. package/dist/cli/commands/research.d.ts +25 -0
  362. package/dist/cli/commands/research.d.ts.map +1 -0
  363. package/dist/cli/commands/research.js +327 -0
  364. package/dist/cli/commands/research.js.map +1 -0
  365. package/dist/cli/commands/restore.d.ts +64 -0
  366. package/dist/cli/commands/restore.d.ts.map +1 -0
  367. package/dist/cli/commands/restore.js +539 -0
  368. package/dist/cli/commands/restore.js.map +1 -0
  369. package/dist/cli/commands/revert.d.ts +79 -0
  370. package/dist/cli/commands/revert.d.ts.map +1 -0
  371. package/dist/cli/commands/revert.js +300 -0
  372. package/dist/cli/commands/revert.js.map +1 -0
  373. package/dist/cli/commands/roadmap.d.ts +29 -0
  374. package/dist/cli/commands/roadmap.d.ts.map +1 -0
  375. package/dist/cli/commands/roadmap.js +43 -0
  376. package/dist/cli/commands/roadmap.js.map +1 -0
  377. package/dist/cli/commands/safestop.d.ts +41 -0
  378. package/dist/cli/commands/safestop.d.ts.map +1 -0
  379. package/dist/cli/commands/safestop.js +62 -0
  380. package/dist/cli/commands/safestop.js.map +1 -0
  381. package/dist/cli/commands/schema.d.ts +44 -0
  382. package/dist/cli/commands/schema.d.ts.map +1 -0
  383. package/dist/cli/commands/schema.js +177 -0
  384. package/dist/cli/commands/schema.js.map +1 -0
  385. package/dist/cli/commands/self-update.d.ts +81 -0
  386. package/dist/cli/commands/self-update.d.ts.map +1 -0
  387. package/dist/cli/commands/self-update.js +483 -0
  388. package/dist/cli/commands/self-update.js.map +1 -0
  389. package/dist/cli/commands/sentient.d.ts +44 -0
  390. package/dist/cli/commands/sentient.d.ts.map +1 -0
  391. package/dist/cli/commands/sentient.js +687 -0
  392. package/dist/cli/commands/sentient.js.map +1 -0
  393. package/dist/cli/commands/sequence.d.ts +15 -0
  394. package/dist/cli/commands/sequence.d.ts.map +1 -0
  395. package/dist/cli/commands/sequence.js +68 -0
  396. package/dist/cli/commands/sequence.js.map +1 -0
  397. package/dist/cli/commands/session.d.ts +32 -0
  398. package/dist/cli/commands/session.d.ts.map +1 -0
  399. package/dist/cli/commands/session.js +583 -0
  400. package/dist/cli/commands/session.js.map +1 -0
  401. package/dist/cli/commands/show.d.ts +21 -0
  402. package/dist/cli/commands/show.d.ts.map +1 -0
  403. package/dist/cli/commands/show.js +37 -0
  404. package/dist/cli/commands/show.js.map +1 -0
  405. package/dist/cli/commands/skills.d.ts +31 -0
  406. package/dist/cli/commands/skills.d.ts.map +1 -0
  407. package/dist/cli/commands/skills.js +303 -0
  408. package/dist/cli/commands/skills.js.map +1 -0
  409. package/dist/cli/commands/snapshot.d.ts +17 -0
  410. package/dist/cli/commands/snapshot.d.ts.map +1 -0
  411. package/dist/cli/commands/snapshot.js +95 -0
  412. package/dist/cli/commands/snapshot.js.map +1 -0
  413. package/dist/cli/commands/start.d.ts +21 -0
  414. package/dist/cli/commands/start.d.ts.map +1 -0
  415. package/dist/cli/commands/start.js +32 -0
  416. package/dist/cli/commands/start.js.map +1 -0
  417. package/dist/cli/commands/stats.d.ts +30 -0
  418. package/dist/cli/commands/stats.d.ts.map +1 -0
  419. package/dist/cli/commands/stats.js +71 -0
  420. package/dist/cli/commands/stats.js.map +1 -0
  421. package/dist/cli/commands/sticky.d.ts +23 -0
  422. package/dist/cli/commands/sticky.d.ts.map +1 -0
  423. package/dist/cli/commands/sticky.js +315 -0
  424. package/dist/cli/commands/sticky.js.map +1 -0
  425. package/dist/cli/commands/stop.d.ts +15 -0
  426. package/dist/cli/commands/stop.d.ts.map +1 -0
  427. package/dist/cli/commands/stop.js +25 -0
  428. package/dist/cli/commands/stop.js.map +1 -0
  429. package/dist/cli/commands/sync.d.ts +25 -0
  430. package/dist/cli/commands/sync.d.ts.map +1 -0
  431. package/dist/cli/commands/sync.js +125 -0
  432. package/dist/cli/commands/sync.js.map +1 -0
  433. package/dist/cli/commands/testing.d.ts +22 -0
  434. package/dist/cli/commands/testing.d.ts.map +1 -0
  435. package/dist/cli/commands/testing.js +111 -0
  436. package/dist/cli/commands/testing.js.map +1 -0
  437. package/dist/cli/commands/token.d.ts +22 -0
  438. package/dist/cli/commands/token.d.ts.map +1 -0
  439. package/dist/cli/commands/token.js +197 -0
  440. package/dist/cli/commands/token.js.map +1 -0
  441. package/dist/cli/commands/transcript.d.ts +32 -0
  442. package/dist/cli/commands/transcript.d.ts.map +1 -0
  443. package/dist/cli/commands/transcript.js +526 -0
  444. package/dist/cli/commands/transcript.js.map +1 -0
  445. package/dist/cli/commands/update.d.ts +164 -0
  446. package/dist/cli/commands/update.d.ts.map +1 -0
  447. package/dist/cli/commands/update.js +234 -0
  448. package/dist/cli/commands/update.js.map +1 -0
  449. package/dist/cli/commands/upgrade.d.ts +76 -0
  450. package/dist/cli/commands/upgrade.d.ts.map +1 -0
  451. package/dist/cli/commands/upgrade.js +154 -0
  452. package/dist/cli/commands/upgrade.js.map +1 -0
  453. package/dist/cli/commands/verify.d.ts +83 -0
  454. package/dist/cli/commands/verify.d.ts.map +1 -0
  455. package/dist/cli/commands/verify.js +108 -0
  456. package/dist/cli/commands/verify.js.map +1 -0
  457. package/dist/cli/commands/web.d.ts +27 -0
  458. package/dist/cli/commands/web.d.ts.map +1 -0
  459. package/dist/cli/commands/web.js +414 -0
  460. package/dist/cli/commands/web.js.map +1 -0
  461. package/dist/cli/field-context.d.ts +32 -0
  462. package/dist/cli/field-context.d.ts.map +1 -0
  463. package/dist/cli/field-context.js +47 -0
  464. package/dist/cli/field-context.js.map +1 -0
  465. package/dist/cli/format-context.d.ts +32 -0
  466. package/dist/cli/format-context.d.ts.map +1 -0
  467. package/dist/cli/format-context.js +50 -0
  468. package/dist/cli/format-context.js.map +1 -0
  469. package/dist/cli/help-renderer.d.ts +40 -0
  470. package/dist/cli/help-renderer.d.ts.map +1 -0
  471. package/dist/cli/help-renderer.js +325 -0
  472. package/dist/cli/help-renderer.js.map +1 -0
  473. package/dist/cli/index.d.ts +14 -0
  474. package/dist/cli/index.d.ts.map +1 -0
  475. package/dist/cli/index.js +1561 -9748
  476. package/dist/cli/index.js.map +4 -4
  477. package/dist/cli/infer-files-via-gitnexus.d.ts +12 -0
  478. package/dist/cli/infer-files-via-gitnexus.d.ts.map +1 -0
  479. package/dist/cli/infer-files-via-gitnexus.js +12 -0
  480. package/dist/cli/infer-files-via-gitnexus.js.map +1 -0
  481. package/dist/cli/lib/did-you-mean.d.ts +30 -0
  482. package/dist/cli/lib/did-you-mean.d.ts.map +1 -0
  483. package/dist/cli/lib/did-you-mean.js +63 -0
  484. package/dist/cli/lib/did-you-mean.js.map +1 -0
  485. package/dist/cli/lib/registry-args.d.ts +36 -0
  486. package/dist/cli/lib/registry-args.d.ts.map +1 -0
  487. package/dist/cli/lib/registry-args.js +37 -0
  488. package/dist/cli/lib/registry-args.js.map +1 -0
  489. package/dist/cli/lib/subcommand-guard.d.ts +45 -0
  490. package/dist/cli/lib/subcommand-guard.d.ts.map +1 -0
  491. package/dist/cli/lib/subcommand-guard.js +55 -0
  492. package/dist/cli/lib/subcommand-guard.js.map +1 -0
  493. package/dist/cli/logger-bootstrap.d.ts +6 -0
  494. package/dist/cli/logger-bootstrap.d.ts.map +1 -0
  495. package/dist/cli/logger-bootstrap.js +10 -0
  496. package/dist/cli/logger-bootstrap.js.map +1 -0
  497. package/dist/cli/middleware/output-format.d.ts +30 -0
  498. package/dist/cli/middleware/output-format.d.ts.map +1 -0
  499. package/dist/cli/middleware/output-format.js +35 -0
  500. package/dist/cli/middleware/output-format.js.map +1 -0
  501. package/dist/cli/paths.d.ts +85 -0
  502. package/dist/cli/paths.d.ts.map +1 -0
  503. package/dist/cli/paths.js +108 -0
  504. package/dist/cli/paths.js.map +1 -0
  505. package/dist/cli/progress.d.ts +89 -0
  506. package/dist/cli/progress.d.ts.map +1 -0
  507. package/dist/cli/progress.js +185 -0
  508. package/dist/cli/progress.js.map +1 -0
  509. package/dist/cli/renderers/colors.d.ts +32 -0
  510. package/dist/cli/renderers/colors.d.ts.map +1 -0
  511. package/dist/cli/renderers/colors.js +141 -0
  512. package/dist/cli/renderers/colors.js.map +1 -0
  513. package/dist/cli/renderers/error.d.ts +13 -0
  514. package/dist/cli/renderers/error.d.ts.map +1 -0
  515. package/dist/cli/renderers/error.js +42 -0
  516. package/dist/cli/renderers/error.js.map +1 -0
  517. package/dist/cli/renderers/index.d.ts +90 -0
  518. package/dist/cli/renderers/index.d.ts.map +1 -0
  519. package/dist/cli/renderers/index.js +268 -0
  520. package/dist/cli/renderers/index.js.map +1 -0
  521. package/dist/cli/renderers/lafs-validator.d.ts +91 -0
  522. package/dist/cli/renderers/lafs-validator.d.ts.map +1 -0
  523. package/dist/cli/renderers/lafs-validator.js +176 -0
  524. package/dist/cli/renderers/lafs-validator.js.map +1 -0
  525. package/dist/cli/renderers/normalizer.d.ts +21 -0
  526. package/dist/cli/renderers/normalizer.d.ts.map +1 -0
  527. package/dist/cli/renderers/normalizer.js +106 -0
  528. package/dist/cli/renderers/normalizer.js.map +1 -0
  529. package/dist/cli/renderers/system.d.ts +110 -0
  530. package/dist/cli/renderers/system.d.ts.map +1 -0
  531. package/dist/cli/renderers/system.js +662 -0
  532. package/dist/cli/renderers/system.js.map +1 -0
  533. package/dist/cli/renderers/tasks.d.ts +28 -0
  534. package/dist/cli/renderers/tasks.d.ts.map +1 -0
  535. package/dist/cli/renderers/tasks.js +306 -0
  536. package/dist/cli/renderers/tasks.js.map +1 -0
  537. package/dist/cli/tree-context.d.ts +53 -0
  538. package/dist/cli/tree-context.d.ts.map +1 -0
  539. package/dist/cli/tree-context.js +43 -0
  540. package/dist/cli/tree-context.js.map +1 -0
  541. package/dist/dispatch/adapters/cli.d.ts +67 -0
  542. package/dist/dispatch/adapters/cli.d.ts.map +1 -0
  543. package/dist/dispatch/adapters/cli.js +331 -0
  544. package/dist/dispatch/adapters/cli.js.map +1 -0
  545. package/dist/dispatch/adapters/typed.d.ts +362 -0
  546. package/dist/dispatch/adapters/typed.d.ts.map +1 -0
  547. package/dist/dispatch/adapters/typed.js +278 -0
  548. package/dist/dispatch/adapters/typed.js.map +1 -0
  549. package/dist/dispatch/context/session-context.d.ts +108 -0
  550. package/dist/dispatch/context/session-context.d.ts.map +1 -0
  551. package/dist/dispatch/context/session-context.js +111 -0
  552. package/dist/dispatch/context/session-context.js.map +1 -0
  553. package/dist/dispatch/dispatcher.d.ts +37 -0
  554. package/dist/dispatch/dispatcher.d.ts.map +1 -0
  555. package/dist/dispatch/dispatcher.js +172 -0
  556. package/dist/dispatch/dispatcher.js.map +1 -0
  557. package/dist/dispatch/domains/_base.d.ts +104 -0
  558. package/dist/dispatch/domains/_base.d.ts.map +1 -0
  559. package/dist/dispatch/domains/_base.js +147 -0
  560. package/dist/dispatch/domains/_base.js.map +1 -0
  561. package/dist/dispatch/domains/_meta.d.ts +23 -0
  562. package/dist/dispatch/domains/_meta.d.ts.map +1 -0
  563. package/dist/dispatch/domains/_meta.js +25 -0
  564. package/dist/dispatch/domains/_meta.js.map +1 -0
  565. package/dist/dispatch/domains/_routing.d.ts +8 -0
  566. package/dist/dispatch/domains/_routing.d.ts.map +1 -0
  567. package/dist/dispatch/domains/_routing.js +20 -0
  568. package/dist/dispatch/domains/_routing.js.map +1 -0
  569. package/dist/dispatch/domains/admin/smoke-provider.d.ts +54 -0
  570. package/dist/dispatch/domains/admin/smoke-provider.d.ts.map +1 -0
  571. package/dist/dispatch/domains/admin/smoke-provider.js +309 -0
  572. package/dist/dispatch/domains/admin/smoke-provider.js.map +1 -0
  573. package/dist/dispatch/domains/admin.d.ts +51 -0
  574. package/dist/dispatch/domains/admin.d.ts.map +1 -0
  575. package/dist/dispatch/domains/admin.js +1163 -0
  576. package/dist/dispatch/domains/admin.js.map +1 -0
  577. package/dist/dispatch/domains/check/canon.d.ts +65 -0
  578. package/dist/dispatch/domains/check/canon.d.ts.map +1 -0
  579. package/dist/dispatch/domains/check/canon.js +193 -0
  580. package/dist/dispatch/domains/check/canon.js.map +1 -0
  581. package/dist/dispatch/domains/check.d.ts +37 -0
  582. package/dist/dispatch/domains/check.d.ts.map +1 -0
  583. package/dist/dispatch/domains/check.js +562 -0
  584. package/dist/dispatch/domains/check.js.map +1 -0
  585. package/dist/dispatch/domains/conduit.d.ts +61 -0
  586. package/dist/dispatch/domains/conduit.d.ts.map +1 -0
  587. package/dist/dispatch/domains/conduit.js +609 -0
  588. package/dist/dispatch/domains/conduit.js.map +1 -0
  589. package/dist/dispatch/domains/diagnostics.d.ts +25 -0
  590. package/dist/dispatch/domains/diagnostics.d.ts.map +1 -0
  591. package/dist/dispatch/domains/diagnostics.js +82 -0
  592. package/dist/dispatch/domains/diagnostics.js.map +1 -0
  593. package/dist/dispatch/domains/docs.d.ts +63 -0
  594. package/dist/dispatch/domains/docs.d.ts.map +1 -0
  595. package/dist/dispatch/domains/docs.js +539 -0
  596. package/dist/dispatch/domains/docs.js.map +1 -0
  597. package/dist/dispatch/domains/index.d.ts +33 -0
  598. package/dist/dispatch/domains/index.d.ts.map +1 -0
  599. package/dist/dispatch/domains/index.js +58 -0
  600. package/dist/dispatch/domains/index.js.map +1 -0
  601. package/dist/dispatch/domains/intelligence.d.ts +26 -0
  602. package/dist/dispatch/domains/intelligence.d.ts.map +1 -0
  603. package/dist/dispatch/domains/intelligence.js +154 -0
  604. package/dist/dispatch/domains/intelligence.js.map +1 -0
  605. package/dist/dispatch/domains/ivtr.d.ts +182 -0
  606. package/dist/dispatch/domains/ivtr.d.ts.map +1 -0
  607. package/dist/dispatch/domains/ivtr.js +430 -0
  608. package/dist/dispatch/domains/ivtr.js.map +1 -0
  609. package/dist/dispatch/domains/memory.d.ts +22 -0
  610. package/dist/dispatch/domains/memory.d.ts.map +1 -0
  611. package/dist/dispatch/domains/memory.js +1281 -0
  612. package/dist/dispatch/domains/memory.js.map +1 -0
  613. package/dist/dispatch/domains/nexus.d.ts +78 -0
  614. package/dist/dispatch/domains/nexus.d.ts.map +1 -0
  615. package/dist/dispatch/domains/nexus.js +938 -0
  616. package/dist/dispatch/domains/nexus.js.map +1 -0
  617. package/dist/dispatch/domains/orchestrate.d.ts +307 -0
  618. package/dist/dispatch/domains/orchestrate.d.ts.map +1 -0
  619. package/dist/dispatch/domains/orchestrate.js +986 -0
  620. package/dist/dispatch/domains/orchestrate.js.map +1 -0
  621. package/dist/dispatch/domains/pipeline.d.ts +276 -0
  622. package/dist/dispatch/domains/pipeline.d.ts.map +1 -0
  623. package/dist/dispatch/domains/pipeline.js +689 -0
  624. package/dist/dispatch/domains/pipeline.js.map +1 -0
  625. package/dist/dispatch/domains/playbook.d.ts +131 -0
  626. package/dist/dispatch/domains/playbook.d.ts.map +1 -0
  627. package/dist/dispatch/domains/playbook.js +633 -0
  628. package/dist/dispatch/domains/playbook.js.map +1 -0
  629. package/dist/dispatch/domains/release.d.ts +97 -0
  630. package/dist/dispatch/domains/release.d.ts.map +1 -0
  631. package/dist/dispatch/domains/release.js +177 -0
  632. package/dist/dispatch/domains/release.js.map +1 -0
  633. package/dist/dispatch/domains/sentient.d.ts +60 -0
  634. package/dist/dispatch/domains/sentient.d.ts.map +1 -0
  635. package/dist/dispatch/domains/sentient.js +270 -0
  636. package/dist/dispatch/domains/sentient.js.map +1 -0
  637. package/dist/dispatch/domains/session.d.ts +49 -0
  638. package/dist/dispatch/domains/session.d.ts.map +1 -0
  639. package/dist/dispatch/domains/session.js +459 -0
  640. package/dist/dispatch/domains/session.js.map +1 -0
  641. package/dist/dispatch/domains/sticky.d.ts +82 -0
  642. package/dist/dispatch/domains/sticky.d.ts.map +1 -0
  643. package/dist/dispatch/domains/sticky.js +287 -0
  644. package/dist/dispatch/domains/sticky.js.map +1 -0
  645. package/dist/dispatch/domains/tasks.d.ts +58 -0
  646. package/dist/dispatch/domains/tasks.d.ts.map +1 -0
  647. package/dist/dispatch/domains/tasks.js +497 -0
  648. package/dist/dispatch/domains/tasks.js.map +1 -0
  649. package/dist/dispatch/domains/tools.d.ts +37 -0
  650. package/dist/dispatch/domains/tools.d.ts.map +1 -0
  651. package/dist/dispatch/domains/tools.js +481 -0
  652. package/dist/dispatch/domains/tools.js.map +1 -0
  653. package/dist/dispatch/engines/_error.d.ts +114 -0
  654. package/dist/dispatch/engines/_error.d.ts.map +1 -0
  655. package/dist/dispatch/engines/_error.js +290 -0
  656. package/dist/dispatch/engines/_error.js.map +1 -0
  657. package/dist/dispatch/engines/admin-engine.d.ts +386 -0
  658. package/dist/dispatch/engines/admin-engine.d.ts.map +1 -0
  659. package/dist/dispatch/engines/admin-engine.js +270 -0
  660. package/dist/dispatch/engines/admin-engine.js.map +1 -0
  661. package/dist/dispatch/engines/code-engine.d.ts +14 -0
  662. package/dist/dispatch/engines/code-engine.d.ts.map +1 -0
  663. package/dist/dispatch/engines/code-engine.js +14 -0
  664. package/dist/dispatch/engines/code-engine.js.map +1 -0
  665. package/dist/dispatch/engines/codebase-map-engine.d.ts +31 -0
  666. package/dist/dispatch/engines/codebase-map-engine.d.ts.map +1 -0
  667. package/dist/dispatch/engines/codebase-map-engine.js +43 -0
  668. package/dist/dispatch/engines/codebase-map-engine.js.map +1 -0
  669. package/dist/dispatch/engines/config-engine.d.ts +14 -0
  670. package/dist/dispatch/engines/config-engine.d.ts.map +1 -0
  671. package/dist/dispatch/engines/config-engine.js +14 -0
  672. package/dist/dispatch/engines/config-engine.js.map +1 -0
  673. package/dist/dispatch/engines/diagnostics-engine.d.ts +13 -0
  674. package/dist/dispatch/engines/diagnostics-engine.d.ts.map +1 -0
  675. package/dist/dispatch/engines/diagnostics-engine.js +12 -0
  676. package/dist/dispatch/engines/diagnostics-engine.js.map +1 -0
  677. package/dist/dispatch/engines/hooks-engine.d.ts +13 -0
  678. package/dist/dispatch/engines/hooks-engine.d.ts.map +1 -0
  679. package/dist/dispatch/engines/hooks-engine.js +12 -0
  680. package/dist/dispatch/engines/hooks-engine.js.map +1 -0
  681. package/dist/dispatch/engines/init-engine.d.ts +14 -0
  682. package/dist/dispatch/engines/init-engine.d.ts.map +1 -0
  683. package/dist/dispatch/engines/init-engine.js +14 -0
  684. package/dist/dispatch/engines/init-engine.js.map +1 -0
  685. package/dist/dispatch/engines/lifecycle-engine.d.ts +13 -0
  686. package/dist/dispatch/engines/lifecycle-engine.d.ts.map +1 -0
  687. package/dist/dispatch/engines/lifecycle-engine.js +12 -0
  688. package/dist/dispatch/engines/lifecycle-engine.js.map +1 -0
  689. package/dist/dispatch/engines/memory-engine.d.ts +10 -0
  690. package/dist/dispatch/engines/memory-engine.d.ts.map +1 -0
  691. package/dist/dispatch/engines/memory-engine.js +10 -0
  692. package/dist/dispatch/engines/memory-engine.js.map +1 -0
  693. package/dist/dispatch/engines/nexus-engine.d.ts +603 -0
  694. package/dist/dispatch/engines/nexus-engine.d.ts.map +1 -0
  695. package/dist/dispatch/engines/nexus-engine.js +1438 -0
  696. package/dist/dispatch/engines/nexus-engine.js.map +1 -0
  697. package/dist/dispatch/engines/orchestrate-engine.d.ts +252 -0
  698. package/dist/dispatch/engines/orchestrate-engine.d.ts.map +1 -0
  699. package/dist/dispatch/engines/orchestrate-engine.js +1526 -0
  700. package/dist/dispatch/engines/orchestrate-engine.js.map +1 -0
  701. package/dist/dispatch/engines/pipeline-engine.d.ts +13 -0
  702. package/dist/dispatch/engines/pipeline-engine.d.ts.map +1 -0
  703. package/dist/dispatch/engines/pipeline-engine.js +12 -0
  704. package/dist/dispatch/engines/pipeline-engine.js.map +1 -0
  705. package/dist/dispatch/engines/release-engine.d.ts +13 -0
  706. package/dist/dispatch/engines/release-engine.d.ts.map +1 -0
  707. package/dist/dispatch/engines/release-engine.js +13 -0
  708. package/dist/dispatch/engines/release-engine.js.map +1 -0
  709. package/dist/dispatch/engines/session-engine.d.ts +15 -0
  710. package/dist/dispatch/engines/session-engine.d.ts.map +1 -0
  711. package/dist/dispatch/engines/session-engine.js +12 -0
  712. package/dist/dispatch/engines/session-engine.js.map +1 -0
  713. package/dist/dispatch/engines/sticky-engine.d.ts +13 -0
  714. package/dist/dispatch/engines/sticky-engine.d.ts.map +1 -0
  715. package/dist/dispatch/engines/sticky-engine.js +12 -0
  716. package/dist/dispatch/engines/sticky-engine.js.map +1 -0
  717. package/dist/dispatch/engines/system-engine.d.ts +543 -0
  718. package/dist/dispatch/engines/system-engine.d.ts.map +1 -0
  719. package/dist/dispatch/engines/system-engine.js +1278 -0
  720. package/dist/dispatch/engines/system-engine.js.map +1 -0
  721. package/dist/dispatch/engines/task-engine.d.ts +1161 -0
  722. package/dist/dispatch/engines/task-engine.d.ts.map +1 -0
  723. package/dist/dispatch/engines/task-engine.js +1599 -0
  724. package/dist/dispatch/engines/task-engine.js.map +1 -0
  725. package/dist/dispatch/engines/template-parser.d.ts +85 -0
  726. package/dist/dispatch/engines/template-parser.d.ts.map +1 -0
  727. package/dist/dispatch/engines/template-parser.js +114 -0
  728. package/dist/dispatch/engines/template-parser.js.map +1 -0
  729. package/dist/dispatch/engines/tools-engine.d.ts +13 -0
  730. package/dist/dispatch/engines/tools-engine.d.ts.map +1 -0
  731. package/dist/dispatch/engines/tools-engine.js +12 -0
  732. package/dist/dispatch/engines/tools-engine.js.map +1 -0
  733. package/dist/dispatch/engines/validate-engine.d.ts +13 -0
  734. package/dist/dispatch/engines/validate-engine.d.ts.map +1 -0
  735. package/dist/dispatch/engines/validate-engine.js +13 -0
  736. package/dist/dispatch/engines/validate-engine.js.map +1 -0
  737. package/dist/dispatch/index.d.ts +20 -0
  738. package/dist/dispatch/index.d.ts.map +1 -0
  739. package/dist/dispatch/index.js +19 -0
  740. package/dist/dispatch/index.js.map +1 -0
  741. package/dist/dispatch/lib/background-jobs.d.ts +162 -0
  742. package/dist/dispatch/lib/background-jobs.d.ts.map +1 -0
  743. package/dist/dispatch/lib/background-jobs.js +360 -0
  744. package/dist/dispatch/lib/background-jobs.js.map +1 -0
  745. package/dist/dispatch/lib/budget.d.ts +36 -0
  746. package/dist/dispatch/lib/budget.d.ts.map +1 -0
  747. package/dist/dispatch/lib/budget.js +109 -0
  748. package/dist/dispatch/lib/budget.js.map +1 -0
  749. package/dist/dispatch/lib/capability-matrix.d.ts +11 -0
  750. package/dist/dispatch/lib/capability-matrix.d.ts.map +1 -0
  751. package/dist/dispatch/lib/capability-matrix.js +10 -0
  752. package/dist/dispatch/lib/capability-matrix.js.map +1 -0
  753. package/dist/dispatch/lib/config-loader.d.ts +42 -0
  754. package/dist/dispatch/lib/config-loader.d.ts.map +1 -0
  755. package/dist/dispatch/lib/config-loader.js +218 -0
  756. package/dist/dispatch/lib/config-loader.js.map +1 -0
  757. package/dist/dispatch/lib/config.d.ts +11 -0
  758. package/dist/dispatch/lib/config.d.ts.map +1 -0
  759. package/dist/dispatch/lib/config.js +10 -0
  760. package/dist/dispatch/lib/config.js.map +1 -0
  761. package/dist/dispatch/lib/defaults.d.ts +115 -0
  762. package/dist/dispatch/lib/defaults.d.ts.map +1 -0
  763. package/dist/dispatch/lib/defaults.js +61 -0
  764. package/dist/dispatch/lib/defaults.js.map +1 -0
  765. package/dist/dispatch/lib/engine.d.ts +17 -0
  766. package/dist/dispatch/lib/engine.d.ts.map +1 -0
  767. package/dist/dispatch/lib/engine.js +36 -0
  768. package/dist/dispatch/lib/engine.js.map +1 -0
  769. package/dist/dispatch/lib/exit-codes.d.ts +35 -0
  770. package/dist/dispatch/lib/exit-codes.d.ts.map +1 -0
  771. package/dist/dispatch/lib/exit-codes.js +60 -0
  772. package/dist/dispatch/lib/exit-codes.js.map +1 -0
  773. package/dist/dispatch/lib/gateway-meta.d.ts +37 -0
  774. package/dist/dispatch/lib/gateway-meta.d.ts.map +1 -0
  775. package/dist/dispatch/lib/gateway-meta.js +50 -0
  776. package/dist/dispatch/lib/gateway-meta.js.map +1 -0
  777. package/dist/dispatch/lib/job-manager-accessor.d.ts +9 -0
  778. package/dist/dispatch/lib/job-manager-accessor.d.ts.map +1 -0
  779. package/dist/dispatch/lib/job-manager-accessor.js +13 -0
  780. package/dist/dispatch/lib/job-manager-accessor.js.map +1 -0
  781. package/dist/dispatch/lib/meta.d.ts +26 -0
  782. package/dist/dispatch/lib/meta.d.ts.map +1 -0
  783. package/dist/dispatch/lib/meta.js +37 -0
  784. package/dist/dispatch/lib/meta.js.map +1 -0
  785. package/dist/dispatch/lib/param-utils.d.ts +11 -0
  786. package/dist/dispatch/lib/param-utils.d.ts.map +1 -0
  787. package/dist/dispatch/lib/param-utils.js +10 -0
  788. package/dist/dispatch/lib/param-utils.js.map +1 -0
  789. package/dist/dispatch/lib/projections.d.ts +56 -0
  790. package/dist/dispatch/lib/projections.d.ts.map +1 -0
  791. package/dist/dispatch/lib/projections.js +65 -0
  792. package/dist/dispatch/lib/projections.js.map +1 -0
  793. package/dist/dispatch/lib/proto-envelope.d.ts +56 -0
  794. package/dist/dispatch/lib/proto-envelope.d.ts.map +1 -0
  795. package/dist/dispatch/lib/proto-envelope.js +17 -0
  796. package/dist/dispatch/lib/proto-envelope.js.map +1 -0
  797. package/dist/dispatch/lib/schema-utils.d.ts +39 -0
  798. package/dist/dispatch/lib/schema-utils.d.ts.map +1 -0
  799. package/dist/dispatch/lib/schema-utils.js +88 -0
  800. package/dist/dispatch/lib/schema-utils.js.map +1 -0
  801. package/dist/dispatch/lib/security.d.ts +11 -0
  802. package/dist/dispatch/lib/security.d.ts.map +1 -0
  803. package/dist/dispatch/lib/security.js +10 -0
  804. package/dist/dispatch/lib/security.js.map +1 -0
  805. package/dist/dispatch/middleware/audit.d.ts +23 -0
  806. package/dist/dispatch/middleware/audit.d.ts.map +1 -0
  807. package/dist/dispatch/middleware/audit.js +169 -0
  808. package/dist/dispatch/middleware/audit.js.map +1 -0
  809. package/dist/dispatch/middleware/field-filter.d.ts +25 -0
  810. package/dist/dispatch/middleware/field-filter.d.ts.map +1 -0
  811. package/dist/dispatch/middleware/field-filter.js +70 -0
  812. package/dist/dispatch/middleware/field-filter.js.map +1 -0
  813. package/dist/dispatch/middleware/pipeline.d.ts +33 -0
  814. package/dist/dispatch/middleware/pipeline.d.ts.map +1 -0
  815. package/dist/dispatch/middleware/pipeline.js +60 -0
  816. package/dist/dispatch/middleware/pipeline.js.map +1 -0
  817. package/dist/dispatch/middleware/projection.d.ts +35 -0
  818. package/dist/dispatch/middleware/projection.d.ts.map +1 -0
  819. package/dist/dispatch/middleware/projection.js +146 -0
  820. package/dist/dispatch/middleware/projection.js.map +1 -0
  821. package/dist/dispatch/middleware/protocol-enforcement.d.ts +30 -0
  822. package/dist/dispatch/middleware/protocol-enforcement.d.ts.map +1 -0
  823. package/dist/dispatch/middleware/protocol-enforcement.js +56 -0
  824. package/dist/dispatch/middleware/protocol-enforcement.js.map +1 -0
  825. package/dist/dispatch/middleware/rate-limiter.d.ts +72 -0
  826. package/dist/dispatch/middleware/rate-limiter.d.ts.map +1 -0
  827. package/dist/dispatch/middleware/rate-limiter.js +127 -0
  828. package/dist/dispatch/middleware/rate-limiter.js.map +1 -0
  829. package/dist/dispatch/middleware/sanitizer.d.ts +24 -0
  830. package/dist/dispatch/middleware/sanitizer.d.ts.map +1 -0
  831. package/dist/dispatch/middleware/sanitizer.js +56 -0
  832. package/dist/dispatch/middleware/sanitizer.js.map +1 -0
  833. package/dist/dispatch/middleware/session-resolver.d.ts +26 -0
  834. package/dist/dispatch/middleware/session-resolver.d.ts.map +1 -0
  835. package/dist/dispatch/middleware/session-resolver.js +65 -0
  836. package/dist/dispatch/middleware/session-resolver.js.map +1 -0
  837. package/dist/dispatch/middleware/telemetry.d.ts +21 -0
  838. package/dist/dispatch/middleware/telemetry.d.ts.map +1 -0
  839. package/dist/dispatch/middleware/telemetry.js +50 -0
  840. package/dist/dispatch/middleware/telemetry.js.map +1 -0
  841. package/dist/dispatch/middleware/verification-gates.d.ts +22 -0
  842. package/dist/dispatch/middleware/verification-gates.d.ts.map +1 -0
  843. package/dist/dispatch/middleware/verification-gates.js +59 -0
  844. package/dist/dispatch/middleware/verification-gates.js.map +1 -0
  845. package/dist/dispatch/registry.d.ts +91 -0
  846. package/dist/dispatch/registry.d.ts.map +1 -0
  847. package/dist/dispatch/registry.js +6430 -0
  848. package/dist/dispatch/registry.js.map +1 -0
  849. package/dist/dispatch/types.d.ts +150 -0
  850. package/dist/dispatch/types.d.ts.map +1 -0
  851. package/dist/dispatch/types.js +38 -0
  852. package/dist/dispatch/types.js.map +1 -0
  853. package/dist/migrations/2026-04-25-t991-parent-link-repair.d.ts +88 -0
  854. package/dist/migrations/2026-04-25-t991-parent-link-repair.d.ts.map +1 -0
  855. package/dist/migrations/2026-04-25-t991-parent-link-repair.js +76 -0
  856. package/dist/migrations/2026-04-25-t991-parent-link-repair.js.map +1 -0
  857. package/package.json +9 -9
@@ -0,0 +1,1599 @@
1
+ /**
2
+ * Task Engine
3
+ *
4
+ * Native TypeScript implementation of core task CRUD operations.
5
+ * Uses StoreProvider (via getStore()) for task/session data access,
6
+ * falling back to direct JSON for config and specialized operations.
7
+ *
8
+ * CRUD operations (show, list, find, exists, create, update, complete, delete, archive)
9
+ * delegate to src/core/tasks/*.
10
+ *
11
+ * Non-CRUD operations delegate to src/core/tasks/task-ops.ts.
12
+ *
13
+ * @task T4657
14
+ * @task T4790
15
+ * @epic T4654
16
+ */
17
+ // validation-rules.js still used by other engines; core modules handle their own validation
18
+ // Core module imports for accessor-based operations
19
+ import { computeTaskView, addTask as coreAddTask, archiveTasks as coreArchiveTasks, completeTask as coreCompleteTask, deleteTask as coreDeleteTask, findTasks as coreFindTasks, listTasks as coreListTasks, showTask as coreShowTask, coreTaskAnalyze, coreTaskBatchValidate, coreTaskBlockers, coreTaskCancel, coreTaskComplexityEstimate, coreTaskDepends, coreTaskDeps, coreTaskDepsCycles, coreTaskDepsOverview, coreTaskExport, coreTaskHistory, coreTaskImport, coreTaskLint, coreTaskNext, coreTaskPromote, coreTaskRelates, coreTaskRelatesAdd, coreTaskReopen, coreTaskReorder, coreTaskReparent, coreTaskRestore, coreTaskStats, coreTaskTree, coreTaskUnarchive, updateTask as coreUpdateTask, getAccessor, getActiveSession, getIvtrState, getLifecycleStatus, getLogger, loadConfig, predictImpact, toCompact, } from '@cleocode/core/internal';
20
+ import { cleoErrorToEngineError, engineError } from './_error.js';
21
+ /**
22
+ * Convert a core Task to a TaskRecord for backward compatibility.
23
+ * TaskRecord has string-typed status/priority; Task has union types.
24
+ *
25
+ * @task T4657
26
+ * @epic T4654
27
+ */
28
+ function taskToRecord(task) {
29
+ // Task union-typed fields (status, priority, origin, etc.) widen to string in TaskRecord.
30
+ // Some fields have structural mismatches (blockedBy: string vs string[], etc.)
31
+ // so we explicitly map each field rather than relying on spread.
32
+ const relates = task.relates?.map((r) => ({
33
+ taskId: r.taskId,
34
+ type: r.type,
35
+ ...(r.reason && { reason: r.reason }),
36
+ }));
37
+ return {
38
+ id: task.id,
39
+ title: task.title,
40
+ description: task.description ?? '',
41
+ status: task.status,
42
+ priority: task.priority,
43
+ type: task.type,
44
+ phase: task.phase,
45
+ createdAt: task.createdAt,
46
+ updatedAt: task.updatedAt ?? null,
47
+ completedAt: task.completedAt ?? null,
48
+ cancelledAt: task.cancelledAt ?? null,
49
+ parentId: task.parentId,
50
+ position: task.position,
51
+ positionVersion: task.positionVersion,
52
+ depends: task.depends,
53
+ relates,
54
+ files: task.files,
55
+ acceptance: task.acceptance?.filter((a) => typeof a === 'string'),
56
+ notes: task.notes,
57
+ labels: task.labels,
58
+ size: task.size ?? null,
59
+ epicLifecycle: task.epicLifecycle ?? null,
60
+ noAutoComplete: task.noAutoComplete ?? null,
61
+ verification: task.verification ? { ...task.verification } : null,
62
+ origin: task.origin ?? null,
63
+ cancellationReason: task.cancellationReason,
64
+ blockedBy: task.blockedBy ? [task.blockedBy] : undefined,
65
+ pipelineStage: task.pipelineStage ?? null,
66
+ // T944: orthogonal axes
67
+ role: task.role ?? null,
68
+ scope: task.scope ?? null,
69
+ severity: task.severity ?? null,
70
+ };
71
+ }
72
+ /**
73
+ * Convert an array of core Tasks to TaskRecords.
74
+ *
75
+ * @task T4657
76
+ * @epic T4654
77
+ */
78
+ function tasksToRecords(tasks) {
79
+ return tasks.map(taskToRecord);
80
+ }
81
+ // loadTaskFile and saveTaskFile removed — all operations now use DataAccessor.
82
+ // Config reads (hierarchy limits, phase meta) still use readJsonFile directly
83
+ // since they are NOT domain data (they don't go through the accessor).
84
+ // Priority normalization moved to core/tasks/add.ts (normalizePriority)
85
+ // ===== Query Operations =====
86
+ /**
87
+ * Get a single task by ID.
88
+ *
89
+ * @remarks
90
+ * Fetches the full task record from the data accessor and converts it
91
+ * to the backward-compatible TaskRecord format. Also computes the
92
+ * canonical {@link TaskView} via `computeTaskView` so the `view` field
93
+ * in the response includes `readyToComplete`, `nextAction`, and
94
+ * `lifecycleProgress` without a second round-trip.
95
+ *
96
+ * The `view` field is `null` when `computeTaskView` cannot load the
97
+ * task (e.g. freshly created task not yet visible to the native DB
98
+ * handle). Callers MUST check `result.data.task` for the primary record.
99
+ *
100
+ * @param projectRoot - Absolute path to the project root
101
+ * @param taskId - Task identifier (e.g. "T001")
102
+ * @returns EngineResult containing the task record and canonical view
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const result = await taskShow('/project', 'T42');
107
+ * if (result.success) {
108
+ * console.log(result.data.task.title);
109
+ * console.log(result.data.view?.nextAction); // 'verify' | 'spawn-worker' | …
110
+ * }
111
+ * ```
112
+ *
113
+ * @task T4657
114
+ * @task T943
115
+ * @epic T4654
116
+ */
117
+ export async function taskShow(projectRoot, taskId) {
118
+ try {
119
+ const accessor = await getAccessor(projectRoot);
120
+ const detail = await coreShowTask(taskId, projectRoot, accessor);
121
+ // Compute the canonical view in parallel with record conversion.
122
+ const view = await computeTaskView(taskId, accessor);
123
+ return { success: true, data: { task: taskToRecord(detail), view } };
124
+ }
125
+ catch (err) {
126
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
127
+ }
128
+ }
129
+ /**
130
+ * Get a single task by ID, optionally including its lifecycle stage history.
131
+ *
132
+ * @remarks
133
+ * When `includeHistory` is `true`, appends a `history` array containing one
134
+ * {@link LifecycleStageEntry} per RCASD pipeline stage. If the task has no
135
+ * pipeline record the call never fails — it returns `history: []` instead.
136
+ *
137
+ * When `includeHistory` is `false` (or omitted) the return value is identical
138
+ * to {@link taskShow} and the `history` key is absent from `data`.
139
+ *
140
+ * @param projectRoot - Absolute path to the project root
141
+ * @param taskId - Task identifier (e.g. "T042")
142
+ * @param includeHistory - When true, append lifecycle stage array
143
+ * @returns EngineResult containing the task record and optional history
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const result = await taskShowWithHistory('/project', 'T42', true);
148
+ * if (result.success) {
149
+ * console.log(result.data.task.title);
150
+ * console.log(result.data.history); // LifecycleStageEntry[]
151
+ * }
152
+ * ```
153
+ *
154
+ * @task T787
155
+ * @epic T769
156
+ */
157
+ export async function taskShowWithHistory(projectRoot, taskId, includeHistory) {
158
+ try {
159
+ const accessor = await getAccessor(projectRoot);
160
+ const detail = await coreShowTask(taskId, projectRoot, accessor);
161
+ const task = taskToRecord(detail);
162
+ if (!includeHistory) {
163
+ return { success: true, data: { task } };
164
+ }
165
+ // Fetch lifecycle stages — empty array on any failure (task may have no pipeline).
166
+ let history = [];
167
+ try {
168
+ const status = await getLifecycleStatus(projectRoot ?? process.cwd(), { taskId });
169
+ history = status.stages.map((s) => ({
170
+ stage: s.stage,
171
+ status: s.status ?? 'not_started',
172
+ startedAt: null,
173
+ completedAt: s.completedAt ?? null,
174
+ outputFile: s.outputFile ?? null,
175
+ }));
176
+ }
177
+ catch {
178
+ // No pipeline for this task — return empty history (not an error).
179
+ history = [];
180
+ }
181
+ return { success: true, data: { task, history } };
182
+ }
183
+ catch (err) {
184
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
185
+ }
186
+ }
187
+ /**
188
+ * List tasks with optional filters.
189
+ *
190
+ * @remarks
191
+ * Supports filtering by parent, status, priority, type, phase, and label.
192
+ * When `compact` is true, returns lightweight CompactTask records.
193
+ * Results are paginated via `limit` and `offset` parameters.
194
+ *
195
+ * @param projectRoot - Absolute path to the project root
196
+ * @param params - Optional filter, pagination, and format parameters
197
+ * @returns EngineResult with task array, total count, and filtered count
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * const result = await taskList('/project', { status: 'active', limit: 10 });
202
+ * ```
203
+ *
204
+ * @task T4657
205
+ * @epic T4654
206
+ */
207
+ export async function taskList(projectRoot, params) {
208
+ try {
209
+ const accessor = await getAccessor(projectRoot);
210
+ const result = await coreListTasks({
211
+ parentId: params?.parent ?? undefined,
212
+ status: params?.status,
213
+ priority: params?.priority,
214
+ type: params?.type,
215
+ phase: params?.phase,
216
+ label: params?.label,
217
+ children: params?.children,
218
+ limit: params?.limit,
219
+ offset: params?.offset,
220
+ }, projectRoot, accessor);
221
+ const tasks = params?.compact
222
+ ? result.tasks.map((t) => toCompact(t))
223
+ : tasksToRecords(result.tasks);
224
+ if (params?.compact) {
225
+ return {
226
+ success: true,
227
+ data: { tasks, total: result.total, filtered: result.filtered },
228
+ page: result.page,
229
+ };
230
+ }
231
+ return {
232
+ success: true,
233
+ data: { tasks, total: result.total, filtered: result.filtered },
234
+ page: result.page,
235
+ };
236
+ }
237
+ catch (err) {
238
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
239
+ }
240
+ }
241
+ /**
242
+ * Fuzzy search tasks by title/description/ID.
243
+ *
244
+ * @remarks
245
+ * Returns minimal task records to keep context consumption low.
246
+ * Supports exact matching, status filtering, and archive inclusion.
247
+ *
248
+ * @param projectRoot - Absolute path to the project root
249
+ * @param query - Search string to match against title, description, or ID
250
+ * @param limit - Maximum number of results (defaults to 20)
251
+ * @param options - Additional search options
252
+ * @returns EngineResult with matching tasks and total count
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * const result = await taskFind('/project', 'authentication', 10);
257
+ * ```
258
+ *
259
+ * @task T4657
260
+ * @epic T4654
261
+ */
262
+ export async function taskFind(projectRoot, query, limit, options) {
263
+ try {
264
+ const accessor = await getAccessor(projectRoot);
265
+ const findResult = await coreFindTasks({
266
+ query,
267
+ id: options?.id,
268
+ exact: options?.exact,
269
+ status: options?.status,
270
+ includeArchive: options?.includeArchive,
271
+ limit: limit ?? 20,
272
+ offset: options?.offset,
273
+ // T944: role filter
274
+ role: options?.role,
275
+ }, projectRoot, accessor);
276
+ // --verbose: return full task records for each result
277
+ if (options?.verbose) {
278
+ const fullResults = [];
279
+ for (const r of findResult.results) {
280
+ const task = await accessor.loadSingleTask(r.id);
281
+ if (task)
282
+ fullResults.push(taskToRecord(task));
283
+ }
284
+ return { success: true, data: { results: fullResults, total: findResult.total } };
285
+ }
286
+ // --fields: return full task records (loading full data to include requested fields).
287
+ // Since loadSingleTask is required anyway, returning the complete TaskRecord avoids
288
+ // an unsafe Record<string, unknown> cast while giving agents the extra fields they need.
289
+ if (options?.fields) {
290
+ const fullResults = [];
291
+ for (const r of findResult.results) {
292
+ const task = await accessor.loadSingleTask(r.id);
293
+ if (task)
294
+ fullResults.push(taskToRecord(task));
295
+ }
296
+ return { success: true, data: { results: fullResults, total: findResult.total } };
297
+ }
298
+ // Default: return minimal records with depends/type/size for agent readiness checks
299
+ const results = findResult.results.map((r) => ({
300
+ id: r.id,
301
+ title: r.title,
302
+ status: r.status,
303
+ priority: r.priority,
304
+ parentId: r.parentId,
305
+ depends: r.depends,
306
+ type: r.type,
307
+ size: r.size,
308
+ }));
309
+ return { success: true, data: { results, total: findResult.total } };
310
+ }
311
+ catch (err) {
312
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
313
+ }
314
+ }
315
+ /**
316
+ * Check if a task exists.
317
+ *
318
+ * @remarks
319
+ * Returns `{ exists: true }` if the task is found, `{ exists: false }` otherwise.
320
+ * Never fails -- catches all errors and returns false.
321
+ *
322
+ * @param projectRoot - Absolute path to the project root
323
+ * @param taskId - Task identifier to check
324
+ * @returns EngineResult with exists flag and the queried taskId
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const result = await taskExists('/project', 'T42');
329
+ * if (result.success && result.data.exists) { console.log('exists'); }
330
+ * ```
331
+ *
332
+ *
333
+ @task
334
+ T4657
335
+ * @epic T4654
336
+ */
337
+ export async function taskExists(projectRoot, taskId) {
338
+ try {
339
+ const accessor = await getAccessor(projectRoot);
340
+ const exists = await accessor.taskExists(taskId);
341
+ return { success: true, data: { exists, taskId } };
342
+ }
343
+ catch {
344
+ return { success: true, data: { exists: false, taskId } };
345
+ }
346
+ }
347
+ // ===== Mutate Operations =====
348
+ /**
349
+ * Create a new task.
350
+ *
351
+ * @remarks
352
+ * Validates hierarchy depth, sibling limits, parent type, and circular
353
+ * references before creating the task. Supports dry-run mode for preview.
354
+ *
355
+ * @param projectRoot - Absolute path to the project root
356
+ * @param params - Task creation parameters
357
+ * @returns EngineResult with the created task record and duplicate flag
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * const result = await taskCreate('/project', {
362
+ * title: 'Implement auth',
363
+ * description: 'Add JWT-based authentication',
364
+ * priority: 'high',
365
+ * });
366
+ * ```
367
+ */
368
+ export async function taskCreate(projectRoot, params) {
369
+ try {
370
+ const accessor = await getAccessor(projectRoot);
371
+ // Resolve parent through 3 mechanisms in priority order (T090):
372
+ // 1. Explicit --parent flag
373
+ // 2. --parent-search fuzzy title match
374
+ // 3. Session-scoped epic inheritance (when session scope is epic:T###)
375
+ let resolvedParent = params.parent || null;
376
+ // --parent-search: resolve by title substring
377
+ if (!resolvedParent && params.parentSearch) {
378
+ const searchResult = await coreFindTasks({ query: params.parentSearch, limit: 1 }, projectRoot, accessor);
379
+ if (searchResult.results.length > 0) {
380
+ resolvedParent = searchResult.results[0].id;
381
+ }
382
+ else {
383
+ return cleoErrorToEngineError(new Error(`No task found matching --parent-search "${params.parentSearch}"`), 'E_NOT_FOUND', `No task found matching "${params.parentSearch}"`);
384
+ }
385
+ }
386
+ // Session-scoped parent: auto-inherit from epic scope when no parent specified
387
+ if (!resolvedParent && params.type !== 'epic') {
388
+ try {
389
+ const session = await getActiveSession(projectRoot);
390
+ if (session?.scope?.type === 'epic' && session.scope.epicId) {
391
+ resolvedParent = session.scope.epicId;
392
+ }
393
+ }
394
+ catch {
395
+ // Session lookup failure is non-fatal — proceed without parent
396
+ }
397
+ }
398
+ const result = await coreAddTask({
399
+ title: params.title,
400
+ description: params.description,
401
+ parentId: resolvedParent,
402
+ depends: params.depends,
403
+ priority: params.priority || 'medium',
404
+ labels: params.labels,
405
+ type: params.type || undefined,
406
+ phase: params.phase,
407
+ size: params.size,
408
+ acceptance: params.acceptance,
409
+ notes: params.notes,
410
+ files: params.files,
411
+ dryRun: params.dryRun,
412
+ // T944: orthogonal axes
413
+ role: params.role,
414
+ scope: params.scope,
415
+ severity: params.severity,
416
+ }, projectRoot, accessor);
417
+ return {
418
+ success: true,
419
+ data: {
420
+ task: taskToRecord(result.task),
421
+ duplicate: result.duplicate ?? false,
422
+ dryRun: params.dryRun,
423
+ ...(result.warnings?.length && { warnings: result.warnings }),
424
+ },
425
+ };
426
+ }
427
+ catch (err) {
428
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
429
+ }
430
+ }
431
+ /**
432
+ * Update a task's fields.
433
+ *
434
+ * @remarks
435
+ * Supports atomic label and dependency operations via addLabels/removeLabels
436
+ * and addDepends/removeDepends. Returns the updated task and a list of
437
+ * changed fields.
438
+ *
439
+ * @param projectRoot - Absolute path to the project root
440
+ * @param taskId - Task identifier to update
441
+ * @param updates - Fields to update (only provided fields are changed)
442
+ * @returns EngineResult with the updated task record and list of changes
443
+ *
444
+ * @example
445
+ * ```typescript
446
+ * const result = await taskUpdate('/project', 'T42', { status: 'active' });
447
+ * ```
448
+ */
449
+ export async function taskUpdate(projectRoot, taskId, updates) {
450
+ try {
451
+ const accessor = await getAccessor(projectRoot);
452
+ const result = await coreUpdateTask({
453
+ taskId,
454
+ title: updates.title,
455
+ description: updates.description,
456
+ status: updates.status,
457
+ priority: updates.priority,
458
+ notes: updates.notes,
459
+ labels: updates.labels,
460
+ addLabels: updates.addLabels,
461
+ removeLabels: updates.removeLabels,
462
+ depends: updates.depends,
463
+ addDepends: updates.addDepends,
464
+ removeDepends: updates.removeDepends,
465
+ acceptance: updates.acceptance,
466
+ parentId: updates.parent,
467
+ type: updates.type,
468
+ size: updates.size,
469
+ // T1014: wire --files through to core update (parity with task add).
470
+ files: updates.files,
471
+ // T834 / ADR-051 Decision 4: forward pipelineStage to core update.
472
+ pipelineStage: updates.pipelineStage,
473
+ // T944: orthogonal axes
474
+ role: updates.role,
475
+ scope: updates.scope,
476
+ // T1590: forward operator override reason to AC-immutability guard.
477
+ reason: updates.reason,
478
+ }, projectRoot, accessor);
479
+ return { success: true, data: { task: taskToRecord(result.task), changes: result.changes } };
480
+ }
481
+ catch (err) {
482
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
483
+ }
484
+ }
485
+ /**
486
+ * Complete a task (set status to done).
487
+ *
488
+ * @remarks
489
+ * May trigger auto-completion of parent tasks and unblocking of dependent
490
+ * tasks. Maps core exit codes to engine error codes for structured error reporting.
491
+ *
492
+ * After a successful completion, `modified_by` and `session_id` are written back
493
+ * to the task row via `updateTaskFields` so every completed task carries auditable
494
+ * provenance (T1222 / CLEO-VALID-27). `modified_by` is sourced from the
495
+ * `CLEO_AGENT_ID` environment variable (falls back to `"cleo"`). `session_id` is
496
+ * sourced from the currently-active session returned by `getActiveSession`, falling
497
+ * back to the `CLEO_SESSION_ID` environment variable, and finally `null`.
498
+ *
499
+ * @param projectRoot - Absolute path to the project root
500
+ * @param taskId - Task identifier to complete
501
+ * @param notes - Optional completion notes
502
+ * @returns EngineResult with the completed task, auto-completed parents, and unblocked tasks
503
+ *
504
+ * @example
505
+ * ```typescript
506
+ * const result = await taskComplete('/project', 'T42', 'All tests passing');
507
+ * ```
508
+ *
509
+ * @task T1222
510
+ */
511
+ export async function taskComplete(projectRoot, taskId, notes) {
512
+ try {
513
+ const accessor = await getAccessor(projectRoot);
514
+ const result = await coreCompleteTask({ taskId, notes }, projectRoot, accessor);
515
+ // T1222 / CLEO-VALID-27: stamp modified_by + session_id on every successful
516
+ // completion so the audit trail is complete. Best-effort — a failure here must
517
+ // not roll back the completion that already landed in the DB.
518
+ try {
519
+ const agentId = process.env['CLEO_AGENT_ID'] ?? 'cleo';
520
+ let sessionId = typeof process.env['CLEO_SESSION_ID'] === 'string' &&
521
+ process.env['CLEO_SESSION_ID'].length > 0
522
+ ? process.env['CLEO_SESSION_ID']
523
+ : null;
524
+ // Prefer the live session record over the env fallback.
525
+ const activeSession = await getActiveSession(projectRoot);
526
+ if (activeSession?.id) {
527
+ sessionId = activeSession.id;
528
+ }
529
+ await accessor.updateTaskFields(taskId, { modifiedBy: agentId, sessionId });
530
+ }
531
+ catch {
532
+ // Provenance write failure is non-fatal; the task is already completed.
533
+ }
534
+ return {
535
+ success: true,
536
+ data: {
537
+ task: result.task,
538
+ ...(result.autoCompleted && { autoCompleted: result.autoCompleted }),
539
+ ...(result.unblockedTasks && { unblockedTasks: result.unblockedTasks }),
540
+ },
541
+ };
542
+ }
543
+ catch (err) {
544
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to complete task');
545
+ }
546
+ }
547
+ /**
548
+ * Project IvtrPhaseEntry to the surface-safe IvtrHistoryEntry shape.
549
+ */
550
+ function toHistoryEntry(e) {
551
+ return {
552
+ phase: e.phase,
553
+ agent: e.agentIdentity,
554
+ startedAt: e.startedAt,
555
+ completedAt: e.completedAt,
556
+ passed: e.passed,
557
+ evidenceRefs: e.evidenceRefs,
558
+ };
559
+ }
560
+ /**
561
+ * Complete a task with strict IVTR + evidence-staleness enforcement.
562
+ *
563
+ * @remarks
564
+ * Enforcement path (T832 / ADR-051 Decision 3+8):
565
+ * 1. **Evidence staleness re-check**: every verification.evidence record is
566
+ * re-validated. Hard atoms (commit, files, test-run) must still match
567
+ * their recorded sha256 / reachability; tampering after verify → reject
568
+ * with {@link E_EVIDENCE_STALE}.
569
+ * 2. **IVTR enforcement** in strict mode: `ivtr_state.currentPhase` MUST be
570
+ * `released`; otherwise reject with {@link E_IVTR_INCOMPLETE}.
571
+ * 3. **Parent-epic lifecycle gate**: child task completion is blocked while
572
+ * the parent epic is still in a planning stage (research/consensus/
573
+ * architecture_decision/specification/decomposition). Rejects with
574
+ * {@link E_LIFECYCLE_GATE_FAILED}.
575
+ *
576
+ * Unlike v2026.4.77 and earlier, `--force` is no longer accepted. The
577
+ * dispatch layer rejects `force` with `E_FLAG_REMOVED` before we reach
578
+ * here. Emergency bypass lives in `cleo verify` via `CLEO_OWNER_OVERRIDE`.
579
+ *
580
+ * @param projectRoot - Absolute path to the project root
581
+ * @param taskId - Task identifier to complete
582
+ * @param notes - Optional completion notes
583
+ * @returns EngineResult with the completed task, auto-completed parents, and unblocked tasks
584
+ *
585
+ * @task T815
586
+ * @task T832
587
+ * @adr ADR-051
588
+ * @epic T810
589
+ */
590
+ export async function taskCompleteStrict(projectRoot, taskId, notes) {
591
+ try {
592
+ // Load config to check lifecycle enforcement mode.
593
+ const config = await loadConfig(projectRoot);
594
+ const lifecycleMode = config.lifecycle?.mode ?? 'strict';
595
+ // 1. Evidence staleness re-check (T832 / ADR-051 Decision 8).
596
+ // When verification.evidence is populated, re-validate each hard atom
597
+ // to catch post-verify tampering. Best-effort import to avoid cycles
598
+ // during dispatch tests — core module is lazily loaded.
599
+ if (lifecycleMode === 'strict') {
600
+ const accessor = await getAccessor(projectRoot);
601
+ const task = await accessor.loadSingleTask(taskId);
602
+ if (task?.verification?.evidence) {
603
+ const { revalidateEvidence } = await import('@cleocode/core/internal');
604
+ const evidenceEntries = Object.entries(task.verification.evidence);
605
+ const staleGates = [];
606
+ for (const [gate, ev] of evidenceEntries) {
607
+ if (!ev)
608
+ continue;
609
+ const check = await revalidateEvidence(ev, projectRoot);
610
+ if (!check.stillValid) {
611
+ staleGates.push({
612
+ gate,
613
+ failures: check.failedAtoms.map((f) => f.reason),
614
+ });
615
+ }
616
+ }
617
+ if (staleGates.length > 0) {
618
+ const message = `Task ${taskId} evidence is stale. ` +
619
+ staleGates.map((sg) => `Gate '${sg.gate}': ${sg.failures.join('; ')}`).join(' | ');
620
+ return engineError('E_EVIDENCE_STALE', message, {
621
+ details: { taskId, staleGates },
622
+ fix: `Re-capture evidence for the stale gates via ` +
623
+ `'cleo verify ${taskId} --gate <gate> --evidence <updated>' ` +
624
+ `then retry 'cleo complete ${taskId}'. See ADR-051.`,
625
+ });
626
+ }
627
+ }
628
+ }
629
+ // 2. IVTR enforcement only applies in strict mode.
630
+ if (lifecycleMode === 'strict') {
631
+ const ivtrState = await getIvtrState(taskId, { cwd: projectRoot });
632
+ if (ivtrState !== null && ivtrState.currentPhase !== 'released') {
633
+ // Identify which phases have not passed at all.
634
+ const requiredPhases = [
635
+ 'implement',
636
+ 'validate',
637
+ 'test',
638
+ ];
639
+ const failedPhases = [];
640
+ for (const phase of requiredPhases) {
641
+ const hasPassed = ivtrState.phaseHistory.some((e) => e.phase === phase && e.passed === true);
642
+ if (!hasPassed) {
643
+ failedPhases.push(`Phase '${phase}' has no passing entry`);
644
+ }
645
+ }
646
+ // Also note if a phase is currently active (in-progress).
647
+ const activeEntry = ivtrState.phaseHistory.findLast((e) => e.completedAt === null);
648
+ if (activeEntry) {
649
+ failedPhases.push(`Phase '${activeEntry.phase}' is currently in-progress (not completed)`);
650
+ }
651
+ return engineError('E_IVTR_INCOMPLETE', `Task ${taskId} IVTR loop is not complete — currentPhase='${ivtrState.currentPhase}', not 'released'`, {
652
+ details: {
653
+ taskId,
654
+ currentPhase: ivtrState.currentPhase,
655
+ failedPhases,
656
+ },
657
+ fix: `Advance the IVTR loop to 'released' via 'cleo orchestrate ivtr ${taskId} --next'. Evidence-based bypass: CLEO_OWNER_OVERRIDE=1 on 'cleo verify' (audited, see ADR-051).`,
658
+ });
659
+ }
660
+ }
661
+ // 3. Parent-epic lifecycle gate check on child complete (T788 LOOM-04).
662
+ // When child task has an epic parent whose pipelineStage is still in early
663
+ // planning stages, reject completion. Advisory mode logs but allows.
664
+ if (lifecycleMode === 'strict' || lifecycleMode === 'advisory') {
665
+ const accessor = await getAccessor(projectRoot);
666
+ const task = await accessor.loadSingleTask(taskId);
667
+ if (task?.parentId) {
668
+ const parent = await accessor.loadSingleTask(task.parentId);
669
+ if (parent?.type === 'epic') {
670
+ const earlyStages = new Set([
671
+ 'research',
672
+ 'consensus',
673
+ 'architecture_decision',
674
+ 'specification',
675
+ 'decomposition',
676
+ ]);
677
+ const epicStage = parent.pipelineStage ?? null;
678
+ if (epicStage && earlyStages.has(epicStage)) {
679
+ const msg = `Task ${taskId} cannot complete: parent epic ${task.parentId} is still in ` +
680
+ `'${epicStage}' stage. Advance the epic past decomposition before completing children.`;
681
+ if (lifecycleMode === 'strict') {
682
+ return engineError('E_LIFECYCLE_GATE_FAILED', msg, {
683
+ details: {
684
+ taskId,
685
+ parentEpicId: task.parentId,
686
+ epicStage,
687
+ requiredStages: ['implementation', 'validation', 'testing', 'release'],
688
+ },
689
+ fix: `Advance the parent epic via 'cleo lifecycle complete ${task.parentId} ${epicStage}' ` +
690
+ `and then the next stages. Lifecycle advancement automatically updates the parent epic's pipelineStage (ADR-051 Decision 5).`,
691
+ });
692
+ }
693
+ // Advisory mode: log warning but continue.
694
+ getLogger('engine:lifecycle').warn({
695
+ taskId,
696
+ parentEpicId: task.parentId,
697
+ epicStage,
698
+ mode: lifecycleMode,
699
+ }, `[ADVISORY] parent-epic lifecycle gate: ${msg}`);
700
+ }
701
+ }
702
+ }
703
+ }
704
+ // 4. T1222 / CLEO-VALID-26: verify verification_json is not NULL before
705
+ // delegating. Only applies in strict mode — advisory/off modes let core's
706
+ // completeTask surface its own VERIFICATION_INIT_FAILED error. Epics are
707
+ // exempted (auto-completed, no verify step required).
708
+ if (lifecycleMode === 'strict') {
709
+ const accessor = await getAccessor(projectRoot);
710
+ const task = await accessor.loadSingleTask(taskId);
711
+ if (task && task.type !== 'epic' && !task.verification) {
712
+ return engineError('E_EVIDENCE_MISSING', `Task ${taskId} has no verification record (verification_json IS NULL). ` +
713
+ `Run 'cleo verify' with programmatic evidence before completing. See ADR-051.`, {
714
+ details: { taskId, verificationStatus: 'null' },
715
+ fix: `Initialize and populate verification gates: ` +
716
+ `'cleo verify ${taskId} --gate implemented --evidence "commit:<sha>;files:<list>"' ` +
717
+ `and other required gates, then retry 'cleo complete ${taskId}'.`,
718
+ });
719
+ }
720
+ }
721
+ // No IVTR state, or lifecycle not strict, or already released — delegate normally.
722
+ return taskComplete(projectRoot, taskId, notes);
723
+ }
724
+ catch (err) {
725
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to complete task (strict mode)');
726
+ }
727
+ }
728
+ /**
729
+ * Retrieve the IVTR phase history for a task.
730
+ *
731
+ * @remarks
732
+ * Reads `tasks.ivtr_state` JSON and extracts the `phaseHistory` array.
733
+ * Returns an empty `ivtrHistory` array when the task has no IVTR state —
734
+ * this is not an error condition.
735
+ *
736
+ * @param projectRoot - Absolute path to the project root
737
+ * @param taskId - Task identifier (e.g. "T042")
738
+ * @returns EngineResult with ivtrHistory array
739
+ *
740
+ * @example
741
+ * ```typescript
742
+ * const result = await taskShowIvtrHistory('/project', 'T42');
743
+ * if (result.success) console.log(result.data.ivtrHistory);
744
+ * ```
745
+ *
746
+ * @task T817
747
+ * @epic T810
748
+ */
749
+ export async function taskShowIvtrHistory(projectRoot, taskId) {
750
+ try {
751
+ const ivtrState = await getIvtrState(taskId, { cwd: projectRoot });
752
+ if (!ivtrState) {
753
+ return { success: true, data: { ivtrHistory: [] } };
754
+ }
755
+ const ivtrHistory = ivtrState.phaseHistory.map(toHistoryEntry);
756
+ return { success: true, data: { ivtrHistory } };
757
+ }
758
+ catch (err) {
759
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to read IVTR state');
760
+ }
761
+ }
762
+ /**
763
+ * Delete a task.
764
+ *
765
+ * @remarks
766
+ * When `force` is true, cascade-deletes child tasks. Otherwise, returns
767
+ * E_HAS_CHILDREN if the task has children.
768
+ *
769
+ * @param projectRoot - Absolute path to the project root
770
+ * @param taskId - Task identifier to delete
771
+ * @param force - When true, enables cascade deletion of children
772
+ * @returns EngineResult with the deleted task and optional cascade info
773
+ *
774
+ * @example
775
+ * ```typescript
776
+ * const result = await taskDelete('/project', 'T42', true);
777
+ * ```
778
+ */
779
+ export async function taskDelete(projectRoot, taskId, force) {
780
+ try {
781
+ const accessor = await getAccessor(projectRoot);
782
+ const result = await coreDeleteTask({
783
+ taskId,
784
+ force: force ?? false,
785
+ cascade: force ?? false,
786
+ }, projectRoot, accessor);
787
+ return {
788
+ success: true,
789
+ data: {
790
+ deletedTask: taskToRecord(result.deletedTask),
791
+ deleted: true,
792
+ cascadeDeleted: result.cascadeDeleted,
793
+ },
794
+ };
795
+ }
796
+ catch (err) {
797
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
798
+ }
799
+ }
800
+ /**
801
+ * Archive completed tasks.
802
+ * Moves done/cancelled tasks from active task data to archive.
803
+ *
804
+ * @remarks
805
+ * Archives a specific task by ID, or all tasks completed before a given date.
806
+ * Archived tasks are no longer returned by default queries.
807
+ *
808
+ * @param projectRoot - Absolute path to the project root
809
+ * @param taskId - Optional specific task ID to archive
810
+ * @param before - Optional ISO date string; archives tasks completed before this date
811
+ * @returns EngineResult with count and list of archived task IDs
812
+ *
813
+ * @example
814
+ * ```typescript
815
+ * const result = await taskArchive('/project', undefined, '2026-01-01');
816
+ * ```
817
+ */
818
+ export async function taskArchive(projectRoot, taskId, before, opts) {
819
+ try {
820
+ const accessor = await getAccessor(projectRoot);
821
+ const taskIds = opts?.taskIds ?? (taskId ? [taskId] : undefined);
822
+ const result = await coreArchiveTasks({
823
+ taskIds,
824
+ before,
825
+ includeCancelled: opts?.includeCancelled,
826
+ dryRun: opts?.dryRun,
827
+ }, projectRoot, accessor);
828
+ return {
829
+ success: true,
830
+ data: {
831
+ archivedCount: result.archived.length,
832
+ archivedTasks: result.archived.map((id) => ({ id })),
833
+ },
834
+ };
835
+ }
836
+ catch (err) {
837
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
838
+ }
839
+ }
840
+ // ===== Non-CRUD Operations (delegated to core/tasks/task-ops.ts) =====
841
+ /**
842
+ * Suggest next task to work on based on priority, phase alignment, age, and dependency readiness.
843
+ *
844
+ * @remarks
845
+ * Scores all pending tasks and returns ranked suggestions. When `explain`
846
+ * is true, includes per-task scoring reasons in the response.
847
+ *
848
+ * @param projectRoot - Absolute path to the project root
849
+ * @param params - Optional count limit and explain flag
850
+ * @returns EngineResult with scored suggestions and total candidate count
851
+ *
852
+ * @example
853
+ * ```typescript
854
+ * const result = await taskNext('/project', { count: 3, explain: true });
855
+ * ```
856
+ *
857
+ * @task T4657
858
+ * @task T4790
859
+ * @epic T4654
860
+ */
861
+ export async function taskNext(projectRoot, params) {
862
+ try {
863
+ const result = await coreTaskNext(projectRoot, params);
864
+ return { success: true, data: result };
865
+ }
866
+ catch {
867
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
868
+ }
869
+ }
870
+ /**
871
+ * Show blocked tasks and analyze blocking chains.
872
+ *
873
+ * @remarks
874
+ * Identifies all blocked tasks, traces their blocking chains, and highlights
875
+ * critical blockers (tasks that block the most other tasks).
876
+ *
877
+ * @param projectRoot - Absolute path to the project root
878
+ * @param params - Optional analysis and limit parameters
879
+ * @returns EngineResult with blocked tasks, critical blockers, and summary
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * const result = await taskBlockers('/project', { analyze: true });
884
+ * ```
885
+ *
886
+ * @task T4657
887
+ * @task T4790
888
+ * @epic T4654
889
+ */
890
+ export async function taskBlockers(projectRoot, params) {
891
+ try {
892
+ const result = await coreTaskBlockers(projectRoot, params);
893
+ return { success: true, data: result };
894
+ }
895
+ catch {
896
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
897
+ }
898
+ }
899
+ /**
900
+ * Build hierarchy tree.
901
+ *
902
+ * @remarks
903
+ * Returns a tree structure of tasks rooted at the given task ID, or
904
+ * the full project tree when no task ID is specified.
905
+ *
906
+ * When `withBlockers` is `true` each node is annotated with `blockerChain`
907
+ * and `leafBlockers` so the formatter can render transitive chain information.
908
+ *
909
+ * @param projectRoot - Absolute path to the project root.
910
+ * @param taskId - Optional root task ID for subtree.
911
+ * @param withBlockers - When `true`, annotate each node with blocker chain data.
912
+ * @returns EngineResult with the hierarchical tree data.
913
+ *
914
+ * @example
915
+ * ```typescript
916
+ * const result = await taskTree('/project', 'T1');
917
+ * ```
918
+ *
919
+ * @example
920
+ * ```typescript
921
+ * // With blocker chain annotations
922
+ * const result = await taskTree('/project', undefined, true);
923
+ * ```
924
+ *
925
+ * @task T4657
926
+ * @task T4790
927
+ * @task T1206
928
+ * @epic T4654
929
+ */
930
+ export async function taskTree(projectRoot, taskId, withBlockers) {
931
+ try {
932
+ const result = await coreTaskTree(projectRoot, taskId, withBlockers);
933
+ return { success: true, data: result };
934
+ }
935
+ catch (err) {
936
+ return cleoErrorToEngineError(err, 'E_NOT_FOUND', 'Task not found');
937
+ }
938
+ }
939
+ /**
940
+ * Show dependencies for a task - both what it depends on and what depends on it.
941
+ *
942
+ * @remarks
943
+ * Returns bidirectional dependency information including unresolved deps
944
+ * and a ready flag indicating whether all dependencies are satisfied.
945
+ *
946
+ * @param projectRoot - Absolute path to the project root
947
+ * @param taskId - Task identifier to inspect
948
+ * @returns EngineResult with dependency information in both directions
949
+ *
950
+ * @example
951
+ * ```typescript
952
+ * const result = await taskDeps('/project', 'T42');
953
+ * ```
954
+ *
955
+ * @task T4657
956
+ * @task T4790
957
+ * @epic T4654
958
+ */
959
+ export async function taskDeps(projectRoot, taskId) {
960
+ try {
961
+ const result = await coreTaskDeps(projectRoot, taskId);
962
+ return { success: true, data: result };
963
+ }
964
+ catch (err) {
965
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
966
+ }
967
+ }
968
+ /**
969
+ * Show task relations (existing relates entries).
970
+ *
971
+ * @remarks
972
+ * Lists all `relates` entries for a given task, including the relationship
973
+ * type and optional reason.
974
+ *
975
+ * @param projectRoot - Absolute path to the project root
976
+ * @param taskId - Task identifier to inspect
977
+ * @returns EngineResult with relations array and count
978
+ *
979
+ * @example
980
+ * ```typescript
981
+ * const result = await taskRelates('/project', 'T42');
982
+ * ```
983
+ *
984
+ * @task T4657
985
+ * @task T4790
986
+ * @epic T4654
987
+ */
988
+ export async function taskRelates(projectRoot, taskId) {
989
+ try {
990
+ const result = await coreTaskRelates(projectRoot, taskId);
991
+ return { success: true, data: result };
992
+ }
993
+ catch (err) {
994
+ return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to read task relations');
995
+ }
996
+ }
997
+ /**
998
+ * Add a relation between two tasks.
999
+ *
1000
+ * @remarks
1001
+ * Valid relation types: related, blocks, duplicates, absorbs, fixes, extends, supersedes.
1002
+ *
1003
+ * @param projectRoot - Absolute path to the project root
1004
+ * @param taskId - Source task identifier
1005
+ * @param relatedId - Target task identifier
1006
+ * @param type - Relation type (e.g. "blocks", "related")
1007
+ * @param reason - Optional explanation for the relation
1008
+ * @returns EngineResult confirming the relation was added
1009
+ *
1010
+ * @example
1011
+ * ```typescript
1012
+ * const result = await taskRelatesAdd('/project', 'T42', 'T43', 'blocks', 'Needs auth first');
1013
+ * ```
1014
+ *
1015
+ * @task T4790
1016
+ */
1017
+ export async function taskRelatesAdd(projectRoot, taskId, relatedId, type, reason) {
1018
+ try {
1019
+ const result = await coreTaskRelatesAdd(projectRoot, taskId, relatedId, type, reason);
1020
+ return { success: true, data: result };
1021
+ }
1022
+ catch (err) {
1023
+ return cleoErrorToEngineError(err, 'E_GENERAL', 'Failed to update task relations');
1024
+ }
1025
+ }
1026
+ /**
1027
+ * Analyze a task for description quality, missing fields, and dependency health.
1028
+ *
1029
+ * @remarks
1030
+ * When no task ID is provided, analyzes all tasks to identify bottlenecks,
1031
+ * leverage opportunities, and overall project health metrics.
1032
+ *
1033
+ * @param projectRoot - Absolute path to the project root
1034
+ * @param taskId - Optional specific task to analyze
1035
+ * @param params - Optional analysis parameters
1036
+ * @returns EngineResult with recommended task, bottlenecks, tiers, and metrics
1037
+ *
1038
+ * @example
1039
+ * ```typescript
1040
+ * const result = await taskAnalyze('/project');
1041
+ * ```
1042
+ *
1043
+ * @task T4657
1044
+ * @task T4790
1045
+ * @epic T4654
1046
+ */
1047
+ export async function taskAnalyze(projectRoot, taskId, params) {
1048
+ try {
1049
+ const result = await coreTaskAnalyze(projectRoot, taskId, params);
1050
+ return { success: true, data: result };
1051
+ }
1052
+ catch (err) {
1053
+ return cleoErrorToEngineError(err, 'E_GENERAL', 'Task analysis failed');
1054
+ }
1055
+ }
1056
+ /**
1057
+ * Predict downstream impact of a free-text change description.
1058
+ *
1059
+ * Delegates to {@link predictImpact} from the intelligence module.
1060
+ * Uses keyword matching against task titles/descriptions, then traces
1061
+ * the reverse dependency graph for transitive effects.
1062
+ *
1063
+ * @remarks
1064
+ * The impact report includes directly affected tasks, transitively
1065
+ * affected tasks (through the dependency graph), and a severity assessment.
1066
+ *
1067
+ * @param projectRoot - Project root directory
1068
+ * @param change - Free-text description of the proposed change
1069
+ * @param matchLimit - Maximum seed tasks to match (default: 5)
1070
+ * @returns Impact prediction report
1071
+ *
1072
+ * @example
1073
+ * ```typescript
1074
+ * const result = await taskImpact('/project', 'Refactor authentication module');
1075
+ * ```
1076
+ *
1077
+ * @task T043
1078
+ */
1079
+ export async function taskImpact(projectRoot, change, matchLimit) {
1080
+ try {
1081
+ const result = await predictImpact(change, projectRoot, undefined, matchLimit);
1082
+ return { success: true, data: result };
1083
+ }
1084
+ catch (err) {
1085
+ return cleoErrorToEngineError(err, 'E_GENERAL', 'Impact prediction failed');
1086
+ }
1087
+ }
1088
+ /**
1089
+ * Restore a cancelled task back to pending.
1090
+ *
1091
+ * @remarks
1092
+ * When cascade is true, also restores cancelled children.
1093
+ *
1094
+ * @param projectRoot - Absolute path to the project root
1095
+ * @param taskId - Task identifier to restore
1096
+ * @param params - Optional cascade and notes options
1097
+ * @returns EngineResult with restored task IDs and count
1098
+ *
1099
+ * @example
1100
+ * ```typescript
1101
+ * const result = await taskRestore('/project', 'T42', { cascade: true });
1102
+ * ```
1103
+ *
1104
+ * @task T4790
1105
+ */
1106
+ export async function taskRestore(projectRoot, taskId, params) {
1107
+ try {
1108
+ const result = await coreTaskRestore(projectRoot, taskId, params);
1109
+ return { success: true, data: result };
1110
+ }
1111
+ catch (err) {
1112
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to restore task');
1113
+ }
1114
+ }
1115
+ /**
1116
+ * Move an archived task back to active task data with status 'done' (or specified status).
1117
+ *
1118
+ * @remarks
1119
+ * By default restores with status 'done'. Use `preserveStatus` to keep
1120
+ * the original status, or `status` to set a specific status.
1121
+ *
1122
+ * @param projectRoot - Absolute path to the project root
1123
+ * @param taskId - Archived task identifier to restore
1124
+ * @param params - Optional status override parameters
1125
+ * @returns EngineResult with the unarchived task info
1126
+ *
1127
+ * @example
1128
+ * ```typescript
1129
+ * const result = await taskUnarchive('/project', 'T42', { status: 'pending' });
1130
+ * ```
1131
+ *
1132
+ * @task T4790
1133
+ */
1134
+ export async function taskUnarchive(projectRoot, taskId, params) {
1135
+ try {
1136
+ const result = await coreTaskUnarchive(projectRoot, taskId, params);
1137
+ return { success: true, data: result };
1138
+ }
1139
+ catch (err) {
1140
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to unarchive task');
1141
+ }
1142
+ }
1143
+ /**
1144
+ * Change task position within its sibling group.
1145
+ *
1146
+ * @remarks
1147
+ * Reorders a task to the specified zero-based position among its siblings.
1148
+ *
1149
+ * @param projectRoot - Absolute path to the project root
1150
+ * @param taskId - Task identifier to reorder
1151
+ * @param position - Target zero-based position
1152
+ * @returns EngineResult with new position and total siblings
1153
+ *
1154
+ * @example
1155
+ * ```typescript
1156
+ * const result = await taskReorder('/project', 'T42', 0); // move to first
1157
+ * ```
1158
+ *
1159
+ * @task T4790
1160
+ */
1161
+ export async function taskReorder(projectRoot, taskId, position) {
1162
+ try {
1163
+ const result = await coreTaskReorder(projectRoot, taskId, position);
1164
+ return { success: true, data: result };
1165
+ }
1166
+ catch (err) {
1167
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to reorder task');
1168
+ }
1169
+ }
1170
+ /**
1171
+ * Move task under a different parent.
1172
+ *
1173
+ * @remarks
1174
+ * Pass null as `newParentId` to promote the task to a root-level task.
1175
+ * Validates hierarchy depth and circular reference constraints.
1176
+ *
1177
+ * @param projectRoot - Absolute path to the project root
1178
+ * @param taskId - Task identifier to move
1179
+ * @param newParentId - New parent task ID, or null for root
1180
+ * @returns EngineResult with old and new parent information
1181
+ *
1182
+ * @example
1183
+ * ```typescript
1184
+ * const result = await taskReparent('/project', 'T42', 'T1');
1185
+ * ```
1186
+ *
1187
+ * @task T4790
1188
+ */
1189
+ export async function taskReparent(projectRoot, taskId, newParentId) {
1190
+ try {
1191
+ const result = await coreTaskReparent(projectRoot, taskId, newParentId);
1192
+ return { success: true, data: result };
1193
+ }
1194
+ catch (err) {
1195
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to reparent task');
1196
+ }
1197
+ }
1198
+ /**
1199
+ * Promote a subtask to task or task to root (remove parent).
1200
+ *
1201
+ * @remarks
1202
+ * Removes the parent reference and may change the task type from subtask to task.
1203
+ *
1204
+ * @param projectRoot - Absolute path to the project root
1205
+ * @param taskId - Task identifier to promote
1206
+ * @returns EngineResult with promotion details
1207
+ *
1208
+ * @example
1209
+ * ```typescript
1210
+ * const result = await taskPromote('/project', 'T42');
1211
+ * ```
1212
+ *
1213
+ * @task T4790
1214
+ */
1215
+ export async function taskPromote(projectRoot, taskId) {
1216
+ try {
1217
+ const result = await coreTaskPromote(projectRoot, taskId);
1218
+ return { success: true, data: result };
1219
+ }
1220
+ catch (err) {
1221
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to promote task');
1222
+ }
1223
+ }
1224
+ /**
1225
+ * Reopen a completed task (set status back to pending).
1226
+ *
1227
+ * @remarks
1228
+ * Only works on tasks with status 'done'. Optionally sets a different
1229
+ * target status and records a reason for reopening.
1230
+ *
1231
+ * @param projectRoot - Absolute path to the project root
1232
+ * @param taskId - Task identifier to reopen
1233
+ * @param params - Optional target status and reason
1234
+ * @returns EngineResult with reopen details including previous and new status
1235
+ *
1236
+ * @example
1237
+ * ```typescript
1238
+ * const result = await taskReopen('/project', 'T42', { reason: 'Tests regressed' });
1239
+ * ```
1240
+ *
1241
+ * @task T4790
1242
+ */
1243
+ export async function taskReopen(projectRoot, taskId, params) {
1244
+ try {
1245
+ const result = await coreTaskReopen(projectRoot, taskId, params);
1246
+ return { success: true, data: result };
1247
+ }
1248
+ catch (err) {
1249
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to reopen task');
1250
+ }
1251
+ }
1252
+ /**
1253
+ * Cancel a task (soft terminal state -- reversible via restore).
1254
+ *
1255
+ * @remarks
1256
+ * Sets the task status to cancelled with an optional reason. The task can
1257
+ * be restored later via {@link taskRestore}.
1258
+ *
1259
+ * @param projectRoot - Absolute path to the project root
1260
+ * @param taskId - Task identifier to cancel
1261
+ * @param reason - Optional cancellation reason
1262
+ * @returns EngineResult with cancellation details
1263
+ *
1264
+ * @example
1265
+ * ```typescript
1266
+ * const result = await taskCancel('/project', 'T42', 'No longer needed');
1267
+ * ```
1268
+ *
1269
+ * @task T4529
1270
+ */
1271
+ export async function taskCancel(projectRoot, taskId, reason) {
1272
+ try {
1273
+ const result = await coreTaskCancel(projectRoot, taskId, { reason });
1274
+ return { success: true, data: result };
1275
+ }
1276
+ catch (err) {
1277
+ return cleoErrorToEngineError(err, 'E_NOT_FOUND', 'Failed to cancel task');
1278
+ }
1279
+ }
1280
+ /**
1281
+ * Deterministic complexity scoring from task metadata.
1282
+ *
1283
+ * @remarks
1284
+ * Produces a size estimate (small/medium/large) based on dependency depth,
1285
+ * subtask count, file count, and other structural factors.
1286
+ *
1287
+ * @param projectRoot - Absolute path to the project root
1288
+ * @param params - Parameters including the task ID to estimate
1289
+ * @returns EngineResult with size, score, factors, and structural metrics
1290
+ *
1291
+ * @example
1292
+ * ```typescript
1293
+ * const result = await taskComplexityEstimate('/project', { taskId: 'T42' });
1294
+ * ```
1295
+ *
1296
+ * @task T4657
1297
+ * @task T4790
1298
+ * @epic T4654
1299
+ */
1300
+ export async function taskComplexityEstimate(projectRoot, params) {
1301
+ try {
1302
+ const result = await coreTaskComplexityEstimate(projectRoot, params);
1303
+ return { success: true, data: result };
1304
+ }
1305
+ catch (err) {
1306
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
1307
+ }
1308
+ }
1309
+ /**
1310
+ * List dependencies for a task in a given direction.
1311
+ * @task T4657
1312
+ * @task T4790
1313
+ * @epic T4654
1314
+ */
1315
+ export async function taskDepends(projectRoot, taskId, direction = 'both', tree) {
1316
+ try {
1317
+ const result = await coreTaskDepends(projectRoot, taskId, direction, tree ? { tree } : undefined);
1318
+ return { success: true, data: result };
1319
+ }
1320
+ catch (err) {
1321
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
1322
+ }
1323
+ }
1324
+ /**
1325
+ * Overview of all dependencies across the project.
1326
+ * @task T5157
1327
+ */
1328
+ export async function taskDepsOverview(projectRoot) {
1329
+ try {
1330
+ const result = await coreTaskDepsOverview(projectRoot);
1331
+ return { success: true, data: result };
1332
+ }
1333
+ catch (err) {
1334
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to load deps overview');
1335
+ }
1336
+ }
1337
+ /**
1338
+ * Detect circular dependencies across the project.
1339
+ * @task T5157
1340
+ */
1341
+ export async function taskDepsCycles(projectRoot) {
1342
+ try {
1343
+ const result = await coreTaskDepsCycles(projectRoot);
1344
+ return { success: true, data: result };
1345
+ }
1346
+ catch (err) {
1347
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to detect cycles');
1348
+ }
1349
+ }
1350
+ /**
1351
+ * Compute task statistics, optionally scoped to an epic.
1352
+ * @task T4657
1353
+ * @task T4790
1354
+ * @epic T4654
1355
+ */
1356
+ export async function taskStats(projectRoot, epicId) {
1357
+ try {
1358
+ const result = await coreTaskStats(projectRoot, epicId);
1359
+ return { success: true, data: result };
1360
+ }
1361
+ catch {
1362
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
1363
+ }
1364
+ }
1365
+ /**
1366
+ * Export tasks as JSON or CSV.
1367
+ * @task T4657
1368
+ * @task T4790
1369
+ * @epic T4654
1370
+ */
1371
+ export async function taskExport(projectRoot, params) {
1372
+ try {
1373
+ const result = await coreTaskExport(projectRoot, params);
1374
+ return { success: true, data: result };
1375
+ }
1376
+ catch {
1377
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
1378
+ }
1379
+ }
1380
+ /**
1381
+ * Get task history from the log file.
1382
+ * @task T4657
1383
+ * @task T4790
1384
+ * @epic T4654
1385
+ */
1386
+ export async function taskHistory(projectRoot, taskId, limit) {
1387
+ try {
1388
+ const result = await coreTaskHistory(projectRoot, taskId, limit);
1389
+ return { success: true, data: result };
1390
+ }
1391
+ catch {
1392
+ return engineError('E_NOT_INITIALIZED', 'Failed to read task history');
1393
+ }
1394
+ }
1395
+ /**
1396
+ * Lint tasks for common issues.
1397
+ * @task T4657
1398
+ * @task T4790
1399
+ * @epic T4654
1400
+ */
1401
+ export async function taskLint(projectRoot, taskId) {
1402
+ try {
1403
+ const result = await coreTaskLint(projectRoot, taskId);
1404
+ return { success: true, data: result };
1405
+ }
1406
+ catch (err) {
1407
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Task database not initialized');
1408
+ }
1409
+ }
1410
+ /**
1411
+ * Validate multiple tasks at once.
1412
+ * @task T4657
1413
+ * @task T4790
1414
+ * @epic T4654
1415
+ */
1416
+ export async function taskBatchValidate(projectRoot, taskIds, checkMode = 'full') {
1417
+ try {
1418
+ const result = await coreTaskBatchValidate(projectRoot, taskIds, checkMode);
1419
+ return { success: true, data: result };
1420
+ }
1421
+ catch {
1422
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
1423
+ }
1424
+ }
1425
+ /**
1426
+ * Import tasks from a JSON source string or export package.
1427
+ * @task T4790
1428
+ */
1429
+ export async function taskImport(projectRoot, source, overwrite) {
1430
+ try {
1431
+ const result = await coreTaskImport(projectRoot, source, overwrite);
1432
+ return { success: true, data: result };
1433
+ }
1434
+ catch (err) {
1435
+ return cleoErrorToEngineError(err, 'E_NOT_INITIALIZED', 'Failed to import tasks');
1436
+ }
1437
+ }
1438
+ /**
1439
+ * Compute a ranked plan: in-progress epics, ready tasks, blockers, bugs.
1440
+ * @task T4815
1441
+ */
1442
+ export async function taskPlan(projectRoot) {
1443
+ const { coreTaskPlan } = await import('@cleocode/core/internal');
1444
+ try {
1445
+ const result = await coreTaskPlan(projectRoot);
1446
+ return { success: true, data: result };
1447
+ }
1448
+ catch {
1449
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
1450
+ }
1451
+ }
1452
+ /**
1453
+ * Find related tasks using semantic search or keyword matching.
1454
+ * @task T5672
1455
+ */
1456
+ export async function taskRelatesFind(projectRoot, taskId, params) {
1457
+ try {
1458
+ const { suggestRelated, discoverRelated } = await import('@cleocode/core/internal');
1459
+ const accessor = await getAccessor(projectRoot);
1460
+ const mode = params?.mode ?? 'suggest';
1461
+ let result;
1462
+ if (mode === 'discover') {
1463
+ result = await discoverRelated(taskId, undefined, accessor);
1464
+ }
1465
+ else {
1466
+ const threshold = params?.threshold ?? 50;
1467
+ result = await suggestRelated(taskId, { threshold }, accessor);
1468
+ }
1469
+ return { success: true, data: result };
1470
+ }
1471
+ catch (err) {
1472
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Task plan failed');
1473
+ }
1474
+ }
1475
+ /**
1476
+ * List all labels used in tasks.
1477
+ * @task T5672
1478
+ */
1479
+ export async function taskLabelList(projectRoot) {
1480
+ try {
1481
+ const { listLabels } = await import('@cleocode/core/internal');
1482
+ const accessor = await getAccessor(projectRoot);
1483
+ const labels = await listLabels(projectRoot, accessor);
1484
+ return { success: true, data: { labels, count: labels.length } };
1485
+ }
1486
+ catch {
1487
+ return engineError('E_NOT_INITIALIZED', 'Task database not initialized');
1488
+ }
1489
+ }
1490
+ /**
1491
+ * Show tasks associated with a label.
1492
+ * @task T5672
1493
+ */
1494
+ export async function taskLabelShow(projectRoot, label) {
1495
+ try {
1496
+ const { showLabelTasks } = await import('@cleocode/core/internal');
1497
+ const accessor = await getAccessor(projectRoot);
1498
+ const result = await showLabelTasks(label, projectRoot, accessor);
1499
+ return { success: true, data: result };
1500
+ }
1501
+ catch (err) {
1502
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to list labels');
1503
+ }
1504
+ }
1505
+ // ---------------------------------------------------------------------------
1506
+ // Sync sub-domain (provider-agnostic task reconciliation)
1507
+ // ---------------------------------------------------------------------------
1508
+ /**
1509
+ * Reconcile external tasks with CLEO as SSoT.
1510
+ */
1511
+ export async function taskSyncReconcile(projectRoot, params) {
1512
+ try {
1513
+ const { reconcile } = await import('@cleocode/core/internal');
1514
+ const accessor = await getAccessor(projectRoot);
1515
+ const result = await reconcile(params.externalTasks, {
1516
+ providerId: params.providerId,
1517
+ cwd: projectRoot,
1518
+ dryRun: params.dryRun,
1519
+ conflictPolicy: params.conflictPolicy,
1520
+ defaultPhase: params.defaultPhase,
1521
+ defaultLabels: params.defaultLabels,
1522
+ }, accessor);
1523
+ return { success: true, data: result };
1524
+ }
1525
+ catch (err) {
1526
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Sync reconcile failed');
1527
+ }
1528
+ }
1529
+ /**
1530
+ * List external task links by provider or task ID.
1531
+ */
1532
+ export async function taskSyncLinks(projectRoot, params) {
1533
+ try {
1534
+ const { getLinksByProvider, getLinksByTaskId } = await import('@cleocode/core/internal');
1535
+ if (params?.taskId) {
1536
+ const links = await getLinksByTaskId(params.taskId, projectRoot);
1537
+ return { success: true, data: { links, count: links.length } };
1538
+ }
1539
+ if (params?.providerId) {
1540
+ const links = await getLinksByProvider(params.providerId, projectRoot);
1541
+ return { success: true, data: { links, count: links.length } };
1542
+ }
1543
+ return engineError('E_INVALID_INPUT', 'Either providerId or taskId is required');
1544
+ }
1545
+ catch (err) {
1546
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to list links');
1547
+ }
1548
+ }
1549
+ /**
1550
+ * Remove all external task links for a provider.
1551
+ */
1552
+ export async function taskSyncLinksRemove(projectRoot, providerId) {
1553
+ try {
1554
+ const { removeLinksByProvider } = await import('@cleocode/core/internal');
1555
+ const removed = await removeLinksByProvider(providerId, projectRoot);
1556
+ return { success: true, data: { providerId, removed } };
1557
+ }
1558
+ catch (err) {
1559
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to remove links');
1560
+ }
1561
+ }
1562
+ /**
1563
+ * Atomically claim a task for an agent.
1564
+ *
1565
+ * Fails if the task is already claimed by a different agent.
1566
+ * No-op if the task is already claimed by the same agent (idempotent).
1567
+ */
1568
+ export async function taskClaim(projectRoot, taskId, agentId) {
1569
+ try {
1570
+ if (!taskId)
1571
+ return engineError('E_INVALID_INPUT', 'taskId is required');
1572
+ if (!agentId)
1573
+ return engineError('E_INVALID_INPUT', 'agentId is required');
1574
+ const acc = await getAccessor(projectRoot);
1575
+ await acc.claimTask(taskId, agentId);
1576
+ return { success: true, data: { taskId, agentId } };
1577
+ }
1578
+ catch (err) {
1579
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to claim task');
1580
+ }
1581
+ }
1582
+ /**
1583
+ * Release an agent's claim on a task, setting assignee to null.
1584
+ *
1585
+ * No-op if the task is not currently claimed.
1586
+ */
1587
+ export async function taskUnclaim(projectRoot, taskId) {
1588
+ try {
1589
+ if (!taskId)
1590
+ return engineError('E_INVALID_INPUT', 'taskId is required');
1591
+ const acc = await getAccessor(projectRoot);
1592
+ await acc.unclaimTask(taskId);
1593
+ return { success: true, data: { taskId } };
1594
+ }
1595
+ catch (err) {
1596
+ return cleoErrorToEngineError(err, 'E_INTERNAL', 'Failed to unclaim task');
1597
+ }
1598
+ }
1599
+ //# sourceMappingURL=task-engine.js.map