@entelligentsia/forgecli 1.0.25 → 1.0.40

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 (590) hide show
  1. package/CHANGELOG.md +341 -0
  2. package/README.md +2 -0
  3. package/dist/CHANGELOG-forge-plugin.md +264 -0
  4. package/dist/CHANGELOG-pi.md +143 -0
  5. package/dist/bin/argv.d.ts +2 -2
  6. package/dist/bin/argv.js +37 -0
  7. package/dist/bin/argv.js.map +1 -1
  8. package/dist/bin/forge.js +30 -16
  9. package/dist/bin/forge.js.map +1 -1
  10. package/dist/bin/init.d.ts +23 -0
  11. package/dist/bin/init.js +123 -0
  12. package/dist/bin/init.js.map +1 -0
  13. package/dist/bin/reset.d.ts +39 -0
  14. package/dist/bin/reset.js +101 -0
  15. package/dist/bin/reset.js.map +1 -0
  16. package/dist/bin/uninstall.d.ts +20 -0
  17. package/dist/bin/uninstall.js +141 -0
  18. package/dist/bin/uninstall.js.map +1 -0
  19. package/dist/extensions/forgecli/claude-bootstrap/bootstrap.d.ts +40 -0
  20. package/dist/extensions/forgecli/claude-bootstrap/bootstrap.js +384 -0
  21. package/dist/extensions/forgecli/claude-bootstrap/bootstrap.js.map +1 -0
  22. package/dist/extensions/forgecli/claude-bootstrap/settings-merge.d.ts +46 -0
  23. package/dist/extensions/forgecli/claude-bootstrap/settings-merge.js +245 -0
  24. package/dist/extensions/forgecli/claude-bootstrap/settings-merge.js.map +1 -0
  25. package/dist/extensions/forgecli/claude-bootstrap/uninstall.d.ts +23 -0
  26. package/dist/extensions/forgecli/claude-bootstrap/uninstall.js +235 -0
  27. package/dist/extensions/forgecli/claude-bootstrap/uninstall.js.map +1 -0
  28. package/dist/extensions/forgecli/commands/reset.d.ts +16 -0
  29. package/dist/extensions/forgecli/commands/reset.js +83 -0
  30. package/dist/extensions/forgecli/commands/reset.js.map +1 -0
  31. package/dist/extensions/forgecli/dashboard/component.js +10 -7
  32. package/dist/extensions/forgecli/dashboard/component.js.map +1 -1
  33. package/dist/extensions/forgecli/forge-commands.d.ts +7 -2
  34. package/dist/extensions/forgecli/forge-commands.js +19 -5
  35. package/dist/extensions/forgecli/forge-commands.js.map +1 -1
  36. package/dist/extensions/forgecli/forge-subagent.d.ts +4 -4
  37. package/dist/extensions/forgecli/hooks/forge-permissions.js +20 -6
  38. package/dist/extensions/forgecli/hooks/forge-permissions.js.map +1 -1
  39. package/dist/extensions/forgecli/index.js +6 -3
  40. package/dist/extensions/forgecli/index.js.map +1 -1
  41. package/dist/extensions/forgecli/lib/forge-root.d.ts +6 -0
  42. package/dist/extensions/forgecli/lib/forge-root.js +52 -0
  43. package/dist/extensions/forgecli/lib/forge-root.js.map +1 -1
  44. package/dist/extensions/forgecli/lib/payload-manifest.d.ts +62 -0
  45. package/dist/extensions/forgecli/lib/payload-manifest.js +151 -0
  46. package/dist/extensions/forgecli/lib/payload-manifest.js.map +1 -0
  47. package/dist/extensions/forgecli/orchestrators/advisory-render.d.ts +9 -0
  48. package/dist/extensions/forgecli/orchestrators/advisory-render.js +107 -0
  49. package/dist/extensions/forgecli/orchestrators/advisory-render.js.map +1 -0
  50. package/dist/extensions/forgecli/orchestrators/bug/bug-body.d.ts +1 -0
  51. package/dist/extensions/forgecli/orchestrators/bug/bug-body.js +65 -0
  52. package/dist/extensions/forgecli/orchestrators/bug/bug-body.js.map +1 -0
  53. package/dist/extensions/forgecli/orchestrators/bug/bug-id.d.ts +23 -0
  54. package/dist/extensions/forgecli/orchestrators/bug/bug-id.js +140 -0
  55. package/dist/extensions/forgecli/orchestrators/bug/bug-id.js.map +1 -0
  56. package/dist/extensions/forgecli/orchestrators/bug/bug-phase-dispatch.d.ts +54 -0
  57. package/dist/extensions/forgecli/orchestrators/bug/bug-phase-dispatch.js +349 -0
  58. package/dist/extensions/forgecli/orchestrators/bug/bug-phase-dispatch.js.map +1 -0
  59. package/dist/extensions/forgecli/orchestrators/bug/bug-phases.d.ts +11 -0
  60. package/dist/extensions/forgecli/orchestrators/bug/bug-phases.js +82 -0
  61. package/dist/extensions/forgecli/orchestrators/bug/bug-phases.js.map +1 -0
  62. package/dist/extensions/forgecli/orchestrators/bug/bug-state.d.ts +14 -0
  63. package/dist/extensions/forgecli/orchestrators/bug/bug-state.js +100 -0
  64. package/dist/extensions/forgecli/orchestrators/bug/bug-state.js.map +1 -0
  65. package/dist/extensions/forgecli/orchestrators/bug/bug-triage-routing.d.ts +72 -0
  66. package/dist/extensions/forgecli/orchestrators/bug/bug-triage-routing.js +204 -0
  67. package/dist/extensions/forgecli/orchestrators/bug/bug-triage-routing.js.map +1 -0
  68. package/dist/extensions/forgecli/orchestrators/bug/bug-verdict-loop.d.ts +38 -0
  69. package/dist/extensions/forgecli/orchestrators/bug/bug-verdict-loop.js +198 -0
  70. package/dist/extensions/forgecli/orchestrators/bug/bug-verdict-loop.js.map +1 -0
  71. package/dist/extensions/forgecli/orchestrators/bug/bug-verdict.d.ts +3 -0
  72. package/dist/extensions/forgecli/orchestrators/bug/bug-verdict.js +55 -0
  73. package/dist/extensions/forgecli/orchestrators/bug/bug-verdict.js.map +1 -0
  74. package/dist/extensions/forgecli/orchestrators/bug/run-bug-command.d.ts +7 -0
  75. package/dist/extensions/forgecli/orchestrators/bug/run-bug-command.js +293 -0
  76. package/dist/extensions/forgecli/orchestrators/bug/run-bug-command.js.map +1 -0
  77. package/dist/extensions/forgecli/orchestrators/bug/run-bug-pipeline.d.ts +2 -0
  78. package/dist/extensions/forgecli/orchestrators/bug/run-bug-pipeline.js +501 -0
  79. package/dist/extensions/forgecli/orchestrators/bug/run-bug-pipeline.js.map +1 -0
  80. package/dist/extensions/forgecli/orchestrators/bug/run-bug-types.d.ts +41 -0
  81. package/dist/extensions/forgecli/orchestrators/bug/run-bug-types.js +5 -0
  82. package/dist/extensions/forgecli/orchestrators/bug/run-bug-types.js.map +1 -0
  83. package/dist/extensions/forgecli/orchestrators/common/orchestrator-entry.d.ts +43 -0
  84. package/dist/extensions/forgecli/orchestrators/common/orchestrator-entry.js +85 -0
  85. package/dist/extensions/forgecli/orchestrators/common/orchestrator-entry.js.map +1 -0
  86. package/dist/extensions/forgecli/orchestrators/common/orchestrator-misc.d.ts +8 -0
  87. package/dist/extensions/forgecli/orchestrators/common/orchestrator-misc.js +37 -0
  88. package/dist/extensions/forgecli/orchestrators/common/orchestrator-misc.js.map +1 -0
  89. package/dist/extensions/forgecli/orchestrators/common/orchestrator-notify.d.ts +28 -0
  90. package/dist/extensions/forgecli/orchestrators/common/orchestrator-notify.js +45 -0
  91. package/dist/extensions/forgecli/orchestrators/common/orchestrator-notify.js.map +1 -0
  92. package/dist/extensions/forgecli/orchestrators/common/orchestrator-transcript-session.d.ts +26 -0
  93. package/dist/extensions/forgecli/orchestrators/common/orchestrator-transcript-session.js +75 -0
  94. package/dist/extensions/forgecli/orchestrators/common/orchestrator-transcript-session.js.map +1 -0
  95. package/dist/extensions/forgecli/orchestrators/common/recovery-menu.d.ts +24 -0
  96. package/dist/extensions/forgecli/orchestrators/common/recovery-menu.js +58 -0
  97. package/dist/extensions/forgecli/orchestrators/common/recovery-menu.js.map +1 -0
  98. package/dist/extensions/forgecli/orchestrators/common/reset-pipeline.d.ts +53 -0
  99. package/dist/extensions/forgecli/orchestrators/common/reset-pipeline.js +131 -0
  100. package/dist/extensions/forgecli/orchestrators/common/reset-pipeline.js.map +1 -0
  101. package/dist/extensions/forgecli/orchestrators/common/summary-recovery.d.ts +24 -0
  102. package/dist/extensions/forgecli/orchestrators/common/summary-recovery.js +37 -0
  103. package/dist/extensions/forgecli/orchestrators/common/summary-recovery.js.map +1 -0
  104. package/dist/extensions/forgecli/orchestrators/fix-bug.d.ts +9 -93
  105. package/dist/extensions/forgecli/orchestrators/fix-bug.js +23 -1721
  106. package/dist/extensions/forgecli/orchestrators/fix-bug.js.map +1 -1
  107. package/dist/extensions/forgecli/orchestrators/halt-advisor.js +25 -3
  108. package/dist/extensions/forgecli/orchestrators/halt-advisor.js.map +1 -1
  109. package/dist/extensions/forgecli/orchestrators/run-sprint.d.ts +3 -12
  110. package/dist/extensions/forgecli/orchestrators/run-sprint.js +48 -270
  111. package/dist/extensions/forgecli/orchestrators/run-sprint.js.map +1 -1
  112. package/dist/extensions/forgecli/orchestrators/run-task.d.ts +10 -214
  113. package/dist/extensions/forgecli/orchestrators/run-task.js +31 -1481
  114. package/dist/extensions/forgecli/orchestrators/run-task.js.map +1 -1
  115. package/dist/extensions/forgecli/orchestrators/sprint/sprint-ceremony.d.ts +33 -0
  116. package/dist/extensions/forgecli/orchestrators/sprint/sprint-ceremony.js +135 -0
  117. package/dist/extensions/forgecli/orchestrators/sprint/sprint-ceremony.js.map +1 -0
  118. package/dist/extensions/forgecli/orchestrators/sprint/sprint-state.d.ts +18 -0
  119. package/dist/extensions/forgecli/orchestrators/sprint/sprint-state.js +55 -0
  120. package/dist/extensions/forgecli/orchestrators/sprint/sprint-state.js.map +1 -0
  121. package/dist/extensions/forgecli/orchestrators/task/run-task-command.d.ts +9 -0
  122. package/dist/extensions/forgecli/orchestrators/task/run-task-command.js +174 -0
  123. package/dist/extensions/forgecli/orchestrators/task/run-task-command.js.map +1 -0
  124. package/dist/extensions/forgecli/orchestrators/task/run-task-pipeline.d.ts +2 -0
  125. package/dist/extensions/forgecli/orchestrators/task/run-task-pipeline.js +494 -0
  126. package/dist/extensions/forgecli/orchestrators/task/run-task-pipeline.js.map +1 -0
  127. package/dist/extensions/forgecli/orchestrators/task/run-task-types.d.ts +62 -0
  128. package/dist/extensions/forgecli/orchestrators/task/run-task-types.js +5 -0
  129. package/dist/extensions/forgecli/orchestrators/task/run-task-types.js.map +1 -0
  130. package/dist/extensions/forgecli/orchestrators/task/task-body.d.ts +4 -0
  131. package/dist/extensions/forgecli/orchestrators/task/task-body.js +48 -0
  132. package/dist/extensions/forgecli/orchestrators/task/task-body.js.map +1 -0
  133. package/dist/extensions/forgecli/orchestrators/task/task-events.d.ts +63 -0
  134. package/dist/extensions/forgecli/orchestrators/task/task-events.js +185 -0
  135. package/dist/extensions/forgecli/orchestrators/task/task-events.js.map +1 -0
  136. package/dist/extensions/forgecli/orchestrators/task/task-gates.d.ts +34 -0
  137. package/dist/extensions/forgecli/orchestrators/task/task-gates.js +78 -0
  138. package/dist/extensions/forgecli/orchestrators/task/task-gates.js.map +1 -0
  139. package/dist/extensions/forgecli/orchestrators/task/task-phase-dispatch.d.ts +42 -0
  140. package/dist/extensions/forgecli/orchestrators/task/task-phase-dispatch.js +370 -0
  141. package/dist/extensions/forgecli/orchestrators/task/task-phase-dispatch.js.map +1 -0
  142. package/dist/extensions/forgecli/orchestrators/task/task-phases.d.ts +17 -0
  143. package/dist/extensions/forgecli/orchestrators/task/task-phases.js +48 -0
  144. package/dist/extensions/forgecli/orchestrators/task/task-phases.js.map +1 -0
  145. package/dist/extensions/forgecli/orchestrators/task/task-record.d.ts +9 -0
  146. package/dist/extensions/forgecli/orchestrators/task/task-record.js +58 -0
  147. package/dist/extensions/forgecli/orchestrators/task/task-record.js.map +1 -0
  148. package/dist/extensions/forgecli/orchestrators/task/task-state.d.ts +14 -0
  149. package/dist/extensions/forgecli/orchestrators/task/task-state.js +35 -0
  150. package/dist/extensions/forgecli/orchestrators/task/task-state.js.map +1 -0
  151. package/dist/extensions/forgecli/orchestrators/task/task-verdict-loop.d.ts +36 -0
  152. package/dist/extensions/forgecli/orchestrators/task/task-verdict-loop.js +187 -0
  153. package/dist/extensions/forgecli/orchestrators/task/task-verdict-loop.js.map +1 -0
  154. package/dist/extensions/forgecli/store/store-resolver.d.ts +15 -0
  155. package/dist/extensions/forgecli/store/store-resolver.js +118 -18
  156. package/dist/extensions/forgecli/store/store-resolver.js.map +1 -1
  157. package/dist/extensions/forgecli/update/forge-update-command.js +10 -7
  158. package/dist/extensions/forgecli/update/forge-update-command.js.map +1 -1
  159. package/dist/forge-payload/.base-pack/workflows/collator_agent.md +5 -6
  160. package/dist/forge-payload/.base-pack/workflows/migrate_structural.md +1 -1
  161. package/dist/forge-payload/.base-pack/workflows-js/wfl-init.js +449 -0
  162. package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
  163. package/dist/forge-payload/.schemas/enum-catalog.json +2 -2
  164. package/dist/forge-payload/.schemas/migrations.json +170 -0
  165. package/dist/forge-payload/.schemas/payload-manifest.schema.json +100 -0
  166. package/dist/forge-payload/commands/add-pipeline.md +1 -1
  167. package/dist/forge-payload/commands/add-task.md +3 -3
  168. package/dist/forge-payload/{.base-pack/commands → commands}/approve.md +2 -2
  169. package/dist/forge-payload/commands/ask.md +1 -1
  170. package/dist/forge-payload/commands/check-agent.md +8 -24
  171. package/dist/forge-payload/{.base-pack/commands → commands}/collate.md +2 -2
  172. package/dist/forge-payload/{.base-pack/commands → commands}/commit.md +2 -2
  173. package/dist/forge-payload/commands/config.md +1 -1
  174. package/dist/forge-payload/commands/enhance.md +31 -5
  175. package/dist/forge-payload/{.base-pack/commands → commands}/fix-bug.md +2 -2
  176. package/dist/forge-payload/commands/health.md +1 -1
  177. package/dist/forge-payload/{.base-pack/commands → commands}/implement.md +2 -2
  178. package/dist/forge-payload/commands/init.md +186 -67
  179. package/dist/forge-payload/{.base-pack/commands → commands}/new-sprint.md +2 -2
  180. package/dist/forge-payload/{.base-pack/commands → commands}/plan-sprint.md +2 -2
  181. package/dist/forge-payload/{.base-pack/commands → commands}/plan.md +2 -2
  182. package/dist/forge-payload/commands/rebuild.md +3 -3
  183. package/dist/forge-payload/commands/remove.md +1 -1
  184. package/dist/forge-payload/commands/repair.md +1 -1
  185. package/dist/forge-payload/commands/report-bug.md +1 -1
  186. package/dist/forge-payload/commands/reset.md +117 -0
  187. package/dist/forge-payload/{.base-pack/commands → commands}/retro.md +2 -2
  188. package/dist/forge-payload/{.base-pack/commands → commands}/review-code.md +2 -2
  189. package/dist/forge-payload/{.base-pack/commands → commands}/review-plan.md +2 -2
  190. package/dist/forge-payload/{.base-pack/commands → commands}/run-sprint.md +2 -2
  191. package/dist/forge-payload/{.base-pack/commands → commands}/run-task.md +2 -2
  192. package/dist/forge-payload/commands/status.md +1 -1
  193. package/dist/forge-payload/commands/update.md +3 -3
  194. package/dist/forge-payload/{.base-pack/commands → commands}/validate.md +2 -2
  195. package/dist/forge-payload/hooks/forge-permissions.cjs +29 -6
  196. package/dist/forge-payload/hooks/lib/common.cjs +228 -0
  197. package/dist/forge-payload/hooks/lib/plugin-detection.cjs +106 -0
  198. package/dist/forge-payload/hooks/lib/update-msg.cjs +23 -0
  199. package/dist/forge-payload/hooks/lib/update-url.cjs +46 -0
  200. package/dist/forge-payload/hooks/lib/write-registry.js +53 -0
  201. package/dist/forge-payload/init/discovery/discover-database.md +32 -0
  202. package/dist/forge-payload/init/discovery/discover-processes.md +31 -0
  203. package/dist/forge-payload/init/discovery/discover-routing.md +31 -0
  204. package/dist/forge-payload/init/discovery/discover-stack.md +33 -0
  205. package/dist/forge-payload/init/discovery/discover-testing.md +34 -0
  206. package/dist/forge-payload/init/generation/generate-commands.md +171 -0
  207. package/dist/forge-payload/init/generation/generate-kb-doc.md +60 -0
  208. package/dist/forge-payload/init/generation/generate-persona.md +73 -0
  209. package/dist/forge-payload/init/generation/generate-skill.md +66 -0
  210. package/dist/forge-payload/init/generation/generate-template.md +60 -0
  211. package/dist/forge-payload/init/generation/generate-tools.md +133 -0
  212. package/dist/forge-payload/init/generation/generate-workflows.md +78 -0
  213. package/dist/forge-payload/init/phases/phase-1-collect.md +10 -2
  214. package/dist/forge-payload/init/phases/phase-3-materialize.md +5 -1
  215. package/dist/forge-payload/init/phases/phase-4-register.md +8 -0
  216. package/dist/forge-payload/init/workflow-gen-plan.json +17 -0
  217. package/dist/forge-payload/integrity.json +33 -18
  218. package/dist/forge-payload/meta/workflows/meta-collate.md +5 -6
  219. package/dist/forge-payload/meta/workflows/meta-migrate.md +1 -1
  220. package/dist/forge-payload/payload-manifest.json +314 -0
  221. package/dist/forge-payload/schemas/enum-catalog.json +2 -2
  222. package/dist/forge-payload/schemas/payload-manifest.schema.json +100 -0
  223. package/dist/forge-payload/schemas/structure-manifest.json +5 -12
  224. package/dist/forge-payload/tools/forge-preflight.cjs +268 -0
  225. package/dist/forge-payload/tools/lib/paths.cjs +12 -11
  226. package/dist/forge-payload/tools/lib/pricing.cjs +31 -11
  227. package/dist/forge-payload/tools/query-logger.cjs +34 -0
  228. package/dist/forge-payload/tools/reset-plan.cjs +210 -0
  229. package/dist/forge-payload/tools/store.cjs +4 -1
  230. package/dist/forge-payload/tools/substitute-placeholders.cjs +14 -7
  231. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  232. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +8 -0
  233. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  234. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +1 -1
  235. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  236. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +1 -1
  237. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  238. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.d.ts +4 -0
  239. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.d.ts.map +1 -0
  240. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +3 -0
  241. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js.map +1 -0
  242. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.d.ts +20 -0
  243. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.d.ts.map +1 -0
  244. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +92 -0
  245. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js.map +1 -0
  246. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.d.ts +18 -0
  247. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.d.ts.map +1 -0
  248. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +42 -0
  249. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js.map +1 -0
  250. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.d.ts +10 -0
  251. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.d.ts.map +1 -0
  252. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +31 -0
  253. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js.map +1 -0
  254. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.d.ts +30 -0
  255. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.d.ts.map +1 -0
  256. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +170 -0
  257. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js.map +1 -0
  258. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.d.ts +26 -0
  259. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.d.ts.map +1 -0
  260. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +90 -0
  261. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js.map +1 -0
  262. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -1
  263. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  264. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  265. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  266. package/node_modules/@earendil-works/pi-ai/README.md +12 -4
  267. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  268. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +3 -0
  269. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  270. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +45 -0
  271. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  272. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +45 -0
  273. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  274. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +1804 -815
  275. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  276. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +2031 -1384
  277. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  278. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  279. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +71 -27
  280. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  281. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts +1 -1
  282. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
  283. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +24 -16
  284. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
  285. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
  286. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
  287. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
  288. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
  289. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +3 -1
  290. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
  291. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
  292. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +35 -13
  293. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
  294. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
  295. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +2 -1
  296. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
  297. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
  298. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -0
  299. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
  300. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +12 -4
  301. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  302. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  303. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
  304. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +13 -1
  305. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
  306. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
  307. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +4 -2
  308. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
  309. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +1 -1
  310. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  311. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +3 -2
  312. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  313. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  314. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +143 -0
  315. package/node_modules/@earendil-works/pi-coding-agent/README.md +26 -4
  316. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts +1 -0
  317. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  318. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +11 -0
  319. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  320. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/project-trust.d.ts +10 -0
  321. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/project-trust.d.ts.map +1 -0
  322. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/project-trust.js +48 -0
  323. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/project-trust.js.map +1 -0
  324. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/startup-ui.d.ts +17 -0
  325. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/startup-ui.d.ts.map +1 -0
  326. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/startup-ui.js +128 -0
  327. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/startup-ui.js.map +1 -0
  328. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
  329. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +9 -1
  330. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
  331. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts +3 -1
  332. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -1
  333. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +4 -1
  334. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js.map +1 -1
  335. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.d.ts +2 -1
  336. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.d.ts.map +1 -1
  337. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +2 -2
  338. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js.map +1 -1
  339. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +4 -1
  340. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  341. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +16 -3
  342. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  343. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  344. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +4 -3
  345. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  346. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts +3 -1
  347. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  348. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.js +9 -3
  349. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
  350. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts +1 -1
  351. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
  352. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js +1 -1
  353. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
  354. package/node_modules/@earendil-works/pi-coding-agent/dist/core/experimental.d.ts +2 -0
  355. package/node_modules/@earendil-works/pi-coding-agent/dist/core/experimental.d.ts.map +1 -0
  356. package/node_modules/@earendil-works/pi-coding-agent/dist/core/experimental.js +4 -0
  357. package/node_modules/@earendil-works/pi-coding-agent/dist/core/experimental.js.map +1 -0
  358. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +19 -6
  359. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
  360. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
  361. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
  362. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.d.ts +1 -1
  363. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
  364. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +4 -4
  365. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
  366. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +10 -3
  367. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  368. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +47 -1
  369. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  370. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +28 -2
  371. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  372. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  373. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts +2 -0
  374. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.d.ts.map +1 -1
  375. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js +29 -1
  376. package/node_modules/@earendil-works/pi-coding-agent/dist/core/footer-data-provider.js.map +1 -1
  377. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.d.ts +1 -0
  378. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.d.ts.map +1 -1
  379. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.js +1 -0
  380. package/node_modules/@earendil-works/pi-coding-agent/dist/core/index.js.map +1 -1
  381. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
  382. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +1 -0
  383. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js.map +1 -1
  384. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts +1 -0
  385. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  386. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +44 -5
  387. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  388. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts +3 -0
  389. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  390. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +47 -13
  391. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  392. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.d.ts +15 -0
  393. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.d.ts.map +1 -0
  394. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +58 -0
  395. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js.map +1 -0
  396. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.d.ts +2 -1
  397. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
  398. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +24 -26
  399. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
  400. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-attribution.d.ts +4 -0
  401. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-attribution.d.ts.map +1 -0
  402. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-attribution.js +72 -0
  403. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-attribution.js.map +1 -0
  404. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-display-names.d.ts.map +1 -1
  405. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-display-names.js +3 -0
  406. package/node_modules/@earendil-works/pi-coding-agent/dist/core/provider-display-names.js.map +1 -1
  407. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts +13 -2
  408. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  409. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +112 -37
  410. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  411. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
  412. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +7 -33
  413. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js.map +1 -1
  414. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
  415. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +103 -70
  416. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js.map +1 -1
  417. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts +20 -2
  418. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  419. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +97 -30
  420. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  421. package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -1
  422. package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.js +1 -0
  423. package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.js.map +1 -1
  424. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  425. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +1 -1
  426. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  427. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  428. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +1 -1
  429. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  430. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  431. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +1 -1
  432. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
  433. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  434. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +1 -1
  435. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
  436. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  437. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +1 -1
  438. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  439. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  440. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +1 -1
  441. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  442. package/node_modules/@earendil-works/pi-coding-agent/dist/core/trust-manager.d.ts +36 -0
  443. package/node_modules/@earendil-works/pi-coding-agent/dist/core/trust-manager.d.ts.map +1 -0
  444. package/node_modules/@earendil-works/pi-coding-agent/dist/core/trust-manager.js +202 -0
  445. package/node_modules/@earendil-works/pi-coding-agent/dist/core/trust-manager.js.map +1 -0
  446. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +5 -4
  447. package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts.map +1 -1
  448. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js +2 -1
  449. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js.map +1 -1
  450. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  451. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +72 -32
  452. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  453. package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.d.ts.map +1 -1
  454. package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.js +39 -34
  455. package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.js.map +1 -1
  456. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/index.d.ts +1 -1
  457. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/index.d.ts.map +1 -1
  458. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/index.js.map +1 -1
  459. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  460. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +2 -2
  461. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
  462. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  463. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  464. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/first-time-setup.js +103 -0
  465. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  466. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
  467. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +7 -0
  468. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
  469. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.d.ts +2 -0
  470. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -1
  471. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.js +2 -0
  472. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/index.js.map +1 -1
  473. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +1 -1
  474. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  475. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +10 -13
  476. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
  477. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  478. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  479. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +20 -0
  480. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
  481. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  482. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +22 -0
  483. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  484. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  485. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  486. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/trust-selector.js +91 -0
  487. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/trust-selector.js.map +1 -0
  488. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +7 -0
  489. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  490. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +101 -5
  491. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  492. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
  493. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js +1 -0
  494. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
  495. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  496. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +1 -0
  497. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
  498. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts +6 -2
  499. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
  500. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +111 -10
  501. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
  502. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts +1 -0
  503. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
  504. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js +78 -0
  505. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js.map +1 -1
  506. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/git.d.ts.map +1 -1
  507. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/git.js +54 -22
  508. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/git.js.map +1 -1
  509. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/open-browser.d.ts +9 -0
  510. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/open-browser.d.ts.map +1 -0
  511. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/open-browser.js +22 -0
  512. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/open-browser.js.map +1 -0
  513. package/node_modules/@earendil-works/pi-coding-agent/docs/containerization.md +111 -0
  514. package/node_modules/@earendil-works/pi-coding-agent/docs/docs.json +8 -0
  515. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +67 -13
  516. package/node_modules/@earendil-works/pi-coding-agent/docs/index.md +2 -0
  517. package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +4 -3
  518. package/node_modules/@earendil-works/pi-coding-agent/docs/packages.md +1 -1
  519. package/node_modules/@earendil-works/pi-coding-agent/docs/prompt-templates.md +9 -2
  520. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +5 -0
  521. package/node_modules/@earendil-works/pi-coding-agent/docs/rpc.md +1 -1
  522. package/node_modules/@earendil-works/pi-coding-agent/docs/sdk.md +5 -0
  523. package/node_modules/@earendil-works/pi-coding-agent/docs/security.md +59 -0
  524. package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +15 -0
  525. package/node_modules/@earendil-works/pi-coding-agent/docs/skills.md +1 -1
  526. package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +36 -2
  527. package/node_modules/@earendil-works/pi-coding-agent/docs/themes.md +1 -1
  528. package/node_modules/@earendil-works/pi-coding-agent/docs/tmux.md +4 -2
  529. package/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +10 -1
  530. package/node_modules/@earendil-works/pi-coding-agent/docs/usage.md +19 -2
  531. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/README.md +2 -0
  532. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-header.ts +1 -1
  533. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  534. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  535. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/doom-overlay/index.ts +1 -1
  536. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/index.ts +531 -0
  537. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +185 -0
  538. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +19 -0
  539. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/handoff.ts +1 -1
  540. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/interactive-shell.ts +1 -1
  541. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/overlay-qa-tests.ts +152 -81
  542. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/project-trust.ts +64 -0
  543. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/qna.ts +1 -1
  544. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/question.ts +1 -1
  545. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/questionnaire.ts +1 -1
  546. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  547. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/snake.ts +1 -1
  548. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/space-invaders.ts +1 -1
  549. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/summarize.ts +1 -1
  550. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/tic-tac-toe.ts +1 -1
  551. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/todo.ts +1 -1
  552. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/tools.ts +5 -0
  553. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  554. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +12 -419
  555. package/node_modules/@earendil-works/pi-coding-agent/package.json +5 -8
  556. package/node_modules/@earendil-works/pi-tui/README.md +13 -1
  557. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +2 -0
  558. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  559. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  560. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -1
  561. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  562. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +102 -43
  563. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  564. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +2 -1
  565. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  566. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -1
  567. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  568. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +1 -1
  569. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
  570. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +2 -2
  571. package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
  572. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
  573. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  574. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  575. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +4 -7
  576. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  577. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -77
  578. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  579. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +20 -4
  580. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  581. package/node_modules/@earendil-works/pi-tui/dist/tui.js +244 -42
  582. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  583. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +1 -0
  584. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  585. package/node_modules/@earendil-works/pi-tui/dist/utils.js +46 -15
  586. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  587. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  588. package/package.json +8 -7
  589. package/dist/forge-payload/.base-pack/commands/check-agent.md +0 -22
  590. package/dist/forge-payload/.base-pack/commands/enhance.md +0 -37
