light-plan 0.0.0-stage → 0.1.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 (963) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3181 -2
  3. package/assets/README.md +111 -0
  4. package/assets/agents/lpm-developer.md +468 -0
  5. package/assets/agents/lpm-planner.md +532 -0
  6. package/assets/harnesses/claude.yml +43 -0
  7. package/assets/harnesses/copilot.yml +54 -0
  8. package/assets/harnesses/reasonix.yml +49 -0
  9. package/assets/hcm/light-plan.yml +45 -0
  10. package/assets/skills/lpm-board-health.md +243 -0
  11. package/assets/skills/lpm-board-setup.md +354 -0
  12. package/assets/skills/lpm-delivery.md +344 -0
  13. package/assets/skills/lpm-planning.md +411 -0
  14. package/assets/skills/lpm-templates.md +144 -0
  15. package/assets/skills/lpm.md +267 -0
  16. package/dist/cli/agent-view.d.ts +27 -0
  17. package/dist/cli/agent-view.js +247 -0
  18. package/dist/cli/agent-view.js.map +1 -0
  19. package/dist/cli/commands/agent/assets.d.ts +64 -0
  20. package/dist/cli/commands/agent/assets.js +106 -0
  21. package/dist/cli/commands/agent/assets.js.map +1 -0
  22. package/dist/cli/commands/agent/glob.d.ts +25 -0
  23. package/dist/cli/commands/agent/glob.js +82 -0
  24. package/dist/cli/commands/agent/glob.js.map +1 -0
  25. package/dist/cli/commands/agent/index.d.ts +11 -0
  26. package/dist/cli/commands/agent/index.js +284 -0
  27. package/dist/cli/commands/agent/index.js.map +1 -0
  28. package/dist/cli/commands/agent/install.d.ts +59 -0
  29. package/dist/cli/commands/agent/install.js +131 -0
  30. package/dist/cli/commands/agent/install.js.map +1 -0
  31. package/dist/cli/commands/agent/mapping.d.ts +175 -0
  32. package/dist/cli/commands/agent/mapping.js +256 -0
  33. package/dist/cli/commands/agent/mapping.js.map +1 -0
  34. package/dist/cli/commands/check.d.ts +2 -0
  35. package/dist/cli/commands/check.js +81 -0
  36. package/dist/cli/commands/check.js.map +1 -0
  37. package/dist/cli/commands/comment.d.ts +2 -0
  38. package/dist/cli/commands/comment.js +104 -0
  39. package/dist/cli/commands/comment.js.map +1 -0
  40. package/dist/cli/commands/convert.d.ts +2 -0
  41. package/dist/cli/commands/convert.js +115 -0
  42. package/dist/cli/commands/convert.js.map +1 -0
  43. package/dist/cli/commands/copy.d.ts +2 -0
  44. package/dist/cli/commands/copy.js +69 -0
  45. package/dist/cli/commands/copy.js.map +1 -0
  46. package/dist/cli/commands/export.d.ts +11 -0
  47. package/dist/cli/commands/export.js +226 -0
  48. package/dist/cli/commands/export.js.map +1 -0
  49. package/dist/cli/commands/flag.d.ts +2 -0
  50. package/dist/cli/commands/flag.js +172 -0
  51. package/dist/cli/commands/flag.js.map +1 -0
  52. package/dist/cli/commands/git.d.ts +11 -0
  53. package/dist/cli/commands/git.js +357 -0
  54. package/dist/cli/commands/git.js.map +1 -0
  55. package/dist/cli/commands/hcm/bundle.d.ts +60 -0
  56. package/dist/cli/commands/hcm/bundle.js +166 -0
  57. package/dist/cli/commands/hcm/bundle.js.map +1 -0
  58. package/dist/cli/commands/hcm/index.d.ts +11 -0
  59. package/dist/cli/commands/hcm/index.js +162 -0
  60. package/dist/cli/commands/hcm/index.js.map +1 -0
  61. package/dist/cli/commands/init.d.ts +2 -0
  62. package/dist/cli/commands/init.js +81 -0
  63. package/dist/cli/commands/init.js.map +1 -0
  64. package/dist/cli/commands/insert.d.ts +2 -0
  65. package/dist/cli/commands/insert.js +70 -0
  66. package/dist/cli/commands/insert.js.map +1 -0
  67. package/dist/cli/commands/instructions.d.ts +7 -0
  68. package/dist/cli/commands/instructions.js +256 -0
  69. package/dist/cli/commands/instructions.js.map +1 -0
  70. package/dist/cli/commands/link.d.ts +2 -0
  71. package/dist/cli/commands/link.js +121 -0
  72. package/dist/cli/commands/link.js.map +1 -0
  73. package/dist/cli/commands/mcp/config.d.ts +71 -0
  74. package/dist/cli/commands/mcp/config.js +119 -0
  75. package/dist/cli/commands/mcp/config.js.map +1 -0
  76. package/dist/cli/commands/mcp/index.d.ts +9 -0
  77. package/dist/cli/commands/mcp/index.js +92 -0
  78. package/dist/cli/commands/mcp/index.js.map +1 -0
  79. package/dist/cli/commands/mcp/serve.d.ts +1 -0
  80. package/dist/cli/commands/mcp/serve.js +76 -0
  81. package/dist/cli/commands/mcp/serve.js.map +1 -0
  82. package/dist/cli/commands/mcp/setup.d.ts +1 -0
  83. package/dist/cli/commands/mcp/setup.js +83 -0
  84. package/dist/cli/commands/mcp/setup.js.map +1 -0
  85. package/dist/cli/commands/me.d.ts +2 -0
  86. package/dist/cli/commands/me.js +85 -0
  87. package/dist/cli/commands/me.js.map +1 -0
  88. package/dist/cli/commands/move.d.ts +2 -0
  89. package/dist/cli/commands/move.js +81 -0
  90. package/dist/cli/commands/move.js.map +1 -0
  91. package/dist/cli/commands/new.d.ts +2 -0
  92. package/dist/cli/commands/new.js +222 -0
  93. package/dist/cli/commands/new.js.map +1 -0
  94. package/dist/cli/commands/open.d.ts +2 -0
  95. package/dist/cli/commands/open.js +43 -0
  96. package/dist/cli/commands/open.js.map +1 -0
  97. package/dist/cli/commands/period.d.ts +10 -0
  98. package/dist/cli/commands/period.js +165 -0
  99. package/dist/cli/commands/period.js.map +1 -0
  100. package/dist/cli/commands/profile.d.ts +2 -0
  101. package/dist/cli/commands/profile.js +133 -0
  102. package/dist/cli/commands/profile.js.map +1 -0
  103. package/dist/cli/commands/queue.d.ts +2 -0
  104. package/dist/cli/commands/queue.js +582 -0
  105. package/dist/cli/commands/queue.js.map +1 -0
  106. package/dist/cli/commands/remote.d.ts +10 -0
  107. package/dist/cli/commands/remote.js +3142 -0
  108. package/dist/cli/commands/remote.js.map +1 -0
  109. package/dist/cli/commands/rm.d.ts +2 -0
  110. package/dist/cli/commands/rm.js +63 -0
  111. package/dist/cli/commands/rm.js.map +1 -0
  112. package/dist/cli/commands/set.d.ts +2 -0
  113. package/dist/cli/commands/set.js +139 -0
  114. package/dist/cli/commands/set.js.map +1 -0
  115. package/dist/cli/commands/split.d.ts +2 -0
  116. package/dist/cli/commands/split.js +90 -0
  117. package/dist/cli/commands/split.js.map +1 -0
  118. package/dist/cli/commands/task.d.ts +2 -0
  119. package/dist/cli/commands/task.js +298 -0
  120. package/dist/cli/commands/task.js.map +1 -0
  121. package/dist/cli/commands/team.d.ts +2 -0
  122. package/dist/cli/commands/team.js +114 -0
  123. package/dist/cli/commands/team.js.map +1 -0
  124. package/dist/cli/commands/template.d.ts +2 -0
  125. package/dist/cli/commands/template.js +338 -0
  126. package/dist/cli/commands/template.js.map +1 -0
  127. package/dist/cli/commands/ui.d.ts +2 -0
  128. package/dist/cli/commands/ui.js +98 -0
  129. package/dist/cli/commands/ui.js.map +1 -0
  130. package/dist/cli/commands/upstream.d.ts +2 -0
  131. package/dist/cli/commands/upstream.js +218 -0
  132. package/dist/cli/commands/upstream.js.map +1 -0
  133. package/dist/cli/context.d.ts +24 -0
  134. package/dist/cli/context.js +52 -0
  135. package/dist/cli/context.js.map +1 -0
  136. package/dist/cli/index.d.ts +2 -0
  137. package/dist/cli/index.js +208 -0
  138. package/dist/cli/index.js.map +1 -0
  139. package/dist/cli/live.d.ts +71 -0
  140. package/dist/cli/live.js +182 -0
  141. package/dist/cli/live.js.map +1 -0
  142. package/dist/cli/plan.d.ts +28 -0
  143. package/dist/cli/plan.js +76 -0
  144. package/dist/cli/plan.js.map +1 -0
  145. package/dist/cli/prompt.d.ts +60 -0
  146. package/dist/cli/prompt.js +185 -0
  147. package/dist/cli/prompt.js.map +1 -0
  148. package/dist/cli/ui.d.ts +65 -0
  149. package/dist/cli/ui.js +79 -0
  150. package/dist/cli/ui.js.map +1 -0
  151. package/dist/core/board/dependency-rollup.d.ts +54 -0
  152. package/dist/core/board/dependency-rollup.js +72 -0
  153. package/dist/core/board/dependency-rollup.js.map +1 -0
  154. package/dist/core/board/flag-rollup.d.ts +33 -0
  155. package/dist/core/board/flag-rollup.js +56 -0
  156. package/dist/core/board/flag-rollup.js.map +1 -0
  157. package/dist/core/board/index.d.ts +21 -0
  158. package/dist/core/board/index.js +22 -0
  159. package/dist/core/board/index.js.map +1 -0
  160. package/dist/core/board/load/cache.d.ts +52 -0
  161. package/dist/core/board/load/cache.js +105 -0
  162. package/dist/core/board/load/cache.js.map +1 -0
  163. package/dist/core/board/load/fields.d.ts +33 -0
  164. package/dist/core/board/load/fields.js +154 -0
  165. package/dist/core/board/load/fields.js.map +1 -0
  166. package/dist/core/board/load/scan.d.ts +39 -0
  167. package/dist/core/board/load/scan.js +88 -0
  168. package/dist/core/board/load/scan.js.map +1 -0
  169. package/dist/core/board/load/tree.d.ts +10 -0
  170. package/dist/core/board/load/tree.js +114 -0
  171. package/dist/core/board/load/tree.js.map +1 -0
  172. package/dist/core/board/load.d.ts +69 -0
  173. package/dist/core/board/load.js +204 -0
  174. package/dist/core/board/load.js.map +1 -0
  175. package/dist/core/board/query.d.ts +126 -0
  176. package/dist/core/board/query.js +291 -0
  177. package/dist/core/board/query.js.map +1 -0
  178. package/dist/core/board/registry.d.ts +51 -0
  179. package/dist/core/board/registry.js +98 -0
  180. package/dist/core/board/registry.js.map +1 -0
  181. package/dist/core/board/remote-scopes.d.ts +71 -0
  182. package/dist/core/board/remote-scopes.js +103 -0
  183. package/dist/core/board/remote-scopes.js.map +1 -0
  184. package/dist/core/board/rollup.d.ts +32 -0
  185. package/dist/core/board/rollup.js +67 -0
  186. package/dist/core/board/rollup.js.map +1 -0
  187. package/dist/core/board/scope.d.ts +81 -0
  188. package/dist/core/board/scope.js +134 -0
  189. package/dist/core/board/scope.js.map +1 -0
  190. package/dist/core/board/simulate.d.ts +138 -0
  191. package/dist/core/board/simulate.js +141 -0
  192. package/dist/core/board/simulate.js.map +1 -0
  193. package/dist/core/board/tasks/index.d.ts +25 -0
  194. package/dist/core/board/tasks/index.js +26 -0
  195. package/dist/core/board/tasks/index.js.map +1 -0
  196. package/dist/core/board/tasks/ranking.d.ts +155 -0
  197. package/dist/core/board/tasks/ranking.js +374 -0
  198. package/dist/core/board/tasks/ranking.js.map +1 -0
  199. package/dist/core/board/tasks/roster.d.ts +42 -0
  200. package/dist/core/board/tasks/roster.js +82 -0
  201. package/dist/core/board/tasks/roster.js.map +1 -0
  202. package/dist/core/board/tasks.d.ts +1 -0
  203. package/dist/core/board/tasks.js +2 -0
  204. package/dist/core/board/tasks.js.map +1 -0
  205. package/dist/core/config/index.d.ts +9 -0
  206. package/dist/core/config/index.js +10 -0
  207. package/dist/core/config/index.js.map +1 -0
  208. package/dist/core/config/lookup.d.ts +114 -0
  209. package/dist/core/config/lookup.js +221 -0
  210. package/dist/core/config/lookup.js.map +1 -0
  211. package/dist/core/config/remote-blocks.d.ts +17 -0
  212. package/dist/core/config/remote-blocks.js +47 -0
  213. package/dist/core/config/remote-blocks.js.map +1 -0
  214. package/dist/core/config/schema.d.ts +10 -0
  215. package/dist/core/config/schema.js +451 -0
  216. package/dist/core/config/schema.js.map +1 -0
  217. package/dist/core/errors.d.ts +23 -0
  218. package/dist/core/errors.js +31 -0
  219. package/dist/core/errors.js.map +1 -0
  220. package/dist/core/gitsync/hosts.d.ts +40 -0
  221. package/dist/core/gitsync/hosts.js +115 -0
  222. package/dist/core/gitsync/hosts.js.map +1 -0
  223. package/dist/core/gitsync/index.d.ts +25 -0
  224. package/dist/core/gitsync/index.js +25 -0
  225. package/dist/core/gitsync/index.js.map +1 -0
  226. package/dist/core/gitsync/integrate.d.ts +72 -0
  227. package/dist/core/gitsync/integrate.js +115 -0
  228. package/dist/core/gitsync/integrate.js.map +1 -0
  229. package/dist/core/gitsync/repo.d.ts +61 -0
  230. package/dist/core/gitsync/repo.js +213 -0
  231. package/dist/core/gitsync/repo.js.map +1 -0
  232. package/dist/core/gitsync/run.d.ts +58 -0
  233. package/dist/core/gitsync/run.js +102 -0
  234. package/dist/core/gitsync/run.js.map +1 -0
  235. package/dist/core/gitsync/status.d.ts +59 -0
  236. package/dist/core/gitsync/status.js +81 -0
  237. package/dist/core/gitsync/status.js.map +1 -0
  238. package/dist/core/gitsync/sync.d.ts +111 -0
  239. package/dist/core/gitsync/sync.js +275 -0
  240. package/dist/core/gitsync/sync.js.map +1 -0
  241. package/dist/core/index.d.ts +31 -0
  242. package/dist/core/index.js +32 -0
  243. package/dist/core/index.js.map +1 -0
  244. package/dist/core/instructions/analyze.d.ts +70 -0
  245. package/dist/core/instructions/analyze.js +275 -0
  246. package/dist/core/instructions/analyze.js.map +1 -0
  247. package/dist/core/instructions/builtin.d.ts +21 -0
  248. package/dist/core/instructions/builtin.js +133 -0
  249. package/dist/core/instructions/builtin.js.map +1 -0
  250. package/dist/core/instructions/context.d.ts +155 -0
  251. package/dist/core/instructions/context.js +209 -0
  252. package/dist/core/instructions/context.js.map +1 -0
  253. package/dist/core/instructions/index.d.ts +29 -0
  254. package/dist/core/instructions/index.js +30 -0
  255. package/dist/core/instructions/index.js.map +1 -0
  256. package/dist/core/instructions/instructions.d.ts +90 -0
  257. package/dist/core/instructions/instructions.js +179 -0
  258. package/dist/core/instructions/instructions.js.map +1 -0
  259. package/dist/core/instructions/template.d.ts +108 -0
  260. package/dist/core/instructions/template.js +252 -0
  261. package/dist/core/instructions/template.js.map +1 -0
  262. package/dist/core/model/attributes.d.ts +16 -0
  263. package/dist/core/model/attributes.js +119 -0
  264. package/dist/core/model/attributes.js.map +1 -0
  265. package/dist/core/model/index.d.ts +10 -0
  266. package/dist/core/model/index.js +11 -0
  267. package/dist/core/model/index.js.map +1 -0
  268. package/dist/core/model/links.d.ts +34 -0
  269. package/dist/core/model/links.js +114 -0
  270. package/dist/core/model/links.js.map +1 -0
  271. package/dist/core/model/profile.d.ts +31 -0
  272. package/dist/core/model/profile.js +8 -0
  273. package/dist/core/model/profile.js.map +1 -0
  274. package/dist/core/model/types.d.ts +441 -0
  275. package/dist/core/model/types.js +167 -0
  276. package/dist/core/model/types.js.map +1 -0
  277. package/dist/core/model/zod.d.ts +6 -0
  278. package/dist/core/model/zod.js +11 -0
  279. package/dist/core/model/zod.js.map +1 -0
  280. package/dist/core/operations/board-index.d.ts +45 -0
  281. package/dist/core/operations/board-index.js +147 -0
  282. package/dist/core/operations/board-index.js.map +1 -0
  283. package/dist/core/operations/claim.d.ts +69 -0
  284. package/dist/core/operations/claim.js +115 -0
  285. package/dist/core/operations/claim.js.map +1 -0
  286. package/dist/core/operations/comment.d.ts +30 -0
  287. package/dist/core/operations/comment.js +46 -0
  288. package/dist/core/operations/comment.js.map +1 -0
  289. package/dist/core/operations/create.d.ts +82 -0
  290. package/dist/core/operations/create.js +306 -0
  291. package/dist/core/operations/create.js.map +1 -0
  292. package/dist/core/operations/flag.d.ts +58 -0
  293. package/dist/core/operations/flag.js +95 -0
  294. package/dist/core/operations/flag.js.map +1 -0
  295. package/dist/core/operations/git-sync.d.ts +148 -0
  296. package/dist/core/operations/git-sync.js +341 -0
  297. package/dist/core/operations/git-sync.js.map +1 -0
  298. package/dist/core/operations/index.d.ts +44 -0
  299. package/dist/core/operations/index.js +45 -0
  300. package/dist/core/operations/index.js.map +1 -0
  301. package/dist/core/operations/init.d.ts +25 -0
  302. package/dist/core/operations/init.js +122 -0
  303. package/dist/core/operations/init.js.map +1 -0
  304. package/dist/core/operations/link.d.ts +40 -0
  305. package/dist/core/operations/link.js +131 -0
  306. package/dist/core/operations/link.js.map +1 -0
  307. package/dist/core/operations/move.d.ts +43 -0
  308. package/dist/core/operations/move.js +103 -0
  309. package/dist/core/operations/move.js.map +1 -0
  310. package/dist/core/operations/profile.d.ts +23 -0
  311. package/dist/core/operations/profile.js +26 -0
  312. package/dist/core/operations/profile.js.map +1 -0
  313. package/dist/core/operations/remotes-off.d.ts +12 -0
  314. package/dist/core/operations/remotes-off.js +67 -0
  315. package/dist/core/operations/remotes-off.js.map +1 -0
  316. package/dist/core/operations/remove.d.ts +18 -0
  317. package/dist/core/operations/remove.js +114 -0
  318. package/dist/core/operations/remove.js.map +1 -0
  319. package/dist/core/operations/retype.d.ts +25 -0
  320. package/dist/core/operations/retype.js +59 -0
  321. package/dist/core/operations/retype.js.map +1 -0
  322. package/dist/core/operations/rollup.d.ts +74 -0
  323. package/dist/core/operations/rollup.js +121 -0
  324. package/dist/core/operations/rollup.js.map +1 -0
  325. package/dist/core/operations/shared.d.ts +133 -0
  326. package/dist/core/operations/shared.js +383 -0
  327. package/dist/core/operations/shared.js.map +1 -0
  328. package/dist/core/operations/update.d.ts +43 -0
  329. package/dist/core/operations/update.js +161 -0
  330. package/dist/core/operations/update.js.map +1 -0
  331. package/dist/core/operations/user.d.ts +27 -0
  332. package/dist/core/operations/user.js +68 -0
  333. package/dist/core/operations/user.js.map +1 -0
  334. package/dist/core/profile/current.d.ts +35 -0
  335. package/dist/core/profile/current.js +31 -0
  336. package/dist/core/profile/current.js.map +1 -0
  337. package/dist/core/profile/index.d.ts +14 -0
  338. package/dist/core/profile/index.js +15 -0
  339. package/dist/core/profile/index.js.map +1 -0
  340. package/dist/core/profile/schema.d.ts +9 -0
  341. package/dist/core/profile/schema.js +100 -0
  342. package/dist/core/profile/schema.js.map +1 -0
  343. package/dist/core/storage/activity.d.ts +78 -0
  344. package/dist/core/storage/activity.js +131 -0
  345. package/dist/core/storage/activity.js.map +1 -0
  346. package/dist/core/storage/atomic.d.ts +34 -0
  347. package/dist/core/storage/atomic.js +117 -0
  348. package/dist/core/storage/atomic.js.map +1 -0
  349. package/dist/core/storage/comments.d.ts +39 -0
  350. package/dist/core/storage/comments.js +88 -0
  351. package/dist/core/storage/comments.js.map +1 -0
  352. package/dist/core/storage/document.d.ts +16 -0
  353. package/dist/core/storage/document.js +98 -0
  354. package/dist/core/storage/document.js.map +1 -0
  355. package/dist/core/storage/frontmatter.d.ts +16 -0
  356. package/dist/core/storage/frontmatter.js +33 -0
  357. package/dist/core/storage/frontmatter.js.map +1 -0
  358. package/dist/core/storage/git.d.ts +8 -0
  359. package/dist/core/storage/git.js +48 -0
  360. package/dist/core/storage/git.js.map +1 -0
  361. package/dist/core/storage/index.d.ts +27 -0
  362. package/dist/core/storage/index.js +28 -0
  363. package/dist/core/storage/index.js.map +1 -0
  364. package/dist/core/storage/local.d.ts +57 -0
  365. package/dist/core/storage/local.js +133 -0
  366. package/dist/core/storage/local.js.map +1 -0
  367. package/dist/core/storage/lock.d.ts +85 -0
  368. package/dist/core/storage/lock.js +364 -0
  369. package/dist/core/storage/lock.js.map +1 -0
  370. package/dist/core/storage/paths.d.ts +125 -0
  371. package/dist/core/storage/paths.js +202 -0
  372. package/dist/core/storage/paths.js.map +1 -0
  373. package/dist/core/storage/state.d.ts +32 -0
  374. package/dist/core/storage/state.js +71 -0
  375. package/dist/core/storage/state.js.map +1 -0
  376. package/dist/core/storage/templates.d.ts +29 -0
  377. package/dist/core/storage/templates.js +62 -0
  378. package/dist/core/storage/templates.js.map +1 -0
  379. package/dist/core/storage/views.d.ts +18 -0
  380. package/dist/core/storage/views.js +62 -0
  381. package/dist/core/storage/views.js.map +1 -0
  382. package/dist/core/validation/check.d.ts +4 -0
  383. package/dist/core/validation/check.js +22 -0
  384. package/dist/core/validation/check.js.map +1 -0
  385. package/dist/core/validation/checks/collection.d.ts +4 -0
  386. package/dist/core/validation/checks/collection.js +152 -0
  387. package/dist/core/validation/checks/collection.js.map +1 -0
  388. package/dist/core/validation/checks/counters.d.ts +3 -0
  389. package/dist/core/validation/checks/counters.js +23 -0
  390. package/dist/core/validation/checks/counters.js.map +1 -0
  391. package/dist/core/validation/checks/dependencies.d.ts +3 -0
  392. package/dist/core/validation/checks/dependencies.js +58 -0
  393. package/dist/core/validation/checks/dependencies.js.map +1 -0
  394. package/dist/core/validation/checks/gitignore.d.ts +10 -0
  395. package/dist/core/validation/checks/gitignore.js +22 -0
  396. package/dist/core/validation/checks/gitignore.js.map +1 -0
  397. package/dist/core/validation/checks/index-file.d.ts +8 -0
  398. package/dist/core/validation/checks/index-file.js +26 -0
  399. package/dist/core/validation/checks/index-file.js.map +1 -0
  400. package/dist/core/validation/checks/index.d.ts +20 -0
  401. package/dist/core/validation/checks/index.js +21 -0
  402. package/dist/core/validation/checks/index.js.map +1 -0
  403. package/dist/core/validation/checks/issues.d.ts +3 -0
  404. package/dist/core/validation/checks/issues.js +152 -0
  405. package/dist/core/validation/checks/issues.js.map +1 -0
  406. package/dist/core/validation/checks/periods.d.ts +3 -0
  407. package/dist/core/validation/checks/periods.js +89 -0
  408. package/dist/core/validation/checks/periods.js.map +1 -0
  409. package/dist/core/validation/checks/remotes.d.ts +20 -0
  410. package/dist/core/validation/checks/remotes.js +42 -0
  411. package/dist/core/validation/checks/remotes.js.map +1 -0
  412. package/dist/core/validation/checks/resources.d.ts +3 -0
  413. package/dist/core/validation/checks/resources.js +77 -0
  414. package/dist/core/validation/checks/resources.js.map +1 -0
  415. package/dist/core/validation/checks/rollup.d.ts +27 -0
  416. package/dist/core/validation/checks/rollup.js +53 -0
  417. package/dist/core/validation/checks/rollup.js.map +1 -0
  418. package/dist/core/validation/checks/squads.d.ts +3 -0
  419. package/dist/core/validation/checks/squads.js +42 -0
  420. package/dist/core/validation/checks/squads.js.map +1 -0
  421. package/dist/core/validation/checks/templates.d.ts +14 -0
  422. package/dist/core/validation/checks/templates.js +119 -0
  423. package/dist/core/validation/checks/templates.js.map +1 -0
  424. package/dist/core/validation/fix.d.ts +7 -0
  425. package/dist/core/validation/fix.js +273 -0
  426. package/dist/core/validation/fix.js.map +1 -0
  427. package/dist/core/validation/index.d.ts +7 -0
  428. package/dist/core/validation/index.js +8 -0
  429. package/dist/core/validation/index.js.map +1 -0
  430. package/dist/core/validation/shared.d.ts +47 -0
  431. package/dist/core/validation/shared.js +66 -0
  432. package/dist/core/validation/shared.js.map +1 -0
  433. package/dist/mcp/context.d.ts +70 -0
  434. package/dist/mcp/context.js +110 -0
  435. package/dist/mcp/context.js.map +1 -0
  436. package/dist/mcp/index.d.ts +49 -0
  437. package/dist/mcp/index.js +90 -0
  438. package/dist/mcp/index.js.map +1 -0
  439. package/dist/mcp/reply.d.ts +28 -0
  440. package/dist/mcp/reply.js +34 -0
  441. package/dist/mcp/reply.js.map +1 -0
  442. package/dist/mcp/tools/plan/create.d.ts +3 -0
  443. package/dist/mcp/tools/plan/create.js +128 -0
  444. package/dist/mcp/tools/plan/create.js.map +1 -0
  445. package/dist/mcp/tools/plan/delete.d.ts +3 -0
  446. package/dist/mcp/tools/plan/delete.js +35 -0
  447. package/dist/mcp/tools/plan/delete.js.map +1 -0
  448. package/dist/mcp/tools/plan/graph.d.ts +3 -0
  449. package/dist/mcp/tools/plan/graph.js +53 -0
  450. package/dist/mcp/tools/plan/graph.js.map +1 -0
  451. package/dist/mcp/tools/plan/index.d.ts +15 -0
  452. package/dist/mcp/tools/plan/index.js +16 -0
  453. package/dist/mcp/tools/plan/index.js.map +1 -0
  454. package/dist/mcp/tools/plan/link.d.ts +3 -0
  455. package/dist/mcp/tools/plan/link.js +46 -0
  456. package/dist/mcp/tools/plan/link.js.map +1 -0
  457. package/dist/mcp/tools/plan/registrar.d.ts +10 -0
  458. package/dist/mcp/tools/plan/registrar.js +24 -0
  459. package/dist/mcp/tools/plan/registrar.js.map +1 -0
  460. package/dist/mcp/tools/plan/reshape.d.ts +3 -0
  461. package/dist/mcp/tools/plan/reshape.js +95 -0
  462. package/dist/mcp/tools/plan/reshape.js.map +1 -0
  463. package/dist/mcp/tools/plan/timeline.d.ts +3 -0
  464. package/dist/mcp/tools/plan/timeline.js +68 -0
  465. package/dist/mcp/tools/plan/timeline.js.map +1 -0
  466. package/dist/mcp/tools/plan/upstream.d.ts +14 -0
  467. package/dist/mcp/tools/plan/upstream.js +69 -0
  468. package/dist/mcp/tools/plan/upstream.js.map +1 -0
  469. package/dist/mcp/tools/plan.d.ts +1 -0
  470. package/dist/mcp/tools/plan.js +2 -0
  471. package/dist/mcp/tools/plan.js.map +1 -0
  472. package/dist/mcp/tools/read.d.ts +3 -0
  473. package/dist/mcp/tools/read.js +339 -0
  474. package/dist/mcp/tools/read.js.map +1 -0
  475. package/dist/mcp/tools/remote.d.ts +3 -0
  476. package/dist/mcp/tools/remote.js +254 -0
  477. package/dist/mcp/tools/remote.js.map +1 -0
  478. package/dist/mcp/tools/templates.d.ts +12 -0
  479. package/dist/mcp/tools/templates.js +165 -0
  480. package/dist/mcp/tools/templates.js.map +1 -0
  481. package/dist/mcp/tools/work.d.ts +16 -0
  482. package/dist/mcp/tools/work.js +359 -0
  483. package/dist/mcp/tools/work.js.map +1 -0
  484. package/dist/remote/accounts.d.ts +158 -0
  485. package/dist/remote/accounts.js +207 -0
  486. package/dist/remote/accounts.js.map +1 -0
  487. package/dist/remote/adopt.d.ts +139 -0
  488. package/dist/remote/adopt.js +181 -0
  489. package/dist/remote/adopt.js.map +1 -0
  490. package/dist/remote/anchor.d.ts +35 -0
  491. package/dist/remote/anchor.js +53 -0
  492. package/dist/remote/anchor.js.map +1 -0
  493. package/dist/remote/attributes.d.ts +103 -0
  494. package/dist/remote/attributes.js +245 -0
  495. package/dist/remote/attributes.js.map +1 -0
  496. package/dist/remote/audit.d.ts +112 -0
  497. package/dist/remote/audit.js +215 -0
  498. package/dist/remote/audit.js.map +1 -0
  499. package/dist/remote/capabilities.d.ts +267 -0
  500. package/dist/remote/capabilities.js +225 -0
  501. package/dist/remote/capabilities.js.map +1 -0
  502. package/dist/remote/check.d.ts +49 -0
  503. package/dist/remote/check.js +356 -0
  504. package/dist/remote/check.js.map +1 -0
  505. package/dist/remote/comments.d.ts +86 -0
  506. package/dist/remote/comments.js +87 -0
  507. package/dist/remote/comments.js.map +1 -0
  508. package/dist/remote/config-file.d.ts +237 -0
  509. package/dist/remote/config-file.js +640 -0
  510. package/dist/remote/config-file.js.map +1 -0
  511. package/dist/remote/conflicts.d.ts +110 -0
  512. package/dist/remote/conflicts.js +188 -0
  513. package/dist/remote/conflicts.js.map +1 -0
  514. package/dist/remote/connection-catalogue.d.ts +65 -0
  515. package/dist/remote/connection-catalogue.js +66 -0
  516. package/dist/remote/connection-catalogue.js.map +1 -0
  517. package/dist/remote/connection.d.ts +84 -0
  518. package/dist/remote/connection.js +229 -0
  519. package/dist/remote/connection.js.map +1 -0
  520. package/dist/remote/coverage.d.ts +65 -0
  521. package/dist/remote/coverage.js +244 -0
  522. package/dist/remote/coverage.js.map +1 -0
  523. package/dist/remote/credentials.d.ts +95 -0
  524. package/dist/remote/credentials.js +210 -0
  525. package/dist/remote/credentials.js.map +1 -0
  526. package/dist/remote/execute.d.ts +178 -0
  527. package/dist/remote/execute.js +1245 -0
  528. package/dist/remote/execute.js.map +1 -0
  529. package/dist/remote/fingerprint.d.ts +172 -0
  530. package/dist/remote/fingerprint.js +337 -0
  531. package/dist/remote/fingerprint.js.map +1 -0
  532. package/dist/remote/fixtures.d.ts +176 -0
  533. package/dist/remote/fixtures.js +432 -0
  534. package/dist/remote/fixtures.js.map +1 -0
  535. package/dist/remote/guard.d.ts +90 -0
  536. package/dist/remote/guard.js +83 -0
  537. package/dist/remote/guard.js.map +1 -0
  538. package/dist/remote/hierarchy.d.ts +141 -0
  539. package/dist/remote/hierarchy.js +129 -0
  540. package/dist/remote/hierarchy.js.map +1 -0
  541. package/dist/remote/index.d.ts +145 -0
  542. package/dist/remote/index.js +146 -0
  543. package/dist/remote/index.js.map +1 -0
  544. package/dist/remote/inspect.d.ts +103 -0
  545. package/dist/remote/inspect.js +152 -0
  546. package/dist/remote/inspect.js.map +1 -0
  547. package/dist/remote/labels.d.ts +75 -0
  548. package/dist/remote/labels.js +137 -0
  549. package/dist/remote/labels.js.map +1 -0
  550. package/dist/remote/ladder.d.ts +145 -0
  551. package/dist/remote/ladder.js +387 -0
  552. package/dist/remote/ladder.js.map +1 -0
  553. package/dist/remote/ledger.d.ts +97 -0
  554. package/dist/remote/ledger.js +148 -0
  555. package/dist/remote/ledger.js.map +1 -0
  556. package/dist/remote/lifecycle.d.ts +175 -0
  557. package/dist/remote/lifecycle.js +274 -0
  558. package/dist/remote/lifecycle.js.map +1 -0
  559. package/dist/remote/links.d.ts +411 -0
  560. package/dist/remote/links.js +748 -0
  561. package/dist/remote/links.js.map +1 -0
  562. package/dist/remote/managed-block.d.ts +182 -0
  563. package/dist/remote/managed-block.js +406 -0
  564. package/dist/remote/managed-block.js.map +1 -0
  565. package/dist/remote/managed-comment.d.ts +104 -0
  566. package/dist/remote/managed-comment.js +92 -0
  567. package/dist/remote/managed-comment.js.map +1 -0
  568. package/dist/remote/mapping.d.ts +282 -0
  569. package/dist/remote/mapping.js +336 -0
  570. package/dist/remote/mapping.js.map +1 -0
  571. package/dist/remote/merge.d.ts +172 -0
  572. package/dist/remote/merge.js +221 -0
  573. package/dist/remote/merge.js.map +1 -0
  574. package/dist/remote/periods.d.ts +209 -0
  575. package/dist/remote/periods.js +224 -0
  576. package/dist/remote/periods.js.map +1 -0
  577. package/dist/remote/plan.d.ts +671 -0
  578. package/dist/remote/plan.js +1210 -0
  579. package/dist/remote/plan.js.map +1 -0
  580. package/dist/remote/policy.d.ts +67 -0
  581. package/dist/remote/policy.js +67 -0
  582. package/dist/remote/policy.js.map +1 -0
  583. package/dist/remote/preflight.d.ts +112 -0
  584. package/dist/remote/preflight.js +342 -0
  585. package/dist/remote/preflight.js.map +1 -0
  586. package/dist/remote/prerequisites.d.ts +113 -0
  587. package/dist/remote/prerequisites.js +161 -0
  588. package/dist/remote/prerequisites.js.map +1 -0
  589. package/dist/remote/provider.d.ts +802 -0
  590. package/dist/remote/provider.js +27 -0
  591. package/dist/remote/provider.js.map +1 -0
  592. package/dist/remote/providers/github/config.d.ts +84 -0
  593. package/dist/remote/providers/github/config.js +161 -0
  594. package/dist/remote/providers/github/config.js.map +1 -0
  595. package/dist/remote/providers/github/connector.d.ts +33 -0
  596. package/dist/remote/providers/github/connector.js +774 -0
  597. package/dist/remote/providers/github/connector.js.map +1 -0
  598. package/dist/remote/providers/github/edges.d.ts +29 -0
  599. package/dist/remote/providers/github/edges.js +56 -0
  600. package/dist/remote/providers/github/edges.js.map +1 -0
  601. package/dist/remote/providers/github/hierarchy.d.ts +21 -0
  602. package/dist/remote/providers/github/hierarchy.js +46 -0
  603. package/dist/remote/providers/github/hierarchy.js.map +1 -0
  604. package/dist/remote/providers/github/index.d.ts +26 -0
  605. package/dist/remote/providers/github/index.js +69 -0
  606. package/dist/remote/providers/github/index.js.map +1 -0
  607. package/dist/remote/providers/github/project-iteration.d.ts +71 -0
  608. package/dist/remote/providers/github/project-iteration.js +203 -0
  609. package/dist/remote/providers/github/project-iteration.js.map +1 -0
  610. package/dist/remote/providers/github/project-provision.d.ts +130 -0
  611. package/dist/remote/providers/github/project-provision.js +247 -0
  612. package/dist/remote/providers/github/project-provision.js.map +1 -0
  613. package/dist/remote/providers/github/project-status.d.ts +115 -0
  614. package/dist/remote/providers/github/project-status.js +317 -0
  615. package/dist/remote/providers/github/project-status.js.map +1 -0
  616. package/dist/remote/providers/github/projects.d.ts +181 -0
  617. package/dist/remote/providers/github/projects.js +481 -0
  618. package/dist/remote/providers/github/projects.js.map +1 -0
  619. package/dist/remote/providers/github/translator.d.ts +103 -0
  620. package/dist/remote/providers/github/translator.js +400 -0
  621. package/dist/remote/providers/github/translator.js.map +1 -0
  622. package/dist/remote/providers/jira/config.d.ts +96 -0
  623. package/dist/remote/providers/jira/config.js +200 -0
  624. package/dist/remote/providers/jira/config.js.map +1 -0
  625. package/dist/remote/providers/jira/connector.d.ts +42 -0
  626. package/dist/remote/providers/jira/connector.js +1688 -0
  627. package/dist/remote/providers/jira/connector.js.map +1 -0
  628. package/dist/remote/providers/jira/fields.d.ts +292 -0
  629. package/dist/remote/providers/jira/fields.js +463 -0
  630. package/dist/remote/providers/jira/fields.js.map +1 -0
  631. package/dist/remote/providers/jira/hierarchy.d.ts +28 -0
  632. package/dist/remote/providers/jira/hierarchy.js +60 -0
  633. package/dist/remote/providers/jira/hierarchy.js.map +1 -0
  634. package/dist/remote/providers/jira/index.d.ts +29 -0
  635. package/dist/remote/providers/jira/index.js +100 -0
  636. package/dist/remote/providers/jira/index.js.map +1 -0
  637. package/dist/remote/providers/jira/links.d.ts +41 -0
  638. package/dist/remote/providers/jira/links.js +102 -0
  639. package/dist/remote/providers/jira/links.js.map +1 -0
  640. package/dist/remote/providers/jira/sprints.d.ts +80 -0
  641. package/dist/remote/providers/jira/sprints.js +107 -0
  642. package/dist/remote/providers/jira/sprints.js.map +1 -0
  643. package/dist/remote/providers/jira/translator.d.ts +61 -0
  644. package/dist/remote/providers/jira/translator.js +382 -0
  645. package/dist/remote/providers/jira/translator.js.map +1 -0
  646. package/dist/remote/providers/jira/types.d.ts +112 -0
  647. package/dist/remote/providers/jira/types.js +160 -0
  648. package/dist/remote/providers/jira/types.js.map +1 -0
  649. package/dist/remote/providers/jira/vocabulary.d.ts +55 -0
  650. package/dist/remote/providers/jira/vocabulary.js +91 -0
  651. package/dist/remote/providers/jira/vocabulary.js.map +1 -0
  652. package/dist/remote/providers/jsonfile/config.d.ts +61 -0
  653. package/dist/remote/providers/jsonfile/config.js +83 -0
  654. package/dist/remote/providers/jsonfile/config.js.map +1 -0
  655. package/dist/remote/providers/jsonfile/connector.d.ts +34 -0
  656. package/dist/remote/providers/jsonfile/connector.js +251 -0
  657. package/dist/remote/providers/jsonfile/connector.js.map +1 -0
  658. package/dist/remote/providers/jsonfile/index.d.ts +38 -0
  659. package/dist/remote/providers/jsonfile/index.js +90 -0
  660. package/dist/remote/providers/jsonfile/index.js.map +1 -0
  661. package/dist/remote/providers/jsonfile/store.d.ts +59 -0
  662. package/dist/remote/providers/jsonfile/store.js +48 -0
  663. package/dist/remote/providers/jsonfile/store.js.map +1 -0
  664. package/dist/remote/providers/jsonfile/translator.d.ts +54 -0
  665. package/dist/remote/providers/jsonfile/translator.js +199 -0
  666. package/dist/remote/providers/jsonfile/translator.js.map +1 -0
  667. package/dist/remote/providers/linear/config.d.ts +83 -0
  668. package/dist/remote/providers/linear/config.js +140 -0
  669. package/dist/remote/providers/linear/config.js.map +1 -0
  670. package/dist/remote/providers/linear/connector.d.ts +36 -0
  671. package/dist/remote/providers/linear/connector.js +438 -0
  672. package/dist/remote/providers/linear/connector.js.map +1 -0
  673. package/dist/remote/providers/linear/estimate.d.ts +63 -0
  674. package/dist/remote/providers/linear/estimate.js +112 -0
  675. package/dist/remote/providers/linear/estimate.js.map +1 -0
  676. package/dist/remote/providers/linear/index.d.ts +31 -0
  677. package/dist/remote/providers/linear/index.js +75 -0
  678. package/dist/remote/providers/linear/index.js.map +1 -0
  679. package/dist/remote/providers/linear/labels.d.ts +51 -0
  680. package/dist/remote/providers/linear/labels.js +129 -0
  681. package/dist/remote/providers/linear/labels.js.map +1 -0
  682. package/dist/remote/providers/linear/states.d.ts +97 -0
  683. package/dist/remote/providers/linear/states.js +124 -0
  684. package/dist/remote/providers/linear/states.js.map +1 -0
  685. package/dist/remote/providers/linear/translator.d.ts +48 -0
  686. package/dist/remote/providers/linear/translator.js +343 -0
  687. package/dist/remote/providers/linear/translator.js.map +1 -0
  688. package/dist/remote/providers/linear/vocabulary.d.ts +27 -0
  689. package/dist/remote/providers/linear/vocabulary.js +42 -0
  690. package/dist/remote/providers/linear/vocabulary.js.map +1 -0
  691. package/dist/remote/provision.d.ts +45 -0
  692. package/dist/remote/provision.js +81 -0
  693. package/dist/remote/provision.js.map +1 -0
  694. package/dist/remote/pull.d.ts +52 -0
  695. package/dist/remote/pull.js +116 -0
  696. package/dist/remote/pull.js.map +1 -0
  697. package/dist/remote/readiness.d.ts +67 -0
  698. package/dist/remote/readiness.js +336 -0
  699. package/dist/remote/readiness.js.map +1 -0
  700. package/dist/remote/rebase.d.ts +157 -0
  701. package/dist/remote/rebase.js +255 -0
  702. package/dist/remote/rebase.js.map +1 -0
  703. package/dist/remote/reconcile.d.ts +115 -0
  704. package/dist/remote/reconcile.js +140 -0
  705. package/dist/remote/reconcile.js.map +1 -0
  706. package/dist/remote/redact.d.ts +70 -0
  707. package/dist/remote/redact.js +132 -0
  708. package/dist/remote/redact.js.map +1 -0
  709. package/dist/remote/registry.d.ts +32 -0
  710. package/dist/remote/registry.js +54 -0
  711. package/dist/remote/registry.js.map +1 -0
  712. package/dist/remote/remotes.d.ts +94 -0
  713. package/dist/remote/remotes.js +182 -0
  714. package/dist/remote/remotes.js.map +1 -0
  715. package/dist/remote/render.d.ts +147 -0
  716. package/dist/remote/render.js +683 -0
  717. package/dist/remote/render.js.map +1 -0
  718. package/dist/remote/report.d.ts +63 -0
  719. package/dist/remote/report.js +345 -0
  720. package/dist/remote/report.js.map +1 -0
  721. package/dist/remote/resolutions.d.ts +115 -0
  722. package/dist/remote/resolutions.js +217 -0
  723. package/dist/remote/resolutions.js.map +1 -0
  724. package/dist/remote/scaffold.d.ts +134 -0
  725. package/dist/remote/scaffold.js +370 -0
  726. package/dist/remote/scaffold.js.map +1 -0
  727. package/dist/remote/scope.d.ts +57 -0
  728. package/dist/remote/scope.js +91 -0
  729. package/dist/remote/scope.js.map +1 -0
  730. package/dist/remote/selection.d.ts +38 -0
  731. package/dist/remote/selection.js +50 -0
  732. package/dist/remote/selection.js.map +1 -0
  733. package/dist/remote/shape.d.ts +141 -0
  734. package/dist/remote/shape.js +220 -0
  735. package/dist/remote/shape.js.map +1 -0
  736. package/dist/remote/status.d.ts +104 -0
  737. package/dist/remote/status.js +238 -0
  738. package/dist/remote/status.js.map +1 -0
  739. package/dist/remote/sync.d.ts +182 -0
  740. package/dist/remote/sync.js +523 -0
  741. package/dist/remote/sync.js.map +1 -0
  742. package/dist/remote/transport/budget.d.ts +48 -0
  743. package/dist/remote/transport/budget.js +68 -0
  744. package/dist/remote/transport/budget.js.map +1 -0
  745. package/dist/remote/transport/connector.d.ts +115 -0
  746. package/dist/remote/transport/connector.js +21 -0
  747. package/dist/remote/transport/connector.js.map +1 -0
  748. package/dist/remote/transport/error.d.ts +88 -0
  749. package/dist/remote/transport/error.js +196 -0
  750. package/dist/remote/transport/error.js.map +1 -0
  751. package/dist/remote/transport/gh.d.ts +20 -0
  752. package/dist/remote/transport/gh.js +41 -0
  753. package/dist/remote/transport/gh.js.map +1 -0
  754. package/dist/remote/transport/graphql.d.ts +25 -0
  755. package/dist/remote/transport/graphql.js +81 -0
  756. package/dist/remote/transport/graphql.js.map +1 -0
  757. package/dist/remote/transport/http.d.ts +47 -0
  758. package/dist/remote/transport/http.js +195 -0
  759. package/dist/remote/transport/http.js.map +1 -0
  760. package/dist/remote/transport/index.d.ts +18 -0
  761. package/dist/remote/transport/index.js +19 -0
  762. package/dist/remote/transport/index.js.map +1 -0
  763. package/dist/remote/transport/process.d.ts +39 -0
  764. package/dist/remote/transport/process.js +121 -0
  765. package/dist/remote/transport/process.js.map +1 -0
  766. package/dist/remote/transport/rest.d.ts +22 -0
  767. package/dist/remote/transport/rest.js +57 -0
  768. package/dist/remote/transport/rest.js.map +1 -0
  769. package/dist/remote/transport/retry.d.ts +91 -0
  770. package/dist/remote/transport/retry.js +138 -0
  771. package/dist/remote/transport/retry.js.map +1 -0
  772. package/dist/remote/transport-error.d.ts +19 -0
  773. package/dist/remote/transport-error.js +22 -0
  774. package/dist/remote/transport-error.js.map +1 -0
  775. package/dist/remote/vocabulary.d.ts +126 -0
  776. package/dist/remote/vocabulary.js +57 -0
  777. package/dist/remote/vocabulary.js.map +1 -0
  778. package/dist/runner/config.d.ts +7 -0
  779. package/dist/runner/config.js +61 -0
  780. package/dist/runner/config.js.map +1 -0
  781. package/dist/runner/git.d.ts +19 -0
  782. package/dist/runner/git.js +26 -0
  783. package/dist/runner/git.js.map +1 -0
  784. package/dist/runner/index.d.ts +20 -0
  785. package/dist/runner/index.js +21 -0
  786. package/dist/runner/index.js.map +1 -0
  787. package/dist/runner/loop.d.ts +46 -0
  788. package/dist/runner/loop.js +243 -0
  789. package/dist/runner/loop.js.map +1 -0
  790. package/dist/runner/pi.d.ts +39 -0
  791. package/dist/runner/pi.js +276 -0
  792. package/dist/runner/pi.js.map +1 -0
  793. package/dist/runner/shell.d.ts +44 -0
  794. package/dist/runner/shell.js +174 -0
  795. package/dist/runner/shell.js.map +1 -0
  796. package/dist/runner/stats.d.ts +19 -0
  797. package/dist/runner/stats.js +58 -0
  798. package/dist/runner/stats.js.map +1 -0
  799. package/dist/runner/types.d.ts +218 -0
  800. package/dist/runner/types.js +37 -0
  801. package/dist/runner/types.js.map +1 -0
  802. package/dist/server/git.d.ts +8 -0
  803. package/dist/server/git.js +50 -0
  804. package/dist/server/git.js.map +1 -0
  805. package/dist/server/http/respond.d.ts +13 -0
  806. package/dist/server/http/respond.js +59 -0
  807. package/dist/server/http/respond.js.map +1 -0
  808. package/dist/server/http/router.d.ts +27 -0
  809. package/dist/server/http/router.js +48 -0
  810. package/dist/server/http/router.js.map +1 -0
  811. package/dist/server/http/static.d.ts +14 -0
  812. package/dist/server/http/static.js +55 -0
  813. package/dist/server/http/static.js.map +1 -0
  814. package/dist/server/index.d.ts +58 -0
  815. package/dist/server/index.js +124 -0
  816. package/dist/server/index.js.map +1 -0
  817. package/dist/server/routes/board.d.ts +8 -0
  818. package/dist/server/routes/board.js +19 -0
  819. package/dist/server/routes/board.js.map +1 -0
  820. package/dist/server/routes/comments.d.ts +13 -0
  821. package/dist/server/routes/comments.js +36 -0
  822. package/dist/server/routes/comments.js.map +1 -0
  823. package/dist/server/routes/flags.d.ts +16 -0
  824. package/dist/server/routes/flags.js +37 -0
  825. package/dist/server/routes/flags.js.map +1 -0
  826. package/dist/server/routes/git.d.ts +13 -0
  827. package/dist/server/routes/git.js +84 -0
  828. package/dist/server/routes/git.js.map +1 -0
  829. package/dist/server/routes/remotes.d.ts +36 -0
  830. package/dist/server/routes/remotes.js +749 -0
  831. package/dist/server/routes/remotes.js.map +1 -0
  832. package/dist/server/routes/views.d.ts +10 -0
  833. package/dist/server/routes/views.js +63 -0
  834. package/dist/server/routes/views.js.map +1 -0
  835. package/dist/server/views/schema.d.ts +2 -0
  836. package/dist/server/views/schema.js +121 -0
  837. package/dist/server/views/schema.js.map +1 -0
  838. package/dist/server/views/store.d.ts +17 -0
  839. package/dist/server/views/store.js +67 -0
  840. package/dist/server/views/store.js.map +1 -0
  841. package/dist/shared/adf.d.ts +83 -0
  842. package/dist/shared/adf.js +795 -0
  843. package/dist/shared/adf.js.map +1 -0
  844. package/dist/shared/blocking.d.ts +130 -0
  845. package/dist/shared/blocking.js +179 -0
  846. package/dist/shared/blocking.js.map +1 -0
  847. package/dist/shared/changes.d.ts +100 -0
  848. package/dist/shared/changes.js +112 -0
  849. package/dist/shared/changes.js.map +1 -0
  850. package/dist/shared/cohesion.d.ts +75 -0
  851. package/dist/shared/cohesion.js +132 -0
  852. package/dist/shared/cohesion.js.map +1 -0
  853. package/dist/shared/dependency-rollup.d.ts +91 -0
  854. package/dist/shared/dependency-rollup.js +132 -0
  855. package/dist/shared/dependency-rollup.js.map +1 -0
  856. package/dist/shared/errors.d.ts +23 -0
  857. package/dist/shared/errors.js +24 -0
  858. package/dist/shared/errors.js.map +1 -0
  859. package/dist/shared/flag-rollup.d.ts +88 -0
  860. package/dist/shared/flag-rollup.js +119 -0
  861. package/dist/shared/flag-rollup.js.map +1 -0
  862. package/dist/shared/git-sync.d.ts +90 -0
  863. package/dist/shared/git-sync.js +9 -0
  864. package/dist/shared/git-sync.js.map +1 -0
  865. package/dist/shared/index.d.ts +40 -0
  866. package/dist/shared/index.js +41 -0
  867. package/dist/shared/index.js.map +1 -0
  868. package/dist/shared/model.d.ts +218 -0
  869. package/dist/shared/model.js +95 -0
  870. package/dist/shared/model.js.map +1 -0
  871. package/dist/shared/period-query.d.ts +21 -0
  872. package/dist/shared/period-query.js +26 -0
  873. package/dist/shared/period-query.js.map +1 -0
  874. package/dist/shared/period-stance.d.ts +45 -0
  875. package/dist/shared/period-stance.js +50 -0
  876. package/dist/shared/period-stance.js.map +1 -0
  877. package/dist/shared/plans/breakdown.d.ts +66 -0
  878. package/dist/shared/plans/breakdown.js +186 -0
  879. package/dist/shared/plans/breakdown.js.map +1 -0
  880. package/dist/shared/plans/index.d.ts +21 -0
  881. package/dist/shared/plans/index.js +22 -0
  882. package/dist/shared/plans/index.js.map +1 -0
  883. package/dist/shared/plans/instantiate.d.ts +61 -0
  884. package/dist/shared/plans/instantiate.js +184 -0
  885. package/dist/shared/plans/instantiate.js.map +1 -0
  886. package/dist/shared/plans/reading.d.ts +79 -0
  887. package/dist/shared/plans/reading.js +149 -0
  888. package/dist/shared/plans/reading.js.map +1 -0
  889. package/dist/shared/plans/reparent.d.ts +54 -0
  890. package/dist/shared/plans/reparent.js +217 -0
  891. package/dist/shared/plans/reparent.js.map +1 -0
  892. package/dist/shared/plans/timeline.d.ts +93 -0
  893. package/dist/shared/plans/timeline.js +224 -0
  894. package/dist/shared/plans/timeline.js.map +1 -0
  895. package/dist/shared/plans/upstream.d.ts +67 -0
  896. package/dist/shared/plans/upstream.js +73 -0
  897. package/dist/shared/plans/upstream.js.map +1 -0
  898. package/dist/shared/remote-api.d.ts +413 -0
  899. package/dist/shared/remote-api.js +11 -0
  900. package/dist/shared/remote-api.js.map +1 -0
  901. package/dist/shared/remote-coverage.d.ts +120 -0
  902. package/dist/shared/remote-coverage.js +98 -0
  903. package/dist/shared/remote-coverage.js.map +1 -0
  904. package/dist/shared/remote-readiness.d.ts +162 -0
  905. package/dist/shared/remote-readiness.js +49 -0
  906. package/dist/shared/remote-readiness.js.map +1 -0
  907. package/dist/shared/remote-status.d.ts +268 -0
  908. package/dist/shared/remote-status.js +79 -0
  909. package/dist/shared/remote-status.js.map +1 -0
  910. package/dist/shared/rollup.d.ts +90 -0
  911. package/dist/shared/rollup.js +119 -0
  912. package/dist/shared/rollup.js.map +1 -0
  913. package/dist/shared/static.d.ts +65 -0
  914. package/dist/shared/static.js +107 -0
  915. package/dist/shared/static.js.map +1 -0
  916. package/dist/shared/template-params.d.ts +80 -0
  917. package/dist/shared/template-params.js +141 -0
  918. package/dist/shared/template-params.js.map +1 -0
  919. package/dist/shared/view.d.ts +105 -0
  920. package/dist/shared/view.js +44 -0
  921. package/dist/shared/view.js.map +1 -0
  922. package/dist/shared/work-unit.d.ts +34 -0
  923. package/dist/shared/work-unit.js +47 -0
  924. package/dist/shared/work-unit.js.map +1 -0
  925. package/dist/sync/apply.d.ts +21 -0
  926. package/dist/sync/apply.js +149 -0
  927. package/dist/sync/apply.js.map +1 -0
  928. package/dist/sync/dto.d.ts +9 -0
  929. package/dist/sync/dto.js +162 -0
  930. package/dist/sync/dto.js.map +1 -0
  931. package/dist/sync/index.d.ts +24 -0
  932. package/dist/sync/index.js +25 -0
  933. package/dist/sync/index.js.map +1 -0
  934. package/dist/sync/patch.d.ts +13 -0
  935. package/dist/sync/patch.js +212 -0
  936. package/dist/sync/patch.js.map +1 -0
  937. package/dist/sync/session.d.ts +31 -0
  938. package/dist/sync/session.js +55 -0
  939. package/dist/sync/session.js.map +1 -0
  940. package/dist/sync/static.d.ts +11 -0
  941. package/dist/sync/static.js +33 -0
  942. package/dist/sync/static.js.map +1 -0
  943. package/package.json +95 -4
  944. package/templates/blank.yml +71 -0
  945. package/templates/context/bug.md +107 -0
  946. package/templates/context/default.md +119 -0
  947. package/templates/context/epic.md +81 -0
  948. package/templates/context/feature.md +91 -0
  949. package/templates/context/research.md +87 -0
  950. package/templates/context/review.md +81 -0
  951. package/templates/context/story.md +94 -0
  952. package/templates/context/sub_task.md +108 -0
  953. package/templates/context/task.md +86 -0
  954. package/templates/context/test.md +73 -0
  955. package/templates/context/user_story.md +147 -0
  956. package/templates/kanban.yml +226 -0
  957. package/templates/scrum.yml +567 -0
  958. package/web/dist/assets/index-D0j8OnHq.js +35 -0
  959. package/web/dist/assets/index-DFL7v8aP.css +1 -0
  960. package/web/dist/index.html +13 -0
  961. package/web/dist-viewer/assets/index-Bcns6OuC.css +1 -0
  962. package/web/dist-viewer/assets/index-vVXzeiFo.js +7 -0
  963. package/web/dist-viewer/index.html +14 -0
