agent-relay 2.0.0 → 2.0.4

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 (360) hide show
  1. package/deploy/workspace/entrypoint.sh +4 -0
  2. package/dist/dashboard/out/404.html +1 -1
  3. package/dist/dashboard/out/app/onboarding.html +1 -1
  4. package/dist/dashboard/out/app/onboarding.txt +1 -1
  5. package/dist/dashboard/out/app.html +1 -1
  6. package/dist/dashboard/out/app.txt +1 -1
  7. package/dist/dashboard/out/cloud/link.html +1 -1
  8. package/dist/dashboard/out/cloud/link.txt +1 -1
  9. package/dist/dashboard/out/connect-repos.html +1 -1
  10. package/dist/dashboard/out/connect-repos.txt +1 -1
  11. package/dist/dashboard/out/history.html +1 -1
  12. package/dist/dashboard/out/history.txt +1 -1
  13. package/dist/dashboard/out/index.html +1 -1
  14. package/dist/dashboard/out/index.txt +1 -1
  15. package/dist/dashboard/out/login.html +1 -1
  16. package/dist/dashboard/out/login.txt +1 -1
  17. package/dist/dashboard/out/metrics.html +1 -1
  18. package/dist/dashboard/out/metrics.txt +1 -1
  19. package/dist/dashboard/out/pricing.html +1 -1
  20. package/dist/dashboard/out/pricing.txt +1 -1
  21. package/dist/dashboard/out/providers/setup/claude.html +1 -1
  22. package/dist/dashboard/out/providers/setup/claude.txt +1 -1
  23. package/dist/dashboard/out/providers/setup/codex.html +1 -1
  24. package/dist/dashboard/out/providers/setup/codex.txt +1 -1
  25. package/dist/dashboard/out/providers/setup/cursor.html +1 -1
  26. package/dist/dashboard/out/providers/setup/cursor.txt +1 -1
  27. package/dist/dashboard/out/providers.html +1 -1
  28. package/dist/dashboard/out/providers.txt +1 -1
  29. package/dist/dashboard/out/signup.html +1 -1
  30. package/dist/dashboard/out/signup.txt +1 -1
  31. package/dist/src/cli/index.js +7 -5
  32. package/package.json +10 -10
  33. package/packages/api-types/package.json +1 -1
  34. package/packages/bridge/dist/spawner.js +3 -1
  35. package/packages/bridge/package.json +12 -7
  36. package/packages/cloud/package.json +11 -6
  37. package/packages/config/dist/project-namespace.d.ts +4 -0
  38. package/packages/config/dist/project-namespace.js +8 -0
  39. package/packages/config/dist/relay-config.d.ts +14 -6
  40. package/packages/config/dist/relay-config.js +14 -6
  41. package/packages/config/package.json +7 -2
  42. package/packages/continuity/package.json +6 -1
  43. package/packages/daemon/package.json +16 -11
  44. package/packages/dashboard/dist/server.js +89 -17
  45. package/packages/dashboard/package.json +14 -22
  46. package/packages/dashboard/ui/react-components/SpawnModal.tsx +119 -29
  47. package/packages/dashboard/ui-dist/404.html +1 -1
  48. package/packages/dashboard/ui-dist/_next/static/chunks/677-7323947c23b35979.js +1 -0
  49. package/packages/dashboard/ui-dist/app/onboarding.html +1 -1
  50. package/packages/dashboard/ui-dist/app/onboarding.txt +1 -1
  51. package/packages/dashboard/ui-dist/app.html +1 -1
  52. package/packages/dashboard/ui-dist/app.txt +1 -1
  53. package/packages/dashboard/ui-dist/cloud/link.html +1 -1
  54. package/packages/dashboard/ui-dist/cloud/link.txt +1 -1
  55. package/packages/dashboard/ui-dist/connect-repos.html +1 -1
  56. package/packages/dashboard/ui-dist/connect-repos.txt +1 -1
  57. package/packages/dashboard/ui-dist/history.html +1 -1
  58. package/packages/dashboard/ui-dist/history.txt +1 -1
  59. package/packages/dashboard/ui-dist/index.html +1 -1
  60. package/packages/dashboard/ui-dist/index.txt +1 -1
  61. package/packages/dashboard/ui-dist/login.html +1 -1
  62. package/packages/dashboard/ui-dist/login.txt +1 -1
  63. package/packages/dashboard/ui-dist/metrics.html +1 -1
  64. package/packages/dashboard/ui-dist/metrics.txt +1 -1
  65. package/packages/dashboard/ui-dist/pricing.html +1 -1
  66. package/packages/dashboard/ui-dist/pricing.txt +1 -1
  67. package/packages/dashboard/ui-dist/providers/setup/claude.html +1 -1
  68. package/packages/dashboard/ui-dist/providers/setup/claude.txt +1 -1
  69. package/packages/dashboard/ui-dist/providers/setup/codex.html +1 -1
  70. package/packages/dashboard/ui-dist/providers/setup/codex.txt +1 -1
  71. package/packages/dashboard/ui-dist/providers/setup/cursor.html +1 -1
  72. package/packages/dashboard/ui-dist/providers/setup/cursor.txt +1 -1
  73. package/packages/dashboard/ui-dist/providers.html +1 -1
  74. package/packages/dashboard/ui-dist/providers.txt +1 -1
  75. package/packages/dashboard/ui-dist/signup.html +1 -1
  76. package/packages/dashboard/ui-dist/signup.txt +1 -1
  77. package/packages/dashboard-server/package.json +18 -12
  78. package/packages/hooks/package.json +9 -4
  79. package/packages/mcp/README.md +135 -19
  80. package/packages/mcp/dist/cloud.js +50 -1
  81. package/packages/mcp/package.json +1 -1
  82. package/packages/memory/package.json +7 -2
  83. package/packages/policy/package.json +7 -2
  84. package/packages/protocol/package.json +6 -1
  85. package/packages/resiliency/package.json +6 -1
  86. package/packages/sdk/README.md +160 -43
  87. package/packages/sdk/dist/client.d.ts +99 -3
  88. package/packages/sdk/dist/client.js +113 -6
  89. package/packages/sdk/dist/discovery.d.ts +29 -0
  90. package/packages/sdk/dist/discovery.js +126 -0
  91. package/packages/sdk/dist/index.d.ts +1 -0
  92. package/packages/sdk/dist/index.js +2 -0
  93. package/packages/sdk/dist/standalone.js +1 -0
  94. package/packages/sdk/package.json +2 -2
  95. package/packages/spawner/package.json +2 -2
  96. package/packages/state/package.json +6 -1
  97. package/packages/storage/package.json +7 -2
  98. package/packages/trajectory/package.json +7 -2
  99. package/packages/user-directory/package.json +7 -2
  100. package/packages/utils/package.json +6 -1
  101. package/packages/wrapper/dist/base-wrapper.d.ts +25 -1
  102. package/packages/wrapper/dist/base-wrapper.js +44 -2
  103. package/packages/wrapper/dist/relay-pty-orchestrator.d.ts +2 -0
  104. package/packages/wrapper/dist/relay-pty-orchestrator.js +55 -10
  105. package/packages/wrapper/dist/shared.d.ts +25 -0
  106. package/packages/wrapper/dist/shared.js +40 -0
  107. package/packages/wrapper/dist/tmux-wrapper.d.ts +7 -0
  108. package/packages/wrapper/dist/tmux-wrapper.js +62 -9
  109. package/packages/wrapper/package.json +7 -7
  110. package/.turbo/cache/013415461711937f-meta.json +0 -1
  111. package/.turbo/cache/013415461711937f.tar.zst +0 -0
  112. package/.turbo/cache/0562b1ff326acd6d-meta.json +0 -1
  113. package/.turbo/cache/0562b1ff326acd6d.tar.zst +0 -0
  114. package/.turbo/cache/0b46e0e17254882f-meta.json +0 -1
  115. package/.turbo/cache/0b46e0e17254882f.tar.zst +0 -0
  116. package/.turbo/cache/3799eda981d53d14-meta.json +0 -1
  117. package/.turbo/cache/3799eda981d53d14.tar.zst +0 -0
  118. package/.turbo/cache/47e9d8f404ed064d-meta.json +0 -1
  119. package/.turbo/cache/47e9d8f404ed064d.tar.zst +0 -0
  120. package/.turbo/cache/4cde1d1e5b298099-meta.json +0 -1
  121. package/.turbo/cache/4cde1d1e5b298099.tar.zst +0 -0
  122. package/.turbo/cache/538eea955c0936ef-meta.json +0 -1
  123. package/.turbo/cache/538eea955c0936ef.tar.zst +0 -0
  124. package/.turbo/cache/5dceac7f229f5d5d-meta.json +0 -1
  125. package/.turbo/cache/5dceac7f229f5d5d.tar.zst +0 -0
  126. package/.turbo/cache/64c15b201819367d-meta.json +0 -1
  127. package/.turbo/cache/64c15b201819367d.tar.zst +0 -0
  128. package/.turbo/cache/6d6a21a05efca434-meta.json +0 -1
  129. package/.turbo/cache/6d6a21a05efca434.tar.zst +0 -0
  130. package/.turbo/cache/7562610cb03ec040-meta.json +0 -1
  131. package/.turbo/cache/7562610cb03ec040.tar.zst +0 -0
  132. package/.turbo/cache/81a2456e17af4d7f-meta.json +0 -1
  133. package/.turbo/cache/81a2456e17af4d7f.tar.zst +0 -0
  134. package/.turbo/cache/823fc2a7b12f724c-meta.json +0 -1
  135. package/.turbo/cache/823fc2a7b12f724c.tar.zst +0 -0
  136. package/.turbo/cache/9daad16a073d1f91-meta.json +0 -1
  137. package/.turbo/cache/9daad16a073d1f91.tar.zst +0 -0
  138. package/.turbo/cache/b81ccbab0a606b60-meta.json +0 -1
  139. package/.turbo/cache/b81ccbab0a606b60.tar.zst +0 -0
  140. package/.turbo/cache/cf98487988bfcf91-meta.json +0 -1
  141. package/.turbo/cache/cf98487988bfcf91.tar.zst +0 -0
  142. package/.turbo/cache/cfdf7c57dca71f27-meta.json +0 -1
  143. package/.turbo/cache/cfdf7c57dca71f27.tar.zst +0 -0
  144. package/.turbo/cache/d3063ef43811b1e5-meta.json +0 -1
  145. package/.turbo/cache/d3063ef43811b1e5.tar.zst +0 -0
  146. package/.turbo/cache/de28892eb7678e65-meta.json +0 -1
  147. package/.turbo/cache/de28892eb7678e65.tar.zst +0 -0
  148. package/.turbo/cache/ec29adce408132ba-meta.json +0 -1
  149. package/.turbo/cache/ec29adce408132ba.tar.zst +0 -0
  150. package/.turbo/cache/f70450d8d305f172-meta.json +0 -1
  151. package/.turbo/cache/f70450d8d305f172.tar.zst +0 -0
  152. package/.turbo/cache/fe384d5d6b7a983a-meta.json +0 -1
  153. package/.turbo/cache/fe384d5d6b7a983a.tar.zst +0 -0
  154. package/bin/relay-pty +0 -0
  155. package/packages/dashboard/ui/.next/BUILD_ID +0 -1
  156. package/packages/dashboard/ui/.next/app-build-manifest.json +0 -135
  157. package/packages/dashboard/ui/.next/app-path-routes-manifest.json +0 -1
  158. package/packages/dashboard/ui/.next/build-manifest.json +0 -32
  159. package/packages/dashboard/ui/.next/cache/config.json +0 -7
  160. package/packages/dashboard/ui/.next/cache/eslint/.cache_1asv1h5 +0 -1
  161. package/packages/dashboard/ui/.next/cache/webpack/client-production/0.pack +0 -0
  162. package/packages/dashboard/ui/.next/cache/webpack/client-production/index.pack +0 -0
  163. package/packages/dashboard/ui/.next/cache/webpack/edge-server-production/0.pack +0 -0
  164. package/packages/dashboard/ui/.next/cache/webpack/edge-server-production/index.pack +0 -0
  165. package/packages/dashboard/ui/.next/cache/webpack/server-production/0.pack +0 -0
  166. package/packages/dashboard/ui/.next/cache/webpack/server-production/index.pack +0 -0
  167. package/packages/dashboard/ui/.next/export-detail.json +0 -1
  168. package/packages/dashboard/ui/.next/export-marker.json +0 -1
  169. package/packages/dashboard/ui/.next/images-manifest.json +0 -1
  170. package/packages/dashboard/ui/.next/next-minimal-server.js.nft.json +0 -1
  171. package/packages/dashboard/ui/.next/next-server.js.nft.json +0 -1
  172. package/packages/dashboard/ui/.next/package.json +0 -1
  173. package/packages/dashboard/ui/.next/prerender-manifest.json +0 -1
  174. package/packages/dashboard/ui/.next/react-loadable-manifest.json +0 -1970
  175. package/packages/dashboard/ui/.next/required-server-files.json +0 -1
  176. package/packages/dashboard/ui/.next/routes-manifest.json +0 -1
  177. package/packages/dashboard/ui/.next/server/app/_not-found/page.js +0 -1
  178. package/packages/dashboard/ui/.next/server/app/_not-found/page.js.nft.json +0 -1
  179. package/packages/dashboard/ui/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
  180. package/packages/dashboard/ui/.next/server/app/_not-found.html +0 -1
  181. package/packages/dashboard/ui/.next/server/app/_not-found.meta +0 -6
  182. package/packages/dashboard/ui/.next/server/app/_not-found.rsc +0 -9
  183. package/packages/dashboard/ui/.next/server/app/app/onboarding/page.js +0 -6
  184. package/packages/dashboard/ui/.next/server/app/app/onboarding/page.js.nft.json +0 -1
  185. package/packages/dashboard/ui/.next/server/app/app/onboarding/page_client-reference-manifest.js +0 -1
  186. package/packages/dashboard/ui/.next/server/app/app/onboarding.html +0 -1
  187. package/packages/dashboard/ui/.next/server/app/app/onboarding.meta +0 -5
  188. package/packages/dashboard/ui/.next/server/app/app/onboarding.rsc +0 -7
  189. package/packages/dashboard/ui/.next/server/app/app/page.js +0 -436
  190. package/packages/dashboard/ui/.next/server/app/app/page.js.nft.json +0 -1
  191. package/packages/dashboard/ui/.next/server/app/app/page_client-reference-manifest.js +0 -1
  192. package/packages/dashboard/ui/.next/server/app/app.html +0 -1
  193. package/packages/dashboard/ui/.next/server/app/app.meta +0 -5
  194. package/packages/dashboard/ui/.next/server/app/app.rsc +0 -7
  195. package/packages/dashboard/ui/.next/server/app/apple-icon.png/route.js +0 -12
  196. package/packages/dashboard/ui/.next/server/app/apple-icon.png/route.js.nft.json +0 -1
  197. package/packages/dashboard/ui/.next/server/app/apple-icon.png.body +0 -0
  198. package/packages/dashboard/ui/.next/server/app/apple-icon.png.meta +0 -1
  199. package/packages/dashboard/ui/.next/server/app/cloud/link/page.js +0 -1
  200. package/packages/dashboard/ui/.next/server/app/cloud/link/page.js.nft.json +0 -1
  201. package/packages/dashboard/ui/.next/server/app/cloud/link/page_client-reference-manifest.js +0 -1
  202. package/packages/dashboard/ui/.next/server/app/cloud/link.html +0 -1
  203. package/packages/dashboard/ui/.next/server/app/cloud/link.meta +0 -5
  204. package/packages/dashboard/ui/.next/server/app/cloud/link.rsc +0 -7
  205. package/packages/dashboard/ui/.next/server/app/connect-repos/page.js +0 -6
  206. package/packages/dashboard/ui/.next/server/app/connect-repos/page.js.nft.json +0 -1
  207. package/packages/dashboard/ui/.next/server/app/connect-repos/page_client-reference-manifest.js +0 -1
  208. package/packages/dashboard/ui/.next/server/app/connect-repos.html +0 -1
  209. package/packages/dashboard/ui/.next/server/app/connect-repos.meta +0 -5
  210. package/packages/dashboard/ui/.next/server/app/connect-repos.rsc +0 -7
  211. package/packages/dashboard/ui/.next/server/app/history/page.js +0 -1
  212. package/packages/dashboard/ui/.next/server/app/history/page.js.nft.json +0 -1
  213. package/packages/dashboard/ui/.next/server/app/history/page_client-reference-manifest.js +0 -1
  214. package/packages/dashboard/ui/.next/server/app/history.html +0 -1
  215. package/packages/dashboard/ui/.next/server/app/history.meta +0 -5
  216. package/packages/dashboard/ui/.next/server/app/history.rsc +0 -7
  217. package/packages/dashboard/ui/.next/server/app/index.html +0 -1
  218. package/packages/dashboard/ui/.next/server/app/index.meta +0 -5
  219. package/packages/dashboard/ui/.next/server/app/index.rsc +0 -7
  220. package/packages/dashboard/ui/.next/server/app/login/page.js +0 -6
  221. package/packages/dashboard/ui/.next/server/app/login/page.js.nft.json +0 -1
  222. package/packages/dashboard/ui/.next/server/app/login/page_client-reference-manifest.js +0 -1
  223. package/packages/dashboard/ui/.next/server/app/login.html +0 -5
  224. package/packages/dashboard/ui/.next/server/app/login.meta +0 -5
  225. package/packages/dashboard/ui/.next/server/app/login.rsc +0 -7
  226. package/packages/dashboard/ui/.next/server/app/metrics/page.js +0 -1
  227. package/packages/dashboard/ui/.next/server/app/metrics/page.js.nft.json +0 -1
  228. package/packages/dashboard/ui/.next/server/app/metrics/page_client-reference-manifest.js +0 -1
  229. package/packages/dashboard/ui/.next/server/app/metrics.html +0 -1
  230. package/packages/dashboard/ui/.next/server/app/metrics.meta +0 -5
  231. package/packages/dashboard/ui/.next/server/app/metrics.rsc +0 -7
  232. package/packages/dashboard/ui/.next/server/app/page.js +0 -1
  233. package/packages/dashboard/ui/.next/server/app/page.js.nft.json +0 -1
  234. package/packages/dashboard/ui/.next/server/app/page_client-reference-manifest.js +0 -1
  235. package/packages/dashboard/ui/.next/server/app/pricing/page.js +0 -5
  236. package/packages/dashboard/ui/.next/server/app/pricing/page.js.nft.json +0 -1
  237. package/packages/dashboard/ui/.next/server/app/pricing/page_client-reference-manifest.js +0 -1
  238. package/packages/dashboard/ui/.next/server/app/pricing.html +0 -13
  239. package/packages/dashboard/ui/.next/server/app/pricing.meta +0 -5
  240. package/packages/dashboard/ui/.next/server/app/pricing.rsc +0 -7
  241. package/packages/dashboard/ui/.next/server/app/providers/page.js +0 -2
  242. package/packages/dashboard/ui/.next/server/app/providers/page.js.nft.json +0 -1
  243. package/packages/dashboard/ui/.next/server/app/providers/page_client-reference-manifest.js +0 -1
  244. package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page.js +0 -1
  245. package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page.js.nft.json +0 -1
  246. package/packages/dashboard/ui/.next/server/app/providers/setup/[provider]/page_client-reference-manifest.js +0 -1
  247. package/packages/dashboard/ui/.next/server/app/providers/setup/claude.html +0 -1
  248. package/packages/dashboard/ui/.next/server/app/providers/setup/claude.meta +0 -5
  249. package/packages/dashboard/ui/.next/server/app/providers/setup/claude.rsc +0 -8
  250. package/packages/dashboard/ui/.next/server/app/providers/setup/codex.html +0 -1
  251. package/packages/dashboard/ui/.next/server/app/providers/setup/codex.meta +0 -5
  252. package/packages/dashboard/ui/.next/server/app/providers/setup/codex.rsc +0 -8
  253. package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.html +0 -1
  254. package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.meta +0 -5
  255. package/packages/dashboard/ui/.next/server/app/providers/setup/cursor.rsc +0 -8
  256. package/packages/dashboard/ui/.next/server/app/providers.html +0 -1
  257. package/packages/dashboard/ui/.next/server/app/providers.meta +0 -5
  258. package/packages/dashboard/ui/.next/server/app/providers.rsc +0 -7
  259. package/packages/dashboard/ui/.next/server/app/signup/page.js +0 -6
  260. package/packages/dashboard/ui/.next/server/app/signup/page.js.nft.json +0 -1
  261. package/packages/dashboard/ui/.next/server/app/signup/page_client-reference-manifest.js +0 -1
  262. package/packages/dashboard/ui/.next/server/app/signup.html +0 -6
  263. package/packages/dashboard/ui/.next/server/app/signup.meta +0 -5
  264. package/packages/dashboard/ui/.next/server/app/signup.rsc +0 -7
  265. package/packages/dashboard/ui/.next/server/app-paths-manifest.json +0 -16
  266. package/packages/dashboard/ui/.next/server/chunks/190.js +0 -1
  267. package/packages/dashboard/ui/.next/server/chunks/205.js +0 -1
  268. package/packages/dashboard/ui/.next/server/chunks/251.js +0 -9
  269. package/packages/dashboard/ui/.next/server/chunks/288.js +0 -1
  270. package/packages/dashboard/ui/.next/server/chunks/434.js +0 -1
  271. package/packages/dashboard/ui/.next/server/chunks/471.js +0 -2
  272. package/packages/dashboard/ui/.next/server/chunks/621.js +0 -1
  273. package/packages/dashboard/ui/.next/server/chunks/680.js +0 -5
  274. package/packages/dashboard/ui/.next/server/chunks/682.js +0 -6
  275. package/packages/dashboard/ui/.next/server/chunks/684.js +0 -1
  276. package/packages/dashboard/ui/.next/server/chunks/71.js +0 -196
  277. package/packages/dashboard/ui/.next/server/chunks/711.js +0 -1
  278. package/packages/dashboard/ui/.next/server/chunks/90.js +0 -17
  279. package/packages/dashboard/ui/.next/server/chunks/948.js +0 -2
  280. package/packages/dashboard/ui/.next/server/chunks/font-manifest.json +0 -1
  281. package/packages/dashboard/ui/.next/server/font-manifest.json +0 -1
  282. package/packages/dashboard/ui/.next/server/functions-config-manifest.json +0 -1
  283. package/packages/dashboard/ui/.next/server/interception-route-rewrite-manifest.js +0 -1
  284. package/packages/dashboard/ui/.next/server/middleware-build-manifest.js +0 -1
  285. package/packages/dashboard/ui/.next/server/middleware-manifest.json +0 -6
  286. package/packages/dashboard/ui/.next/server/middleware-react-loadable-manifest.js +0 -1
  287. package/packages/dashboard/ui/.next/server/next-font-manifest.js +0 -1
  288. package/packages/dashboard/ui/.next/server/next-font-manifest.json +0 -1
  289. package/packages/dashboard/ui/.next/server/pages/404.html +0 -1
  290. package/packages/dashboard/ui/.next/server/pages/500.html +0 -1
  291. package/packages/dashboard/ui/.next/server/pages/_app.js +0 -1
  292. package/packages/dashboard/ui/.next/server/pages/_app.js.nft.json +0 -1
  293. package/packages/dashboard/ui/.next/server/pages/_document.js +0 -1
  294. package/packages/dashboard/ui/.next/server/pages/_document.js.nft.json +0 -1
  295. package/packages/dashboard/ui/.next/server/pages/_error.js +0 -1
  296. package/packages/dashboard/ui/.next/server/pages/_error.js.nft.json +0 -1
  297. package/packages/dashboard/ui/.next/server/pages-manifest.json +0 -1
  298. package/packages/dashboard/ui/.next/server/server-reference-manifest.js +0 -1
  299. package/packages/dashboard/ui/.next/server/server-reference-manifest.json +0 -1
  300. package/packages/dashboard/ui/.next/server/webpack-runtime.js +0 -1
  301. package/packages/dashboard/ui/.next/static/chunks/116-a883fca163f3a5bc.js +0 -1
  302. package/packages/dashboard/ui/.next/static/chunks/117-c8afed19e821a35d.js +0 -2
  303. package/packages/dashboard/ui/.next/static/chunks/282-980c2eb8fff20123.js +0 -1
  304. package/packages/dashboard/ui/.next/static/chunks/532-bace199897eeab37.js +0 -9
  305. package/packages/dashboard/ui/.next/static/chunks/631-af51bad94027527a.js +0 -1
  306. package/packages/dashboard/ui/.next/static/chunks/648-acb2ff9f77cbfbd3.js +0 -1
  307. package/packages/dashboard/ui/.next/static/chunks/677-30e60cb0b47875b6.js +0 -1
  308. package/packages/dashboard/ui/.next/static/chunks/766-2aea80818f7eb0d8.js +0 -1
  309. package/packages/dashboard/ui/.next/static/chunks/83-4f08122d4e7e79a6.js +0 -1
  310. package/packages/dashboard/ui/.next/static/chunks/847-f1f467060f32afff.js +0 -1
  311. package/packages/dashboard/ui/.next/static/chunks/891-5cb1513eeb97a891.js +0 -1
  312. package/packages/dashboard/ui/.next/static/chunks/app/_not-found/page-60501fddbafba9dc.js +0 -1
  313. package/packages/dashboard/ui/.next/static/chunks/app/app/onboarding/page-9914652442f7e4fb.js +0 -1
  314. package/packages/dashboard/ui/.next/static/chunks/app/app/page-44813aa26ad19681.js +0 -1
  315. package/packages/dashboard/ui/.next/static/chunks/app/cloud/link/page-fa1d5842aa90e8a6.js +0 -1
  316. package/packages/dashboard/ui/.next/static/chunks/app/connect-repos/page-113060009ef35bc2.js +0 -1
  317. package/packages/dashboard/ui/.next/static/chunks/app/history/page-9965d2483011b846.js +0 -1
  318. package/packages/dashboard/ui/.next/static/chunks/app/layout-6b91e33784c20610.js +0 -1
  319. package/packages/dashboard/ui/.next/static/chunks/app/login/page-a0ca6f7ca6a100b8.js +0 -1
  320. package/packages/dashboard/ui/.next/static/chunks/app/metrics/page-1e37ef8e73940b40.js +0 -1
  321. package/packages/dashboard/ui/.next/static/chunks/app/page-7993778218818ace.js +0 -1
  322. package/packages/dashboard/ui/.next/static/chunks/app/pricing/page-9db3ebdfa567a7c9.js +0 -1
  323. package/packages/dashboard/ui/.next/static/chunks/app/providers/page-bcf46064ac4474ce.js +0 -1
  324. package/packages/dashboard/ui/.next/static/chunks/app/providers/setup/[provider]/page-4dbe33f0f7691b7c.js +0 -1
  325. package/packages/dashboard/ui/.next/static/chunks/app/signup/page-1ede2205b58649ca.js +0 -1
  326. package/packages/dashboard/ui/.next/static/chunks/e868780c-48e5f147c90a3a41.js +0 -18
  327. package/packages/dashboard/ui/.next/static/chunks/fd9d1056-609918ca7b6280bb.js +0 -1
  328. package/packages/dashboard/ui/.next/static/chunks/framework-f66176bb897dc684.js +0 -1
  329. package/packages/dashboard/ui/.next/static/chunks/main-5a40a5ae29646e1b.js +0 -1
  330. package/packages/dashboard/ui/.next/static/chunks/main-app-fdbeb09028f57c9f.js +0 -1
  331. package/packages/dashboard/ui/.next/static/chunks/pages/_app-72b849fbd24ac258.js +0 -1
  332. package/packages/dashboard/ui/.next/static/chunks/pages/_error-7ba65e1336b92748.js +0 -1
  333. package/packages/dashboard/ui/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  334. package/packages/dashboard/ui/.next/static/chunks/webpack-1cdd8ed57114d5e1.js +0 -1
  335. package/packages/dashboard/ui/.next/static/css/4034f236dd1a3178.css +0 -1
  336. package/packages/dashboard/ui/.next/static/css/99c2552394077586.css +0 -1
  337. package/packages/dashboard/ui/.next/trace +0 -63
  338. package/packages/dashboard/ui/.next/types/app/app/onboarding/page.ts +0 -79
  339. package/packages/dashboard/ui/.next/types/app/app/page.ts +0 -79
  340. package/packages/dashboard/ui/.next/types/app/cloud/link/page.ts +0 -79
  341. package/packages/dashboard/ui/.next/types/app/connect-repos/page.ts +0 -79
  342. package/packages/dashboard/ui/.next/types/app/history/page.ts +0 -79
  343. package/packages/dashboard/ui/.next/types/app/layout.ts +0 -79
  344. package/packages/dashboard/ui/.next/types/app/login/page.ts +0 -79
  345. package/packages/dashboard/ui/.next/types/app/metrics/page.ts +0 -79
  346. package/packages/dashboard/ui/.next/types/app/page.ts +0 -79
  347. package/packages/dashboard/ui/.next/types/app/pricing/page.ts +0 -79
  348. package/packages/dashboard/ui/.next/types/app/providers/page.ts +0 -79
  349. package/packages/dashboard/ui/.next/types/app/providers/setup/[provider]/page.ts +0 -79
  350. package/packages/dashboard/ui/.next/types/app/signup/page.ts +0 -79
  351. package/packages/dashboard/ui/.next/types/package.json +0 -1
  352. package/packages/dashboard/ui-dist/_next/static/chunks/677-30e60cb0b47875b6.js +0 -1
  353. /package/dist/dashboard/out/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_buildManifest.js +0 -0
  354. /package/dist/dashboard/out/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_ssgManifest.js +0 -0
  355. /package/packages/dashboard/ui-dist/_next/static/{HR7W9z1PPVPFqUboUVZFZ → 0AsOfRemPXJmtynCKT-rx}/_buildManifest.js +0 -0
  356. /package/packages/dashboard/ui-dist/_next/static/{HR7W9z1PPVPFqUboUVZFZ → 0AsOfRemPXJmtynCKT-rx}/_ssgManifest.js +0 -0
  357. /package/packages/dashboard/ui-dist/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_buildManifest.js +0 -0
  358. /package/packages/dashboard/ui-dist/_next/static/{ZCFjHbkF8yDKS2md3lVgb → 72btMIJ64BCAB4UgVkpaq}/_ssgManifest.js +0 -0
  359. /package/packages/dashboard/{ui/.next/static/HR7W9z1PPVPFqUboUVZFZ → ui-dist/_next/static/clUN2n0bz9HCjKI0qlOxU}/_buildManifest.js +0 -0
  360. /package/packages/dashboard/{ui/.next/static/HR7W9z1PPVPFqUboUVZFZ → ui-dist/_next/static/clUN2n0bz9HCjKI0qlOxU}/_ssgManifest.js +0 -0
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Socket Discovery for Agent Relay SDK
3
+ *
4
+ * Discovers the daemon socket path for local development and cloud environments.
5
+ */
6
+ import { existsSync, readFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { homedir } from 'node:os';
9
+ /**
10
+ * Find project root by looking for common markers.
11
+ * Scans up from startDir until it finds a marker or hits the filesystem root.
12
+ */
13
+ function findProjectRoot(startDir = process.cwd()) {
14
+ let current = startDir;
15
+ const markers = ['.git', 'package.json', 'Cargo.toml', 'go.mod', 'pyproject.toml', '.agent-relay'];
16
+ // Limit iterations to prevent infinite loops
17
+ for (let i = 0; i < 100; i++) {
18
+ for (const marker of markers) {
19
+ if (existsSync(join(current, marker))) {
20
+ return current;
21
+ }
22
+ }
23
+ const parent = join(current, '..');
24
+ if (parent === current)
25
+ break; // Reached root
26
+ current = parent;
27
+ }
28
+ return null;
29
+ }
30
+ /**
31
+ * Discover the relay daemon socket path.
32
+ *
33
+ * Discovery order:
34
+ * 1. RELAY_SOCKET environment variable (explicit override)
35
+ * 2. Cloud workspace socket (if WORKSPACE_ID is set)
36
+ * 3. Project-local socket ({projectRoot}/.agent-relay/relay.sock)
37
+ * 4. Legacy fallback (/tmp/agent-relay.sock)
38
+ *
39
+ * @param cwd - Working directory to start search from (default: process.cwd())
40
+ * @returns Discovery result with socket path and metadata
41
+ */
42
+ export function discoverSocket(cwd) {
43
+ const startDir = cwd || process.cwd();
44
+ // 1. Explicit socket path from environment
45
+ const socketEnv = process.env.RELAY_SOCKET;
46
+ if (socketEnv && existsSync(socketEnv)) {
47
+ return {
48
+ socketPath: socketEnv,
49
+ projectId: process.env.RELAY_PROJECT || 'env',
50
+ source: 'env',
51
+ };
52
+ }
53
+ // 2. Cloud workspace socket (if WORKSPACE_ID is set)
54
+ const workspaceId = process.env.WORKSPACE_ID;
55
+ if (workspaceId) {
56
+ const cloudSocket = `/tmp/relay/${workspaceId}/sockets/daemon.sock`;
57
+ if (existsSync(cloudSocket)) {
58
+ return {
59
+ socketPath: cloudSocket,
60
+ projectId: workspaceId,
61
+ source: 'cloud',
62
+ };
63
+ }
64
+ }
65
+ // 3. Project-local socket
66
+ // First try cwd, then scan up to find project root
67
+ const projectRoot = findProjectRoot(startDir);
68
+ const searchDirs = [startDir];
69
+ if (projectRoot && projectRoot !== startDir) {
70
+ searchDirs.push(projectRoot);
71
+ }
72
+ for (const dir of searchDirs) {
73
+ const projectLocalSocket = join(dir, '.agent-relay', 'relay.sock');
74
+ if (existsSync(projectLocalSocket)) {
75
+ // Read project ID from marker file if available
76
+ let projectId = 'local';
77
+ const markerPath = join(dir, '.agent-relay', '.project');
78
+ if (existsSync(markerPath)) {
79
+ try {
80
+ const marker = JSON.parse(readFileSync(markerPath, 'utf-8'));
81
+ projectId = marker.projectId || 'local';
82
+ }
83
+ catch {
84
+ // Ignore marker read errors
85
+ }
86
+ }
87
+ return {
88
+ socketPath: projectLocalSocket,
89
+ projectId,
90
+ source: 'project',
91
+ };
92
+ }
93
+ }
94
+ // 4. Legacy fallback
95
+ const legacySocket = '/tmp/agent-relay.sock';
96
+ if (existsSync(legacySocket)) {
97
+ return {
98
+ socketPath: legacySocket,
99
+ projectId: 'legacy',
100
+ source: 'legacy',
101
+ };
102
+ }
103
+ // Also check ~/.agent-relay for legacy global installations
104
+ const homeSocket = join(homedir(), '.agent-relay', 'relay.sock');
105
+ if (existsSync(homeSocket)) {
106
+ return {
107
+ socketPath: homeSocket,
108
+ projectId: 'home',
109
+ source: 'legacy',
110
+ };
111
+ }
112
+ // Return legacy path even if it doesn't exist (will fail on connect)
113
+ return {
114
+ socketPath: legacySocket,
115
+ projectId: 'unknown',
116
+ source: 'legacy',
117
+ };
118
+ }
119
+ /**
120
+ * Get the default socket path using discovery.
121
+ * Convenience function that returns just the path.
122
+ */
123
+ export function getDefaultSocketPath(cwd) {
124
+ return discoverSocket(cwd).socketPath;
125
+ }
126
+ //# sourceMappingURL=discovery.js.map
@@ -29,4 +29,5 @@ export { RelayClient, type ClientState, type ClientConfig, type SyncOptions, } f
29
29
  export { createRelay, createPair, type Relay, type RelayConfig, } from './standalone.js';
30
30
  export { PROTOCOL_VERSION, type MessageType, type PayloadKind, type Envelope, type EntityType, type SendPayload, type SendMeta, type SyncMeta, type DeliveryInfo, type AckPayload, type ErrorCode, type ErrorPayload, type SpeakOnTrigger, type ShadowConfig, type SpawnPayload, type SpawnResultPayload, type ReleasePayload, type ReleaseResultPayload, type ChannelMessagePayload, type ChannelJoinPayload, type ChannelLeavePayload, } from './protocol/index.js';
31
31
  export { encodeFrame, encodeFrameLegacy, FrameParser, MAX_FRAME_BYTES, } from './protocol/index.js';
32
+ export { discoverSocket, getDefaultSocketPath, type DiscoveryResult, } from './discovery.js';
32
33
  //# sourceMappingURL=index.d.ts.map
@@ -33,4 +33,6 @@ export { createRelay, createPair, } from './standalone.js';
33
33
  export { PROTOCOL_VERSION, } from './protocol/index.js';
34
34
  // Framing utilities
35
35
  export { encodeFrame, encodeFrameLegacy, FrameParser, MAX_FRAME_BYTES, } from './protocol/index.js';
36
+ // Socket discovery utilities
37
+ export { discoverSocket, getDefaultSocketPath, } from './discovery.js';
36
38
  //# sourceMappingURL=index.js.map
@@ -52,6 +52,7 @@ export async function createRelay(config = {}) {
52
52
  // Lazy-load daemon to keep SDK lightweight for client-only users
53
53
  let Daemon;
54
54
  try {
55
+ // @ts-ignore - daemon is an optional peer dependency, may not be installed
55
56
  const daemonModule = await import('@agent-relay/daemon');
56
57
  Daemon = daemonModule.Daemon;
57
58
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "Lightweight SDK for agent-to-agent communication via Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "access": "public"
56
56
  },
57
57
  "dependencies": {
58
- "@agent-relay/protocol": "2.0.0"
58
+ "@agent-relay/protocol": "2.0.4"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=18.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/spawner",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "Agent spawning types and utilities for Agent Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "repository": {
42
42
  "type": "git",
43
- "url": "https://github.com/AgentWorkforce/relay.git",
43
+ "url": "git+https://github.com/AgentWorkforce/relay.git",
44
44
  "directory": "packages/spawner"
45
45
  },
46
46
  "license": "MIT"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/state",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "Agent state persistence for non-hook CLIs (Codex, Gemini, etc.)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,5 +28,10 @@
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/AgentWorkforce/relay.git",
35
+ "directory": "packages/state"
31
36
  }
32
37
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/storage",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "Storage adapters and interfaces for Relay message/session persistence",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  }
57
57
  },
58
58
  "dependencies": {
59
- "@agent-relay/protocol": "2.0.0"
59
+ "@agent-relay/protocol": "2.0.4"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/node": "^22.19.3",
@@ -65,5 +65,10 @@
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public"
68
+ },
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://github.com/AgentWorkforce/relay.git",
72
+ "directory": "packages/storage"
68
73
  }