@@ -0,0 +1,370 @@
1
+ // task-phase-dispatch.ts — per-phase subagent dispatch for the run-task
2
+ // pipeline: persona load → task-body compose → model resolution → viewport
3
+ // observer attach → context-governor injection → runForgeSubagent (IL10) →
4
+ // post-subagent abort / halt-on-failure detection. Extracted VERBATIM from
5
+ // run-task.ts's phase loop (FORGE-S31 file-size refactor) with no logic
6
+ // changes — the inline `return {...}` paths now return `{ kind: "return";
7
+ // result }`, and the success path returns `{ kind: "ok"; ... }` carrying the
8
+ // live locals the loop needs (subagent result, finishPhaseNode closure,
9
+ // observer, phaseStart, writeDebug).
10
+ //
11
+ // IL10 — ALL LLM dispatch goes through runForgeSubagent (NO sendKickoff here).
12
+ import * as fs from "node:fs";
13
+ import * as path from "node:path";
14
+ import { CallerContextStore } from "../../audience-gate.js";
15
+ import { buildGovernorFactory } from "../../context-governor.js";
16
+ import { buildForgeCompactionFactory } from "../../context-governor-compaction.js";
17
+ import { loadForgePersona, runForgeSubagent } from "../../forge-subagent.js";
18
+ import { getSubagentTools } from "../../forge-tools.js";
19
+ import { resolveModelForPhase } from "../../config/model-resolver.js";
20
+ import { getOrchestratorTree } from "../../orchestrator-tree.js";
21
+ import { attachViewportObserver } from "../../viewport/events.js";
22
+ import { composeTaskBody, buildSummariesBlock } from "./task-body.js";
23
+ import { emitIncompletePhaseEvent } from "./task-events.js";
24
+ import { PHASES } from "./task-phases.js";
25
+ import { readTaskRecord } from "./task-record.js";
26
+ import { writeState } from "./task-state.js";
27
+ const STATUS_KEY = "forge:run-task";
28
+ const MESSAGE_KEY = "forge:run-task:message";
29
+ /**
30
+ * Run a single phase's subagent dispatch and classify the immediate outcome
31
+ * (persona-load failure, subagent throw, cancellation, or non-zero exit) into
32
+ * a discriminated result. On success returns `kind: "ok"` with the live locals
33
+ * the caller's loop needs for verdict/postflight handling and advance.
34
+ */
35
+ export async function dispatchPhase(p) {
36
+ const { opts, phase, taskId, cwd, ctx, storeCli, currentPhaseIndex, iterationCounts, dispatchCounts, modelRoutingConfig, registry, cacheSessionId, taskRecordAtStart, } = p;
37
+ const tree = getOrchestratorTree();
38
+ // ── Persona load ──────────────────────────────────────────────
39
+ let persona;
40
+ try {
41
+ persona = loadForgePersona(phase.personaNoun, cwd);
42
+ }
43
+ catch (err) {
44
+ const e = err;
45
+ ctx.ui.notify(`× forge:run-task — persona '${phase.personaNoun}' not found for phase ${phase.role}: ${e.message ?? "unknown"}. ` +
46
+ "Run /forge:regenerate to materialize persona files.", "error");
47
+ writeState(cwd, {
48
+ taskId,
49
+ phaseIndex: currentPhaseIndex,
50
+ iterationCounts,
51
+ halted: true,
52
+ lastError: `persona load failed: ${e.message ?? "unknown"}`,
53
+ savedAt: new Date().toISOString(),
54
+ });
55
+ return {
56
+ kind: "return",
57
+ result: {
58
+ status: "failed",
59
+ lastPhaseIndex: currentPhaseIndex,
60
+ iterationCounts,
61
+ lastError: `persona load failed: ${e.message ?? "unknown"}`,
62
+ },
63
+ };
64
+ }
65
+ // ── 4. Dispatch via runForgeSubagent (IL10) ───────────────────
66
+ // NEVER sendKickoff here — that would reproduce issue #30 (same-context inline = no fork).
67
+ // Read fresh task record to carry forward prior phase summaries (forge-cli#19).
68
+ const taskRecordForSummaries = currentPhaseIndex > 0 ? readTaskRecord(taskId, storeCli, cwd) : null;
69
+ const summariesBlock = buildSummariesBlock(taskRecordForSummaries?.summaries);
70
+ const taskBody = composeTaskBody(p.subWorkflowMd, taskId, summariesBlock || undefined);
71
+ // Log whether carry-forward summaries were injected (forge-cli#19).
72
+ if (summariesBlock) {
73
+ const debugCarryPath = path.join(cwd, ".forge", "cache", `run-task-debug-${taskId}.jsonl`);
74
+ try {
75
+ fs.mkdirSync(path.dirname(debugCarryPath), { recursive: true });
76
+ fs.appendFileSync(debugCarryPath, `${JSON.stringify({ ts: new Date().toISOString(), phase: phase.role, kind: "carry_forward_injected", summariesLength: summariesBlock.length, summariesBlock })}\n`, "utf8");
77
+ }
78
+ catch {
79
+ /* best-effort debug log */
80
+ }
81
+ }
82
+ // Resolve per-phase model from layered config (Plan 16 Slice 2).
83
+ // Pipeline name "default" matches the Forge plugin's shipped pipeline.
84
+ // When config is absent or cascade bottoms out, resolves to inherit
85
+ // (model: undefined) — setModel is skipped and pi's current model is used.
86
+ const modelResolution = resolveModelForPhase("default", phase.role, phase.personaNoun, modelRoutingConfig);
87
+ const dispatchModelLabel = modelResolution.model
88
+ ? `${modelResolution.model.provider}:${modelResolution.model.model}`
89
+ : "inherit";
90
+ ctx.ui.notify(` dispatch: persona=${phase.personaNoun} · model=${dispatchModelLabel} [${modelResolution.source}]`, "info");
91
+ const phaseStart = Date.now();
92
+ // Stabilization debug log — every subagent event appended as JSONL.
93
+ const debugLogPath = path.join(cwd, ".forge", "cache", `run-task-debug-${taskId}.jsonl`);
94
+ const writeDebug = (rec) => {
95
+ try {
96
+ fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });
97
+ fs.appendFileSync(debugLogPath, `${JSON.stringify({ ts: new Date().toISOString(), phase: phase.role, ...rec })}\n`, "utf8");
98
+ }
99
+ catch {
100
+ // non-fatal; debug log is best-effort
101
+ }
102
+ };
103
+ writeDebug({ kind: "phase_start", phaseIndex: currentPhaseIndex });
104
+ writeDebug({
105
+ kind: "requested_model",
106
+ requested: modelResolution.model ?? null,
107
+ source: modelResolution.source,
108
+ persona: phase.personaNoun,
109
+ });
110
+ registry.startPhase(taskId, phase.role, currentPhaseIndex);
111
+ // Bridge: register phase in OrchestratorTree. Node identity is
112
+ // per-dispatch (see dispatchCounts above) — never reuse an ID for a
113
+ // re-dispatched role.
114
+ const iteration = (dispatchCounts[phase.role] = (dispatchCounts[phase.role] ?? 0) + 1);
115
+ const phaseNodeId = `${taskId}:${phase.role}:${iteration}`;
116
+ tree.startNode(phaseNodeId, {
117
+ parentId: taskId,
118
+ label: `${phase.role}:${iteration}`,
119
+ kind: "leaf",
120
+ // Full body — display clamping/expansion is the view's decision
121
+ // (the tree applies only a storage cap).
122
+ promptPreview: taskBody,
123
+ });
124
+ // Capture the first stream-observed model on turn_end (IL10 visibility).
125
+ // If pi auto-substitutes or setModel silently no-ops, this line will diverge
126
+ // from requested_model — exactly the diagnostic signal we want.
127
+ let modelObservedLogged = false;
128
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
129
+ const wrappedOnEvent = (event) => {
130
+ if (!modelObservedLogged && event?.type === "turn_end" && typeof event?.message?.model === "string") {
131
+ modelObservedLogged = true;
132
+ writeDebug({
133
+ kind: "model_observed",
134
+ provider: event.message.provider ?? null,
135
+ model: event.message.model,
136
+ });
137
+ }
138
+ observer.onEvent(event);
139
+ };
140
+ const refreshStatus = () => {
141
+ if (process.env.FORGE_VERBOSE !== "1")
142
+ return;
143
+ const elapsed = Math.floor((Date.now() - phaseStart) / 1000);
144
+ const tail = observer.state.lastTool ? ` · ${observer.state.lastTool}` : "";
145
+ ctx.ui.setStatus?.(STATUS_KEY, `run-task ${taskId}: ${phase.role} · t${observer.state.turn} · tools ${observer.state.toolCount}${observer.state.errCount ? ` · err ${observer.state.errCount}` : ""} · ${elapsed}s${tail}`);
146
+ };
147
+ const observer = attachViewportObserver({
148
+ registry,
149
+ sessionId: taskId,
150
+ phaseRole: phase.role,
151
+ nodeId: phaseNodeId,
152
+ beginHeader: `─── phase ${currentPhaseIndex + 1}/${PHASES.length} ${phase.role} begin · ${taskId} ───`,
153
+ writeDebug,
154
+ notify: (msg, level) => ctx.ui.notify(msg, level),
155
+ setStatusVerbose: process.env.FORGE_VERBOSE === "1" ? (k, v) => ctx.ui.setStatus?.(k, v) : undefined,
156
+ verboseKeys: { messageKey: MESSAGE_KEY },
157
+ afterEach: refreshStatus,
158
+ });
159
+ // ── Context governor injection (completes FORGE-S30-T07) ──────
160
+ // Per-phase factories built HERE because only the pipeline knows the
161
+ // `${personaNoun}/${role}` phase key — pi never sets persona/phase on
162
+ // ExtensionContext, and the parent session's registerHookDispatcher
163
+ // governor never sees subagent tool traffic (dormant-governor defect,
164
+ // CART-S02-T03 benchmark). Flag-gated: FORGE_CTX_GOVERNOR=1.
165
+ // buildGovernorFactory — Mechanisms A/B/C/D in the subagent
166
+ // buildForgeCompactionFactory — Mechanism E with warm-tier path opts
167
+ // (previously injected from index.ts with NO opts → warm-tier dead)
168
+ const phaseKey = `${phase.personaNoun}/${phase.role}`;
169
+ // Sprint ID from the task record's sprint FK (the store owns that
170
+ // relationship); the taskId-shape regex is only a fallback for records
171
+ // missing the FK (FORGE-BUG-043 PR 2).
172
+ const sprintIdForSummaries = taskRecordAtStart?.sprintId ?? /^(.*)-T\d+$/.exec(taskId)?.[1];
173
+ const governorFactories = process.env.FORGE_CTX_GOVERNOR === "1"
174
+ ? [
175
+ buildGovernorFactory({ phaseKey, cwd }),
176
+ buildForgeCompactionFactory({
177
+ cwd,
178
+ phaseKey,
179
+ entityId: taskId,
180
+ sprintId: sprintIdForSummaries,
181
+ }),
182
+ ]
183
+ : [];
184
+ const phaseExtensionFactories = [...(opts.extensionFactories ?? []), ...governorFactories];
185
+ let result;
186
+ try {
187
+ // FORGE-BUG-040: wrap the runForgeSubagent dispatch in the phase
188
+ // caller context (parity with fix-bug.ts) so the phase-ownership
189
+ // guard can verify tool calls from the subagent. Single setter
190
+ // of phase context for the task pipeline.
191
+ result = await CallerContextStore.asSubagent(phase.role, () => runForgeSubagent({
192
+ persona,
193
+ task: taskBody,
194
+ cwd,
195
+ exportTag: `${taskId}__${phase.role}`,
196
+ tailLog: observer.state.tailLog,
197
+ cacheSessionId,
198
+ streamFn: opts.streamFnFactory?.({
199
+ kind: "task-phase",
200
+ persona: persona.name,
201
+ phase: phase.role,
202
+ taskId,
203
+ }),
204
+ onEvent: wrappedOnEvent,
205
+ requestedModel: modelResolution.model,
206
+ modelRegistry: ctx.modelRegistry,
207
+ signal: opts.signal,
208
+ customTools: opts.forgeToolDefs ? getSubagentTools(opts.forgeToolDefs, persona.name) : undefined,
209
+ extensionFactories: phaseExtensionFactories.length > 0 ? phaseExtensionFactories : undefined,
210
+ }));
211
+ }
212
+ catch (err) {
213
+ const e = err;
214
+ ctx.ui.notify(`× forge:run-task — runForgeSubagent threw for phase ${phase.role}: ${e.message ?? "unknown"}`, "error");
215
+ tree.completeNode(phaseNodeId, "failed");
216
+ writeState(cwd, {
217
+ taskId,
218
+ phaseIndex: currentPhaseIndex,
219
+ iterationCounts,
220
+ halted: true,
221
+ lastError: `runForgeSubagent threw: ${e.message ?? "unknown"}`,
222
+ savedAt: new Date().toISOString(),
223
+ });
224
+ return {
225
+ kind: "return",
226
+ result: {
227
+ status: "failed",
228
+ lastPhaseIndex: currentPhaseIndex,
229
+ iterationCounts,
230
+ lastError: `runForgeSubagent threw: ${e.message ?? "unknown"}`,
231
+ },
232
+ };
233
+ }
234
+ // Close this dispatch's tree node with final usage/model — MUST be
235
+ // called on every exit path below (failure, halt, escalation,
236
+ // loopback, advance). A node left `running` keeps a live spinner in
237
+ // the dashboard forever AND absorbs the next same-role dispatch's
238
+ // telemetry via the observer's legacy role-prefix scan.
239
+ const finishPhaseNode = (status) => {
240
+ tree.setNodeUsage(phaseNodeId, {
241
+ input: result.usage.input,
242
+ output: result.usage.output,
243
+ cacheRead: result.usage.cacheRead,
244
+ });
245
+ if (result.model)
246
+ tree.setNodeModel(phaseNodeId, result.model, result.provider ?? "");
247
+ tree.completeNode(phaseNodeId, status);
248
+ };
249
+ // ── Post-subagent abort detection ─────────────────────────────────
250
+ // If the abort signal fired during the subagent run, treat it as
251
+ // cancellation regardless of the exit code (subagent may have been
252
+ // mid-turn when aborted — exitCode could be 0 or 1).
253
+ // This check MUST come before halt-on-failure so that
254
+ // stopReason="aborted" + exitCode=1 is classified as cancellation,
255
+ // not a phase failure.
256
+ if (result.stopReason === "aborted" || opts.signal?.aborted) {
257
+ ctx.ui.notify(`⊘ forge:run-task — ${taskId} phase ${phase.role} cancelled.`, "info");
258
+ registry.completePhase(taskId, phase.role, "cancelled");
259
+ tree.completeNode(phaseNodeId, "cancelled");
260
+ registry.confirmCancelled(taskId);
261
+ // Bug B: account the billed tokens of this aborted attempt before returning.
262
+ {
263
+ const abortSprintId = readTaskRecord(taskId, storeCli, cwd)?.sprintId;
264
+ if (abortSprintId) {
265
+ emitIncompletePhaseEvent({
266
+ emitCtx: {
267
+ entityType: "task",
268
+ taskId,
269
+ sprintId: abortSprintId,
270
+ phase,
271
+ iteration: (iterationCounts[phase.role] ?? 0) + 1,
272
+ startMs: phaseStart,
273
+ endMs: Date.now(),
274
+ model: result.model ?? "unknown",
275
+ provider: result.provider ?? "unknown",
276
+ usage: {
277
+ input: result.usage.input,
278
+ output: result.usage.output,
279
+ cacheRead: result.usage.cacheRead,
280
+ cacheWrite: result.usage.cacheWrite,
281
+ },
282
+ judgement: undefined,
283
+ storeCli,
284
+ cwd,
285
+ },
286
+ outcome: "aborted",
287
+ notes: result.errorMessage ?? result.stopReason ?? undefined,
288
+ onDebug: writeDebug,
289
+ });
290
+ }
291
+ else {
292
+ writeDebug({ kind: "incomplete_emit_skipped", reason: "no-sprintId", outcome: "aborted" });
293
+ }
294
+ }
295
+ // ADR-S21-01: preserve state file so cancelled runs are resumable
296
+ writeState(cwd, {
297
+ taskId,
298
+ phaseIndex: currentPhaseIndex,
299
+ iterationCounts,
300
+ halted: false,
301
+ status: "cancelled",
302
+ lastError: undefined,
303
+ savedAt: new Date().toISOString(),
304
+ });
305
+ return {
306
+ kind: "return",
307
+ result: { status: "cancelled", lastPhaseIndex: currentPhaseIndex, iterationCounts },
308
+ };
309
+ }
310
+ // ── Halt-on-failure ───────────────────────────────────────────
311
+ if (result.exitCode !== 0) {
312
+ ctx.ui.notify(`× forge:run-task — phase ${phase.role} failed (exit ${result.exitCode})` +
313
+ (result.errorMessage ? `: ${result.errorMessage}` : "") +
314
+ (result.stopReason ? ` [${result.stopReason}]` : ""), "error");
315
+ finishPhaseNode("failed");
316
+ // Bug B: account the billed tokens of this failed attempt before returning.
317
+ {
318
+ const failSprintId = readTaskRecord(taskId, storeCli, cwd)?.sprintId;
319
+ if (failSprintId) {
320
+ emitIncompletePhaseEvent({
321
+ emitCtx: {
322
+ entityType: "task",
323
+ taskId,
324
+ sprintId: failSprintId,
325
+ phase,
326
+ iteration: (iterationCounts[phase.role] ?? 0) + 1,
327
+ startMs: phaseStart,
328
+ endMs: Date.now(),
329
+ model: result.model ?? "unknown",
330
+ provider: result.provider ?? "unknown",
331
+ usage: {
332
+ input: result.usage.input,
333
+ output: result.usage.output,
334
+ cacheRead: result.usage.cacheRead,
335
+ cacheWrite: result.usage.cacheWrite,
336
+ },
337
+ judgement: undefined,
338
+ storeCli,
339
+ cwd,
340
+ },
341
+ outcome: "failed",
342
+ notes: result.errorMessage ?? result.stopReason ?? undefined,
343
+ onDebug: writeDebug,
344
+ });
345
+ }
346
+ else {
347
+ writeDebug({ kind: "incomplete_emit_skipped", reason: "no-sprintId", outcome: "failed" });
348
+ }
349
+ }
350
+ writeState(cwd, {
351
+ taskId,
352
+ phaseIndex: currentPhaseIndex,
353
+ iterationCounts,
354
+ halted: true,
355
+ lastError: result.errorMessage ?? result.stopReason ?? "subagent exit non-zero",
356
+ savedAt: new Date().toISOString(),
357
+ });
358
+ return {
359
+ kind: "return",
360
+ result: {
361
+ status: "failed",
362
+ lastPhaseIndex: currentPhaseIndex,
363
+ iterationCounts,
364
+ lastError: result.errorMessage ?? result.stopReason ?? "subagent exit non-zero",
365
+ },
366
+ };
367
+ }
368
+ return { kind: "ok", result, finishPhaseNode, observer, phaseStart, writeDebug };
369
+ }
370
+ //# sourceMappingURL=task-phase-dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-phase-dispatch.js","sourceRoot":"","sources":["../../../../../src/extensions/forgecli/orchestrators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AAI,SAAS;oBAC5D,OAAO,EAAE,UAAU;iBACnB,CAAC,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACP,UAAU,CAAC,EAAE,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC3F,CAAC;QACF,CAAC;QACD,UAAU,CAAC,GAAG,EAAE;YACf,MAAM;YACN,UAAU,EAAE,iBAAiB;YAC7B,eAAe;YACf,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,IAAI,wBAAwB;YAC/E,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACjC,CAAC,CAAC;QACH,OAAO;YACN,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE;gBACP,MAAM,EAAE,QAAQ;gBAChB,cAAc,EAAE,iBAAiB;gBACjC,eAAe;gBACf,SAAS,EAAE,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,IAAI,wBAAwB;aAC/E;SACD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAClF,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface PhaseDescriptor {
2
+ /** Workflow role name (also used as key for summaries and iteration tracking). */
3
+ role: string;
4
+ /** Filename under .forge/workflows/ (without extension). */
5
+ workflowFile: string;
6
+ /** Persona noun passed to loadForgePersona. */
7
+ personaNoun: string;
8
+ /** When true: read summaries.<role>.verdict after dispatch. */
9
+ isReview: boolean;
10
+ /** Max revision iterations before escalation. */
11
+ maxIterations: number;
12
+ }
13
+ export declare const PHASES: PhaseDescriptor[];
14
+ export declare const SUMMARY_KEY_BY_ROLE: Record<string, string | null>;
15
+ export declare const PHASE_PRE_STATUS: Record<string, string>;
16
+ /** Index of a phase in the PHASES table by role, or -1 if unknown. */
17
+ export declare function phaseIndexByRole(role: string): number;
@@ -0,0 +1,48 @@
1
+ // task-phases.ts — phase descriptor table for the /forge:run-task pipeline.
2
+ // Extracted from run-task.ts (no logic changes). run-task.ts re-exports these.
3
+ export const PHASES = [
4
+ { role: "plan", workflowFile: "plan_task", personaNoun: "engineer", isReview: false, maxIterations: 1 },
5
+ { role: "review-plan", workflowFile: "review_plan", personaNoun: "supervisor", isReview: true, maxIterations: 3 },
6
+ { role: "implement", workflowFile: "implement_plan", personaNoun: "engineer", isReview: false, maxIterations: 1 },
7
+ { role: "review-code", workflowFile: "review_code", personaNoun: "supervisor", isReview: true, maxIterations: 3 },
8
+ { role: "validate", workflowFile: "validate_task", personaNoun: "qa-engineer", isReview: true, maxIterations: 3 },
9
+ { role: "approve", workflowFile: "architect_approve", personaNoun: "architect", isReview: true, maxIterations: 3 },
10
+ { role: "writeback", workflowFile: "collator_agent", personaNoun: "collator", isReview: false, maxIterations: 1 },
11
+ { role: "commit", workflowFile: "commit_task", personaNoun: "engineer", isReview: false, maxIterations: 1 },
12
+ ];
13
+ // Map phase.role → canonical summary key written by base-pack workflows
14
+ // (see forge/forge/tools/store-cli.cjs VALID_SUMMARY_PHASES). Phases whose
15
+ // workflows do not write a summaries entry (e.g. approve, which transitions
16
+ // task.status=approved instead) map to null and are verdict-checked via
17
+ // task status rather than the summaries map.
18
+ export const SUMMARY_KEY_BY_ROLE = {
19
+ plan: "plan",
20
+ "review-plan": "review_plan",
21
+ implement: "implementation",
22
+ "review-code": "code_review",
23
+ validate: "validation",
24
+ approve: null,
25
+ };
26
+ // FEAT-009 (halt-recovery UX): the task status a record must hold for a given
27
+ // phase to (re-)run — i.e. the status `resetPipelineState` sets when rewinding
28
+ // the pipeline to that phase. Each value is within the documented step-0b
29
+ // "Allowed states for this phase" set of the corresponding workflow
30
+ // (.forge/workflows/<workflowFile>.md), so the phase's own guard accepts it:
31
+ // plan/review-plan → planned implement → plan-approved
32
+ // review-code → implemented validate/approve → review-approved
33
+ // writeback/commit → approved
34
+ export const PHASE_PRE_STATUS = {
35
+ plan: "planned",
36
+ "review-plan": "planned",
37
+ implement: "plan-approved",
38
+ "review-code": "implemented",
39
+ validate: "review-approved",
40
+ approve: "review-approved",
41
+ writeback: "approved",
42
+ commit: "approved",
43
+ };
44
+ /** Index of a phase in the PHASES table by role, or -1 if unknown. */
45
+ export function phaseIndexByRole(role) {
46
+ return PHASES.findIndex((p) => p.role === role);
47
+ }
48
+ //# sourceMappingURL=task-phases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-phases.js","sourceRoot":"","sources":["../../../../../src/extensions/forgecli/orchestrators/task/task-phases.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAoB/E,MAAM,CAAC,MAAM,MAAM,GAAsB;IACxC,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE;IACvG,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE;IACjH,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE;IACjH,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE;IACjH,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE;IACjH,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,EAAE,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n/a" | "missing";
2
+ export declare function readVerdict(taskId: string, phaseRole: string, storeCli: string, cwd: string): Verdict;
3
+ export interface TaskRecord {
4
+ sprintId?: string;
5
+ status?: string;
6
+ summaries?: Record<string, unknown>;
7
+ }
8
+ export declare function readTaskRecord(taskId: string, storeCli: string, cwd: string): TaskRecord | null;
9
+ export {};
@@ -0,0 +1,58 @@
1
+ // task-record.ts — store-cli verdict + task-record reads for the run-task
2
+ // pipeline. Extracted from run-task.ts (no logic changes). run-task.ts
3
+ // re-exports these.
4
+ import { spawnSync } from "node:child_process";
5
+ import { SUMMARY_KEY_BY_ROLE } from "./task-phases.js";
6
+ export function readVerdict(taskId, phaseRole, storeCli, cwd) {
7
+ const result = spawnSync("node", [storeCli, "read", "task", taskId], { cwd, encoding: "utf8" });
8
+ if (result.status !== 0)
9
+ return "missing";
10
+ try {
11
+ const raw = typeof result.stdout === "string" ? result.stdout : String(result.stdout);
12
+ const record = JSON.parse(raw);
13
+ // Phases like `approve` do not write a summaries entry; they
14
+ // transition task.status to "approved" instead. For those, the
15
+ // verdict source is task.status.
16
+ const summaryKey = SUMMARY_KEY_BY_ROLE[phaseRole];
17
+ if (summaryKey === null) {
18
+ return record.status === "approved" ? "approved" : "missing";
19
+ }
20
+ // Verdict lookup with three fallbacks:
21
+ // 1. Canonical mapped summary key (e.g. "code_review" for review-code).
22
+ // 2. Underscore-swapped phase role ("review_code") — legacy/defensive.
23
+ // 3. Raw hyphenated phase role ("review-code") — defensive only.
24
+ const summaries = record.summaries ?? {};
25
+ const underscoreKey = phaseRole.replace(/-/g, "_");
26
+ const candidates = [summaryKey ?? "", underscoreKey, phaseRole].filter(Boolean);
27
+ let verdict;
28
+ for (const k of candidates) {
29
+ if (summaries[k]?.verdict) {
30
+ verdict = summaries[k].verdict;
31
+ break;
32
+ }
33
+ }
34
+ if (!verdict)
35
+ return "missing";
36
+ if (verdict === "approved")
37
+ return "approved";
38
+ if (verdict === "revision")
39
+ return "revision";
40
+ return "missing";
41
+ }
42
+ catch {
43
+ return "missing";
44
+ }
45
+ }
46
+ export function readTaskRecord(taskId, storeCli, cwd) {
47
+ const result = spawnSync("node", [storeCli, "read", "task", taskId], { cwd, encoding: "utf8" });
48
+ if (result.status !== 0)
49
+ return null;
50
+ try {
51
+ const raw = typeof result.stdout === "string" ? result.stdout : String(result.stdout);
52
+ return JSON.parse(raw);
53
+ }
54
+ catch {
55
+ return null;
56
+ }
57
+ }
58
+ //# sourceMappingURL=task-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-record.js","sourceRoot":"","sources":["../../../../../src/extensions/forgecli/orchestrators/task/task-record.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,uEAAuE;AACvE,oBAAoB;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,SAAiB,EAAE,QAAgB,EAAE,GAAW;IAC3F,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAChG,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC;QACJ,MAAM,GAAG,GAAW,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9F,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAG5B,CAAC;QAEF,6DAA6D;QAC7D,+DAA+D;QAC/D,iCAAiC;QACjC,MAAM,UAAU,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,UAAU,KAA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IAAI,CAAC;QACJ,MAAM,GAAG,GAAW,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAe,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface RunTaskState {
2
+ taskId: string;
3
+ phaseIndex: number;
4
+ iterationCounts: Record<string, number>;
5
+ halted: boolean;
6
+ /** Set on cancellation so the resume prompt can say "cancelled" vs "halted". */
7
+ status?: "cancelled" | "halted" | "running";
8
+ lastError?: string;
9
+ savedAt: string;
10
+ }
11
+ export declare function readState(cwd: string, taskId: string): RunTaskState | null;
12
+ export declare function writeState(cwd: string, state: RunTaskState): void;
13
+ export declare function deleteState(cwd: string, taskId: string): void;
14
+ export declare function isStateStale(state: RunTaskState): boolean;
@@ -0,0 +1,35 @@
1
+ // task-state.ts — run-task state persistence. Extracted from run-task.ts
2
+ // (no logic changes). run-task.ts re-exports these; run-sprint.ts imports
3
+ // readState as readTaskState from the barrel.
4
+ import * as fs from "node:fs";
5
+ import { isStateStale as isJsonStateStale, readJsonState, taskStateFilePath, writeJsonState, } from "../../lib/state-helpers.js";
6
+ import { validateId } from "../common/orchestrator-misc.js";
7
+ // FORGE-S25-T16 (N-H-B): state helpers delegate to lib/state-helpers.ts.
8
+ // Public API (readState, writeState, deleteState, isStateStale) is preserved —
9
+ // run-sprint.ts imports readState as readTaskState from this file.
10
+ function stateFilePath(cwd, taskId) {
11
+ if (!validateId(taskId)) {
12
+ throw new Error(`Invalid taskId for state file path: ${taskId}`);
13
+ }
14
+ return taskStateFilePath(cwd, taskId);
15
+ }
16
+ export function readState(cwd, taskId) {
17
+ return readJsonState(stateFilePath(cwd, taskId));
18
+ }
19
+ export function writeState(cwd, state) {
20
+ writeJsonState(stateFilePath(cwd, state.taskId), state);
21
+ }
22
+ export function deleteState(cwd, taskId) {
23
+ const fp = stateFilePath(cwd, taskId);
24
+ try {
25
+ if (fs.existsSync(fp))
26
+ fs.unlinkSync(fp);
27
+ }
28
+ catch {
29
+ // non-fatal
30
+ }
31
+ }
32
+ export function isStateStale(state) {
33
+ return isJsonStateStale(state.savedAt);
34
+ }
35
+ //# sourceMappingURL=task-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-state.js","sourceRoot":"","sources":["../../../../../src/extensions/forgecli/orchestrators/task/task-state.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,0EAA0E;AAC1E,8CAA8C;AAE9C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EACN,YAAY,IAAI,gBAAgB,EAChC,aAAa,EACb,iBAAiB,EACjB,cAAc,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAe5D,yEAAyE;AACzE,+EAA+E;AAC/E,mEAAmE;AAEnE,SAAS,aAAa,CAAC,GAAW,EAAE,MAAc;IACjD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,MAAc;IACpD,OAAO,aAAa,CAAe,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,KAAmB;IAC1D,cAAc,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,MAAc;IACtD,MAAM,EAAE,GAAG,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACtC,IAAI,CAAC;QACJ,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;YAAE,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACR,YAAY;IACb,CAAC;AACF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAmB;IAC/C,OAAO,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
+ import type { MergedConfig } from "../../config/config-layer.js";
3
+ import type { OrchestratorTranscriptWriter } from "../../subagent/orchestrator-transcript.js";
4
+ import { type PhaseDescriptor } from "./task-phases.js";
5
+ import type { RunTaskPipelineResult } from "./run-task-types.js";
6
+ export type VerdictLoopOutcome = {
7
+ kind: "advance";
8
+ } | {
9
+ kind: "loopback";
10
+ toIndex: number;
11
+ } | {
12
+ kind: "return";
13
+ result: RunTaskPipelineResult;
14
+ };
15
+ export interface VerdictLoopParams {
16
+ phase: PhaseDescriptor;
17
+ taskId: string;
18
+ storeCli: string;
19
+ cwd: string;
20
+ forgeRoot: string;
21
+ iterationCounts: Record<string, number>;
22
+ currentPhaseIndex: number;
23
+ modelRoutingConfig: MergedConfig;
24
+ ctx: ExtensionCommandContext;
25
+ orchTranscript: OrchestratorTranscriptWriter;
26
+ /** Closure that finalizes this dispatch's OrchestratorTree node. */
27
+ finishPhaseNode: (status: "completed" | "failed" | "escalated") => void;
28
+ /** Per-phase completion-recovery guard (forge-engineering#41) — roles that
29
+ * already consumed their one set-summary recovery attempt this run. */
30
+ recoveredPhases: Set<string>;
31
+ }
32
+ /**
33
+ * Evaluate the review-phase verdict and decide the loop's next move.
34
+ * Mirrors the inline block that previously lived in runTaskPipelineInner.
35
+ */
36
+ export declare function handleReviewVerdict(p: VerdictLoopParams): Promise<VerdictLoopOutcome>;