@agentuity/cli 1.0.1 → 1.0.3

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 (331) hide show
  1. package/AGENTS.md +40 -24
  2. package/bin/cli.ts +47 -22
  3. package/dist/agent-detection.d.ts +23 -38
  4. package/dist/agent-detection.d.ts.map +1 -1
  5. package/dist/agent-detection.js +412 -153
  6. package/dist/agent-detection.js.map +1 -1
  7. package/dist/ai-help.d.ts +23 -0
  8. package/dist/ai-help.d.ts.map +1 -0
  9. package/dist/ai-help.js +328 -0
  10. package/dist/ai-help.js.map +1 -0
  11. package/dist/api.js +1 -1
  12. package/dist/api.js.map +1 -1
  13. package/dist/auth.d.ts +10 -1
  14. package/dist/auth.d.ts.map +1 -1
  15. package/dist/auth.js +176 -16
  16. package/dist/auth.js.map +1 -1
  17. package/dist/banner.d.ts.map +1 -1
  18. package/dist/banner.js +5 -0
  19. package/dist/banner.js.map +1 -1
  20. package/dist/cache/agent-intro.d.ts +13 -0
  21. package/dist/cache/agent-intro.d.ts.map +1 -0
  22. package/dist/cache/agent-intro.js +54 -0
  23. package/dist/cache/agent-intro.js.map +1 -0
  24. package/dist/cache/index.d.ts +1 -0
  25. package/dist/cache/index.d.ts.map +1 -1
  26. package/dist/cache/index.js +1 -0
  27. package/dist/cache/index.js.map +1 -1
  28. package/dist/cache/resource-region.d.ts +3 -2
  29. package/dist/cache/resource-region.d.ts.map +1 -1
  30. package/dist/cache/resource-region.js +13 -4
  31. package/dist/cache/resource-region.js.map +1 -1
  32. package/dist/catalyst.d.ts +7 -0
  33. package/dist/catalyst.d.ts.map +1 -0
  34. package/dist/catalyst.js +15 -0
  35. package/dist/catalyst.js.map +1 -0
  36. package/dist/cli.d.ts +12 -1
  37. package/dist/cli.d.ts.map +1 -1
  38. package/dist/cli.js +290 -67
  39. package/dist/cli.js.map +1 -1
  40. package/dist/cmd/ai/detect.d.ts +3 -0
  41. package/dist/cmd/ai/detect.d.ts.map +1 -0
  42. package/dist/cmd/ai/detect.js +49 -0
  43. package/dist/cmd/ai/detect.js.map +1 -0
  44. package/dist/cmd/ai/index.d.ts.map +1 -1
  45. package/dist/cmd/ai/index.js +18 -1
  46. package/dist/cmd/ai/index.js.map +1 -1
  47. package/dist/cmd/ai/intro.d.ts +7 -0
  48. package/dist/cmd/ai/intro.d.ts.map +1 -0
  49. package/dist/cmd/ai/intro.js +141 -0
  50. package/dist/cmd/ai/intro.js.map +1 -0
  51. package/dist/cmd/ai/opencode/run.d.ts.map +1 -1
  52. package/dist/cmd/ai/opencode/run.js +5 -0
  53. package/dist/cmd/ai/opencode/run.js.map +1 -1
  54. package/dist/cmd/build/ast.d.ts.map +1 -1
  55. package/dist/cmd/build/ast.js +79 -0
  56. package/dist/cmd/build/ast.js.map +1 -1
  57. package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
  58. package/dist/cmd/build/vite/bun-dev-server.js +2 -0
  59. package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
  60. package/dist/cmd/build/vite/docs-generator.d.ts.map +1 -1
  61. package/dist/cmd/build/vite/docs-generator.js +15 -1
  62. package/dist/cmd/build/vite/docs-generator.js.map +1 -1
  63. package/dist/cmd/build/vite/env-types-generator.d.ts +26 -0
  64. package/dist/cmd/build/vite/env-types-generator.d.ts.map +1 -0
  65. package/dist/cmd/build/vite/env-types-generator.js +110 -0
  66. package/dist/cmd/build/vite/env-types-generator.js.map +1 -0
  67. package/dist/cmd/build/vite/index.d.ts +2 -0
  68. package/dist/cmd/build/vite/index.d.ts.map +1 -1
  69. package/dist/cmd/build/vite/index.js +12 -1
  70. package/dist/cmd/build/vite/index.js.map +1 -1
  71. package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +1 -1
  72. package/dist/cmd/build/vite/public-asset-path-plugin.js.map +1 -1
  73. package/dist/cmd/build/vite/vite-builder.d.ts +2 -0
  74. package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
  75. package/dist/cmd/build/vite/vite-builder.js +10 -1
  76. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  77. package/dist/cmd/cloud/db/create.js.map +1 -1
  78. package/dist/cmd/cloud/db/delete.js.map +1 -1
  79. package/dist/cmd/cloud/db/get.d.ts.map +1 -1
  80. package/dist/cmd/cloud/db/get.js +27 -12
  81. package/dist/cmd/cloud/db/get.js.map +1 -1
  82. package/dist/cmd/cloud/deploy-fork.d.ts.map +1 -1
  83. package/dist/cmd/cloud/deploy-fork.js +2 -0
  84. package/dist/cmd/cloud/deploy-fork.js.map +1 -1
  85. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  86. package/dist/cmd/cloud/deploy.js +17 -0
  87. package/dist/cmd/cloud/deploy.js.map +1 -1
  88. package/dist/cmd/cloud/env/import.js.map +1 -1
  89. package/dist/cmd/cloud/env/list.js.map +1 -1
  90. package/dist/cmd/cloud/env/push.js.map +1 -1
  91. package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
  92. package/dist/cmd/cloud/keyvalue/util.js +3 -3
  93. package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
  94. package/dist/cmd/cloud/machine/list.js +3 -3
  95. package/dist/cmd/cloud/machine/list.js.map +1 -1
  96. package/dist/cmd/cloud/region/index.js.map +1 -1
  97. package/dist/cmd/cloud/region-lookup.d.ts +7 -4
  98. package/dist/cmd/cloud/region-lookup.d.ts.map +1 -1
  99. package/dist/cmd/cloud/region-lookup.js +59 -14
  100. package/dist/cmd/cloud/region-lookup.js.map +1 -1
  101. package/dist/cmd/cloud/sandbox/cp.d.ts.map +1 -1
  102. package/dist/cmd/cloud/sandbox/cp.js +7 -5
  103. package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
  104. package/dist/cmd/cloud/sandbox/create.js +2 -2
  105. package/dist/cmd/cloud/sandbox/create.js.map +1 -1
  106. package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
  107. package/dist/cmd/cloud/sandbox/delete.js +8 -7
  108. package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
  109. package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -1
  110. package/dist/cmd/cloud/sandbox/download.js +7 -5
  111. package/dist/cmd/cloud/sandbox/download.js.map +1 -1
  112. package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -1
  113. package/dist/cmd/cloud/sandbox/env.js +7 -5
  114. package/dist/cmd/cloud/sandbox/env.js.map +1 -1
  115. package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
  116. package/dist/cmd/cloud/sandbox/exec.js +7 -5
  117. package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
  118. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  119. package/dist/cmd/cloud/sandbox/get.js +12 -7
  120. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  121. package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
  122. package/dist/cmd/cloud/sandbox/list.js +40 -63
  123. package/dist/cmd/cloud/sandbox/list.js.map +1 -1
  124. package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -1
  125. package/dist/cmd/cloud/sandbox/ls.js +7 -5
  126. package/dist/cmd/cloud/sandbox/ls.js.map +1 -1
  127. package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -1
  128. package/dist/cmd/cloud/sandbox/mkdir.js +7 -5
  129. package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -1
  130. package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -1
  131. package/dist/cmd/cloud/sandbox/rm.js +7 -5
  132. package/dist/cmd/cloud/sandbox/rm.js.map +1 -1
  133. package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -1
  134. package/dist/cmd/cloud/sandbox/rmdir.js +7 -5
  135. package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -1
  136. package/dist/cmd/cloud/sandbox/run.js +1 -1
  137. package/dist/cmd/cloud/sandbox/run.js.map +1 -1
  138. package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
  139. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  140. package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -1
  141. package/dist/cmd/cloud/sandbox/upload.js +7 -5
  142. package/dist/cmd/cloud/sandbox/upload.js.map +1 -1
  143. package/dist/cmd/cloud/sandbox/util.d.ts +2 -2
  144. package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
  145. package/dist/cmd/cloud/sandbox/util.js +14 -13
  146. package/dist/cmd/cloud/sandbox/util.js.map +1 -1
  147. package/dist/cmd/cloud/ssh.d.ts.map +1 -1
  148. package/dist/cmd/cloud/ssh.js +3 -3
  149. package/dist/cmd/cloud/ssh.js.map +1 -1
  150. package/dist/cmd/cloud/storage/create.js.map +1 -1
  151. package/dist/cmd/cloud/storage/delete.js.map +1 -1
  152. package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
  153. package/dist/cmd/cloud/storage/get.js +5 -11
  154. package/dist/cmd/cloud/storage/get.js.map +1 -1
  155. package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
  156. package/dist/cmd/cloud/storage/list.js +6 -6
  157. package/dist/cmd/cloud/storage/list.js.map +1 -1
  158. package/dist/cmd/cloud/stream/create.d.ts.map +1 -1
  159. package/dist/cmd/cloud/stream/create.js +7 -4
  160. package/dist/cmd/cloud/stream/create.js.map +1 -1
  161. package/dist/cmd/cloud/stream/delete.d.ts.map +1 -1
  162. package/dist/cmd/cloud/stream/delete.js +25 -4
  163. package/dist/cmd/cloud/stream/delete.js.map +1 -1
  164. package/dist/cmd/cloud/stream/get.d.ts.map +1 -1
  165. package/dist/cmd/cloud/stream/get.js +91 -62
  166. package/dist/cmd/cloud/stream/get.js.map +1 -1
  167. package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
  168. package/dist/cmd/cloud/stream/list.js +66 -38
  169. package/dist/cmd/cloud/stream/list.js.map +1 -1
  170. package/dist/cmd/cloud/stream/util.d.ts +20 -0
  171. package/dist/cmd/cloud/stream/util.d.ts.map +1 -1
  172. package/dist/cmd/cloud/stream/util.js +27 -3
  173. package/dist/cmd/cloud/stream/util.js.map +1 -1
  174. package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
  175. package/dist/cmd/cloud/vector/util.js +3 -3
  176. package/dist/cmd/cloud/vector/util.js.map +1 -1
  177. package/dist/cmd/dev/index.js.map +1 -1
  178. package/dist/cmd/git/account/add.js.map +1 -1
  179. package/dist/cmd/git/list.js.map +1 -1
  180. package/dist/cmd/project/add/database.d.ts +2 -0
  181. package/dist/cmd/project/add/database.d.ts.map +1 -0
  182. package/dist/cmd/project/add/database.js +123 -0
  183. package/dist/cmd/project/add/database.js.map +1 -0
  184. package/dist/cmd/project/add/domain.d.ts +2 -0
  185. package/dist/cmd/project/add/domain.d.ts.map +1 -0
  186. package/dist/cmd/project/add/domain.js +152 -0
  187. package/dist/cmd/project/add/domain.js.map +1 -0
  188. package/dist/cmd/project/add/index.d.ts +2 -0
  189. package/dist/cmd/project/add/index.d.ts.map +1 -0
  190. package/dist/cmd/project/add/index.js +35 -0
  191. package/dist/cmd/project/add/index.js.map +1 -0
  192. package/dist/cmd/project/add/storage.d.ts +2 -0
  193. package/dist/cmd/project/add/storage.d.ts.map +1 -0
  194. package/dist/cmd/project/add/storage.js +123 -0
  195. package/dist/cmd/project/add/storage.js.map +1 -0
  196. package/dist/cmd/project/auth/init.js.map +1 -1
  197. package/dist/cmd/project/index.d.ts.map +1 -1
  198. package/dist/cmd/project/index.js +7 -0
  199. package/dist/cmd/project/index.js.map +1 -1
  200. package/dist/cmd/project/reconcile.d.ts.map +1 -1
  201. package/dist/cmd/project/reconcile.js +32 -0
  202. package/dist/cmd/project/reconcile.js.map +1 -1
  203. package/dist/cmd/support/report.js.map +1 -1
  204. package/dist/cmd/support/system.js +2 -2
  205. package/dist/cmd/support/system.js.map +1 -1
  206. package/dist/config.d.ts +6 -3
  207. package/dist/config.d.ts.map +1 -1
  208. package/dist/config.js +31 -7
  209. package/dist/config.js.map +1 -1
  210. package/dist/errors.d.ts +2 -1
  211. package/dist/errors.d.ts.map +1 -1
  212. package/dist/errors.js +5 -0
  213. package/dist/errors.js.map +1 -1
  214. package/dist/index.d.ts +4 -1
  215. package/dist/index.d.ts.map +1 -1
  216. package/dist/index.js +3 -0
  217. package/dist/index.js.map +1 -1
  218. package/dist/repl.js +2 -1
  219. package/dist/repl.js.map +1 -1
  220. package/dist/tui/box.d.ts +3 -1
  221. package/dist/tui/box.d.ts.map +1 -1
  222. package/dist/tui/box.js +22 -7
  223. package/dist/tui/box.js.map +1 -1
  224. package/dist/tui/colors.d.ts +0 -3
  225. package/dist/tui/colors.d.ts.map +1 -1
  226. package/dist/tui/colors.js +76 -23
  227. package/dist/tui/colors.js.map +1 -1
  228. package/dist/tui/prompt.d.ts +2 -0
  229. package/dist/tui/prompt.d.ts.map +1 -1
  230. package/dist/tui/prompt.js +44 -3
  231. package/dist/tui/prompt.js.map +1 -1
  232. package/dist/tui/symbols.d.ts +0 -4
  233. package/dist/tui/symbols.d.ts.map +1 -1
  234. package/dist/tui/symbols.js +5 -0
  235. package/dist/tui/symbols.js.map +1 -1
  236. package/dist/tui.d.ts +8 -0
  237. package/dist/tui.d.ts.map +1 -1
  238. package/dist/tui.js +54 -9
  239. package/dist/tui.js.map +1 -1
  240. package/dist/types.d.ts +37 -2
  241. package/dist/types.d.ts.map +1 -1
  242. package/dist/types.js +1 -0
  243. package/dist/types.js.map +1 -1
  244. package/dist/version-check.d.ts.map +1 -1
  245. package/dist/version-check.js +5 -0
  246. package/dist/version-check.js.map +1 -1
  247. package/package.json +6 -6
  248. package/src/agent-detection.ts +457 -160
  249. package/src/ai-help.ts +393 -0
  250. package/src/api.ts +1 -1
  251. package/src/auth.ts +226 -17
  252. package/src/banner.ts +5 -0
  253. package/src/cache/agent-intro.ts +62 -0
  254. package/src/cache/index.ts +2 -0
  255. package/src/cache/resource-region.ts +28 -7
  256. package/src/catalyst.ts +16 -0
  257. package/src/cli.ts +375 -93
  258. package/src/cmd/ai/detect.ts +54 -0
  259. package/src/cmd/ai/index.ts +18 -1
  260. package/src/cmd/ai/intro.ts +154 -0
  261. package/src/cmd/ai/opencode/run.ts +5 -0
  262. package/src/cmd/build/ast.ts +97 -0
  263. package/src/cmd/build/vite/bun-dev-server.ts +2 -0
  264. package/src/cmd/build/vite/docs-generator.ts +15 -1
  265. package/src/cmd/build/vite/env-types-generator.ts +145 -0
  266. package/src/cmd/build/vite/index.ts +15 -0
  267. package/src/cmd/build/vite/public-asset-path-plugin.ts +8 -2
  268. package/src/cmd/build/vite/vite-builder.ts +31 -11
  269. package/src/cmd/cloud/db/create.ts +16 -16
  270. package/src/cmd/cloud/db/delete.ts +19 -19
  271. package/src/cmd/cloud/db/get.ts +32 -17
  272. package/src/cmd/cloud/deploy-fork.ts +2 -0
  273. package/src/cmd/cloud/deploy.ts +17 -0
  274. package/src/cmd/cloud/env/import.ts +6 -6
  275. package/src/cmd/cloud/env/list.ts +11 -11
  276. package/src/cmd/cloud/env/push.ts +6 -6
  277. package/src/cmd/cloud/keyvalue/util.ts +3 -3
  278. package/src/cmd/cloud/machine/list.ts +3 -3
  279. package/src/cmd/cloud/region/index.ts +3 -3
  280. package/src/cmd/cloud/region-lookup.ts +82 -22
  281. package/src/cmd/cloud/sandbox/cp.ts +9 -4
  282. package/src/cmd/cloud/sandbox/create.ts +2 -2
  283. package/src/cmd/cloud/sandbox/delete.ts +10 -7
  284. package/src/cmd/cloud/sandbox/download.ts +8 -5
  285. package/src/cmd/cloud/sandbox/env.ts +8 -5
  286. package/src/cmd/cloud/sandbox/exec.ts +10 -5
  287. package/src/cmd/cloud/sandbox/get.ts +13 -7
  288. package/src/cmd/cloud/sandbox/list.ts +47 -73
  289. package/src/cmd/cloud/sandbox/ls.ts +9 -5
  290. package/src/cmd/cloud/sandbox/mkdir.ts +9 -5
  291. package/src/cmd/cloud/sandbox/rm.ts +9 -5
  292. package/src/cmd/cloud/sandbox/rmdir.ts +9 -5
  293. package/src/cmd/cloud/sandbox/run.ts +1 -1
  294. package/src/cmd/cloud/sandbox/snapshot/build.ts +31 -31
  295. package/src/cmd/cloud/sandbox/snapshot/get.ts +17 -17
  296. package/src/cmd/cloud/sandbox/upload.ts +8 -5
  297. package/src/cmd/cloud/sandbox/util.ts +15 -14
  298. package/src/cmd/cloud/ssh.ts +2 -4
  299. package/src/cmd/cloud/storage/create.ts +16 -16
  300. package/src/cmd/cloud/storage/delete.ts +19 -19
  301. package/src/cmd/cloud/storage/get.ts +5 -16
  302. package/src/cmd/cloud/storage/list.ts +12 -6
  303. package/src/cmd/cloud/stream/create.ts +8 -4
  304. package/src/cmd/cloud/stream/delete.ts +28 -4
  305. package/src/cmd/cloud/stream/get.ts +102 -64
  306. package/src/cmd/cloud/stream/list.ts +76 -44
  307. package/src/cmd/cloud/stream/util.ts +39 -3
  308. package/src/cmd/cloud/vector/util.ts +3 -3
  309. package/src/cmd/dev/index.ts +4 -4
  310. package/src/cmd/git/account/add.ts +5 -5
  311. package/src/cmd/git/list.ts +7 -7
  312. package/src/cmd/project/add/database.ts +145 -0
  313. package/src/cmd/project/add/domain.ts +181 -0
  314. package/src/cmd/project/add/index.ts +35 -0
  315. package/src/cmd/project/add/storage.ts +147 -0
  316. package/src/cmd/project/auth/init.ts +6 -6
  317. package/src/cmd/project/index.ts +7 -0
  318. package/src/cmd/project/reconcile.ts +40 -0
  319. package/src/cmd/support/report.ts +5 -5
  320. package/src/cmd/support/system.ts +2 -2
  321. package/src/config.ts +40 -12
  322. package/src/errors.ts +7 -0
  323. package/src/index.ts +11 -0
  324. package/src/repl.ts +4 -1
  325. package/src/tui/box.ts +24 -9
  326. package/src/tui/colors.ts +83 -26
  327. package/src/tui/prompt.ts +55 -3
  328. package/src/tui/symbols.ts +6 -0
  329. package/src/tui.ts +55 -9
  330. package/src/types.ts +46 -2
  331. package/src/version-check.ts +6 -0