69
74
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/trajectory",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "Trajectory integration utilities (trail/PDERO) for Relay",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "test:watch": "vitest"
23
23
  },
24
24
  "dependencies": {
25
- "@agent-relay/config": "2.0.0"
25
+ "@agent-relay/config": "2.0.4"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -31,5 +31,10 @@
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/AgentWorkforce/relay.git",
38
+ "directory": "packages/trajectory"
34
39
  }
35
40
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/user-directory",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "User directory service for agent-relay (per-user credential storage)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "test:watch": "vitest"
23
23
  },
24
24
  "dependencies": {
25
- "@agent-relay/resiliency": "2.0.0"
25
+ "@agent-relay/resiliency": "2.0.4"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.3",
@@ -31,5 +31,10 @@
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/AgentWorkforce/relay.git",
38
+ "directory": "packages/user-directory"
34
39
  }
35
40
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-relay/utils",
3
- "version": "2.0.0",
3
+ "version": "2.0.4",
4
4
  "description": "Shared utilities for agent-relay: logging, name generation, command resolution, update checking",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -71,5 +71,10 @@
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"
74
+ },
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "git+https://github.com/AgentWorkforce/relay.git",
78
+ "directory": "packages/utils"
74
79
  }
75
80
  }
@@ -19,7 +19,7 @@ import { RelayClient } from './client.js';
19
19
  import type { ParsedCommand, ParsedSummary } from './parser.js';
