@agentuity/cli 2.0.0-beta.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/bin/cli.ts +5 -0
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +12 -1
  5. package/dist/auth.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +29 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/cmd/auth/ssh/delete.js +1 -1
  10. package/dist/cmd/auth/ssh/delete.js.map +1 -1
  11. package/dist/cmd/build/app-config-extractor.d.ts +27 -0
  12. package/dist/cmd/build/app-config-extractor.d.ts.map +1 -0
  13. package/dist/cmd/build/app-config-extractor.js +152 -0
  14. package/dist/cmd/build/app-config-extractor.js.map +1 -0
  15. package/dist/cmd/build/ci.d.ts +18 -0
  16. package/dist/cmd/build/ci.d.ts.map +1 -0
  17. package/dist/cmd/build/ci.js +181 -0
  18. package/dist/cmd/build/ci.js.map +1 -0
  19. package/dist/cmd/build/index.d.ts.map +1 -1
  20. package/dist/cmd/build/index.js +53 -14
  21. package/dist/cmd/build/index.js.map +1 -1
  22. package/dist/cmd/build/vite/bun-dev-server.d.ts +35 -0
  23. package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
  24. package/dist/cmd/build/vite/bun-dev-server.js +232 -4
  25. package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
  26. package/dist/cmd/build/vite/config-loader.d.ts +15 -20
  27. package/dist/cmd/build/vite/config-loader.d.ts.map +1 -1
  28. package/dist/cmd/build/vite/config-loader.js +41 -74
  29. package/dist/cmd/build/vite/config-loader.js.map +1 -1
  30. package/dist/cmd/build/vite/static-renderer.d.ts +0 -2
  31. package/dist/cmd/build/vite/static-renderer.d.ts.map +1 -1
  32. package/dist/cmd/build/vite/static-renderer.js +28 -14
  33. package/dist/cmd/build/vite/static-renderer.js.map +1 -1
  34. package/dist/cmd/build/vite/tailwind-source-plugin.d.ts +15 -0
  35. package/dist/cmd/build/vite/tailwind-source-plugin.d.ts.map +1 -0
  36. package/dist/cmd/build/vite/tailwind-source-plugin.js +61 -0
  37. package/dist/cmd/build/vite/tailwind-source-plugin.js.map +1 -0
  38. package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
  39. package/dist/cmd/build/vite/vite-asset-server-config.js +4 -48
  40. package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
  41. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
  42. package/dist/cmd/build/vite/vite-builder.js +38 -156
  43. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  44. package/dist/cmd/cloud/agent/get.d.ts.map +1 -1
  45. package/dist/cmd/cloud/agent/get.js +1 -0
  46. package/dist/cmd/cloud/agent/get.js.map +1 -1
  47. package/dist/cmd/cloud/apikey/delete.js +1 -1
  48. package/dist/cmd/cloud/apikey/delete.js.map +1 -1
  49. package/dist/cmd/cloud/apikey/get.d.ts.map +1 -1
  50. package/dist/cmd/cloud/apikey/get.js +1 -0
  51. package/dist/cmd/cloud/apikey/get.js.map +1 -1
  52. package/dist/cmd/cloud/apikey/index.d.ts.map +1 -1
  53. package/dist/cmd/cloud/apikey/index.js +1 -0
  54. package/dist/cmd/cloud/apikey/index.js.map +1 -1
  55. package/dist/cmd/cloud/db/delete.js +1 -1
  56. package/dist/cmd/cloud/db/delete.js.map +1 -1
  57. package/dist/cmd/cloud/deploy.js +1 -1
  58. package/dist/cmd/cloud/deploy.js.map +1 -1
  59. package/dist/cmd/cloud/deployment/remove.js +17 -17
  60. package/dist/cmd/cloud/deployment/remove.js.map +1 -1
  61. package/dist/cmd/cloud/deployment/show.js +1 -1
  62. package/dist/cmd/cloud/deployment/show.js.map +1 -1
  63. package/dist/cmd/cloud/email/create.js +1 -1
  64. package/dist/cmd/cloud/email/create.js.map +1 -1
  65. package/dist/cmd/cloud/email/delete.js +1 -1
  66. package/dist/cmd/cloud/email/delete.js.map +1 -1
  67. package/dist/cmd/cloud/email/destination/delete.js +1 -1
  68. package/dist/cmd/cloud/email/destination/delete.js.map +1 -1
  69. package/dist/cmd/cloud/email/get.d.ts.map +1 -1
  70. package/dist/cmd/cloud/email/get.js +1 -0
  71. package/dist/cmd/cloud/email/get.js.map +1 -1
  72. package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -1
  73. package/dist/cmd/cloud/email/inbound/get.js +1 -0
  74. package/dist/cmd/cloud/email/inbound/get.js.map +1 -1
  75. package/dist/cmd/cloud/email/outbound/get.d.ts.map +1 -1
  76. package/dist/cmd/cloud/email/outbound/get.js +1 -0
  77. package/dist/cmd/cloud/email/outbound/get.js.map +1 -1
  78. package/dist/cmd/cloud/env/delete.js +1 -1
  79. package/dist/cmd/cloud/env/delete.js.map +1 -1
  80. package/dist/cmd/cloud/env/get.d.ts.map +1 -1
  81. package/dist/cmd/cloud/env/get.js +1 -0
  82. package/dist/cmd/cloud/env/get.js.map +1 -1
  83. package/dist/cmd/cloud/eval/get.d.ts.map +1 -1
  84. package/dist/cmd/cloud/eval/get.js +1 -0
  85. package/dist/cmd/cloud/eval/get.js.map +1 -1
  86. package/dist/cmd/cloud/eval/index.d.ts.map +1 -1
  87. package/dist/cmd/cloud/eval/index.js +1 -0
  88. package/dist/cmd/cloud/eval/index.js.map +1 -1
  89. package/dist/cmd/cloud/eval/list.js +1 -1
  90. package/dist/cmd/cloud/eval/list.js.map +1 -1
  91. package/dist/cmd/cloud/eval-run/get.d.ts.map +1 -1
  92. package/dist/cmd/cloud/eval-run/get.js +1 -0
  93. package/dist/cmd/cloud/eval-run/get.js.map +1 -1
  94. package/dist/cmd/cloud/eval-run/index.d.ts.map +1 -1
  95. package/dist/cmd/cloud/eval-run/index.js +1 -0
  96. package/dist/cmd/cloud/eval-run/index.js.map +1 -1
  97. package/dist/cmd/cloud/eval-run/list.js +1 -1
  98. package/dist/cmd/cloud/eval-run/list.js.map +1 -1
  99. package/dist/cmd/cloud/keyvalue/delete-namespace.js +1 -1
  100. package/dist/cmd/cloud/keyvalue/delete-namespace.js.map +1 -1
  101. package/dist/cmd/cloud/keyvalue/delete.js +1 -1
  102. package/dist/cmd/cloud/keyvalue/delete.js.map +1 -1
  103. package/dist/cmd/cloud/keyvalue/get.d.ts.map +1 -1
  104. package/dist/cmd/cloud/keyvalue/get.js +1 -0
  105. package/dist/cmd/cloud/keyvalue/get.js.map +1 -1
  106. package/dist/cmd/cloud/keyvalue/index.js +1 -1
  107. package/dist/cmd/cloud/keyvalue/index.js.map +1 -1
  108. package/dist/cmd/cloud/machine/delete.js +1 -1
  109. package/dist/cmd/cloud/machine/delete.js.map +1 -1
  110. package/dist/cmd/cloud/oidc/delete.js +1 -1
  111. package/dist/cmd/cloud/oidc/delete.js.map +1 -1
  112. package/dist/cmd/cloud/oidc/get.d.ts.map +1 -1
  113. package/dist/cmd/cloud/oidc/get.js +1 -0
  114. package/dist/cmd/cloud/oidc/get.js.map +1 -1
  115. package/dist/cmd/cloud/queue/create.d.ts.map +1 -1
  116. package/dist/cmd/cloud/queue/create.js +1 -0
  117. package/dist/cmd/cloud/queue/create.js.map +1 -1
  118. package/dist/cmd/cloud/queue/delete.js +1 -1
  119. package/dist/cmd/cloud/queue/delete.js.map +1 -1
  120. package/dist/cmd/cloud/queue/get.d.ts.map +1 -1
  121. package/dist/cmd/cloud/queue/get.js +1 -0
  122. package/dist/cmd/cloud/queue/get.js.map +1 -1
  123. package/dist/cmd/cloud/redis/get.js +1 -1
  124. package/dist/cmd/cloud/redis/get.js.map +1 -1
  125. package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts.map +1 -1
  126. package/dist/cmd/cloud/sandbox/checkpoint/create.js +1 -0
  127. package/dist/cmd/cloud/sandbox/checkpoint/create.js.map +1 -1
  128. package/dist/cmd/cloud/sandbox/checkpoint/delete.js +1 -1
  129. package/dist/cmd/cloud/sandbox/checkpoint/delete.js.map +1 -1
  130. package/dist/cmd/cloud/sandbox/checkpoint/index.js +1 -1
  131. package/dist/cmd/cloud/sandbox/checkpoint/index.js.map +1 -1
  132. package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
  133. package/dist/cmd/cloud/sandbox/create.js +9 -0
  134. package/dist/cmd/cloud/sandbox/create.js.map +1 -1
  135. package/dist/cmd/cloud/sandbox/delete.js +1 -1
  136. package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
  137. package/dist/cmd/cloud/sandbox/execution/index.js +1 -1
  138. package/dist/cmd/cloud/sandbox/execution/index.js.map +1 -1
  139. package/dist/cmd/cloud/sandbox/execution/list.js +2 -2
  140. package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
  141. package/dist/cmd/cloud/sandbox/fs/cp.d.ts +3 -0
  142. package/dist/cmd/cloud/sandbox/fs/cp.d.ts.map +1 -0
  143. package/dist/cmd/cloud/sandbox/{cp.js → fs/cp.js} +13 -13
  144. package/dist/cmd/cloud/sandbox/fs/cp.js.map +1 -0
  145. package/dist/cmd/cloud/sandbox/fs/download.d.ts +3 -0
  146. package/dist/cmd/cloud/sandbox/fs/download.d.ts.map +1 -0
  147. package/dist/cmd/cloud/sandbox/{download.js → fs/download.js} +7 -7
  148. package/dist/cmd/cloud/sandbox/fs/download.js.map +1 -0
  149. package/dist/cmd/cloud/sandbox/fs/index.d.ts +2 -0
  150. package/dist/cmd/cloud/sandbox/fs/index.d.ts.map +1 -0
  151. package/dist/cmd/cloud/sandbox/fs/index.js +36 -0
  152. package/dist/cmd/cloud/sandbox/fs/index.js.map +1 -0
  153. package/dist/cmd/cloud/sandbox/fs/ls.d.ts +3 -0
  154. package/dist/cmd/cloud/sandbox/fs/ls.d.ts.map +1 -0
  155. package/dist/cmd/cloud/sandbox/{ls.js → fs/ls.js} +10 -10
  156. package/dist/cmd/cloud/sandbox/fs/ls.js.map +1 -0
  157. package/dist/cmd/cloud/sandbox/fs/mkdir.d.ts +3 -0
  158. package/dist/cmd/cloud/sandbox/fs/mkdir.d.ts.map +1 -0
  159. package/dist/cmd/cloud/sandbox/{mkdir.js → fs/mkdir.js} +6 -6
  160. package/dist/cmd/cloud/sandbox/fs/mkdir.js.map +1 -0
  161. package/dist/cmd/cloud/sandbox/fs/rm.d.ts +3 -0
  162. package/dist/cmd/cloud/sandbox/fs/rm.d.ts.map +1 -0
  163. package/dist/cmd/cloud/sandbox/{rm.js → fs/rm.js} +6 -5
  164. package/dist/cmd/cloud/sandbox/fs/rm.js.map +1 -0
  165. package/dist/cmd/cloud/sandbox/fs/rmdir.d.ts +3 -0
  166. package/dist/cmd/cloud/sandbox/fs/rmdir.d.ts.map +1 -0
  167. package/dist/cmd/cloud/sandbox/{rmdir.js → fs/rmdir.js} +6 -6
  168. package/dist/cmd/cloud/sandbox/fs/rmdir.js.map +1 -0
  169. package/dist/cmd/cloud/sandbox/fs/upload.d.ts +3 -0
  170. package/dist/cmd/cloud/sandbox/fs/upload.d.ts.map +1 -0
  171. package/dist/cmd/cloud/sandbox/{upload.js → fs/upload.js} +7 -7
  172. package/dist/cmd/cloud/sandbox/fs/upload.js.map +1 -0
  173. package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
  174. package/dist/cmd/cloud/sandbox/index.js +4 -14
  175. package/dist/cmd/cloud/sandbox/index.js.map +1 -1
  176. package/dist/cmd/cloud/sandbox/job/create.d.ts +3 -0
  177. package/dist/cmd/cloud/sandbox/job/create.d.ts.map +1 -0
  178. package/dist/cmd/cloud/sandbox/job/create.js +52 -0
  179. package/dist/cmd/cloud/sandbox/job/create.js.map +1 -0
  180. package/dist/cmd/cloud/sandbox/job/destroy.d.ts +3 -0
  181. package/dist/cmd/cloud/sandbox/job/destroy.d.ts.map +1 -0
  182. package/dist/cmd/cloud/sandbox/job/destroy.js +59 -0
  183. package/dist/cmd/cloud/sandbox/job/destroy.js.map +1 -0
  184. package/dist/cmd/cloud/sandbox/job/get.d.ts +3 -0
  185. package/dist/cmd/cloud/sandbox/job/get.d.ts.map +1 -0
  186. package/dist/cmd/cloud/sandbox/job/get.js +66 -0
  187. package/dist/cmd/cloud/sandbox/job/get.js.map +1 -0
  188. package/dist/cmd/cloud/sandbox/job/index.d.ts +3 -0
  189. package/dist/cmd/cloud/sandbox/job/index.d.ts.map +1 -0
  190. package/dist/cmd/cloud/sandbox/job/index.js +30 -0
  191. package/dist/cmd/cloud/sandbox/job/index.js.map +1 -0
  192. package/dist/cmd/cloud/sandbox/job/list.d.ts +3 -0
  193. package/dist/cmd/cloud/sandbox/job/list.d.ts.map +1 -0
  194. package/dist/cmd/cloud/sandbox/job/list.js +67 -0
  195. package/dist/cmd/cloud/sandbox/job/list.js.map +1 -0
  196. package/dist/cmd/cloud/sandbox/runtime/index.js +1 -1
  197. package/dist/cmd/cloud/sandbox/runtime/index.js.map +1 -1
  198. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  199. package/dist/cmd/cloud/sandbox/snapshot/create.js +1 -0
  200. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  201. package/dist/cmd/cloud/sandbox/snapshot/delete.js +1 -1
  202. package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
  203. package/dist/cmd/cloud/sandbox/snapshot/index.js +1 -1
  204. package/dist/cmd/cloud/sandbox/snapshot/index.js.map +1 -1
  205. package/dist/cmd/cloud/schedule/create.d.ts.map +1 -1
  206. package/dist/cmd/cloud/schedule/create.js +1 -0
  207. package/dist/cmd/cloud/schedule/create.js.map +1 -1
  208. package/dist/cmd/cloud/schedule/delete.js +1 -1
  209. package/dist/cmd/cloud/schedule/delete.js.map +1 -1
  210. package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -1
  211. package/dist/cmd/cloud/schedule/delivery/get.js +1 -0
  212. package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -1
  213. package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -1
  214. package/dist/cmd/cloud/schedule/destination/create.js +1 -0
  215. package/dist/cmd/cloud/schedule/destination/create.js.map +1 -1
  216. package/dist/cmd/cloud/schedule/destination/delete.js +1 -1
  217. package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -1
  218. package/dist/cmd/cloud/schedule/destination/get.d.ts.map +1 -1
  219. package/dist/cmd/cloud/schedule/destination/get.js +1 -0
  220. package/dist/cmd/cloud/schedule/destination/get.js.map +1 -1
  221. package/dist/cmd/cloud/schedule/get.d.ts.map +1 -1
  222. package/dist/cmd/cloud/schedule/get.js +1 -0
  223. package/dist/cmd/cloud/schedule/get.js.map +1 -1
  224. package/dist/cmd/cloud/session/get.d.ts.map +1 -1
  225. package/dist/cmd/cloud/session/get.js +1 -0
  226. package/dist/cmd/cloud/session/get.js.map +1 -1
  227. package/dist/cmd/cloud/session/index.d.ts.map +1 -1
  228. package/dist/cmd/cloud/session/index.js +1 -0
  229. package/dist/cmd/cloud/session/index.js.map +1 -1
  230. package/dist/cmd/cloud/session/list.js +1 -1
  231. package/dist/cmd/cloud/session/list.js.map +1 -1
  232. package/dist/cmd/cloud/storage/delete.js +1 -1
  233. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  234. package/dist/cmd/cloud/stream/delete.js +1 -1
  235. package/dist/cmd/cloud/stream/delete.js.map +1 -1
  236. package/dist/cmd/cloud/stream/get.d.ts.map +1 -1
  237. package/dist/cmd/cloud/stream/get.js +1 -0
  238. package/dist/cmd/cloud/stream/get.js.map +1 -1
  239. package/dist/cmd/cloud/task/delete.js +1 -1
  240. package/dist/cmd/cloud/task/delete.js.map +1 -1
  241. package/dist/cmd/cloud/task/index.d.ts.map +1 -1
  242. package/dist/cmd/cloud/task/index.js +1 -0
  243. package/dist/cmd/cloud/task/index.js.map +1 -1
  244. package/dist/cmd/cloud/thread/delete.js +1 -1
  245. package/dist/cmd/cloud/thread/delete.js.map +1 -1
  246. package/dist/cmd/cloud/thread/get.d.ts.map +1 -1
  247. package/dist/cmd/cloud/thread/get.js +1 -0
  248. package/dist/cmd/cloud/thread/get.js.map +1 -1
  249. package/dist/cmd/cloud/thread/index.d.ts.map +1 -1
  250. package/dist/cmd/cloud/thread/index.js +1 -0
  251. package/dist/cmd/cloud/thread/index.js.map +1 -1
  252. package/dist/cmd/cloud/thread/list.js +1 -1
  253. package/dist/cmd/cloud/thread/list.js.map +1 -1
  254. package/dist/cmd/cloud/vector/delete-namespace.js +1 -1
  255. package/dist/cmd/cloud/vector/delete-namespace.js.map +1 -1
  256. package/dist/cmd/cloud/vector/delete.js +1 -1
  257. package/dist/cmd/cloud/vector/delete.js.map +1 -1
  258. package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
  259. package/dist/cmd/cloud/vector/get.js +1 -0
  260. package/dist/cmd/cloud/vector/get.js.map +1 -1
  261. package/dist/cmd/cloud/vector/index.js +1 -1
  262. package/dist/cmd/cloud/vector/index.js.map +1 -1
  263. package/dist/cmd/cloud/webhook/create.d.ts.map +1 -1
  264. package/dist/cmd/cloud/webhook/create.js +1 -0
  265. package/dist/cmd/cloud/webhook/create.js.map +1 -1
  266. package/dist/cmd/cloud/webhook/delete.js +1 -1
  267. package/dist/cmd/cloud/webhook/delete.js.map +1 -1
  268. package/dist/cmd/cloud/webhook/get.d.ts.map +1 -1
  269. package/dist/cmd/cloud/webhook/get.js +1 -0
  270. package/dist/cmd/cloud/webhook/get.js.map +1 -1
  271. package/dist/cmd/dev/index.d.ts.map +1 -1
  272. package/dist/cmd/dev/index.js +161 -130
  273. package/dist/cmd/dev/index.js.map +1 -1
  274. package/dist/cmd/dev/process-manager.d.ts +104 -0
  275. package/dist/cmd/dev/process-manager.d.ts.map +1 -0
  276. package/dist/cmd/dev/process-manager.js +204 -0
  277. package/dist/cmd/dev/process-manager.js.map +1 -0
  278. package/dist/cmd/git/account/remove.d.ts.map +1 -1
  279. package/dist/cmd/git/account/remove.js +1 -0
  280. package/dist/cmd/git/account/remove.js.map +1 -1
  281. package/dist/cmd/profile/delete.js +1 -1
  282. package/dist/cmd/profile/delete.js.map +1 -1
  283. package/dist/cmd/project/delete.js +1 -1
  284. package/dist/cmd/project/delete.js.map +1 -1
  285. package/dist/cmd/project/hostname/get.d.ts.map +1 -1
  286. package/dist/cmd/project/hostname/get.js +1 -0
  287. package/dist/cmd/project/hostname/get.js.map +1 -1
  288. package/dist/cmd/upgrade/index.d.ts.map +1 -1
  289. package/dist/cmd/upgrade/index.js +3 -16
  290. package/dist/cmd/upgrade/index.js.map +1 -1
  291. package/dist/schema-generator.js +1 -1
  292. package/dist/schema-generator.js.map +1 -1
  293. package/dist/schema-parser.d.ts.map +1 -1
  294. package/dist/schema-parser.js +8 -0
  295. package/dist/schema-parser.js.map +1 -1
  296. package/dist/utils/version-mismatch.d.ts +39 -0
  297. package/dist/utils/version-mismatch.d.ts.map +1 -0
  298. package/dist/utils/version-mismatch.js +161 -0
  299. package/dist/utils/version-mismatch.js.map +1 -0
  300. package/package.json +8 -6
  301. package/src/auth.ts +12 -2
  302. package/src/cli.ts +33 -1
  303. package/src/cmd/auth/ssh/delete.ts +1 -1
  304. package/src/cmd/build/app-config-extractor.ts +186 -0
  305. package/src/cmd/build/ci.ts +223 -0
  306. package/src/cmd/build/index.ts +65 -14
  307. package/src/cmd/build/vite/bun-dev-server.ts +319 -6
  308. package/src/cmd/build/vite/config-loader.ts +45 -77
  309. package/src/cmd/build/vite/static-renderer.ts +34 -16
  310. package/src/cmd/build/vite/tailwind-source-plugin.ts +73 -0
  311. package/src/cmd/build/vite/vite-asset-server-config.ts +4 -47
  312. package/src/cmd/build/vite/vite-builder.ts +45 -169
  313. package/src/cmd/cloud/agent/get.ts +1 -0
  314. package/src/cmd/cloud/apikey/delete.ts +1 -1
  315. package/src/cmd/cloud/apikey/get.ts +1 -0
  316. package/src/cmd/cloud/apikey/index.ts +1 -0
  317. package/src/cmd/cloud/db/delete.ts +1 -1
  318. package/src/cmd/cloud/deploy.ts +1 -1
  319. package/src/cmd/cloud/deployment/remove.ts +17 -17
  320. package/src/cmd/cloud/deployment/show.ts +1 -1
  321. package/src/cmd/cloud/email/create.ts +1 -1
  322. package/src/cmd/cloud/email/delete.ts +1 -1
  323. package/src/cmd/cloud/email/destination/delete.ts +1 -1
  324. package/src/cmd/cloud/email/get.ts +1 -0
  325. package/src/cmd/cloud/email/inbound/get.ts +1 -0
  326. package/src/cmd/cloud/email/outbound/get.ts +1 -0
  327. package/src/cmd/cloud/env/delete.ts +1 -1
  328. package/src/cmd/cloud/env/get.ts +1 -0
  329. package/src/cmd/cloud/eval/get.ts +1 -0
  330. package/src/cmd/cloud/eval/index.ts +1 -0
  331. package/src/cmd/cloud/eval/list.ts +1 -1
  332. package/src/cmd/cloud/eval-run/get.ts +1 -0
  333. package/src/cmd/cloud/eval-run/index.ts +1 -0
  334. package/src/cmd/cloud/eval-run/list.ts +1 -1
  335. package/src/cmd/cloud/keyvalue/delete-namespace.ts +1 -1
  336. package/src/cmd/cloud/keyvalue/delete.ts +1 -1
  337. package/src/cmd/cloud/keyvalue/get.ts +1 -0
  338. package/src/cmd/cloud/keyvalue/index.ts +1 -1
  339. package/src/cmd/cloud/machine/delete.ts +1 -1
  340. package/src/cmd/cloud/oidc/delete.ts +1 -1
  341. package/src/cmd/cloud/oidc/get.ts +1 -0
  342. package/src/cmd/cloud/queue/create.ts +1 -0
  343. package/src/cmd/cloud/queue/delete.ts +1 -1
  344. package/src/cmd/cloud/queue/get.ts +1 -0
  345. package/src/cmd/cloud/redis/get.ts +1 -1
  346. package/src/cmd/cloud/sandbox/checkpoint/create.ts +1 -0
  347. package/src/cmd/cloud/sandbox/checkpoint/delete.ts +1 -1
  348. package/src/cmd/cloud/sandbox/checkpoint/index.ts +1 -1
  349. package/src/cmd/cloud/sandbox/create.ts +9 -0
  350. package/src/cmd/cloud/sandbox/delete.ts +1 -1
  351. package/src/cmd/cloud/sandbox/execution/index.ts +1 -1
  352. package/src/cmd/cloud/sandbox/execution/list.ts +2 -2
  353. package/src/cmd/cloud/sandbox/{cp.ts → fs/cp.ts} +13 -13
  354. package/src/cmd/cloud/sandbox/{download.ts → fs/download.ts} +7 -7
  355. package/src/cmd/cloud/sandbox/fs/index.ts +36 -0
  356. package/src/cmd/cloud/sandbox/{ls.ts → fs/ls.ts} +10 -10
  357. package/src/cmd/cloud/sandbox/{mkdir.ts → fs/mkdir.ts} +6 -6
  358. package/src/cmd/cloud/sandbox/{rm.ts → fs/rm.ts} +6 -5
  359. package/src/cmd/cloud/sandbox/{rmdir.ts → fs/rmdir.ts} +6 -6
  360. package/src/cmd/cloud/sandbox/{upload.ts → fs/upload.ts} +7 -7
  361. package/src/cmd/cloud/sandbox/index.ts +4 -14
  362. package/src/cmd/cloud/sandbox/job/create.ts +63 -0
  363. package/src/cmd/cloud/sandbox/job/destroy.ts +67 -0
  364. package/src/cmd/cloud/sandbox/job/get.ts +78 -0
  365. package/src/cmd/cloud/sandbox/job/index.ts +31 -0
  366. package/src/cmd/cloud/sandbox/job/list.ts +81 -0
  367. package/src/cmd/cloud/sandbox/runtime/index.ts +1 -1
  368. package/src/cmd/cloud/sandbox/snapshot/create.ts +1 -0
  369. package/src/cmd/cloud/sandbox/snapshot/delete.ts +1 -1
  370. package/src/cmd/cloud/sandbox/snapshot/index.ts +1 -1
  371. package/src/cmd/cloud/schedule/create.ts +1 -0
  372. package/src/cmd/cloud/schedule/delete.ts +1 -1
  373. package/src/cmd/cloud/schedule/delivery/get.ts +1 -0
  374. package/src/cmd/cloud/schedule/destination/create.ts +1 -0
  375. package/src/cmd/cloud/schedule/destination/delete.ts +1 -1
  376. package/src/cmd/cloud/schedule/destination/get.ts +1 -0
  377. package/src/cmd/cloud/schedule/get.ts +1 -0
  378. package/src/cmd/cloud/session/get.ts +1 -0
  379. package/src/cmd/cloud/session/index.ts +1 -0
  380. package/src/cmd/cloud/session/list.ts +1 -1
  381. package/src/cmd/cloud/storage/delete.ts +1 -1
  382. package/src/cmd/cloud/stream/delete.ts +1 -1
  383. package/src/cmd/cloud/stream/get.ts +1 -0
  384. package/src/cmd/cloud/task/delete.ts +1 -1
  385. package/src/cmd/cloud/task/index.ts +1 -0
  386. package/src/cmd/cloud/thread/delete.ts +1 -1
  387. package/src/cmd/cloud/thread/get.ts +1 -0
  388. package/src/cmd/cloud/thread/index.ts +1 -0
  389. package/src/cmd/cloud/thread/list.ts +1 -1
  390. package/src/cmd/cloud/vector/delete-namespace.ts +1 -1
  391. package/src/cmd/cloud/vector/delete.ts +1 -1
  392. package/src/cmd/cloud/vector/get.ts +1 -0
  393. package/src/cmd/cloud/vector/index.ts +1 -1
  394. package/src/cmd/cloud/webhook/create.ts +1 -0
  395. package/src/cmd/cloud/webhook/delete.ts +1 -1
  396. package/src/cmd/cloud/webhook/get.ts +1 -0
  397. package/src/cmd/dev/index.ts +171 -131
  398. package/src/cmd/dev/process-manager.ts +261 -0
  399. package/src/cmd/git/account/remove.ts +1 -0
  400. package/src/cmd/profile/delete.ts +1 -1
  401. package/src/cmd/project/delete.ts +1 -1
  402. package/src/cmd/project/hostname/get.ts +1 -0
  403. package/src/cmd/upgrade/index.ts +3 -18
  404. package/src/schema-generator.ts +1 -1
  405. package/src/schema-parser.ts +11 -0
  406. package/src/utils/version-mismatch.ts +204 -0
  407. package/dist/cmd/cloud/sandbox/cp.d.ts +0 -3
  408. package/dist/cmd/cloud/sandbox/cp.d.ts.map +0 -1
  409. package/dist/cmd/cloud/sandbox/cp.js.map +0 -1
  410. package/dist/cmd/cloud/sandbox/download.d.ts +0 -3
  411. package/dist/cmd/cloud/sandbox/download.d.ts.map +0 -1
  412. package/dist/cmd/cloud/sandbox/download.js.map +0 -1
  413. package/dist/cmd/cloud/sandbox/ls.d.ts +0 -3
  414. package/dist/cmd/cloud/sandbox/ls.d.ts.map +0 -1
  415. package/dist/cmd/cloud/sandbox/ls.js.map +0 -1
  416. package/dist/cmd/cloud/sandbox/mkdir.d.ts +0 -3
  417. package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +0 -1
  418. package/dist/cmd/cloud/sandbox/mkdir.js.map +0 -1
  419. package/dist/cmd/cloud/sandbox/rm.d.ts +0 -3
  420. package/dist/cmd/cloud/sandbox/rm.d.ts.map +0 -1
  421. package/dist/cmd/cloud/sandbox/rm.js.map +0 -1
  422. package/dist/cmd/cloud/sandbox/rmdir.d.ts +0 -3
  423. package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +0 -1
  424. package/dist/cmd/cloud/sandbox/rmdir.js.map +0 -1
  425. package/dist/cmd/cloud/sandbox/upload.d.ts +0 -3
  426. package/dist/cmd/cloud/sandbox/upload.d.ts.map +0 -1
  427. package/dist/cmd/cloud/sandbox/upload.js.map +0 -1
