agent-relay 1.1.0 → 1.2.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 (490) hide show
  1. package/README.md +1 -1
  2. package/dist/bridge/spawner.d.ts +53 -0
  3. package/dist/bridge/spawner.d.ts.map +1 -1
  4. package/dist/bridge/spawner.js +203 -19
  5. package/dist/bridge/spawner.js.map +1 -1
  6. package/dist/bridge/types.d.ts +12 -0
  7. package/dist/bridge/types.d.ts.map +1 -1
  8. package/dist/cli/index.js +401 -5
  9. package/dist/cli/index.js.map +1 -1
  10. package/dist/cloud/api/auth.d.ts +3 -2
  11. package/dist/cloud/api/auth.d.ts.map +1 -1
  12. package/dist/cloud/api/auth.js +10 -98
  13. package/dist/cloud/api/auth.js.map +1 -1
  14. package/dist/cloud/api/cli-pty-runner.d.ts +54 -0
  15. package/dist/cloud/api/cli-pty-runner.d.ts.map +1 -0
  16. package/dist/cloud/api/cli-pty-runner.js +119 -0
  17. package/dist/cloud/api/cli-pty-runner.js.map +1 -0
  18. package/dist/cloud/api/generic-webhooks.d.ts +8 -0
  19. package/dist/cloud/api/generic-webhooks.d.ts.map +1 -0
  20. package/dist/cloud/api/generic-webhooks.js +129 -0
  21. package/dist/cloud/api/generic-webhooks.js.map +1 -0
  22. package/dist/cloud/api/git.d.ts +8 -0
  23. package/dist/cloud/api/git.d.ts.map +1 -0
  24. package/dist/cloud/api/git.js +131 -0
  25. package/dist/cloud/api/git.js.map +1 -0
  26. package/dist/cloud/api/github-app.d.ts +11 -0
  27. package/dist/cloud/api/github-app.d.ts.map +1 -0
  28. package/dist/cloud/api/github-app.js +189 -0
  29. package/dist/cloud/api/github-app.js.map +1 -0
  30. package/dist/cloud/api/middleware/planLimits.d.ts +7 -0
  31. package/dist/cloud/api/middleware/planLimits.d.ts.map +1 -1
  32. package/dist/cloud/api/middleware/planLimits.js +39 -1
  33. package/dist/cloud/api/middleware/planLimits.js.map +1 -1
  34. package/dist/cloud/api/monitoring.d.ts +11 -0
  35. package/dist/cloud/api/monitoring.d.ts.map +1 -0
  36. package/dist/cloud/api/monitoring.js +578 -0
  37. package/dist/cloud/api/monitoring.js.map +1 -0
  38. package/dist/cloud/api/nango-auth.d.ts +9 -0
  39. package/dist/cloud/api/nango-auth.d.ts.map +1 -0
  40. package/dist/cloud/api/nango-auth.js +377 -0
  41. package/dist/cloud/api/nango-auth.js.map +1 -0
  42. package/dist/cloud/api/onboarding.d.ts +8 -1
  43. package/dist/cloud/api/onboarding.d.ts.map +1 -1
  44. package/dist/cloud/api/onboarding.js +300 -119
  45. package/dist/cloud/api/onboarding.js.map +1 -1
  46. package/dist/cloud/api/policy.d.ts +8 -0
  47. package/dist/cloud/api/policy.d.ts.map +1 -0
  48. package/dist/cloud/api/policy.js +229 -0
  49. package/dist/cloud/api/policy.js.map +1 -0
  50. package/dist/cloud/api/providers.js +114 -42
  51. package/dist/cloud/api/providers.js.map +1 -1
  52. package/dist/cloud/api/test-helpers.d.ts +10 -0
  53. package/dist/cloud/api/test-helpers.d.ts.map +1 -0
  54. package/dist/cloud/api/test-helpers.js +575 -0
  55. package/dist/cloud/api/test-helpers.js.map +1 -0
  56. package/dist/cloud/api/webhooks.d.ts +7 -0
  57. package/dist/cloud/api/webhooks.d.ts.map +1 -0
  58. package/dist/cloud/api/webhooks.js +496 -0
  59. package/dist/cloud/api/webhooks.js.map +1 -0
  60. package/dist/cloud/api/workspaces.js +225 -8
  61. package/dist/cloud/api/workspaces.js.map +1 -1
  62. package/dist/cloud/billing/plans.d.ts.map +1 -1
  63. package/dist/cloud/billing/plans.js +13 -0
  64. package/dist/cloud/billing/plans.js.map +1 -1
  65. package/dist/cloud/billing/types.d.ts +9 -3
  66. package/dist/cloud/billing/types.d.ts.map +1 -1
  67. package/dist/cloud/config.d.ts +9 -2
  68. package/dist/cloud/config.d.ts.map +1 -1
  69. package/dist/cloud/config.js +13 -4
  70. package/dist/cloud/config.js.map +1 -1
  71. package/dist/cloud/db/drizzle.d.ts +84 -1
  72. package/dist/cloud/db/drizzle.d.ts.map +1 -1
  73. package/dist/cloud/db/drizzle.js +470 -0
  74. package/dist/cloud/db/drizzle.js.map +1 -1
  75. package/dist/cloud/db/index.d.ts +9 -4
  76. package/dist/cloud/db/index.d.ts.map +1 -1
  77. package/dist/cloud/db/index.js +11 -3
  78. package/dist/cloud/db/index.js.map +1 -1
  79. package/dist/cloud/db/schema.d.ts +3283 -556
  80. package/dist/cloud/db/schema.d.ts.map +1 -1
  81. package/dist/cloud/db/schema.js +314 -1
  82. package/dist/cloud/db/schema.js.map +1 -1
  83. package/dist/cloud/index.d.ts +1 -0
  84. package/dist/cloud/index.d.ts.map +1 -1
  85. package/dist/cloud/index.js +2 -0
  86. package/dist/cloud/index.js.map +1 -1
  87. package/dist/cloud/provisioner/index.d.ts +24 -0
  88. package/dist/cloud/provisioner/index.d.ts.map +1 -1
  89. package/dist/cloud/provisioner/index.js +319 -18
  90. package/dist/cloud/provisioner/index.js.map +1 -1
  91. package/dist/cloud/server.d.ts +1 -0
  92. package/dist/cloud/server.d.ts.map +1 -1
  93. package/dist/cloud/server.js +357 -13
  94. package/dist/cloud/server.js.map +1 -1
  95. package/dist/cloud/services/auto-scaler.d.ts +152 -0
  96. package/dist/cloud/services/auto-scaler.d.ts.map +1 -0
  97. package/dist/cloud/services/auto-scaler.js +439 -0
  98. package/dist/cloud/services/auto-scaler.js.map +1 -0
  99. package/dist/cloud/services/capacity-manager.d.ts +148 -0
  100. package/dist/cloud/services/capacity-manager.d.ts.map +1 -0
  101. package/dist/cloud/services/capacity-manager.js +449 -0
  102. package/dist/cloud/services/capacity-manager.js.map +1 -0
  103. package/dist/cloud/services/ci-agent-spawner.d.ts +49 -0
  104. package/dist/cloud/services/ci-agent-spawner.d.ts.map +1 -0
  105. package/dist/cloud/services/ci-agent-spawner.js +373 -0
  106. package/dist/cloud/services/ci-agent-spawner.js.map +1 -0
  107. package/dist/cloud/services/index.d.ts +12 -0
  108. package/dist/cloud/services/index.d.ts.map +1 -0
  109. package/dist/cloud/services/index.js +15 -0
  110. package/dist/cloud/services/index.js.map +1 -0
  111. package/dist/cloud/services/mention-handler.d.ts +65 -0
  112. package/dist/cloud/services/mention-handler.d.ts.map +1 -0
  113. package/dist/cloud/services/mention-handler.js +405 -0
  114. package/dist/cloud/services/mention-handler.js.map +1 -0
  115. package/dist/cloud/services/nango.d.ts +126 -0
  116. package/dist/cloud/services/nango.d.ts.map +1 -0
  117. package/dist/cloud/services/nango.js +191 -0
  118. package/dist/cloud/services/nango.js.map +1 -0
  119. package/dist/cloud/services/persistence.d.ts +131 -0
  120. package/dist/cloud/services/persistence.d.ts.map +1 -0
  121. package/dist/cloud/services/persistence.js +200 -0
  122. package/dist/cloud/services/persistence.js.map +1 -0
  123. package/dist/cloud/services/planLimits.d.ts +15 -0
  124. package/dist/cloud/services/planLimits.d.ts.map +1 -1
  125. package/dist/cloud/services/planLimits.js +28 -0
  126. package/dist/cloud/services/planLimits.js.map +1 -1
  127. package/dist/cloud/services/scaling-orchestrator.d.ts +159 -0
  128. package/dist/cloud/services/scaling-orchestrator.d.ts.map +1 -0
  129. package/dist/cloud/services/scaling-orchestrator.js +502 -0
  130. package/dist/cloud/services/scaling-orchestrator.js.map +1 -0
  131. package/dist/cloud/services/scaling-policy.d.ts +121 -0
  132. package/dist/cloud/services/scaling-policy.d.ts.map +1 -0
  133. package/dist/cloud/services/scaling-policy.js +415 -0
  134. package/dist/cloud/services/scaling-policy.js.map +1 -0
  135. package/dist/cloud/vault/index.js +1 -1
  136. package/dist/cloud/vault/index.js.map +1 -1
  137. package/dist/cloud/webhooks/index.d.ts +24 -0
  138. package/dist/cloud/webhooks/index.d.ts.map +1 -0
  139. package/dist/cloud/webhooks/index.js +29 -0
  140. package/dist/cloud/webhooks/index.js.map +1 -0
  141. package/dist/cloud/webhooks/parsers/github.d.ts +8 -0
  142. package/dist/cloud/webhooks/parsers/github.d.ts.map +1 -0
  143. package/dist/cloud/webhooks/parsers/github.js +234 -0
  144. package/dist/cloud/webhooks/parsers/github.js.map +1 -0
  145. package/dist/cloud/webhooks/parsers/index.d.ts +23 -0
  146. package/dist/cloud/webhooks/parsers/index.d.ts.map +1 -0
  147. package/dist/cloud/webhooks/parsers/index.js +30 -0
  148. package/dist/cloud/webhooks/parsers/index.js.map +1 -0
  149. package/dist/cloud/webhooks/parsers/linear.d.ts +9 -0
  150. package/dist/cloud/webhooks/parsers/linear.d.ts.map +1 -0
  151. package/dist/cloud/webhooks/parsers/linear.js +258 -0
  152. package/dist/cloud/webhooks/parsers/linear.js.map +1 -0
  153. package/dist/cloud/webhooks/parsers/slack.d.ts +9 -0
  154. package/dist/cloud/webhooks/parsers/slack.d.ts.map +1 -0
  155. package/dist/cloud/webhooks/parsers/slack.js +214 -0
  156. package/dist/cloud/webhooks/parsers/slack.js.map +1 -0
  157. package/dist/cloud/webhooks/responders/github.d.ts +8 -0
  158. package/dist/cloud/webhooks/responders/github.d.ts.map +1 -0
  159. package/dist/cloud/webhooks/responders/github.js +73 -0
  160. package/dist/cloud/webhooks/responders/github.js.map +1 -0
  161. package/dist/cloud/webhooks/responders/index.d.ts +23 -0
  162. package/dist/cloud/webhooks/responders/index.d.ts.map +1 -0
  163. package/dist/cloud/webhooks/responders/index.js +30 -0
  164. package/dist/cloud/webhooks/responders/index.js.map +1 -0
  165. package/dist/cloud/webhooks/responders/linear.d.ts +9 -0
  166. package/dist/cloud/webhooks/responders/linear.d.ts.map +1 -0
  167. package/dist/cloud/webhooks/responders/linear.js +149 -0
  168. package/dist/cloud/webhooks/responders/linear.js.map +1 -0
  169. package/dist/cloud/webhooks/responders/slack.d.ts +20 -0
  170. package/dist/cloud/webhooks/responders/slack.d.ts.map +1 -0
  171. package/dist/cloud/webhooks/responders/slack.js +178 -0
  172. package/dist/cloud/webhooks/responders/slack.js.map +1 -0
  173. package/dist/cloud/webhooks/router.d.ts +25 -0
  174. package/dist/cloud/webhooks/router.d.ts.map +1 -0
  175. package/dist/cloud/webhooks/router.js +504 -0
  176. package/dist/cloud/webhooks/router.js.map +1 -0
  177. package/dist/cloud/webhooks/rules-engine.d.ts +24 -0
  178. package/dist/cloud/webhooks/rules-engine.d.ts.map +1 -0
  179. package/dist/cloud/webhooks/rules-engine.js +287 -0
  180. package/dist/cloud/webhooks/rules-engine.js.map +1 -0
  181. package/dist/cloud/webhooks/types.d.ts +186 -0
  182. package/dist/cloud/webhooks/types.d.ts.map +1 -0
  183. package/dist/cloud/webhooks/types.js +8 -0
  184. package/dist/cloud/webhooks/types.js.map +1 -0
  185. package/dist/continuity/formatter.d.ts +51 -0
  186. package/dist/continuity/formatter.d.ts.map +1 -0
  187. package/dist/continuity/formatter.js +313 -0
  188. package/dist/continuity/formatter.js.map +1 -0
  189. package/dist/continuity/handoff-store.d.ts +67 -0
  190. package/dist/continuity/handoff-store.d.ts.map +1 -0
  191. package/dist/continuity/handoff-store.js +472 -0
  192. package/dist/continuity/handoff-store.js.map +1 -0
  193. package/dist/continuity/index.d.ts +45 -0
  194. package/dist/continuity/index.d.ts.map +1 -0
  195. package/dist/continuity/index.js +48 -0
  196. package/dist/continuity/index.js.map +1 -0
  197. package/dist/continuity/ledger-store.d.ts +110 -0
  198. package/dist/continuity/ledger-store.d.ts.map +1 -0
  199. package/dist/continuity/ledger-store.js +500 -0
  200. package/dist/continuity/ledger-store.js.map +1 -0
  201. package/dist/continuity/manager.d.ts +178 -0
  202. package/dist/continuity/manager.d.ts.map +1 -0
  203. package/dist/continuity/manager.js +562 -0
  204. package/dist/continuity/manager.js.map +1 -0
  205. package/dist/continuity/parser.d.ts +76 -0
  206. package/dist/continuity/parser.d.ts.map +1 -0
  207. package/dist/continuity/parser.js +579 -0
  208. package/dist/continuity/parser.js.map +1 -0
  209. package/dist/continuity/types.d.ts +180 -0
  210. package/dist/continuity/types.d.ts.map +1 -0
  211. package/dist/continuity/types.js +9 -0
  212. package/dist/continuity/types.js.map +1 -0
  213. package/dist/daemon/agent-manager.d.ts +27 -0
  214. package/dist/daemon/agent-manager.d.ts.map +1 -1
  215. package/dist/daemon/agent-manager.js +107 -6
  216. package/dist/daemon/agent-manager.js.map +1 -1
  217. package/dist/daemon/agent-registry.d.ts +32 -0
  218. package/dist/daemon/agent-registry.d.ts.map +1 -1
  219. package/dist/daemon/agent-registry.js +42 -2
  220. package/dist/daemon/agent-registry.js.map +1 -1
  221. package/dist/daemon/api.d.ts +12 -0
  222. package/dist/daemon/api.d.ts.map +1 -1
  223. package/dist/daemon/api.js +131 -2
  224. package/dist/daemon/api.js.map +1 -1
  225. package/dist/daemon/cli-auth.d.ts +67 -0
  226. package/dist/daemon/cli-auth.d.ts.map +1 -0
  227. package/dist/daemon/cli-auth.js +537 -0
  228. package/dist/daemon/cli-auth.js.map +1 -0
  229. package/dist/daemon/cloud-sync.d.ts.map +1 -1
  230. package/dist/daemon/cloud-sync.js +9 -7
  231. package/dist/daemon/cloud-sync.js.map +1 -1
  232. package/dist/daemon/orchestrator.d.ts.map +1 -1
  233. package/dist/daemon/orchestrator.js +30 -0
  234. package/dist/daemon/orchestrator.js.map +1 -1
  235. package/dist/daemon/router.d.ts +5 -0
  236. package/dist/daemon/router.d.ts.map +1 -1
  237. package/dist/daemon/router.js +78 -26
  238. package/dist/daemon/router.js.map +1 -1
  239. package/dist/daemon/server.d.ts +5 -0
  240. package/dist/daemon/server.d.ts.map +1 -1
  241. package/dist/daemon/server.js +9 -1
  242. package/dist/daemon/server.js.map +1 -1
  243. package/dist/daemon/services/browser-testing.d.ts +88 -0
  244. package/dist/daemon/services/browser-testing.d.ts.map +1 -0
  245. package/dist/daemon/services/browser-testing.js +244 -0
  246. package/dist/daemon/services/browser-testing.js.map +1 -0
  247. package/dist/daemon/services/container-spawner.d.ts +135 -0
  248. package/dist/daemon/services/container-spawner.d.ts.map +1 -0
  249. package/dist/daemon/services/container-spawner.js +313 -0
  250. package/dist/daemon/services/container-spawner.js.map +1 -0
  251. package/dist/daemon/types.d.ts +5 -1
  252. package/dist/daemon/types.d.ts.map +1 -1
  253. package/dist/dashboard/out/404.html +1 -1
  254. package/dist/dashboard/out/_next/static/chunks/116-2502180def231162.js +1 -0
  255. package/dist/dashboard/out/_next/static/chunks/282-980c2eb8fff20123.js +1 -0
  256. package/dist/dashboard/out/_next/static/chunks/480-2d4111711d4e473c.js +1 -0
  257. package/dist/dashboard/out/_next/static/chunks/724-73c1ee5f60abe860.js +9 -0
  258. package/dist/dashboard/out/_next/static/chunks/766-c3a14283c88d815b.js +1 -0
  259. package/dist/dashboard/out/_next/static/chunks/app/app/page-7120be68bea622f3.js +1 -0
  260. package/dist/dashboard/out/_next/static/chunks/app/connect-repos/page-dc2e3a1a22478efc.js +1 -0
  261. package/dist/dashboard/out/_next/static/chunks/app/history/{page-b6edd4dde8d08194.js → page-56a8b4616a90dc43.js} +1 -1
  262. package/dist/dashboard/out/_next/static/chunks/app/login/page-3eac37ea6f5dd153.js +1 -0
  263. package/dist/dashboard/out/_next/static/chunks/app/metrics/page-1081dd190a331a91.js +1 -0
  264. package/dist/dashboard/out/_next/static/chunks/app/page-daf87e86f783f980.js +1 -0
  265. package/dist/dashboard/out/_next/static/chunks/app/providers/page-b68a681526eb145e.js +1 -0
  266. package/dist/dashboard/out/_next/static/chunks/app/signup/page-fee4ed1709070bcd.js +1 -0
  267. package/dist/dashboard/out/_next/static/chunks/e868780c-48e5f147c90a3a41.js +18 -0
  268. package/dist/dashboard/out/_next/static/chunks/{main-c2f423b9c9f4591b.js → main-97850e03d723ea8c.js} +1 -1
  269. package/dist/dashboard/out/_next/static/chunks/webpack-1cdd8ed57114d5e1.js +1 -0
  270. package/dist/dashboard/out/_next/static/css/29852f26181969a0.css +1 -0
  271. package/dist/dashboard/out/_next/static/css/411ce23ffeae9f76.css +1 -0
  272. package/dist/dashboard/out/app.html +1 -14
  273. package/dist/dashboard/out/app.txt +2 -2
  274. package/dist/dashboard/out/connect-repos.html +1 -0
  275. package/dist/dashboard/out/connect-repos.txt +7 -0
  276. package/dist/dashboard/out/history.html +1 -1
  277. package/dist/dashboard/out/history.txt +2 -2
  278. package/dist/dashboard/out/index.html +1 -1
  279. package/dist/dashboard/out/index.txt +2 -2
  280. package/dist/dashboard/out/login.html +6 -0
  281. package/dist/dashboard/out/login.txt +7 -0
  282. package/dist/dashboard/out/metrics.html +1 -1
  283. package/dist/dashboard/out/metrics.txt +2 -2
  284. package/dist/dashboard/out/pricing.html +2 -2
  285. package/dist/dashboard/out/pricing.txt +2 -2
  286. package/dist/dashboard/out/providers.html +1 -0
  287. package/dist/dashboard/out/providers.txt +7 -0
  288. package/dist/dashboard/out/signup.html +6 -0
  289. package/dist/dashboard/out/signup.txt +7 -0
  290. package/dist/dashboard-server/server.d.ts.map +1 -1
  291. package/dist/dashboard-server/server.js +1308 -8
  292. package/dist/dashboard-server/server.js.map +1 -1
  293. package/dist/hooks/emitter.d.ts +40 -0
  294. package/dist/hooks/emitter.d.ts.map +1 -0
  295. package/dist/hooks/emitter.js +63 -0
  296. package/dist/hooks/emitter.js.map +1 -0
  297. package/dist/hooks/index.d.ts +3 -0
  298. package/dist/hooks/index.d.ts.map +1 -1
  299. package/dist/hooks/index.js +3 -0
  300. package/dist/hooks/index.js.map +1 -1
  301. package/dist/hooks/registry.d.ts +173 -0
  302. package/dist/hooks/registry.d.ts.map +1 -0
  303. package/dist/hooks/registry.js +476 -0
  304. package/dist/hooks/registry.js.map +1 -0
  305. package/dist/hooks/trajectory-hooks.d.ts +52 -0
  306. package/dist/hooks/trajectory-hooks.d.ts.map +1 -0
  307. package/dist/hooks/trajectory-hooks.js +183 -0
  308. package/dist/hooks/trajectory-hooks.js.map +1 -0
  309. package/dist/hooks/types.d.ts +141 -0
  310. package/dist/hooks/types.d.ts.map +1 -1
  311. package/dist/index.d.ts +2 -0
  312. package/dist/index.d.ts.map +1 -1
  313. package/dist/index.js +3 -0
  314. package/dist/index.js.map +1 -1
  315. package/dist/memory/adapters/index.d.ts +8 -0
  316. package/dist/memory/adapters/index.d.ts.map +1 -0
  317. package/dist/memory/adapters/index.js +8 -0
  318. package/dist/memory/adapters/index.js.map +1 -0
  319. package/dist/memory/adapters/inmemory.d.ts +59 -0
  320. package/dist/memory/adapters/inmemory.d.ts.map +1 -0
  321. package/dist/memory/adapters/inmemory.js +195 -0
  322. package/dist/memory/adapters/inmemory.js.map +1 -0
  323. package/dist/memory/adapters/supermemory.d.ts +71 -0
  324. package/dist/memory/adapters/supermemory.d.ts.map +1 -0
  325. package/dist/memory/adapters/supermemory.js +338 -0
  326. package/dist/memory/adapters/supermemory.js.map +1 -0
  327. package/dist/memory/factory.d.ts +48 -0
  328. package/dist/memory/factory.d.ts.map +1 -0
  329. package/dist/memory/factory.js +143 -0
  330. package/dist/memory/factory.js.map +1 -0
  331. package/dist/memory/index.d.ts +32 -0
  332. package/dist/memory/index.d.ts.map +1 -0
  333. package/dist/memory/index.js +32 -0
  334. package/dist/memory/index.js.map +1 -0
  335. package/dist/memory/memory-hooks.d.ts +60 -0
  336. package/dist/memory/memory-hooks.d.ts.map +1 -0
  337. package/dist/memory/memory-hooks.js +313 -0
  338. package/dist/memory/memory-hooks.js.map +1 -0
  339. package/dist/memory/service.d.ts +49 -0
  340. package/dist/memory/service.d.ts.map +1 -0
  341. package/dist/memory/service.js +146 -0
  342. package/dist/memory/service.js.map +1 -0
  343. package/dist/memory/types.d.ts +195 -0
  344. package/dist/memory/types.d.ts.map +1 -0
  345. package/dist/memory/types.js +8 -0
  346. package/dist/memory/types.js.map +1 -0
  347. package/dist/policy/agent-policy.d.ts +225 -0
  348. package/dist/policy/agent-policy.d.ts.map +1 -0
  349. package/dist/policy/agent-policy.js +665 -0
  350. package/dist/policy/agent-policy.js.map +1 -0
  351. package/dist/policy/cloud-policy-fetcher.d.ts +12 -0
  352. package/dist/policy/cloud-policy-fetcher.d.ts.map +1 -0
  353. package/dist/policy/cloud-policy-fetcher.js +64 -0
  354. package/dist/policy/cloud-policy-fetcher.js.map +1 -0
  355. package/dist/resiliency/crash-insights.d.ts +156 -0
  356. package/dist/resiliency/crash-insights.d.ts.map +1 -0
  357. package/dist/resiliency/crash-insights.js +492 -0
  358. package/dist/resiliency/crash-insights.js.map +1 -0
  359. package/dist/resiliency/gossip-health.d.ts +137 -0
  360. package/dist/resiliency/gossip-health.d.ts.map +1 -0
  361. package/dist/resiliency/gossip-health.js +241 -0
  362. package/dist/resiliency/gossip-health.js.map +1 -0
  363. package/dist/resiliency/index.d.ts +5 -0
  364. package/dist/resiliency/index.d.ts.map +1 -1
  365. package/dist/resiliency/index.js +5 -0
  366. package/dist/resiliency/index.js.map +1 -1
  367. package/dist/resiliency/leader-watchdog.d.ts +109 -0
  368. package/dist/resiliency/leader-watchdog.d.ts.map +1 -0
  369. package/dist/resiliency/leader-watchdog.js +189 -0
  370. package/dist/resiliency/leader-watchdog.js.map +1 -0
  371. package/dist/resiliency/memory-monitor.d.ts +172 -0
  372. package/dist/resiliency/memory-monitor.d.ts.map +1 -0
  373. package/dist/resiliency/memory-monitor.js +593 -0
  374. package/dist/resiliency/memory-monitor.js.map +1 -0
  375. package/dist/resiliency/stateless-lead.d.ts +149 -0
  376. package/dist/resiliency/stateless-lead.d.ts.map +1 -0
  377. package/dist/resiliency/stateless-lead.js +308 -0
  378. package/dist/resiliency/stateless-lead.js.map +1 -0
  379. package/dist/resiliency/supervisor.d.ts +38 -0
  380. package/dist/resiliency/supervisor.d.ts.map +1 -1
  381. package/dist/resiliency/supervisor.js +122 -0
  382. package/dist/resiliency/supervisor.js.map +1 -1
  383. package/dist/shared/cli-auth-config.d.ts +91 -0
  384. package/dist/shared/cli-auth-config.d.ts.map +1 -0
  385. package/dist/shared/cli-auth-config.js +264 -0
  386. package/dist/shared/cli-auth-config.js.map +1 -0
  387. package/dist/storage/adapter.d.ts +1 -1
  388. package/dist/storage/adapter.d.ts.map +1 -1
  389. package/dist/trajectory/config.d.ts +84 -0
  390. package/dist/trajectory/config.d.ts.map +1 -0
  391. package/dist/trajectory/config.js +163 -0
  392. package/dist/trajectory/config.js.map +1 -0
  393. package/dist/trajectory/index.d.ts +8 -0
  394. package/dist/trajectory/index.d.ts.map +1 -0
  395. package/dist/trajectory/index.js +8 -0
  396. package/dist/trajectory/index.js.map +1 -0
  397. package/dist/trajectory/integration.d.ts +292 -0
  398. package/dist/trajectory/integration.d.ts.map +1 -0
  399. package/dist/trajectory/integration.js +834 -0
  400. package/dist/trajectory/integration.js.map +1 -0
  401. package/dist/utils/logger.js +1 -1
  402. package/dist/utils/logger.js.map +1 -1
  403. package/dist/utils/project-namespace.d.ts +24 -0
  404. package/dist/utils/project-namespace.d.ts.map +1 -1
  405. package/dist/utils/project-namespace.js +84 -0
  406. package/dist/utils/project-namespace.js.map +1 -1
  407. package/dist/wrapper/parser.d.ts +10 -0
  408. package/dist/wrapper/parser.d.ts.map +1 -1
  409. package/dist/wrapper/parser.js +100 -33
  410. package/dist/wrapper/parser.js.map +1 -1
  411. package/dist/wrapper/pty-wrapper.d.ts +197 -16
  412. package/dist/wrapper/pty-wrapper.d.ts.map +1 -1
  413. package/dist/wrapper/pty-wrapper.js +943 -106
  414. package/dist/wrapper/pty-wrapper.js.map +1 -1
  415. package/dist/wrapper/shared.d.ts +165 -0
  416. package/dist/wrapper/shared.d.ts.map +1 -0
  417. package/dist/wrapper/shared.js +270 -0
  418. package/dist/wrapper/shared.js.map +1 -0
  419. package/dist/wrapper/tmux-wrapper.d.ts +73 -11
  420. package/dist/wrapper/tmux-wrapper.d.ts.map +1 -1
  421. package/dist/wrapper/tmux-wrapper.js +541 -120
  422. package/dist/wrapper/tmux-wrapper.js.map +1 -1
  423. package/docs/CLOUD-ARCHITECTURE.md +152 -0
  424. package/docs/HOOKS_API.md +394 -0
  425. package/docs/WRAPPER_EVENTS.md +358 -0
  426. package/docs/agent-policy-snippet.md +40 -0
  427. package/docs/agent-relay-protocol.md +238 -0
  428. package/docs/agent-relay-snippet.md +53 -47
  429. package/docs/archive/EXECUTIVE_SUMMARY.md +358 -0
  430. package/docs/archive/ROADMAP.md +329 -0
  431. package/docs/competitive/GASTOWN.md +451 -0
  432. package/docs/{COMPETITIVE_ANALYSIS.md → competitive/OVERVIEW.md} +1 -0
  433. package/docs/competitive/README.md +34 -0
  434. package/docs/competitive/TMUX_ORCHESTRATOR.md +605 -0
  435. package/docs/dashboard.png +0 -0
  436. package/docs/design/ci-failure-webhooks.md +812 -0
  437. package/docs/design/comprehensive-integrations.md +238 -0
  438. package/docs/design/e2b-sandbox-integration.md +504 -0
  439. package/docs/design/github-app-permissions.md +264 -0
  440. package/docs/local-testing.md +428 -0
  441. package/docs/proposals/continuous-claude-integration.md +622 -0
  442. package/docs/proposals/custom-commands.md +368 -0
  443. package/docs/tasks/global-skills-system.tasks.md +230 -0
  444. package/docs/tasks/webhook-integrations.tasks.md +184 -0
  445. package/docs/tasks/workspace-capabilities.tasks.md +121 -0
  446. package/docs/testing/RESILIENCY-TEST-PLAN-2026-01-01.md +366 -0
  447. package/package.json +16 -7
  448. package/scripts/cloud-setup.sh +96 -0
  449. package/scripts/manual-qa.sh +293 -0
  450. package/scripts/postinstall.js +60 -0
  451. package/scripts/run-cloud-qa.sh +220 -0
  452. package/scripts/test-cli-auth/Dockerfile +44 -0
  453. package/scripts/test-cli-auth/Dockerfile.real +79 -0
  454. package/scripts/test-cli-auth/README.md +286 -0
  455. package/scripts/test-cli-auth/ci-test-real-clis.ts +251 -0
  456. package/scripts/test-cli-auth/ci-test-runner.ts +263 -0
  457. package/scripts/test-cli-auth/mock-cli.sh +147 -0
  458. package/scripts/test-cli-auth/package.json +14 -0
  459. package/scripts/test-cli-auth/test-oauth-flow.ts +220 -0
  460. package/scripts/test-pty-input-auto.js +222 -0
  461. package/scripts/test-pty-input.js +150 -0
  462. package/dist/dashboard/out/_next/static/chunks/693-7b3301d8f6bc5014.js +0 -1
  463. package/dist/dashboard/out/_next/static/chunks/713-f78477eb185f1f4d.js +0 -1
  464. package/dist/dashboard/out/_next/static/chunks/766-e53e1cfe39b0b5b5.js +0 -1
  465. package/dist/dashboard/out/_next/static/chunks/900-037c64bfd797fb2a.js +0 -1
  466. package/dist/dashboard/out/_next/static/chunks/app/app/page-e3d9e1f4466b9bae.js +0 -1
  467. package/dist/dashboard/out/_next/static/chunks/app/metrics/page-e68825a81db67ba1.js +0 -1
  468. package/dist/dashboard/out/_next/static/chunks/app/page-cc108bf68c8a657f.js +0 -1
  469. package/dist/dashboard/out/_next/static/chunks/webpack-a5acc2831d094776.js +0 -1
  470. package/dist/dashboard/out/_next/static/css/79b80143647a07d7.css +0 -1
  471. package/dist/dashboard/out/_next/static/css/8cf277370ad48cfe.css +0 -1
  472. /package/dist/dashboard/out/_next/static/{6HHWb2ZmnJ4OSm0zUP7h4 → H5aWG0udPB4iOUIl_gytz}/_buildManifest.js +0 -0
  473. /package/dist/dashboard/out/_next/static/{6HHWb2ZmnJ4OSm0zUP7h4 → H5aWG0udPB4iOUIl_gytz}/_ssgManifest.js +0 -0
  474. /package/dist/dashboard/out/_next/static/chunks/{117-b2cd8d6485aacf2b.js → 117-b100311aff8d5c61.js} +0 -0
  475. /package/dist/dashboard/out/_next/static/chunks/{648-8f3f26864ce515e5.js → 648-a13d3c2b1be45466.js} +0 -0
  476. /package/dist/dashboard/out/_next/static/chunks/app/_not-found/{page-0b990dbb71d72a98.js → page-a4973f3e3c82fb67.js} +0 -0
  477. /package/dist/dashboard/out/_next/static/chunks/app/pricing/{page-d80e03a5297f95b6.js → page-4d72d5a5d8a9b618.js} +0 -0
  478. /package/docs/{CHANGELOG.md → archive/CHANGELOG.md} +0 -0
  479. /package/docs/{CLI-SIMPLIFICATION-COMPLETE.md → archive/CLI-SIMPLIFICATION-COMPLETE.md} +0 -0
  480. /package/docs/{DESIGN_BRIDGE_STAFFING.md → archive/DESIGN_BRIDGE_STAFFING.md} +0 -0
  481. /package/docs/{DESIGN_V2.md → archive/DESIGN_V2.md} +0 -0
  482. /package/docs/{MONETIZATION.md → archive/MONETIZATION.md} +0 -0
  483. /package/docs/{PROPOSAL-trajectories.md → archive/PROPOSAL-trajectories.md} +0 -0
  484. /package/docs/{SCALING_ANALYSIS.md → archive/SCALING_ANALYSIS.md} +0 -0
  485. /package/docs/{TESTING_PRESENCE_FEATURES.md → archive/TESTING_PRESENCE_FEATURES.md} +0 -0
  486. /package/docs/{TMUX_IMPLEMENTATION_NOTES.md → archive/TMUX_IMPLEMENTATION_NOTES.md} +0 -0
  487. /package/docs/{TMUX_IMPROVEMENTS.md → archive/TMUX_IMPROVEMENTS.md} +0 -0
  488. /package/docs/{dashboard-v2-plan.md → archive/dashboard-v2-plan.md} +0 -0
  489. /package/docs/{removable-code-analysis.md → archive/removable-code-analysis.md} +0 -0
  490. /package/docs/{competitive-analysis-mcp-agent-mail.md → competitive/MCP_AGENT_MAIL.md} +0 -0