20
20
  import type { SendPayload, SendMeta, SpeakOnTrigger, Envelope } from '@agent-relay/protocol/types';
21
21
  import type { ChannelMessagePayload } from '@agent-relay/protocol/channels';
22
- import { type QueuedMessage, type InjectionMetrics, type CliType } from './shared.js';
22
+ import { type QueuedMessage, type InjectionMetrics, type CliType, type MessagePriority } from './shared.js';
23
23
  import { type ContinuityManager } from '@agent-relay/continuity';
24
24
  import { UniversalIdleDetector } from './idle-detector.js';
25
25
  import { StuckDetector, type StuckReason } from './stuck-detector.js';
@@ -161,6 +161,30 @@ export declare abstract class BaseWrapper extends EventEmitter {
161
161
  isIdle: boolean;
162
162
  confidence: number;
163
163
  }>;
164
+ /**
165
+ * Sort the message queue by priority (urgent first).
166
+ * Call this before processing messages to ensure proper ordering.
167
+ */
168
+ protected sortQueueByPriority(): void;
169
+ /**
170
+ * Get the next message from the queue (highest priority first).
171
+ * Does not remove the message - call dequeueMessage() to remove.
172
+ */
173
+ protected peekNextMessage(): QueuedMessage | undefined;
174
+ /**
175
+ * Remove and return the next message from the queue.
176
+ * Messages are sorted by priority before dequeue.
177
+ */
178
+ protected dequeueMessage(): QueuedMessage | undefined;
179
+ /**
180
+ * Get the priority of the next message in queue.
181
+ * Returns MESSAGE_PRIORITY.NORMAL if queue is empty.
182
+ */
183
+ protected getNextMessagePriority(): MessagePriority;
184
+ /**
185
+ * Check if there are urgent messages that should bypass normal idle wait.
186
+ */
187
+ protected hasUrgentMessages(): boolean;
164
188
  /**
165
189
  * Handle incoming message from relay
166
190
  */