@@ -63,6 +63,8 @@ export interface ViteBuildOptions {
63
63
  deploymentOptions?: DeployOptions;
64
64
  /** Optional collector for structured error reporting */
65
65
  collector?: BuildReportCollector;
66
+ /** Optional config profile name (e.g., 'staging', 'test') for .env.{profile} files */
67
+ profile?: string;
66
68
  }
67
69
 
68
70
  /**
@@ -70,7 +72,15 @@ export interface ViteBuildOptions {
70
72
  * Uses inline Vite config (customizable via agentuity.config.ts)
71
73
  */
72
74
  export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
73
- const { rootDir, mode, dev = false, projectId = '', deploymentId = '', logger } = options;
75
+ const {
76
+ rootDir,
77
+ mode,
78
+ dev = false,
79
+ projectId = '',
80
+ deploymentId = '',
81
+ logger,
82
+ profile,
83
+ } = options;
74
84
 
75
85
  logger.debug(`Running Vite build for mode: ${mode}`);
76
86
 
@@ -93,6 +103,16 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
93
103
  const { generateLifecycleTypes } = await import('./lifecycle-generator');
94
104
  await generateLifecycleTypes(rootDir, srcDir, logger);
95
105
 
106
+ // Generate environment types from local .env files
107
+ const { generateEnvTypes } = await import('./env-types-generator');
108
+ await generateEnvTypes({
109
+ rootDir,
110
+ srcDir,
111
+ logger,
112
+ isProduction: !dev,
113
+ profile,
114
+ });
115
+
96
116
  // Load workbench config for entry file generation
