@cluesmith/codev 2.0.0-rc.9 → 2.0.1

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 (537) hide show
  1. package/bin/af.js +2 -2
  2. package/bin/consult.js +1 -1
  3. package/dashboard/dist/assets/index-4n9zpWLY.css +32 -0
  4. package/dashboard/dist/assets/index-b38SaXk5.js +136 -0
  5. package/dashboard/dist/assets/index-b38SaXk5.js.map +1 -0
  6. package/dashboard/dist/index.html +14 -0
  7. package/dist/agent-farm/cli.d.ts.map +1 -1
  8. package/dist/agent-farm/cli.js +179 -104
  9. package/dist/agent-farm/cli.js.map +1 -1
  10. package/dist/agent-farm/commands/architect.d.ts +3 -3
  11. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  12. package/dist/agent-farm/commands/architect.js +20 -147
  13. package/dist/agent-farm/commands/architect.js.map +1 -1
  14. package/dist/agent-farm/commands/attach.d.ts +13 -0
  15. package/dist/agent-farm/commands/attach.d.ts.map +1 -0
  16. package/dist/agent-farm/commands/attach.js +144 -0
  17. package/dist/agent-farm/commands/attach.js.map +1 -0
  18. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  19. package/dist/agent-farm/commands/cleanup.js +35 -19
  20. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  21. package/dist/agent-farm/commands/consult.d.ts +3 -4
  22. package/dist/agent-farm/commands/consult.d.ts.map +1 -1
  23. package/dist/agent-farm/commands/consult.js +27 -37
  24. package/dist/agent-farm/commands/consult.js.map +1 -1
  25. package/dist/agent-farm/commands/index.d.ts +2 -2
  26. package/dist/agent-farm/commands/index.d.ts.map +1 -1
  27. package/dist/agent-farm/commands/index.js +2 -2
  28. package/dist/agent-farm/commands/index.js.map +1 -1
  29. package/dist/agent-farm/commands/open.d.ts +4 -2
  30. package/dist/agent-farm/commands/open.d.ts.map +1 -1
  31. package/dist/agent-farm/commands/open.js +33 -83
  32. package/dist/agent-farm/commands/open.js.map +1 -1
  33. package/dist/agent-farm/commands/send.d.ts +1 -1
  34. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  35. package/dist/agent-farm/commands/send.js +70 -79
  36. package/dist/agent-farm/commands/send.js.map +1 -1
  37. package/dist/agent-farm/commands/shell.d.ts +15 -0
  38. package/dist/agent-farm/commands/shell.d.ts.map +1 -0
  39. package/dist/agent-farm/commands/shell.js +50 -0
  40. package/dist/agent-farm/commands/shell.js.map +1 -0
  41. package/dist/agent-farm/commands/spawn-roles.d.ts +80 -0
  42. package/dist/agent-farm/commands/spawn-roles.d.ts.map +1 -0
  43. package/dist/agent-farm/commands/spawn-roles.js +278 -0
  44. package/dist/agent-farm/commands/spawn-roles.js.map +1 -0
  45. package/dist/agent-farm/commands/spawn-worktree.d.ts +96 -0
  46. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -0
  47. package/dist/agent-farm/commands/spawn-worktree.js +305 -0
  48. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -0
  49. package/dist/agent-farm/commands/spawn.d.ts +5 -1
  50. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  51. package/dist/agent-farm/commands/spawn.js +241 -561
  52. package/dist/agent-farm/commands/spawn.js.map +1 -1
  53. package/dist/agent-farm/commands/start.d.ts +10 -20
  54. package/dist/agent-farm/commands/start.d.ts.map +1 -1
  55. package/dist/agent-farm/commands/start.js +45 -449
  56. package/dist/agent-farm/commands/start.js.map +1 -1
  57. package/dist/agent-farm/commands/status.d.ts +2 -0
  58. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  59. package/dist/agent-farm/commands/status.js +75 -24
  60. package/dist/agent-farm/commands/status.js.map +1 -1
  61. package/dist/agent-farm/commands/stop.d.ts +6 -0
  62. package/dist/agent-farm/commands/stop.d.ts.map +1 -1
  63. package/dist/agent-farm/commands/stop.js +49 -109
  64. package/dist/agent-farm/commands/stop.js.map +1 -1
  65. package/dist/agent-farm/commands/tower-cloud.d.ts +48 -0
  66. package/dist/agent-farm/commands/tower-cloud.d.ts.map +1 -0
  67. package/dist/agent-farm/commands/tower-cloud.js +293 -0
  68. package/dist/agent-farm/commands/tower-cloud.js.map +1 -0
  69. package/dist/agent-farm/commands/tower.d.ts +9 -0
  70. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  71. package/dist/agent-farm/commands/tower.js +59 -19
  72. package/dist/agent-farm/commands/tower.js.map +1 -1
  73. package/dist/agent-farm/db/index.d.ts +6 -2
  74. package/dist/agent-farm/db/index.d.ts.map +1 -1
  75. package/dist/agent-farm/db/index.js +301 -19
  76. package/dist/agent-farm/db/index.js.map +1 -1
  77. package/dist/agent-farm/db/migrate.d.ts +0 -4
  78. package/dist/agent-farm/db/migrate.d.ts.map +1 -1
  79. package/dist/agent-farm/db/migrate.js +6 -55
  80. package/dist/agent-farm/db/migrate.js.map +1 -1
  81. package/dist/agent-farm/db/schema.d.ts +3 -3
  82. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  83. package/dist/agent-farm/db/schema.js +25 -19
  84. package/dist/agent-farm/db/schema.js.map +1 -1
  85. package/dist/agent-farm/db/types.d.ts +3 -13
  86. package/dist/agent-farm/db/types.d.ts.map +1 -1
  87. package/dist/agent-farm/db/types.js +3 -11
  88. package/dist/agent-farm/db/types.js.map +1 -1
  89. package/dist/agent-farm/hq-connector.d.ts +2 -6
  90. package/dist/agent-farm/hq-connector.d.ts.map +1 -1
  91. package/dist/agent-farm/hq-connector.js +2 -17
  92. package/dist/agent-farm/hq-connector.js.map +1 -1
  93. package/dist/agent-farm/lib/cloud-config.d.ts +59 -0
  94. package/dist/agent-farm/lib/cloud-config.d.ts.map +1 -0
  95. package/dist/agent-farm/lib/cloud-config.js +143 -0
  96. package/dist/agent-farm/lib/cloud-config.js.map +1 -0
  97. package/dist/agent-farm/lib/device-name.d.ts +25 -0
  98. package/dist/agent-farm/lib/device-name.d.ts.map +1 -0
  99. package/dist/agent-farm/lib/device-name.js +46 -0
  100. package/dist/agent-farm/lib/device-name.js.map +1 -0
  101. package/dist/agent-farm/lib/nonce-store.d.ts +28 -0
  102. package/dist/agent-farm/lib/nonce-store.d.ts.map +1 -0
  103. package/dist/agent-farm/lib/nonce-store.js +60 -0
  104. package/dist/agent-farm/lib/nonce-store.js.map +1 -0
  105. package/dist/agent-farm/lib/token-exchange.d.ts +18 -0
  106. package/dist/agent-farm/lib/token-exchange.d.ts.map +1 -0
  107. package/dist/agent-farm/lib/token-exchange.js +48 -0
  108. package/dist/agent-farm/lib/token-exchange.js.map +1 -0
  109. package/dist/agent-farm/lib/tower-client.d.ts +163 -0
  110. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -0
  111. package/dist/agent-farm/lib/tower-client.js +233 -0
  112. package/dist/agent-farm/lib/tower-client.js.map +1 -0
  113. package/dist/agent-farm/lib/tunnel-client.d.ts +117 -0
  114. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -0
  115. package/dist/agent-farm/lib/tunnel-client.js +504 -0
  116. package/dist/agent-farm/lib/tunnel-client.js.map +1 -0
  117. package/dist/agent-farm/servers/tower-instances.d.ts +82 -0
  118. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -0
  119. package/dist/agent-farm/servers/tower-instances.js +454 -0
  120. package/dist/agent-farm/servers/tower-instances.js.map +1 -0
  121. package/dist/agent-farm/servers/tower-routes.d.ts +34 -0
  122. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -0
  123. package/dist/agent-farm/servers/tower-routes.js +1445 -0
  124. package/dist/agent-farm/servers/tower-routes.js.map +1 -0
  125. package/dist/agent-farm/servers/tower-server.d.ts +5 -2
  126. package/dist/agent-farm/servers/tower-server.d.ts.map +1 -1
  127. package/dist/agent-farm/servers/tower-server.js +157 -475
  128. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  129. package/dist/agent-farm/servers/tower-terminals.d.ts +119 -0
  130. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -0
  131. package/dist/agent-farm/servers/tower-terminals.js +629 -0
  132. package/dist/agent-farm/servers/tower-terminals.js.map +1 -0
  133. package/dist/agent-farm/servers/tower-tunnel.d.ts +34 -0
  134. package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -0
  135. package/dist/agent-farm/servers/tower-tunnel.js +480 -0
  136. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -0
  137. package/dist/agent-farm/servers/tower-types.d.ts +86 -0
  138. package/dist/agent-farm/servers/tower-types.d.ts.map +1 -0
  139. package/dist/agent-farm/servers/tower-types.js +6 -0
  140. package/dist/agent-farm/servers/tower-types.js.map +1 -0
  141. package/dist/agent-farm/servers/tower-utils.d.ts +58 -0
  142. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -0
  143. package/dist/agent-farm/servers/tower-utils.js +182 -0
  144. package/dist/agent-farm/servers/tower-utils.js.map +1 -0
  145. package/dist/agent-farm/servers/tower-websocket.d.ts +25 -0
  146. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -0
  147. package/dist/agent-farm/servers/tower-websocket.js +171 -0
  148. package/dist/agent-farm/servers/tower-websocket.js.map +1 -0
  149. package/dist/agent-farm/state.d.ts +6 -2
  150. package/dist/agent-farm/state.d.ts.map +1 -1
  151. package/dist/agent-farm/state.js +34 -25
  152. package/dist/agent-farm/state.js.map +1 -1
  153. package/dist/agent-farm/types.d.ts +49 -26
  154. package/dist/agent-farm/types.d.ts.map +1 -1
  155. package/dist/agent-farm/utils/config.d.ts +0 -5
  156. package/dist/agent-farm/utils/config.d.ts.map +1 -1
  157. package/dist/agent-farm/utils/config.js +12 -44
  158. package/dist/agent-farm/utils/config.js.map +1 -1
  159. package/dist/agent-farm/utils/deps.d.ts.map +1 -1
  160. package/dist/agent-farm/utils/deps.js +0 -32
  161. package/dist/agent-farm/utils/deps.js.map +1 -1
  162. package/dist/agent-farm/utils/file-tabs.d.ts +27 -0
  163. package/dist/agent-farm/utils/file-tabs.d.ts.map +1 -0
  164. package/dist/agent-farm/utils/file-tabs.js +46 -0
  165. package/dist/agent-farm/utils/file-tabs.js.map +1 -0
  166. package/dist/agent-farm/utils/gate-status.d.ts +16 -0
  167. package/dist/agent-farm/utils/gate-status.d.ts.map +1 -0
  168. package/dist/agent-farm/utils/gate-status.js +79 -0
  169. package/dist/agent-farm/utils/gate-status.js.map +1 -0
  170. package/dist/agent-farm/utils/gate-watcher.d.ts +38 -0
  171. package/dist/agent-farm/utils/gate-watcher.d.ts.map +1 -0
  172. package/dist/agent-farm/utils/gate-watcher.js +122 -0
  173. package/dist/agent-farm/utils/gate-watcher.js.map +1 -0
  174. package/dist/agent-farm/utils/index.d.ts +0 -1
  175. package/dist/agent-farm/utils/index.d.ts.map +1 -1
  176. package/dist/agent-farm/utils/index.js +0 -1
  177. package/dist/agent-farm/utils/index.js.map +1 -1
  178. package/dist/agent-farm/utils/notifications.d.ts +30 -0
  179. package/dist/agent-farm/utils/notifications.d.ts.map +1 -0
  180. package/dist/agent-farm/utils/notifications.js +121 -0
  181. package/dist/agent-farm/utils/notifications.js.map +1 -0
  182. package/dist/agent-farm/utils/server-utils.d.ts +5 -5
  183. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  184. package/dist/agent-farm/utils/server-utils.js +5 -16
  185. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  186. package/dist/agent-farm/utils/session.d.ts +32 -0
  187. package/dist/agent-farm/utils/session.d.ts.map +1 -0
  188. package/dist/agent-farm/utils/session.js +57 -0
  189. package/dist/agent-farm/utils/session.js.map +1 -0
  190. package/dist/agent-farm/utils/shell.d.ts +9 -22
  191. package/dist/agent-farm/utils/shell.d.ts.map +1 -1
  192. package/dist/agent-farm/utils/shell.js +34 -34
  193. package/dist/agent-farm/utils/shell.js.map +1 -1
  194. package/dist/cli.d.ts.map +1 -1
  195. package/dist/cli.js +6 -37
  196. package/dist/cli.js.map +1 -1
  197. package/dist/commands/adopt.d.ts.map +1 -1
  198. package/dist/commands/adopt.js +33 -4
  199. package/dist/commands/adopt.js.map +1 -1
  200. package/dist/commands/consult/index.d.ts +13 -2
  201. package/dist/commands/consult/index.d.ts.map +1 -1
  202. package/dist/commands/consult/index.js +244 -29
  203. package/dist/commands/consult/index.js.map +1 -1
  204. package/dist/commands/doctor.d.ts.map +1 -1
  205. package/dist/commands/doctor.js +96 -79
  206. package/dist/commands/doctor.js.map +1 -1
  207. package/dist/commands/init.d.ts.map +1 -1
  208. package/dist/commands/init.js +36 -3
  209. package/dist/commands/init.js.map +1 -1
  210. package/dist/commands/porch/build-counter.d.ts +5 -0
  211. package/dist/commands/porch/build-counter.d.ts.map +1 -0
  212. package/dist/commands/porch/build-counter.js +5 -0
  213. package/dist/commands/porch/build-counter.js.map +1 -0
  214. package/dist/commands/porch/checks.d.ts +3 -2
  215. package/dist/commands/porch/checks.d.ts.map +1 -1
  216. package/dist/commands/porch/checks.js +8 -2
  217. package/dist/commands/porch/checks.js.map +1 -1
  218. package/dist/commands/porch/index.d.ts +4 -0
  219. package/dist/commands/porch/index.d.ts.map +1 -1
  220. package/dist/commands/porch/index.js +109 -70
  221. package/dist/commands/porch/index.js.map +1 -1
  222. package/dist/commands/porch/next.d.ts +22 -0
  223. package/dist/commands/porch/next.d.ts.map +1 -0
  224. package/dist/commands/porch/next.js +571 -0
  225. package/dist/commands/porch/next.js.map +1 -0
  226. package/dist/commands/porch/plan.d.ts +11 -1
  227. package/dist/commands/porch/plan.d.ts.map +1 -1
  228. package/dist/commands/porch/plan.js +33 -5
  229. package/dist/commands/porch/plan.js.map +1 -1
  230. package/dist/commands/porch/prompts.d.ts.map +1 -1
  231. package/dist/commands/porch/prompts.js +44 -26
  232. package/dist/commands/porch/prompts.js.map +1 -1
  233. package/dist/commands/porch/protocol.d.ts +6 -4
  234. package/dist/commands/porch/protocol.d.ts.map +1 -1
  235. package/dist/commands/porch/protocol.js +59 -15
  236. package/dist/commands/porch/protocol.js.map +1 -1
  237. package/dist/commands/porch/state.d.ts +29 -2
  238. package/dist/commands/porch/state.d.ts.map +1 -1
  239. package/dist/commands/porch/state.js +71 -3
  240. package/dist/commands/porch/state.js.map +1 -1
  241. package/dist/commands/porch/types.d.ts +45 -2
  242. package/dist/commands/porch/types.d.ts.map +1 -1
  243. package/dist/commands/porch/verdict.d.ts +31 -0
  244. package/dist/commands/porch/verdict.d.ts.map +1 -0
  245. package/dist/commands/porch/verdict.js +59 -0
  246. package/dist/commands/porch/verdict.js.map +1 -0
  247. package/dist/commands/update.d.ts.map +1 -1
  248. package/dist/commands/update.js +18 -6
  249. package/dist/commands/update.js.map +1 -1
  250. package/dist/lib/scaffold.d.ts +13 -0
  251. package/dist/lib/scaffold.d.ts.map +1 -1
  252. package/dist/lib/scaffold.js +36 -0
  253. package/dist/lib/scaffold.js.map +1 -1
  254. package/dist/terminal/index.d.ts +8 -0
  255. package/dist/terminal/index.d.ts.map +1 -0
  256. package/dist/terminal/index.js +5 -0
  257. package/dist/terminal/index.js.map +1 -0
  258. package/dist/terminal/pty-manager.d.ts +69 -0
  259. package/dist/terminal/pty-manager.d.ts.map +1 -0
  260. package/dist/terminal/pty-manager.js +377 -0
  261. package/dist/terminal/pty-manager.js.map +1 -0
  262. package/dist/terminal/pty-session.d.ts +104 -0
  263. package/dist/terminal/pty-session.d.ts.map +1 -0
  264. package/dist/terminal/pty-session.js +327 -0
  265. package/dist/terminal/pty-session.js.map +1 -0
  266. package/dist/terminal/ring-buffer.d.ts +34 -0
  267. package/dist/terminal/ring-buffer.d.ts.map +1 -0
  268. package/dist/terminal/ring-buffer.js +94 -0
  269. package/dist/terminal/ring-buffer.js.map +1 -0
  270. package/dist/terminal/session-manager.d.ts +115 -0
  271. package/dist/terminal/session-manager.d.ts.map +1 -0
  272. package/dist/terminal/session-manager.js +582 -0
  273. package/dist/terminal/session-manager.js.map +1 -0
  274. package/dist/terminal/shellper-client.d.ts +66 -0
  275. package/dist/terminal/shellper-client.d.ts.map +1 -0
  276. package/dist/terminal/shellper-client.js +234 -0
  277. package/dist/terminal/shellper-client.js.map +1 -0
  278. package/dist/terminal/shellper-main.d.ts +19 -0
  279. package/dist/terminal/shellper-main.d.ts.map +1 -0
  280. package/dist/terminal/shellper-main.js +153 -0
  281. package/dist/terminal/shellper-main.js.map +1 -0
  282. package/dist/terminal/shellper-process.d.ts +75 -0
  283. package/dist/terminal/shellper-process.d.ts.map +1 -0
  284. package/dist/terminal/shellper-process.js +279 -0
  285. package/dist/terminal/shellper-process.js.map +1 -0
  286. package/dist/terminal/shellper-protocol.d.ts +115 -0
  287. package/dist/terminal/shellper-protocol.d.ts.map +1 -0
  288. package/dist/terminal/shellper-protocol.js +214 -0
  289. package/dist/terminal/shellper-protocol.js.map +1 -0
  290. package/dist/terminal/shellper-replay-buffer.d.ts +38 -0
  291. package/dist/terminal/shellper-replay-buffer.d.ts.map +1 -0
  292. package/dist/terminal/shellper-replay-buffer.js +94 -0
  293. package/dist/terminal/shellper-replay-buffer.js.map +1 -0
  294. package/dist/terminal/ws-protocol.d.ts +27 -0
  295. package/dist/terminal/ws-protocol.d.ts.map +1 -0
  296. package/dist/terminal/ws-protocol.js +44 -0
  297. package/dist/terminal/ws-protocol.js.map +1 -0
  298. package/package.json +17 -5
  299. package/skeleton/.claude/skills/af/SKILL.md +89 -0
  300. package/skeleton/.claude/skills/codev/SKILL.md +41 -0
  301. package/skeleton/.claude/skills/consult/SKILL.md +81 -0
  302. package/skeleton/.claude/skills/generate-image/SKILL.md +56 -0
  303. package/skeleton/DEPENDENCIES.md +4 -62
  304. package/skeleton/builders.md +1 -1
  305. package/skeleton/consult-types/impl-review.md +18 -9
  306. package/skeleton/consult-types/integration-review.md +1 -1
  307. package/skeleton/consult-types/plan-review.md +1 -1
  308. package/skeleton/consult-types/pr-ready.md +1 -1
  309. package/skeleton/consult-types/spec-review.md +1 -1
  310. package/skeleton/porch/prompts/defend.md +1 -1
  311. package/skeleton/porch/prompts/evaluate.md +2 -2
  312. package/skeleton/porch/prompts/implement.md +1 -1
  313. package/skeleton/porch/prompts/plan.md +1 -1
  314. package/skeleton/porch/prompts/review.md +4 -4
  315. package/skeleton/porch/prompts/specify.md +1 -1
  316. package/skeleton/porch/prompts/understand.md +2 -2
  317. package/skeleton/protocol-schema.json +282 -0
  318. package/skeleton/protocols/bugfix/builder-prompt.md +60 -0
  319. package/skeleton/protocols/bugfix/prompts/fix.md +77 -0
  320. package/skeleton/protocols/bugfix/prompts/investigate.md +77 -0
  321. package/skeleton/protocols/bugfix/prompts/pr.md +84 -0
  322. package/skeleton/protocols/bugfix/protocol.json +20 -33
  323. package/skeleton/protocols/experiment/builder-prompt.md +52 -0
  324. package/skeleton/protocols/experiment/protocol.json +101 -0
  325. package/skeleton/protocols/experiment/protocol.md +3 -3
  326. package/skeleton/protocols/experiment/templates/notes.md +1 -1
  327. package/skeleton/protocols/maintain/builder-prompt.md +46 -0
  328. package/skeleton/protocols/maintain/prompts/audit.md +111 -0
  329. package/skeleton/protocols/maintain/prompts/clean.md +91 -0
  330. package/skeleton/protocols/maintain/prompts/sync.md +113 -0
  331. package/skeleton/protocols/maintain/prompts/verify.md +110 -0
  332. package/skeleton/protocols/maintain/protocol.json +141 -0
  333. package/skeleton/protocols/maintain/protocol.md +17 -11
  334. package/skeleton/protocols/protocol-schema.json +54 -1
  335. package/skeleton/protocols/spir/builder-prompt.md +66 -0
  336. package/skeleton/protocols/spir/prompts/implement.md +208 -0
  337. package/skeleton/protocols/{spider → spir}/prompts/plan.md +6 -70
  338. package/skeleton/protocols/{spider → spir}/prompts/review.md +20 -39
  339. package/skeleton/protocols/{spider → spir}/prompts/specify.md +24 -59
  340. package/skeleton/protocols/{spider → spir}/protocol.json +30 -10
  341. package/skeleton/protocols/{spider → spir}/protocol.md +35 -21
  342. package/skeleton/protocols/spir/templates/review.md +89 -0
  343. package/skeleton/protocols/tick/builder-prompt.md +56 -0
  344. package/skeleton/protocols/tick/protocol.json +7 -2
  345. package/skeleton/protocols/tick/protocol.md +18 -18
  346. package/skeleton/protocols/tick/templates/review.md +1 -1
  347. package/skeleton/resources/commands/agent-farm.md +63 -46
  348. package/skeleton/resources/commands/codev.md +0 -2
  349. package/skeleton/resources/commands/overview.md +7 -17
  350. package/skeleton/resources/workflow-reference.md +4 -4
  351. package/skeleton/roles/architect.md +151 -306
  352. package/skeleton/roles/builder.md +115 -332
  353. package/skeleton/roles/consultant.md +6 -6
  354. package/skeleton/templates/AGENTS.md +2 -2
  355. package/skeleton/templates/CLAUDE.md +2 -2
  356. package/skeleton/templates/cheatsheet.md +7 -5
  357. package/skeleton/templates/projectlist.md +1 -1
  358. package/templates/dashboard/index.html +17 -16
  359. package/templates/dashboard/js/dialogs.js +7 -7
  360. package/templates/dashboard/js/files.js +2 -2
  361. package/templates/dashboard/js/main.js +4 -4
  362. package/templates/dashboard/js/projects.js +3 -3
  363. package/templates/dashboard/js/tabs.js +1 -1
  364. package/templates/dashboard/js/utils.js +22 -1
  365. package/templates/open.html +26 -0
  366. package/templates/tower.html +731 -91
  367. package/dist/agent-farm/commands/kickoff.d.ts +0 -20
  368. package/dist/agent-farm/commands/kickoff.d.ts.map +0 -1
  369. package/dist/agent-farm/commands/kickoff.js +0 -273
  370. package/dist/agent-farm/commands/kickoff.js.map +0 -1
  371. package/dist/agent-farm/commands/rename.d.ts +0 -13
  372. package/dist/agent-farm/commands/rename.d.ts.map +0 -1
  373. package/dist/agent-farm/commands/rename.js +0 -33
  374. package/dist/agent-farm/commands/rename.js.map +0 -1
  375. package/dist/agent-farm/commands/tutorial.d.ts +0 -10
  376. package/dist/agent-farm/commands/tutorial.d.ts.map +0 -1
  377. package/dist/agent-farm/commands/tutorial.js +0 -49
  378. package/dist/agent-farm/commands/tutorial.js.map +0 -1
  379. package/dist/agent-farm/commands/util.d.ts +0 -15
  380. package/dist/agent-farm/commands/util.d.ts.map +0 -1
  381. package/dist/agent-farm/commands/util.js +0 -108
  382. package/dist/agent-farm/commands/util.js.map +0 -1
  383. package/dist/agent-farm/servers/dashboard-server.d.ts +0 -7
  384. package/dist/agent-farm/servers/dashboard-server.d.ts.map +0 -1
  385. package/dist/agent-farm/servers/dashboard-server.js +0 -1858
  386. package/dist/agent-farm/servers/dashboard-server.js.map +0 -1
  387. package/dist/agent-farm/servers/open-server.d.ts +0 -7
  388. package/dist/agent-farm/servers/open-server.d.ts.map +0 -1
  389. package/dist/agent-farm/servers/open-server.js +0 -315
  390. package/dist/agent-farm/servers/open-server.js.map +0 -1
  391. package/dist/agent-farm/tutorial/index.d.ts +0 -8
  392. package/dist/agent-farm/tutorial/index.d.ts.map +0 -1
  393. package/dist/agent-farm/tutorial/index.js +0 -8
  394. package/dist/agent-farm/tutorial/index.js.map +0 -1
  395. package/dist/agent-farm/tutorial/prompts.d.ts +0 -57
  396. package/dist/agent-farm/tutorial/prompts.d.ts.map +0 -1
  397. package/dist/agent-farm/tutorial/prompts.js +0 -147
  398. package/dist/agent-farm/tutorial/prompts.js.map +0 -1
  399. package/dist/agent-farm/tutorial/runner.d.ts +0 -52
  400. package/dist/agent-farm/tutorial/runner.d.ts.map +0 -1
  401. package/dist/agent-farm/tutorial/runner.js +0 -204
  402. package/dist/agent-farm/tutorial/runner.js.map +0 -1
  403. package/dist/agent-farm/tutorial/state.d.ts +0 -26
  404. package/dist/agent-farm/tutorial/state.d.ts.map +0 -1
  405. package/dist/agent-farm/tutorial/state.js +0 -89
  406. package/dist/agent-farm/tutorial/state.js.map +0 -1
  407. package/dist/agent-farm/tutorial/steps/first-spec.d.ts +0 -7
  408. package/dist/agent-farm/tutorial/steps/first-spec.d.ts.map +0 -1
  409. package/dist/agent-farm/tutorial/steps/first-spec.js +0 -136
  410. package/dist/agent-farm/tutorial/steps/first-spec.js.map +0 -1
  411. package/dist/agent-farm/tutorial/steps/implementation.d.ts +0 -7
  412. package/dist/agent-farm/tutorial/steps/implementation.d.ts.map +0 -1
  413. package/dist/agent-farm/tutorial/steps/implementation.js +0 -76
  414. package/dist/agent-farm/tutorial/steps/implementation.js.map +0 -1
  415. package/dist/agent-farm/tutorial/steps/index.d.ts +0 -10
  416. package/dist/agent-farm/tutorial/steps/index.d.ts.map +0 -1
  417. package/dist/agent-farm/tutorial/steps/index.js +0 -10
  418. package/dist/agent-farm/tutorial/steps/index.js.map +0 -1
  419. package/dist/agent-farm/tutorial/steps/planning.d.ts +0 -7
  420. package/dist/agent-farm/tutorial/steps/planning.d.ts.map +0 -1
  421. package/dist/agent-farm/tutorial/steps/planning.js +0 -143
  422. package/dist/agent-farm/tutorial/steps/planning.js.map +0 -1
  423. package/dist/agent-farm/tutorial/steps/review.d.ts +0 -7
  424. package/dist/agent-farm/tutorial/steps/review.d.ts.map +0 -1
  425. package/dist/agent-farm/tutorial/steps/review.js +0 -78
  426. package/dist/agent-farm/tutorial/steps/review.js.map +0 -1
  427. package/dist/agent-farm/tutorial/steps/setup.d.ts +0 -7
  428. package/dist/agent-farm/tutorial/steps/setup.d.ts.map +0 -1
  429. package/dist/agent-farm/tutorial/steps/setup.js +0 -126
  430. package/dist/agent-farm/tutorial/steps/setup.js.map +0 -1
  431. package/dist/agent-farm/tutorial/steps/welcome.d.ts +0 -7
  432. package/dist/agent-farm/tutorial/steps/welcome.d.ts.map +0 -1
  433. package/dist/agent-farm/tutorial/steps/welcome.js +0 -50
  434. package/dist/agent-farm/tutorial/steps/welcome.js.map +0 -1
  435. package/dist/agent-farm/utils/orphan-handler.d.ts +0 -27
  436. package/dist/agent-farm/utils/orphan-handler.d.ts.map +0 -1
  437. package/dist/agent-farm/utils/orphan-handler.js +0 -149
  438. package/dist/agent-farm/utils/orphan-handler.js.map +0 -1
  439. package/dist/agent-farm/utils/port-registry.d.ts +0 -58
  440. package/dist/agent-farm/utils/port-registry.d.ts.map +0 -1
  441. package/dist/agent-farm/utils/port-registry.js +0 -166
  442. package/dist/agent-farm/utils/port-registry.js.map +0 -1
  443. package/dist/agent-farm/utils/terminal-ports.d.ts +0 -18
  444. package/dist/agent-farm/utils/terminal-ports.d.ts.map +0 -1
  445. package/dist/agent-farm/utils/terminal-ports.js +0 -35
  446. package/dist/agent-farm/utils/terminal-ports.js.map +0 -1
  447. package/dist/commands/pcheck/cache.d.ts +0 -48
  448. package/dist/commands/pcheck/cache.d.ts.map +0 -1
  449. package/dist/commands/pcheck/cache.js +0 -170
  450. package/dist/commands/pcheck/cache.js.map +0 -1
  451. package/dist/commands/pcheck/evaluator.d.ts +0 -15
  452. package/dist/commands/pcheck/evaluator.d.ts.map +0 -1
  453. package/dist/commands/pcheck/evaluator.js +0 -246
  454. package/dist/commands/pcheck/evaluator.js.map +0 -1
  455. package/dist/commands/pcheck/index.d.ts +0 -12
  456. package/dist/commands/pcheck/index.d.ts.map +0 -1
  457. package/dist/commands/pcheck/index.js +0 -249
  458. package/dist/commands/pcheck/index.js.map +0 -1
  459. package/dist/commands/pcheck/parser.d.ts +0 -39
  460. package/dist/commands/pcheck/parser.d.ts.map +0 -1
  461. package/dist/commands/pcheck/parser.js +0 -155
  462. package/dist/commands/pcheck/parser.js.map +0 -1
  463. package/dist/commands/pcheck/types.d.ts +0 -82
  464. package/dist/commands/pcheck/types.d.ts.map +0 -1
  465. package/dist/commands/pcheck/types.js +0 -5
  466. package/dist/commands/pcheck/types.js.map +0 -1
  467. package/dist/commands/porch/claude.d.ts +0 -29
  468. package/dist/commands/porch/claude.d.ts.map +0 -1
  469. package/dist/commands/porch/claude.js +0 -79
  470. package/dist/commands/porch/claude.js.map +0 -1
  471. package/dist/commands/porch/consultation.d.ts +0 -56
  472. package/dist/commands/porch/consultation.d.ts.map +0 -1
  473. package/dist/commands/porch/consultation.js +0 -330
  474. package/dist/commands/porch/consultation.js.map +0 -1
  475. package/dist/commands/porch/notifications.d.ts +0 -99
  476. package/dist/commands/porch/notifications.d.ts.map +0 -1
  477. package/dist/commands/porch/notifications.js +0 -223
  478. package/dist/commands/porch/notifications.js.map +0 -1
  479. package/dist/commands/porch/plan-parser.d.ts +0 -38
  480. package/dist/commands/porch/plan-parser.d.ts.map +0 -1
  481. package/dist/commands/porch/plan-parser.js +0 -166
  482. package/dist/commands/porch/plan-parser.js.map +0 -1
  483. package/dist/commands/porch/protocol-loader.d.ts +0 -46
  484. package/dist/commands/porch/protocol-loader.d.ts.map +0 -1
  485. package/dist/commands/porch/protocol-loader.js +0 -262
  486. package/dist/commands/porch/protocol-loader.js.map +0 -1
  487. package/dist/commands/porch/repl.d.ts +0 -33
  488. package/dist/commands/porch/repl.d.ts.map +0 -1
  489. package/dist/commands/porch/repl.js +0 -206
  490. package/dist/commands/porch/repl.js.map +0 -1
  491. package/dist/commands/porch/run.d.ts +0 -15
  492. package/dist/commands/porch/run.d.ts.map +0 -1
  493. package/dist/commands/porch/run.js +0 -551
  494. package/dist/commands/porch/run.js.map +0 -1
  495. package/dist/commands/porch/signal-parser.d.ts +0 -102
  496. package/dist/commands/porch/signal-parser.d.ts.map +0 -1
  497. package/dist/commands/porch/signal-parser.js +0 -199
  498. package/dist/commands/porch/signal-parser.js.map +0 -1
  499. package/dist/commands/porch/signals.d.ts +0 -35
  500. package/dist/commands/porch/signals.d.ts.map +0 -1
  501. package/dist/commands/porch/signals.js +0 -76
  502. package/dist/commands/porch/signals.js.map +0 -1
  503. package/dist/commands/porch2/checks.d.ts +0 -29
  504. package/dist/commands/porch2/checks.d.ts.map +0 -1
  505. package/dist/commands/porch2/checks.js +0 -141
  506. package/dist/commands/porch2/checks.js.map +0 -1
  507. package/dist/commands/porch2/index.d.ts +0 -38
  508. package/dist/commands/porch2/index.d.ts.map +0 -1
  509. package/dist/commands/porch2/index.js +0 -483
  510. package/dist/commands/porch2/index.js.map +0 -1
  511. package/dist/commands/porch2/plan.d.ts +0 -70
  512. package/dist/commands/porch2/plan.d.ts.map +0 -1
  513. package/dist/commands/porch2/plan.js +0 -227
  514. package/dist/commands/porch2/plan.js.map +0 -1
  515. package/dist/commands/porch2/protocol.d.ts +0 -37
  516. package/dist/commands/porch2/protocol.d.ts.map +0 -1
  517. package/dist/commands/porch2/protocol.js +0 -183
  518. package/dist/commands/porch2/protocol.js.map +0 -1
  519. package/dist/commands/porch2/state.d.ts +0 -35
  520. package/dist/commands/porch2/state.d.ts.map +0 -1
  521. package/dist/commands/porch2/state.js +0 -124
  522. package/dist/commands/porch2/state.js.map +0 -1
  523. package/dist/commands/porch2/types.d.ts +0 -79
  524. package/dist/commands/porch2/types.d.ts.map +0 -1
  525. package/dist/commands/porch2/types.js +0 -8
  526. package/dist/commands/porch2/types.js.map +0 -1
  527. package/dist/commands/tower.d.ts +0 -16
  528. package/dist/commands/tower.d.ts.map +0 -1
  529. package/dist/commands/tower.js +0 -21
  530. package/dist/commands/tower.js.map +0 -1
  531. package/skeleton/config.json +0 -7
  532. package/skeleton/protocols/spider/prompts/defend.md +0 -215
  533. package/skeleton/protocols/spider/prompts/evaluate.md +0 -241
  534. package/skeleton/protocols/spider/prompts/implement.md +0 -149
  535. package/skeleton/protocols/spider/templates/review.md +0 -207
  536. /package/skeleton/protocols/{spider → spir}/templates/plan.md +0 -0
  537. /package/skeleton/protocols/{spider → spir}/templates/spec.md +0 -0