@@ -17,7 +17,7 @@
17
17
  import { EventEmitter } from 'node:events';
18
18
  import { RelayClient } from './client.js';
19
19
  import { isPlaceholderTarget } from './parser.js';
20
- import { getDefaultRelayPrefix, detectCliType, createInjectionMetrics, } from './shared.js';
20
+ import { getDefaultRelayPrefix, detectCliType, createInjectionMetrics, sortByPriority, getPriorityFromImportance, MESSAGE_PRIORITY, } from './shared.js';
21
21
  import { DEFAULT_IDLE_BEFORE_INJECT_MS, DEFAULT_IDLE_CONFIDENCE_THRESHOLD, } from '@agent-relay/config/relay-config';
22
22
  import { getContinuityManager, parseContinuityCommand, hasContinuityCommand, } from '@agent-relay/continuity';
23
23
  import { UniversalIdleDetector } from './idle-detector.js';
@@ -168,7 +168,7 @@ export class BaseWrapper extends EventEmitter {
168
168
  */
169
169
  checkIdleForInjection() {
170
170
  return this.idleDetector.checkIdle({
171
- minSilenceMs: this.config.idleBeforeInjectMs ?? 1500,
171
+ minSilenceMs: this.config.idleBeforeInjectMs ?? DEFAULT_IDLE_BEFORE_INJECT_MS,
172
172
  });
173
173
  }
174
174
  /**
@@ -179,6 +179,48 @@ export class BaseWrapper extends EventEmitter {
179
179
  return this.idleDetector.waitForIdle(timeoutMs, pollMs);
180
180
  }
181
181
  // =========================================================================
182
+ // Priority queue management
183
+ // =========================================================================
184
+ /**
185
+ * Sort the message queue by priority (urgent first).
186
+ * Call this before processing messages to ensure proper ordering.
187
+ */
188
+ sortQueueByPriority() {
189
+ if (this.messageQueue.length > 1) {
190
+ this.messageQueue = sortByPriority(this.messageQueue);
191
+ }
192
+ }
193
+ /**
194
+ * Get the next message from the queue (highest priority first).
195
+ * Does not remove the message - call dequeueMessage() to remove.
196
+ */
197
+ peekNextMessage() {
198
+ this.sortQueueByPriority();
199
+ return this.messageQueue[0];
200
+ }
201
+ /**
202
+ * Remove and return the next message from the queue.
203
+ * Messages are sorted by priority before dequeue.
204
+ */
205
+ dequeueMessage() {
206
+ this.sortQueueByPriority();
207
+ return this.messageQueue.shift();
208
+ }
209
+ /**
210
+ * Get the priority of the next message in queue.
211
+ * Returns MESSAGE_PRIORITY.NORMAL if queue is empty.
212
+ */
213
+ getNextMessagePriority() {
214
+ const next = this.messageQueue[0];
215
+ return next ? getPriorityFromImportance(next.importance) : MESSAGE_PRIORITY.NORMAL;
216
+ }
217
+ /**
218
+ * Check if there are urgent messages that should bypass normal idle wait.
219
+ */
220
+ hasUrgentMessages() {
221
+ return this.messageQueue.some(msg => getPriorityFromImportance(msg.importance) === MESSAGE_PRIORITY.URGENT);
222
+ }
223
+ // =========================================================================
182
224
  // Message handling
183
225
  // =========================================================================
184
226
  /**
@@ -98,6 +98,8 @@ export declare class RelayPtyOrchestrator extends BaseWrapper {
98
98
  private hasReceivedOutput;
99
99
  private queueMonitorTimer?;
100
100
  private readonly QUEUE_MONITOR_INTERVAL_MS;
101
+ private injectionStartTime;
102
+ private readonly MAX_INJECTION_STUCK_MS;
101
103
  private protocolWatcher?;
102
104
  private protocolReminderCooldown;
103
105
  private readonly PROTOCOL_REMINDER_COOLDOWN_MS;
@@ -74,6 +74,8 @@ export class RelayPtyOrchestrator extends BaseWrapper {
74
74
  // Queue monitor for stuck message detection
75
75
  queueMonitorTimer;
76
76
  QUEUE_MONITOR_INTERVAL_MS = 30000; // Check every 30 seconds
77
+ injectionStartTime = 0; // Track when isInjecting was set to true
78
+ MAX_INJECTION_STUCK_MS = 60000; // Force reset after 60 seconds
77
79
  // Protocol monitor for detecting agent mistakes (e.g., empty AGENT_RELAY_NAME)
78
80
  protocolWatcher;
79
81
  protocolReminderCooldown = 0; // Prevent spam
@@ -130,8 +132,15 @@ export class RelayPtyOrchestrator extends BaseWrapper {
130
132
  else {
131
133
  // Local mode: use ~/.agent-relay paths directly (no symlinks needed)
132
134
  this._outboxPath = this._canonicalOutboxPath;
133
- // Socket at ~/.agent-relay/{projectId}/sockets/{agentName}.sock
134
- this.socketPath = join(projectPaths.dataDir, 'sockets', `${config.name}.sock`);
135
+ // Socket at {projectRoot}/.agent-relay/sockets/{agentName}.sock
136
+ let localSocketPath = join(projectPaths.dataDir, 'sockets', `${config.name}.sock`);
137
+ // If socket path is too long, fall back to /tmp/relay-local/{projectId}/sockets/
138
+ if (localSocketPath.length > MAX_SOCKET_PATH_LENGTH) {
139
+ const tmpSocketPath = `/tmp/relay-local/${projectPaths.projectId}/sockets/${config.name}.sock`;
140
+ console.warn(`[relay-pty-orchestrator:${config.name}] Socket path too long (${localSocketPath.length} chars); using /tmp fallback`);
141
+ localSocketPath = tmpSocketPath;
142
+ }
143
+ this.socketPath = localSocketPath;
135
144
  // No legacy path needed for local mode
136
145
  this._legacyOutboxPath = this._outboxPath;
137
146
  }
@@ -226,7 +235,7 @@ export class RelayPtyOrchestrator extends BaseWrapper {
226
235
  if (existsSync(linkPath)) {
227
236
  try {
228
237
  const stats = lstatSync(linkPath);
229
- if (stats.isSymbolicLink()) {
238
+ if (stats.isSymbolicLink() || stats.isFile()) {
230
239
  unlinkSync(linkPath);
231
240
  }
232
241
  else if (stats.isDirectory()) {
@@ -946,6 +955,23 @@ export class RelayPtyOrchestrator extends BaseWrapper {
946
955
  this.log(` Message ${pending.shortId} delivered (interactive mode) ✓`);
947
956
  return;
948
957
  }
958
+ // Skip verification if queue is backing up - trust Rust's delivery status
959
+ // relay-pty writes directly to PTY which is more reliable than tmux
960
+ const queueBackingUp = this.messageQueue.length >= 2;
961
+ if (queueBackingUp) {
962
+ this.log(` Queue backing up (${this.messageQueue.length} pending), skipping verification for ${pending.shortId}`);
963
+ clearTimeout(pending.timeout);
964
+ this.pendingInjections.delete(response.id);
965
+ if (pending.retryCount === 0) {
966
+ this.injectionMetrics.successFirstTry++;
967
+ }
968
+ else {
969
+ this.injectionMetrics.successWithRetry++;
970
+ }
971
+ this.injectionMetrics.total++;
972
+ pending.resolve(true);
973
+ return;
974
+ }
949
975
  // Give a brief moment for output to be captured
950
976
  await sleep(100);
951
977
  // Verify the message pattern appears in captured output
@@ -1146,6 +1172,7 @@ export class RelayPtyOrchestrator extends BaseWrapper {
1146
1172
  return;
1147
1173
  }
1148
1174
  this.isInjecting = true;
1175
+ this.injectionStartTime = Date.now();
1149
1176
  const msg = this.messageQueue.shift();
1150
1177
  const retryCount = msg._retryCount ?? 0;
1151
1178
  const bodyPreview = msg.body.substring(0, 50).replace(/\n/g, '\\n');
@@ -1189,6 +1216,7 @@ export class RelayPtyOrchestrator extends BaseWrapper {
1189
1216
  }
1190
1217
  finally {
1191
1218
  this.isInjecting = false;
1219
+ this.injectionStartTime = 0;
1192
1220
  // Process next message after adaptive delay (faster when healthy, slower under stress)
1193
1221
  if (this.messageQueue.length > 0 && !this.backpressureActive) {
1194
1222
  const delay = this.throttle.getDelay();
@@ -1354,19 +1382,20 @@ EOF
1354
1382
  Then output: \`->relay-file:msg\``,
1355
1383
  file_in_root: `⚠️ **Protocol Issue Detected**
1356
1384
 
1357
- Found file "${filename}" directly in the outbox directory instead of in your agent's subdirectory.
1385
+ Found file "${filename}" directly in the outbox root instead of using the proper path.
1358
1386
  Your agent name is: **${this.config.name}**
1359
1387
 
1360
- Correct outbox path: \`$AGENT_RELAY_OUTBOX\`
1388
+ The \`$AGENT_RELAY_OUTBOX\` path already points to your agent's directory.
1389
+ Write files directly inside it:
1361
1390
 
1362
- Files should be created in your agent's directory:
1363
1391
  \`\`\`bash
1364
- cat > $AGENT_RELAY_OUTBOX/${filename} << 'EOF'
1392
+ cat > $AGENT_RELAY_OUTBOX/msg << 'EOF'
1365
1393
  TO: TargetAgent
1366
1394
 
1367
1395
  Your message here
1368
1396
  EOF
1369
- \`\`\``,
1397
+ \`\`\`
1398
+ Then output: \`->relay-file:msg\``,
1370
1399
  };
1371
1400
  const reminder = reminders[issue];
1372
1401
  if (reminder) {
@@ -1482,9 +1511,25 @@ Then output: \`->relay-file:spawn\`
1482
1511
  if (this.messageQueue.length === 0) {
1483
1512
  return;
1484
1513
  }
1485
- // Skip if currently injecting (processing is in progress)
1514
+ // Check if currently injecting
1486
1515
  if (this.isInjecting) {
1487
- return;
1516
+ // Check if injection has been stuck for too long
1517
+ const stuckDuration = Date.now() - this.injectionStartTime;
1518
+ if (stuckDuration > this.MAX_INJECTION_STUCK_MS) {
1519
+ this.logError(` ⚠️ Injection stuck for ${Math.round(stuckDuration / 1000)}s - force resetting`);
1520
+ this.isInjecting = false;
1521
+ this.injectionStartTime = 0;
1522
+ // Clear any pending injections that might be stuck
1523
+ for (const [id, pending] of this.pendingInjections) {
1524
+ clearTimeout(pending.timeout);
1525
+ this.logError(` Clearing stuck pending injection: ${id.substring(0, 8)}`);
1526
+ }
1527
+ this.pendingInjections.clear();
1528
+ // Continue to process the queue below
1529
+ }
1530
+ else {
1531
+ return; // Still within normal injection time
1532
+ }
1488
1533
  }
1489
1534
  // Skip if backpressure is active
1490
1535
  if (this.backpressureActive) {
@@ -5,6 +5,31 @@
5
5
  * wrapper implementations and reduce duplication.
6
6
  */
7
7
  import type { SyncMeta } from '@agent-relay/protocol/types';
8
+ /**
9
+ * Message priority levels for queue ordering.
10
+ * Lower numbers = higher priority (processed first).
11
+ */
12
+ export declare const MESSAGE_PRIORITY: {
13
+ /** System-critical messages (sync ACKs, errors) - skip idle wait */
14
+ readonly URGENT: 0;
15
+ /** Time-sensitive messages (user requests) - reduced idle wait */
16
+ readonly HIGH: 1;
17
+ /** Normal agent-to-agent messages */
18
+ readonly NORMAL: 2;
19
+ /** Batch/background messages - can wait longer */
20
+ readonly LOW: 3;
21
+ };
22
+ export type MessagePriority = typeof MESSAGE_PRIORITY[keyof typeof MESSAGE_PRIORITY];
23
+ /**
24
+ * Get priority from importance value or default to NORMAL.
25
+ * Maps importance number to priority level.
26
+ */
27
+ export declare function getPriorityFromImportance(importance?: number): MessagePriority;
28
+ /**
29
+ * Sort messages by priority (lower number = higher priority).
30
+ * Stable sort - maintains order within same priority.
31
+ */
32
+ export declare function sortByPriority(messages: QueuedMessage[]): QueuedMessage[];
8
33
  /**
9
34
  * Message queued for injection into an agent's terminal
10
35
  */
@@ -4,6 +4,46 @@
4
4
  * This module contains common code to prevent drift between the two
5
5
  * wrapper implementations and reduce duplication.
6
6
  */
7
+ /**
8
+ * Message priority levels for queue ordering.
9
+ * Lower numbers = higher priority (processed first).
10
+ */
11
+ export const MESSAGE_PRIORITY = {
12
+ /** System-critical messages (sync ACKs, errors) - skip idle wait */
13
+ URGENT: 0,
14
+ /** Time-sensitive messages (user requests) - reduced idle wait */
15
+ HIGH: 1,
16
+ /** Normal agent-to-agent messages */
17
+ NORMAL: 2,
18
+ /** Batch/background messages - can wait longer */
19
+ LOW: 3,
20
+ };
21
+ /**
22
+ * Get priority from importance value or default to NORMAL.
23
+ * Maps importance number to priority level.
24
+ */
25
+ export function getPriorityFromImportance(importance) {
26
+ if (importance === undefined)
27
+ return MESSAGE_PRIORITY.NORMAL;
28
+ if (importance >= 90)
29
+ return MESSAGE_PRIORITY.URGENT;
30
+ if (importance >= 70)
31
+ return MESSAGE_PRIORITY.HIGH;
32
+ if (importance >= 30)
33
+ return MESSAGE_PRIORITY.NORMAL;
34
+ return MESSAGE_PRIORITY.LOW;
35
+ }
36
+ /**
37
+ * Sort messages by priority (lower number = higher priority).
38
+ * Stable sort - maintains order within same priority.
39
+ */
40
+ export function sortByPriority(messages) {
41
+ return [...messages].sort((a, b) => {
42
+ const priorityA = getPriorityFromImportance(a.importance);
43
+ const priorityB = getPriorityFromImportance(b.importance);
44
+ return priorityA - priorityB;
45
+ });
46
+ }
7
47
  /**
8
48
  * Injection timing constants
9
49
  *
@@ -271,6 +271,7 @@ export declare class TmuxWrapper extends BaseWrapper {
271
271
  /**
272
272
  * Check if we should inject a message.
273
273
  * Uses UniversalIdleDetector (from BaseWrapper) for robust cross-CLI idle detection.
274
+ * Processes messages by priority (urgent first).
274
275
  */
275
276
  private checkForInjectionOpportunity;
276
277
  /**
@@ -335,6 +336,12 @@ export declare class TmuxWrapper extends BaseWrapper {
335
336
  private capturePaneSignature;
336
337
  /**
337
338
  * Wait for pane output to stabilize before injecting to avoid interleaving with ongoing output.
339
+ * Uses adaptive timeout based on idle detector confidence for faster injection when safe.
340
+ *
341
+ * @param maxWaitMs - Maximum time to wait (default from config)
342
+ * @param pollIntervalMs - Polling interval (default from config)
343
+ * @param requiredStablePolls - Consecutive stable polls needed (default 2)
344
+ * @param priority - Message priority (lower = more urgent, can use shorter timeout)
338
345
  */
339
346
  private waitForStablePane;
340
347
  /**