@cluesmith/codev 3.2.3 → 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 (445) 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 +173 -0
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/attach.js +2 -2
  9. package/dist/agent-farm/commands/attach.js.map +1 -1
  10. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  11. package/dist/agent-farm/commands/cleanup.js +16 -0
  12. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  13. package/dist/agent-farm/commands/inbox.d.ts +42 -0
  14. package/dist/agent-farm/commands/inbox.d.ts.map +1 -0
  15. package/dist/agent-farm/commands/inbox.js +129 -0
  16. package/dist/agent-farm/commands/inbox.js.map +1 -0
  17. package/dist/agent-farm/commands/interrupt.d.ts +20 -0
  18. package/dist/agent-farm/commands/interrupt.d.ts.map +1 -0
  19. package/dist/agent-farm/commands/interrupt.js +65 -0
  20. package/dist/agent-farm/commands/interrupt.js.map +1 -0
  21. package/dist/agent-farm/commands/reset/constants.d.ts +52 -0
  22. package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -0
  23. package/dist/agent-farm/commands/reset/constants.js +52 -0
  24. package/dist/agent-farm/commands/reset/constants.js.map +1 -0
  25. package/dist/agent-farm/commands/reset/context.d.ts +230 -0
  26. package/dist/agent-farm/commands/reset/context.d.ts.map +1 -0
  27. package/dist/agent-farm/commands/reset/context.js +428 -0
  28. package/dist/agent-farm/commands/reset/context.js.map +1 -0
  29. package/dist/agent-farm/commands/reset/index.d.ts +192 -0
  30. package/dist/agent-farm/commands/reset/index.d.ts.map +1 -0
  31. package/dist/agent-farm/commands/reset/index.js +488 -0
  32. package/dist/agent-farm/commands/reset/index.js.map +1 -0
  33. package/dist/agent-farm/commands/reset/receipt.d.ts +97 -0
  34. package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -0
  35. package/dist/agent-farm/commands/reset/receipt.js +149 -0
  36. package/dist/agent-farm/commands/reset/receipt.js.map +1 -0
  37. package/dist/agent-farm/commands/reset/reorient.d.ts +117 -0
  38. package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -0
  39. package/dist/agent-farm/commands/reset/reorient.js +313 -0
  40. package/dist/agent-farm/commands/reset/reorient.js.map +1 -0
  41. package/dist/agent-farm/commands/reset.d.ts +19 -0
  42. package/dist/agent-farm/commands/reset.d.ts.map +1 -0
  43. package/dist/agent-farm/commands/reset.js +292 -0
  44. package/dist/agent-farm/commands/reset.js.map +1 -0
  45. package/dist/agent-farm/commands/send.d.ts +2 -2
  46. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  47. package/dist/agent-farm/commands/send.js +52 -11
  48. package/dist/agent-farm/commands/send.js.map +1 -1
  49. package/dist/agent-farm/commands/setup.d.ts +4 -1
  50. package/dist/agent-farm/commands/setup.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/setup.js +8 -4
  52. package/dist/agent-farm/commands/setup.js.map +1 -1
  53. package/dist/agent-farm/commands/spawn-worktree.d.ts +116 -6
  54. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  55. package/dist/agent-farm/commands/spawn-worktree.js +345 -74
  56. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  57. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  58. package/dist/agent-farm/commands/spawn.js +13 -1
  59. package/dist/agent-farm/commands/spawn.js.map +1 -1
  60. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  61. package/dist/agent-farm/commands/status.js +105 -9
  62. package/dist/agent-farm/commands/status.js.map +1 -1
  63. package/dist/agent-farm/commands/tower-sweep-husks.d.ts +6 -0
  64. package/dist/agent-farm/commands/tower-sweep-husks.d.ts.map +1 -0
  65. package/dist/agent-farm/commands/tower-sweep-husks.js +77 -0
  66. package/dist/agent-farm/commands/tower-sweep-husks.js.map +1 -0
  67. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  68. package/dist/agent-farm/commands/tower.js +34 -0
  69. package/dist/agent-farm/commands/tower.js.map +1 -1
  70. package/dist/agent-farm/commands/whoami.d.ts +65 -0
  71. package/dist/agent-farm/commands/whoami.d.ts.map +1 -0
  72. package/dist/agent-farm/commands/whoami.js +196 -0
  73. package/dist/agent-farm/commands/whoami.js.map +1 -0
  74. package/dist/agent-farm/db/index.d.ts +1 -1
  75. package/dist/agent-farm/db/index.d.ts.map +1 -1
  76. package/dist/agent-farm/db/index.js +80 -1
  77. package/dist/agent-farm/db/index.js.map +1 -1
  78. package/dist/agent-farm/db/mailbox.d.ts +222 -0
  79. package/dist/agent-farm/db/mailbox.d.ts.map +1 -0
  80. package/dist/agent-farm/db/mailbox.js +304 -0
  81. package/dist/agent-farm/db/mailbox.js.map +1 -0
  82. package/dist/agent-farm/db/schema.d.ts +1 -1
  83. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  84. package/dist/agent-farm/db/schema.js +35 -0
  85. package/dist/agent-farm/db/schema.js.map +1 -1
  86. package/dist/agent-farm/db/types.d.ts +45 -0
  87. package/dist/agent-farm/db/types.d.ts.map +1 -1
  88. package/dist/agent-farm/db/types.js.map +1 -1
  89. package/dist/agent-farm/lib/builder-lookup.d.ts +1 -1
  90. package/dist/agent-farm/lib/builder-lookup.js +2 -2
  91. package/dist/agent-farm/lib/builder-lookup.js.map +1 -1
  92. package/dist/agent-farm/lib/reconnect-backoff.d.ts +54 -0
  93. package/dist/agent-farm/lib/reconnect-backoff.d.ts.map +1 -0
  94. package/dist/agent-farm/lib/reconnect-backoff.js +47 -0
  95. package/dist/agent-farm/lib/reconnect-backoff.js.map +1 -0
  96. package/dist/agent-farm/lib/tower-client.d.ts +16 -6
  97. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  98. package/dist/agent-farm/lib/tower-client.js +37 -6
  99. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  100. package/dist/agent-farm/lib/tunnel-client.d.ts +69 -1
  101. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
  102. package/dist/agent-farm/lib/tunnel-client.js +218 -27
  103. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  104. package/dist/agent-farm/servers/architect-session-holder.d.ts +133 -0
  105. package/dist/agent-farm/servers/architect-session-holder.d.ts.map +1 -0
  106. package/dist/agent-farm/servers/architect-session-holder.js +268 -0
  107. package/dist/agent-farm/servers/architect-session-holder.js.map +1 -0
  108. package/dist/agent-farm/servers/cron-delivery.d.ts +72 -0
  109. package/dist/agent-farm/servers/cron-delivery.d.ts.map +1 -0
  110. package/dist/agent-farm/servers/cron-delivery.js +80 -0
  111. package/dist/agent-farm/servers/cron-delivery.js.map +1 -0
  112. package/dist/agent-farm/servers/delayed-send.d.ts +85 -0
  113. package/dist/agent-farm/servers/delayed-send.d.ts.map +1 -0
  114. package/dist/agent-farm/servers/delayed-send.js +165 -0
  115. package/dist/agent-farm/servers/delayed-send.js.map +1 -0
  116. package/dist/agent-farm/servers/gate-profiles.d.ts +67 -0
  117. package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -0
  118. package/dist/agent-farm/servers/gate-profiles.js +113 -0
  119. package/dist/agent-farm/servers/gate-profiles.js.map +1 -0
  120. package/dist/agent-farm/servers/mailbox-delivery.d.ts +370 -0
  121. package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -0
  122. package/dist/agent-farm/servers/mailbox-delivery.js +617 -0
  123. package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -0
  124. package/dist/agent-farm/servers/mailbox-wiring.d.ts +125 -0
  125. package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -0
  126. package/dist/agent-farm/servers/mailbox-wiring.js +425 -0
  127. package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -0
  128. package/dist/agent-farm/servers/message-write.d.ts +53 -1
  129. package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
  130. package/dist/agent-farm/servers/message-write.js +63 -0
  131. package/dist/agent-farm/servers/message-write.js.map +1 -1
  132. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  133. package/dist/agent-farm/servers/overview.js +23 -4
  134. package/dist/agent-farm/servers/overview.js.map +1 -1
  135. package/dist/agent-farm/servers/process-census.d.ts +41 -0
  136. package/dist/agent-farm/servers/process-census.d.ts.map +1 -0
  137. package/dist/agent-farm/servers/process-census.js +62 -0
  138. package/dist/agent-farm/servers/process-census.js.map +1 -0
  139. package/dist/agent-farm/servers/render-gate.d.ts +141 -0
  140. package/dist/agent-farm/servers/render-gate.d.ts.map +1 -0
  141. package/dist/agent-farm/servers/render-gate.js +251 -0
  142. package/dist/agent-farm/servers/render-gate.js.map +1 -0
  143. package/dist/agent-farm/servers/session-log-sweep.d.ts +93 -0
  144. package/dist/agent-farm/servers/session-log-sweep.d.ts.map +1 -0
  145. package/dist/agent-farm/servers/session-log-sweep.js +165 -0
  146. package/dist/agent-farm/servers/session-log-sweep.js.map +1 -0
  147. package/dist/agent-farm/servers/session-submit.d.ts +90 -0
  148. package/dist/agent-farm/servers/session-submit.d.ts.map +1 -0
  149. package/dist/agent-farm/servers/session-submit.js +127 -0
  150. package/dist/agent-farm/servers/session-submit.js.map +1 -0
  151. package/dist/agent-farm/servers/shellper-husk-sweep.d.ts +87 -0
  152. package/dist/agent-farm/servers/shellper-husk-sweep.d.ts.map +1 -0
  153. package/dist/agent-farm/servers/shellper-husk-sweep.js +129 -0
  154. package/dist/agent-farm/servers/shellper-husk-sweep.js.map +1 -0
  155. package/dist/agent-farm/servers/tower-cron.d.ts +10 -7
  156. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  157. package/dist/agent-farm/servers/tower-cron.js +58 -53
  158. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  159. package/dist/agent-farm/servers/tower-instances.d.ts +14 -2
  160. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  161. package/dist/agent-farm/servers/tower-instances.js +128 -19
  162. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  163. package/dist/agent-farm/servers/tower-messages.d.ts +38 -1
  164. package/dist/agent-farm/servers/tower-messages.d.ts.map +1 -1
  165. package/dist/agent-farm/servers/tower-messages.js +106 -1
  166. package/dist/agent-farm/servers/tower-messages.js.map +1 -1
  167. package/dist/agent-farm/servers/tower-routes.d.ts +16 -4
  168. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  169. package/dist/agent-farm/servers/tower-routes.js +807 -99
  170. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  171. package/dist/agent-farm/servers/tower-server.js +241 -15
  172. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  173. package/dist/agent-farm/servers/tower-terminals.d.ts +17 -2
  174. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  175. package/dist/agent-farm/servers/tower-terminals.js +139 -124
  176. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  177. package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
  178. package/dist/agent-farm/servers/tower-tunnel.js +63 -4
  179. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  180. package/dist/agent-farm/servers/tower-types.d.ts +2 -1
  181. package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
  182. package/dist/agent-farm/servers/tower-utils.d.ts +99 -1
  183. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  184. package/dist/agent-farm/servers/tower-utils.js +242 -6
  185. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  186. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  187. package/dist/agent-farm/servers/tower-websocket.js +6 -21
  188. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  189. package/dist/agent-farm/servers/write-queue.d.ts +35 -0
  190. package/dist/agent-farm/servers/write-queue.d.ts.map +1 -0
  191. package/dist/agent-farm/servers/write-queue.js +56 -0
  192. package/dist/agent-farm/servers/write-queue.js.map +1 -0
  193. package/dist/agent-farm/state.d.ts +6 -1
  194. package/dist/agent-farm/state.d.ts.map +1 -1
  195. package/dist/agent-farm/state.js +5 -2
  196. package/dist/agent-farm/state.js.map +1 -1
  197. package/dist/agent-farm/types.d.ts +39 -0
  198. package/dist/agent-farm/types.d.ts.map +1 -1
  199. package/dist/agent-farm/utils/agent-names.d.ts +2 -2
  200. package/dist/agent-farm/utils/agent-names.d.ts.map +1 -1
  201. package/dist/agent-farm/utils/agent-names.js +3 -3
  202. package/dist/agent-farm/utils/agent-names.js.map +1 -1
  203. package/dist/agent-farm/utils/architect-name.d.ts +2 -2
  204. package/dist/agent-farm/utils/architect-name.d.ts.map +1 -1
  205. package/dist/agent-farm/utils/architect-name.js +3 -3
  206. package/dist/agent-farm/utils/architect-name.js.map +1 -1
  207. package/dist/agent-farm/utils/config.d.ts +13 -0
  208. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  209. package/dist/agent-farm/utils/config.js +33 -1
  210. package/dist/agent-farm/utils/config.js.map +1 -1
  211. package/dist/agent-farm/utils/harness.d.ts +103 -7
  212. package/dist/agent-farm/utils/harness.d.ts.map +1 -1
  213. package/dist/agent-farm/utils/harness.js +126 -19
  214. package/dist/agent-farm/utils/harness.js.map +1 -1
  215. package/dist/cli.d.ts.map +1 -1
  216. package/dist/cli.js +6 -32
  217. package/dist/cli.js.map +1 -1
  218. package/dist/commands/adopt.d.ts +3 -2
  219. package/dist/commands/adopt.d.ts.map +1 -1
  220. package/dist/commands/adopt.js +7 -6
  221. package/dist/commands/adopt.js.map +1 -1
  222. package/dist/commands/consult/agy-auth-cache.d.ts +97 -0
  223. package/dist/commands/consult/agy-auth-cache.d.ts.map +1 -0
  224. package/dist/commands/consult/agy-auth-cache.js +320 -0
  225. package/dist/commands/consult/agy-auth-cache.js.map +1 -0
  226. package/dist/commands/consult/cli-options.d.ts +34 -0
  227. package/dist/commands/consult/cli-options.d.ts.map +1 -0
  228. package/dist/commands/consult/cli-options.js +67 -0
  229. package/dist/commands/consult/cli-options.js.map +1 -0
  230. package/dist/commands/consult/index.d.ts +56 -2
  231. package/dist/commands/consult/index.d.ts.map +1 -1
  232. package/dist/commands/consult/index.js +330 -27
  233. package/dist/commands/consult/index.js.map +1 -1
  234. package/dist/commands/consult/metrics.d.ts +42 -0
  235. package/dist/commands/consult/metrics.d.ts.map +1 -1
  236. package/dist/commands/consult/metrics.js +129 -9
  237. package/dist/commands/consult/metrics.js.map +1 -1
  238. package/dist/commands/doctor.d.ts +28 -0
  239. package/dist/commands/doctor.d.ts.map +1 -1
  240. package/dist/commands/doctor.js +258 -22
  241. package/dist/commands/doctor.js.map +1 -1
  242. package/dist/commands/init.d.ts +3 -2
  243. package/dist/commands/init.d.ts.map +1 -1
  244. package/dist/commands/init.js +7 -6
  245. package/dist/commands/init.js.map +1 -1
  246. package/dist/commands/porch/checks.d.ts +23 -0
  247. package/dist/commands/porch/checks.d.ts.map +1 -1
  248. package/dist/commands/porch/checks.js +60 -0
  249. package/dist/commands/porch/checks.js.map +1 -1
  250. package/dist/commands/porch/config.d.ts +20 -0
  251. package/dist/commands/porch/config.d.ts.map +1 -1
  252. package/dist/commands/porch/config.js +20 -0
  253. package/dist/commands/porch/config.js.map +1 -1
  254. package/dist/commands/porch/index.d.ts.map +1 -1
  255. package/dist/commands/porch/index.js +32 -36
  256. package/dist/commands/porch/index.js.map +1 -1
  257. package/dist/commands/porch/next.d.ts.map +1 -1
  258. package/dist/commands/porch/next.js +2 -41
  259. package/dist/commands/porch/next.js.map +1 -1
  260. package/dist/commands/update.d.ts +4 -4
  261. package/dist/commands/update.d.ts.map +1 -1
  262. package/dist/commands/update.js +9 -11
  263. package/dist/commands/update.js.map +1 -1
  264. package/dist/lib/config.d.ts +70 -3
  265. package/dist/lib/config.d.ts.map +1 -1
  266. package/dist/lib/config.js +67 -3
  267. package/dist/lib/config.js.map +1 -1
  268. package/dist/lib/consult-lanes.d.ts +149 -0
  269. package/dist/lib/consult-lanes.d.ts.map +1 -0
  270. package/dist/lib/consult-lanes.js +360 -0
  271. package/dist/lib/consult-lanes.js.map +1 -0
  272. package/dist/lib/default-branch.d.ts +1 -1
  273. package/dist/lib/default-branch.js +1 -1
  274. package/dist/lib/github.js +1 -1
  275. package/dist/lib/github.js.map +1 -1
  276. package/dist/lib/gitignore.d.ts +25 -2
  277. package/dist/lib/gitignore.d.ts.map +1 -1
  278. package/dist/lib/gitignore.js +70 -0
  279. package/dist/lib/gitignore.js.map +1 -1
  280. package/dist/lib/migration-backup-audit.d.ts +64 -0
  281. package/dist/lib/migration-backup-audit.d.ts.map +1 -0
  282. package/dist/lib/migration-backup-audit.js +145 -0
  283. package/dist/lib/migration-backup-audit.js.map +1 -0
  284. package/dist/lib/prompt-behavior-metrics.d.ts +67 -0
  285. package/dist/lib/prompt-behavior-metrics.d.ts.map +1 -0
  286. package/dist/lib/prompt-behavior-metrics.js +290 -0
  287. package/dist/lib/prompt-behavior-metrics.js.map +1 -0
  288. package/dist/lib/protocol-drift-audit.d.ts +118 -0
  289. package/dist/lib/protocol-drift-audit.d.ts.map +1 -0
  290. package/dist/lib/protocol-drift-audit.js +217 -0
  291. package/dist/lib/protocol-drift-audit.js.map +1 -0
  292. package/dist/lib/scaffold.d.ts +10 -3
  293. package/dist/lib/scaffold.d.ts.map +1 -1
  294. package/dist/lib/scaffold.js +29 -26
  295. package/dist/lib/scaffold.js.map +1 -1
  296. package/dist/lib/skeleton.d.ts +22 -1
  297. package/dist/lib/skeleton.d.ts.map +1 -1
  298. package/dist/lib/skeleton.js +120 -0
  299. package/dist/lib/skeleton.js.map +1 -1
  300. package/dist/lib/test-env.d.ts +74 -0
  301. package/dist/lib/test-env.d.ts.map +1 -0
  302. package/dist/lib/test-env.js +92 -0
  303. package/dist/lib/test-env.js.map +1 -0
  304. package/dist/terminal/pty-manager.d.ts +9 -0
  305. package/dist/terminal/pty-manager.d.ts.map +1 -1
  306. package/dist/terminal/pty-manager.js +32 -6
  307. package/dist/terminal/pty-manager.js.map +1 -1
  308. package/dist/terminal/pty-session.d.ts +156 -4
  309. package/dist/terminal/pty-session.d.ts.map +1 -1
  310. package/dist/terminal/pty-session.js +307 -42
  311. package/dist/terminal/pty-session.js.map +1 -1
  312. package/dist/terminal/ring-buffer.d.ts +39 -6
  313. package/dist/terminal/ring-buffer.d.ts.map +1 -1
  314. package/dist/terminal/ring-buffer.js +74 -6
  315. package/dist/terminal/ring-buffer.js.map +1 -1
  316. package/dist/terminal/session-manager.d.ts +129 -0
  317. package/dist/terminal/session-manager.d.ts.map +1 -1
  318. package/dist/terminal/session-manager.js +337 -44
  319. package/dist/terminal/session-manager.js.map +1 -1
  320. package/dist/terminal/session-screen.d.ts +91 -0
  321. package/dist/terminal/session-screen.d.ts.map +1 -0
  322. package/dist/terminal/session-screen.js +135 -0
  323. package/dist/terminal/session-screen.js.map +1 -0
  324. package/dist/terminal/shellper-client.d.ts +19 -4
  325. package/dist/terminal/shellper-client.d.ts.map +1 -1
  326. package/dist/terminal/shellper-client.js +70 -8
  327. package/dist/terminal/shellper-client.js.map +1 -1
  328. package/dist/terminal/shellper-main.js +2 -1
  329. package/dist/terminal/shellper-main.js.map +1 -1
  330. package/dist/terminal/shellper-process.d.ts +1 -1
  331. package/dist/terminal/shellper-process.d.ts.map +1 -1
  332. package/dist/terminal/shellper-process.js +33 -9
  333. package/dist/terminal/shellper-process.js.map +1 -1
  334. package/dist/terminal/shellper-protocol.d.ts +40 -2
  335. package/dist/terminal/shellper-protocol.d.ts.map +1 -1
  336. package/dist/terminal/shellper-protocol.js +72 -5
  337. package/dist/terminal/shellper-protocol.js.map +1 -1
  338. package/dist/terminal/shellper-replay-buffer.d.ts +69 -7
  339. package/dist/terminal/shellper-replay-buffer.d.ts.map +1 -1
  340. package/dist/terminal/shellper-replay-buffer.js +167 -31
  341. package/dist/terminal/shellper-replay-buffer.js.map +1 -1
  342. package/package.json +11 -9
  343. package/skeleton/.claude/skills/afx/SKILL.md +27 -1
  344. package/skeleton/.claude/skills/arch-init/SKILL.md +135 -0
  345. package/skeleton/.claude/skills/arch-save/SKILL.md +183 -0
  346. package/skeleton/.claude/skills/codev/SKILL.md +33 -2
  347. package/skeleton/.claude/skills/runnable-worktrees/SKILL.md +119 -0
  348. package/skeleton/.codex/skills/afx/SKILL.md +170 -0
  349. package/skeleton/.codex/skills/arch-init/SKILL.md +135 -0
  350. package/skeleton/.codex/skills/arch-save/SKILL.md +183 -0
  351. package/skeleton/.codex/skills/codev/SKILL.md +90 -0
  352. package/skeleton/.codex/skills/consult/SKILL.md +96 -0
  353. package/skeleton/.codex/skills/generate-image/SKILL.md +45 -0
  354. package/skeleton/.codex/skills/porch/SKILL.md +60 -0
  355. package/skeleton/.codex/skills/runnable-worktrees/SKILL.md +119 -0
  356. package/skeleton/.codex/skills/update-arch-docs/SKILL.md +132 -0
  357. package/skeleton/protocols/air/builder-prompt.md +28 -47
  358. package/skeleton/protocols/air/consult-types/impl-review.md +17 -34
  359. package/skeleton/protocols/air/consult-types/pr-review.md +14 -37
  360. package/skeleton/protocols/air/prompts/implement.md +20 -73
  361. package/skeleton/protocols/air/prompts/pr.md +22 -54
  362. package/skeleton/protocols/air/protocol.md +40 -71
  363. package/skeleton/protocols/aspir/builder-prompt.md +29 -66
  364. package/skeleton/protocols/aspir/consult-types/impl-review.md +17 -44
  365. package/skeleton/protocols/aspir/consult-types/phase-review.md +17 -44
  366. package/skeleton/protocols/aspir/consult-types/plan-review.md +14 -38
  367. package/skeleton/protocols/aspir/consult-types/pr-review.md +13 -39
  368. package/skeleton/protocols/aspir/consult-types/spec-review.md +13 -33
  369. package/skeleton/protocols/aspir/prompts/implement.md +27 -196
  370. package/skeleton/protocols/aspir/prompts/plan.md +21 -85
  371. package/skeleton/protocols/aspir/prompts/review.md +29 -228
  372. package/skeleton/protocols/aspir/prompts/specify.md +25 -111
  373. package/skeleton/protocols/aspir/protocol.json +10 -0
  374. package/skeleton/protocols/aspir/protocol.md +36 -82
  375. package/skeleton/protocols/bugfix/builder-prompt.md +23 -45
  376. package/skeleton/protocols/bugfix/consult-types/impl-review.md +21 -45
  377. package/skeleton/protocols/bugfix/consult-types/pr-review.md +18 -52
  378. package/skeleton/protocols/bugfix/prompts/fix.md +16 -61
  379. package/skeleton/protocols/bugfix/prompts/investigate.md +18 -62
  380. package/skeleton/protocols/bugfix/prompts/pr.md +22 -57
  381. package/skeleton/protocols/bugfix/protocol.md +44 -50
  382. package/skeleton/protocols/experiment/builder-prompt.md +25 -58
  383. package/skeleton/protocols/experiment/protocol.md +22 -188
  384. package/skeleton/protocols/experiment/templates/notes.md +11 -71
  385. package/skeleton/protocols/maintain/builder-prompt.md +24 -45
  386. package/skeleton/protocols/maintain/consult-types/impl-review.md +17 -44
  387. package/skeleton/protocols/maintain/consult-types/pr-review.md +13 -39
  388. package/skeleton/protocols/maintain/prompts/maintain.md +1 -1
  389. package/skeleton/protocols/maintain/protocol.md +32 -266
  390. package/skeleton/protocols/maintain/templates/maintenance-run.md +11 -0
  391. package/skeleton/protocols/pir/builder-prompt.md +30 -64
  392. package/skeleton/protocols/pir/consult-types/impl-review.md +17 -50
  393. package/skeleton/protocols/pir/consult-types/pr-review.md +11 -40
  394. package/skeleton/protocols/pir/prompts/implement.md +1 -2
  395. package/skeleton/protocols/pir/prompts/plan.md +0 -3
  396. package/skeleton/protocols/pir/prompts/review.md +1 -1
  397. package/skeleton/protocols/pir/protocol.md +54 -177
  398. package/skeleton/protocols/research/builder-prompt.md +27 -58
  399. package/skeleton/protocols/research/protocol.md +28 -153
  400. package/skeleton/protocols/spike/builder-prompt.md +30 -48
  401. package/skeleton/protocols/spike/protocol.md +24 -107
  402. package/skeleton/protocols/spike/templates/findings.md +9 -39
  403. package/skeleton/protocols/spir/builder-prompt.md +33 -62
  404. package/skeleton/protocols/spir/consult-types/impl-review.md +17 -44
  405. package/skeleton/protocols/spir/consult-types/phase-review.md +17 -44
  406. package/skeleton/protocols/spir/consult-types/plan-review.md +14 -38
  407. package/skeleton/protocols/spir/consult-types/pr-review.md +13 -39
  408. package/skeleton/protocols/spir/consult-types/spec-review.md +13 -33
  409. package/skeleton/protocols/spir/prompts/implement.md +26 -195
  410. package/skeleton/protocols/spir/prompts/plan.md +20 -84
  411. package/skeleton/protocols/spir/prompts/review.md +28 -227
  412. package/skeleton/protocols/spir/prompts/specify.md +24 -110
  413. package/skeleton/protocols/spir/protocol.json +10 -0
  414. package/skeleton/protocols/spir/protocol.md +84 -633
  415. package/skeleton/protocols/spir/templates/plan.md +28 -147
  416. package/skeleton/protocols/spir/templates/review.md +21 -80
  417. package/skeleton/protocols/spir/templates/spec.md +24 -118
  418. package/skeleton/resources/commands/agent-farm.md +348 -0
  419. package/skeleton/resources/commands/codev.md +5 -0
  420. package/skeleton/resources/commands/consult.md +262 -8
  421. package/skeleton/resources/commands/overview.md +1 -0
  422. package/skeleton/roles/architect.md +67 -306
  423. package/skeleton/roles/builder.md +77 -191
  424. package/skeleton/templates/AGENTS.md +2 -0
  425. package/skeleton/templates/CLAUDE.md +2 -0
  426. package/templates/tower.html +39 -2
  427. package/dashboard-dist/assets/index-BZ1x7x1X.js.map +0 -1
  428. package/dashboard-dist/assets/index-DB1KBSNE.css +0 -32
  429. package/dist/agent-farm/servers/send-buffer.d.ts +0 -59
  430. package/dist/agent-farm/servers/send-buffer.d.ts.map +0 -1
  431. package/dist/agent-farm/servers/send-buffer.js +0 -103
  432. package/dist/agent-farm/servers/send-buffer.js.map +0 -1
  433. package/skeleton/porch/prompts/defend.md +0 -108
  434. package/skeleton/porch/prompts/diagnose.md +0 -70
  435. package/skeleton/porch/prompts/evaluate.md +0 -132
  436. package/skeleton/porch/prompts/fix.md +0 -59
  437. package/skeleton/porch/prompts/implement.md +0 -88
  438. package/skeleton/porch/prompts/plan.md +0 -74
  439. package/skeleton/porch/prompts/pr.md +0 -84
  440. package/skeleton/porch/prompts/review.md +0 -249
  441. package/skeleton/porch/prompts/specify.md +0 -53
  442. package/skeleton/porch/prompts/test.md +0 -63
  443. package/skeleton/protocols/aspir/templates/plan.md +0 -184
  444. package/skeleton/protocols/aspir/templates/review.md +0 -120
  445. package/skeleton/protocols/aspir/templates/spec.md +0 -154
