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,622 @@
1
+ # Proposal: CLI-Agnostic Continuity System
2
+
3
+ **Issue:** agent-relay-317
4
+ **Status:** Proposed
5
+ **Priority:** 1 (High)
6
+ **Type:** Feature Epic
7
+
8
+ ## Executive Summary
9
+
10
+ Integrate session continuity and context management into Agent Relay at the **relay layer**, making it work for **any CLI** (Claude, Codex, Gemini, custom agents). This addresses context degradation without requiring CLI-specific hooks.
11
+
12
+ ## Problem Statement
13
+
14
+ All LLM-based CLIs suffer from context degradation:
15
+ - **Claude Code**: Lossy compaction summaries
16
+ - **Codex CLI**: Fixed context window, no persistence
17
+ - **Gemini CLI**: Similar context limitations
18
+
19
+ For long-running agent tasks, this leads to:
20
+ - Lost architectural decisions
21
+ - Forgotten implementation details
22
+ - Repeated mistakes
23
+ - Broken continuity across sessions
24
+
25
+ ## Design Principle: CLI-Agnostic
26
+
27
+ Unlike Continuous-Claude-v2 which uses Claude Code hooks, we implement continuity at the **relay layer**:
28
+
29
+ | Approach | Continuous-Claude-v2 | Agent Relay (this proposal) |
30
+ |----------|----------------------|----------------------------|
31
+ | Integration point | Claude Code hooks | Relay wrapper/protocol |
32
+ | CLI support | Claude only | Any CLI |
33
+ | Trigger mechanism | Hook events | Output patterns + relay messages |
34
+ | Context injection | Hook injection | Message injection via PTY |
35
+
36
+ ## Relationship to Trajectory System (PR #38)
37
+
38
+ This proposal is designed to **complement** the trajectory system (PR #38), not replace it:
39
+
40
+ | System | Scope | Focus |
41
+ |--------|-------|-------|
42
+ | **Trajectory** | Within-session | Decision tracking, PDERO phases |
43
+ | **Continuity** | Cross-session | State persistence, context reload |
44
+
45
+ ### How They Work Together
46
+
47
+ ```
48
+ ┌─────────────────────────────────────────────────────────────┐
49
+ │ Agent Work Session │
50
+ ├─────────────────────────────────────────────────────────────┤
51
+ │ TRAJECTORY (within-session, fine-grained) │
52
+ │ ├─ Plan phase: "Implement auth" │
53
+ │ ├─ Design phase: "Use JWT + refresh tokens" │
54
+ │ ├─ Execute phase: [decisions, tool calls, code] │
55
+ │ ├─ Review phase: "Tests pass" │
56
+ │ └─ Observe phase: "Performance good" │
57
+ │ │ │
58
+ │ ▼ (on completion or context limit) │
59
+ │ CONTINUITY (cross-session, coarse-grained) │
60
+ │ └─ Handoff auto-generated from trajectory │
61
+ │ ├─ Summary: trajectory.summary │
62
+ │ ├─ Decisions: trajectory.decisions[] │
63
+ │ ├─ Phase: trajectory.currentPhase │
64
+ │ └─ Next steps: derived from PDERO state │
65
+ └─────────────────────────────────────────────────────────────┘
66
+ ```
67
+
68
+ ### Integration Points
69
+
70
+ 1. **Trajectory completion → Auto-handoff**
71
+ - When `trail complete` is called, auto-generate a handoff
72
+ - Include trajectory summary, decisions, learnings
73
+
74
+ 2. **Hooks system shared**
75
+ - Use trajectory's hooks (PR #38) for continuity triggers
76
+ - `onAgentStop` → save ledger
77
+ - `onMessageSent` → update ledger
78
+
79
+ 3. **Memory adapters optional backend**
80
+ - Continuity can optionally use trajectory's memory adapters
81
+ - Default: SQLite + FTS5 (local, searchable)
82
+ - Optional: supermemory.ai (cloud, semantic search)
83
+
84
+ 4. **PDERO phases inform ledger**
85
+ - Ledger's `currentTask` maps to trajectory's current phase
86
+ - Decisions from trajectory populate ledger's `keyDecisions`
87
+
88
+ ### Non-Overlapping Responsibilities
89
+
90
+ | Trajectory Handles | Continuity Handles |
91
+ |-------------------|-------------------|
92
+ | PDERO phase transitions | Cross-session state reload |
93
+ | Decision recording | Handoff document creation |
94
+ | `trail` CLI integration | Context injection on spawn |
95
+ | Fine-grained step tracking | FTS5 searchable history |
96
+
97
+ ## Core Concepts
98
+
99
+ ### Philosophy: "Clear, Don't Compact"
100
+
101
+ Instead of relying on lossy summarization:
102
+ 1. Explicitly save state before context fills up
103
+ 2. Clear/restart the agent with fresh context
104
+ 3. Inject continuity context on startup
105
+
106
+ ### Key Components
107
+
108
+ | Component | Purpose | Persistence |
109
+ |-----------|---------|-------------|
110
+ | **Ledgers** | Within-session state snapshots | Per-agent, ephemeral |
111
+ | **Handoffs** | Cross-session transfer documents | Permanent, searchable |
112
+ | **Artifact Index** | SQLite+FTS5 knowledge base | Permanent |
113
+ | **Continuity Protocol** | Relay message extensions | N/A |
114
+ | **Trajectory Bridge** | Integration with PR #38 | Via hooks |
115
+
116
+ ## Integration Architecture
117
+
118
+ ### Layer 1: Output Pattern Detection
119
+
120
+ Extend the existing `->relay:` pattern system:
121
+
122
+ ```
123
+ # Agent requests handoff creation
124
+ ->continuity:save <<<
125
+ Current task: Implementing auth module
126
+ Completed: User model, JWT utils
127
+ Next: Login endpoint
128
+ Key decision: Using refresh tokens
129
+ >>>
130
+
131
+ # Agent requests context reload
132
+ ->continuity:load
133
+
134
+ # Agent marks uncertainty
135
+ ->continuity:uncertain "API rate limit handling unclear"
136
+ ```
137
+
138
+ **Implementation:** Extend `src/wrapper/parser.ts`
139
+
140
+ ```typescript
141
+ interface ContinuityCommand {
142
+ type: 'save' | 'load' | 'uncertain' | 'search';
143
+ content?: string;
144
+ query?: string;
145
+ }
146
+
147
+ function parseContinuityCommand(output: string): ContinuityCommand | null;
148
+ ```
149
+
150
+ ### Layer 2: Relay Protocol Extensions
151
+
152
+ Add continuity message types to the protocol:
153
+
154
+ ```typescript
155
+ // src/protocol/types.ts
156
+ type MessageType =
157
+ | 'MESSAGE'
158
+ | 'ACK'
159
+ | 'NACK'
160
+ // New continuity types
161
+ | 'CONTINUITY_SAVE' // Agent saves state
162
+ | 'CONTINUITY_LOAD' // Agent requests context
163
+ | 'CONTINUITY_SEARCH' // Agent searches history
164
+ | 'CONTINUITY_INJECT'; // Daemon injects context
165
+
166
+ interface ContinuitySavePayload {
167
+ agentName: string;
168
+ ledger: Ledger;
169
+ createHandoff: boolean;
170
+ }
171
+
172
+ interface ContinuityInjectPayload {
173
+ agentName: string;
174
+ context: string; // Markdown to inject
175
+ }
176
+ ```
177
+
178
+ ### Layer 3: Wrapper-Level Automation
179
+
180
+ The `TmuxWrapper` monitors agents and handles continuity:
181
+
182
+ ```typescript
183
+ // src/wrapper/tmux-wrapper.ts additions
184
+
185
+ class TmuxWrapper {
186
+ private continuityManager: ContinuityManager;
187
+
188
+ // Monitor output for continuity patterns
189
+ private handleOutput(output: string) {
190
+ const cmd = parseContinuityCommand(output);
191
+ if (cmd) {
192
+ this.handleContinuityCommand(cmd);
193
+ }
194
+ }
195
+
196
+ // Inject context on agent spawn
197
+ async spawnAgent(config: AgentConfig) {
198
+ await this.startTmuxSession();
199
+
200
+ // Load and inject continuity context
201
+ const context = await this.continuityManager.getStartupContext(config.name);
202
+ if (context) {
203
+ await this.injectMessage(context);
204
+ }
205
+
206
+ await this.startAgentProcess(config);
207
+ }
208
+
209
+ // Auto-save before agent restart
210
+ async restartAgent(agentName: string, reason: string) {
211
+ // Save current state
212
+ await this.continuityManager.autoSave(agentName, reason);
213
+
214
+ // Restart with fresh context
215
+ await this.killAgent(agentName);
216
+ await this.spawnAgent({ name: agentName, ... });
217
+ }
218
+ }
219
+ ```
220
+
221
+ ### Layer 4: Continuity Manager
222
+
223
+ Central service managing state persistence:
224
+
225
+ ```typescript
226
+ // src/continuity/manager.ts
227
+ class ContinuityManager {
228
+ private ledgerStore: LedgerStore;
229
+ private handoffStore: HandoffStore;
230
+ private artifactIndex: ArtifactIndex;
231
+
232
+ // Get context to inject on agent startup
233
+ async getStartupContext(agentName: string): Promise<string | null> {
234
+ const ledger = await this.ledgerStore.load(agentName);
235
+ const handoff = await this.handoffStore.getLatest(agentName);
236
+ const learnings = await this.artifactIndex.getRelevantLearnings(agentName);
237
+
238
+ if (!ledger && !handoff) return null;
239
+
240
+ return this.formatStartupContext({ ledger, handoff, learnings });
241
+ }
242
+
243
+ // Save agent state (called via relay protocol or output pattern)
244
+ async save(agentName: string, content: string, createHandoff: boolean) {
245
+ const ledger = this.parseLedger(content);
246
+ await this.ledgerStore.save(agentName, ledger);
247
+
248
+ if (createHandoff) {
249
+ const handoff = this.createHandoff(agentName, ledger);
250
+ await this.handoffStore.save(handoff);
251
+ await this.artifactIndex.index(handoff);
252
+ }
253
+ }
254
+
255
+ // Auto-save triggered by wrapper (restart, crash, etc.)
256
+ async autoSave(agentName: string, reason: string) {
257
+ // Request state from agent via injected prompt
258
+ // Or save last known state from ledger
259
+ }
260
+
261
+ // Search across all handoffs
262
+ async search(query: string): Promise<Handoff[]> {
263
+ return this.artifactIndex.search(query);
264
+ }
265
+ }
266
+ ```
267
+
268
+ ## Data Structures
269
+
270
+ ### Ledger (Within-Session)
271
+
272
+ ```typescript
273
+ interface Ledger {
274
+ agentName: string;
275
+ sessionId: string;
276
+ cli: string; // 'claude' | 'codex' | 'gemini' | string
277
+
278
+ // State
279
+ currentTask: string;
280
+ completed: string[];
281
+ inProgress: string[];
282
+ blocked: string[];
283
+
284
+ // Decisions & Context
285
+ keyDecisions: Decision[];
286
+ uncertainItems: string[]; // Things to verify
287
+ fileContext: FileRef[]; // Recently touched files
288
+
289
+ updatedAt: Date;
290
+ }
291
+ ```
292
+
293
+ ### Handoff (Cross-Session)
294
+
295
+ ```typescript
296
+ interface Handoff {
297
+ id: string;
298
+ agentName: string;
299
+ cli: string;
300
+
301
+ // Content
302
+ summary: string;
303
+ taskDescription: string;
304
+ completedWork: string[];
305
+ nextSteps: string[];
306
+
307
+ // References
308
+ fileReferences: FileRef[];
309
+ decisions: Decision[];
310
+ relatedHandoffs: string[]; // Links to previous handoffs
311
+
312
+ // Metadata
313
+ createdAt: Date;
314
+ triggerReason: 'manual' | 'auto_restart' | 'context_limit' | 'crash';
315
+ }
316
+ ```
317
+
318
+ ### File Structure
319
+
320
+ ```
321
+ .agent-relay/
322
+ ├── continuity/
323
+ │ ├── ledgers/
324
+ │ │ ├── Alice.json # Per-agent current state
325
+ │ │ └── Bob.json
326
+ │ ├── handoffs/
327
+ │ │ ├── Alice/
328
+ │ │ │ ├── 2025-12-31-auth-module.md
329
+ │ │ │ └── 2025-12-30-user-model.md
330
+ │ │ └── Bob/
331
+ │ │ └── 2025-12-31-api-endpoints.md
332
+ │ └── artifact-index.db # SQLite + FTS5
333
+ ```
334
+
335
+ ## Agent Instructions (CLI-Agnostic)
336
+
337
+ Add to agent system prompts via CLAUDE.md / agent config:
338
+
339
+ ```markdown
340
+ # Session Continuity
341
+
342
+ You have access to a continuity system that preserves your work across sessions.
343
+
344
+ ## Saving State
345
+
346
+ When you want to save your current progress (recommended before long operations):
347
+
348
+ \```
349
+ ->continuity:save <<<
350
+ Current task: [what you're working on]
351
+ Completed: [what's done]
352
+ In progress: [what's partially done]
353
+ Next steps: [what comes next]
354
+ Key decisions: [important choices made]
355
+ Uncertain: [things to verify]
356
+ Files: [key files with line numbers]
357
+ >>>
358
+ \```
359
+
360
+ ## Loading Previous Context
361
+
362
+ To load your previous session state:
363
+ \```
364
+ ->continuity:load
365
+ \```
366
+
367
+ ## Searching History
368
+
369
+ To search past handoffs and decisions:
370
+ \```
371
+ ->continuity:search "authentication patterns"
372
+ \```
373
+
374
+ The relay system will inject context automatically on session start.
375
+ ```
376
+
377
+ ## Dashboard Integration
378
+
379
+ ### Components
380
+
381
+ ```typescript
382
+ // Context meter showing agent "freshness"
383
+ interface AgentContextMeterProps {
384
+ agentName: string;
385
+ hasLedger: boolean;
386
+ lastHandoff: Date | null;
387
+ handoffCount: number;
388
+ }
389
+
390
+ // Handoff browser with search
391
+ interface HandoffBrowserProps {
392
+ agentName?: string;
393
+ onSelect: (handoff: Handoff) => void;
394
+ onInject: (handoff: Handoff, targetAgent: string) => void;
395
+ }
396
+
397
+ // Ledger viewer showing current agent state
398
+ interface LedgerViewerProps {
399
+ agentName: string;
400
+ ledger: Ledger | null;
401
+ onRefresh: () => void;
402
+ onCreateHandoff: () => void;
403
+ }
404
+ ```
405
+
406
+ ### API Endpoints
407
+
408
+ ```typescript
409
+ // Continuity API routes
410
+ router.get('/continuity/:agent/ledger', getLedger);
411
+ router.post('/continuity/:agent/ledger', saveLedger);
412
+ router.get('/continuity/:agent/handoffs', getHandoffs);
413
+ router.post('/continuity/:agent/handoff', createHandoff);
414
+ router.get('/continuity/search', searchHandoffs);
415
+ router.post('/continuity/:agent/inject', injectContext);
416
+ ```
417
+
418
+ ## CLI Commands
419
+
420
+ ```bash
421
+ # View agent's current ledger
422
+ agent-relay continuity ledger Alice
423
+
424
+ # List handoffs for an agent
425
+ agent-relay continuity handoffs Alice
426
+
427
+ # Search all handoffs
428
+ agent-relay continuity search "authentication"
429
+
430
+ # Manually create handoff for agent
431
+ agent-relay continuity save Alice --reason "manual checkpoint"
432
+
433
+ # Inject context into running agent
434
+ agent-relay continuity inject Alice --handoff <handoff-id>
435
+
436
+ # Clear continuity data for agent
437
+ agent-relay continuity clear Alice
438
+ ```
439
+
440
+ ## Implementation Roadmap
441
+
442
+ ### Milestone 1: Core Infrastructure
443
+ - [ ] `ContinuityManager` class
444
+ - [ ] `LedgerStore` with JSON file backend
445
+ - [ ] `HandoffStore` with markdown files
446
+ - [ ] Directory structure initialization
447
+
448
+ ### Milestone 2: Protocol Integration
449
+ - [ ] Output pattern parser (`->continuity:` commands)
450
+ - [ ] Protocol message types
451
+ - [ ] Router handling for continuity messages
452
+
453
+ ### Milestone 3: Wrapper Integration
454
+ - [ ] Context injection on spawn
455
+ - [ ] Auto-save on restart/crash
456
+ - [ ] Output monitoring for continuity patterns
457
+
458
+ ### Milestone 4: Artifact Index
459
+ - [ ] SQLite + FTS5 schema
460
+ - [ ] Handoff indexing
461
+ - [ ] Search API
462
+
463
+ ### Milestone 5: Dashboard & CLI
464
+ - [ ] `AgentContextMeter` component
465
+ - [ ] `HandoffBrowser` component
466
+ - [ ] `LedgerViewer` component
467
+ - [ ] CLI commands
468
+
469
+ ### Milestone 6: Advanced Features
470
+ - [ ] Cross-agent context sharing
471
+ - [ ] Learning extraction
472
+ - [ ] Automatic context limit detection
473
+
474
+ ## Trajectory Bridge (PR #38 Integration)
475
+
476
+ ### Bridge Implementation
477
+
478
+ ```typescript
479
+ // src/continuity/trajectory-bridge.ts
480
+ import { getTrajectoryStatus, type CompleteTrajectoryOptions } from '../trajectory/integration.js';
481
+ import type { HookContext } from '../hooks/types.js';
482
+
483
+ /**
484
+ * Bridge between trajectory system and continuity system.
485
+ * Automatically creates handoffs from trajectory data.
486
+ */
487
+ export class TrajectoryBridge {
488
+ constructor(
489
+ private continuityManager: ContinuityManager,
490
+ private hookRegistry: HookRegistry
491
+ ) {
492
+ this.registerHooks();
493
+ }
494
+
495
+ private registerHooks() {
496
+ // When trajectory completes, create handoff
497
+ this.hookRegistry.register('onTrajectoryComplete', async (ctx, data) => {
498
+ const handoff = await this.createHandoffFromTrajectory(
499
+ ctx.agentId,
500
+ data.trajectory
501
+ );
502
+ await this.continuityManager.saveHandoff(handoff);
503
+ });
504
+
505
+ // When agent stops, save ledger with trajectory context
506
+ this.hookRegistry.register('onAgentStop', async (ctx) => {
507
+ const trajectoryStatus = await getTrajectoryStatus();
508
+ if (trajectoryStatus.active) {
509
+ await this.continuityManager.saveLedger(ctx.agentId, {
510
+ currentPhase: trajectoryStatus.phase,
511
+ trajectoryId: trajectoryStatus.trajectoryId,
512
+ });
513
+ }
514
+ });
515
+ }
516
+
517
+ async createHandoffFromTrajectory(
518
+ agentName: string,
519
+ trajectory: TrajectoryData
520
+ ): Promise<Handoff> {
521
+ return {
522
+ id: generateId(),
523
+ agentName,
524
+ cli: trajectory.agent || 'unknown',
525
+ summary: trajectory.summary || '',
526
+ taskDescription: trajectory.task?.title || '',
527
+ completedWork: trajectory.completedSteps || [],
528
+ nextSteps: this.deriveNextSteps(trajectory),
529
+ fileReferences: trajectory.filesModified || [],
530
+ decisions: trajectory.decisions || [],
531
+ relatedHandoffs: [],
532
+ createdAt: new Date(),
533
+ triggerReason: 'trajectory_complete',
534
+ // Trajectory-specific fields
535
+ trajectoryId: trajectory.id,
536
+ pderoPhase: trajectory.currentPhase,
537
+ confidence: trajectory.confidence,
538
+ learnings: trajectory.learnings,
539
+ };
540
+ }
541
+ }
542
+ ```
543
+
544
+ ### Handoff Extended for Trajectory
545
+
546
+ ```typescript
547
+ interface Handoff {
548
+ // ... existing fields ...
549
+
550
+ // Trajectory integration (optional, present if from trajectory)
551
+ trajectoryId?: string;
552
+ pderoPhase?: PDEROPhase;
553
+ confidence?: number;
554
+ learnings?: string[];
555
+ }
556
+ ```
557
+
558
+ ## Files to Create/Modify
559
+
560
+ ### New Files
561
+ ```
562
+ src/continuity/
563
+ ├── index.ts
564
+ ├── manager.ts
565
+ ├── ledger-store.ts
566
+ ├── handoff-store.ts
567
+ ├── artifact-index.ts
568
+ ├── parser.ts # Continuity command parsing
569
+ ├── formatter.ts # Context formatting for injection
570
+ └── trajectory-bridge.ts # Integration with PR #38
571
+
572
+ src/dashboard/react-components/
573
+ ├── AgentContextMeter.tsx
574
+ ├── LedgerViewer.tsx
575
+ └── HandoffBrowser.tsx
576
+ ```
577
+
578
+ ### Modified Files
579
+ ```
580
+ src/wrapper/parser.ts # Add continuity pattern parsing
581
+ src/wrapper/tmux-wrapper.ts # Add continuity handling
582
+ src/protocol/types.ts # Add continuity message types
583
+ src/daemon/router.ts # Handle continuity messages
584
+ src/daemon/server.ts # Add continuity API endpoints
585
+ src/cli/index.ts # Add continuity commands
586
+ src/hooks/registry.ts # Register continuity hooks (PR #38)
587
+ ```
588
+
589
+ ## CLI Support Matrix
590
+
591
+ | Feature | Claude | Codex | Gemini | Custom |
592
+ |---------|--------|-------|--------|--------|
593
+ | Output pattern detection | ✅ | ✅ | ✅ | ✅ |
594
+ | Context injection | ✅ | ✅ | ✅ | ✅ |
595
+ | Auto-save on restart | ✅ | ✅ | ✅ | ✅ |
596
+ | Manual save command | ✅ | ✅ | ✅ | ✅ |
597
+ | Handoff search | ✅ | ✅ | ✅ | ✅ |
598
+
599
+ ## Success Metrics
600
+
601
+ 1. **CLI-agnostic**: Works with Claude, Codex, Gemini without modification
602
+ 2. **Seamless restarts**: Agents resume work after restart within 1 message
603
+ 3. **Searchable history**: Find past decisions in <100ms
604
+ 4. **Zero data loss**: No state lost across 10+ restart cycles
605
+ 5. **Dashboard visibility**: Real-time continuity status for all agents
606
+
607
+ ## Risks & Mitigations
608
+
609
+ | Risk | Mitigation |
610
+ |------|------------|
611
+ | Output parsing fragility | Well-defined patterns, fuzzy matching |
612
+ | Context injection timing | Wait for agent ready signal |
613
+ | Storage growth | Auto-archive, configurable retention |
614
+ | Cross-CLI compatibility | Test matrix, fallback behaviors |
615
+
616
+ ## References
617
+
618
+ - [Continuous-Claude-v2](https://github.com/parcadei/Continuous-Claude-v2)
619
+ - [Agent Relay Architecture](../ARCHITECTURE.md)
620
+ - [Relay Protocol Spec](../protocol/README.md)
621
+ - [Trajectory Integration PR #38](https://github.com/AgentWorkforce/relay/pull/38)
622
+ - [Agent Trajectories Package](https://github.com/steveyegge/agent-trajectories)