@agentuity/cli 2.0.11 → 3.0.0-alpha.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 (339) hide show
  1. package/dist/cmd/ai/prompt/index.d.ts.map +1 -1
  2. package/dist/cmd/ai/prompt/index.js +2 -7
  3. package/dist/cmd/ai/prompt/index.js.map +1 -1
  4. package/dist/cmd/build/adapters/generic.d.ts +29 -0
  5. package/dist/cmd/build/adapters/generic.d.ts.map +1 -0
  6. package/dist/cmd/build/adapters/generic.js +190 -0
  7. package/dist/cmd/build/adapters/generic.js.map +1 -0
  8. package/dist/cmd/build/adapters/index.d.ts +15 -0
  9. package/dist/cmd/build/adapters/index.d.ts.map +1 -0
  10. package/dist/cmd/build/adapters/index.js +24 -0
  11. package/dist/cmd/build/adapters/index.js.map +1 -0
  12. package/dist/cmd/build/adapters/nextjs.d.ts +11 -0
  13. package/dist/cmd/build/adapters/nextjs.d.ts.map +1 -0
  14. package/dist/cmd/build/adapters/nextjs.js +118 -0
  15. package/dist/cmd/build/adapters/nextjs.js.map +1 -0
  16. package/dist/cmd/build/adapters/static-server.d.ts +23 -0
  17. package/dist/cmd/build/adapters/static-server.d.ts.map +1 -0
  18. package/dist/cmd/build/adapters/static-server.js +137 -0
  19. package/dist/cmd/build/adapters/static-server.js.map +1 -0
  20. package/dist/cmd/build/adapters/types.d.ts +71 -0
  21. package/dist/cmd/build/adapters/types.d.ts.map +1 -0
  22. package/dist/cmd/build/adapters/types.js +8 -0
  23. package/dist/cmd/build/adapters/types.js.map +1 -0
  24. package/dist/cmd/build/detect/engine.d.ts +24 -0
  25. package/dist/cmd/build/detect/engine.d.ts.map +1 -0
  26. package/dist/cmd/build/detect/engine.js +91 -0
  27. package/dist/cmd/build/detect/engine.js.map +1 -0
  28. package/dist/cmd/build/detect/frameworks.d.ts +66 -0
  29. package/dist/cmd/build/detect/frameworks.d.ts.map +1 -0
  30. package/dist/cmd/build/detect/frameworks.js +278 -0
  31. package/dist/cmd/build/detect/frameworks.js.map +1 -0
  32. package/dist/cmd/build/detect/generic.d.ts +13 -0
  33. package/dist/cmd/build/detect/generic.d.ts.map +1 -0
  34. package/dist/cmd/build/detect/generic.js +62 -0
  35. package/dist/cmd/build/detect/generic.js.map +1 -0
  36. package/dist/cmd/build/detect/index.d.ts +27 -0
  37. package/dist/cmd/build/detect/index.d.ts.map +1 -0
  38. package/dist/cmd/build/detect/index.js +76 -0
  39. package/dist/cmd/build/detect/index.js.map +1 -0
  40. package/dist/cmd/build/detect/types.d.ts +91 -0
  41. package/dist/cmd/build/detect/types.d.ts.map +1 -0
  42. package/dist/cmd/build/detect/types.js +9 -0
  43. package/dist/cmd/build/detect/types.js.map +1 -0
  44. package/dist/cmd/build/detect/util.d.ts +41 -0
  45. package/dist/cmd/build/detect/util.d.ts.map +1 -0
  46. package/dist/cmd/build/detect/util.js +101 -0
  47. package/dist/cmd/build/detect/util.js.map +1 -0
  48. package/dist/cmd/build/index.d.ts.map +1 -1
  49. package/dist/cmd/build/index.js +49 -22
  50. package/dist/cmd/build/index.js.map +1 -1
  51. package/dist/cmd/build/package/index.d.ts +30 -0
  52. package/dist/cmd/build/package/index.d.ts.map +1 -0
  53. package/dist/cmd/build/package/index.js +39 -0
  54. package/dist/cmd/build/package/index.js.map +1 -0
  55. package/dist/cmd/build/package/launch.d.ts +56 -0
  56. package/dist/cmd/build/package/launch.d.ts.map +1 -0
  57. package/dist/cmd/build/package/launch.js +56 -0
  58. package/dist/cmd/build/package/launch.js.map +1 -0
  59. package/dist/cmd/build/typecheck.d.ts.map +1 -1
  60. package/dist/cmd/build/typecheck.js +8 -0
  61. package/dist/cmd/build/typecheck.js.map +1 -1
  62. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  63. package/dist/cmd/cloud/deploy.js +63 -13
  64. package/dist/cmd/cloud/deploy.js.map +1 -1
  65. package/dist/cmd/coder/create.js +7 -7
  66. package/dist/cmd/coder/create.js.map +1 -1
  67. package/dist/cmd/coder/update.js +8 -8
  68. package/dist/cmd/coder/update.js.map +1 -1
  69. package/dist/cmd/coder/workspace/create.js +9 -9
  70. package/dist/cmd/coder/workspace/create.js.map +1 -1
  71. package/dist/cmd/dev/index.d.ts +9 -0
  72. package/dist/cmd/dev/index.d.ts.map +1 -1
  73. package/dist/cmd/dev/index.js +127 -923
  74. package/dist/cmd/dev/index.js.map +1 -1
  75. package/dist/cmd/project/auth/shared.d.ts.map +1 -1
  76. package/dist/cmd/project/auth/shared.js +14 -38
  77. package/dist/cmd/project/auth/shared.js.map +1 -1
  78. package/dist/cmd/project/create.d.ts.map +1 -1
  79. package/dist/cmd/project/create.js +12 -19
  80. package/dist/cmd/project/create.js.map +1 -1
  81. package/dist/cmd/project/frameworks-ai-examples.d.ts +15 -0
  82. package/dist/cmd/project/frameworks-ai-examples.d.ts.map +1 -0
  83. package/dist/cmd/project/frameworks-ai-examples.js +160 -0
  84. package/dist/cmd/project/frameworks-ai-examples.js.map +1 -0
  85. package/dist/cmd/project/frameworks-landing-pages.d.ts +17 -0
  86. package/dist/cmd/project/frameworks-landing-pages.d.ts.map +1 -0
  87. package/dist/cmd/project/frameworks-landing-pages.js +242 -0
  88. package/dist/cmd/project/frameworks-landing-pages.js.map +1 -0
  89. package/dist/cmd/project/frameworks.d.ts +58 -0
  90. package/dist/cmd/project/frameworks.d.ts.map +1 -0
  91. package/dist/cmd/project/frameworks.js +152 -0
  92. package/dist/cmd/project/frameworks.js.map +1 -0
  93. package/dist/cmd/project/reconcile.d.ts.map +1 -1
  94. package/dist/cmd/project/reconcile.js +10 -23
  95. package/dist/cmd/project/reconcile.js.map +1 -1
  96. package/dist/cmd/project/remote-import.js +1 -1
  97. package/dist/cmd/project/scaffold.d.ts +58 -0
  98. package/dist/cmd/project/scaffold.d.ts.map +1 -0
  99. package/dist/cmd/project/scaffold.js +223 -0
  100. package/dist/cmd/project/scaffold.js.map +1 -0
  101. package/dist/cmd/project/template-flow.d.ts +8 -4
  102. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  103. package/dist/cmd/project/template-flow.js +93 -144
  104. package/dist/cmd/project/template-flow.js.map +1 -1
  105. package/dist/deploy-metadata.d.ts +49 -0
  106. package/dist/deploy-metadata.d.ts.map +1 -0
  107. package/dist/deploy-metadata.js +183 -0
  108. package/dist/deploy-metadata.js.map +1 -0
  109. package/dist/index.d.ts +1 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js.map +1 -1
  112. package/dist/types.d.ts +24 -30
  113. package/dist/types.d.ts.map +1 -1
  114. package/dist/types.js.map +1 -1
  115. package/package.json +13 -8
  116. package/src/cmd/ai/prompt/index.ts +2 -7
  117. package/src/cmd/build/adapters/generic.ts +239 -0
  118. package/src/cmd/build/adapters/index.ts +30 -0
  119. package/src/cmd/build/adapters/nextjs.ts +146 -0
  120. package/src/cmd/build/adapters/static-server.ts +143 -0
  121. package/src/cmd/build/adapters/types.ts +93 -0
  122. package/src/cmd/build/detect/engine.ts +111 -0
  123. package/src/cmd/build/detect/frameworks.ts +335 -0
  124. package/src/cmd/build/detect/generic.ts +71 -0
  125. package/src/cmd/build/detect/index.ts +122 -0
  126. package/src/cmd/build/detect/types.ts +109 -0
  127. package/src/cmd/build/detect/util.ts +104 -0
  128. package/src/cmd/build/index.ts +64 -24
  129. package/src/cmd/build/package/index.ts +66 -0
  130. package/src/cmd/build/package/launch.ts +104 -0
  131. package/src/cmd/build/typecheck.ts +9 -0
  132. package/src/cmd/cloud/deploy.ts +86 -13
  133. package/src/cmd/coder/create.ts +8 -8
  134. package/src/cmd/coder/update.ts +7 -7
  135. package/src/cmd/coder/workspace/create.ts +10 -10
  136. package/src/cmd/dev/index.ts +155 -1059
  137. package/src/cmd/project/auth/shared.ts +14 -39
  138. package/src/cmd/project/create.ts +14 -19
  139. package/src/cmd/project/frameworks-ai-examples.ts +166 -0
  140. package/src/cmd/project/frameworks-landing-pages.ts +267 -0
  141. package/src/cmd/project/frameworks.ts +223 -0
  142. package/src/cmd/project/reconcile.ts +10 -22
  143. package/src/cmd/project/remote-import.ts +1 -1
  144. package/src/cmd/project/scaffold.ts +300 -0
  145. package/src/cmd/project/template-flow.ts +102 -156
  146. package/src/deploy-metadata.ts +253 -0
  147. package/src/index.ts +0 -2
  148. package/src/types.ts +0 -31
  149. package/dist/agents-docs.d.ts +0 -23
  150. package/dist/agents-docs.d.ts.map +0 -1
  151. package/dist/agents-docs.js +0 -56
  152. package/dist/agents-docs.js.map +0 -1
  153. package/dist/cmd/ai/prompt/agent.d.ts +0 -10
  154. package/dist/cmd/ai/prompt/agent.d.ts.map +0 -1
  155. package/dist/cmd/ai/prompt/agent.js +0 -28
  156. package/dist/cmd/ai/prompt/agent.js.map +0 -1
  157. package/dist/cmd/build/app-router-detector.d.ts +0 -39
  158. package/dist/cmd/build/app-router-detector.d.ts.map +0 -1
  159. package/dist/cmd/build/app-router-detector.js +0 -229
  160. package/dist/cmd/build/app-router-detector.js.map +0 -1
  161. package/dist/cmd/build/format-schema.d.ts +0 -6
  162. package/dist/cmd/build/format-schema.d.ts.map +0 -1
  163. package/dist/cmd/build/format-schema.js +0 -60
  164. package/dist/cmd/build/format-schema.js.map +0 -1
  165. package/dist/cmd/build/vite/agent-discovery.d.ts +0 -37
  166. package/dist/cmd/build/vite/agent-discovery.d.ts.map +0 -1
  167. package/dist/cmd/build/vite/agent-discovery.js +0 -263
  168. package/dist/cmd/build/vite/agent-discovery.js.map +0 -1
  169. package/dist/cmd/build/vite/beacon-plugin.d.ts +0 -19
  170. package/dist/cmd/build/vite/beacon-plugin.d.ts.map +0 -1
  171. package/dist/cmd/build/vite/beacon-plugin.js +0 -137
  172. package/dist/cmd/build/vite/beacon-plugin.js.map +0 -1
  173. package/dist/cmd/build/vite/browser-env-plugin.d.ts +0 -9
  174. package/dist/cmd/build/vite/browser-env-plugin.d.ts.map +0 -1
  175. package/dist/cmd/build/vite/browser-env-plugin.js +0 -28
  176. package/dist/cmd/build/vite/browser-env-plugin.js.map +0 -1
  177. package/dist/cmd/build/vite/bun-dev-server.d.ts +0 -67
  178. package/dist/cmd/build/vite/bun-dev-server.d.ts.map +0 -1
  179. package/dist/cmd/build/vite/bun-dev-server.js +0 -340
  180. package/dist/cmd/build/vite/bun-dev-server.js.map +0 -1
  181. package/dist/cmd/build/vite/bundle-files.d.ts +0 -12
  182. package/dist/cmd/build/vite/bundle-files.d.ts.map +0 -1
  183. package/dist/cmd/build/vite/bundle-files.js +0 -107
  184. package/dist/cmd/build/vite/bundle-files.js.map +0 -1
  185. package/dist/cmd/build/vite/config-loader.d.ts +0 -29
  186. package/dist/cmd/build/vite/config-loader.d.ts.map +0 -1
  187. package/dist/cmd/build/vite/config-loader.js +0 -57
  188. package/dist/cmd/build/vite/config-loader.js.map +0 -1
  189. package/dist/cmd/build/vite/db-rewrite.d.ts +0 -50
  190. package/dist/cmd/build/vite/db-rewrite.d.ts.map +0 -1
  191. package/dist/cmd/build/vite/db-rewrite.js +0 -169
  192. package/dist/cmd/build/vite/db-rewrite.js.map +0 -1
  193. package/dist/cmd/build/vite/docs-generator.d.ts +0 -13
  194. package/dist/cmd/build/vite/docs-generator.d.ts.map +0 -1
  195. package/dist/cmd/build/vite/docs-generator.js +0 -97
  196. package/dist/cmd/build/vite/docs-generator.js.map +0 -1
  197. package/dist/cmd/build/vite/env-types-generator.d.ts +0 -26
  198. package/dist/cmd/build/vite/env-types-generator.d.ts.map +0 -1
  199. package/dist/cmd/build/vite/env-types-generator.js +0 -110
  200. package/dist/cmd/build/vite/env-types-generator.js.map +0 -1
  201. package/dist/cmd/build/vite/index.d.ts +0 -3
  202. package/dist/cmd/build/vite/index.d.ts.map +0 -1
  203. package/dist/cmd/build/vite/index.js +0 -4
  204. package/dist/cmd/build/vite/index.js.map +0 -1
  205. package/dist/cmd/build/vite/lifecycle-generator.d.ts +0 -19
  206. package/dist/cmd/build/vite/lifecycle-generator.d.ts.map +0 -1
  207. package/dist/cmd/build/vite/lifecycle-generator.js +0 -328
  208. package/dist/cmd/build/vite/lifecycle-generator.js.map +0 -1
  209. package/dist/cmd/build/vite/metadata-generator.d.ts +0 -36
  210. package/dist/cmd/build/vite/metadata-generator.d.ts.map +0 -1
  211. package/dist/cmd/build/vite/metadata-generator.js +0 -575
  212. package/dist/cmd/build/vite/metadata-generator.js.map +0 -1
  213. package/dist/cmd/build/vite/prompt-generator.d.ts +0 -23
  214. package/dist/cmd/build/vite/prompt-generator.d.ts.map +0 -1
  215. package/dist/cmd/build/vite/prompt-generator.js +0 -123
  216. package/dist/cmd/build/vite/prompt-generator.js.map +0 -1
  217. package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +0 -45
  218. package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +0 -1
  219. package/dist/cmd/build/vite/public-asset-path-plugin.js +0 -166
  220. package/dist/cmd/build/vite/public-asset-path-plugin.js.map +0 -1
  221. package/dist/cmd/build/vite/route-discovery.d.ts +0 -64
  222. package/dist/cmd/build/vite/route-discovery.d.ts.map +0 -1
  223. package/dist/cmd/build/vite/route-discovery.js +0 -187
  224. package/dist/cmd/build/vite/route-discovery.js.map +0 -1
  225. package/dist/cmd/build/vite/server-bundler.d.ts +0 -20
  226. package/dist/cmd/build/vite/server-bundler.d.ts.map +0 -1
  227. package/dist/cmd/build/vite/server-bundler.js +0 -388
  228. package/dist/cmd/build/vite/server-bundler.js.map +0 -1
  229. package/dist/cmd/build/vite/static-renderer.d.ts +0 -26
  230. package/dist/cmd/build/vite/static-renderer.d.ts.map +0 -1
  231. package/dist/cmd/build/vite/static-renderer.js +0 -188
  232. package/dist/cmd/build/vite/static-renderer.js.map +0 -1
  233. package/dist/cmd/build/vite/tailwind-source-plugin.d.ts +0 -15
  234. package/dist/cmd/build/vite/tailwind-source-plugin.d.ts.map +0 -1
  235. package/dist/cmd/build/vite/tailwind-source-plugin.js +0 -61
  236. package/dist/cmd/build/vite/tailwind-source-plugin.js.map +0 -1
  237. package/dist/cmd/build/vite/vite-asset-server-config.d.ts +0 -24
  238. package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +0 -1
  239. package/dist/cmd/build/vite/vite-asset-server-config.js +0 -285
  240. package/dist/cmd/build/vite/vite-asset-server-config.js.map +0 -1
  241. package/dist/cmd/build/vite/vite-asset-server.d.ts +0 -30
  242. package/dist/cmd/build/vite/vite-asset-server.d.ts.map +0 -1
  243. package/dist/cmd/build/vite/vite-asset-server.js +0 -109
  244. package/dist/cmd/build/vite/vite-asset-server.js.map +0 -1
  245. package/dist/cmd/build/vite/vite-builder.d.ts +0 -59
  246. package/dist/cmd/build/vite/vite-builder.d.ts.map +0 -1
  247. package/dist/cmd/build/vite/vite-builder.js +0 -401
  248. package/dist/cmd/build/vite/vite-builder.js.map +0 -1
  249. package/dist/cmd/build/vite/workbench-generator.d.ts +0 -10
  250. package/dist/cmd/build/vite/workbench-generator.d.ts.map +0 -1
  251. package/dist/cmd/build/vite/workbench-generator.js +0 -135
  252. package/dist/cmd/build/vite/workbench-generator.js.map +0 -1
  253. package/dist/cmd/build/vite/ws-proxy.d.ts +0 -53
  254. package/dist/cmd/build/vite/ws-proxy.d.ts.map +0 -1
  255. package/dist/cmd/build/vite/ws-proxy.js +0 -95
  256. package/dist/cmd/build/vite/ws-proxy.js.map +0 -1
  257. package/dist/cmd/build/vite-bundler.d.ts +0 -29
  258. package/dist/cmd/build/vite-bundler.d.ts.map +0 -1
  259. package/dist/cmd/build/vite-bundler.js +0 -93
  260. package/dist/cmd/build/vite-bundler.js.map +0 -1
  261. package/dist/cmd/dev/agents.d.ts +0 -2
  262. package/dist/cmd/dev/agents.d.ts.map +0 -1
  263. package/dist/cmd/dev/agents.js +0 -123
  264. package/dist/cmd/dev/agents.js.map +0 -1
  265. package/dist/cmd/dev/api.d.ts +0 -20
  266. package/dist/cmd/dev/api.d.ts.map +0 -1
  267. package/dist/cmd/dev/api.js +0 -42
  268. package/dist/cmd/dev/api.js.map +0 -1
  269. package/dist/cmd/dev/dev-lock.d.ts +0 -62
  270. package/dist/cmd/dev/dev-lock.d.ts.map +0 -1
  271. package/dist/cmd/dev/dev-lock.js +0 -250
  272. package/dist/cmd/dev/dev-lock.js.map +0 -1
  273. package/dist/cmd/dev/download.d.ts +0 -11
  274. package/dist/cmd/dev/download.d.ts.map +0 -1
  275. package/dist/cmd/dev/download.js +0 -94
  276. package/dist/cmd/dev/download.js.map +0 -1
  277. package/dist/cmd/dev/file-watcher.d.ts +0 -24
  278. package/dist/cmd/dev/file-watcher.d.ts.map +0 -1
  279. package/dist/cmd/dev/file-watcher.js +0 -349
  280. package/dist/cmd/dev/file-watcher.js.map +0 -1
  281. package/dist/cmd/dev/process-manager.d.ts +0 -104
  282. package/dist/cmd/dev/process-manager.d.ts.map +0 -1
  283. package/dist/cmd/dev/process-manager.js +0 -204
  284. package/dist/cmd/dev/process-manager.js.map +0 -1
  285. package/dist/cmd/dev/sync.d.ts +0 -12
  286. package/dist/cmd/dev/sync.d.ts.map +0 -1
  287. package/dist/cmd/dev/sync.js +0 -227
  288. package/dist/cmd/dev/sync.js.map +0 -1
  289. package/dist/cmd/dev/templates.d.ts +0 -3
  290. package/dist/cmd/dev/templates.d.ts.map +0 -1
  291. package/dist/cmd/dev/templates.js +0 -58
  292. package/dist/cmd/dev/templates.js.map +0 -1
  293. package/dist/cmd/project/download.d.ts +0 -35
  294. package/dist/cmd/project/download.d.ts.map +0 -1
  295. package/dist/cmd/project/download.js +0 -403
  296. package/dist/cmd/project/download.js.map +0 -1
  297. package/dist/cmd/project/templates.d.ts +0 -9
  298. package/dist/cmd/project/templates.d.ts.map +0 -1
  299. package/dist/cmd/project/templates.js +0 -34
  300. package/dist/cmd/project/templates.js.map +0 -1
  301. package/src/agents-docs.ts +0 -86
  302. package/src/cmd/ai/prompt/agent.md +0 -305
  303. package/src/cmd/ai/prompt/agent.ts +0 -31
  304. package/src/cmd/build/app-router-detector.ts +0 -320
  305. package/src/cmd/build/format-schema.ts +0 -66
  306. package/src/cmd/build/vite/agent-discovery.ts +0 -380
  307. package/src/cmd/build/vite/beacon-plugin.ts +0 -164
  308. package/src/cmd/build/vite/browser-env-plugin.ts +0 -34
  309. package/src/cmd/build/vite/bun-dev-server.ts +0 -458
  310. package/src/cmd/build/vite/bundle-files.ts +0 -135
  311. package/src/cmd/build/vite/config-loader.ts +0 -76
  312. package/src/cmd/build/vite/db-rewrite.ts +0 -189
  313. package/src/cmd/build/vite/docs-generator.ts +0 -103
  314. package/src/cmd/build/vite/env-types-generator.ts +0 -145
  315. package/src/cmd/build/vite/index.ts +0 -3
  316. package/src/cmd/build/vite/lifecycle-generator.ts +0 -381
  317. package/src/cmd/build/vite/metadata-generator.ts +0 -713
  318. package/src/cmd/build/vite/prompt-generator.ts +0 -169
  319. package/src/cmd/build/vite/public-asset-path-plugin.ts +0 -209
  320. package/src/cmd/build/vite/route-discovery.ts +0 -271
  321. package/src/cmd/build/vite/server-bundler.ts +0 -481
  322. package/src/cmd/build/vite/static-renderer.ts +0 -239
  323. package/src/cmd/build/vite/tailwind-source-plugin.ts +0 -73
  324. package/src/cmd/build/vite/vite-asset-server-config.ts +0 -349
  325. package/src/cmd/build/vite/vite-asset-server.ts +0 -154
  326. package/src/cmd/build/vite/vite-builder.ts +0 -503
  327. package/src/cmd/build/vite/workbench-generator.ts +0 -152
  328. package/src/cmd/build/vite/ws-proxy.ts +0 -126
  329. package/src/cmd/build/vite-bundler.ts +0 -137
  330. package/src/cmd/dev/agents.ts +0 -140
  331. package/src/cmd/dev/api.ts +0 -65
  332. package/src/cmd/dev/dev-lock.ts +0 -332
  333. package/src/cmd/dev/download.ts +0 -117
  334. package/src/cmd/dev/file-watcher.ts +0 -423
  335. package/src/cmd/dev/process-manager.ts +0 -261
  336. package/src/cmd/dev/sync.ts +0 -411
  337. package/src/cmd/dev/templates.ts +0 -66
  338. package/src/cmd/project/download.ts +0 -505
  339. package/src/cmd/project/templates.ts +0 -56