@@ -0,0 +1,46 @@
1
+ import type { BoardPaths, ResolvedScope } from '../core/index.js';
2
+ import type { GitDriver } from './git.js';
3
+ import type { CommitMode, PiRunner, RunEventSink, RunReport } from './types.js';
4
+ /**
5
+ * The development loop behind `lpm queue agent`.
6
+ *
7
+ * It is `simulateQueue` with the pretend taken out: instead of an in-memory
8
+ * overlay it writes to disk and reloads between steps (the push-session
9
+ * rationale — core operations make every handle stale the moment they run). It
10
+ * owns *orchestration* only. What may be picked up is still the engine's
11
+ * decision — `nextTasks` for new work, `resumableTasks` for work a previous run
12
+ * already claimed — so the agent works the same queue `lpm task next` offers and
13
+ * the same sequence `lpm queue simulate` predicts; the pi run arrives as an
14
+ * injected `PiRunner`, so this file never imports the SDK and its tests drive it
15
+ * with a fake.
16
+ */
17
+ /** Who wrote the comments and flags a run leaves behind. */
18
+ export declare const AGENT_AUTHOR = "pi (agent)";
19
+ export interface LoopOptions {
20
+ /** Stop after this many tasks. `Infinity` for unbounded. */
21
+ maxTasks: number;
22
+ includeUnassigned: boolean;
23
+ includeParked: boolean;
24
+ commit: CommitMode;
25
+ /** Pick and brief the next task, but run nothing and write nothing. */
26
+ dryRun: boolean;
27
+ scope: ResolvedScope | null;
28
+ /** Fixed "today", so a test can say what day it is. */
29
+ today?: string;
30
+ }
31
+ export interface LoopDeps {
32
+ /** Runs one task. Required unless `dryRun` is set. */
33
+ runner?: PiRunner;
34
+ git: GitDriver;
35
+ /** Timestamp source for artifacts, injectable for tests. */
36
+ now?: () => string;
37
+ /**
38
+ * Where the run reports what it is doing, as it does it. The loop emits its
39
+ * own stages and passes the same sink to the runner, so the agent's stream
40
+ * and the board's bookkeeping arrive on one channel in the order they
41
+ * happened. Optional, and never read back: what a front end draws is not the
42
+ * loop's business, and a display that throws cannot stop a task.
43
+ */
44
+ emit?: RunEventSink;
45
+ }
46
+ export declare function runAgentQueue(paths: BoardPaths, resourceId: string, options: LoopOptions, deps: LoopDeps): Promise<RunReport>;
@@ -0,0 +1,243 @@
1
+ import { BoardError, ConflictError, DocumentCache, addComment, claimIssue, currentTasks, findIssue, flagIssue, instructionsFor, isTerminalStatus, loadBoard, moveNode, nextTasks, pullBoard, resumableTasks, startStatusId, subtreeOf, terminalStatusId, workUnits, } from '../core/index.js';
2
+ import { formatRunComment, writeRunArtifact } from './stats.js';
3
+ import { safeSink } from './types.js';
4
+ /**
5
+ * The development loop behind `lpm queue agent`.
6
+ *
7
+ * It is `simulateQueue` with the pretend taken out: instead of an in-memory
8
+ * overlay it writes to disk and reloads between steps (the push-session
9
+ * rationale — core operations make every handle stale the moment they run). It
10
+ * owns *orchestration* only. What may be picked up is still the engine's
11
+ * decision — `nextTasks` for new work, `resumableTasks` for work a previous run
12
+ * already claimed — so the agent works the same queue `lpm task next` offers and
13
+ * the same sequence `lpm queue simulate` predicts; the pi run arrives as an
14
+ * injected `PiRunner`, so this file never imports the SDK and its tests drive it
15
+ * with a fake.
16
+ */
17
+ /** Who wrote the comments and flags a run leaves behind. */
18
+ export const AGENT_AUTHOR = 'pi (agent)';
19
+ /**
20
+ * How many claims in a row may be lost to other writers before the run stops.
21
+ *
22
+ * Losing one is ordinary on a busy checkout — the queue moved, ask again. A
23
+ * long unbroken streak is not: it means something is claiming everything this
24
+ * run is offered as fast as it can pick, and a loop that never gave up would
25
+ * spin on it without doing any work or reporting why.
26
+ */
27
+ const MAX_LOST_RACES = 5;
28
+ /** Every work unit under `parentId` is finished — the feature is complete. */
29
+ function parentComplete(board, parentId) {
30
+ const parent = findIssue(board, parentId);
31
+ if (!parent)
32
+ return false;
33
+ const units = new Set(workUnits(board).map((issue) => issue.id));
34
+ const inside = subtreeOf(board.issues, parent).filter((issue) => issue.id !== parent.id && units.has(issue.id));
35
+ return inside.length > 0 && inside.every((issue) => isTerminalStatus(board.config, issue.status));
36
+ }
37
+ /** The commit a finished task should produce, given the mode. */
38
+ function commitFor(board, paths, issue, mode, git) {
39
+ if (mode === 'none')
40
+ return null;
41
+ if (mode === 'task')
42
+ return git.commitAll(paths.root, `${issue.id}: ${issue.title}`);
43
+ // 'parent': a work unit with no parent is its own feature, so commit it like a
44
+ // task; otherwise hold until every sibling under the parent is done.
45
+ const parentId = issue.parentId;
46
+ if (!parentId)
47
+ return git.commitAll(paths.root, `${issue.id}: ${issue.title}`);
48
+ if (!parentComplete(board, parentId))
49
+ return null;
50
+ const parent = findIssue(board, parentId);
51
+ const title = parent ? parent.title : parentId;
52
+ return git.commitAll(paths.root, `${parentId}: complete ${title}`);
53
+ }
54
+ /** The outcome to record when the run itself failed rather than reporting. */
55
+ function failure(message) {
56
+ return {
57
+ completed: false,
58
+ summary: `The agent run did not finish: ${message}`,
59
+ reason: 'help',
60
+ error: message,
61
+ stats: { model: null, effort: null, tools: [], wallMs: 0, tokens: null, cost: null },
62
+ };
63
+ }
64
+ export async function runAgentQueue(paths, resourceId, options, deps) {
65
+ const cache = new DocumentCache();
66
+ // On a board shared through git, every look at the queue starts from the
67
+ // remote's latest, so two runners on two machines do not pick the same task.
68
+ // Throttled because the loop reloads after every write it makes, and each of
69
+ // those writes has just pushed. Best effort: a stale pick is still refused at
70
+ // the claim, which the loop already answers by asking the queue again.
71
+ const reload = () => {
72
+ try {
73
+ pullBoard(paths, { maxAgeMs: 10_000 });
74
+ }
75
+ catch {
76
+ // Reported by the write that runs into it.
77
+ }
78
+ return loadBoard(paths, { cache });
79
+ };
80
+ const emit = safeSink(deps.emit);
81
+ let board = reload();
82
+ const startStatus = startStatusId(board.config);
83
+ const terminalStatus = terminalStatusId(board.config);
84
+ if (!startStatus) {
85
+ throw new BoardError('This board has no in-progress status to move work into', [
86
+ 'Declare a status with `active: true` in .lpm/config.yml.',
87
+ ]);
88
+ }
89
+ if (!terminalStatus) {
90
+ throw new BoardError('This board has no end state to move finished work into', [
91
+ 'Declare a status with `terminal: true` in .lpm/config.yml.',
92
+ ]);
93
+ }
94
+ if (!options.dryRun && !deps.runner) {
95
+ throw new BoardError('No agent runner was provided');
96
+ }
97
+ const steps = [];
98
+ let focusParent = null;
99
+ let stopped = 'empty';
100
+ let held = [];
101
+ /** Claims lost in a row to somebody else on this checkout. */
102
+ let lost = 0;
103
+ while (steps.length < options.maxTasks) {
104
+ board = reload();
105
+ emit({ type: 'phase', phase: 'picking' });
106
+ const ranking = { focusParent, today: options.today };
107
+ // What this person is already holding comes first. The queue never offers
108
+ // work in an active status — it has been picked up — so a loop that only
109
+ // asked `nextTasks` could never return to a task a previous run claimed and
110
+ // did not finish, and everything waiting on that task stayed blocked for
111
+ // ever. `resumableTasks` is the engine's rule for that, and the same call
112
+ // `simulateQueue` seeds with, so the prediction and the run agree; it stops
113
+ // at a flag, which is what keeps a stalled task from being retried forever.
114
+ const top = resumableTasks(board, resourceId, ranking)[0] ??
115
+ nextTasks(board, resourceId, {
116
+ ...ranking,
117
+ includeUnassigned: options.includeUnassigned,
118
+ includeParked: options.includeParked,
119
+ scope: options.scope,
120
+ limit: 1,
121
+ })[0];
122
+ if (!top) {
123
+ // Nothing on offer. Say what this resource is already holding, read off
124
+ // the very handle that produced the empty queue — "nothing to pick up" and
125
+ // "three issues of yours are flagged" are the same board, and only the
126
+ // second one tells anybody what to do about it.
127
+ held = currentTasks(board, resourceId).map((issue) => ({
128
+ id: issue.id,
129
+ title: issue.title,
130
+ flag: issue.flag,
131
+ }));
132
+ break;
133
+ }
134
+ const issue = top.issue;
135
+ if (options.dryRun) {
136
+ const brief = instructionsFor(board, issue.id, { includeComments: true }).text;
137
+ emit({ type: 'task-start', index: 1, id: issue.id, title: issue.title });
138
+ emit({ type: 'note', text: brief });
139
+ steps.push({ id: issue.id, title: issue.title, completed: false, committed: null, artifact: null });
140
+ stopped = 'dry-run';
141
+ break;
142
+ }
143
+ emit({ type: 'task-start', index: steps.length + 1, id: issue.id, title: issue.title });
144
+ emit({ type: 'phase', phase: 'claiming' });
145
+ // Claim it before running, so a crash leaves a visible in-progress trail
146
+ // rather than silently losing the pick. The claim is a test-and-set and can
147
+ // legitimately fail: another agent or a person on this checkout may have
148
+ // taken this issue between the reload above and now. That is not a run
149
+ // failure and it must not be recorded against the issue — the queue simply
150
+ // moved on, so this run asks it again. Only a bounded number of times: a
151
+ // loop that kept re-picking would spin against a board being edited fast
152
+ // enough to always beat it.
153
+ try {
154
+ claimIssue(board, issue, { assignee: resourceId, status: startStatus });
155
+ }
156
+ catch (error) {
157
+ if (!(error instanceof ConflictError))
158
+ throw error;
159
+ emit({ type: 'note', text: `${issue.id} was taken by somebody else; picking again` });
160
+ lost += 1;
161
+ if (lost > MAX_LOST_RACES) {
162
+ stopped = 'contended';
163
+ break;
164
+ }
165
+ continue;
166
+ }
167
+ lost = 0;
168
+ board = reload();
169
+ emit({ type: 'phase', phase: 'briefing' });
170
+ const brief = instructionsFor(board, issue.id, { includeComments: true }).text;
171
+ let outcome;
172
+ emit({ type: 'phase', phase: 'running' });
173
+ try {
174
+ outcome = await deps.runner({
175
+ issue: findIssue(board, issue.id) ?? issue,
176
+ brief,
177
+ cwd: paths.root,
178
+ emit: deps.emit,
179
+ });
180
+ }
181
+ catch (error) {
182
+ outcome = failure(error.message);
183
+ }
184
+ board = reload();
185
+ emit({ type: 'phase', phase: 'recording' });
186
+ const target = findIssue(board, issue.id);
187
+ if (!target) {
188
+ // The issue vanished mid-run (deleted on disk). Record it and move on.
189
+ emit({ type: 'note', text: `${issue.id} is gone; skipping` });
190
+ emit({ type: 'task-end', id: issue.id, completed: false, summary: 'issue no longer on the board' });
191
+ steps.push({
192
+ id: issue.id,
193
+ title: issue.title,
194
+ completed: false,
195
+ committed: null,
196
+ artifact: null,
197
+ error: 'issue no longer on the board',
198
+ });
199
+ focusParent = issue.parentId;
200
+ continue;
201
+ }
202
+ if (outcome.completed) {
203
+ moveNode(board, target, { status: terminalStatus });
204
+ emit({ type: 'task-end', id: issue.id, completed: true, summary: outcome.summary });
205
+ }
206
+ else {
207
+ const reason = outcome.reason ?? 'help';
208
+ flagIssue(board, target, { reason, comment: outcome.summary, author: AGENT_AUTHOR });
209
+ emit({ type: 'task-end', id: issue.id, completed: false, flagReason: reason, summary: outcome.summary });
210
+ }
211
+ const artifact = writeRunArtifact(paths, issue.id, outcome, deps.now?.());
212
+ board = reload();
213
+ addComment(board, issue.id, {
214
+ body: formatRunComment(outcome, artifact),
215
+ author: AGENT_AUTHOR,
216
+ });
217
+ let committed = null;
218
+ if (outcome.completed && options.commit !== 'none') {
219
+ emit({ type: 'phase', phase: 'committing' });
220
+ board = reload();
221
+ const done = findIssue(board, issue.id);
222
+ committed = done ? commitFor(board, paths, done, options.commit, deps.git) : null;
223
+ if (committed)
224
+ emit({ type: 'note', text: `committed ${committed}` });
225
+ }
226
+ steps.push({
227
+ id: issue.id,
228
+ title: issue.title,
229
+ completed: outcome.completed,
230
+ ...(outcome.completed ? {} : { flagReason: outcome.reason ?? 'help' }),
231
+ committed,
232
+ artifact,
233
+ ...(outcome.error ? { error: outcome.error } : {}),
234
+ });
235
+ focusParent = target.parentId;
236
+ if (steps.length >= options.maxTasks) {
237
+ stopped = 'max-tasks';
238
+ break;
239
+ }
240
+ }
241
+ return { steps, stopped, held };
242
+ }
243
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/runner/loop.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,SAAS,GACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAWtC;;;;;;;;;;;;GAYG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC;AA+BzB,8EAA8E;AAC9E,SAAS,cAAc,CAAC,KAAkB,EAAE,QAAgB;IAC1D,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,MAAM,KAAK,GAAG,IAA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K,CAAC,EAAE,CAAC,CAAC;YACxC,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAClF,IAAI,SAAS;gBAAE,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,SAAS,EAAE,EAAE,CAAC,CAAC;QACxE,CAAC;QAED,KAAK,CAAC,IAAI,CAAC;YACT,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC;YACtE,SAAS;YACT,QAAQ;YACR,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnD,CAAC,CAAC;QACH,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC;QAE9B,IAAI,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrC,OAAO,GAAG,WAAW,CAAC;YACtB,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { PiRunner } from './types.js';
2
+ /**
3
+ * The one file that talks to the pi coding agent SDK.
4
+ *
5
+ * The SDK is an optional *peer* dependency — never installed with light-plan,
6
+ * because the agent is experimental — and it needs a newer Node than the engine
7
+ * does, so it cannot be assumed present at build time. It is therefore loaded
8
+ * through a computed specifier — `tsc` does not resolve a non-literal `import()`,
9
+ * so the whole project still compiles on a machine that has never installed pi —
10
+ * and reached only through a typed facade of the slice we use. Nothing else in
11
+ * the codebase imports this file's SDK types; the loop takes a `PiRunner` and
12
+ * never knows pi exists.
13
+ *
14
+ * `createPiRunner` loads the SDK once (failing fast with a readable message when
15
+ * it is missing) and returns a runner that opens a *fresh* in-memory session per
16
+ * task, so every task starts with an empty context.
17
+ *
18
+ * Two things here are about a run that nobody is watching, and both belong in
19
+ * this file because both are pi's shell. **The bash tool is replaced** with one
20
+ * of our own (`hardenedBash`): a custom tool of the same name wins over the
21
+ * built-in, which is how the non-interactive environment, the guard in
22
+ * `shell.ts` and a per-command timeout reach every command the agent runs.
23
+ * **Session events are forwarded** as `RunEvent`s, so a front end can show what
24
+ * the agent is doing without knowing that pi exists either.
25
+ */
26
+ /** The pi options a run is bound to. */
27
+ export interface PiRunnerOptions {
28
+ /** `provider:model`, e.g. `anthropic:claude-opus-4-5`. Omit for pi's default. */
29
+ model?: string;
30
+ effort?: string;
31
+ /** Per-task wall-clock cap, in milliseconds. */
32
+ timeoutMs?: number;
33
+ /** Per-command wall-clock cap, in seconds. Default `DEFAULT_COMMAND_TIMEOUT`. */
34
+ commandTimeout?: number;
35
+ /** Restrict the agent to these tool names (plus the result tool). */
36
+ tools?: string[];
37
+ authPath?: string;
38
+ }
39
+ export declare function createPiRunner(options: PiRunnerOptions): Promise<PiRunner>;
@@ -0,0 +1,276 @@
1
+ import { BoardError } from '../core/index.js';
2
+ import { NON_INTERACTIVE_ENV, blockedCommand, refusalFor } from './shell.js';
3
+ import { DEFAULT_COMMAND_TIMEOUT, safeSink } from './types.js';
4
+ // Non-literal specifiers so `tsc` does not require the packages to be installed.
5
+ const AGENT_PACKAGE = '@earendil-works/pi-coding-agent';
6
+ const AI_PACKAGE = '@earendil-works/pi-ai';
7
+ async function loadSdk() {
8
+ try {
9
+ const sdk = (await import(AGENT_PACKAGE));
10
+ const ai = (await import(AI_PACKAGE));
11
+ return { sdk, ai };
12
+ }
13
+ catch (error) {
14
+ throw new BoardError('The pi coding agent is not available', [
15
+ 'The agent is experimental, so its packages are not installed with light-plan.',
16
+ 'Install them beside light-plan (add -g if light-plan is installed globally):',
17
+ ' npm install @earendil-works/pi-coding-agent @earendil-works/pi-ai',
18
+ 'They require Node 22.19 or newer.',
19
+ error.message,
20
+ ]);
21
+ }
22
+ }
23
+ /**
24
+ * The bash tool an unattended run gets, or null when this pi is too old to
25
+ * build one — in which case the built-in tool is used and only the environment
26
+ * (see `hardenEnvironment`) protects the run.
27
+ *
28
+ * A custom tool replaces a built-in of the same name in pi's registry, so this
29
+ * *is* `bash` as far as the agent is concerned. Three things are added, in
30
+ * order of how much they save: a per-command timeout, so nothing runs for ever;
31
+ * the non-interactive environment, so pagers and editors do not wait; and the
32
+ * refusal in `shell.ts`, for the commands no variable can talk out of opening a
33
+ * window.
34
+ */
35
+ function hardenedBash(sdk, cwd, timeout) {
36
+ if (!sdk.createBashToolDefinition || !sdk.createLocalBashOperations)
37
+ return null;
38
+ const local = sdk.createLocalBashOperations();
39
+ const operations = {
40
+ // The agent may ask for its own timeout on a command it knows is slow; this
41
+ // only fills one in when it did not, so the cap is a floor under carelessness
42
+ // rather than a ceiling over judgement.
43
+ exec: (command, at, opts) => local.exec(command, at, { ...opts, timeout: opts.timeout ?? timeout }),
44
+ };
45
+ return sdk.createBashToolDefinition(cwd, {
46
+ operations,
47
+ spawnHook: (context) => {
48
+ const reason = blockedCommand(context.command);
49
+ return {
50
+ cwd: context.cwd,
51
+ env: { ...context.env, ...NON_INTERACTIVE_ENV },
52
+ command: reason ? refusalFor(reason) : context.command,
53
+ };
54
+ },
55
+ });
56
+ }
57
+ /**
58
+ * Put the non-interactive settings on this process too.
59
+ *
60
+ * Belt and braces: pi builds a child's environment from `process.env`, so this
61
+ * covers the built-in bash tool when `hardenedBash` could not be built, and any
62
+ * other process a run starts. It is set once, on a command that exists to run
63
+ * an agent, and never unset — `lpm queue agent` does nothing else afterwards.
64
+ */
65
+ function hardenEnvironment() {
66
+ Object.assign(process.env, NON_INTERACTIVE_ENV);
67
+ }
68
+ /** The argument of a tool call worth putting on one line of a display. */
69
+ function summarize(name, args) {
70
+ if (!args)
71
+ return '';
72
+ const first = (...keys) => {
73
+ for (const key of keys) {
74
+ const value = args[key];
75
+ if (typeof value === 'string' && value.trim())
76
+ return value.trim();
77
+ }
78
+ return '';
79
+ };
80
+ const text = name === 'bash'
81
+ ? first('command')
82
+ : first('command', 'path', 'file', 'file_path', 'pattern', 'query', 'summary');
83
+ return text.split('\n')[0] ?? '';
84
+ }
85
+ /** The text of a tool result, whatever shape pi wrapped it in. */
86
+ function resultText(result) {
87
+ if (typeof result === 'string')
88
+ return result;
89
+ if (!result || typeof result !== 'object')
90
+ return '';
91
+ const content = result.content;
92
+ if (!Array.isArray(content))
93
+ return '';
94
+ return content
95
+ .map((part) => (part && typeof part === 'object' ? String(part.text ?? '') : ''))
96
+ .join('');
97
+ }
98
+ /** Split `provider:model` (or `provider/model`) into its two parts. */
99
+ function splitModel(spec) {
100
+ const at = spec.search(/[:/]/);
101
+ if (at <= 0 || at >= spec.length - 1) {
102
+ throw new BoardError(`Invalid --model "${spec}"`, [
103
+ 'Write it as provider:model, e.g. anthropic:claude-opus-4-5.',
104
+ ]);
105
+ }
106
+ return [spec.slice(0, at), spec.slice(at + 1)];
107
+ }
108
+ export async function createPiRunner(options) {
109
+ const { sdk, ai } = await loadSdk();
110
+ hardenEnvironment();
111
+ const commandTimeout = options.commandTimeout ?? DEFAULT_COMMAND_TIMEOUT;
112
+ const runtime = await sdk.ModelRuntime.create(options.authPath ? { authPath: options.authPath } : {});
113
+ let model;
114
+ if (options.model) {
115
+ const [provider, id] = splitModel(options.model);
116
+ model = runtime.getModel(provider, id);
117
+ if (!model) {
118
+ throw new BoardError(`Unknown model "${options.model}"`, [
119
+ 'Check the provider and id, and that its API key is configured.',
120
+ ]);
121
+ }
122
+ }
123
+ return async (request) => {
124
+ const started = Date.now();
125
+ const tools = [];
126
+ const startedAt = new Map();
127
+ const index = new Map();
128
+ const reported = new Map();
129
+ const emit = safeSink(request.emit);
130
+ let submitted = null;
131
+ const submitTool = sdk.defineTool({
132
+ name: 'submit_result',
133
+ label: 'Submit result',
134
+ description: 'Report the outcome of this task and end the run. Call this exactly once, ' +
135
+ 'when you are done or when you cannot proceed. Set completed=true only if ' +
136
+ 'the task is fully finished; otherwise set completed=false and give a reason.',
137
+ parameters: ai.Type.Object({
138
+ completed: ai.Type.Boolean({ description: 'True only if the task is fully done.' }),
139
+ summary: ai.Type.String({ description: 'What you did, or why you stopped.' }),
140
+ reason: ai.Type.Optional(ai.Type.Union([ai.Type.Literal('blocked'), ai.Type.Literal('paused'), ai.Type.Literal('help')], { description: 'When not completed: why. blocked | paused | help.' })),
141
+ details: ai.Type.Optional(ai.Type.String({ description: 'Optional longer notes.' })),
142
+ }),
143
+ execute: async (_toolCallId, params) => {
144
+ submitted = params;
145
+ return { content: [{ type: 'text', text: 'Result recorded. You may stop now.' }], details: {} };
146
+ },
147
+ });
148
+ const bashTool = hardenedBash(sdk, request.cwd, commandTimeout);
149
+ const sessionOptions = {
150
+ cwd: request.cwd,
151
+ modelRuntime: runtime,
152
+ customTools: bashTool ? [submitTool, bashTool] : [submitTool],
153
+ sessionManager: sdk.SessionManager.inMemory(request.cwd),
154
+ };
155
+ if (model)
156
+ sessionOptions.model = model;
157
+ if (options.effort)
158
+ sessionOptions.thinkingLevel = options.effort;
159
+ // An allowlist replaces the defaults, so keep the result tool reachable.
160
+ if (options.tools)
161
+ sessionOptions.tools = [...options.tools, 'submit_result'];
162
+ const { session } = await sdk.createAgentSession(sessionOptions);
163
+ const unsubscribe = session.subscribe((event) => {
164
+ if (event.type === 'message_update') {
165
+ // The one place a run says what it is *thinking*: text arrives in
166
+ // fragments, and the display is what decides how to break them up.
167
+ const delta = event.assistantMessageEvent?.delta;
168
+ if (!delta)
169
+ return;
170
+ if (event.assistantMessageEvent?.type === 'text_delta')
171
+ emit({ type: 'agent-text', text: delta });
172
+ else if (event.assistantMessageEvent?.type === 'thinking_delta') {
173
+ emit({ type: 'agent-thinking', text: delta });
174
+ }
175
+ }
176
+ else if (event.type === 'tool_execution_start' && event.toolCallId) {
177
+ startedAt.set(event.toolCallId, Date.now());
178
+ index.set(event.toolCallId, tools.length);
179
+ const name = event.toolName ?? 'unknown';
180
+ tools.push({ name, ms: null, isError: false });
181
+ emit({ type: 'tool-start', name, summary: summarize(name, event.args) });
182
+ }
183
+ else if (event.type === 'tool_execution_update' && event.toolCallId) {
184
+ // pi reports a running tool's output as a growing snapshot; only the
185
+ // part nobody has seen is news.
186
+ const text = resultText(event.partialResult);
187
+ const seen = reported.get(event.toolCallId) ?? 0;
188
+ if (text.length > seen) {
189
+ reported.set(event.toolCallId, text.length);
190
+ emit({ type: 'tool-output', text: text.slice(seen) });
191
+ }
192
+ }
193
+ else if (event.type === 'tool_execution_end' && event.toolCallId) {
194
+ const at = index.get(event.toolCallId);
195
+ if (at !== undefined) {
196
+ const begin = startedAt.get(event.toolCallId);
197
+ tools[at] = {
198
+ name: tools[at].name,
199
+ ms: begin === undefined ? null : Date.now() - begin,
200
+ isError: Boolean(event.isError),
201
+ };
202
+ emit({ type: 'tool-end', name: tools[at].name, ms: tools[at].ms, isError: tools[at].isError });
203
+ }
204
+ }
205
+ });
206
+ let timedOut = false;
207
+ let timer;
208
+ try {
209
+ // The shell refuses what would stop the run, but a refused command is a
210
+ // wasted turn: saying so up front is cheaper than letting the agent find
211
+ // out. Both halves are here because both are about *this* kind of run.
212
+ const brief = `${request.brief}\n\n---\n\n` +
213
+ 'Nobody is watching this run. Every command must finish on its own: no ' +
214
+ 'pagers, no editors, no `start`/`open`/`code`, no watch modes or servers ' +
215
+ `that stay up (a command is killed after ${commandTimeout}s). Read files ` +
216
+ 'with the read tool, and run tests once rather than in watch mode.\n\n' +
217
+ 'When you have finished this task, or if you cannot, call the ' +
218
+ '`submit_result` tool with your outcome. Do not stop without calling it.';
219
+ const run = session.prompt(brief);
220
+ if (options.timeoutMs && options.timeoutMs > 0) {
221
+ await Promise.race([
222
+ run,
223
+ new Promise((resolve) => {
224
+ timer = setTimeout(() => {
225
+ timedOut = true;
226
+ void session.abort().finally(resolve);
227
+ }, options.timeoutMs);
228
+ }),
229
+ ]);
230
+ }
231
+ else {
232
+ await run;
233
+ }
234
+ }
235
+ finally {
236
+ if (timer)
237
+ clearTimeout(timer);
238
+ unsubscribe();
239
+ }
240
+ const raw = session.getSessionStats();
241
+ const stats = {
242
+ model: options.model ?? null,
243
+ effort: options.effort ?? null,
244
+ tools,
245
+ wallMs: Date.now() - started,
246
+ tokens: raw.tokens ?? null,
247
+ cost: raw.cost ?? null,
248
+ sessionId: raw.sessionId,
249
+ };
250
+ const lastText = session.getLastAssistantText();
251
+ session.dispose();
252
+ if (submitted) {
253
+ const result = submitted;
254
+ const outcome = {
255
+ completed: result.completed,
256
+ summary: result.summary,
257
+ stats,
258
+ ...(result.reason ? { reason: result.reason } : {}),
259
+ ...(result.details ? { details: result.details } : {}),
260
+ };
261
+ return outcome;
262
+ }
263
+ // No result submitted: a timeout, a crash, or the agent simply stopping.
264
+ const why = timedOut
265
+ ? `timed out after ${Math.round((options.timeoutMs ?? 0) / 1000)}s`
266
+ : 'the agent ended without submitting a result';
267
+ return {
268
+ completed: false,
269
+ summary: lastText?.trim() || why,
270
+ reason: 'help',
271
+ error: why,
272
+ stats,
273
+ };
274
+ };
275
+ }
276
+ //# sourceMappingURL=pi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.js","sourceRoot":"","sources":["../../src/runner/pi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA2H/D,iFAAiF;AACjF,MAAM,aAAa,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