@@ -7,10 +7,15 @@
7
7
  *
8
8
  * The user's app.ts exports the result of createApp() which includes `fetch`
9
9
  * and `port` properties that Bun uses to manage the server lifecycle.
10
+ *
11
+ * Key requirements for bun --hot:
12
+ * - app.ts MUST have `export default` with { fetch, port } properties
13
+ * - Without export default, Bun runs the code but never starts an HTTP server
10
14
  */
11
15
 
12
16
  import type { Logger } from '../../../types';
13
17
  import { getAgentEnv } from '../../../agent-detection';
18
+ import { createServer as createNetServer } from 'node:net';
14
19
 
15
20
  export interface BunDevServerOptions {
16
21
  rootDir: string;
@@ -26,6 +31,264 @@ export interface BunDevServerResult {
26
31
  bunServerPort: number;
27
32
  }
28
33
 
34
+ /**
35
+ * Check if a port is available for binding.
36
+ * Returns true if the port is free, false if in use.
37
+ */
38
+ function isPortAvailable(port: number, host: string = '127.0.0.1'): Promise<boolean> {
39
+ return new Promise((resolve) => {
40
+ const server = createNetServer();
41
+ server.once('error', () => {
42
+ resolve(false);
43
+ });
44
+ server.listen(port, host, () => {
45
+ server.close(() => {
46
+ resolve(true);
47
+ });
48
+ });
49
+ });
50
+ }
51
+
52
+ /**
53
+ * Kill any process listening on the specified port.
54
+ * Uses lsof on Unix systems to find and kill the process.
55
+ */
56
+ async function killProcessOnPort(
57
+ port: number,
58
+ logger: { debug: (msg: string, ...args: unknown[]) => void }
59
+ ): Promise<boolean> {
60
+ if (process.platform === 'win32') {
61
+ // Windows: use netstat to find PID, then taskkill
62
+ // This is more complex and less reliable, skip for now
63
+ return false;
64
+ }
65
+
66
+ try {
67
+ // Find PIDs listening on the port
68
+ const result = Bun.spawnSync(['lsof', '-t', '-i', `:${port}`], {
69
+ stdout: 'pipe',
70
+ stderr: 'ignore',
71
+ });
72
+
73
+ if (result.exitCode !== 0 || !result.stdout) {
74
+ return false;
75
+ }
76
+
77
+ const pids = new TextDecoder()
78
+ .decode(result.stdout)
79
+ .trim()
80
+ .split('\n')
81
+ .filter((line) => line && /^\d+$/.test(line));
82
+
83
+ if (pids.length === 0) {
84
+ return false;
85
+ }
86
+
87
+ // Kill each process
88
+ for (const pid of pids) {
89
+ try {
90
+ // Use SIGKILL to ensure cleanup
91
+ const killResult = Bun.spawnSync(['kill', '-9', pid], {
92
+ stdout: 'ignore',
93
+ stderr: 'ignore',
94
+ });
95
+ if (killResult.exitCode === 0) {
96
+ logger.debug('Killed orphan process %s on port %d', pid, port);
97
+ }
98
+ } catch {
99
+ // Ignore kill errors
100
+ }
101
+ }
102
+
103
+ // Brief pause to let the port be released
104
+ await new Promise((resolve) => setTimeout(resolve, 100));
105
+ return true;
106
+ } catch {
107
+ return false;
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Ensure the port is available, cleaning up any orphan processes if needed.
113
+ */
114
+ async function ensurePortAvailable(
115
+ port: number,
116
+ logger: { debug: (msg: string, ...args: unknown[]) => void }
117
+ ): Promise<void> {
118
+ const available = await isPortAvailable(port);
119
+ if (available) {
120
+ return;
121
+ }
122
+
123
+ logger.debug('Port %d is in use, attempting to clean up orphan process...', port);
124
+
125
+ const killed = await killProcessOnPort(port, logger);
126
+ if (killed) {
127
+ // Verify the port is now free
128
+ const nowAvailable = await isPortAvailable(port);
129
+ if (!nowAvailable) {
130
+ throw new Error(
131
+ `Port ${port} is still in use after cleanup. Another process may be holding it.\n` +
132
+ `Run 'lsof -i :${port}' to identify the process.`
133
+ );
134
+ }
135
+ logger.debug('Port %d is now available', port);
136
+ } else {
137
+ throw new Error(
138
+ `Port ${port} is already in use.\n` +
139
+ `Run 'lsof -i :${port}' to identify the process, or kill it manually.`
140
+ );
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Validation result for app.ts entry point.
146
+ */
147
+ interface AppValidationResult {
148
+ /** Whether app.ts has a default export */
149
+ hasDefaultExport: boolean;
150
+ /** Whether app.ts calls createApp() */
151
+ hasCreateApp: boolean;
152
+ /** Whether it's the v1 pattern (destructuring without export) */
153
+ isV1Pattern: boolean;
154
+ /** Any validation hints to show */
155
+ hints: string[];
156
+ }
157
+
158
+ /**
159
+ * Validate app.ts for common issues that prevent Bun --hot from starting.
160
+ *
161
+ * Bun --hot requires `export default { fetch, port }` to start a server.
162
+ * Common mistakes:
163
+ * - No `export default` (v1 pattern: destructuring result without exporting)
164
+ * - Calling createApp() but not exporting it
165
+ *
166
+ * @internal Exported for testing only
167
+ */
168
+ export async function validateAppTs(appPath: string): Promise<AppValidationResult> {
169
+ const result: AppValidationResult = {
170
+ hasDefaultExport: false,
171
+ hasCreateApp: false,
172
+ isV1Pattern: false,
173
+ hints: [],
174
+ };
175
+
176
+ const file = Bun.file(appPath);
177
+ if (!(await file.exists())) {
178
+ return result;
179
+ }
180
+
181
+ const content = await file.text();
182
+
183
+ // Strip comments to avoid false positives from commented-out code
184
+ // Simple approach: remove single-line and multi-line comments
185
+ const codeWithoutComments = content
186
+ .replace(/\/\/.*$/gm, '') // Single-line comments
187
+ .replace(/\/\*[\s\S]*?\*\//g, ''); // Multi-line comments
188
+
189
+ // Check for default export patterns (only in actual code, not comments)
190
+ // Matches: export default createApp(...), export default await createApp(...),
191
+ // export default { fetch, port }, const { ... } = await createApp(...) then export default result
192
+ result.hasDefaultExport = /\bexport\s+default\b/.test(codeWithoutComments);
193
+
194
+ // Check for createApp call
195
+ result.hasCreateApp = /\bcreateApp\s*\(/.test(content);
196
+
197
+ // Detect v1 pattern: destructuring createApp result without export default
198
+ // e.g., const { server, logger } = await createApp({...});
199
+ const hasDestructuring = /const\s*\{[^}]*\}\s*=\s*(?:await\s+)?createApp/.test(content);
200
+ if (hasDestructuring && !result.hasDefaultExport) {
201
+ result.isV1Pattern = true;
202
+ result.hints.push(
203
+ 'app.ts calls createApp() but does not export it. Bun --hot requires `export default` to start a server.',
204
+ '',
205
+ 'Fix: Change your app.ts to export the createApp() result:',
206
+ '',
207
+ ' import { createApp } from "@agentuity/runtime";',
208
+ ' import agents from "@agent/index";',
209
+ '',
210
+ ' export default createApp({',
211
+ ' agents,',
212
+ ' router: { path: "/api", router: api },',
213
+ ' });',
214
+ '',
215
+ 'Or if you need the logger:',
216
+ '',
217
+ ' const app = await createApp({ agents });',
218
+ ' app.logger.debug("Running %s", app.server.url);',
219
+ ' export default app;'
220
+ );
221
+ }
222
+
223
+ // Check for missing createApp entirely
224
+ if (!result.hasCreateApp && !content.includes('Bun.serve')) {
225
+ result.hints.push(
226
+ 'app.ts does not call createApp(). This is required for Agentuity apps.',
227
+ '',
228
+ 'Example:',
229
+ '',
230
+ ' import { createApp } from "@agentuity/runtime";',
231
+ ' export default createApp({ agents });'
232
+ );
233
+ }
234
+
235
+ return result;
236
+ }
237
+
238
+ /**
239
+ * Build a detailed error message with validation hints and captured output.
240
+ *
241
+ * @internal Exported for testing only
242
+ */
243
+ export function buildStartupErrorMessage(
244
+ port: number,
245
+ timeoutMs: number,
246
+ stderr: string,
247
+ validation: AppValidationResult
248
+ ): string {
249
+ const lines: string[] = [];
250
+
251
+ lines.push(`Bun server failed to start on port ${port} after ${timeoutMs}ms`);
252
+ lines.push('');
253
+
254
+ // Show captured stderr if any
255
+ if (stderr.trim()) {
256
+ lines.push('Bun output:');
257
+ lines.push('');
258
+ // Indent stderr lines for readability
259
+ for (const line of stderr.trim().split('\n').slice(0, 20)) {
260
+ lines.push(` ${line}`);
261
+ }
262
+ if (stderr.split('\n').length > 20) {
263
+ lines.push(' ... (truncated)');
264
+ }
265
+ lines.push('');
266
+ }
267
+
268
+ // Show validation hints
269
+ if (validation.hints.length > 0) {
270
+ lines.push('Possible issue:');
271
+ lines.push('');
272
+ for (const hint of validation.hints) {
273
+ lines.push(` ${hint}`);
274
+ }
275
+ lines.push('');
276
+ }
277
+
278
+ // Generic troubleshooting if no specific hints
279
+ if (validation.hints.length === 0) {
280
+ lines.push('Troubleshooting:');
281
+ lines.push('');
282
+ lines.push(' 1. Check app.ts exports `export default createApp({...})`');
283
+ lines.push(' 2. Check for TypeScript/syntax errors in your code');
284
+ lines.push(` 3. Check if port ${port} is already in use: lsof -i :${port}`);
285
+ lines.push(' 4. Try running manually: bun run --hot app.ts');
286
+ lines.push('');
287
+ }
288
+
289
+ return lines.join('\n');
290
+ }
291
+
29
292
  /**
30
293
  * Start Bun dev server with --hot (Vite asset server must already be running).
31
294
  *
@@ -45,6 +308,20 @@ export async function startBunDevServer(options: BunDevServerOptions): Promise<B
45
308
  throw new Error(`App entry not found at ${appPath}.`);
46
309
  }
47
310
 
311
+ // Pre-validate app.ts for common issues
312
+ const validation = await validateAppTs(appPath);
313
+ if (validation.isV1Pattern) {
314
+ logger.warn('');
315
+ logger.warn('⚠️ app.ts may have a v1-style pattern that prevents Bun --hot from starting.');
316
+ for (const hint of validation.hints) {
317
+ logger.warn(' %s', hint);
318
+ }
319
+ logger.warn('');
320
+ }
321
+
322
+ // Ensure the port is available, cleaning up any orphan processes
323
+ await ensurePortAvailable(port, logger);
324
+
48
325
  process.env.PORT = String(port);
49
326
 
50
327
  const args: string[] = ['bun'];
@@ -66,10 +343,34 @@ export async function startBunDevServer(options: BunDevServerOptions): Promise<B
66
343
 
67
344
  logger.debug('Spawning bun subprocess: %s', args.join(' '));
68
345
 
346
+ // Capture stderr for error reporting while still showing it in real-time
347
+ const stderrChunks: string[] = [];
348
+ const stdoutChunks: string[] = [];
349
+
350
+ // Helper to read a stream, capture output, and forward to parent
351
+ const captureStream = async (
352
+ stream: ReadableStream<Uint8Array>,
353
+ chunks: string[],
354
+ output: typeof process.stdout | typeof process.stderr
355
+ ) => {
356
+ const reader = stream.getReader();
357
+ try {
358
+ while (true) {
359
+ const { done, value } = await reader.read();
360
+ if (done) break;
361
+ const str = new TextDecoder().decode(value);
362
+ chunks.push(str);
363
+ output.write(value); // Forward to parent for real-time visibility
364
+ }
365
+ } catch {
366
+ // Stream may be closed unexpectedly when process exits
367
+ }
368
+ };
369
+
69
370
  const bunProcess = Bun.spawn(args, {
70
371
  cwd: rootDir,
71
- stdout: 'inherit',
72
- stderr: 'inherit',
372
+ stdout: 'pipe',
373
+ stderr: 'pipe',
73
374
  env: {
74
375
  ...process.env,
75
376
  ...getAgentEnv(),
@@ -77,17 +378,29 @@ export async function startBunDevServer(options: BunDevServerOptions): Promise<B
77
378
  },
78
379
  });
79
380
 
381
+ // Start capturing streams in the background (don't await, we need to check server readiness)
382
+ if (bunProcess.stdout) {
383
+ captureStream(bunProcess.stdout, stdoutChunks, process.stdout).catch(() => {});
384
+ }
385
+ if (bunProcess.stderr) {
386
+ captureStream(bunProcess.stderr, stderrChunks, process.stderr).catch(() => {});
387
+ }
388
+
80
389
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
390
  (globalThis as any).__AGENTUITY_BUN_SUBPROCESS__ = bunProcess;
82
391
 
83
392
  // Wait for server to start listening
84
393
  const maxRetries = 50;
85
394
  const retryDelay = 100;
395
+ const timeoutMs = maxRetries * retryDelay;
86
396
  let serverReady = false;
87
397
 
88
398
  for (let i = 0; i < maxRetries; i++) {
89
399
  if (bunProcess.exitCode !== null) {
90
- throw new Error(`Bun subprocess exited with code ${bunProcess.exitCode} during startup`);
400
+ const stderr = stderrChunks.join('');
401
+ throw new Error(
402
+ `Bun subprocess exited with code ${bunProcess.exitCode} during startup\n\n${stderr}`
403
+ );
91
404
  }
92
405
 
93
406
  try {
@@ -111,9 +424,9 @@ export async function startBunDevServer(options: BunDevServerOptions): Promise<B
111
424
  }
112
425
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
426
  (globalThis as any).__AGENTUITY_BUN_SUBPROCESS__ = undefined;
114
- throw new Error(
115
- `Bun server failed to start on port ${port} after ${maxRetries * retryDelay}ms`
116
- );
427
+
428
+ const stderr = stderrChunks.join('');
429
+ throw new Error(buildStartupErrorMessage(port, timeoutMs, stderr, validation));
117
430
  }
118
431
 
119
432
  logger.debug(`Bun dev server started on http://127.0.0.1:${port} (--hot mode)`);
@@ -1,108 +1,76 @@
1
1
  /**
2
- * Config loader for agentuity.config.ts
2
+ * Config loader for v2
3
+ *
4
+ * In v2, all runtime config (analytics, workbench) goes in createApp().
5
+ * Vite-specific config (plugins, define, render, bundle) goes in vite.config.ts.
6
+ *
7
+ * Runtime config values are extracted from app.ts via app-config-extractor.
3
8
  */
4
9
 
5
- import { join } from 'node:path';
6
10
  import type { Logger } from '../../../types';
7
- import type { AgentuityConfig } from '../../../types';
11
+ import { extractAppConfig, type ExtractedAppConfig } from '../app-config-extractor';
8
12
 
9
13
  /**
10
- * Load agentuity.config.ts from the project root
11
- * Returns null if the file doesn't exist or fails to load
14
+ * Load runtime config from createApp() in app.ts (v2 approach).
15
+ *
16
+ * This is the only way to get analytics/workbench config in v2.
17
+ * The CLI reads these values directly from the user's createApp() call.
12
18
  */
13
- export async function loadAgentuityConfig(
19
+ export async function loadRuntimeConfig(
14
20
  rootDir: string,
15
21
  logger: Logger
16
- ): Promise<AgentuityConfig | null> {
17
- const configPath = join(rootDir, 'agentuity.config.ts');
18
-
19
- if (!(await Bun.file(configPath).exists())) {
20
- logger.trace('No agentuity.config.ts found');
21
- return null;
22
- }
23
-
24
- try {
25
- const config = await import(configPath);
26
- const userConfig = config.default as AgentuityConfig | undefined;
27
-
28
- if (!userConfig) {
29
- logger.warn('agentuity.config.ts does not export a default configuration');
30
- return null;
31
- }
32
-
33
- logger.trace('Loaded agentuity.config.ts');
34
- return userConfig;
35
- } catch (error) {
36
- logger.warn('Failed to load agentuity.config.ts:', error);
37
- return null;
38
- }
22
+ ): Promise<ExtractedAppConfig> {
23
+ return extractAppConfig(rootDir, logger);
39
24
  }
40
25
 
41
26
  /**
42
- * Get workbench configuration with defaults
43
- * NOTE: Workbench is only enabled at runtime in dev mode, but we need to know
44
- * if it's configured at build time so we can generate the correct code.
27
+ * Get workbench configuration with defaults.
45
28
  *
46
- * Presence of workbench config implicitly enables it (no explicit 'enabled' flag needed)
47
- * Missing workbench config implicitly disables it
29
+ * In v2, workbench config is extracted from createApp() in app.ts.
48
30
  */
49
31
  export function getWorkbenchConfig(
50
- config: AgentuityConfig | null,
51
- dev: boolean
32
+ dev: boolean,
33
+ runtimeConfig?: ExtractedAppConfig
52
34
  ): {
53
35
  configured: boolean;
54
36
  enabled: boolean;
55
37
  route: string;
56
38
  headers: Record<string, string>;
57
39
  } {
58
- const configured = config?.workbench !== undefined;
40
+ const workbenchFromRuntime = runtimeConfig?.workbench;
59
41
 
60
42
  // Workbench is enabled if:
61
43
  // 1. In dev mode (never in production)
62
- // 2. Config has a workbench object (presence implies enablement)
63
- const enabled = dev && configured;
44
+ // 2. Workbench is configured in createApp()
45
+ const hasWorkbench = workbenchFromRuntime !== undefined;
46
+ const configured = hasWorkbench;
47
+ const enabled = dev && hasWorkbench;
64
48
 
65
- const workbench = config?.workbench || {};
49
+ // Extract values from createApp()
50
+ let route = '/workbench';
51
+ let headers: Record<string, string> = {};
52
+
53
+ if (workbenchFromRuntime !== undefined) {
54
+ if (typeof workbenchFromRuntime === 'string') {
55
+ route = workbenchFromRuntime;
56
+ } else if (typeof workbenchFromRuntime === 'object' && workbenchFromRuntime !== null) {
57
+ if ('route' in workbenchFromRuntime && typeof workbenchFromRuntime.route === 'string') {
58
+ route = workbenchFromRuntime.route;
59
+ }
60
+ if (
61
+ 'headers' in workbenchFromRuntime &&
62
+ typeof workbenchFromRuntime.headers === 'object'
63
+ ) {
64
+ headers = workbenchFromRuntime.headers as Record<string, string>;
65
+ }
66
+ }
67
+ // boolean true uses defaults
68
+ }
66
69
 
67
70
  return {
68
71
  configured,
69
72
  enabled,
70
- route: workbench.route ?? '/workbench',
71
- headers: workbench.headers ?? {},
73
+ route,
74
+ headers,
72
75
  };
73
76
  }
74
-
75
- /**
76
- * Known Vite framework plugin name prefixes.
77
- * Each framework's Vite plugin registers one or more plugins whose names
78
- * start with these prefixes. We match against these to detect whether the
79
- * user has already configured a framework plugin in their agentuity.config.ts.
80
- */
81
- const FRAMEWORK_PLUGIN_PREFIXES = [
82
- 'vite:react', // @vitejs/plugin-react (vite:react-babel, vite:react-refresh, …)
83
- 'vite:preact', // @preact/preset-vite
84
- 'vite-plugin-svelte', // @sveltejs/vite-plugin-svelte
85
- 'vite:vue', // @vitejs/plugin-vue (vite:vue, vite:vue-jsx)
86
- 'vite-plugin-solid', // vite-plugin-solid
87
- 'solid', // vite-plugin-solid also uses plain "solid"
88
- ];
89
-
90
- /**
91
- * Check if the user's plugins include any known UI-framework Vite plugin
92
- * (React, Svelte, Vue, Solid, Preact, …).
93
- *
94
- * Detection is name-based: Vite plugins expose a `name` property and every
95
- * major framework plugin uses a predictable prefix. This avoids dynamically
96
- * importing every possible framework just to compare names.
97
- */
98
- export function hasFrameworkPlugin(userPlugins: import('vite').PluginOption[]): boolean {
99
- const flat = (userPlugins as unknown[]).flat(Infinity).filter(Boolean);
100
- return flat.some(
101
- (p: unknown) =>
102
- p &&
103
- typeof p === 'object' &&
104
- 'name' in p &&
105
- typeof (p as { name: unknown }).name === 'string' &&
106
- FRAMEWORK_PLUGIN_PREFIXES.some((prefix) => (p as { name: string }).name.startsWith(prefix))
107
- );
108
- }
@@ -17,7 +17,6 @@ import { join } from 'node:path';
17
17
  import { createRequire } from 'node:module';
18
18
  import { mkdirSync, writeFileSync, readFileSync, existsSync, rmSync } from 'node:fs';
19
19
  import type { Logger } from '../../../types';
20
- import { hasFrameworkPlugin } from './config-loader';
21
20
 
22
21
  /** Minimal shape of a TanStack Router route tree node. */
23
22
  interface RouteTreeNode {
@@ -75,8 +74,6 @@ function extractRoutePaths(node: RouteTreeNode): string[] {
75
74
  export interface StaticRenderOptions {
76
75
  rootDir: string;
77
76
  logger: Logger;
78
- /** User plugins from agentuity.config.ts */
79
- userPlugins: import('vite').PluginOption[];
80
77
  }
81
78
 
82
79
  export interface StaticRenderResult {
@@ -85,7 +82,7 @@ export interface StaticRenderResult {
85
82
  }
86
83
 
87
84
  export async function runStaticRender(options: StaticRenderOptions): Promise<StaticRenderResult> {
88
- const { rootDir, logger, userPlugins } = options;
85
+ const { rootDir, logger } = options;
89
86
  const started = Date.now();
90
87
 
91
88
  const clientDir = join(rootDir, '.agentuity/client');
@@ -109,33 +106,52 @@ export async function runStaticRender(options: StaticRenderOptions): Promise<Sta
109
106
  );
110
107
  }
111
108
 
109
+ const isViteDebug =
110
+ process.env.AGENTUITY_VITE_DEBUG === '1' || process.env.AGENTUITY_VITE_DEBUG === 'true';
111
+ if (isViteDebug) {
112
+ logger.debug('Vite debug logging enabled via AGENTUITY_VITE_DEBUG');
113
+ const existing = process.env.DEBUG || '';
114
+ if (!existing.includes('vite:')) {
115
+ process.env.DEBUG = existing ? `${existing},vite:*` : 'vite:*';
116
+ }
117
+ }
118
+
112
119
  // Step 1: Vite SSR build
113
120
  // This resolves import.meta.glob, MDX imports, and other Vite-specific APIs
114
121
  logger.debug('Running Vite SSR build for static rendering...');
115
122
 
116
123
  const projectRequire = createRequire(join(rootDir, 'package.json'));
117
124
  let vitePath = 'vite';
118
- let reactPluginPath = '@vitejs/plugin-react';
119
125
  try {
120
126
  vitePath = projectRequire.resolve('vite');
121
- reactPluginPath = projectRequire.resolve('@vitejs/plugin-react');
122
127
  } catch {
123
128
  // Use CLI's bundled version
124
129
  }
125
130
 
126
- const { build: viteBuild } = await import(vitePath);
127
- const reactModule = await import(reactPluginPath);
128
- const react = reactModule.default;
131
+ const { build: viteBuild, loadConfigFromFile, mergeConfig } = await import(vitePath);
132
+
133
+ // Load vite.config.ts if it exists (v2 approach)
134
+ let userConfig: import('vite').InlineConfig = {};
135
+ const viteConfigPath = join(rootDir, 'vite.config.ts');
129
136
 
130
- // Build plugin list: auto-add React if no framework plugin present
131
- const plugins = [...(userPlugins || [])];
132
- if (plugins.length === 0 || !hasFrameworkPlugin(plugins)) {
133
- plugins.unshift(react());
137
+ if (await Bun.file(viteConfigPath).exists()) {
138
+ try {
139
+ const loaded = await loadConfigFromFile(
140
+ { command: 'build', mode: 'production' },
141
+ viteConfigPath
142
+ );
143
+ if (loaded?.config) {
144
+ userConfig = loaded.config as import('vite').InlineConfig;
145
+ logger.debug('Loaded vite.config.ts for SSR build');
146
+ }
147
+ } catch (error) {
148
+ logger.warn('Failed to load vite.config.ts: %s', error);
149
+ }
134
150
  }
135
151
 
136
- await viteBuild({
152
+ // Merge user config with SSR build settings
153
+ const ssrConfig = mergeConfig(userConfig, {
137
154
  root: rootDir,
138
- plugins,
139
155
  build: {
140
156
  ssr: entryServerPath,
141
157
  outDir: ssrOutDir,
@@ -150,9 +166,11 @@ export async function runStaticRender(options: StaticRenderOptions): Promise<Sta
150
166
  // resolved at build time. Node built-ins are still externalized.
151
167
  noExternal: true,
152
168
  },
153
- logLevel: 'warn',
169
+ logLevel: isViteDebug ? 'info' : 'warn',
154
170
  });
155
171
 
172
+ await viteBuild(ssrConfig);
173
+
156
174
  // Steps 2–4: wrapped in try-finally so SSR artifacts are always cleaned up,
157
175
  // even if an exception is thrown during module import, validation, or rendering.
158
176
  let routeCount = 0;