@@ -1,66 +0,0 @@
1
- /**
2
- * Simple formatter for schema code strings.
3
- * Adds basic indentation and line breaks for readability.
4
- */
5
- export function formatSchemaCode(code: string): string {
6
- if (!code) return code;
7
-
8
- let indentLevel = 0;
9
- const indentSize = 2;
10
- const lines: string[] = [];
11
- let currentLine = '';
12
-
13
- for (let i = 0; i < code.length; i++) {
14
- const char = code[i];
15
- const nextChar = code[i + 1];
16
- const prevChar = i > 0 ? code[i - 1] : '';
17
-
18
- // Skip existing whitespace/newlines
19
- if (char === '\n' || char === '\r' || (char === ' ' && prevChar === ' ')) {
20
- continue;
21
- }
22
-
23
- // Handle opening braces
24
- if (char === '{') {
25
- currentLine += char;
26
- lines.push(' '.repeat(indentLevel * indentSize) + currentLine.trim());
27
- indentLevel++;
28
- currentLine = '';
29
- continue;
30
- }
31
-
32
- // Handle closing braces
33
- if (char === '}') {
34
- if (currentLine.trim()) {
35
- lines.push(' '.repeat(indentLevel * indentSize) + currentLine.trim());
36
- currentLine = '';
37
- }
38
- indentLevel--;
39
- // Check if next char is closing paren - if so, put on same line
40
- if (nextChar === ')') {
41
- currentLine = '}';
42
- } else {
43
- lines.push(' '.repeat(indentLevel * indentSize) + char);
44
- }
45
- continue;
46
- }
47
-
48
- // Handle commas - add line break after
49
- if (char === ',') {
50
- currentLine += char;
51
- lines.push(' '.repeat(indentLevel * indentSize) + currentLine.trim());
52
- currentLine = '';
53
- continue;
54
- }
55
-
56
- // Accumulate characters
57
- currentLine += char;
58
- }
59
-
60
- // Add any remaining content
61
- if (currentLine.trim()) {
62
- lines.push(' '.repeat(indentLevel * indentSize) + currentLine.trim());
63
- }
64
-
65
- return lines.join('\n');
66
- }
@@ -1,380 +0,0 @@
1
- /**
2
- * Agent Discovery — import-based
3
- *
4
- * Discovers agents by scanning src/agent/**\/*.ts files and importing them
5
- * at build time. The agent instance already knows its own metadata, schemas,
6
- * and evals — no AST parsing needed.
7
- */
8
-
9
- import { dirname, join, relative } from 'node:path';
10
- import type { Logger } from '../../../types';
11
- import { StructuredError } from '@agentuity/core';
12
- import { toForwardSlash } from '../../../utils/normalize-path';
13
-
14
- const DuplicateEvalNameError = StructuredError('DuplicateEvalNameError')<{
15
- agent: string;
16
- filename: string;
17
- }>();
18
-
19
- export interface AgentMetadata {
20
- filename: string;
21
- name: string;
22
- id: string;
23
- agentId: string;
24
- version: string;
25
- description?: string;
26
- inputSchemaCode?: string;
27
- outputSchemaCode?: string;
28
- evals?: EvalMetadata[];
29
- }
30
-
31
- export interface EvalMetadata {
32
- id: string;
33
- identifier: string;
34
- name: string;
35
- filename: string;
36
- version: string;
37
- description?: string;
38
- agentIdentifier: string;
39
- projectId: string;
40
- }
41
-
42
- /**
43
- * Hash function for generating stable IDs
44
- */
45
- function hash(...val: string[]): string {
46
- const hasher = new Bun.CryptoHasher('sha256');
47
- for (const v of val) hasher.update(v);
48
- return hasher.digest().toHex();
49
- }
50
-
51
- function hashSHA1(...val: string[]): string {
52
- const hasher = new Bun.CryptoHasher('sha1');
53
- for (const v of val) hasher.update(v);
54
- return hasher.digest().toHex();
55
- }
56
-
57
- function getAgentId(
58
- projectId: string,
59
- deploymentId: string,
60
- filename: string,
61
- version: string
62
- ): string {
63
- return `agentid_${hashSHA1(projectId, deploymentId, filename, version)}`;
64
- }
65
-
66
- function generateStableAgentId(projectId: string, name: string): string {
67
- return `agent_${hashSHA1(projectId, name)}`.substring(0, 64);
68
- }
69
-
70
- function getEvalId(
71
- projectId: string,
72
- deploymentId: string,
73
- filename: string,
74
- name: string,
75
- version: string
76
- ): string {
77
- return `evalid_${hashSHA1(projectId, deploymentId, filename, name, version)}`;
78
- }
79
-
80
- function generateStableEvalId(projectId: string, agentId: string, name: string): string {
81
- return `eval_${hashSHA1(projectId, agentId, name)}`.substring(0, 64);
82
- }
83
-
84
- /**
85
- * Convert a StandardSchemaV1-compatible schema to a JSON Schema string.
86
- * Dynamically imports toJSONSchema from @agentuity/schema (available in user's project).
87
- */
88
- async function schemaToJsonString(
89
- schema: unknown,
90
- rootDir: string,
91
- logger: Logger
92
- ): Promise<string | undefined> {
93
- if (!schema) return undefined;
94
-
95
- try {
96
- // Resolve @agentuity/schema from the user's project and import its public entry point.
97
- // The CLI doesn't declare @agentuity/schema as its own dependency — it lives in the
98
- // user's node_modules, so we resolve the path dynamically.
99
- const schemaPackageDir = join(rootDir, 'node_modules', '@agentuity', 'schema');
100
- if (!(await Bun.file(join(schemaPackageDir, 'package.json')).exists())) {
101
- logger.debug('[agent-discovery] @agentuity/schema not found in user project');
102
- return undefined;
103
- }
104
-
105
- const { toJSONSchema } = await import(schemaPackageDir);
106
- const jsonSchema = toJSONSchema(schema);
107
- return JSON.stringify(jsonSchema);
108
- } catch (error) {
109
- logger.debug(
110
- '[agent-discovery] Failed to convert schema to JSON Schema: %s',
111
- error instanceof Error ? error.message : String(error)
112
- );
113
- return undefined;
114
- }
115
- }
116
-
117
- /**
118
- * Import an agent file and extract metadata from the agent instance.
119
- */
120
- async function importAgentMetadata(
121
- filePath: string,
122
- relativeFilename: string,
123
- rootDir: string,
124
- projectId: string,
125
- deploymentId: string,
126
- logger: Logger
127
- ): Promise<AgentMetadata | null> {
128
- try {
129
- const source = await Bun.file(filePath).text();
130
- const version = hash(source);
131
-
132
- // Import the agent file — Bun handles TS natively
133
- // No source-level gate: files may re-export agents created elsewhere
134
- const mod = await import(filePath);
135
- const agent = mod.default;
136
-
137
- if (!agent?.metadata?.name) {
138
- logger.debug('[agent-discovery] No valid agent found in %s', relativeFilename);
139
- return null;
140
- }
141
-
142
- const name = agent.metadata.name;
143
- const description = agent.metadata.description;
144
- const id = getAgentId(projectId, deploymentId, relativeFilename, version);
145
- const agentId = generateStableAgentId(projectId, name);
146
-
147
- // Extract schemas as JSON Schema strings
148
- const inputSchemaCode = await schemaToJsonString(agent.inputSchema, rootDir, logger);
149
- const outputSchemaCode = await schemaToJsonString(agent.outputSchema, rootDir, logger);
150
-
151
- // Extract evals from agent.evals array (self-registered by createEval())
152
- const evals: EvalMetadata[] = [];
153
- if (agent.evals && Array.isArray(agent.evals) && agent.evals.length > 0) {
154
- for (const evalItem of agent.evals) {
155
- const evalName = evalItem.metadata?.name ?? evalItem.name;
156
- if (!evalName) continue;
157
-
158
- const evalDescription = evalItem.metadata?.description ?? evalItem.description;
159
- const evalVersion = version; // same file version
160
- const evalId = getEvalId(
161
- projectId,
162
- deploymentId,
163
- relativeFilename,
164
- evalName,
165
- evalVersion
166
- );
167
- const evalIdentifier = generateStableEvalId(projectId, agentId, evalName);
168
-
169
- logger.trace(
170
- 'Found eval "%s" in %s (identifier: %s)',
171
- evalName,
172
- relativeFilename,
173
- evalIdentifier
174
- );
175
-
176
- evals.push({
177
- id: evalId,
178
- identifier: evalIdentifier,
179
- name: evalName,
180
- filename: relativeFilename,
181
- version: evalVersion,
182
- description: evalDescription,
183
- agentIdentifier: agentId,
184
- projectId,
185
- });
186
- }
187
- }
188
-
189
- // Also check for evals in separate eval.ts file in same directory
190
- const agentDir = dirname(filePath);
191
- const evalsPath = join(agentDir, 'eval.ts');
192
- if (await Bun.file(evalsPath).exists()) {
193
- const evalsSource = await Bun.file(evalsPath).text();
194
- if (evalsSource.includes('createEval')) {
195
- try {
196
- await import(evalsPath);
197
- // After importing, the evals self-register on the agent via agent.createEval()
198
- // Re-check agent.evals for any newly registered evals
199
- if (agent.evals && Array.isArray(agent.evals)) {
200
- const relativeEvalsPath = toForwardSlash(relative(join(rootDir), evalsPath));
201
- const evalVersion = hash(evalsSource);
202
-
203
- for (const evalItem of agent.evals) {
204
- const evalName = evalItem.metadata?.name ?? evalItem.name;
205
- if (!evalName) continue;
206
-
207
- // Skip if already collected from agent file
208
- if (evals.some((e) => e.name === evalName)) continue;
209
-
210
- const evalDescription = evalItem.metadata?.description ?? evalItem.description;
211
- const evalId = getEvalId(
212
- projectId,
213
- deploymentId,
214
- relativeEvalsPath,
215
- evalName,
216
- evalVersion
217
- );
218
- const evalIdentifier = generateStableEvalId(projectId, agentId, evalName);
219
-
220
- logger.trace(
221
- 'Found eval "%s" in eval.ts for agent %s (identifier: %s)',
222
- evalName,
223
- name,
224
- evalIdentifier
225
- );
226
-
227
- evals.push({
228
- id: evalId,
229
- identifier: evalIdentifier,
230
- name: evalName,
231
- filename: relativeEvalsPath,
232
- version: evalVersion,
233
- description: evalDescription,
234
- agentIdentifier: agentId,
235
- projectId,
236
- });
237
- }
238
- }
239
- } catch (error) {
240
- logger.warn(
241
- '[agent-discovery] Failed to import evals from %s: %s',
242
- evalsPath,
243
- error instanceof Error ? error.message : String(error)
244
- );
245
- }
246
- }
247
- }
248
-
249
- // Check for duplicate eval names across sources (agent file + eval.ts).
250
- // Same name + same agent = same stable identifier → duplicate key error
251
- // on the backend database.
252
- if (evals.length > 1) {
253
- const seen = new Map<string, string>();
254
- for (const evalItem of evals) {
255
- const prev = seen.get(evalItem.name);
256
- if (prev && prev !== evalItem.filename) {
257
- throw new DuplicateEvalNameError({
258
- message:
259
- `Duplicate eval name '${evalItem.name}' for agent '${name}': ` +
260
- `defined in both '${prev}' and '${evalItem.filename}'. ` +
261
- 'Eval names must be unique per agent.',
262
- agent: name,
263
- filename: evalItem.filename,
264
- });
265
- }
266
- seen.set(evalItem.name, evalItem.filename);
267
- }
268
- }
269
-
270
- return {
271
- filename: relativeFilename,
272
- name,
273
- id,
274
- agentId,
275
- version,
276
- description,
277
- inputSchemaCode,
278
- outputSchemaCode,
279
- evals: evals.length > 0 ? evals : undefined,
280
- };
281
- } catch (error) {
282
- const errorMsg = error instanceof Error ? error.message : String(error);
283
- throw new Error(
284
- `Failed to import agent at ${relativeFilename}:\n` +
285
- ` ${errorMsg}\n\n` +
286
- `Agent files are imported at build time to extract metadata. Code that ` +
287
- `runs at module scope (outside of setup() or handler()) will execute ` +
288
- `during the build — including SDK client constructors that require API ` +
289
- `keys or environment variables.\n\n` +
290
- `To fix this, move initialization code into setup() or handler():\n\n` +
291
- ` // ❌ Don't do this — runs at import time:\n` +
292
- ` const client = new OpenAI();\n` +
293
- ` export default createAgent('my-agent', { handler: async (ctx) => { ... } });\n\n` +
294
- ` // ✅ Do this instead — runs at startup:\n` +
295
- ` export default createAgent('my-agent', {\n` +
296
- ` setup: async () => ({ client: new OpenAI() }),\n` +
297
- ` handler: async (ctx) => { const { client } = ctx.config; ... },\n` +
298
- ` });\n\n` +
299
- `See https://agentuity.dev/agents/creating-agents for more information.`
300
- );
301
- }
302
- }
303
-
304
- /**
305
- * Discover all agents in src/agent directory.
306
- *
307
- * Imports each agent file at build time — the agent instance already knows
308
- * its own metadata, schemas, and evals. No AST parsing needed.
309
- */
310
- export async function discoverAgents(
311
- srcDir: string,
312
- projectId: string,
313
- deploymentId: string,
314
- logger: Logger
315
- ): Promise<AgentMetadata[]> {
316
- const agentsDir = join(srcDir, 'agent');
317
- const agents: AgentMetadata[] = [];
318
- const rootDir = join(srcDir, '..');
319
-
320
- // Scan all .ts files in agent directory
321
- const glob = new Bun.Glob('**/*.ts');
322
- let files: string[];
323
- try {
324
- files = await Array.fromAsync(glob.scan(agentsDir));
325
- } catch {
326
- logger.trace('No agent directory found at %s', agentsDir);
327
- return agents;
328
- }
329
-
330
- // Track seen agent names to deduplicate — e.g., index.ts re-exporting agent.ts
331
- const seenAgentNames = new Set<string>();
332
-
333
- for (const file of files) {
334
- const filePath = join(agentsDir, file);
335
-
336
- // Skip eval.ts files (processed as part of agent discovery)
337
- if (file.endsWith('/eval.ts') || file === 'eval.ts') {
338
- continue;
339
- }
340
-
341
- // Skip test files (*.test.ts, *.spec.ts) and test directories
342
- if (
343
- file.startsWith('test/') ||
344
- file.includes('/test/') ||
345
- file.startsWith('__tests__/') ||
346
- file.includes('/__tests__/') ||
347
- file.endsWith('.test.ts') ||
348
- file.endsWith('.spec.ts')
349
- ) {
350
- continue;
351
- }
352
-
353
- const relativeFilename = toForwardSlash(relative(rootDir, filePath));
354
- const agentMetadata = await importAgentMetadata(
355
- filePath,
356
- relativeFilename,
357
- rootDir,
358
- projectId,
359
- deploymentId,
360
- logger
361
- );
362
-
363
- if (agentMetadata) {
364
- if (seenAgentNames.has(agentMetadata.name)) {
365
- logger.trace(
366
- 'Skipping duplicate agent %s from %s (already discovered)',
367
- agentMetadata.name,
368
- relativeFilename
369
- );
370
- continue;
371
- }
372
- seenAgentNames.add(agentMetadata.name);
373
- logger.trace('Discovered agent: %s at %s', agentMetadata.name, relativeFilename);
374
- agents.push(agentMetadata);
375
- }
376
- }
377
-
378
- logger.debug('Discovered %d agent(s)', agents.length);
379
- return agents;
380
- }
@@ -1,164 +0,0 @@
1
- /**
2
- * Vite plugin to emit the analytics beacon as a hashed CDN asset
3
- *
4
- * This plugin:
5
- * 1. Reads the pre-built beacon from @agentuity/frontend
6
- * 2. Emits it as a Rollup asset with content-based hashing
7
- * 3. Injects a <script data-agentuity-beacon> tag into the HTML
8
- */
9
-
10
- import type { Plugin, ResolvedConfig } from 'vite';
11
- import { join } from 'node:path';
12
- import { createRequire } from 'node:module';
13
-
14
- export interface BeaconPluginOptions {
15
- /** Whether analytics is enabled */
16
- enabled: boolean;
17
- }
18
-
19
- /**
20
- * Read the pre-built beacon script from @agentuity/frontend package
21
- * @param projectRoot - The root directory of the project (for resolving node_modules)
22
- */
23
- async function readBeaconScript(projectRoot: string): Promise<string> {
24
- let frontendPath: string | null = null;
25
-
26
- // Strategy 1: Use Bun.resolve (works with workspaces and symlinks)
27
- try {
28
- frontendPath = await Bun.resolve('@agentuity/frontend', projectRoot);
29
- } catch {
30
- // Not found from project root
31
- }
32
-
33
- // Strategy 2: Try from this file's directory (for installed CLI case)
34
- if (!frontendPath) {
35
- try {
36
- const thisDir = new URL('.', import.meta.url).pathname;
37
- frontendPath = await Bun.resolve('@agentuity/frontend', thisDir);
38
- } catch {
39
- // Not found from CLI directory
40
- }
41
- }
42
-
43
- // Strategy 3: Fallback to createRequire for Node.js compatibility
44
- if (!frontendPath) {
45
- try {
46
- const projectRequire = createRequire(join(projectRoot, 'package.json'));
47
- frontendPath = projectRequire.resolve('@agentuity/frontend');
48
- } catch {
49
- // Not found via createRequire
50
- }
51
- }
52
-
53
- if (!frontendPath) {
54
- throw new Error(
55
- 'Could not resolve @agentuity/frontend. Ensure the package is installed and built.'
56
- );
57
- }
58
-
59
- // The beacon.js file is in the dist folder of @agentuity/frontend
60
- // frontendPath points to dist/index.js, so we go up one level
61
- const packageDir = join(frontendPath, '..');
62
- const beaconPath = join(packageDir, 'beacon.js');
63
-
64
- const beaconFile = Bun.file(beaconPath);
65
- if (!(await beaconFile.exists())) {
66
- throw new Error(
67
- `Beacon script not found at ${beaconPath}. Run "bun run build" in @agentuity/frontend first.`
68
- );
69
- }
70
-
71
- return beaconFile.text();
72
- }
73
-
74
- /**
75
- * Vite plugin that emits the analytics beacon as a hashed asset
76
- * and injects a script tag into the HTML
77
- */
78
- export function beaconPlugin(options: BeaconPluginOptions): Plugin {
79
- const { enabled } = options;
80
-
81
- let resolvedConfig: ResolvedConfig | null = null;
82
- let beaconReferenceId: string | null = null;
83
-
84
- return {
85
- name: 'agentuity:beacon',
86
- apply: 'build',
87
-
88
- configResolved(config) {
89
- resolvedConfig = config;
90
- },
91
-
92
- async buildStart() {
93
- if (!enabled) return;
94
-
95
- try {
96
- // Get project root from Vite config
97
- const projectRoot = resolvedConfig?.root || process.cwd();
98
- const beaconCode = await readBeaconScript(projectRoot);
99
-
100
- // Emit the beacon as an asset - Rollup will hash it
101
- beaconReferenceId = this.emitFile({
102
- type: 'asset',
103
- name: 'agentuity-beacon.js',
104
- source: beaconCode,
105
- });
106
- } catch (error) {
107
- this.error(
108
- `Failed to read beacon script: ${error instanceof Error ? error.message : String(error)}`
109
- );
110
- }
111
- },
112
-
113
- // Use transformIndexHtml hook to modify the HTML
114
- // This is called during the HTML transformation phase and works with Vite's HTML pipeline
115
- transformIndexHtml: {
116
- order: 'post',
117
- handler(html, ctx) {
118
- if (!enabled || !beaconReferenceId) return html;
119
-
120
- // Get the final hashed filename using the bundle from the context
121
- // We need to use ctx.bundle to access the emitted file
122
- const bundle = ctx.bundle;
123
- if (!bundle) return html;
124
-
125
- // Find our beacon asset in the bundle
126
- let beaconFileName: string | null = null;
127
- for (const fileName of Object.keys(bundle)) {
128
- if (fileName.includes('agentuity-beacon') && fileName.endsWith('.js')) {
129
- beaconFileName = fileName;
130
- break;
131
- }
132
- }
133
-
134
- if (!beaconFileName) return html;
135
-
136
- // Build the beacon URL using Vite's configured base (respects CDN URL)
137
- // resolvedConfig.base is e.g., "https://cdn.agentuity.com/{deploymentId}/client/" or "/"
138
- const base = resolvedConfig?.base || '/';
139
- // Normalize: ensure base ends with / and beaconFileName doesn't start with /
140
- const normalizedBase = base.endsWith('/') ? base : `${base}/`;
141
- const normalizedFileName = beaconFileName.startsWith('/')
142
- ? beaconFileName.slice(1)
143
- : beaconFileName;
144
- const beaconUrl = `${normalizedBase}${normalizedFileName}`;
145
-
146
- // Inject a marker script tag
147
- // The script must be sync (no async/defer) to patch history API before router loads
148
- // Use data-agentuity-beacon attribute as a marker for config/session injection
149
- const beaconScript = `<script data-agentuity-beacon src="${beaconUrl}"></script>`;
150
-
151
- // Inject before </head>
152
- if (html.includes('</head>')) {
153
- return html.replace('</head>', `${beaconScript}</head>`);
154
- }
155
- // Fallback: inject at start of body
156
- if (html.includes('<body')) {
157
- return html.replace(/<body([^>]*)>/, `<body$1>${beaconScript}`);
158
- }
159
-
160
- return beaconScript + html;
161
- },
162
- },
163
- };
164
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * Vite plugin to shim process.env for browser code only
3
- *
4
- * Replaces process.env with import.meta.env ONLY in files under src/web
5
- * to avoid breaking server-side code that needs real process.env
6
- */
7
-
8
- import type { Plugin } from 'vite';
9
-
10
- export function browserEnvPlugin(): Plugin {
11
- return {
12
- name: 'agentuity:browser-env',
13
- enforce: 'pre',
14
-
15
- transform(code, id) {
16
- // Only transform files in src/web (browser code)
17
- if (!id.includes('/src/web/') && !id.includes('\\src\\web\\')) {
18
- return null;
19
- }
20
-
21
- // Replace process.env with import.meta.env for browser compatibility
22
- const transformed = code.replace(/process\.env/g, 'import.meta.env');
23
-
24
- if (transformed !== code) {
25
- return {
26
- code: transformed,
27
- map: null,
28
- };
29
- }
30
-
31
- return null;
32
- },
33
- };
34
- }