97
117
  const { loadAgentuityConfig, getWorkbenchConfig } = await import('./config-loader');
98
118
  const config = await loadAgentuityConfig(rootDir, logger);
@@ -203,17 +223,17 @@ export async function runViteBuild(options: ViteBuildOptions): Promise<void> {
203
223
  ? JSON.stringify(workbenchRoute)
204
224
  : 'undefined',
205
225
  },
206
- build: {
207
- outDir: clientOutDir,
208
- rollupOptions: {
209
- input: htmlPath,
226
+ build: {
227
+ outDir: clientOutDir,
228
+ rollupOptions: {
229
+ input: htmlPath,
230
+ },
231
+ manifest: true,
232
+ emptyOutDir: true,
233
+ // Copy public files to output for CDN upload (production builds only)
234
+ // In dev mode, Vite serves them directly from src/web/public/
235
+ copyPublicDir: !dev,
210
236
  },
211
- manifest: true,
212
- emptyOutDir: true,
213
- // Copy public files to output for CDN upload (production builds only)
214
- // In dev mode, Vite serves them directly from src/web/public/
215
- copyPublicDir: !dev,
216
- },
217
237
  logLevel: 'warn',
218
238
  };
219
239
  } else if (mode === 'workbench') {
@@ -74,24 +74,24 @@ export const createSubcommand = defineSubcommand({
74
74
  ]);
75
75
  },