@@ -0,0 +1,812 @@
1
+ # CI Failure Webhooks - Agent Notification System
2
+
3
+ ## Overview
4
+
5
+ This document describes the architecture for automatically notifying agents when GitHub CI checks fail on pull requests. This enables agents to autonomously investigate and fix CI failures without human intervention.
6
+
7
+ ## Motivation
8
+
9
+ Currently, when CI fails on a PR:
10
+ 1. Developer notices the failure (manual)
11
+ 2. Developer investigates logs (manual)
12
+ 3. Developer fixes the issue (manual)
13
+ 4. Developer pushes and waits for CI again (manual)
14
+
15
+ With webhook-based agent notification:
16
+ 1. CI fails → webhook fires
17
+ 2. Agent receives failure context automatically
18
+ 3. Agent investigates and pushes fix
19
+ 4. CI re-runs automatically
20
+
21
+ This closes the loop for autonomous PR maintenance.
22
+
23
+ ## Architecture
24
+
25
+ ```
26
+ ┌─────────────┐ webhook ┌─────────────────┐
27
+ │ GitHub │ ───────────────> │ Cloud API │
28
+ │ (CI fails) │ check_run │ /webhooks │
29
+ └─────────────┘ completed └────────┬────────┘
30
+
31
+ │ spawn or message
32
+
33
+ ┌─────────────────────┐
34
+ │ Agent Relay │
35
+ │ Daemon │
36
+ └────────┬────────────┘
37
+
38
+ ┌────────────┼────────────┐
39
+ ▼ ▼ ▼
40
+ ┌────────┐ ┌────────┐ ┌────────┐
41
+ │ Agent │ │ Agent │ │ Agent │
42
+ │ (PR) │ │ (Lint) │ │ (Test) │
43
+ └────────┘ └────────┘ └────────┘
44
+ ```
45
+
46
+ ## GitHub Webhook Events
47
+
48
+ ### Relevant Events
49
+
50
+ | Event | Trigger | Use Case |
51
+ |-------|---------|----------|
52
+ | `check_run` | Individual check completes | Fine-grained failure handling |
53
+ | `check_suite` | All checks complete | Wait for full CI before acting |
54
+ | `workflow_run` | GitHub Action completes | Action-specific handling |
55
+ | `pull_request` | PR state changes | Track PR lifecycle |
56
+
57
+ ### Recommended: `check_run` Event
58
+
59
+ The `check_run` event provides the most actionable data:
60
+
61
+ ```json
62
+ {
63
+ "action": "completed",
64
+ "check_run": {
65
+ "id": 123456789,
66
+ "name": "lint",
67
+ "status": "completed",
68
+ "conclusion": "failure",
69
+ "output": {
70
+ "title": "ESLint found 3 errors",
71
+ "summary": "Fix the following issues...",
72
+ "text": "src/foo.ts:10:5 - error: ...",
73
+ "annotations": [
74
+ {
75
+ "path": "src/foo.ts",
76
+ "start_line": 10,
77
+ "end_line": 10,
78
+ "annotation_level": "failure",
79
+ "message": "Unexpected console statement"
80
+ }
81
+ ]
82
+ },
83
+ "pull_requests": [
84
+ {
85
+ "number": 55,
86
+ "head": {
87
+ "ref": "feature-branch",
88
+ "sha": "abc123"
89
+ }
90
+ }
91
+ ]
92
+ },
93
+ "repository": {
94
+ "full_name": "org/repo"
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Implementation
100
+
101
+ ### 1. Webhook Endpoint
102
+
103
+ ```typescript
104
+ // src/cloud/api/webhooks.ts
105
+
106
+ import { Router } from 'express';
107
+ import crypto from 'crypto';
108
+
109
+ export const webhookRouter = Router();
110
+
111
+ /**
112
+ * Verify GitHub webhook signature
113
+ */
114
+ function verifyGitHubSignature(
115
+ payload: string,
116
+ signature: string,
117
+ secret: string
118
+ ): boolean {
119
+ const expected = `sha256=${crypto
120
+ .createHmac('sha256', secret)
121
+ .update(payload)
122
+ .digest('hex')}`;
123
+ return crypto.timingSafeEqual(
124
+ Buffer.from(signature),
125
+ Buffer.from(expected)
126
+ );
127
+ }
128
+
129
+ /**
130
+ * GitHub webhook handler for CI failures
131
+ */
132
+ webhookRouter.post('/github/ci', async (req, res) => {
133
+ const event = req.headers['x-github-event'] as string;
134
+ const signature = req.headers['x-hub-signature-256'] as string;
135
+ const payload = JSON.stringify(req.body);
136
+
137
+ // Verify webhook authenticity
138
+ const secret = process.env.GITHUB_WEBHOOK_SECRET;
139
+ if (secret && !verifyGitHubSignature(payload, signature, secret)) {
140
+ return res.status(401).json({ error: 'Invalid signature' });
141
+ }
142
+
143
+ // Handle check_run events
144
+ if (event === 'check_run') {
145
+ await handleCheckRunEvent(req.body);
146
+ }
147
+
148
+ // Handle workflow_run events
149
+ if (event === 'workflow_run') {
150
+ await handleWorkflowRunEvent(req.body);
151
+ }
152
+
153
+ res.status(200).json({ received: true });
154
+ });
155
+ ```
156
+
157
+ ### 2. Check Run Handler
158
+
159
+ ```typescript
160
+ // src/cloud/api/ci-handlers.ts
161
+
162
+ import { db } from '../db';
163
+ import { spawnAgent, messageAgent } from '../services/agent-spawner';
164
+
165
+ interface CheckRunPayload {
166
+ action: string;
167
+ check_run: {
168
+ id: number;
169
+ name: string;
170
+ status: string;
171
+ conclusion: string | null;
172
+ output: {
173
+ title: string;
174
+ summary: string;
175
+ text?: string;
176
+ annotations?: Array<{
177
+ path: string;
178
+ start_line: number;
179
+ end_line: number;
180
+ annotation_level: string;
181
+ message: string;
182
+ }>;
183
+ };
184
+ pull_requests: Array<{
185
+ number: number;
186
+ head: { ref: string; sha: string };
187
+ }>;
188
+ };
189
+ repository: {
190
+ full_name: string;
191
+ clone_url: string;
192
+ };
193
+ }
194
+
195
+ /**
196
+ * Handle check_run webhook events
197
+ */
198
+ export async function handleCheckRunEvent(payload: CheckRunPayload) {
199
+ const { action, check_run, repository } = payload;
200
+
201
+ // Only handle completed, failed checks
202
+ if (action !== 'completed') return;
203
+ if (check_run.conclusion !== 'failure') return;
204
+
205
+ // Only handle checks on PRs
206
+ if (check_run.pull_requests.length === 0) return;
207
+
208
+ const pr = check_run.pull_requests[0];
209
+ const failureContext = buildFailureContext(payload);
210
+
211
+ // Check if there's already an agent working on this PR
212
+ const existingAgent = await findAgentForPR(repository.full_name, pr.number);
213
+
214
+ if (existingAgent) {
215
+ // Message the existing agent about the failure
216
+ await messageAgent(existingAgent.id, {
217
+ type: 'ci_failure',
218
+ ...failureContext,
219
+ });
220
+ } else {
221
+ // Spawn a new agent to handle the failure
222
+ await spawnCIFixAgent(failureContext);
223
+ }
224
+ }
225
+
226
+ /**
227
+ * Build structured context from check run failure
228
+ */
229
+ function buildFailureContext(payload: CheckRunPayload) {
230
+ const { check_run, repository } = payload;
231
+ const pr = check_run.pull_requests[0];
232
+
233
+ return {
234
+ repository: repository.full_name,
235
+ cloneUrl: repository.clone_url,
236
+ prNumber: pr.number,
237
+ branch: pr.head.ref,
238
+ commitSha: pr.head.sha,
239
+ checkName: check_run.name,
240
+ checkId: check_run.id,
241
+ failureTitle: check_run.output.title,
242
+ failureSummary: check_run.output.summary,
243
+ failureDetails: check_run.output.text,
244
+ annotations: check_run.output.annotations || [],
245
+ };
246
+ }
247
+ ```
248
+
249
+ ### 3. Agent Spawner
250
+
251
+ ```typescript
252
+ // src/cloud/services/agent-spawner.ts
253
+
254
+ import { WorkspaceProvisioner } from '../provisioner';
255
+
256
+ interface CIFailureContext {
257
+ repository: string;
258
+ cloneUrl: string;
259
+ prNumber: number;
260
+ branch: string;
261
+ commitSha: string;
262
+ checkName: string;
263
+ checkId: number;
264
+ failureTitle: string;
265
+ failureSummary: string;
266
+ failureDetails?: string;
267
+ annotations: Array<{
268
+ path: string;
269
+ start_line: number;
270
+ end_line: number;
271
+ message: string;
272
+ }>;
273
+ }
274
+
275
+ /**
276
+ * Spawn an agent to fix CI failures
277
+ */
278
+ export async function spawnCIFixAgent(context: CIFailureContext) {
279
+ const prompt = buildAgentPrompt(context);
280
+
281
+ // Find or create workspace for this repository
282
+ const workspace = await findOrCreateWorkspace(context.repository);
283
+
284
+ // Spawn agent in the workspace
285
+ await workspace.spawnAgent({
286
+ name: `ci-fix-${context.checkName}-${context.prNumber}`,
287
+ prompt,
288
+ branch: context.branch,
289
+ workingDirectory: `/workspace/repos/${context.repository}`,
290
+ });
291
+ }
292
+
293
+ /**
294
+ * Build the prompt for the CI fix agent
295
+ */
296
+ function buildAgentPrompt(context: CIFailureContext): string {
297
+ const annotationsList = context.annotations
298
+ .map(a => `- ${a.path}:${a.start_line} - ${a.message}`)
299
+ .join('\n');
300
+
301
+ return `
302
+ # CI Failure Fix Task
303
+
304
+ A CI check has failed on PR #${context.prNumber} in ${context.repository}.
305
+
306
+ ## Failure Details
307
+
308
+ **Check Name:** ${context.checkName}
309
+ **Title:** ${context.failureTitle}
310
+ **Summary:** ${context.failureSummary}
311
+
312
+ ${context.failureDetails ? `**Details:**\n${context.failureDetails}` : ''}
313
+
314
+ ${annotationsList ? `## Annotations\n\n${annotationsList}` : ''}
315
+
316
+ ## Your Task
317
+
318
+ 1. Checkout the branch: \`${context.branch}\`
319
+ 2. Analyze the failure based on the annotations and error messages
320
+ 3. Fix the issues in the affected files
321
+ 4. Run the relevant checks locally to verify the fix
322
+ 5. Commit and push your changes with a clear commit message
323
+ 6. Report back with a summary of what was fixed
324
+
325
+ ## Important
326
+
327
+ - Only fix the specific issues causing the CI failure
328
+ - Do not refactor or improve unrelated code
329
+ - If you cannot fix the issue, explain why and what manual intervention is needed
330
+ `.trim();
331
+ }
332
+ ```
333
+
334
+ ### 4. Agent Notification via Relay
335
+
336
+ For agents already working on a PR, send failure notifications through the relay system:
337
+
338
+ ```typescript
339
+ // src/cloud/services/agent-notifier.ts
340
+
341
+ import { RelayClient } from '../../relay/client';
342
+
343
+ interface CIFailureMessage {
344
+ type: 'ci_failure';
345
+ checkName: string;
346
+ failureTitle: string;
347
+ failureSummary: string;
348
+ annotations: Array<{
349
+ path: string;
350
+ start_line: number;
351
+ message: string;
352
+ }>;
353
+ }
354
+
355
+ /**
356
+ * Notify an agent about CI failure via relay message
357
+ */
358
+ export async function notifyAgentOfCIFailure(
359
+ agentId: string,
360
+ failure: CIFailureMessage
361
+ ) {
362
+ const relay = new RelayClient();
363
+
364
+ const message = formatCIFailureMessage(failure);
365
+
366
+ await relay.sendMessage({
367
+ to: agentId,
368
+ content: message,
369
+ priority: 'high',
370
+ thread: `ci-failure-${failure.checkName}`,
371
+ });
372
+ }
373
+
374
+ function formatCIFailureMessage(failure: CIFailureMessage): string {
375
+ const annotations = failure.annotations
376
+ .slice(0, 10) // Limit to first 10
377
+ .map(a => ` - ${a.path}:${a.start_line}: ${a.message}`)
378
+ .join('\n');
379
+
380
+ return `
381
+ CI FAILURE: ${failure.checkName}
382
+
383
+ ${failure.failureTitle}
384
+
385
+ ${failure.failureSummary}
386
+
387
+ ${annotations ? `Issues:\n${annotations}` : ''}
388
+
389
+ Please investigate and fix these issues, then push your changes.
390
+ `.trim();
391
+ }
392
+ ```
393
+
394
+ ## Configuration
395
+
396
+ ### Workspace Settings
397
+
398
+ Repositories can configure CI webhook behavior in `.relay/config.json`:
399
+
400
+ ```json
401
+ {
402
+ "ciWebhooks": {
403
+ "enabled": true,
404
+ "autoFix": {
405
+ "lint": true,
406
+ "typecheck": true,
407
+ "test": false
408
+ },
409
+ "notifyExistingAgent": true,
410
+ "spawnNewAgent": true,
411
+ "maxConcurrentAgents": 3,
412
+ "cooldownMinutes": 5
413
+ }
414
+ }
415
+ ```
416
+
417
+ ### Check Name Mapping
418
+
419
+ Map CI check names to fix strategies:
420
+
421
+ ```json
422
+ {
423
+ "ciWebhooks": {
424
+ "checkStrategies": {
425
+ "lint": {
426
+ "autoFix": true,
427
+ "command": "npm run lint:fix",
428
+ "agentProfile": "linter"
429
+ },
430
+ "typecheck": {
431
+ "autoFix": true,
432
+ "command": "npm run typecheck",
433
+ "agentProfile": "typescript-expert"
434
+ },
435
+ "test": {
436
+ "autoFix": false,
437
+ "notifyOnly": true,
438
+ "agentProfile": "tester"
439
+ }
440
+ }
441
+ }
442
+ }
443
+ ```
444
+
445
+ ## Agent Profiles for CI Fixes
446
+
447
+ ### Lint Fix Agent
448
+
449
+ ```yaml
450
+ # .claude/agents/lint-fixer.md
451
+ ---
452
+ name: LintFixer
453
+ description: Fixes linting errors automatically
454
+ tools:
455
+ - Read
456
+ - Edit
457
+ - Bash
458
+ model: haiku
459
+ ---
460
+
461
+ You are a code quality specialist. Your job is to fix linting errors.
462
+
463
+ ## Approach
464
+
465
+ 1. Read the files with errors
466
+ 2. Understand the linting rule being violated
467
+ 3. Fix the code to comply with the rule
468
+ 4. Run the linter to verify the fix
469
+ 5. Commit with message: "fix: resolve lint errors"
470
+
471
+ ## Rules
472
+
473
+ - Fix only the specific errors reported
474
+ - Do not change code style beyond what's needed
475
+ - Do not add or remove features
476
+ - If a rule seems wrong, fix it anyway (discuss rule changes separately)
477
+ ```
478
+
479
+ ### Test Fix Agent
480
+
481
+ ```yaml
482
+ # .claude/agents/test-fixer.md
483
+ ---
484
+ name: TestFixer
485
+ description: Investigates and fixes failing tests
486
+ tools:
487
+ - Read
488
+ - Edit
489
+ - Bash
490
+ - Grep
491
+ model: sonnet
492
+ ---
493
+
494
+ You are a testing specialist. Your job is to fix failing tests.
495
+
496
+ ## Approach
497
+
498
+ 1. Run the failing test to see the actual error
499
+ 2. Determine if the issue is:
500
+ - Test is wrong (update the test)
501
+ - Code is wrong (fix the code)
502
+ - Environment issue (fix setup)
503
+ 3. Apply the minimal fix
504
+ 4. Run the test again to verify
505
+ 5. Run the full test suite to check for regressions
506
+ 6. Commit with descriptive message
507
+
508
+ ## Rules
509
+
510
+ - Prefer fixing code over changing tests
511
+ - If changing tests, explain why in the commit message
512
+ - Never delete tests to make CI pass
513
+ - If stuck, report the issue instead of guessing
514
+ ```
515
+
516
+ ## Database Schema
517
+
518
+ Track CI failure events and agent responses:
519
+
520
+ ```sql
521
+ -- CI failure events
522
+ CREATE TABLE ci_failure_events (
523
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
524
+ workspace_id UUID REFERENCES workspaces(id),
525
+ repository TEXT NOT NULL,
526
+ pr_number INTEGER NOT NULL,
527
+ check_name TEXT NOT NULL,
528
+ check_id BIGINT NOT NULL,
529
+ conclusion TEXT NOT NULL,
530
+ failure_title TEXT,
531
+ failure_summary TEXT,
532
+ annotations JSONB,
533
+ created_at TIMESTAMP DEFAULT NOW()
534
+ );
535
+
536
+ -- Agent responses to CI failures
537
+ CREATE TABLE ci_fix_attempts (
538
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
539
+ failure_event_id UUID REFERENCES ci_failure_events(id),
540
+ agent_id TEXT NOT NULL,
541
+ agent_name TEXT NOT NULL,
542
+ status TEXT NOT NULL, -- 'pending', 'in_progress', 'success', 'failed'
543
+ commit_sha TEXT,
544
+ error_message TEXT,
545
+ started_at TIMESTAMP DEFAULT NOW(),
546
+ completed_at TIMESTAMP
547
+ );
548
+
549
+ -- Indexes
550
+ CREATE INDEX idx_ci_failures_repo_pr ON ci_failure_events(repository, pr_number);
551
+ CREATE INDEX idx_ci_failures_created ON ci_failure_events(created_at);
552
+ CREATE INDEX idx_ci_fix_attempts_status ON ci_fix_attempts(status);
553
+ ```
554
+
555
+ ## API Endpoints
556
+
557
+ ### Webhook Registration
558
+
559
+ ```
560
+ POST /api/webhooks/github/register
561
+ {
562
+ "repository": "org/repo",
563
+ "events": ["check_run", "workflow_run"],
564
+ "secret": "webhook-secret"
565
+ }
566
+ ```
567
+
568
+ ### CI Failure History
569
+
570
+ ```
571
+ GET /api/ci-failures?repository=org/repo&pr=55
572
+
573
+ Response:
574
+ {
575
+ "failures": [
576
+ {
577
+ "id": "...",
578
+ "checkName": "lint",
579
+ "failureTitle": "ESLint found 3 errors",
580
+ "createdAt": "2025-01-04T...",
581
+ "fixAttempt": {
582
+ "agentName": "ci-fix-lint-55",
583
+ "status": "success",
584
+ "commitSha": "def456"
585
+ }
586
+ }
587
+ ]
588
+ }
589
+ ```
590
+
591
+ ### Manual Trigger
592
+
593
+ ```
594
+ POST /api/ci-failures/retry
595
+ {
596
+ "failureEventId": "...",
597
+ "agentProfile": "lint-fixer"
598
+ }
599
+ ```
600
+
601
+ ## Security Considerations
602
+
603
+ ### Webhook Verification
604
+
605
+ Always verify webhook signatures:
606
+
607
+ ```typescript
608
+ const signature = req.headers['x-hub-signature-256'];
609
+ const payload = JSON.stringify(req.body);
610
+ const expected = `sha256=${crypto
611
+ .createHmac('sha256', WEBHOOK_SECRET)
612
+ .update(payload)
613
+ .digest('hex')}`;
614
+
615
+ if (!crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))) {
616
+ throw new Error('Invalid webhook signature');
617
+ }
618
+ ```
619
+
620
+ ### Rate Limiting
621
+
622
+ Prevent abuse with rate limits:
623
+
624
+ ```typescript
625
+ const rateLimiter = new RateLimiter({
626
+ // Max 10 agent spawns per repo per hour
627
+ key: (req) => `ci-spawn:${req.body.repository.full_name}`,
628
+ maxRequests: 10,
629
+ windowMs: 60 * 60 * 1000,
630
+ });
631
+ ```
632
+
633
+ ### Agent Permissions
634
+
635
+ CI fix agents should have limited permissions:
636
+
637
+ ```yaml
638
+ permissions:
639
+ tools:
640
+ - Read
641
+ - Edit
642
+ - Bash
643
+ bash:
644
+ allowedCommands:
645
+ - npm
646
+ - git
647
+ - eslint
648
+ blockedCommands:
649
+ - rm -rf
650
+ - curl
651
+ - wget
652
+ files:
653
+ writable:
654
+ - "src/**"
655
+ - "test/**"
656
+ readonly:
657
+ - "package.json"
658
+ - ".github/**"
659
+ ```
660
+
661
+ ## Monitoring & Observability
662
+
663
+ ### Metrics to Track
664
+
665
+ - `ci_webhook_received_total` - Total webhooks received by event type
666
+ - `ci_failure_events_total` - Total CI failures by check name
667
+ - `ci_fix_attempts_total` - Fix attempts by status (success/failed)
668
+ - `ci_fix_duration_seconds` - Time from failure to fix commit
669
+ - `ci_agent_spawn_total` - Agents spawned for CI fixes
670
+
671
+ ### Alerts
672
+
673
+ ```yaml
674
+ alerts:
675
+ - name: HighCIFailureRate
676
+ condition: rate(ci_failure_events_total[1h]) > 10
677
+ severity: warning
678
+ message: "High CI failure rate detected"
679
+
680
+ - name: AgentFixFailures
681
+ condition: rate(ci_fix_attempts_total{status="failed"}[1h]) > 5
682
+ severity: warning
683
+ message: "Agents failing to fix CI issues"
684
+ ```
685
+
686
+ ## Issue and Comment Handling
687
+
688
+ In addition to CI failures, agents can respond to GitHub issues and @mentions in comments.
689
+
690
+ ### Supported Events
691
+
692
+ | Event | Purpose |
693
+ |-------|---------|
694
+ | `issues` | Track new issues for agent assignment |
695
+ | `issue_comment` | Detect @mentions in issue/PR comments |
696
+ | `pull_request_review_comment` | Detect @mentions in PR review comments |
697
+
698
+ ### @Mention Detection
699
+
700
+ When a comment contains `@agent-name`, the system:
701
+
702
+ 1. Extracts all @mentions from the comment text
703
+ 2. Checks if the mentioned name is a known agent type
704
+ 3. Creates a mention record in the database
705
+ 4. Routes to the appropriate agent for response
706
+
707
+ **Known Agent Types:**
708
+ - `@agent-relay` - General purpose agent
709
+ - `@lead` - Lead agent for coordination
710
+ - `@developer` - Developer agent for coding tasks
711
+ - `@reviewer` - Code review agent
712
+ - `@ci-fix` - CI failure fixing agent
713
+ - `@debugger` - Bug investigation agent
714
+ - `@docs` - Documentation agent
715
+ - `@test` - Test writing agent
716
+ - `@refactor` - Code refactoring agent
717
+
718
+ ### Issue Assignment
719
+
720
+ When a new issue is opened:
721
+
722
+ 1. Record the issue in `issue_assignments` table
723
+ 2. Extract priority from labels (p0-p3, critical/high/medium/low)
724
+ 3. Optionally auto-assign based on label mapping
725
+ 4. Agent receives issue context and works on a fix
726
+
727
+ ### Configuration
728
+
729
+ Configure agent triggers per repository:
730
+
731
+ ```json
732
+ {
733
+ "agentTriggers": {
734
+ "mentionableAgents": ["lead", "ci-fix", "reviewer"],
735
+ "defaultIssueAgent": "developer",
736
+ "autoAssignLabels": {
737
+ "bug": "debugger",
738
+ "enhancement": "developer",
739
+ "documentation": "docs"
740
+ },
741
+ "autoRespondToMentions": true,
742
+ "maxResponsesPerHour": 20,
743
+ "allowedTriggerUsers": []
744
+ }
745
+ }
746
+ ```
747
+
748
+ ### Database Schema
749
+
750
+ ```sql
751
+ -- Issue assignments
752
+ CREATE TABLE issue_assignments (
753
+ id UUID PRIMARY KEY,
754
+ repository TEXT NOT NULL,
755
+ issue_number BIGINT NOT NULL,
756
+ issue_title TEXT NOT NULL,
757
+ issue_body TEXT,
758
+ agent_id TEXT,
759
+ agent_name TEXT,
760
+ status TEXT DEFAULT 'pending',
761
+ resolution TEXT,
762
+ linked_pr_number BIGINT,
763
+ labels TEXT[],
764
+ priority TEXT,
765
+ created_at TIMESTAMP DEFAULT NOW(),
766
+ UNIQUE(repository, issue_number)
767
+ );
768
+
769
+ -- Comment mentions
770
+ CREATE TABLE comment_mentions (
771
+ id UUID PRIMARY KEY,
772
+ repository TEXT NOT NULL,
773
+ source_type TEXT NOT NULL, -- issue_comment, pr_comment, pr_review
774
+ source_id BIGINT NOT NULL,
775
+ issue_or_pr_number BIGINT NOT NULL,
776
+ comment_body TEXT NOT NULL,
777
+ author_login TEXT NOT NULL,
778
+ mentioned_agent TEXT NOT NULL,
779
+ status TEXT DEFAULT 'pending',
780
+ response_comment_id BIGINT,
781
+ created_at TIMESTAMP DEFAULT NOW()
782
+ );
783
+ ```
784
+
785
+ ### Security
786
+
787
+ - Rate limit @mentions to prevent abuse
788
+ - Optionally restrict which users can trigger agents
789
+ - Agents cannot respond to their own comments (prevent loops)
790
+ - Bot accounts are ignored by default
791
+
792
+ ## Future Enhancements
793
+
794
+ 1. **Learning from Fixes**: Track successful fixes to build patterns for common errors
795
+
796
+ 2. **Pre-emptive Checks**: Run checks locally before push to catch issues early
797
+
798
+ 3. **Fix Suggestions**: Instead of auto-fixing, suggest fixes for human review
799
+
800
+ 4. **Cross-repo Learning**: Apply fix patterns learned in one repo to others
801
+
802
+ 5. **Escalation Paths**: Auto-escalate to humans if agent can't fix after N attempts
803
+
804
+ 6. **Slack/Discord Integration**: Notify team channels about agent activity
805
+
806
+ 7. **PR Review Automation**: Auto-request reviews from appropriate agents
807
+
808
+ ## References
809
+
810
+ - [GitHub Webhooks Documentation](https://docs.github.com/en/webhooks)
811
+ - [GitHub Checks API](https://docs.github.com/en/rest/checks)
812
+ - [Agent Relay Protocol](./agent-relay-protocol.md)