@@ -0,0 +1,129 @@
1
+ // CLI handlers for `afx inbox` (Spec 1313).
2
+ //
3
+ // Lists *held* (undelivered) mailbox messages, shows one by id (including its body),
4
+ // and dismisses them. The mailbox lives in the user-global global.db that Tower owns,
5
+ // so — like `afx cron` — these handlers talk to the Tower API rather than opening the
6
+ // DB directly.
7
+ //
8
+ // The list is metadata-only (id, age, why-held reason, from→to, workspace): bodies are
9
+ // deliberately NOT surfaced in the list, and never travel through logs. `afx inbox show
10
+ // <id>` is the one surface that DOES display a body — legitimately, over the same local
11
+ // Tower connection that carries it (Spec 1313 Redaction rule: redaction covers logs/
12
+ // diagnostics/telemetry, not this local operator view). Dismiss is a soft transition (the
13
+ // row is marked `dismissed`, not deleted) and is authorized at the workspace-human trust
14
+ // level — any local operator may dismiss (or show) any held row (Spec 1313 decision 8).
15
+ import { getTowerClient, DEFAULT_TOWER_PORT } from '../lib/tower-client.js';
16
+ import { logger, fatal } from '../utils/logger.js';
17
+ import { getConfig } from '../utils/config.js';
18
+ /** Compact human duration ("5s", "3m", "2h", "1d") from a millisecond delta. */
19
+ function formatDuration(ms) {
20
+ const secs = Math.max(0, Math.floor(ms / 1000));
21
+ if (secs < 60)
22
+ return `${secs}s`;
23
+ const mins = Math.floor(secs / 60);
24
+ if (mins < 60)
25
+ return `${mins}m`;
26
+ const hours = Math.floor(mins / 60);
27
+ if (hours < 24)
28
+ return `${hours}h`;
29
+ return `${Math.floor(hours / 24)}d`;
30
+ }
31
+ /** Compact human age ("5s", "3m", "2h", "1d") from an epoch-ms timestamp. */
32
+ function formatAge(createdAt, now) {
33
+ return formatDuration(now - createdAt);
34
+ }
35
+ /**
36
+ * `afx inbox` — list held messages for a workspace. Workspace-scoped per spec
37
+ * decision 8: defaults to the current workspace (`getConfig().workspaceRoot`);
38
+ * `--workspace <path>` lists a different one. Tower normalizes the path, so rows
39
+ * enqueued under the workspace's realpath still match. A `!` after the reason marks
40
+ * a row that has crossed the escalation age.
41
+ */
42
+ export async function inboxList(options = {}) {
43
+ const client = getTowerClient(options.port || DEFAULT_TOWER_PORT);
44
+ // Decision 8: workspace-scoped. Default to the current workspace when no explicit
45
+ // --workspace was given, so `afx inbox` shows this workspace's held mail — not
46
+ // every workspace Tower knows about.
47
+ const workspace = options.workspace ?? getConfig().workspaceRoot;
48
+ const path = `/api/inbox?workspace=${encodeURIComponent(workspace)}`;
49
+ const result = await client.request(path);
50
+ if (!result.ok) {
51
+ fatal(result.error || 'Failed to fetch inbox');
52
+ }
53
+ const rows = result.data;
54
+ if (rows.length === 0) {
55
+ logger.info('No held messages.');
56
+ return;
57
+ }
58
+ logger.header(`Held messages (${rows.length})`);
59
+ const widths = [38, 6, 13, 22, 14];
60
+ logger.row(['ID', 'AGE', 'REASON', 'FROM → TO', 'WORKSPACE'], widths);
61
+ logger.row(['─'.repeat(36), '─'.repeat(5), '─'.repeat(12), '─'.repeat(21), '─'.repeat(13)], widths);
62
+ const now = Date.now();
63
+ for (const row of rows) {
64
+ const wsName = row.workspacePath.split('/').pop() || row.workspacePath;
65
+ const fromTo = `${row.fromAgent ?? '?'} → ${row.toAgent}`;
66
+ // Spec 1313 round 3: a pre-due delayed (`--delay`) row is SCHEDULED, not stuck — render
67
+ // its due countdown ("→15s") in the AGE column and "scheduled" as the reason, so a delayed
68
+ // send that is simply waiting for its due time is not mistaken for a starving held message.
69
+ const preDue = row.notBefore != null && row.notBefore > now;
70
+ const ageCell = preDue ? `→${formatDuration(row.notBefore - now)}` : formatAge(row.createdAt, now);
71
+ const reason = preDue ? 'scheduled' : `${row.reason ?? 'held'}${row.escalated ? '!' : ''}`;
72
+ logger.row([row.id, ageCell, reason.slice(0, 13), fromTo.slice(0, 22), wsName.slice(0, 14)], widths);
73
+ }
74
+ logger.blank();
75
+ logger.info('Show a message body: afx inbox show <id> · Dismiss: afx inbox dismiss <id>');
76
+ }
77
+ /**
78
+ * `afx inbox show <id>` — display a single mailbox row INCLUDING its body. This is the
79
+ * one CLI surface that legitimately surfaces a message body: the Spec 1313 Redaction rule
80
+ * bars bodies from logs/diagnostics/telemetry, not from this local operator view, which
81
+ * travels over the same local Tower connection the message already uses. Works on a row of
82
+ * ANY status (held / delivered / superseded / dismissed) so an operator can inspect or
83
+ * audit by id — the list, by contrast, is held-only and metadata-only. Friendly error if
84
+ * the id names no row.
85
+ */
86
+ export async function inboxShow(id, options = {}) {
87
+ const client = getTowerClient(options.port || DEFAULT_TOWER_PORT);
88
+ const result = await client.request(`/api/inbox/${encodeURIComponent(id)}`);
89
+ if (!result.ok) {
90
+ fatal(result.error || `Failed to fetch '${id}'`);
91
+ }
92
+ const row = result.data;
93
+ const from = row.fromWorkspace ? `${row.fromAgent ?? '?'} (${row.fromWorkspace})` : row.fromAgent ?? '?';
94
+ logger.header(`Message ${row.id}`);
95
+ logger.kv('Status', `${row.status}${row.escalated ? ' (escalated)' : ''}`);
96
+ logger.kv('Reason', row.reason ?? '—');
97
+ logger.kv('From → To', `${from} → ${row.toAgent}`);
98
+ logger.kv('Workspace', row.workspacePath);
99
+ logger.kv('Created', new Date(row.createdAt).toISOString());
100
+ // Spec 1313 round 3: a still-scheduled delayed (`--delay`) row shows its due time and
101
+ // countdown; a delayed row already past its due time is deliverable and needs no annotation.
102
+ if (row.notBefore != null && row.status === 'held') {
103
+ const now = Date.now();
104
+ const label = row.notBefore > now ? `${new Date(row.notBefore).toISOString()} (in ${formatDuration(row.notBefore - now)})` : `${new Date(row.notBefore).toISOString()} (due)`;
105
+ logger.kv('Scheduled', label);
106
+ }
107
+ if (row.resolvedAt) {
108
+ logger.kv('Resolved', new Date(row.resolvedAt).toISOString());
109
+ }
110
+ // The message body is raw user content — print it verbatim, with no [info] prefix or
111
+ // indent. This is the deliberate, spec-sanctioned exception to redaction: bodies surface
112
+ // only here (and on the live terminal), never in logs.
113
+ logger.header('Body');
114
+ console.log(row.body);
115
+ }
116
+ /**
117
+ * `afx inbox dismiss <id>` — mark a held row dismissed. Soft transition (auditable,
118
+ * pruned later); never delivers the message. Returns a friendly error if the id does
119
+ * not name a currently-held row.
120
+ */
121
+ export async function inboxDismiss(id, options = {}) {
122
+ const client = getTowerClient(options.port || DEFAULT_TOWER_PORT);
123
+ const result = await client.request(`/api/inbox/${encodeURIComponent(id)}/dismiss`, { method: 'POST' });
124
+ if (!result.ok) {
125
+ fatal(result.error || `Failed to dismiss '${id}'`);
126
+ }
127
+ logger.success(`Dismissed held message ${id}`);
128
+ }
129
+ //# sourceMappingURL=inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../../src/agent-farm/commands/inbox.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,qFAAqF;AACrF,sFAAsF;AACtF,sFAAsF;AACtF,eAAe;AACf,EAAE;AACF,uFAAuF;AACvF,wFAAwF;AACxF,wFAAwF;AACxF,qFAAqF;AACrF,0FAA0F;AAC1F,yFAAyF;AACzF,wFAAwF;AAExF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0D/C,gFAAgF;AAChF,SAAS,cAAc,CAAC,EAAU;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAChD,IAAI,IAAI,GAAG,EAAE;QAAE,OAAO,GAAG,IAAI,GAAG,CAAC;IACjC,MAAM,IAAI,GAAG,IAAI,CAAC,K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uDAAuD;IACvD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAU,EAAE,UAA+B,EAAE;IAC9E,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,IAAI,kBAAkB,CAAC,CAAC;IAElE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CACjC,cAAc,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,CACnB,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,sBAAsB,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC"}
@@ -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,wDAAwD,CAAC,CAAC;IAClE,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG,mBAAmB,EAAE,IAAI,SAAS,CAAC;IAErD,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,IAAI,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
+ /**
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,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,cAAc,EAAE,aAAa,GAAG,YAAY,CAAC;IAC7C,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAA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