76
76
  });
77
- const resource = created[0];
78
- if (resource) {
79
- // Write environment variables to .env if running inside a project
80
- if (ctx.projectDir && resource.env && Object.keys(resource.env).length > 0) {
81
- await addResourceEnvVars(ctx.projectDir, resource.env);
82
- if (!options.json) {
83
- tui.info('Environment variables written to .env');
77
+ const resource = created[0];
78
+ if (resource) {
79
+ // Write environment variables to .env if running inside a project
80
+ if (ctx.projectDir && resource.env && Object.keys(resource.env).length > 0) {
81
+ await addResourceEnvVars(ctx.projectDir, resource.env);
82
+ if (!options.json) {
83
+ tui.info('Environment variables written to .env');
84
+ }
84
85
  }
85
- }
86
86
 
87
- if (!options.json) {
88
- tui.success(`Created database: ${tui.bold(resource.name)}`);
89
- }
90
- return {
91
- success: true,
92
- name: resource.name,
93
- };
94
- } else {
87
+ if (!options.json) {
88
+ tui.success(`Created database: ${tui.bold(resource.name)}`);
89
+ }
90
+ return {
91
+ success: true,
92
+ name: resource.name,
93
+ };
94
+ } else {
95
95
  tui.fatal('Failed to create database');
96
96
  }
97
97
  } catch (ex) {
@@ -178,27 +178,27 @@ export const deleteSubcommand = createSubcommand({
178
178
  },
179
179
  });
180
180
 
181
- const resource = deleted[0];
182
- if (resource) {
183
- // Clear cache entry for deleted database
184
- await deleteResourceRegion('db', profileName, resource.name);
185
-
186
- // Remove env vars from .env if running inside a project
187
- if (ctx.projectDir && resource.env_keys.length > 0) {
188
- await removeResourceEnvVars(ctx.projectDir, resource.env_keys);
189
- if (!options.json) {
190
- tui.info(`Removed ${resource.env_keys.join(', ')} from .env`);
181
+ const resource = deleted[0];
182
+ if (resource) {
183
+ // Clear cache entry for deleted database
184
+ await deleteResourceRegion('db', profileName, resource.name);
185
+
186
+ // Remove env vars from .env if running inside a project
187
+ if (ctx.projectDir && resource.env_keys.length > 0) {
188
+ await removeResourceEnvVars(ctx.projectDir, resource.env_keys);
189
+ if (!options.json) {
190
+ tui.info(`Removed ${resource.env_keys.join(', ')} from .env`);
191
+ }
191
192
  }
192
- }
193
193
 
194
- if (!options.json) {
195
- tui.success(`Deleted database: ${tui.bold(resource.name)}`);
196
- }
197
- return {
198
- success: true,
199
- name: resource.name,
200
- };
201
- } else {
194
+ if (!options.json) {
195
+ tui.success(`Deleted database: ${tui.bold(resource.name)}`);
196
+ }
197
+ return {
198
+ success: true,
199
+ name: resource.name,
200
+ };
201
+ } else {
202
202
  tui.error('Failed to delete database');
203
203
  return { success: false, name: dbName };
204
204
  }
@@ -5,7 +5,7 @@ import * as tui from '../../../tui';
5
5
  import { getGlobalCatalystAPIClient, getCatalystAPIClient } from '../../../config';
6
6
  import { getCommand } from '../../../command-prefix';
7
7
  import { ErrorCode } from '../../../errors';
8
- import { getResourceInfo, setResourceInfo } from '../../../cache';
8
+ import { setResourceInfo } from '../../../cache';
9
9
 
10
10
  const DBGetResponseSchema = z
11
11
  .object({
@@ -27,7 +27,6 @@ export const getSubcommand = createSubcommand({
27
27
  description: 'Show details about a specific database',
28
28
  tags: ['read-only', 'fast', 'requires-auth'],
29
29
  requires: { auth: true },
30
- optional: { org: true },
31
30
  idempotent: true,
32
31
  examples: [
33
32
  { command: `${getCommand('cloud db get')} my-database`, description: 'Get database details' },
@@ -52,6 +51,22 @@ export const getSubcommand = createSubcommand({
52
51
  description: 'Get table schemas as JSON',
53
52
  },
54
53
  ],
54
+ resourceRules: [
55
+ {
56
+ resource: 'org',
57
+ required: false,
58
+ flag: 'org-id',
59
+ envVar: 'AGENTUITY_CLOUD_ORG_ID',
60
+ canUseCache: true,
61
+ },
62
+ {
63
+ resource: 'region',
64
+ required: false,
65
+ flag: 'region',
66
+ envVar: 'AGENTUITY_REGION',
67
+ operationType: 'read',
68
+ },
69
+ ],
55
70
  schema: {
56
71
  args: z.object({
57
72
  name: z.string().describe('Database name'),
@@ -76,30 +91,20 @@ export const getSubcommand = createSubcommand({
76
91
  const profileName = config?.name ?? 'production';
77
92
  const globalClient = await getGlobalCatalystAPIClient(logger, auth, profileName);
78
93
 
79
- // Check cache first for orgId
80
- const cachedInfo = await getResourceInfo('db', profileName, args.name);
81
- const orgId = ctx.orgId ?? cachedInfo?.orgId;
82
-
83
- if (!orgId) {
84
- tui.fatal(
85
- `Organization not found for database '${args.name}'. Run 'agentuity cloud db list' first or specify --org-id.`,
86
- ErrorCode.INVALID_ARGUMENT
87
- );
88
- }
89
-
94
+ // Search across all orgs the user has access to
90
95
  const resources = await tui.spinner({
91
96
  message: `Fetching database ${args.name}`,
92
97
  clearOnSuccess: true,
93
98
  callback: async () => {
94
- return listOrgResources(globalClient, { type: 'db', orgId });
99
+ return listOrgResources(globalClient, { type: 'db' });
95
100
  },
96
101
  });
97
102
 
98
103
  const db = resources.db.find((d) => d.name === args.name);
99
104
 
100
105
  // Cache the database info for future lookups
101
- if (db?.cloud_region) {
102
- await setResourceInfo('db', profileName, db.name, db.cloud_region, orgId);
106
+ if (db?.cloud_region && db.org_id) {
107
+ await setResourceInfo('db', profileName, db.name, db.cloud_region, db.org_id);
103
108
  }
104
109
 
105
110
  if (!db) {
@@ -111,13 +116,23 @@ export const getSubcommand = createSubcommand({
111
116
  if (opts.showTables) {
112
117
  const region = db.cloud_region;
113
118
  const regionalClient = getCatalystAPIClient(logger, auth, region);
119
+
120
+ // Validate org_id is present - dbTables requires orgId for authorization
121
+ // Some internal databases may not have org_id set, which would fail the API call
122
+ if (!db.org_id) {
123
+ tui.fatal(
124
+ `Database '${args.name}' is missing organization information and cannot be queried for tables`,
125
+ ErrorCode.RESOURCE_NOT_FOUND
126
+ );
127
+ }
128
+
114
129
  const tables = await tui.spinner({
115
130
  message: `Fetching table schemas for ${args.name}`,
116
131
  clearOnSuccess: true,
117
132
  callback: async () => {
118
133
  return dbTables(regionalClient, {
119
134
  database: args.name,
120
- orgId,
135
+ orgId: db.org_id,
121
136
  region,
122
137
  });
123
138
  },
@@ -17,6 +17,7 @@ import { existsSync, readFileSync, unlinkSync } from 'node:fs';
17
17
  import type { APIClient } from '../../api';
18
18
  import { getUserAgent } from '../../api';
19
19
  import { isUnicode } from '../../tui/symbols';
20
+ import { getAgentEnv } from '../../agent-detection';
20
21
  import { projectDeploymentFail, type ClientDiagnostics, type Deployment } from '@agentuity/server';
21
22
  import type { Logger } from '@agentuity/core';
22
23
 
@@ -174,6 +175,7 @@ export async function runForkedDeploy(options: ForkDeployOptions): Promise<ForkD
174
175
  cwd: projectDir,
175
176
  env: {
176
177
  ...process.env,
178
+ ...getAgentEnv(),
177
179
  AGENTUITY_FORK_PARENT: '1',
178
180
  AGENTUITY_DEPLOYMENT: deploymentEnvValue,
179
181
  // Force color and unicode output since child stdout/stderr are piped (not TTY)
@@ -106,6 +106,23 @@ export const deploySubcommand = createSubcommand({
106
106
  idempotent: false,
107
107
  requires: { auth: true, project: true, apiClient: true },
108
108
  prerequisites: ['auth login'],
109
+ resourceRules: [
110
+ {
111
+ resource: 'project',
112
+ required: true,
113
+ flag: 'project-id',
114
+ envVar: 'AGENTUITY_CLOUD_PROJECT_ID',
115
+ impliedFrom: 'agentuity.json',
116
+ },
117
+ {
118
+ resource: 'region',
119
+ required: true,
120
+ flag: 'region',
121
+ envVar: 'AGENTUITY_REGION',
122
+ configPref: 'region',
123
+ operationType: 'mutate',
124
+ },
125
+ ],
109
126
  schema: {
110
127
  options: z.intersection(
111
128
  DeployOptionsSchema,
@@ -113,14 +113,14 @@ export const importSubcommand = createSubcommand({
113
113
  tui.warning(
114
114
  `Moving public variables to env: ${publicSecretKeys.join(', ')} (these are exposed to the frontend)`
115
115
  );
116
- for (const key of publicSecretKeys) {
117
- delete secrets[key];
118
- const value = filteredVars[key];
119
- if (value !== undefined) {
120
- env[key] = value;
116
+ for (const key of publicSecretKeys) {
117
+ delete secrets[key];
118
+ const value = filteredVars[key];
119
+ if (value !== undefined) {
120
+ env[key] = value;
121
+ }
121
122
  }
122
123
  }
123
- }
124
124
 
125
125
  const envCount = Object.keys(env).length;
126
126
  const secretCount = Object.keys(secrets).length;
@@ -168,17 +168,17 @@ export const listSubcommand = createSubcommand({
168
168
  const sortedKeys = Object.keys(result).sort();
169
169
  const shouldMask = opts?.mask !== false;
170
170
 
171
- for (const key of sortedKeys) {
172
- const entry = result[key];
173
- if (!entry) continue;
174
- const { value, secret, scope } = entry;
175
- const displayValue = shouldMask && secret ? tui.maskSecret(value) : value;
176
- const typeIndicator = secret ? ' [secret]' : '';
177
- const scopeIndicator = !useOrgScope ? ` [${scope}]` : '';
178
- console.log(
179
- `${tui.bold(key)}=${displayValue}${tui.muted(typeIndicator + scopeIndicator)}`
180
- );
181
- }
171
+ for (const key of sortedKeys) {
172
+ const entry = result[key];
173
+ if (!entry) continue;
174
+ const { value, secret, scope } = entry;
175
+ const displayValue = shouldMask && secret ? tui.maskSecret(value) : value;
176
+ const typeIndicator = secret ? ' [secret]' : '';
177
+ const scopeIndicator = !useOrgScope ? ` [${scope}]` : '';
178
+ console.log(
179
+ `${tui.bold(key)}=${displayValue}${tui.muted(typeIndicator + scopeIndicator)}`
180
+ );
181
+ }
182
182
  }
183
183
  }
184
184
 
@@ -80,14 +80,14 @@ export const pushSubcommand = createSubcommand({
80
80
  tui.warning(
81
81
  `Moving public variables to env: ${publicSecretKeys.join(', ')} (these are exposed to the frontend)`
82
82
  );
83
- for (const key of publicSecretKeys) {
84
- delete secrets[key];
85
- const value = filteredEnv[key];
86
- if (value !== undefined) {
87
- env[key] = value;
83
+ for (const key of publicSecretKeys) {
84
+ delete secrets[key];
85
+ const value = filteredEnv[key];
86
+ if (value !== undefined) {
87
+ env[key] = value;
88
+ }
88
89
  }
89
90
  }
90
- }
91
91
 
92
92
  if (useOrgScope) {
93
93
  // Organization scope
@@ -1,6 +1,7 @@
1
1
  import { KeyValueStorageService, type Logger } from '@agentuity/core';
2
- import { createServerFetchAdapter, getServiceUrls } from '@agentuity/server';
2
+ import { createServerFetchAdapter } from '@agentuity/server';
3
3
  import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../types';
4
+ import { getCatalystUrl } from '../../../catalyst';
4
5
  import * as tui from '../../../tui';
5
6
 
6
7
  export function createStorageAdapter(ctx: {
@@ -31,7 +32,6 @@ export function createStorageAdapter(ctx: {
31
32
  ctx.logger
32
33
  );
33
34
 
34
- const urls = getServiceUrls(ctx.region);
35
- const baseUrl = urls.catalyst;
35
+ const baseUrl = getCatalystUrl(ctx.region);
36
36
  return new KeyValueStorageService(baseUrl, adapter);
37
37
  }
@@ -32,15 +32,15 @@ export const listSubcommand = createSubcommand({
32
32
  },
33
33
  ],
34
34
  aliases: ['ls'],
35
- requires: { auth: true, org: true },
35
+ requires: { auth: true },
36
36
  idempotent: true,
37
37
  schema: {
38
38
  response: MachineListResponseSchema,
39
39
  },
40
40
  async handler(ctx) {
41
- const { options, logger, auth, config, orgId } = ctx;
41
+ const { options, logger, auth, config } = ctx;
42
42
 
43
- const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name, orgId);
43
+ const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
44
44
 
45
45
  try {
46
46
  const machines = await machineList(catalystClient);
@@ -45,9 +45,9 @@ const selectCommand = createSubcommand({
45
45
  );
46
46
  }
47
47
 
48
- if (regions.length === 1 && regions[0]) {
49
- selectedRegion = regions[0].region;
50
- } else {
48
+ if (regions.length === 1 && regions[0]) {
49
+ selectedRegion = regions[0].region;
50
+ } else {
51
51
  const response = await tui.createPrompt().select<string>({
52
52
  message: 'Select a default region',
53
53
  options: regions.map((r) => ({
@@ -1,12 +1,19 @@
1
- import type { Logger } from '@agentuity/core';
2
- import { projectGet, sandboxGet, deploymentGet, type APIClient } from '@agentuity/server';
3
- import { getResourceRegion, setResourceRegion } from '../../cache';
4
- import { getGlobalCatalystAPIClient } from '../../config';
1
+ import { StreamStorageService, type Logger } from '@agentuity/core';
2
+ import {
3
+ projectGet,
4
+ sandboxResolve,
5
+ deploymentGet,
6
+ type APIClient,
7
+ createServerFetchAdapter,
8
+ getServiceUrls,
9
+ } from '@agentuity/server';
10
+ import { getResourceInfo, setResourceInfo } from '../../cache';
11
+ import { getDefaultRegion } from '../../config';
5
12
  import type { AuthData, Config } from '../../types';
6
13
  import * as tui from '../../tui';
7
14
  import { ErrorCode } from '../../errors';
8
15
 
9
- export type IdentifierType = 'project' | 'deployment' | 'sandbox';
16
+ export type IdentifierType = 'project' | 'deployment' | 'sandbox' | 'stream';
10
17
 
11
18
  /**
12
19
  * Determine the type of identifier based on its prefix
@@ -21,18 +28,24 @@ export function getIdentifierType(identifier: string): IdentifierType {
21
28
  if (identifier.startsWith('sbx_')) {
22
29
  return 'sandbox';
23
30
  }
31
+ if (identifier.startsWith('stream_')) {
32
+ return 'stream';
33
+ }
24
34
  // Default to project for unknown prefixes
25
35
  return 'project';
26
36
  }
27
37
 
28
38
  /**
29
- * Look up the region for a project, deployment, or sandbox identifier.
39
+ * Look up the region for a project, deployment, sandbox, or stream identifier.
30
40
  * Uses cache-first strategy with API fallback.
41
+ *
42
+ * @param apiClient - Required for project/deployment lookups, optional for sandbox/stream
43
+ * (they create their own clients internally)
31
44
  */
32
45
  export async function getIdentifierRegion(
33
46
  logger: Logger,
34
47
  auth: AuthData,
35
- apiClient: APIClient,
48
+ apiClient: APIClient | undefined,
36
49
  profileName = 'production',
37
50
  identifier: string,
38
51
  orgId?: string,
@@ -41,10 +54,10 @@ export async function getIdentifierRegion(
41
54
  const identifierType = getIdentifierType(identifier);
42
55
 
43
56
  // For project, deployment, and sandbox, check cache first
44
- const cachedRegion = await getResourceRegion(identifierType, profileName, identifier);
45
- if (cachedRegion) {
46
- logger.trace(`[region-lookup] Found cached region for ${identifier}: ${cachedRegion}`);
47
- return cachedRegion;
57
+ const cachedInfo = await getResourceInfo(identifierType, profileName, identifier);
58
+ if (cachedInfo?.region) {
59
+ logger.trace(`[region-lookup] Found cached region for ${identifier}: ${cachedInfo.region}`);
60
+ return cachedInfo.region;
48
61
  }
49
62
 
50
63
  logger.trace(`[region-lookup] Cache miss for ${identifier}, fetching from API`);
@@ -52,22 +65,69 @@ export async function getIdentifierRegion(
52
65
  let region: string | null = null;
53
66
 
54
67
  if (identifierType === 'project') {
68
+ if (!apiClient) {
69
+ tui.fatal(
70
+ `API client required for project region lookup. This is an internal error.`,
71
+ ErrorCode.INVALID_ARGUMENT
72
+ );
73
+ }
55
74
  const project = await projectGet(apiClient, { id: identifier, mask: true, keys: false });
56
75
  region = project.cloudRegion ?? null;
57
76
  } else if (identifierType === 'deployment') {
77
+ if (!apiClient) {
78
+ tui.fatal(
79
+ `API client required for deployment region lookup. This is an internal error.`,
80
+ ErrorCode.INVALID_ARGUMENT
81
+ );
82
+ }
58
83
  const deployment = await deploymentGet(apiClient, identifier);
59
84
  region = deployment.cloudRegion ?? null;
85
+ } else if (identifierType === 'sandbox') {
86
+ // sandbox - use CLI API to resolve across all orgs the user has access to
87
+ if (!apiClient) {
88
+ tui.fatal(
89
+ `API client required for sandbox region lookup. This is an internal error.`,
90
+ ErrorCode.INVALID_ARGUMENT
91
+ );
92
+ }
93
+ const sandbox = await sandboxResolve(apiClient, identifier);
94
+ region = sandbox.region ?? null;
95
+ // Cache the orgId along with the region for future lookups
96
+ if (sandbox.orgId) {
97
+ orgId = sandbox.orgId;
98
+ }
60
99
  } else {
61
- // sandbox - pass config to getGlobalCatalystAPIClient for proper region resolution
62
- const globalClient = await getGlobalCatalystAPIClient(
63
- logger,
64
- auth,
65
- profileName,
66
- orgId,
67
- config
100
+ // stream - use the streams service to look up stream info
101
+ // Any regional streams service can look up any stream and return its info
102
+ // The service authenticates based on user's org membership, no explicit orgId needed
103
+ const defaultRegion = await getDefaultRegion(profileName, config);
104
+ const baseUrl = getServiceUrls(defaultRegion).stream;
105
+
106
+ // Include orgId if available, but don't require it
107
+ const resolvedOrgId =
108
+ orgId ?? process.env.AGENTUITY_CLOUD_ORG_ID ?? config?.preferences?.orgId;
109
+
110
+ const adapter = createServerFetchAdapter(
111
+ {
112
+ headers: {
113
+ Authorization: `Bearer ${auth.apiKey}`,
114
+ },
115
+ queryParams: resolvedOrgId ? { orgId: resolvedOrgId } : undefined,
116
+ },
117
+ logger
68
118
  );
69
- const sandbox = await sandboxGet(globalClient, { sandboxId: identifier, orgId });
70
- region = sandbox.region ?? null;
119
+
120
+ const streamService = new StreamStorageService(baseUrl, adapter);
121
+ const streamInfo = await streamService.get(identifier);
122
+
123
+ // Extract region from the stream URL (e.g., https://streams-use.agentuity.cloud/...)
124
+ const urlMatch = streamInfo.url.match(/https:\/\/streams-([^.]+)\.agentuity\.cloud/);
125
+ if (urlMatch?.[1]) {
126
+ region = urlMatch[1];
127
+ } else if (streamInfo.url.includes('streams.agentuity.io')) {
128
+ // Local environment
129
+ region = 'local';
130
+ }
71
131
  }
72
132
 
73
133
  if (!region) {
@@ -86,7 +146,7 @@ export async function getIdentifierRegion(
86
146
  }
87
147
 
88
148
  // Cache the result
89
- await setResourceRegion(identifierType, profileName, identifier, region);
149
+ await setResourceInfo(identifierType, profileName, identifier, region, orgId);
90
150
  logger.trace(`[region-lookup] Cached region for ${identifier}: ${region}`);
91
151
 
92
152
  return region;
@@ -100,5 +160,5 @@ export async function cacheProjectRegion(
100
160
  projectId: string,
101
161
  region: string
102
162
  ): Promise<void> {
103
- await setResourceRegion('project', profileName, projectId, region);
163
+ await setResourceInfo('project', profileName, projectId, region);
104
164
  }
@@ -3,13 +3,14 @@ import { readFileSync, writeFileSync, mkdirSync, statSync, readdirSync } from 'n
3
3
  import { dirname, resolve, basename, join, relative } from 'node:path';
4
4
  import { createCommand } from '../../../types';
5
5
  import * as tui from '../../../tui';
6
- import { getSandboxRegion, createSandboxClient } from './util';
6
+ import { createSandboxClient } from './util';
7
7
  import { getCommand } from '../../../command-prefix';
8
8
  import {
9
9
  sandboxWriteFiles,
10
10
  sandboxReadFile,
11
11
  sandboxExecute,
12
12
  executionGet,
13
+ sandboxResolve,
13
14
  type APIClient,
14
15
  } from '@agentuity/server';
15
16
  import type { Logger, FileToWrite } from '@agentuity/core';
@@ -47,7 +48,7 @@ export const cpSubcommand = createCommand({
47
48
  aliases: ['copy'],
48
49
  description: 'Copy files or directories to or from a sandbox',
49
50
  tags: ['slow', 'requires-auth'],
50
- requires: { auth: true, org: true },
51
+ requires: { auth: true, apiClient: true },
51
52
  examples: [
52
53
  {
53
54
  command: getCommand('cloud sandbox cp ./local-file.txt snbx_abc123:/path/to/file.txt'),
@@ -84,7 +85,7 @@ export const cpSubcommand = createCommand({
84
85
  },
85
86
 
86
87
  async handler(ctx) {
87
- const { args, opts, options, auth, logger, orgId, config } = ctx;
88
+ const { args, opts, options, auth, logger, apiClient } = ctx;
88
89
 
89
90
  const source = parsePath(args.source);
90
91
  const destination = parsePath(args.destination);
@@ -102,7 +103,11 @@ export const cpSubcommand = createCommand({
102
103
  }
103
104
 
104
105
  const sandboxId = source.sandboxId ?? destination.sandboxId!;
105
- const region = await getSandboxRegion(logger, auth, config?.name, sandboxId, orgId);
106
+
107
+ // Resolve sandbox to get region and orgId using CLI API
108
+ const sandboxInfo = await sandboxResolve(apiClient, sandboxId);
109
+ const { region, orgId } = sandboxInfo;
110
+
106
111
  const client = createSandboxClient(logger, auth, region);
107
112
  const recursive = opts.recursive ?? false;
108
113
 
@@ -147,7 +147,7 @@ export const createSubcommand = createCommand({
147
147
  }
148
148
  }
149
149
 
150
- const files = parseFileArgs(opts.file);
150
+ const files = await parseFileArgs(opts.file);
151
151
  const hasFiles = files.length > 0;
152
152
 
153
153
  let metadata: Record<string, unknown> | undefined;
@@ -185,7 +185,7 @@ export const createSubcommand = createCommand({
185
185
  : undefined,
186
186
  timeout: opts.idleTimeout ? { idle: opts.idleTimeout } : undefined,
187
187
  env: Object.keys(envMap).length > 0 ? envMap : undefined,
188
- command: hasFiles ? { exec: [], files } : undefined,
188
+ files: hasFiles ? files : undefined,
189
189
  snapshot: opts.snapshot,
190
190
  dependencies: opts.dependency,
191
191
  metadata,