@@ -1,126 +0,0 @@
1
- /**
2
- * Tutorial Step 2: Setup Phase
3
- * Creates codev directory structure and explains it
4
- */
5
- import { existsSync, mkdirSync } from 'node:fs';
6
- import { writeFile } from 'node:fs/promises';
7
- import { resolve } from 'node:path';
8
- import * as prompts from '../prompts.js';
9
- const AGENTS_MD_TEMPLATE = `# AI Agent Instructions
10
-
11
- This file provides instructions to AI coding assistants working on this project.
12
-
13
- ## Project Overview
14
-
15
- [Describe your project here]
16
-
17
- ## Development Workflow
18
-
19
- This project uses Codev for structured AI-assisted development:
20
-
21
- - **Specifications** (codev/specs/): What to build
22
- - **Plans** (codev/plans/): How to build it
23
- - **Reviews** (codev/reviews/): Lessons learned
24
-
25
- ## Available Protocols
26
-
27
- - **TICK**: Fast protocol for small, well-defined tasks
28
- - **SPIDER**: Full protocol with consultation for complex features
29
-
30
- ## Getting Started
31
-
32
- 1. Check \`codev/projectlist.md\` for current project status
33
- 2. Run \`af tutorial\` if you're new to the project
34
- 3. See \`codev/protocols/\` for detailed protocol documentation
35
- `;
36
- const PROJECTLIST_TEMPLATE = `# Project List
37
-
38
- Track all projects and their status here.
39
-
40
- ## Active Projects
41
-
42
- \`\`\`yaml
43
- projects: []
44
- \`\`\`
45
-
46
- ## Next Available Number
47
-
48
- **0001** - Reserve this number for your next project
49
- `;
50
- export const setupStep = {
51
- id: 'setup',
52
- title: 'Project Setup',
53
- async run(ctx) {
54
- if (ctx.hasCodev) {
55
- prompts.success('Codev is already set up in this project!');
56
- console.log();
57
- prompts.content('Your codev directory structure:');
58
- prompts.bullet('codev/specs/ - Feature specifications');
59
- prompts.bullet('codev/plans/ - Implementation plans');
60
- prompts.bullet('codev/reviews/ - Post-implementation reviews');
61
- prompts.bullet('codev/protocols/ - Development protocols');
62
- prompts.bullet('codev/projectlist.md - Project tracking');
63
- console.log();
64
- await prompts.pressEnter();
65
- return { status: 'completed' };
66
- }
67
- prompts.content('Let\'s set up the Codev directory structure.\n');
68
- prompts.content('This will create:');
69
- prompts.bullet('codev/specs/ - Where you\'ll write feature specifications');
70
- prompts.bullet('codev/plans/ - Where implementation plans go');
71
- prompts.bullet('codev/reviews/ - Where you\'ll document lessons learned');
72
- prompts.bullet('codev/projectlist.md - Master project tracking file');
73
- console.log();
74
- const shouldCreate = await prompts.confirm('Create these directories?');
75
- if (!shouldCreate) {
76
- prompts.info('You can manually create the codev/ directory later.');
77
- return { status: 'skipped' };
78
- }
79
- // Create directories
80
- const codevDir = resolve(ctx.projectPath, 'codev');
81
- const dirs = ['specs', 'plans', 'reviews', 'protocols', 'resources'];
82
- try {
83
- if (!existsSync(codevDir)) {
84
- mkdirSync(codevDir, { recursive: true });
85
- }
86
- for (const dir of dirs) {
87
- const dirPath = resolve(codevDir, dir);
88
- if (!existsSync(dirPath)) {
89
- mkdirSync(dirPath, { recursive: true });
90
- }
91
- }
92
- // Create projectlist.md
93
- const projectlistPath = resolve(codevDir, 'projectlist.md');
94
- if (!existsSync(projectlistPath)) {
95
- await writeFile(projectlistPath, PROJECTLIST_TEMPLATE);
96
- }
97
- // Create CLAUDE.md / AGENTS.md if they don't exist
98
- const claudeMdPath = resolve(ctx.projectPath, 'CLAUDE.md');
99
- const agentsMdPath = resolve(ctx.projectPath, 'AGENTS.md');
100
- if (!existsSync(claudeMdPath) && !existsSync(agentsMdPath)) {
101
- await writeFile(agentsMdPath, AGENTS_MD_TEMPLATE);
102
- prompts.success('Created AGENTS.md with project instructions');
103
- }
104
- prompts.success('Created codev/ directory structure');
105
- console.log();
106
- prompts.content('Directory structure:');
107
- prompts.code(`codev/
108
- ├── specs/ # Feature specifications
109
- ├── plans/ # Implementation plans
110
- ├── reviews/ # Post-implementation reviews
111
- ├── protocols/ # Development protocols
112
- ├── resources/ # Reference materials
113
- └── projectlist.md`);
114
- }
115
- catch (error) {
116
- prompts.warn(`Failed to create directories: ${error instanceof Error ? error.message : String(error)}`);
117
- return { status: 'aborted' };
118
- }
119
- console.log();
120
- prompts.info('Tip: Add AGENTS.md to version control so AI assistants can read it.');
121
- console.log();
122
- await prompts.pressEnter();
123
- return { status: 'completed' };
124
- },
125
- };
126
- //# sourceMappingURL=setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/agent-farm/tutorial/steps/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAEzC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B1B,CAAC;AAEF,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;CAa5B,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAS;IAC7B,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,eAAe;IAEtB,KAAK,CAAC,GAAG,CAAC,GAAgB;QACxB,IAAI,GAAG,CAAC,QAAQ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,OAAO,CAAC,IAAI,CAAC;;;;;;mBAMA,CAAC,CAAC;QAEjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACxG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IACjC,CAAC;CACF,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Tutorial Step 1: Welcome & Project Detection
3
- * Introduces Codev/Agent Farm and detects the project environment
4
- */
5
- import type { Step } from '../runner.js';
6
- export declare const welcomeStep: Step;
7
- //# sourceMappingURL=welcome.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"welcome.d.ts","sourceRoot":"","sources":["../../../../src/agent-farm/tutorial/steps/welcome.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAA2B,MAAM,cAAc,CAAC;AAGlE,eAAO,MAAM,WAAW,EAAE,IAkDzB,CAAC"}
@@ -1,50 +0,0 @@
1
- /**
2
- * Tutorial Step 1: Welcome & Project Detection
3
- * Introduces Codev/Agent Farm and detects the project environment
4
- */
5
- import * as prompts from '../prompts.js';
6
- export const welcomeStep = {
7
- id: 'welcome',
8
- title: 'Welcome & Project Detection',
9
- async run(ctx) {
10
- prompts.content('Welcome to Agent Farm! This tutorial will help you get started');
11
- prompts.content('with structured AI-assisted development.\n');
12
- // Show what we detected
13
- prompts.content('About your project:');
14
- prompts.bullet(`Project: ${ctx.projectName}`);
15
- prompts.bullet(`Type: ${ctx.projectType === 'other' ? 'Unknown' : ctx.projectType}`);
16
- prompts.bullet(`Git repository: ${ctx.hasGit ? 'Yes' : 'No'}`);
17
- prompts.bullet(`Codev initialized: ${ctx.hasCodev ? 'Yes' : 'No'}`);
18
- console.log();
19
- // Warn if not in a git repo
20
- if (!ctx.hasGit) {
21
- prompts.warn('This directory is not a git repository.');
22
- prompts.content('Codev works best with git for version control and worktrees.');
23
- console.log();
24
- const shouldContinue = await prompts.confirm('Continue anyway?');
25
- if (!shouldContinue) {
26
- prompts.info('Run `git init` to initialize a repository, then run `af tutorial` again.');
27
- return { status: 'aborted' };
28
- }
29
- }
30
- // Explain what Codev/Agent Farm is
31
- prompts.content('\nWhat is Agent Farm?\n');
32
- prompts.content('Agent Farm helps you work with AI coding assistants more effectively by:');
33
- prompts.bullet('Organizing work into specs, plans, and reviews');
34
- prompts.bullet('Using structured protocols (SPIDER, TICK) for development');
35
- prompts.bullet('Enabling the Architect/Builder pattern for parallel work');
36
- prompts.bullet('Maintaining project context and documentation');
37
- console.log();
38
- prompts.content('Key concepts:');
39
- prompts.bullet('Spec: What you want to build (the goal)');
40
- prompts.bullet('Plan: How you\'ll build it (the approach)');
41
- prompts.bullet('Review: What you learned (lessons and improvements)');
42
- console.log();
43
- const ready = await prompts.confirm('Ready to set up Codev in your project?');
44
- if (!ready) {
45
- return { status: 'aborted' };
46
- }
47
- return { status: 'completed' };
48
- },
49
- };
50
- //# sourceMappingURL=welcome.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../../../src/agent-farm/tutorial/steps/welcome.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,EAAE,EAAE,SAAS;IACb,KAAK,EAAE,6BAA6B;IAEpC,KAAK,CAAC,GAAG,CAAC,GAAgB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O,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC;QACjE,OAAO,CAAC,MAAM,CAAC,2DAA2D,CAAC,CAAC;QAC5E,OAAO,CAAC,MAAM,CAAC,0DAA0D,CAAC,CAAC;QAC3E,OAAO,CAAC,MAAM,CAAC,+CAA+C,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QACjC,OAAO,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC;QAC1D,OAAO,CAAC,MAAM,CAAC,2CAA2C,CAAC,CAAC;QAC5D,OAAO,CAAC,MAAM,CAAC,qDAAqD,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;QAC9E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IACjC,CAAC;CACF,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Orphan Handler
3
- *
4
- * Detects and handles orphaned tmux sessions from previous agent-farm runs.
5
- * This prevents resource leaks and ensures clean startup.
6
- *
7
- * IMPORTANT: Only cleans up sessions for THIS project (based on port).
8
- * Sessions from other projects are left alone.
9
- */
10
- /**
11
- * Check for and handle orphaned sessions on startup
12
- *
13
- * Returns the number of sessions that were cleaned up.
14
- */
15
- export declare function handleOrphanedSessions(options?: {
16
- kill?: boolean;
17
- silent?: boolean;
18
- }): Promise<number>;
19
- /**
20
- * Check for stale artifacts from bash script era
21
- */
22
- export declare function checkStaleArtifacts(codevDir: string): string[];
23
- /**
24
- * Warn about stale artifacts if found
25
- */
26
- export declare function warnAboutStaleArtifacts(codevDir: string): void;
27
- //# sourceMappingURL=orphan-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orphan-handler.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/utils/orphan-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkFH;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,GAAE;IACpD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAqCvB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB9D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAU9D"}
@@ -1,149 +0,0 @@
1
- /**
2
- * Orphan Handler
3
- *
4
- * Detects and handles orphaned tmux sessions from previous agent-farm runs.
5
- * This prevents resource leaks and ensures clean startup.
6
- *
7
- * IMPORTANT: Only cleans up sessions for THIS project (based on port).
8
- * Sessions from other projects are left alone.
9
- */
10
- import { existsSync } from 'node:fs';
11
- import { resolve } from 'node:path';
12
- import { logger } from './logger.js';
13
- import { run } from './shell.js';
14
- import { getConfig } from './config.js';
15
- import { loadState, setArchitect } from '../state.js';
16
- /**
17
- * Check if a process is still running
18
- */
19
- function isProcessAlive(pid) {
20
- try {
21
- process.kill(pid, 0);
22
- return true;
23
- }
24
- catch {
25
- return false;
26
- }
27
- }
28
- /**
29
- * Find tmux sessions that match THIS project's agent-farm patterns
30
- * Only matches sessions with this project's port to avoid killing other projects
31
- */
32
- async function findOrphanedSessions() {
33
- const config = getConfig();
34
- const architectPort = config.architectPort;
35
- const state = loadState();
36
- // Project-specific patterns - only match THIS project's architect session
37
- const architectPattern = new RegExp(`^af-architect-${architectPort}$`);
38
- const legacyArchitectPattern = /^af-architect$/;
39
- try {
40
- const result = await run('tmux list-sessions -F "#{session_name}" 2>/dev/null');
41
- const sessions = result.stdout.trim().split('\n').filter(Boolean);
42
- const orphans = [];
43
- for (const name of sessions) {
44
- // Check architect sessions - only orphaned if PID is dead
45
- if (architectPattern.test(name) || legacyArchitectPattern.test(name)) {
46
- // If we have state for this architect, check if PID is still alive
47
- if (state.architect) {
48
- if (!isProcessAlive(state.architect.pid)) {
49
- // PID is dead but session exists - this is orphaned
50
- orphans.push({ name, type: 'architect' });
51
- }
52
- // If PID is alive, session is NOT orphaned - skip it
53
- }
54
- else {
55
- // No state entry but session exists - orphaned
56
- orphans.push({ name, type: 'architect' });
57
- }
58
- }
59
- // Note: builder and util sessions use different naming now (af-shell-UXXXXXX)
60
- // Those are managed by their own state entries and don't need orphan detection
61
- }
62
- return orphans;
63
- }
64
- catch {
65
- // tmux not available or no sessions
66
- return [];
67
- }
68
- }
69
- /**
70
- * Kill an orphaned tmux session
71
- */
72
- async function killSession(name) {
73
- try {
74
- await run(`tmux kill-session -t "${name}" 2>/dev/null`);
75
- return true;
76
- }
77
- catch {
78
- return false;
79
- }
80
- }
81
- /**
82
- * Check for and handle orphaned sessions on startup
83
- *
84
- * Returns the number of sessions that were cleaned up.
85
- */
86
- export async function handleOrphanedSessions(options = {}) {
87
- const orphans = await findOrphanedSessions();
88
- if (orphans.length === 0) {
89
- return 0;
90
- }
91
- if (!options.silent) {
92
- logger.warn(`Found ${orphans.length} orphaned tmux session(s) from previous run:`);
93
- for (const orphan of orphans) {
94
- logger.info(` - ${orphan.name} (${orphan.type})`);
95
- }
96
- }
97
- if (options.kill) {
98
- let killed = 0;
99
- for (const orphan of orphans) {
100
- if (await killSession(orphan.name)) {
101
- killed++;
102
- // Clear state entry for killed architects
103
- if (orphan.type === 'architect') {
104
- setArchitect(null);
105
- }
106
- if (!options.silent) {
107
- logger.debug(` Killed: ${orphan.name}`);
108
- }
109
- }
110
- }
111
- if (!options.silent) {
112
- logger.info(`Cleaned up ${killed} orphaned session(s)`);
113
- }
114
- return killed;
115
- }
116
- return 0;
117
- }
118
- /**
119
- * Check for stale artifacts from bash script era
120
- */
121
- export function checkStaleArtifacts(codevDir) {
122
- const staleFiles = [
123
- 'builders.md', // Old bash state file
124
- '.architect.pid',
125
- '.architect.log',
126
- ];
127
- const found = [];
128
- for (const file of staleFiles) {
129
- const path = resolve(codevDir, file);
130
- if (existsSync(path)) {
131
- found.push(file);
132
- }
133
- }
134
- return found;
135
- }
136
- /**
137
- * Warn about stale artifacts if found
138
- */
139
- export function warnAboutStaleArtifacts(codevDir) {
140
- const stale = checkStaleArtifacts(codevDir);
141
- if (stale.length > 0) {
142
- logger.warn('Found stale artifacts from previous bash-based architect:');
143
- for (const file of stale) {
144
- logger.info(` - ${file}`);
145
- }
146
- logger.info('These can be safely deleted. The new TypeScript implementation uses .agent-farm/');
147
- }
148
- }
149
- //# sourceMappingURL=orphan-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orphan-handler.js","sourceRoot":"","sources":["../../../src/agent-farm/utils/orphan-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAOD;;;GAGG;AACH,KAAK,UAAU,oBAAoB;IACjC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAA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AC,cAAc,MAAM,sBAAsB,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,MAAM,UAAU,GAAG;QACjB,aAAa,EAAG,sBAAsB;QACtC,gBAAgB;QAChB,gBAAgB;KACjB,CAAC;IAEF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,MAAM,KAAK,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;QACzE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Global Port Registry
3
- *
4
- * Manages port block allocation across multiple repositories to prevent
5
- * port conflicts when running multiple architect sessions simultaneously.
6
- *
7
- * Registry location: ~/.agent-farm/global.db
8
- * Each repository gets a 100-port block (e.g., 4200-4299, 4300-4399, etc.)
9
- *
10
- * Uses SQLite with ACID transactions for proper concurrency handling.
11
- */
12
- import { closeGlobalDb } from '../db/index.js';
13
- /**
14
- * Clean up stale registry entries (projects that no longer exist or have dead PIDs)
15
- * Note: This function is now synchronous
16
- */
17
- export declare function cleanupStaleEntries(): {
18
- removed: string[];
19
- remaining: number;
20
- };
21
- /**
22
- * Get or allocate a port block for a project
23
- * Returns the base port for the project's block
24
- * Note: This function is now synchronous and uses BEGIN IMMEDIATE for atomicity
25
- */
26
- export declare function getPortBlock(projectRoot: string): number;
27
- /**
28
- * Get port configuration for a project
29
- * Returns all port assignments based on the project's base port
30
- */
31
- export interface ProjectPorts {
32
- basePort: number;
33
- dashboardPort: number;
34
- architectPort: number;
35
- builderPortRange: [number, number];
36
- utilPortRange: [number, number];
37
- openPortRange: [number, number];
38
- }
39
- export declare function getProjectPorts(projectRoot: string): ProjectPorts;
40
- /**
41
- * List all registered projects and their port blocks
42
- */
43
- export declare function listAllocations(): Array<{
44
- path: string;
45
- basePort: number;
46
- registered: string;
47
- lastUsed?: string;
48
- exists: boolean;
49
- pid?: number;
50
- pidAlive?: boolean;
51
- }>;
52
- /**
53
- * Remove a project's port allocation
54
- * Note: This function is now synchronous
55
- */
56
- export declare function removeAllocation(projectRoot: string): boolean;
57
- export { closeGlobalDb };
58
- //# sourceMappingURL=port-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"port-registry.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/utils/port-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAe,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAiC5D;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAgC9E;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA2DxD;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CAWjE;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,KAAK,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC,CAcD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAQ7D;AAGD,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,166 +0,0 @@
1
- /**
2
- * Global Port Registry
3
- *
4
- * Manages port block allocation across multiple repositories to prevent
5
- * port conflicts when running multiple architect sessions simultaneously.
6
- *
7
- * Registry location: ~/.agent-farm/global.db
8
- * Each repository gets a 100-port block (e.g., 4200-4299, 4300-4399, etc.)
9
- *
10
- * Uses SQLite with ACID transactions for proper concurrency handling.
11
- */
12
- import { existsSync } from 'node:fs';
13
- import { resolve } from 'node:path';
14
- import { getGlobalDb, closeGlobalDb } from '../db/index.js';
15
- // Base port for first allocation (configurable via AF_BASE_PORT env var)
16
- const BASE_PORT = parseInt(process.env.AF_BASE_PORT || '4200', 10);
17
- // Ports per project
18
- const PORT_BLOCK_SIZE = 100;
19
- // Maximum allocations (4200-9999 = ~58 projects)
20
- const MAX_ALLOCATIONS = 58;
21
- // Port blocks to skip (base ports that conflict with system services)
22
- // 5000: macOS AirPlay Receiver (ControlCenter)
23
- const BLOCKED_PORT_BLOCKS = [5000];
24
- /**
25
- * Check if a process is still running
26
- */
27
- function isProcessAlive(pid) {
28
- try {
29
- process.kill(pid, 0);
30
- return true;
31
- }
32
- catch {
33
- return false;
34
- }
35
- }
36
- /**
37
- * Check if a project path still exists on disk
38
- */
39
- function projectExists(projectPath) {
40
- return existsSync(projectPath);
41
- }
42
- /**
43
- * Clean up stale registry entries (projects that no longer exist or have dead PIDs)
44
- * Note: This function is now synchronous
45
- */
46
- export function cleanupStaleEntries() {
47
- const db = getGlobalDb();
48
- const removed = [];
49
- // Get all allocations
50
- const allocations = db.prepare('SELECT * FROM port_allocations').all();
51
- const cleanup = db.transaction(() => {
52
- for (const alloc of allocations) {
53
- // Remove if project doesn't exist (skip synthetic keys like "remote:...")
54
- if (!alloc.project_path.startsWith('remote:') && !projectExists(alloc.project_path)) {
55
- removed.push(alloc.project_path);
56
- db.prepare('DELETE FROM port_allocations WHERE project_path = ?').run(alloc.project_path);
57
- continue;
58
- }
59
- // Clear PID if process is stale (process no longer running)
60
- // Don't remove the entry, just clear the PID - project still exists
61
- if (alloc.pid && !isProcessAlive(alloc.pid)) {
62
- db.prepare('UPDATE port_allocations SET pid = NULL WHERE project_path = ?').run(alloc.project_path);
63
- }
64
- }
65
- });
66
- cleanup();
67
- const remaining = db.prepare('SELECT COUNT(*) as count FROM port_allocations').get();
68
- return {
69
- removed,
70
- remaining: remaining.count,
71
- };
72
- }
73
- /**
74
- * Get or allocate a port block for a project
75
- * Returns the base port for the project's block
76
- * Note: This function is now synchronous and uses BEGIN IMMEDIATE for atomicity
77
- */
78
- export function getPortBlock(projectRoot) {
79
- // Normalize path for consistent keys
80
- // Don't resolve synthetic keys like "remote:..." - they're not real paths
81
- const normalizedPath = projectRoot.startsWith('remote:') ? projectRoot : resolve(projectRoot);
82
- const db = getGlobalDb();
83
- // Use immediate transaction to prevent race conditions
84
- const allocate = db.transaction(() => {
85
- // Check if project already has an allocation
86
- const existing = db.prepare('SELECT * FROM port_allocations WHERE project_path = ?')
87
- .get(normalizedPath);
88
- if (existing) {
89
- // Update last used timestamp and PID
90
- db.prepare(`
91
- UPDATE port_allocations
92
- SET last_used_at = datetime('now'), pid = ?
93
- WHERE project_path = ?
94
- `).run(process.pid, normalizedPath);
95
- return existing.base_port;
96
- }
97
- // Find next available port block (with gap recycling)
98
- // Get all allocated ports as a Set for O(1) lookup
99
- const allocated = new Set(db.prepare('SELECT base_port FROM port_allocations').all()
100
- .map(row => row.base_port));
101
- // Find the first available port starting from BASE_PORT
102
- let nextPort = BASE_PORT;
103
- const maxPossiblePort = BASE_PORT + (MAX_ALLOCATIONS * PORT_BLOCK_SIZE);
104
- while (nextPort < maxPossiblePort) {
105
- // Skip if already allocated or blocked
106
- if (!allocated.has(nextPort) && !BLOCKED_PORT_BLOCKS.includes(nextPort)) {
107
- break;
108
- }
109
- nextPort += PORT_BLOCK_SIZE;
110
- }
111
- // Ensure we found an available port
112
- if (nextPort >= maxPossiblePort) {
113
- throw new Error('No available port blocks. Maximum allocations reached.');
114
- }
115
- // Insert new allocation
116
- db.prepare(`
117
- INSERT INTO port_allocations (project_path, base_port, pid)
118
- VALUES (?, ?, ?)
119
- `).run(normalizedPath, nextPort, process.pid);
120
- return nextPort;
121
- });
122
- // Use immediate() to serialize with other writers
123
- return allocate.immediate();
124
- }
125
- export function getProjectPorts(projectRoot) {
126
- const basePort = getPortBlock(projectRoot);
127
- return {
128
- basePort,
129
- dashboardPort: basePort, // 4200
130
- architectPort: basePort + 1, // 4201
131
- builderPortRange: [basePort + 10, basePort + 29], // 4210-4229
132
- utilPortRange: [basePort + 30, basePort + 49], // 4230-4249
133
- openPortRange: [basePort + 50, basePort + 69], // 4250-4269
134
- };
135
- }
136
- /**
137
- * List all registered projects and their port blocks
138
- */
139
- export function listAllocations() {
140
- const db = getGlobalDb();
141
- const allocations = db.prepare('SELECT * FROM port_allocations ORDER BY base_port').all();
142
- return allocations.map((alloc) => ({
143
- path: alloc.project_path,
144
- basePort: alloc.base_port,
145
- registered: alloc.registered_at,
146
- lastUsed: alloc.last_used_at,
147
- // Remote keys are synthetic - can't check if they exist, assume true
148
- exists: alloc.project_path.startsWith('remote:') || projectExists(alloc.project_path),
149
- pid: alloc.pid ?? undefined,
150
- pidAlive: alloc.pid ? isProcessAlive(alloc.pid) : undefined,
151
- }));
152
- }
153
- /**
154
- * Remove a project's port allocation
155
- * Note: This function is now synchronous
156
- */
157
- export function removeAllocation(projectRoot) {
158
- // Don't resolve synthetic keys like "remote:..."
159
- const normalizedPath = projectRoot.startsWith('remote:') ? projectRoot : resolve(projectRoot);
160
- const db = getGlobalDb();
161
- const result = db.prepare('DELETE FROM port_allocations WHERE project_path = ?').run(normalizedPath);
162
- return result.changes > 0;
163
- }
164
- // Re-export closeGlobalDb for cleanup
165
- export { closeGlobalDb };
166
- //# sourceMappingURL=port-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"port-registry.js","sourceRoot":"","sources":["../../../src/agent-farm/utils/port-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG5D,yEAAyE;AACzE,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACnE,oBAAoB;AACpB,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,iDAAiD;AACjD,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,sEAAsE;AACtE,+CAA+C;AAC/C,MAAM,mBAAmB,GAAG,CAAC,IAAI,CAAC,CAAC;AAEnC;;GAEG;AACH,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CA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K,CAAC,YAAY;QACxB,QAAQ,EAAE,KAAK,CAAC,SAAS;QACzB,UAAU,EAAE,KAAK,CAAC,aAAa;QAC/B,QAAQ,EAAE,KAAK,CAAC,YAAY;QAC5B,qEAAqE;QACrE,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;QACrF,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,SAAS;QAC3B,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;KAC5D,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,iDAAiD;IACjD,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9F,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,qDAAqD,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAErG,OAAO,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Terminal port lookup utility (Spec 0062 - Secure Remote Access)
3
- *
4
- * Provides the port lookup function used by the dashboard reverse proxy.
5
- * Extracted to a separate module for testability.
6
- */
7
- import type { DashboardState } from '../types.js';
8
- /**
9
- * Get the ttyd port for a given terminal ID
10
- * Returns null if the terminal is not found
11
- *
12
- * Terminal ID formats:
13
- * - 'architect' -> architect terminal
14
- * - 'builder-{id}' -> builder terminal
15
- * - 'util-{id}' -> utility terminal
16
- */
17
- export declare function getPortForTerminal(terminalId: string, state: DashboardState): number | null;
18
- //# sourceMappingURL=terminal-ports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"terminal-ports.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/utils/terminal-ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAqB3F"}