@cluesmith/codev 3.2.4 → 3.3.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 (358) hide show
  1. package/dashboard-dist/assets/index-BZRTEMtH.css +32 -0
  2. package/dashboard-dist/assets/{index-BZ1x7x1X.js → index-JCbkpAcV.js} +33 -33
  3. package/dashboard-dist/assets/index-JCbkpAcV.js.map +1 -0
  4. package/dashboard-dist/index.html +2 -2
  5. package/dist/agent-farm/cli.d.ts.map +1 -1
  6. package/dist/agent-farm/cli.js +142 -0
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  9. package/dist/agent-farm/commands/cleanup.js +16 -0
  10. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  11. package/dist/agent-farm/commands/inbox.d.ts +42 -0
  12. package/dist/agent-farm/commands/inbox.d.ts.map +1 -0
  13. package/dist/agent-farm/commands/inbox.js +129 -0
  14. package/dist/agent-farm/commands/inbox.js.map +1 -0
  15. package/dist/agent-farm/commands/interrupt.d.ts +20 -0
  16. package/dist/agent-farm/commands/interrupt.d.ts.map +1 -0
  17. package/dist/agent-farm/commands/interrupt.js +65 -0
  18. package/dist/agent-farm/commands/interrupt.js.map +1 -0
  19. package/dist/agent-farm/commands/reset/constants.d.ts +52 -0
  20. package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -0
  21. package/dist/agent-farm/commands/reset/constants.js +52 -0
  22. package/dist/agent-farm/commands/reset/constants.js.map +1 -0
  23. package/dist/agent-farm/commands/reset/context.d.ts +230 -0
  24. package/dist/agent-farm/commands/reset/context.d.ts.map +1 -0
  25. package/dist/agent-farm/commands/reset/context.js +428 -0
  26. package/dist/agent-farm/commands/reset/context.js.map +1 -0
  27. package/dist/agent-farm/commands/reset/index.d.ts +192 -0
  28. package/dist/agent-farm/commands/reset/index.d.ts.map +1 -0
  29. package/dist/agent-farm/commands/reset/index.js +488 -0
  30. package/dist/agent-farm/commands/reset/index.js.map +1 -0
  31. package/dist/agent-farm/commands/reset/receipt.d.ts +97 -0
  32. package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -0
  33. package/dist/agent-farm/commands/reset/receipt.js +149 -0
  34. package/dist/agent-farm/commands/reset/receipt.js.map +1 -0
  35. package/dist/agent-farm/commands/reset/reorient.d.ts +117 -0
  36. package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -0
  37. package/dist/agent-farm/commands/reset/reorient.js +313 -0
  38. package/dist/agent-farm/commands/reset/reorient.js.map +1 -0
  39. package/dist/agent-farm/commands/reset.d.ts +19 -0
  40. package/dist/agent-farm/commands/reset.d.ts.map +1 -0
  41. package/dist/agent-farm/commands/reset.js +292 -0
  42. package/dist/agent-farm/commands/reset.js.map +1 -0
  43. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  44. package/dist/agent-farm/commands/send.js +49 -8
  45. package/dist/agent-farm/commands/send.js.map +1 -1
  46. package/dist/agent-farm/commands/spawn-worktree.d.ts +105 -6
  47. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  48. package/dist/agent-farm/commands/spawn-worktree.js +289 -66
  49. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  50. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/spawn.js +13 -1
  52. package/dist/agent-farm/commands/spawn.js.map +1 -1
  53. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  54. package/dist/agent-farm/commands/status.js +80 -8
  55. package/dist/agent-farm/commands/status.js.map +1 -1
  56. package/dist/agent-farm/db/index.d.ts +1 -1
  57. package/dist/agent-farm/db/index.d.ts.map +1 -1
  58. package/dist/agent-farm/db/index.js +80 -1
  59. package/dist/agent-farm/db/index.js.map +1 -1
  60. package/dist/agent-farm/db/mailbox.d.ts +222 -0
  61. package/dist/agent-farm/db/mailbox.d.ts.map +1 -0
  62. package/dist/agent-farm/db/mailbox.js +304 -0
  63. package/dist/agent-farm/db/mailbox.js.map +1 -0
  64. package/dist/agent-farm/db/schema.d.ts +1 -1
  65. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  66. package/dist/agent-farm/db/schema.js +35 -0
  67. package/dist/agent-farm/db/schema.js.map +1 -1
  68. package/dist/agent-farm/db/types.d.ts +45 -0
  69. package/dist/agent-farm/db/types.d.ts.map +1 -1
  70. package/dist/agent-farm/db/types.js.map +1 -1
  71. package/dist/agent-farm/lib/builder-lookup.d.ts +1 -1
  72. package/dist/agent-farm/lib/builder-lookup.js +2 -2
  73. package/dist/agent-farm/lib/builder-lookup.js.map +1 -1
  74. package/dist/agent-farm/lib/reconnect-backoff.d.ts +54 -0
  75. package/dist/agent-farm/lib/reconnect-backoff.d.ts.map +1 -0
  76. package/dist/agent-farm/lib/reconnect-backoff.js +47 -0
  77. package/dist/agent-farm/lib/reconnect-backoff.js.map +1 -0
  78. package/dist/agent-farm/lib/tower-client.d.ts +16 -6
  79. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  80. package/dist/agent-farm/lib/tower-client.js +37 -6
  81. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  82. package/dist/agent-farm/lib/tunnel-client.d.ts +69 -1
  83. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
  84. package/dist/agent-farm/lib/tunnel-client.js +218 -27
  85. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  86. package/dist/agent-farm/servers/cron-delivery.d.ts +72 -0
  87. package/dist/agent-farm/servers/cron-delivery.d.ts.map +1 -0
  88. package/dist/agent-farm/servers/cron-delivery.js +80 -0
  89. package/dist/agent-farm/servers/cron-delivery.js.map +1 -0
  90. package/dist/agent-farm/servers/delayed-send.d.ts +85 -0
  91. package/dist/agent-farm/servers/delayed-send.d.ts.map +1 -0
  92. package/dist/agent-farm/servers/delayed-send.js +165 -0
  93. package/dist/agent-farm/servers/delayed-send.js.map +1 -0
  94. package/dist/agent-farm/servers/gate-profiles.d.ts +67 -0
  95. package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -0
  96. package/dist/agent-farm/servers/gate-profiles.js +113 -0
  97. package/dist/agent-farm/servers/gate-profiles.js.map +1 -0
  98. package/dist/agent-farm/servers/mailbox-delivery.d.ts +370 -0
  99. package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -0
  100. package/dist/agent-farm/servers/mailbox-delivery.js +617 -0
  101. package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -0
  102. package/dist/agent-farm/servers/mailbox-wiring.d.ts +125 -0
  103. package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -0
  104. package/dist/agent-farm/servers/mailbox-wiring.js +425 -0
  105. package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -0
  106. package/dist/agent-farm/servers/message-write.d.ts +53 -1
  107. package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
  108. package/dist/agent-farm/servers/message-write.js +63 -0
  109. package/dist/agent-farm/servers/message-write.js.map +1 -1
  110. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  111. package/dist/agent-farm/servers/overview.js +23 -4
  112. package/dist/agent-farm/servers/overview.js.map +1 -1
  113. package/dist/agent-farm/servers/render-gate.d.ts +141 -0
  114. package/dist/agent-farm/servers/render-gate.d.ts.map +1 -0
  115. package/dist/agent-farm/servers/render-gate.js +251 -0
  116. package/dist/agent-farm/servers/render-gate.js.map +1 -0
  117. package/dist/agent-farm/servers/session-submit.d.ts +90 -0
  118. package/dist/agent-farm/servers/session-submit.d.ts.map +1 -0
  119. package/dist/agent-farm/servers/session-submit.js +127 -0
  120. package/dist/agent-farm/servers/session-submit.js.map +1 -0
  121. package/dist/agent-farm/servers/tower-cron.d.ts +10 -7
  122. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  123. package/dist/agent-farm/servers/tower-cron.js +58 -53
  124. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  125. package/dist/agent-farm/servers/tower-instances.d.ts +14 -2
  126. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  127. package/dist/agent-farm/servers/tower-instances.js +78 -16
  128. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  129. package/dist/agent-farm/servers/tower-messages.d.ts +38 -1
  130. package/dist/agent-farm/servers/tower-messages.d.ts.map +1 -1
  131. package/dist/agent-farm/servers/tower-messages.js +106 -1
  132. package/dist/agent-farm/servers/tower-messages.js.map +1 -1
  133. package/dist/agent-farm/servers/tower-routes.d.ts +16 -4
  134. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  135. package/dist/agent-farm/servers/tower-routes.js +670 -105
  136. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  137. package/dist/agent-farm/servers/tower-server.js +163 -31
  138. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  139. package/dist/agent-farm/servers/tower-terminals.d.ts +17 -2
  140. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  141. package/dist/agent-farm/servers/tower-terminals.js +104 -122
  142. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  143. package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
  144. package/dist/agent-farm/servers/tower-tunnel.js +63 -4
  145. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  146. package/dist/agent-farm/servers/tower-types.d.ts +2 -1
  147. package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
  148. package/dist/agent-farm/servers/tower-utils.d.ts +64 -1
  149. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  150. package/dist/agent-farm/servers/tower-utils.js +168 -1
  151. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  152. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  153. package/dist/agent-farm/servers/tower-websocket.js +6 -21
  154. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  155. package/dist/agent-farm/servers/write-queue.d.ts +35 -0
  156. package/dist/agent-farm/servers/write-queue.d.ts.map +1 -0
  157. package/dist/agent-farm/servers/write-queue.js +56 -0
  158. package/dist/agent-farm/servers/write-queue.js.map +1 -0
  159. package/dist/agent-farm/types.d.ts +39 -0
  160. package/dist/agent-farm/types.d.ts.map +1 -1
  161. package/dist/agent-farm/utils/agent-names.d.ts +2 -2
  162. package/dist/agent-farm/utils/agent-names.d.ts.map +1 -1
  163. package/dist/agent-farm/utils/agent-names.js +3 -3
  164. package/dist/agent-farm/utils/agent-names.js.map +1 -1
  165. package/dist/agent-farm/utils/architect-name.d.ts +2 -2
  166. package/dist/agent-farm/utils/architect-name.d.ts.map +1 -1
  167. package/dist/agent-farm/utils/architect-name.js +3 -3
  168. package/dist/agent-farm/utils/architect-name.js.map +1 -1
  169. package/dist/agent-farm/utils/config.d.ts +13 -0
  170. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  171. package/dist/agent-farm/utils/config.js +33 -1
  172. package/dist/agent-farm/utils/config.js.map +1 -1
  173. package/dist/agent-farm/utils/harness.d.ts +103 -7
  174. package/dist/agent-farm/utils/harness.d.ts.map +1 -1
  175. package/dist/agent-farm/utils/harness.js +126 -19
  176. package/dist/agent-farm/utils/harness.js.map +1 -1
  177. package/dist/cli.d.ts.map +1 -1
  178. package/dist/cli.js +6 -32
  179. package/dist/cli.js.map +1 -1
  180. package/dist/commands/consult/cli-options.d.ts +34 -0
  181. package/dist/commands/consult/cli-options.d.ts.map +1 -0
  182. package/dist/commands/consult/cli-options.js +67 -0
  183. package/dist/commands/consult/cli-options.js.map +1 -0
  184. package/dist/commands/consult/index.d.ts +56 -2
  185. package/dist/commands/consult/index.d.ts.map +1 -1
  186. package/dist/commands/consult/index.js +272 -28
  187. package/dist/commands/consult/index.js.map +1 -1
  188. package/dist/commands/consult/metrics.d.ts +42 -0
  189. package/dist/commands/consult/metrics.d.ts.map +1 -1
  190. package/dist/commands/consult/metrics.js +129 -9
  191. package/dist/commands/consult/metrics.js.map +1 -1
  192. package/dist/commands/doctor.d.ts.map +1 -1
  193. package/dist/commands/doctor.js +71 -19
  194. package/dist/commands/doctor.js.map +1 -1
  195. package/dist/commands/porch/checks.d.ts +23 -0
  196. package/dist/commands/porch/checks.d.ts.map +1 -1
  197. package/dist/commands/porch/checks.js +60 -0
  198. package/dist/commands/porch/checks.js.map +1 -1
  199. package/dist/commands/porch/config.d.ts +20 -0
  200. package/dist/commands/porch/config.d.ts.map +1 -1
  201. package/dist/commands/porch/config.js +20 -0
  202. package/dist/commands/porch/config.js.map +1 -1
  203. package/dist/commands/porch/index.js +21 -28
  204. package/dist/commands/porch/index.js.map +1 -1
  205. package/dist/commands/porch/next.d.ts.map +1 -1
  206. package/dist/commands/porch/next.js +2 -41
  207. package/dist/commands/porch/next.js.map +1 -1
  208. package/dist/lib/config.d.ts +69 -3
  209. package/dist/lib/config.d.ts.map +1 -1
  210. package/dist/lib/config.js +67 -3
  211. package/dist/lib/config.js.map +1 -1
  212. package/dist/lib/consult-lanes.d.ts +149 -0
  213. package/dist/lib/consult-lanes.d.ts.map +1 -0
  214. package/dist/lib/consult-lanes.js +360 -0
  215. package/dist/lib/consult-lanes.js.map +1 -0
  216. package/dist/lib/github.js +1 -1
  217. package/dist/lib/github.js.map +1 -1
  218. package/dist/lib/prompt-behavior-metrics.d.ts +67 -0
  219. package/dist/lib/prompt-behavior-metrics.d.ts.map +1 -0
  220. package/dist/lib/prompt-behavior-metrics.js +290 -0
  221. package/dist/lib/prompt-behavior-metrics.js.map +1 -0
  222. package/dist/lib/skeleton.d.ts +22 -1
  223. package/dist/lib/skeleton.d.ts.map +1 -1
  224. package/dist/lib/skeleton.js +120 -0
  225. package/dist/lib/skeleton.js.map +1 -1
  226. package/dist/lib/test-env.d.ts +74 -0
  227. package/dist/lib/test-env.d.ts.map +1 -0
  228. package/dist/lib/test-env.js +92 -0
  229. package/dist/lib/test-env.js.map +1 -0
  230. package/dist/terminal/pty-manager.d.ts +2 -0
  231. package/dist/terminal/pty-manager.d.ts.map +1 -1
  232. package/dist/terminal/pty-manager.js +16 -6
  233. package/dist/terminal/pty-manager.js.map +1 -1
  234. package/dist/terminal/pty-session.d.ts +131 -0
  235. package/dist/terminal/pty-session.d.ts.map +1 -1
  236. package/dist/terminal/pty-session.js +232 -39
  237. package/dist/terminal/pty-session.js.map +1 -1
  238. package/dist/terminal/ring-buffer.d.ts +39 -6
  239. package/dist/terminal/ring-buffer.d.ts.map +1 -1
  240. package/dist/terminal/ring-buffer.js +74 -6
  241. package/dist/terminal/ring-buffer.js.map +1 -1
  242. package/dist/terminal/session-manager.d.ts +53 -0
  243. package/dist/terminal/session-manager.d.ts.map +1 -1
  244. package/dist/terminal/session-manager.js +94 -9
  245. package/dist/terminal/session-manager.js.map +1 -1
  246. package/dist/terminal/session-screen.d.ts +91 -0
  247. package/dist/terminal/session-screen.d.ts.map +1 -0
  248. package/dist/terminal/session-screen.js +135 -0
  249. package/dist/terminal/session-screen.js.map +1 -0
  250. package/dist/terminal/shellper-main.js +2 -1
  251. package/dist/terminal/shellper-main.js.map +1 -1
  252. package/dist/terminal/shellper-process.d.ts +1 -1
  253. package/dist/terminal/shellper-process.d.ts.map +1 -1
  254. package/dist/terminal/shellper-process.js +17 -8
  255. package/dist/terminal/shellper-process.js.map +1 -1
  256. package/dist/terminal/shellper-replay-buffer.d.ts +69 -7
  257. package/dist/terminal/shellper-replay-buffer.d.ts.map +1 -1
  258. package/dist/terminal/shellper-replay-buffer.js +167 -31
  259. package/dist/terminal/shellper-replay-buffer.js.map +1 -1
  260. package/package.json +8 -6
  261. package/skeleton/.claude/skills/afx/SKILL.md +14 -1
  262. package/skeleton/.claude/skills/arch-init/SKILL.md +22 -9
  263. package/skeleton/.claude/skills/arch-save/SKILL.md +183 -0
  264. package/skeleton/.claude/skills/codev/SKILL.md +31 -0
  265. package/skeleton/.claude/skills/runnable-worktrees/SKILL.md +119 -0
  266. package/skeleton/.codex/skills/afx/SKILL.md +14 -1
  267. package/skeleton/.codex/skills/arch-init/SKILL.md +22 -9
  268. package/skeleton/.codex/skills/arch-save/SKILL.md +183 -0
  269. package/skeleton/.codex/skills/codev/SKILL.md +31 -0
  270. package/skeleton/.codex/skills/runnable-worktrees/SKILL.md +119 -0
  271. package/skeleton/protocols/air/builder-prompt.md +28 -47
  272. package/skeleton/protocols/air/consult-types/impl-review.md +17 -34
  273. package/skeleton/protocols/air/consult-types/pr-review.md +14 -37
  274. package/skeleton/protocols/air/prompts/implement.md +20 -73
  275. package/skeleton/protocols/air/prompts/pr.md +22 -54
  276. package/skeleton/protocols/air/protocol.md +40 -71
  277. package/skeleton/protocols/aspir/builder-prompt.md +29 -66
  278. package/skeleton/protocols/aspir/consult-types/impl-review.md +17 -44
  279. package/skeleton/protocols/aspir/consult-types/phase-review.md +17 -44
  280. package/skeleton/protocols/aspir/consult-types/plan-review.md +14 -38
  281. package/skeleton/protocols/aspir/consult-types/pr-review.md +13 -39
  282. package/skeleton/protocols/aspir/consult-types/spec-review.md +13 -33
  283. package/skeleton/protocols/aspir/prompts/implement.md +27 -196
  284. package/skeleton/protocols/aspir/prompts/plan.md +21 -85
  285. package/skeleton/protocols/aspir/prompts/review.md +29 -228
  286. package/skeleton/protocols/aspir/prompts/specify.md +25 -111
  287. package/skeleton/protocols/aspir/protocol.json +10 -0
  288. package/skeleton/protocols/aspir/protocol.md +36 -82
  289. package/skeleton/protocols/bugfix/builder-prompt.md +23 -45
  290. package/skeleton/protocols/bugfix/consult-types/impl-review.md +21 -45
  291. package/skeleton/protocols/bugfix/consult-types/pr-review.md +18 -52
  292. package/skeleton/protocols/bugfix/prompts/fix.md +16 -61
  293. package/skeleton/protocols/bugfix/prompts/investigate.md +18 -62
  294. package/skeleton/protocols/bugfix/prompts/pr.md +22 -57
  295. package/skeleton/protocols/bugfix/protocol.md +44 -50
  296. package/skeleton/protocols/experiment/builder-prompt.md +25 -58
  297. package/skeleton/protocols/experiment/protocol.md +22 -188
  298. package/skeleton/protocols/experiment/templates/notes.md +11 -71
  299. package/skeleton/protocols/maintain/builder-prompt.md +24 -45
  300. package/skeleton/protocols/maintain/consult-types/impl-review.md +17 -44
  301. package/skeleton/protocols/maintain/consult-types/pr-review.md +13 -39
  302. package/skeleton/protocols/maintain/prompts/maintain.md +1 -1
  303. package/skeleton/protocols/maintain/protocol.md +32 -266
  304. package/skeleton/protocols/maintain/templates/maintenance-run.md +11 -0
  305. package/skeleton/protocols/pir/builder-prompt.md +30 -64
  306. package/skeleton/protocols/pir/consult-types/impl-review.md +17 -50
  307. package/skeleton/protocols/pir/consult-types/pr-review.md +11 -40
  308. package/skeleton/protocols/pir/prompts/implement.md +1 -2
  309. package/skeleton/protocols/pir/prompts/plan.md +0 -3
  310. package/skeleton/protocols/pir/prompts/review.md +1 -1
  311. package/skeleton/protocols/pir/protocol.md +54 -177
  312. package/skeleton/protocols/research/builder-prompt.md +27 -58
  313. package/skeleton/protocols/research/protocol.md +28 -153
  314. package/skeleton/protocols/spike/builder-prompt.md +30 -48
  315. package/skeleton/protocols/spike/protocol.md +24 -107
  316. package/skeleton/protocols/spike/templates/findings.md +9 -39
  317. package/skeleton/protocols/spir/builder-prompt.md +33 -62
  318. package/skeleton/protocols/spir/consult-types/impl-review.md +17 -44
  319. package/skeleton/protocols/spir/consult-types/phase-review.md +17 -44
  320. package/skeleton/protocols/spir/consult-types/plan-review.md +14 -38
  321. package/skeleton/protocols/spir/consult-types/pr-review.md +13 -39
  322. package/skeleton/protocols/spir/consult-types/spec-review.md +13 -33
  323. package/skeleton/protocols/spir/prompts/implement.md +26 -195
  324. package/skeleton/protocols/spir/prompts/plan.md +20 -84
  325. package/skeleton/protocols/spir/prompts/review.md +28 -227
  326. package/skeleton/protocols/spir/prompts/specify.md +24 -110
  327. package/skeleton/protocols/spir/protocol.json +10 -0
  328. package/skeleton/protocols/spir/protocol.md +84 -633
  329. package/skeleton/protocols/spir/templates/plan.md +28 -147
  330. package/skeleton/protocols/spir/templates/review.md +21 -80
  331. package/skeleton/protocols/spir/templates/spec.md +24 -118
  332. package/skeleton/resources/commands/agent-farm.md +259 -0
  333. package/skeleton/resources/commands/consult.md +236 -8
  334. package/skeleton/resources/commands/overview.md +1 -0
  335. package/skeleton/roles/architect.md +67 -317
  336. package/skeleton/roles/builder.md +77 -191
  337. package/skeleton/templates/AGENTS.md +2 -0
  338. package/skeleton/templates/CLAUDE.md +2 -0
  339. package/templates/tower.html +39 -2
  340. package/dashboard-dist/assets/index-BZ1x7x1X.js.map +0 -1
  341. package/dashboard-dist/assets/index-DB1KBSNE.css +0 -32
  342. package/dist/agent-farm/servers/send-buffer.d.ts +0 -59
  343. package/dist/agent-farm/servers/send-buffer.d.ts.map +0 -1
  344. package/dist/agent-farm/servers/send-buffer.js +0 -116
  345. package/dist/agent-farm/servers/send-buffer.js.map +0 -1
  346. package/skeleton/porch/prompts/defend.md +0 -108
  347. package/skeleton/porch/prompts/diagnose.md +0 -70
  348. package/skeleton/porch/prompts/evaluate.md +0 -132
  349. package/skeleton/porch/prompts/fix.md +0 -59
  350. package/skeleton/porch/prompts/implement.md +0 -88
  351. package/skeleton/porch/prompts/plan.md +0 -74
  352. package/skeleton/porch/prompts/pr.md +0 -84
  353. package/skeleton/porch/prompts/review.md +0 -249
  354. package/skeleton/porch/prompts/specify.md +0 -53
  355. package/skeleton/porch/prompts/test.md +0 -63
  356. package/skeleton/protocols/aspir/templates/plan.md +0 -184
  357. package/skeleton/protocols/aspir/templates/review.md +0 -120
  358. package/skeleton/protocols/aspir/templates/spec.md +0 -154
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Interrupt command — send a bare ESC keystroke into a builder's PTY (Spec 1273).
3
+ *
4
+ * This is the only recovery that reaches a builder *mid-turn*. When a builder
5
+ * chains foreground waits inside one turn, every `afx send` — including the
6
+ * architect's order to stop — queues unread until the turn ends. ESC interrupts
7
+ * the running tool, ends the turn, and the queued messages then process.
8
+ *
9
+ * Verified in production (shannon workspace, 2026-07-27): a builder wedged for
10
+ * 45+ minutes on a wait for a file whose producer had already died resumed
11
+ * within two minutes of receiving ESC. Until now that recipe
12
+ * (`afx send <builder> --raw "$(printf '\x1b')"`) lived only in architect lore
13
+ * and had to be discovered under pressure.
14
+ *
15
+ * Addressing, workspace detection and sender identity are reused verbatim from
16
+ * `afx send` — there is exactly one address resolver.
17
+ */
18
+ import type { InterruptOptions } from '../types.js';
19
+ export declare function interrupt(options: InterruptOptions): Promise<void>;
20
+ //# sourceMappingURL=interrupt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupt.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/commands/interrupt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDxE"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Interrupt command — send a bare ESC keystroke into a builder's PTY (Spec 1273).
3
+ *
4
+ * This is the only recovery that reaches a builder *mid-turn*. When a builder
5
+ * chains foreground waits inside one turn, every `afx send` — including the
6
+ * architect's order to stop — queues unread until the turn ends. ESC interrupts
7
+ * the running tool, ends the turn, and the queued messages then process.
8
+ *
9
+ * Verified in production (shannon workspace, 2026-07-27): a builder wedged for
10
+ * 45+ minutes on a wait for a file whose producer had already died resumed
11
+ * within two minutes of receiving ESC. Until now that recipe
12
+ * (`afx send <builder> --raw "$(printf '\x1b')"`) lived only in architect lore
13
+ * and had to be discovered under pressure.
14
+ *
15
+ * Addressing, workspace detection and sender identity are reused verbatim from
16
+ * `afx send` — there is exactly one address resolver.
17
+ */
18
+ import { logger, fatal } from '../utils/logger.js';
19
+ import { TowerClient } from '../lib/tower-client.js';
20
+ import { detectWorkspaceRoot, detectCurrentBuilderId } from './send.js';
21
+ export async function interrupt(options) {
22
+ const target = options.builder;
23
+ if (!target) {
24
+ fatal('Must specify a builder. Usage: afx interrupt <builder>');
25
+ }
26
+ logger.header('Sending Interrupt (ESC)');
27
+ const workspace = detectWorkspaceRoot() ?? undefined;
28
+ // Same identity rule as `afx send`: in a confirmed builder worktree an
29
+ // unverifiable canonical id aborts rather than sending as an unverified
30
+ // sender, which Tower would silently route to 'main' (issue #1094).
31
+ let from;
32
+ try {
33
+ from = detectCurrentBuilderId() ?? 'architect';
34
+ }
35
+ catch (err) {
36
+ fatal(err instanceof Error ? err.message : String(err));
37
+ }
38
+ const client = new TowerClient();
39
+ if (!(await client.isRunning())) {
40
+ fatal('Tower is not running. Start it with: afx tower start');
41
+ }
42
+ try {
43
+ // `message` carries the ESC byte so the route's non-empty validation is
44
+ // satisfied and both this command and the manual `--raw` recipe exercise the
45
+ // same byte. `escape` is what makes delivery immediate and unformatted.
46
+ const result = await client.sendMessage(target, '\x1b', {
47
+ from,
48
+ workspace,
49
+ fromWorkspace: workspace,
50
+ escape: true,
51
+ noEnter: options.noEnter,
52
+ });
53
+ if (!result.ok) {
54
+ throw new Error(result.error || 'Unknown error');
55
+ }
56
+ logger.success(`Interrupt (ESC) sent to ${result.resolvedTo ?? target}`);
57
+ if (!options.noEnter) {
58
+ logger.info('Enter followed the ESC — any messages queued during the turn should now process.');
59
+ }
60
+ }
61
+ catch (error) {
62
+ fatal(error instanceof Error ? error.message : String(error));
63
+ }
64
+ }
65
+ //# sourceMappingURL=interrupt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interrupt.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/interrupt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAyB;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAE/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,KAAK,CAAC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,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Tunable parameters for `afx reset` (Spec 1273).
3
+ *
4
+ * Every value here is overridable from the CLI. The defaults are grounded in
5
+ * the one verified manual reset (shannon workspace, 2026-07-27), not guessed.
6
+ */
7
+ /**
8
+ * Fixed name of the builder's working-state file, at the worktree root.
9
+ *
10
+ * The `.builder-` prefix is load-bearing: `afx cleanup` classifies untracked
11
+ * `.builder-*` files as scaffold rather than dirt, so a worktree carrying one is
12
+ * still considered clean. It is untracked, which is why `porch done`'s
13
+ * staged-file sweep cannot pick it up.
14
+ *
15
+ * The name is deliberately FIXED rather than nonce-suffixed. Freshness is proven
16
+ * by the nonce *inside* the file (R2), so encoding it in the filename would add
17
+ * nothing and would leave a new litter file after every reset.
18
+ */
19
+ export declare const STATE_FILE_NAME = ".builder-state.md";
20
+ /** Long-form re-orientation written before the clear (R1). Same prefix rationale. */
21
+ export declare const REORIENT_FILE_NAME = ".builder-reorient.md";
22
+ /**
23
+ * Minimum size for a state file to count as substantive.
24
+ *
25
+ * The one verified example ran 203 lines (~8-10KB). A genuine cold-reader save
26
+ * is comfortably over 1KB; a three-line stub is 100-200 bytes. 1000 rejects
27
+ * stubs without false-rejecting a terse but real save.
28
+ */
29
+ export declare const DEFAULT_MIN_BYTES = 1000;
30
+ /** Gap between the two observations that must agree for the file to count as stable. */
31
+ export declare const DEFAULT_STABILITY_WINDOW_MS = 2000;
32
+ /** How often to stat the state file while waiting for it. */
33
+ export declare const DEFAULT_POLL_INTERVAL_MS = 2000;
34
+ /**
35
+ * How long to wait for the builder to produce the state file.
36
+ *
37
+ * A busy builder may take minutes to reach the request — the manual run was of
38
+ * this order. Expiry aborts WITHOUT clearing (R2).
39
+ */
40
+ export declare const DEFAULT_RECEIPT_TIMEOUT_MS = 300000;
41
+ /**
42
+ * How long the terminal must produce no output before it counts as quiescent.
43
+ *
44
+ * An agent mid-turn emits continuously (spinner frames, streamed tokens), so a
45
+ * true silence of this length reliably indicates the turn ended.
46
+ */
47
+ export declare const DEFAULT_QUIET_WINDOW_MS = 1500;
48
+ /** Bounded wait for quiescence before the single ESC escalation (R4). */
49
+ export declare const DEFAULT_QUIESCE_TIMEOUT_MS = 60000;
50
+ /** Bounded wait after the ESC escalation. Shorter — ESC should act immediately. */
51
+ export declare const DEFAULT_QUIESCE_POST_ESCALATION_TIMEOUT_MS = 30000;
52
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/agent-farm/commands/reset/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,wFAAwF;AACxF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,mFAAmF;AACnF,eAAO,MAAM,0CAA0C,QAAS,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Tunable parameters for `afx reset` (Spec 1273).
3
+ *
4
+ * Every value here is overridable from the CLI. The defaults are grounded in
5
+ * the one verified manual reset (shannon workspace, 2026-07-27), not guessed.
6
+ */
7
+ /**
8
+ * Fixed name of the builder's working-state file, at the worktree root.
9
+ *
10
+ * The `.builder-` prefix is load-bearing: `afx cleanup` classifies untracked
11
+ * `.builder-*` files as scaffold rather than dirt, so a worktree carrying one is
12
+ * still considered clean. It is untracked, which is why `porch done`'s
13
+ * staged-file sweep cannot pick it up.
14
+ *
15
+ * The name is deliberately FIXED rather than nonce-suffixed. Freshness is proven
16
+ * by the nonce *inside* the file (R2), so encoding it in the filename would add
17
+ * nothing and would leave a new litter file after every reset.
18
+ */
19
+ export const STATE_FILE_NAME = '.builder-state.md';
20
+ /** Long-form re-orientation written before the clear (R1). Same prefix rationale. */
21
+ export const REORIENT_FILE_NAME = '.builder-reorient.md';
22
+ /**
23
+ * Minimum size for a state file to count as substantive.
24
+ *
25
+ * The one verified example ran 203 lines (~8-10KB). A genuine cold-reader save
26
+ * is comfortably over 1KB; a three-line stub is 100-200 bytes. 1000 rejects
27
+ * stubs without false-rejecting a terse but real save.
28
+ */
29
+ export const DEFAULT_MIN_BYTES = 1000;
30
+ /** Gap between the two observations that must agree for the file to count as stable. */
31
+ export const DEFAULT_STABILITY_WINDOW_MS = 2000;
32
+ /** How often to stat the state file while waiting for it. */
33
+ export const DEFAULT_POLL_INTERVAL_MS = 2000;
34
+ /**
35
+ * How long to wait for the builder to produce the state file.
36
+ *
37
+ * A busy builder may take minutes to reach the request — the manual run was of
38
+ * this order. Expiry aborts WITHOUT clearing (R2).
39
+ */
40
+ export const DEFAULT_RECEIPT_TIMEOUT_MS = 300_000;
41
+ /**
42
+ * How long the terminal must produce no output before it counts as quiescent.
43
+ *
44
+ * An agent mid-turn emits continuously (spinner frames, streamed tokens), so a
45
+ * true silence of this length reliably indicates the turn ended.
46
+ */
47
+ export const DEFAULT_QUIET_WINDOW_MS = 1500;
48
+ /** Bounded wait for quiescence before the single ESC escalation (R4). */
49
+ export const DEFAULT_QUIESCE_TIMEOUT_MS = 60_000;
50
+ /** Bounded wait after the ESC escalation. Shorter — ESC should act immediately. */
51
+ export const DEFAULT_QUIESCE_POST_ESCALATION_TIMEOUT_MS = 30_000;
52
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/agent-farm/commands/reset/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAEnD,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC,wFAAwF;AACxF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEhD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEjD,mFAAmF;AACnF,MAAM,CAAC,MAAM,0CAA0C,GAAG,MAAM,CAAC"}
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Builder context resolution for `afx reset` (Spec 1273, phase 4).
3
+ *
4
+ * Invariant R3 requires a re-orientation carrying protocol, mode, worktree,
5
+ * branch, project identity and porch re-entry. The first draft of the plan
6
+ * assumed the builder registry held those facts. **It does not**, and the gap is
7
+ * silent rather than obvious:
8
+ *
9
+ * - `builders.protocol_name` is NULL for spec-type builders. `spawn.ts` never
10
+ * passes `protocolName` on that path (only the `protocol`-type spawn does),
11
+ * so every SPIR/ASPIR lane — precisely the long-running builders this feature
12
+ * exists for — has NULL there. Reading `db/schema.ts` shows the column and
13
+ * looks fine; the persistence path is where the truth is.
14
+ * - Mode is not persisted at all. `resolveMode` computes it at spawn from flags
15
+ * plus protocol defaults and discards it, so a spawn-time `--soft` cannot be
16
+ * recovered afterwards by recomputation.
17
+ * - Harness comes from workspace config, which can change while a builder runs,
18
+ * so config is not authoritative for a *running* builder.
19
+ *
20
+ * So this module reads the worktree, which holds all of it authoritatively:
21
+ * porch's `status.yaml` (protocol, phase), `.builder-prompt.txt` (the literal
22
+ * `## Mode:` line the builder was given), and `.builder-start.sh` (the launch
23
+ * line of the process actually running).
24
+ *
25
+ * Every chain ends in a **loud abort**, never a default. A guessed protocol or
26
+ * mode would produce a plausible-looking re-orientation that quietly reframes the
27
+ * builder — the exact drift R3 exists to prevent.
28
+ */
29
+ import { type CustomHarnessConfig, type HarnessProvider } from '../../utils/harness.js';
30
+ /** Filesystem access needed for resolution. Injected so tests need no worktree. */
31
+ export interface ContextFsPort {
32
+ exists(path: string): boolean;
33
+ read(path: string): string | null;
34
+ /** Immediate subdirectory names, or null when the directory does not exist. */
35
+ listDirs(path: string): string[] | null;
36
+ }
37
+ export interface ResolvedBuilderContext {
38
+ builderId: string;
39
+ worktree: string;
40
+ branch: string;
41
+ protocol: string;
42
+ /** Where the protocol came from — surfaced in the report so it is auditable. */
43
+ protocolSource: 'status.yaml' | 'builder-id';
44
+ mode: 'strict' | 'soft';
45
+ modeSource: 'flag' | 'builder-prompt' | 'task-default';
46
+ harnessName: string;
47
+ harness: HarnessProvider;
48
+ /** Null for a non-porch lane; that is a branch, not a failure. */
49
+ porch: PorchContext | null;
50
+ /**
51
+ * Artifact identity, for phase 5's reconstruction of the spawn TemplateContext.
52
+ *
53
+ * Null on a non-porch lane, where there is no spec/plan naming convention to
54
+ * derive from. `specPath`/`planPath` are worktree-relative and are only set
55
+ * when the file actually exists — a pointer to a file that is not there would
56
+ * send a freshly-reset builder chasing a ghost.
57
+ */
58
+ specName: string | null;
59
+ specPath: string | null;
60
+ planPath: string | null;
61
+ /** Issue number, from the registry row or the porch project id. */
62
+ issueNumber?: string;
63
+ /**
64
+ * Ad-hoc task text, from the registry row (`builders.task_text`).
65
+ *
66
+ * Present only for `afx spawn --task` builders. Phase 5 needs it to tell that
67
+ * lane apart from the others: a task builder still gets a porch project keyed
68
+ * on its builder id, so `issueNumber` is populated for it too, and without
69
+ * this field the task lane is indistinguishable from an issue-driven one.
70
+ */
71
+ taskText?: string;
72
+ /**
73
+ * True only for a BARE `afx spawn --task` builder (no `--protocol`).
74
+ *
75
+ * Established from positive evidence — task text present AND the prompt file
76
+ * carries no `## Mode:` heading — rather than inferred from the absence of a
77
+ * porch project. `initPorchInWorktree` is deliberately non-fatal, so a
78
+ * `--task --protocol X` builder whose porch init failed also has task text and
79
+ * no porch, and inferring from that would strip its real protocol template and
80
+ * hand it the raw task text instead.
81
+ *
82
+ * The prompt is built BEFORE porch init (`spawn.ts:545-548`), so a
83
+ * `--task --protocol` builder's prompt carries the rendered template — and its
84
+ * `## Mode:` line — regardless of whether porch init later succeeded.
85
+ */
86
+ isBareTask: boolean;
87
+ }
88
+ export interface PorchContext {
89
+ projectId: string;
90
+ projectName: string;
91
+ /** The protocol porch is actually running for this project. */
92
+ protocol: string;
93
+ phase: string;
94
+ currentPlanPhase: string | null;
95
+ statusPath: string;
96
+ }
97
+ /** Thrown when a fact cannot be established. Never swallowed into a default. */
98
+ export declare class ContextResolutionError extends Error {
99
+ constructor(message: string);
100
+ }
101
+ /**
102
+ * Locate and parse THIS BUILDER's porch status file.
103
+ *
104
+ * Returns null when this builder has no porch project — a task or shell builder
105
+ * is a legitimate reset target, it simply gets no porch re-entry block.
106
+ *
107
+ * ## Why this takes an identity instead of picking the first parsable file
108
+ *
109
+ * The first implementation returned the first directory under `codev/projects`
110
+ * with a parsable `status.yaml`. That is correct only for a repo holding exactly
111
+ * one project directory. **This repo commits porch history to `main`**, so every
112
+ * worktree inherits every project ever run — 203 of them at the time of writing.
113
+ * The alphabetically-first is `0087-porch-timeout-termination-retries`, whose
114
+ * protocol is `spider`, so `afx reset` resolved protocol "spider" for *every*
115
+ * builder and died on `Protocol "spider" has no builder-prompt.md`. It failed
116
+ * loudly, which is why nothing was corrupted — but it failed for every lane.
117
+ *
118
+ * The fix is to select by identity, never by position: a directory qualifies
119
+ * only when it belongs to the builder being reset. No match returns null, which
120
+ * is the honest answer for a genuinely non-porch builder and is also safe for a
121
+ * porch one — a missing porch block is visible in the re-orientation, whereas
122
+ * *another project's* protocol is a confident lie.
123
+ *
124
+ * (This is the #1235 wrong-winner family: pick-the-first over a set that is
125
+ * assumed to be a singleton and is not.)
126
+ *
127
+ * Parsed with targeted line matching rather than a YAML dependency: this module
128
+ * needs four scalar fields, and the file is machine-written by porch.
129
+ */
130
+ export interface PorchProjectIdentity {
131
+ /** Registry builder id, e.g. `aspir-1273`, `builder-task-re_v`. */
132
+ builderId: string;
133
+ /** Issue number when the lane has one. */
134
+ issueNumber?: string;
135
+ }
136
+ /**
137
+ * Project ids this builder could legitimately own, most specific first.
138
+ *
139
+ * Three forms, because porch names projects differently per lane:
140
+ * - the issue number, for issue-driven lanes;
141
+ * - the builder id itself — `spawn.ts` passes `builderId` as the porch project
142
+ * id on the `--task` path;
143
+ * - the builder id with its protocol prefix stripped (`aspir-1273` → `1273`),
144
+ * which is how spec-driven lanes are named.
145
+ */
146
+ export declare function candidateProjectIds(identity: PorchProjectIdentity): string[];
147
+ export declare function readPorchContext(fs: ContextFsPort, worktree: string, identity: PorchProjectIdentity): PorchContext | null;
148
+ /**
149
+ * The protocol recorded in status.yaml, if there is one.
150
+ *
151
+ * Reads through `readPorchContext` rather than re-scanning the project dirs, so
152
+ * the two cannot disagree about which status.yaml is authoritative. Worktrees
153
+ * routinely hold MANY project directories here (porch history is committed to
154
+ * `main`), which is exactly why both go through one identity-aware selector.
155
+ */
156
+ export declare function protocolFromStatus(fs: ContextFsPort, worktree: string, identity: PorchProjectIdentity): string | null;
157
+ /**
158
+ * Read the mode the builder was actually told it was running in.
159
+ *
160
+ * The spawn prompt renders a literal `## Mode: STRICT` heading, and `--resume`
161
+ * does not rewrite the prompt file, so this stays correct across resumes. It is
162
+ * a stronger source than recomputing `resolveMode`, which cannot recover a
163
+ * spawn-time `--soft` from protocol defaults.
164
+ */
165
+ export declare function modeFromBuilderPrompt(fs: ContextFsPort, worktree: string): 'strict' | 'soft' | null;
166
+ /**
167
+ * Recover an issue number from a porch project id.
168
+ *
169
+ * Porch ids are not uniformly numeric. PIR and SPIR use the bare issue number;
170
+ * **BUGFIX deliberately uses `<prefix>-<N>`** (`spawn.ts:817`, "historical, kept
171
+ * untouched"). A strict `/^\d+$/` guard therefore threw away BUGFIX's issue
172
+ * identity whenever the registry row lacked one — and on BUGFIX the issue body
173
+ * IS the spec, so the re-orientation lost the requirements it was meant to carry.
174
+ *
175
+ * Accepts a bare number or a canonical `<word>-<number>`; rejects anything else,
176
+ * so an ad-hoc task id (`builder-task-abc`) still cannot masquerade as an issue.
177
+ */
178
+ export declare function issueNumberFromPorchId(projectId?: string): string | undefined;
179
+ /**
180
+ * Identify the harness from the worktree's launch script.
181
+ *
182
+ * Per-builder ground truth: the script is what the running process was started
183
+ * with, so it stays right even if workspace config changed since the spawn.
184
+ */
185
+ export declare function harnessFromLaunchScript(fs: ContextFsPort, worktree: string, customHarnesses?: Record<string, CustomHarnessConfig>): string | null;
186
+ /**
187
+ * Map a harness name to its provider, honouring project-defined custom harnesses.
188
+ *
189
+ * Custom harnesses resolve to a real provider rather than failing as
190
+ * "unrecognisable", so the refusal a project sees is the accurate one — *this
191
+ * harness cannot reset in-session* — instead of a misleading "unknown harness".
192
+ * `buildCustomHarnessProvider` does not set `supportsContextReset`, so custom
193
+ * harnesses are unsupported by default; letting one declare support would be a
194
+ * one-field addition to `CustomHarnessConfig`, deliberately out of scope here.
195
+ */
196
+ export declare function harnessProviderFor(harnessName: string, customHarnesses?: Record<string, CustomHarnessConfig>): HarnessProvider | null;
197
+ /**
198
+ * Derive artifact identity from the porch project.
199
+ *
200
+ * Porch names its project dir `<id>-<title>`, and spec/plan files share that
201
+ * stem by convention (`codev/specs/<id>-<title>.md`). Paths are returned only
202
+ * when the file exists.
203
+ */
204
+ export declare function artifactPaths(fs: ContextFsPort, worktree: string, porch: PorchContext | null): {
205
+ specName: string | null;
206
+ specPath: string | null;
207
+ planPath: string | null;
208
+ };
209
+ export interface ResolveContextOptions {
210
+ fs: ContextFsPort;
211
+ builderId: string;
212
+ worktree: string;
213
+ branch: string;
214
+ issueNumber?: string;
215
+ /** `builders.task_text`, for `--task` builders. Forwarded verbatim. */
216
+ taskText?: string;
217
+ /** `--mode` override; wins over the worktree, for when the prompt file is gone. */
218
+ modeOverride?: 'strict' | 'soft';
219
+ /** Project-defined harnesses from `.codev/config.json`, if any. */
220
+ customHarnesses?: Record<string, CustomHarnessConfig>;
221
+ }
222
+ /**
223
+ * Resolve everything the re-orientation needs, or throw.
224
+ *
225
+ * Deliberately does NOT consult `builders.protocol_name`: it is NULL for
226
+ * spec-type builders, so a reader who "fixed" this to use the registry would
227
+ * break exactly the lanes the feature targets while the code looked more correct.
228
+ */
229
+ export declare function resolveBuilderContext(options: ResolveContextOptions): ResolvedBuilderContext;
230
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/agent-farm/commands/reset/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAMhC,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;CACzC;AAMD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM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